Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is failing Details

Test_IRC_Net10
he 2026-04-22 09:49:13 +08:00
commit 4d7ad9255a
3 changed files with 48 additions and 26 deletions

View File

@ -71,6 +71,7 @@ public static class CacheKeys
public static string TrialDataStoreType(Guid trialId) => $"TrialDataStoreType:{trialId}";
public static string UserQCSkipTask(Guid userId) => $"UserSKipQCTask:{userId}";
}
public static class CacheHelper

View File

@ -113,6 +113,9 @@ namespace IRaCIS.Core.Application.Contracts
public Guid SubjectId { get; set; }
[NotDefault]
public Guid SubjectVisitId { get; set; }
public bool IsSkipCurrentVisit { get; set; }
}
public class GetNextIQCQualityOutDto

View File

@ -8,6 +8,7 @@ using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using Medallion.Threading;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Org.BouncyCastle.Asn1.Cmp;
@ -1297,6 +1298,21 @@ namespace IRaCIS.Core.Application.Image.QA
var isDistinguishType = trialConfig.IsIQCAutoNextTask && trialConfig.IsIQCAutoTaskDistinguishType;
if (inDto.IsSkipCurrentVisit)
{
string cacheKey = CacheKeys.UserQCSkipTask(_userInfo.UserRoleId);
// 获取当前缓存中的访视Id集合如果没有则创建空集合
var skippedVisits = await _fusionCache.GetOrDefaultAsync<List<Guid>>(cacheKey, new List<Guid>());
// 如果当前访视Id不在集合中则添加
if (!skippedVisits.Contains(inDto.SubjectVisitId))
{
skippedVisits.Add(inDto.SubjectVisitId);
await _fusionCache.SetAsync(cacheKey, skippedVisits, TimeSpan.FromMinutes(60));
}
}
if (isDistinguishType == false)
{
//不区分任务类型,也要按照当前任务类型给,没找到,按照默认规则给任务 无质疑 普通质控任务
@ -1348,17 +1364,25 @@ namespace IRaCIS.Core.Application.Image.QA
.Where(t => t.Subject.Status != SubjectStatus.EndOfVisit)
.WhereIf(isDistinguishType, t => isSecondReview == true ? t.SecondReviewState == SecondReviewState.WaitAudit : t.SecondReviewState == SecondReviewState.None)
.WhereIf(isDistinguishType, t => ishaveQCChallenge == true ? t.QCChallengeList.Any() : !t.QCChallengeList.Any())
.Select(t => new { t.IsUrgent, SubjectCode = t.Subject.Code, t.SubjectId, t.Id, t.VisitNum, IshaveQCChallenge = t.QCChallengeList.Any(), t.SecondReviewState })
.Select(t => new { t.IsUrgent, SubjectCode = t.Subject.Code, t.SubjectId, SubjectVisitId = t.Id, t.VisitNum, IshaveQCChallenge = t.QCChallengeList.Any(), t.SecondReviewState })
.OrderBy(t => t.IshaveQCChallenge).ThenBy(t => t.SecondReviewState).ThenBy(x => x.IsUrgent).ThenBy(x => x.SubjectCode).ThenBy(x => x.VisitNum).ToListAsync();
// 获取当前缓存中的访视Id集合如果没有则创建空集合
var skippedVisits = await _fusionCache.GetOrDefaultAsync<List<Guid>>(CacheKeys.UserQCSkipTask(_userInfo.UserRoleId), new List<Guid>() { inDto.SubjectVisitId });
//跳过当前访视
if (inDto.IsSkipCurrentVisit)
{
currentActionList = currentActionList.Where(t => !skippedVisits.Contains(t.SubjectVisitId)).ToList();
}
if (currentActionList.Count() > 0)
{
return new GetNextIQCQualityOutDto()
{
IsReceived = true,
SubjectId = currentActionList[0].SubjectId,
VisitId = currentActionList[0].Id,
VisitId = currentActionList[0].SubjectVisitId,
};
}
@ -1392,19 +1416,16 @@ namespace IRaCIS.Core.Application.Image.QA
.Where(x => x.SubmitState == SubmitStateEnum.Submitted && x.TrialId == inDto.TrialId && x.CurrentActionUserId == null)
//.WhereIf(isSecondReview, t => t.PreliminaryAuditUserId != null)
//.Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.UserRoleId)
.Select(t => new { t.IsUrgent, SubjectCode = t.Subject.Code, t.SubjectId, t.Id, t.VisitNum, IshaveQCChallenge = t.QCChallengeList.Any(), t.SecondReviewState })
.Select(t => new { t.IsUrgent, SubjectCode = t.Subject.Code, t.SubjectId, SubjectVisitId = t.Id, t.VisitNum, IshaveQCChallenge = t.QCChallengeList.Any(), t.SecondReviewState })
.OrderBy(t => t.IshaveQCChallenge).ThenBy(t => t.SecondReviewState).ThenBy(x => x.IsUrgent).ThenBy(x => x.SubjectCode).ThenBy(x => x.VisitNum).ToListAsync();
//var subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId).OrderBy(x => x.VisitNum).FirstOrDefault();
//if (subjectVisit != null)
//{
// return new GetNextIQCQualityOutDto()
// {
// SubjectId = subjectVisit.SubjectId,
// VisitId = subjectVisit.Id
// };
//}
//跳过当前访视
if (inDto.IsSkipCurrentVisit)
{
visitList = visitList.Where(t => !skippedVisits.Contains(t.SubjectVisitId)).ToList();
}
var subjectVisit = visitList.FirstOrDefault();
if (subjectVisit != null)
@ -1412,7 +1433,7 @@ namespace IRaCIS.Core.Application.Image.QA
return new GetNextIQCQualityOutDto()
{
SubjectId = subjectVisit.SubjectId,
VisitId = subjectVisit.Id
VisitId = subjectVisit.SubjectVisitId
};
}
else
@ -1438,19 +1459,16 @@ namespace IRaCIS.Core.Application.Image.QA
//.Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.UserRoleId)
.Select(t => new { t.IsUrgent, SubjectCode = t.Subject.Code, t.SubjectId, t.Id, t.VisitNum, IshaveQCChallenge = t.QCChallengeList.Any(), t.SecondReviewState })
.Select(t => new { t.IsUrgent, SubjectCode = t.Subject.Code, t.SubjectId, SubjectVisitId = t.Id, t.VisitNum, IshaveQCChallenge = t.QCChallengeList.Any(), t.SecondReviewState })
.OrderBy(t => t.IshaveQCChallenge).ThenBy(t => t.SecondReviewState).ThenBy(x => x.IsUrgent).ThenBy(x => x.SubjectCode).ThenBy(x => x.VisitNum).ToListAsync();
//subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId).OrderBy(x => x.VisitNum).FirstOrDefault();
//if (subjectVisit != null)
//{
// return new GetNextIQCQualityOutDto()
// {
// SubjectId = subjectVisit.SubjectId,
// VisitId = subjectVisit.Id
// };
//}
//跳过当前访视
if (inDto.IsSkipCurrentVisit)
{
visitList = visitList.Where(t => !skippedVisits.Contains(t.SubjectVisitId)).ToList();
}
subjectVisit = visitList.FirstOrDefault();
if (subjectVisit != null)
@ -1458,7 +1476,7 @@ namespace IRaCIS.Core.Application.Image.QA
return new GetNextIQCQualityOutDto()
{
SubjectId = subjectVisit.SubjectId,
VisitId = subjectVisit.Id
VisitId = subjectVisit.SubjectVisitId
};
}
else
@ -1975,7 +1993,7 @@ namespace IRaCIS.Core.Application.Image.QA
SubjectVisitId = dbSubjectVisit.Id,
ModuleName = $"G-{dbSubjectVisit.VisitName}",
ModuleType = ModuleTypeEnum.Global,
ReadModuleAddTypeEnum= dbSubjectVisit.PDState == PDStateEnum.PDProgress? ReadModuleAddType.PDConfirmation : ReadModuleAddType.FinalVisit,
ReadModuleAddTypeEnum = dbSubjectVisit.PDState == PDStateEnum.PDProgress ? ReadModuleAddType.PDConfirmation : ReadModuleAddType.FinalVisit,
IsUrgent = dbSubjectVisit.IsUrgent,
TrialId = dbSubjectVisit.TrialId,
SubjectId = dbSubjectVisit.SubjectId
@ -1984,7 +2002,7 @@ namespace IRaCIS.Core.Application.Image.QA
if (await _readingQuestionCriterionTrialRepository.AnyAsync(x => x.Id == trialReadingCriterionId && x.IsOncologyReading))
{
await _readModuleRepository.AddAsync(new ReadModule()
await _readModuleRepository.AddAsync(new ReadModule()
{
TrialReadingCriterionId = trialReadingCriterionId,
ReadingSetType = ReadingSetType.TumorReading,