修改影响的列表

Uat_Study
hang 2023-03-30 17:37:32 +08:00
parent de3c4b5338
commit 8294d6dc80
2 changed files with 107 additions and 41 deletions

View File

@ -1433,6 +1433,7 @@ namespace IRaCIS.Core.Application.Service
TrialReadingCriterionId = reReadingVisitTask.TrialReadingCriterionId,
IsNeedClinicalDataSign = reReadingVisitTask.IsNeedClinicalDataSign,
IsClinicalDataSign = reReadingVisitTask.IsClinicalDataSign,
BeforeConvertedTaskId = reReadingVisitTask.BeforeConvertedTaskId,
// TaskAllocationState = reReadingVisitTask.TaskAllocationState,
// AllocateTime = DateTime.Now,

View File

@ -1290,7 +1290,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
{
if (criterionConfig.IsAutoCreate == false)
{
//---手动生成任务的不允许PM 申请影像重阅
//---手动生成任务的不允许PM 申请影像重阅
return ResponseOutput.NotOk(_localizer["VisitTask_NoPMRecheck"]);
}
@ -1374,13 +1374,13 @@ namespace IRaCIS.Core.Application.Service.Allocation
if (task.ReadingCategory == ReadingCategory.Oncology && await _visitTaskRepository.AnyAsync(filterExpression.And(t => t.ReadingCategory == ReadingCategory.Oncology)))
{
//---有序阅片,只允许申请该受试者阅片人最后一次完成肿瘤学任务重阅
//---有序阅片,只允许申请该受试者阅片人最后一次完成肿瘤学任务重阅
throw new BusinessValidationFailedException(_localizer["VisitTask_LastOncologistRecheck"]);
}
if (task.ReadingCategory == ReadingCategory.Judge && await _visitTaskRepository.AnyAsync(filterExpression.And(t => t.ReadingCategory == ReadingCategory.Judge)))
{
//---有序阅片,只允许申请该受试者阅片人最后一次完成裁判的任务重阅
//---有序阅片,只允许申请该受试者阅片人最后一次完成裁判的任务重阅
throw new BusinessValidationFailedException(_localizer["VisitTask_LastAdjudicatorRecheck"]);
}
@ -1389,7 +1389,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
{
if (task.ReadingCategory != ReadingCategory.Visit && task.ReadingCategory != ReadingCategory.Global)
{
//---无序阅片仅仅允许IR 申请 全局和访视类型类别的任务进行重阅
//---无序阅片仅仅允许IR 申请 全局和访视类型类别的任务进行重阅
throw new BusinessValidationFailedException(_localizer["VisitTask_IRGlobalRecheck"]);
}
}
@ -1521,7 +1521,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
}
var criterionConfig = await _trialReadingCriterionRepository.Where(x => x.Id == origenalTask.TrialReadingCriterionId).Select(x => new { x.ReadingTool,x.CriterionType,x.IsAdditionalAssessment, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync();
var criterionConfig = await _trialReadingCriterionRepository.Where(x => x.Id == origenalTask.TrialReadingCriterionId).Select(x => new { x.ReadingTool, x.CriterionType, x.IsAdditionalAssessment, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync();
//更新申请信息
@ -1815,8 +1815,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
//有序阅片
if (criterionConfig.IsReadingTaskViewInOrder)
{
if (criterionConfig.CriterionType == CriterionType.RECIST1Point1 && criterionConfig.IsAdditionalAssessment==true)
//1.1 有附加评估,会影响其他标准的任务
if (criterionConfig.CriterionType == CriterionType.RECIST1Point1 && criterionConfig.IsAdditionalAssessment == true)
{
filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == origenalTask.TrialReadingCriterionId || t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB);
@ -1825,7 +1825,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
{
filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == origenalTask.TrialReadingCriterionId);
}
@ -1837,11 +1837,38 @@ namespace IRaCIS.Core.Application.Service.Allocation
{
case ReadingCategory.Visit:
//影响后续访视已经读完的,正在读的,未读的不做处理 以及其他类型任务
filterExpression = filterExpression.And(t => t.VisitTaskNum >= origenalTask.VisitTaskNum &&
((t.DoctorUserId == origenalTask.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global))
||
t.ReadingCategory == ReadingCategory.Judge || t.ReadingCategory == ReadingCategory.Oncology)
);
//申请的是转化的,那么影响列表要排除转化之前的
if (criterionConfig.CriterionType == CriterionType.IRECIST1Point1 && origenalTask.BeforeConvertedTaskId != null)
{
filterExpression = filterExpression.And(t => (t.VisitTaskNum > origenalTask.VisitTaskNum &&
(
(((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global) && t.DoctorUserId == origenalTask.DoctorUserId)
// 裁判 肿瘤学是另外的医生做
|| t.ReadingCategory == ReadingCategory.Judge
|| t.ReadingCategory == ReadingCategory.Oncology
)) || t.Id == origenalTask.Id)
;
}
else
{
filterExpression = filterExpression.And(t => t.VisitTaskNum >= origenalTask.VisitTaskNum &&
(
(((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global) && t.DoctorUserId == origenalTask.DoctorUserId)
// 裁判 肿瘤学是另外的医生做
|| t.ReadingCategory == ReadingCategory.Judge
|| t.ReadingCategory == ReadingCategory.Oncology
)
);
}
break;
@ -1878,7 +1905,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
#region 这里时影响其他的任务 /*不包括申请的任务 申请的任务,在上面会统一处理*/
var influenceTaskList = await _visitTaskRepository.Where(filterExpression, true).OrderBy(t=>t.VisitTaskNum).ToListAsync();
var influenceTaskList = await _visitTaskRepository.Where(filterExpression, true).OrderBy(t => t.VisitTaskNum).ToListAsync();
var trakingOrigenalTask = influenceTaskList.Where(t => t.Id == origenalTask.Id).FirstOrDefault();
@ -1916,9 +1943,26 @@ namespace IRaCIS.Core.Application.Service.Allocation
trakingOrigenalTask?.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Abandon });
}
//冻结的任务不生成任务 影响的其他标准的附加评估的任务不立即生成 比如1.1基线 重阅
if ( influenceTask.ReadingCategory == ReadingCategory.Visit && beforeTaskState == TaskState.Effect && influenceTask.TrialReadingCriterionId== origenalTask.TrialReadingCriterionId)
// 影响的任务 仅仅访视类别的才生成
if (influenceTask.ReadingCategory == ReadingCategory.Visit)
{
// 影响的其他标准的附加评估的任务不立即生成 比如1.1基线 重阅 PM 同意仅仅生成1.1任务不生成BM任务
if (criterionConfig.CriterionType == CriterionType.RECIST1Point1 && criterionConfig.IsAdditionalAssessment && influenceTask.TrialReadingCriterionId != origenalTask.TrialReadingCriterionId)
{
//BM标准的不生成任务
continue;
}
//当前任务是转变任务,并且影响列表里有转变之前的任务 那么该访视任务就不生成
if (criterionConfig.CriterionType == CriterionType.IRECIST1Point1 && influenceTask.BeforeConvertedTaskId != null && influenceTaskList.Any(t => t.Id == influenceTask.BeforeConvertedTaskId))
{
continue;
}
await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand()
{
TrialId = trialId,
@ -1950,7 +1994,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
{
item.Id = Guid.Empty;
item.VisitTaskId = newTask.Id;
}
}
_ = _readingTaskQuestionAnswerRepository.AddRangeAsync(list).Result;
}
@ -1970,6 +2014,9 @@ namespace IRaCIS.Core.Application.Service.Allocation
}
});
}
}
@ -2418,7 +2465,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
if (criterion.CriterionType == CriterionType.RECIST1Point1)
{
//影像回退了|| IR 申请及基线重阅
if (_subjectVisitRepository.Any(t => t.Id == task.SourceSubjectVisitId && t.IsBaseLine) )
if (_subjectVisitRepository.Any(t => t.Id == task.SourceSubjectVisitId && t.IsBaseLine))
{
await _subjectCriteriaEvaluationRepository.UpdatePartialFromQueryAsync(t => t.TrialReadingCriterion.IsAutoCreate == false && t.SubjectId == task.SubjectId, u => new SubjectCriteriaEvaluation()
{
@ -2548,7 +2595,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
//var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException();
var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == filterObj.TrialReadingCriterionId).Select(x => new { x.ReadingTool,x.CriterionType,x.IsAdditionalAssessment, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException();
var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == filterObj.TrialReadingCriterionId).Select(x => new { x.ReadingTool, x.CriterionType, x.IsAdditionalAssessment, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException();
Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) && t.TaskAllocationState == TaskAllocationState.Allocated;
@ -2567,25 +2614,25 @@ namespace IRaCIS.Core.Application.Service.Allocation
if ((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.IndependentReviewer))
|| (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null))
{
//附加评估 IR 和PM 看到的影响列表不一样
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);
}
//附加评估 IR 和PM 看到的影响列表不一样
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);
}
//当前任务及其之后的所有访视任务、全局任务、裁判任务、肿瘤学阅片任务
@ -2606,15 +2653,33 @@ namespace IRaCIS.Core.Application.Service.Allocation
// t.ReadingCategory == ReadingCategory.Judge || t.ReadingCategory == ReadingCategory.Oncology)
// );
//申请的是转化的,那么影响列表要排除转化之前的
if (criterionConfig.CriterionType == CriterionType.IRECIST1Point1 && filterObj.BeforeConvertedTaskId != null)
{
filterExpression = filterExpression.And(t => (t.VisitTaskNum > filterObj.VisitTaskNum &&
(
(((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global) && t.DoctorUserId == filterObj.DoctorUserId)
// 裁判 肿瘤学是另外的医生做
|| t.ReadingCategory == ReadingCategory.Judge
|| t.ReadingCategory == ReadingCategory.Oncology
)) || t.Id == filterObj.Id)
;
}
else
{
filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum &&
(
(((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global) && t.DoctorUserId == filterObj.DoctorUserId)
// 裁判 肿瘤学是另外的医生做
|| t.ReadingCategory == ReadingCategory.Judge
|| t.ReadingCategory == ReadingCategory.Oncology
)
);
}
filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum &&
(
(((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global) && t.DoctorUserId == filterObj.DoctorUserId)
// 裁判 肿瘤学是另外的医生做
|| t.ReadingCategory == ReadingCategory.Judge
|| t.ReadingCategory == ReadingCategory.Oncology
)
);
@ -2733,7 +2798,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
if (filterObj.IsAnalysisCreate)
{
//---不允许退回一致性分析任务
//---不允许退回一致性分析任务
throw new BusinessValidationFailedException(_localizer["VisitTask_NoConsistencyReturn"]);
}