From af4aec6a696f230303284306bd2c71e39cd47a08 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 6 Jun 2023 17:18:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bm=E9=87=8D=E9=98=85=E5=BD=B1?= =?UTF-8?q?=E5=93=8D=E5=88=97=E8=A1=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Allocation/VisitTaskHelpeService.cs | 11 +++- .../Service/Allocation/VisitTaskService.cs | 66 +++++++++++-------- 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 12696a4a1..75fdb7488 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -115,7 +115,7 @@ namespace IRaCIS.Core.Application.Service public async Task AddConvertedTask(Guid taskId) { - + var taskInfo = await _visitTaskRepository.Where(x => x.Id == taskId).IgnoreAutoIncludes().AsNoTracking().FirstNotNullAsync(); taskInfo.ReadingTaskState = ReadingTaskState.WaitReading; @@ -148,7 +148,7 @@ namespace IRaCIS.Core.Application.Service }); - + await _visitTaskRepository.SaveChangesAsync(); } @@ -1290,6 +1290,11 @@ namespace IRaCIS.Core.Application.Service //加一个去重的判断 IR 申请重阅的时候,有脏数据 (例如多个follow 2 ),但是生成时候不生成 + //var existTask = _visitTaskRepository.Where(t => t.TrialId == trialId && t.SubjectId == reReadingVisitTask.SubjectId + //&& t.TrialReadingCriterionId == reReadingVisitTask.TrialReadingCriterionId && t.TaskState == TaskState.Effect + // && t.SourceSubjectVisitId == reReadingVisitTask.SourceSubjectVisitId && t.ArmEnum == reReadingVisitTask.ArmEnum && t.DoctorUserId == reReadingVisitTask.DoctorUserId).FirstOrDefault(); + + var newTask = await _visitTaskRepository.AddAsync(new VisitTask() { @@ -1322,7 +1327,7 @@ namespace IRaCIS.Core.Application.Service IsNeedClinicalDataSign = reReadingVisitTask.IsNeedClinicalDataSign, IsClinicalDataSign = reReadingVisitTask.IsClinicalDataSign, BeforeConvertedTaskId = reReadingVisitTask.BeforeConvertedTaskId, - ReReadingApplyState= ReReadingApplyState.Default, + ReReadingApplyState = ReReadingApplyState.Default, // TaskAllocationState = reReadingVisitTask.TaskAllocationState, // AllocateTime = DateTime.Now, //DoctorUserId = reReadingVisitTask.DoctorUserId, diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 0c022b8df..3d43b495d 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -1538,6 +1538,9 @@ namespace IRaCIS.Core.Application.Service.Allocation //是否是一致性分析任务 正常申请 会影响一致性分析任务 filterExpression = filterExpression.And(t => t.IsAnalysisCreate == origenalTask.IsAnalysisCreate); + //IR 申请1.1 基线重阅,影响附加评估两个IR所有的任务 + var isIR1Point1AdditionalAssessmentBaseline = false; + //附加评估 IR 和PM 看到的影响列表不一样 //1.1 有附加评估,会影响其他标准的任务 @@ -1555,7 +1558,10 @@ namespace IRaCIS.Core.Application.Service.Allocation // 1.1 基线任务影响BM任务 if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && _subjectVisitRepository.Any(t => t.Id == origenalTask.SourceSubjectVisitId && t.IsBaseLine == true)) { - filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == origenalTask.TrialReadingCriterionId || t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB); + + isIR1Point1AdditionalAssessmentBaseline = true; + + //filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == origenalTask.TrialReadingCriterionId || t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB); } // 1.1 非基线任务不影响BM任务 else @@ -1795,6 +1801,17 @@ namespace IRaCIS.Core.Application.Service.Allocation )) || t.Id == origenalTask.Id) ; } + else if (isIR1Point1AdditionalAssessmentBaseline) + { + filterExpression = filterExpression.And(t => t.VisitTaskNum >= origenalTask.VisitTaskNum && + ((( + ((t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global) && t.DoctorUserId == origenalTask.DoctorUserId) + // 裁判 肿瘤学是另外的医生做 + || t.ReadingCategory == ReadingCategory.Judge + || t.ReadingCategory == ReadingCategory.Oncology + ) && t.TrialReadingCriterionId == origenalTask.TrialReadingCriterionId) || (t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB)) + ); + } else { filterExpression = filterExpression.And(t => t.VisitTaskNum >= origenalTask.VisitTaskNum && @@ -2579,7 +2596,8 @@ namespace IRaCIS.Core.Application.Service.Allocation filterExpression = filterExpression.And(t => t.IsAnalysisCreate == filterObj.IsAnalysisCreate); - + //IR 申请1.1 基线重阅,影响附加评估所有的任务 + var isIR1Point1AdditionalAssessmentBaseline = false; //附加评估 IR 和PM 看到的影响列表不一样 if (criterionConfig.CriterionType == CriterionType.RECIST1Point1 && criterionConfig.IsAdditionalAssessment) @@ -2593,7 +2611,11 @@ namespace IRaCIS.Core.Application.Service.Allocation // 1.1 基线任务影响BM任务 if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && _subjectVisitRepository.Any(t=>t.Id==filterObj.SourceSubjectVisitId && t.IsBaseLine==true)) { - filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == filterObj.TrialReadingCriterionId || t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB); + + isIR1Point1AdditionalAssessmentBaseline=true; + //filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == filterObj.TrialReadingCriterionId || t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB); + + } // 1.1 非基线任务不影响BM任务 else @@ -2629,27 +2651,6 @@ namespace IRaCIS.Core.Application.Service.Allocation || (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null)) { - - //if (criterionConfig.CriterionType == CriterionType.RECIST1Point1 && criterionConfig.IsAdditionalAssessment) - //{ - // if(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) - // { - // filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == filterObj.TrialReadingCriterionId || t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB); - // } - // else - // { - // filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == filterObj.TrialReadingCriterionId); - // } - - - //} - //else - //{ - // //默认影响的都是该标准的任务 - // filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == filterObj.TrialReadingCriterionId); - //} - - //当前任务及其之后的所有访视任务、全局任务、裁判任务、肿瘤学阅片任务 //有序 @@ -2662,11 +2663,6 @@ namespace IRaCIS.Core.Application.Service.Allocation //影响当前医生 以及当前医生之后的 1、访视任务 已经读完的 //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.ReadingCategory == ReadingCategory.Judge || t.ReadingCategory == ReadingCategory.Oncology) - // ); //申请的是转化的,那么影响列表要排除转化之前的 if (criterionConfig.CriterionType == CriterionType.IRECIST1Point1 && filterObj.BeforeConvertedTaskId != null) @@ -2682,6 +2678,18 @@ namespace IRaCIS.Core.Application.Service.Allocation )) || t.Id == filterObj.Id) ; } + // IR 申请1.1 基线重阅,影响附加评估所有的任务 + else if (isIR1Point1AdditionalAssessmentBaseline) + { + filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && + ((( + ((t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global) && t.DoctorUserId == filterObj.DoctorUserId) + // 裁判 肿瘤学是另外的医生做 + || t.ReadingCategory == ReadingCategory.Judge + || t.ReadingCategory == ReadingCategory.Oncology + )&& t.TrialReadingCriterionId==filterObj.TrialReadingCriterionId )||( t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB)) + ); + } else { filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum &&