diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 2894580d6..425e565f8 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -169,7 +169,7 @@ namespace IRaCIS.Core.Application.Service.Allocation await _subjectUserRepository.DeleteFromQueryAsync(t => t.Id == command.Id); - await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState == ReadingTaskState.WaitReading && t.TaskState == TaskState.Effect && t.IsAnalysisCreate==false, u => new VisitTask() + await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState == ReadingTaskState.WaitReading && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false, u => new VisitTask() { AllocateTime = null, DoctorUserId = null, @@ -1288,6 +1288,23 @@ namespace IRaCIS.Core.Application.Service.Allocation origenalTask.TaskState = agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? TaskState.HaveReturned : origenalTask.TaskState; } + private async Task SetMedicalReviewInvalidAsync(List influenceTaskList, bool isPM = true) + { + //将医学审核设置为失效 + var taskIdList = influenceTaskList.Select(t => t.Id).ToList(); + + if (isPM) + { + await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => taskIdList.Contains(t.VisitTaskId) && t.AuditState != MedicalReviewAuditState.HaveSigned, u => new TaskMedicalReview() { IsInvalid = true }); + + } + else + { + + await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => taskIdList.Contains(t.VisitTaskId) && t.IsHaveQuestion == false && t.AuditState != MedicalReviewAuditState.HaveSigned, u => new TaskMedicalReview() { IsInvalid = true }); + } + } + /// /// 确认重阅与否 1同意 2 拒绝 /// @@ -1406,9 +1423,8 @@ namespace IRaCIS.Core.Application.Service.Allocation //}); - //将医学审核设置为失效 - var taskIdList = influenceTaskList.Select(t => t.Id).ToList(); - await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => taskIdList.Contains(t.VisitTaskId) && t.AuditState != MedicalReviewAuditState.HaveSigned, u => new TaskMedicalReview() { IsInvalid = true }); + await SetMedicalReviewInvalidAsync(influenceTaskList); + } //申请的访视 要不是重阅重置,要不就是失效 不会存在取消分配 @@ -1528,9 +1544,7 @@ namespace IRaCIS.Core.Application.Service.Allocation // influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); //}); - //将医学审核设置为失效 - var taskIdList = influenceTaskList.Select(t => t.Id).ToList(); - await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => taskIdList.Contains(t.VisitTaskId) && t.AuditState != MedicalReviewAuditState.HaveSigned, u => new TaskMedicalReview() { IsInvalid = true }); + await SetMedicalReviewInvalidAsync(influenceTaskList); trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } @@ -1588,7 +1602,7 @@ namespace IRaCIS.Core.Application.Service.Allocation //全局不影响后续访视任务 filterExpression = filterExpression.And(t => t.VisitTaskNum >= origenalTask.VisitTaskNum && - ((t.DoctorUserId == origenalTask.DoctorUserId && t.ReadingCategory == ReadingCategory.Global) || (t.ReadingCategory == ReadingCategory.Oncology) || (t.ReadingCategory == ReadingCategory.Judge))); + ((t.DoctorUserId == origenalTask.DoctorUserId && t.ReadingCategory == ReadingCategory.Global && t.ReadingTaskState == ReadingTaskState.HaveSigned) || (t.ReadingCategory == ReadingCategory.Oncology) || (t.ReadingCategory == ReadingCategory.Judge))); break; case ReadingCategory.Oncology: @@ -1636,10 +1650,8 @@ namespace IRaCIS.Core.Application.Service.Allocation // influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); //}); - //将医学审核设置为失效 - var taskIdList = influenceTaskList.Select(t => t.Id).ToList(); - await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => taskIdList.Contains(t.VisitTaskId) && t.IsHaveQuestion==false && t.AuditState != MedicalReviewAuditState.HaveSigned, u => new TaskMedicalReview() { IsInvalid = true }); + await SetMedicalReviewInvalidAsync(influenceTaskList,false); trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } @@ -1755,10 +1767,7 @@ namespace IRaCIS.Core.Application.Service.Allocation //}); - //将医学审核设置为失效 - var taskIdList = influenceTaskList.Select(t => t.Id).ToList(); - - await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => taskIdList.Contains(t.VisitTaskId) && t.IsHaveQuestion == false && t.AuditState != MedicalReviewAuditState.HaveSigned, u => new TaskMedicalReview() { IsInvalid = true }); + await SetMedicalReviewInvalidAsync(influenceTaskList, false); trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } @@ -1945,6 +1954,8 @@ namespace IRaCIS.Core.Application.Service.Allocation var influenceTaskList = await _visitTaskRepository.Where(filterExpression, true).ToListAsync(); + await SetMedicalReviewInvalidAsync(influenceTaskList); + #region 方式一 //foreach (var influenceTask in influenceTaskList) @@ -2143,6 +2154,8 @@ namespace IRaCIS.Core.Application.Service.Allocation var currentVisitList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == task.SourceSubjectVisitId && t.ReadingCategory == ReadingCategory.Visit && t.TaskState == TaskState.Effect && t.VisitTaskNum == task.VisitTaskNum, true).ToListAsync(); + await SetMedicalReviewInvalidAsync(currentVisitList); + var origenalTask = currentVisitList.Where(t => t.Id == task.Id).First(); foreach (var influenceTask in currentVisitList) @@ -2278,9 +2291,9 @@ namespace IRaCIS.Core.Application.Service.Allocation //2、后续任务如果是全局、肿瘤学阅片任务,状态为阅片完成标记为重阅重置;若在阅片中,则标记为失效;若为待阅片,则标记为失效; //3、当前任务、后续访视任务或者全局任务触发了裁判任务,若裁判任务状态为阅片完成,则标记为重阅重置;若在阅片中或待阅片,则标记为失效 filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && - ((t.DoctorUserId == filterObj.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState == ReadingTaskState.HaveSigned) || t.ReadingCategory == ReadingCategory.Global )) + ((t.DoctorUserId == filterObj.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState == ReadingTaskState.HaveSigned) || t.ReadingCategory == ReadingCategory.Global)) || - t.ReadingCategory == ReadingCategory.Judge ||t.ReadingCategory==ReadingCategory.Oncology) + t.ReadingCategory == ReadingCategory.Judge || t.ReadingCategory == ReadingCategory.Oncology) ) ; break; @@ -2294,7 +2307,7 @@ namespace IRaCIS.Core.Application.Service.Allocation //全局不影响后续访视任务 filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && - ((t.DoctorUserId == filterObj.DoctorUserId && t.ReadingCategory == ReadingCategory.Global) || (t.ReadingCategory == ReadingCategory.Oncology) || (t.ReadingCategory == ReadingCategory.Judge))); + ((t.DoctorUserId == filterObj.DoctorUserId && t.ReadingCategory == ReadingCategory.Global && t.ReadingTaskState==ReadingTaskState.HaveSigned) || (t.ReadingCategory == ReadingCategory.Oncology) || (t.ReadingCategory == ReadingCategory.Judge))); break; //1、后续任务如果是访视任务、全局任务或裁判任务,均不处理;