diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs index 0a566607e..9f73b9a4a 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs @@ -33,7 +33,6 @@ namespace IRaCIS.Core.Application.ViewModel public class TaskConsistentRuleBasic : TaskConsistentRuleAddOrEdit { - } public class SubjectGeneratedTask @@ -288,7 +287,14 @@ namespace IRaCIS.Core.Application.ViewModel } - + public class GetConsistentRuleOut + { + public TaskConsistentRuleBasic? ConsistentRuleBasic { get; set; } + /// + /// 任务展示访视 读片任务显示是否顺序 + /// + public ReadingOrder IsReadingTaskViewInOrder { get; set; } = ReadingOrder.InOrder; + } ///TaskConsistentRuleQuery 列表查询参数模型 public class TaskConsistentRuleQuery diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index 77e0a2737..c914ee5be 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -34,6 +34,7 @@ namespace IRaCIS.Core.Application.Service private readonly IRepository _taskConsistentRuleRepository; private readonly IRepository _visitTaskRepository; private readonly IRepository _readingConsistentClinicalDataRepository; + private readonly IRepository _trialReadingCriterionRepository; private readonly IReadingClinicalDataService _readingClinicalDataService; private readonly IRepository _subjectUserRepository; private readonly IRepository _subjectRepository; @@ -49,6 +50,7 @@ namespace IRaCIS.Core.Application.Service public TaskConsistentRuleService(IRepository visitTaskRepository, IRepository readingConsistentClinicalDataRepository, + IRepository trialReadingCriterionRepository, IReadingClinicalDataService readingClinicalDataService, IRepository enrollRepository, IRepository taskConsistentRuleRepository, IRepository subjectUserRepository, IRepository subjectRepository, IDistributedLockProvider distributedLockProvider, IRepository trialRepository, IRepository trialSiteRepository, IRepository trialVirtualSiteCodeUpdateRepository, IVisitTaskHelpeService visitTaskCommonService) @@ -56,6 +58,7 @@ namespace IRaCIS.Core.Application.Service _taskConsistentRuleRepository = taskConsistentRuleRepository; _visitTaskRepository = visitTaskRepository; this._readingConsistentClinicalDataRepository = readingConsistentClinicalDataRepository; + this._trialReadingCriterionRepository = trialReadingCriterionRepository; this._readingClinicalDataService = readingClinicalDataService; _subjectUserRepository = subjectUserRepository; _subjectRepository = subjectRepository; @@ -782,9 +785,16 @@ namespace IRaCIS.Core.Application.Service [HttpPost] - public async Task GetConsistentRule(TaskConsistentRuleQuery inQuery) + public async Task GetConsistentRule(TaskConsistentRuleQuery inQuery) { - return await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis == inQuery.IsSelfAnalysis && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); + + var IsReadingTaskViewInOrder = await _trialReadingCriterionRepository.Where(x => x.Id == inQuery.TrialReadingCriterionId).Select(x => x.IsReadingTaskViewInOrder).FirstNotNullAsync(); + var result = await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis == inQuery.IsSelfAnalysis && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); + return new GetConsistentRuleOut() + { + ConsistentRuleBasic = result, + IsReadingTaskViewInOrder = IsReadingTaskViewInOrder + }; } /// diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 950076470..ab994e41d 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -1427,6 +1427,7 @@ namespace IRaCIS.Core.Application.Service case GenerateTaskCategory.SelfConsistent: var readingCriterionId = generateTaskCommand.GenerataConsistentTaskList.First().TrialReadingCriterionId; + var isReadingTaskViewInOrder = await _trialReadingCriterionRepository.Where(t => t.Id == readingCriterionId).Select(x => x.IsReadingTaskViewInOrder).FirstNotNullAsync(); var subjectId = generateTaskCommand.GenerataConsistentTaskList.First().SubjectId; //var trialReadingCriterion=_trialReadingCriterionRepository.Where(t=>t.Id== trialReadingCriterionId).FirstOrDefault(); @@ -1469,7 +1470,11 @@ namespace IRaCIS.Core.Application.Service foreach (var task in generateTaskCommand.GenerataConsistentTaskList) { - var exsitPDF = await _readingClinicalDataRepository.AnyAsync(t => t.TrialId == trialId && + + + var exsitPDF = await _readingClinicalDataRepository + .WhereIf(isReadingTaskViewInOrder== ReadingOrder.Random,t=>t.ReadingId== task.SouceReadModuleId|| t.ReadingId == task.SourceSubjectVisitId) + .AnyAsync(t => t.TrialId == trialId && t.SubjectId== task.SubjectId&& t.ClinicalDataTrialSet.TrialClinicalDataSetCriteriaList.Any(c => c.TrialReadingCriterionId == readingCriterionId) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs index 5b3886fee..8e41acc53 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs @@ -90,6 +90,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.IsReading, t => t.MapFrom(u => u.DicomSerie.IsReading)); CreateMap(); CreateMap(); + CreateMap(); diff --git a/IRaCIS.Core.Application/Service/Visit/PatientService.cs b/IRaCIS.Core.Application/Service/Visit/PatientService.cs index 471d97fe5..dce64507d 100644 --- a/IRaCIS.Core.Application/Service/Visit/PatientService.cs +++ b/IRaCIS.Core.Application/Service/Visit/PatientService.cs @@ -69,6 +69,43 @@ namespace IRaCIS.Application.Services } + + public async Task>> GetPatientSeriesList(Guid scpStudyId, + [FromServices] IRepository _seriesRepository, + [FromServices] IRepository _instanceRepository + ) + { + + var seriesList = await _seriesRepository.Where(s => s.StudyId == scpStudyId).OrderBy(s => s.SeriesNumber). + ThenBy(s => s.SeriesTime).ThenBy(s => s.CreateTime) + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + + var instanceList = await _instanceRepository.Where(s => s.StudyId == scpStudyId).OrderBy(t => t.SeriesId).ThenBy(t => t.InstanceNumber) + .ThenBy(s => s.InstanceTime).ThenBy(s => s.CreateTime) + .Select(t => new { t.SeriesId, t.Id, t.Path, t.NumberOfFrames, t.InstanceNumber }).ToListAsync();//.GroupBy(u => u.SeriesId); + + foreach (var series in seriesList) + { + + series.InstanceInfoList = instanceList.Where(t => t.SeriesId == series.Id).OrderBy(t => t.InstanceNumber).Select(k => + new InstanceBasicInfo() + { + Id = k.Id, + NumberOfFrames = k.NumberOfFrames, + //HtmlPath = string.Empty, + Path = k.Path, + InstanceNumber = k.InstanceNumber, + + }).ToList(); + } + + var study = await _scpStudyRepository.FindAsync(scpStudyId); + + return ResponseOutput.Ok(seriesList, study); + } + + + /// /// scp 影像推送记录表 ///