删除提示

Uat_Study
hang 2022-07-19 10:08:29 +08:00
parent 0b880e20da
commit 960a8a9fec
1 changed files with 28 additions and 32 deletions

View File

@ -14,7 +14,7 @@ using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Infra.EFCore.Common; using IRaCIS.Core.Infra.EFCore.Common;
using System.Linq.Expressions; using System.Linq.Expressions;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service.Allocation
{ {
/// <summary> /// <summary>
/// 访视读片任务 /// 访视读片任务
@ -52,7 +52,7 @@ namespace IRaCIS.Core.Application.Service
_subjectUserRepository = subjectUserRepository; _subjectUserRepository = subjectUserRepository;
_readModuleRepository = readModuleRepository; _readModuleRepository = readModuleRepository;
_visitTaskReReadingRepository = visitTaskReReadingRepository; _visitTaskReReadingRepository = visitTaskReReadingRepository;
this._taskMedicalReviewRepository = taskMedicalReviewRepository; _taskMedicalReviewRepository = taskMedicalReviewRepository;
_readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository; _readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
} }
@ -478,10 +478,10 @@ namespace IRaCIS.Core.Application.Service
if (assginSubjectDoctorCommand.IsReAssign) if (assginSubjectDoctorCommand.IsReAssign)
{ {
if (await _visitTaskRepository.AnyAsync(t => assginSubjectDoctorCommand.SubjectIdList.Contains(t.SubjectId) && t.DoctorUserId != null && t.ArmEnum == Arm.JudgeArm)) //if (await _visitTaskRepository.AnyAsync(t => assginSubjectDoctorCommand.SubjectIdList.Contains(t.SubjectId) && t.DoctorUserId != null && t.ArmEnum == Arm.JudgeArm))
{ //{
throw new BusinessValidationFailedException("有Subject任务已应用不允许重新分配"); // throw new BusinessValidationFailedException("有Subject任务已应用不允许重新分配");
} //}
await _subjectUserRepository.BatchDeleteNoTrackingAsync(t => doctorUserIdList.Contains(t.DoctorUserId) && assginSubjectDoctorCommand.SubjectIdList.Contains(t.SubjectId) && t.ArmEnum == Arm.JudgeArm); await _subjectUserRepository.BatchDeleteNoTrackingAsync(t => doctorUserIdList.Contains(t.DoctorUserId) && assginSubjectDoctorCommand.SubjectIdList.Contains(t.SubjectId) && t.ArmEnum == Arm.JudgeArm);
@ -494,10 +494,10 @@ namespace IRaCIS.Core.Application.Service
if (assginSubjectDoctorCommand.IsReAssign) if (assginSubjectDoctorCommand.IsReAssign)
{ {
if (await _visitTaskRepository.AnyAsync(t => assginSubjectDoctorCommand.SubjectIdList.Contains(t.SubjectId) && t.DoctorUserId != null && t.ArmEnum != Arm.JudgeArm)) //if (await _visitTaskRepository.AnyAsync(t => assginSubjectDoctorCommand.SubjectIdList.Contains(t.SubjectId) && t.DoctorUserId != null && t.ArmEnum != Arm.JudgeArm))
{ //{
throw new BusinessValidationFailedException("有Subject任务已应用不允许重新分配"); // throw new BusinessValidationFailedException("有Subject任务已应用不允许重新分配");
} //}
await _subjectUserRepository.BatchDeleteNoTrackingAsync(t => doctorUserIdList.Contains(t.DoctorUserId) && assginSubjectDoctorCommand.SubjectIdList.Contains(t.SubjectId) && t.ArmEnum != Arm.JudgeArm); await _subjectUserRepository.BatchDeleteNoTrackingAsync(t => doctorUserIdList.Contains(t.DoctorUserId) && assginSubjectDoctorCommand.SubjectIdList.Contains(t.SubjectId) && t.ArmEnum != Arm.JudgeArm);
@ -722,7 +722,7 @@ namespace IRaCIS.Core.Application.Service
//已分配的 医生的情况 //已分配的 医生的情况
var haveAssignedSubjectDoctorList = subjectList.Clone().SelectMany(t => t.DoctorUserList.Select(c => new { t.SubjectId, DoctorUserId = c.DoctorUserId, c.ArmEnum })).ToList(); var haveAssignedSubjectDoctorList = subjectList.Clone().SelectMany(t => t.DoctorUserList.Select(c => new { t.SubjectId, c.DoctorUserId, c.ArmEnum })).ToList();
//将目前已分配的情况 换到医生的维度 //将目前已分配的情况 换到医生的维度
foreach (var waitAllocationDoctor in waitAllocationDoctorList) foreach (var waitAllocationDoctor in waitAllocationDoctorList)
@ -798,18 +798,18 @@ namespace IRaCIS.Core.Application.Service
var doctor1Arm = Arm.DoubleReadingArm1; var doctor1Arm = Arm.DoubleReadingArm1;
var doctor2Arm = Arm.DoubleReadingArm2; var doctor2Arm = Arm.DoubleReadingArm2;
if ((preferredDoctor1Arm == null && preferredDoctor2Arm == null) || if (preferredDoctor1Arm == null && preferredDoctor2Arm == null ||
(preferredDoctor1Arm == null && preferredDoctor2Arm == Arm.DoubleReadingArm2) || preferredDoctor1Arm == null && preferredDoctor2Arm == Arm.DoubleReadingArm2 ||
(preferredDoctor1Arm == Arm.DoubleReadingArm1 && preferredDoctor2Arm == null) || preferredDoctor1Arm == Arm.DoubleReadingArm1 && preferredDoctor2Arm == null ||
(preferredDoctor1Arm == Arm.DoubleReadingArm1 && preferredDoctor2Arm == Arm.DoubleReadingArm2) preferredDoctor1Arm == Arm.DoubleReadingArm1 && preferredDoctor2Arm == Arm.DoubleReadingArm2
) )
{ {
doctor1Arm = Arm.DoubleReadingArm1; doctor1Arm = Arm.DoubleReadingArm1;
doctor2Arm = Arm.DoubleReadingArm2; doctor2Arm = Arm.DoubleReadingArm2;
} }
else if ((preferredDoctor1Arm == null && preferredDoctor2Arm == Arm.DoubleReadingArm1) || else if (preferredDoctor1Arm == null && preferredDoctor2Arm == Arm.DoubleReadingArm1 ||
(preferredDoctor1Arm == Arm.DoubleReadingArm2 && preferredDoctor2Arm == Arm.DoubleReadingArm1) || preferredDoctor1Arm == Arm.DoubleReadingArm2 && preferredDoctor2Arm == Arm.DoubleReadingArm1 ||
(preferredDoctor1Arm == Arm.DoubleReadingArm2 && preferredDoctor2Arm == null)) preferredDoctor1Arm == Arm.DoubleReadingArm2 && preferredDoctor2Arm == null)
{ {
doctor1Arm = Arm.DoubleReadingArm2; doctor1Arm = Arm.DoubleReadingArm2;
doctor2Arm = Arm.DoubleReadingArm1; doctor2Arm = Arm.DoubleReadingArm1;
@ -1061,20 +1061,16 @@ namespace IRaCIS.Core.Application.Service
} }
else else
{ {
if ((task.ReadingCategory != ReadingCategory.Visit && task.ReadingCategory != ReadingCategory.Global)) if (task.ReadingCategory != ReadingCategory.Visit && task.ReadingCategory != ReadingCategory.Global)
{ {
throw new BusinessValidationFailedException("无序阅片仅仅允许IR 申请 全局和访视类型类别的任务进行重阅"); throw new BusinessValidationFailedException("无序阅片仅仅允许IR 申请 全局和访视类型类别的任务进行重阅");
} }
} }
} }
task.ReReadingApplyState = ReReadingApplyState.HaveApplyed; task.ReReadingApplyState = ReReadingApplyState.HaveApplyed;
@ -1123,8 +1119,8 @@ namespace IRaCIS.Core.Application.Service
//更新原始任务 当前任务处理 //更新原始任务 当前任务处理
origenalTask.ReReadingApplyState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? ReReadingApplyState.Agree : ReReadingApplyState.Reject); origenalTask.ReReadingApplyState = agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? ReReadingApplyState.Agree : ReReadingApplyState.Reject;
origenalTask.TaskState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? TaskState.HaveReturned : origenalTask.TaskState); origenalTask.TaskState = agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? TaskState.HaveReturned : origenalTask.TaskState;
@ -1172,7 +1168,7 @@ namespace IRaCIS.Core.Application.Service
filterExpression = filterExpression.And(t => t.IsAnalysisCreate == origenalTask.IsAnalysisCreate); filterExpression = filterExpression.And(t => t.IsAnalysisCreate == origenalTask.IsAnalysisCreate);
//访视影响当前以及当前之后的 两个阅片人的 //访视影响当前以及当前之后的 两个阅片人的
filterExpression = filterExpression.And(t => (t.VisitTaskNum > origenalTask.VisitTaskNum && t.DoctorUserId == origenalTask.DoctorUserId) || (t.VisitTaskNum >= origenalTask.VisitTaskNum && t.DoctorUserId != origenalTask.DoctorUserId)); filterExpression = filterExpression.And(t => t.VisitTaskNum > origenalTask.VisitTaskNum && t.DoctorUserId == origenalTask.DoctorUserId || t.VisitTaskNum >= origenalTask.VisitTaskNum && t.DoctorUserId != origenalTask.DoctorUserId);
#region 影响的任务(排除申请的任务) #region 影响的任务(排除申请的任务)
@ -1288,7 +1284,7 @@ namespace IRaCIS.Core.Application.Service
//影响后续访视已经读完的,未读的不做处理 以及其他类型任务 //影响后续访视已经读完的,未读的不做处理 以及其他类型任务
filterExpression = filterExpression.And(t => t.VisitTaskNum > origenalTask.VisitTaskNum && t.DoctorUserId == origenalTask.DoctorUserId && filterExpression = filterExpression.And(t => t.VisitTaskNum > origenalTask.VisitTaskNum && t.DoctorUserId == origenalTask.DoctorUserId &&
((t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit) || (t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit ||
t.ReadingCategory == ReadingCategory.Global || t.ReadingCategory == ReadingCategory.Global ||
t.ReadingCategory == ReadingCategory.Oncology || t.ReadingCategory == ReadingCategory.Oncology ||
t.ReadingCategory == ReadingCategory.Judge) t.ReadingCategory == ReadingCategory.Judge)
@ -1315,7 +1311,7 @@ namespace IRaCIS.Core.Application.Service
case ReadingCategory.Judge: case ReadingCategory.Judge:
//裁判的影响自己 和后续肿瘤学阅片 //裁判的影响自己 和后续肿瘤学阅片
filterExpression = filterExpression.And(t => /*(t.Id == origenalTask.Id) ||*/ (t.VisitTaskNum > origenalTask.VisitTaskNum && t.DoctorUserId == origenalTask.DoctorUserId && t.ReadingCategory == ReadingCategory.Oncology)); filterExpression = filterExpression.And(t => /*(t.Id == origenalTask.Id) ||*/ t.VisitTaskNum > origenalTask.VisitTaskNum && t.DoctorUserId == origenalTask.DoctorUserId && t.ReadingCategory == ReadingCategory.Oncology);
break; break;
@ -1804,7 +1800,7 @@ namespace IRaCIS.Core.Application.Service
//2、后续任务如果是全局、肿瘤学阅片任务状态为阅片完成标记为重阅重置若在阅片中则标记为失效若为待阅片则标记为失效 //2、后续任务如果是全局、肿瘤学阅片任务状态为阅片完成标记为重阅重置若在阅片中则标记为失效若为待阅片则标记为失效
//3、当前任务、后续访视任务或者全局任务触发了裁判任务若裁判任务状态为阅片完成则标记为重阅重置若在阅片中或待阅片则标记为失效 //3、当前任务、后续访视任务或者全局任务触发了裁判任务若裁判任务状态为阅片完成则标记为重阅重置若在阅片中或待阅片则标记为失效
filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && t.DoctorUserId == filterObj.DoctorUserId && filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && t.DoctorUserId == filterObj.DoctorUserId &&
((t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit) || (t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit ||
t.ReadingCategory == ReadingCategory.Global || t.ReadingCategory == ReadingCategory.Global ||
t.ReadingCategory == ReadingCategory.Oncology || t.ReadingCategory == ReadingCategory.Oncology ||
t.ReadingCategory == ReadingCategory.Judge) t.ReadingCategory == ReadingCategory.Judge)
@ -1831,7 +1827,7 @@ namespace IRaCIS.Core.Application.Service
case ReadingCategory.Oncology: case ReadingCategory.Oncology:
//仅仅影响自己 //仅仅影响自己
filterExpression = filterExpression.And(t => (t.Id == filterObj.Id)); filterExpression = filterExpression.And(t => t.Id == filterObj.Id);
break; break;
//(只允许申请该阅片人最后一次完成裁判的任务重阅)申请的时候做了限制 //(只允许申请该阅片人最后一次完成裁判的任务重阅)申请的时候做了限制
@ -1841,7 +1837,7 @@ namespace IRaCIS.Core.Application.Service
//2、后续若有肿瘤学阅片若肿瘤学阅片任务状态为阅片完成则标记为重阅重置若为阅片中则标记为失效如为待阅片则取消分配 //2、后续若有肿瘤学阅片若肿瘤学阅片任务状态为阅片完成则标记为重阅重置若为阅片中则标记为失效如为待阅片则取消分配
//裁判的影响自己 和后续肿瘤学阅片 //裁判的影响自己 和后续肿瘤学阅片
filterExpression = filterExpression.And(t => (t.Id == filterObj.Id) || (t.VisitTaskNum > filterObj.VisitTaskNum && t.DoctorUserId == filterObj.DoctorUserId && t.ReadingCategory == ReadingCategory.Oncology)); filterExpression = filterExpression.And(t => t.Id == filterObj.Id || t.VisitTaskNum > filterObj.VisitTaskNum && t.DoctorUserId == filterObj.DoctorUserId && t.ReadingCategory == ReadingCategory.Oncology);
break; break;