diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs index 42e338374..e983144d5 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs @@ -125,7 +125,7 @@ namespace IRaCIS.Core.Application.ViewModel { public Guid TrialId { get; set; } - public ReadingCategory ReadingCategory { get; set; } + public GenerateTaskCategory ReadingCategory { get; set; } @@ -154,6 +154,7 @@ namespace IRaCIS.Core.Application.ViewModel public List GenerataConsistentTaskList { get; set; } + } //public class ReReadingApplyGenerateTaskCommand diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs index c2c52dd10..82db25c2a 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs @@ -91,14 +91,23 @@ namespace IRaCIS.Core.Application.ViewModel public TaskState TaskState { get; set; } + + //可以不查询 + public List GlobalVisitTaskList { get; set; } + + //也可以不查询 + public bool IsHaveGeneratedTask { get; set; } + + + public string BlindSubjectCode { get; set; } = string.Empty; + public string BlindTrialSiteCode { get; set; } = string.Empty; + + [JsonIgnore] public Guid? DoctorUserId { get; set; } [JsonIgnore] public Guid? TaskConsistentRuleId { get; set; } - public bool IsHaveGeneratedTask { get; set; } - - public List GlobalVisitTaskList { get; set; } } @@ -187,8 +196,12 @@ namespace IRaCIS.Core.Application.ViewModel public int IntervalWeeks { get; set; } public bool IsHaveReadingPeriod { get; set; } public bool IsGenerateGlobalTask { get; set; } + public Guid AnalysisDoctorUserId { get; set; } + public int BlindSubjectNumberOfPlaces { get; set; } + public string BlindTrialSiteCode { get; set; } = string.Empty; + } diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index 6232a7d0b..5c16abd93 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -123,14 +123,27 @@ namespace IRaCIS.Core.Application.Service foreach (var subject in list) { - subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t => { t.DoctorUserId = filterObj.AnalysisDoctorUserId; t.TaskConsistentRuleId = filterObj.Id; }); + //处理 Subject 编号 + subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t => + { + t.DoctorUserId = filterObj.AnalysisDoctorUserId; + t.TaskConsistentRuleId = filterObj.Id; + t.BlindTrialSiteCode = filterObj.BlindTrialSiteCode; + }); + //最后一个访视添加全局 + var globalTask = (subject.VisitTaskList[filterObj.PlanVisitCount - 1]).Clone(); + globalTask.ReadingCategory = ReadingCategory.Global; + globalTask.VisitTaskNum += ReadingCommon.TaskNumDic[ReadingCategory.Global]; + subject.VisitTaskList.Add(globalTask); + await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand() { TrialId = filterObj.TrialId, - ReadingCategory = ReadingCategory.SelfConsistent, + ReadingCategory = GenerateTaskCategory.SelfConsistent, + //产生的过滤掉已经生成的 GenerataConsistentTaskList = subject.VisitTaskList.Where(t => t.IsHaveGeneratedTask == false).ToList() @@ -159,7 +172,7 @@ namespace IRaCIS.Core.Application.Service if (subejctIdList != null && subejctIdList?.Count > 0) { - visitTaskFilter.And( t => subejctIdList.Contains(t.SubjectId)); + visitTaskFilter.And(t => subejctIdList.Contains(t.SubjectId)); } //所选访视数量 的访视 其中必有一个访视后有全局任务 @@ -219,7 +232,7 @@ namespace IRaCIS.Core.Application.Service }).ToList(), - }).ToList() + }).OrderBy(t => t.VisitTaskNum).ToList() }); return query.OrderByDescending(t => t.IsHaveGeneratedTask); diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs index 8d249a075..1467e5781 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs @@ -51,9 +51,9 @@ namespace IRaCIS.Core.Application.Service var taskMedicalReviewQueryable = _taskMedicalReviewRepository.Where(t => t.VisitTask.TrialId == inQuery.TrialId) .WhereIf(inQuery.SiteId != null, t => t.VisitTask.Subject.SiteId == inQuery.SiteId) - .WhereIf(inQuery.SubjectId != null, t => t.VisitTask.SubjectId == inQuery.SubjectId) + .WhereIf(inQuery.SubjectId != null, t => t.VisitTask.SubjectId == inQuery.SubjectId) .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode)) - .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.VisitTask.TaskName.Contains(inQuery.TaskName) || t.VisitTask.TaskBlindName.Contains(inQuery.TaskName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.VisitTask.TaskName.Contains(inQuery.TaskName) || t.VisitTask.TaskBlindName.Contains(inQuery.TaskName)) .WhereIf(inQuery.IsUrgent != null, t => t.VisitTask.IsUrgent == inQuery.IsUrgent) .WhereIf(inQuery.DoctorUserId != null, t => t.VisitTask.DoctorUserId == inQuery.DoctorUserId) .WhereIf(inQuery.ReadingCategory != null, t => t.VisitTask.ReadingCategory == inQuery.ReadingCategory) @@ -84,7 +84,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory) .WhereIf(inQuery.ReadingTaskState != null, t => t.ReadingTaskState == inQuery.ReadingTaskState) .WhereIf(inQuery.IsGeneratedJudge != null, t => t.JudgeVisitTaskId != null) - //.WhereIf(inQuery.IsGlobalHaveUpdate != null, t => t.JudgeVisitTaskId != null) + .WhereIf(inQuery.IsGlobalHaveUpdate != null, t => t.IsGlobalHaveUpdate== inQuery.IsGlobalHaveUpdate) .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName)) .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode)) diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 695bb62f6..c5fc07da8 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -66,7 +66,7 @@ namespace IRaCIS.Core.Application.Service var subjectVisitList = _subjectVisitRepository.Where(t => subjectVisitIdList.Contains(t.Id)).ProjectTo(_mapper.ConfigurationProvider).Distinct().ToList(); - await AddTaskAsync(new GenerateTaskCommand() { TrialId = trialId, IsAssignSubjectToDoctor = isAssignSubjectToDoctor, VisitGenerataTaskList = subjectVisitList, ReadingCategory = ReadingCategory.Visit }); + await AddTaskAsync(new GenerateTaskCommand() { TrialId = trialId, IsAssignSubjectToDoctor = isAssignSubjectToDoctor, VisitGenerataTaskList = subjectVisitList, ReadingCategory = GenerateTaskCategory.Visit }); } @@ -89,7 +89,7 @@ namespace IRaCIS.Core.Application.Service switch (generateTaskCommand.ReadingCategory) { - case ReadingCategory.Visit: + case GenerateTaskCategory.Visit: foreach (var subjectVisit in generateTaskCommand.VisitGenerataTaskList) { var assignConfigList = await _subjectUserRepository.Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId && t.OrignalSubjectUserId == null && t.IsConfirmed).Select(u => new { u.DoctorUserId, u.ArmEnum }).ToListAsync(); @@ -294,7 +294,7 @@ namespace IRaCIS.Core.Application.Service await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.Id == subjectVisit.Id, u => new SubjectVisit() { IsVisitTaskGenerated = true }); } break; - case ReadingCategory.ReReading: + case GenerateTaskCategory.ReReading: var reReadingVisitTask = generateTaskCommand.ReReadingTask; @@ -355,8 +355,8 @@ namespace IRaCIS.Core.Application.Service //} break; - case ReadingCategory.SelfConsistent: - case ReadingCategory.GroupConsistent: + case GenerateTaskCategory.SelfConsistent: + case GenerateTaskCategory.GroupConsistent: foreach (var task in generateTaskCommand.GenerataConsistentTaskList) { @@ -381,9 +381,11 @@ namespace IRaCIS.Core.Application.Service TaskAllocationState = TaskAllocationState.Allocated, AllocateTime = DateTime.Now, + BlindTrialSiteCode=task.BlindTrialSiteCode, + BlindSubjectCode=task.BlindSubjectCode, ConsistentAnalysisOriginalTaskId=task.Id, - IsSelfAnalysis= generateTaskCommand.ReadingCategory==ReadingCategory.SelfConsistent, + IsSelfAnalysis= generateTaskCommand.ReadingCategory== GenerateTaskCategory.SelfConsistent, }; @@ -396,7 +398,7 @@ namespace IRaCIS.Core.Application.Service break; - case ReadingCategory.Judge: + case GenerateTaskCategory.Judge: var firstTask = await _visitTaskRepository.Where(x => generateTaskCommand.JudgeVisitTaskIdList.Contains(x.Id)).FirstOrDefaultAsync(); var subjectUser = await _subjectUserRepository.Where(x => x.SubjectId == firstTask.SubjectId && x.ArmEnum == Arm.JudgeArm).FirstOrDefaultAsync(); @@ -441,7 +443,7 @@ namespace IRaCIS.Core.Application.Service break; //case ReadingCategory.ReadingPeriod: - case ReadingCategory.Global: + case GenerateTaskCategory.Global: if (trialConfig.ReadingType == ReadingMethod.Double) { @@ -507,7 +509,7 @@ namespace IRaCIS.Core.Application.Service } } break; - case ReadingCategory.Oncology: + case GenerateTaskCategory.Oncology: foreach (var item in generateTaskCommand.ReadingGenerataTaskList) { var singleTask = await _visitTaskRepository.AddAsync(new VisitTask() diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 097601989..95fba669f 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -1046,7 +1046,7 @@ namespace IRaCIS.Core.Application.Service { TrialId = trialId, - ReadingCategory = ReadingCategory.ReReading, + ReadingCategory = GenerateTaskCategory.ReReading, ReReadingTask = origenalTask, @@ -1178,7 +1178,7 @@ namespace IRaCIS.Core.Application.Service { TrialId = trialId, - ReadingCategory = ReadingCategory.ReReading, + ReadingCategory = GenerateTaskCategory.ReReading, ReReadingTask = origenalTask, diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index 304d11dad..2897c7953 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -597,7 +597,7 @@ namespace IRaCIS.Application.Services await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand() { - ReadingCategory = ReadingCategory.Global, + ReadingCategory = GenerateTaskCategory.Global, TrialId = taskInfo.TrialId, ReadingGenerataTaskList = needReadList }) ; @@ -619,7 +619,7 @@ namespace IRaCIS.Application.Services await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand() { - ReadingCategory = ReadingCategory.Oncology, + ReadingCategory = GenerateTaskCategory.Oncology, TrialId = taskInfo.TrialId, ReadingGenerataTaskList = needReadList }); @@ -780,7 +780,7 @@ namespace IRaCIS.Application.Services await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand() { JudgeVisitTaskIdList= inDto.VisitTaskIds, - ReadingCategory= ReadingCategory.Judge, + ReadingCategory= GenerateTaskCategory.Judge, TrialId= trialId }); } diff --git a/IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs b/IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs index 96d6493b9..7616141ce 100644 --- a/IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs +++ b/IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs @@ -23,6 +23,30 @@ namespace IRaCIS.Core.Domain.Share + + } + + public enum GenerateTaskCategory + { + //访视 + Visit = 1, + + ////阅片周期 + //ReadingPeriod = 2, + + //全局 + Global = 3, + + //裁判 + Judge = 4, + + /// + /// 肿瘤学 + /// + Oncology = 5, + + + //生成任务 额外增加的 前端那边不加 ReReading = 6, diff --git a/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs b/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs index bddce9bae..e58b4a476 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs @@ -45,11 +45,13 @@ namespace IRaCIS.Core.Domain.Models public int IntervalWeeks { get; set; } - - + + //public Guid? CompareDoctorUserId { get; set; } - - + //public User AnalysisDoctorUser { get; set; } + + + public bool IsHaveReadingPeriod { get; set; } @@ -58,12 +60,12 @@ namespace IRaCIS.Core.Domain.Models public User CompareDoctorUser { get; set; } - public User AnalysisDoctorUser { get; set; } public List DoctorVisitTaskList { get; set; } - + public int BlindSubjectNumberOfPlaces { get; set; } + public string BlindTrialSiteCode { get; set; } = string.Empty; //[Projectable] //public List DoctorConsistentTaskList => DoctorVisitTaskList.Where(t => t.IsAnalysisCreate && t.TaskConsistentRuleId == Id).ToList(); diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index 151d2157f..d6b4dc7be 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -147,6 +147,11 @@ namespace IRaCIS.Core.Domain.Models /// public DateTime? FirstReadingTime { get; set; } + /// + /// 全局是否有更新 + /// + public bool? IsGlobalHaveUpdate { get; set; } + #region 一致性分析的任务特有数据 /// diff --git a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs index 0bf518096..e5db6470f 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs @@ -20,7 +20,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common {ReadingCategory.Visit, 0 }, {ReadingCategory.Global,(decimal) 0.03 }, {ReadingCategory.Judge,(decimal) 0.02 }, - {ReadingCategory.ReReading, 0 }, {ReadingCategory.Oncology, 0 }, }; diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 52348bb7a..e13bcd97c 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -103,8 +103,6 @@ namespace IRaCIS.Core.Infra.EFCore modelBuilder.Entity().HasMany(t => t.TaskMedicalReviewList).WithOne(t => t.VisitTask).HasForeignKey(t => t.VisitTaskId); - - modelBuilder.Entity().HasOne(t => t.Subject).WithMany(s=>s.SubjectVisitTaskList).HasForeignKey(t => t.SubjectId);