diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 0aa262a5d..abcc5af31 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -79,7 +79,7 @@ namespace IRaCIS.Core.Application.Service var trialId = generateTaskCommand.TrialId; var isAssignSubjectToDoctor = generateTaskCommand.IsAssignSubjectToDoctor; - var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState, t.TaskAllocateObjEnum,t.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); + var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState, t.TaskAllocateObjEnum, t.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); var dbMaxCode = _visitTaskRepository.Where(t => t.TrialId == trialId).Select(t => t.Code).DefaultIfEmpty().Max(); @@ -172,7 +172,7 @@ namespace IRaCIS.Core.Application.Service //并且配置了医生 if (assignConfigList.Count > 0 && trialConfig.IsFollowVisitAutoAssign) { - + #region 后续访视 未分配的进行再次分配,重置的或者失效的 需要重新生成新的任务 (PM 有序退回 或者PM 有序 申请重阅) @@ -209,7 +209,7 @@ namespace IRaCIS.Core.Application.Service //存在退回访视1 又退回基线 这种情况 生成任务 考虑基线先一致性核查通过,但是访视1还未通过时 生成任务 var followVisitTaskList = await _visitTaskRepository - .Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.SourceSubjectVisit.CheckState == CheckStateEnum.CVPassed && t.ReadingCategory == ReadingCategory.Visit &&t.IsAnalysisCreate==false, true) + .Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.SourceSubjectVisit.CheckState == CheckStateEnum.CVPassed && t.ReadingCategory == ReadingCategory.Visit && t.IsAnalysisCreate == false, true) .WhereIf(followBackVisitTask != null, t => t.VisitTaskNum < followBackVisitTask.VisitTaskNum) .ToListAsync(); @@ -221,7 +221,7 @@ namespace IRaCIS.Core.Application.Service foreach (var visitGroup in followVisitGroup) { - var arm1 = visitGroup.FirstOrDefault(t => t.TaskState == TaskState.Effect && t.TaskAllocationState==TaskAllocationState.NotAllocate && t.DoctorUserId == null && t.ArmEnum == Arm.DoubleReadingArm1); + var arm1 = visitGroup.FirstOrDefault(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.DoctorUserId == null && t.ArmEnum == Arm.DoubleReadingArm1); if (arm1 != null) { arm1.TaskAllocationState = TaskAllocationState.Allocated; @@ -255,8 +255,8 @@ namespace IRaCIS.Core.Application.Service TaskAllocationState = TaskAllocationState.Allocated, AllocateTime = DateTime.Now, DoctorUserId = task1.DoctorUserId, - SuggesteFinishedTime=DateTime.Now.AddDays(7), - }); + SuggesteFinishedTime = DateTime.Now.AddDays(7), + }); currentMaxCodeInt = currentMaxCodeInt + 1; @@ -414,7 +414,7 @@ namespace IRaCIS.Core.Application.Service //配置了医生 if (assignConfigList.Count > 0) { - + #region 重阅/退回的时候,需要将取消分配的访视类型的 任务重新分配 @@ -609,6 +609,27 @@ namespace IRaCIS.Core.Application.Service generateTaskCommand.Action(newTask); + if (reReadingVisitTask.ReadingCategory == ReadingCategory.Judge) + { + var judgeRecord = await _readingJudgeInfoRepository.Where(t => t.JudgeTaskId == reReadingVisitTask.Id).FirstOrDefaultAsync(); + + var origenalTaskIdList = new Guid[] { judgeRecord.TaskIdOne, judgeRecord.TaskIdTwo }; + + await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => origenalTaskIdList.Contains(x.Id), x => new VisitTask() + { + JudgeVisitTaskId = newTask.Id + }); + + await _readingJudgeInfoRepository.AddAsync(new ReadingJudgeInfo() + { + JudgeTaskId = newTask.Id, + SubjectId = judgeRecord.SubjectId, + TrialId = judgeRecord.TrialId, + TaskIdOne = judgeRecord.TaskIdOne, + TaskIdTwo = judgeRecord.TaskIdTwo + }); + } + //await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t=>t.) //是否增加任务类别 @@ -688,7 +709,7 @@ namespace IRaCIS.Core.Application.Service DoctorUserId = task.DoctorUserId, TaskAllocationState = TaskAllocationState.Allocated, AllocateTime = DateTime.Now, - SuggesteFinishedTime= DateTime.Now.AddDays(7), + SuggesteFinishedTime = DateTime.Now.AddDays(7), IsAnalysisCreate = true, IsSelfAnalysis = false, @@ -724,7 +745,7 @@ namespace IRaCIS.Core.Application.Service SouceReadModuleId = firstTask.SouceReadModuleId, TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)), TaskState = TaskState.Effect, - TaskBlindName= firstTask.TaskName, + TaskBlindName = firstTask.TaskName, DoctorUserId = subjectUser == null ? null : subjectUser.DoctorUserId, TaskAllocationState = subjectUser == null ? TaskAllocationState.NotAllocate : TaskAllocationState.Allocated, AllocateTime = subjectUser == null ? null : DateTime.Now, @@ -758,7 +779,7 @@ namespace IRaCIS.Core.Application.Service var originalTaskInfo = await _visitTaskRepository.Where(x => x.Id == generateTaskCommand.OriginalVisitId).FirstNotNullAsync(); foreach (var item in generateTaskCommand.ReadingGenerataTaskList) { - + var task1 = await _visitTaskRepository.AddAsync(new VisitTask() { TrialId = trialId, @@ -787,7 +808,7 @@ namespace IRaCIS.Core.Application.Service case GenerateTaskCategory.Oncology: - + foreach (var item in generateTaskCommand.ReadingGenerataTaskList) { var oncologySubjectUser = await _subjectUserRepository.Where(x => x.SubjectId == item.SubjectId && x.ArmEnum == Arm.TumorArm && x.IsConfirmed).FirstOrDefaultAsync(); diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 9dcbcdf1c..dc76ce3e3 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -1919,6 +1919,10 @@ namespace IRaCIS.Core.Application.Service.Allocation newTask.AllocateTime = DateTime.Now; newTask.SuggesteFinishedTime = DateTime.Now.AddDays(7); + + //裁判任务 需要进行特殊处理 在重阅逻辑里面处理 + + //拷贝表单 if (visitTaskReReadingAppply.IsCopyOrigenalForms) {