修改有序阅片 影响列表

Uat_Study
hang 2022-09-14 13:42:30 +08:00
parent 54d88dab9e
commit 9bbfb7da4d
1 changed files with 65 additions and 54 deletions

View File

@ -578,7 +578,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
//给Subject分配医生的时候 未确认绑定关系的 //给Subject分配医生的时候 未确认绑定关系的
DoctorUserList = t.SubjectDoctorList.Where(t => isJudge ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.OrignalSubjectUserId == null).Select(t => new { t.DoctorUserId, t.ArmEnum }), DoctorUserList = t.SubjectDoctorList.Where(t => isJudge ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.OrignalSubjectUserId == null).Select(t => new { t.DoctorUserId, t.ArmEnum }),
//IsApplyed = t.SubjectDoctorList.Where(t => isJudge ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.OrignalSubjectUserId == null).SelectMany(t => t.SubjectArmVisitTaskList).Any(c => c.DoctorUserId != null) //IsApplyed = t.SubjectDoctorList.Where(t => isJudge ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.OrignalSubjectUserId == null).SelectMany(t => t.SubjectArmVisitTaskList).Any(c => c.DoctorUserId != null)
IsApplyed=false IsApplyed = false
}).ToList(); }).ToList();
//已产生任务的Subject数量裁判情况下就是产生裁判任务Subject 的数量) //已产生任务的Subject数量裁判情况下就是产生裁判任务Subject 的数量)
@ -1106,7 +1106,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
{ {
var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id) var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id)
.Where(x => !x.Subject.IsDeleted) .Where(x => !x.Subject.IsDeleted)
.Where(t => (t.ReadingTaskState != ReadingTaskState.HaveSigned || t.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed||t.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) && t.TaskState == TaskState.Effect) .Where(t => (t.ReadingTaskState != ReadingTaskState.HaveSigned || t.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed || t.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) && t.TaskState == TaskState.Effect)
.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode }); .GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode });
var visitTaskQuery = visitGroupQuery.Select(x => new IRUnReadSubjectView() var visitTaskQuery = visitGroupQuery.Select(x => new IRUnReadSubjectView()
@ -1125,7 +1125,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
VisistId = u.SourceSubjectVisitId, VisistId = u.SourceSubjectVisitId,
SuggesteFinishedTime = u.SuggesteFinishedTime, SuggesteFinishedTime = u.SuggesteFinishedTime,
ReadingCategory = u.ReadingCategory, ReadingCategory = u.ReadingCategory,
IsAnalysisCreate=u.IsAnalysisCreate, IsAnalysisCreate = u.IsAnalysisCreate,
}).ToList(), }).ToList(),
}).Where(x => x.UnReadTaskCount > 0).OrderBy(x => x.SubjectId); }).Where(x => x.UnReadTaskCount > 0).OrderBy(x => x.SubjectId);
@ -1403,9 +1403,6 @@ namespace IRaCIS.Core.Application.Service.Allocation
return ResponseOutput.NotOk("当前为有序阅片,当前访视之后,也申请了重阅 必须从后向前处理"); return ResponseOutput.NotOk("当前为有序阅片,当前访视之后,也申请了重阅 必须从后向前处理");
} }
} }
@ -1434,8 +1431,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
#region PM 申请双重阅片 同一访视 其他已申请的任务也修改为同意 #region PM 申请双重阅片 同一访视 其他已申请的任务也修改为同意
await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.OriginalReReadingTask.SubjectId == origenalTask.SubjectId && await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.OriginalReReadingTask.SubjectId == origenalTask.SubjectId &&
t.OriginalReReadingTask.ReReadingApplyState==ReReadingApplyState.TrialGroupHaveApplyed && t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed &&
//t.RequestReReadingResultEnum==RequestReReadingResult.Default && //t.RequestReReadingResultEnum==RequestReReadingResult.Default &&
t.RequestReReadingType == RequestReReadingType.TrialGroupApply && t.RequestReReadingType == RequestReReadingType.TrialGroupApply &&
t.OriginalReReadingTask.VisitTaskNum == origenalTask.VisitTaskNum && t.OriginalReReadingTask.VisitTaskNum == origenalTask.VisitTaskNum &&
t.Id != item.Id, u => new VisitTaskReReading() t.Id != item.Id, u => new VisitTaskReReading()
@ -1676,9 +1673,9 @@ namespace IRaCIS.Core.Application.Service.Allocation
switch (origenalTask.ReadingCategory) switch (origenalTask.ReadingCategory)
{ {
case ReadingCategory.Visit: case ReadingCategory.Visit:
//影响后续访视已经读完的,未读的不做处理 以及其他类型任务 //影响后续访视已经读完的,正在读的,未读的不做处理 以及其他类型任务
filterExpression = filterExpression.And(t => t.VisitTaskNum >= origenalTask.VisitTaskNum && filterExpression = filterExpression.And(t => t.VisitTaskNum >= origenalTask.VisitTaskNum &&
((t.DoctorUserId == origenalTask.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState == ReadingTaskState.HaveSigned) || t.ReadingCategory == ReadingCategory.Global)) ((t.DoctorUserId == origenalTask.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global))
|| ||
t.ReadingCategory == ReadingCategory.Judge || t.ReadingCategory == ReadingCategory.Oncology) t.ReadingCategory == ReadingCategory.Judge || t.ReadingCategory == ReadingCategory.Oncology)
); );
@ -1686,9 +1683,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
case ReadingCategory.Global: case ReadingCategory.Global:
//全局不影响后续访视任务
filterExpression = filterExpression.And(t => t.VisitTaskNum >= origenalTask.VisitTaskNum && filterExpression = filterExpression.And(t => t.VisitTaskNum >= origenalTask.VisitTaskNum &&
((t.DoctorUserId == origenalTask.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState == ReadingTaskState.HaveSigned) || t.ReadingCategory == ReadingCategory.Global)) || (t.ReadingCategory == ReadingCategory.Oncology) || (t.ReadingCategory == ReadingCategory.Judge))); ((t.DoctorUserId == origenalTask.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global)) || (t.ReadingCategory == ReadingCategory.Oncology) || (t.ReadingCategory == ReadingCategory.Judge)));
break; break;
case ReadingCategory.Oncology: case ReadingCategory.Oncology:
@ -1729,13 +1725,6 @@ namespace IRaCIS.Core.Application.Service.Allocation
{ {
ReReadingTaskTrackingDeal(influenceTask, agreeReReadingCommand); ReReadingTaskTrackingDeal(influenceTask, agreeReReadingCommand);
//influenceTaskList.ForEach(t =>
//{
// //记录实际影像的任务
// influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id });
//});
await SetMedicalReviewInvalidAsync(influenceTaskList, false); await SetMedicalReviewInvalidAsync(influenceTaskList, false);
@ -1759,14 +1748,14 @@ namespace IRaCIS.Core.Application.Service.Allocation
} }
if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned && influenceTask.ReadingCategory == ReadingCategory.Visit) if (/*influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned &&*/ influenceTask.ReadingCategory == ReadingCategory.Visit)
{ {
await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand() await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand()
{ {
TrialId = trialId, TrialId = trialId,
ReadingCategory = GenerateTaskCategory.ReReading, ReadingCategory = GenerateTaskCategory.ReReading,
ReReadingTask = influenceTask, ReReadingTask = influenceTask,
//同步才可以 //同步才可以
@ -1781,36 +1770,34 @@ namespace IRaCIS.Core.Application.Service.Allocation
newTask.AllocateTime = DateTime.Now; newTask.AllocateTime = DateTime.Now;
newTask.SuggesteFinishedTime = DateTime.Now.AddDays(7); newTask.SuggesteFinishedTime = DateTime.Now.AddDays(7);
//拷贝表单 //拷贝后续表单
if ( (visitTaskReReadingAppply.IsCopyOrigenalForms && origenalTask.VisitTaskNum==influenceTask.VisitTaskNum)|| (visitTaskReReadingAppply.IsCopyFollowForms && origenalTask.VisitTaskNum != influenceTask.VisitTaskNum)) //if (visitTaskReReadingAppply.IsCopyFollowForms && origenalTask.VisitTaskNum != influenceTask.VisitTaskNum)
{ //{
if (origenalTask.ReadingCategory == ReadingCategory.Visit) // if (origenalTask.ReadingCategory == ReadingCategory.Visit)
{ // {
var list = _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == origenalTask.Id).ToList(); // var list = _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == origenalTask.Id).ToList();
foreach (var item in list) // foreach (var item in list)
{ // {
item.Id = Guid.Empty; // item.Id = Guid.Empty;
item.VisitTaskId = newTask.Id; // item.VisitTaskId = newTask.Id;
} // }
_ = _readingTaskQuestionAnswerRepository.AddRangeAsync(list).Result; // _ = _readingTaskQuestionAnswerRepository.AddRangeAsync(list).Result;
} // }
else if (origenalTask.ReadingCategory == ReadingCategory.Global) // else if (origenalTask.ReadingCategory == ReadingCategory.Global)
{ // {
var list = _repository.Where<ReadingGlobalTaskInfo>(t => t.GlobalTaskId == origenalTask.Id).ToList(); // var list = _repository.Where<ReadingGlobalTaskInfo>(t => t.GlobalTaskId == origenalTask.Id).ToList();
foreach (var item in list) // foreach (var item in list)
{ // {
item.Id = Guid.Empty; // item.Id = Guid.Empty;
item.GlobalTaskId = newTask.Id; // item.GlobalTaskId = newTask.Id;
} // }
_ = _repository.AddRangeAsync(list).Result; // _ = _repository.AddRangeAsync(list).Result;
} // }
//}
}
} }
}); });
@ -2385,11 +2372,24 @@ namespace IRaCIS.Core.Application.Service.Allocation
//影响当前医生 以及当前医生之后的 1、访视任务 已经读完的 //影响当前医生 以及当前医生之后的 1、访视任务 已经读完的
//2、后续任务如果是全局、肿瘤学阅片任务状态为阅片完成标记为重阅重置若在阅片中则标记为失效若为待阅片则标记为失效 //2、后续任务如果是全局、肿瘤学阅片任务状态为阅片完成标记为重阅重置若在阅片中则标记为失效若为待阅片则标记为失效
//3、当前任务、后续访视任务或者全局任务触发了裁判任务若裁判任务状态为阅片完成则标记为重阅重置若在阅片中或待阅片则标记为失效 //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)
// );
filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && 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.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global) && t.DoctorUserId == filterObj.DoctorUserId)
t.ReadingCategory == ReadingCategory.Judge || t.ReadingCategory == ReadingCategory.Oncology) // 裁判 肿瘤学是另外的医生做
|| t.ReadingCategory == ReadingCategory.Judge
|| t.ReadingCategory == ReadingCategory.Oncology
)
); );
break; break;
case ReadingCategory.Global: case ReadingCategory.Global:
@ -2399,9 +2399,17 @@ namespace IRaCIS.Core.Application.Service.Allocation
//3、当前任务或者全局任务触发了裁判任务若裁判任务状态为阅片完成则标记为重阅重置若在阅片中或待阅片则标记为失效 //3、当前任务或者全局任务触发了裁判任务若裁判任务状态为阅片完成则标记为重阅重置若在阅片中或待阅片则标记为失效
//4、后续任务为肿瘤学阅片任务状态为阅片完成标记为重阅重置若在阅片中则标记为失效若为待阅片则标记为失效 //4、后续任务为肿瘤学阅片任务状态为阅片完成标记为重阅重置若在阅片中则标记为失效若为待阅片则标记为失效
//全局不影响后续访视任务 //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.Oncology) || (t.ReadingCategory == ReadingCategory.Judge)));
filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && 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.Oncology) || (t.ReadingCategory == ReadingCategory.Judge))); (
(t.DoctorUserId == filterObj.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global))
|| (t.ReadingCategory == ReadingCategory.Oncology)
|| (t.ReadingCategory == ReadingCategory.Judge)
));
break; break;
//1、后续任务如果是访视任务、全局任务或裁判任务均不处理 //1、后续任务如果是访视任务、全局任务或裁判任务均不处理
@ -2534,7 +2542,6 @@ namespace IRaCIS.Core.Application.Service.Allocation
if (isReReading) if (isReReading)
{ {
if ((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && applyId != null) || (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null)) if ((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && applyId != null) || (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null))
{ {
//有序 //有序
@ -2544,10 +2551,14 @@ namespace IRaCIS.Core.Application.Service.Allocation
{ {
influenceTask.OptType = ReReadingOrBackOptType.Return; influenceTask.OptType = ReReadingOrBackOptType.Return;
} }
else else if (influenceTask.ReadingTaskState == ReadingTaskState.Reading)
{ {
influenceTask.OptType = ReReadingOrBackOptType.Abandon; influenceTask.OptType = ReReadingOrBackOptType.Abandon;
} }
else
{
throw new BusinessValidationFailedException("IR 申请重阅,不会影响到后续未读的任务");
}
} }
else else
{ {