diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index cbf736de3..7952817d6 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -83,9 +83,12 @@ namespace IRaCIS.Core.Application.Service var trialId = generateTaskCommand.TrialId; var isAssignSubjectToDoctor = generateTaskCommand.IsAssignSubjectToDoctor; - var trialReadingCriterionIdList = _trialReadingCriterionRepository.Where(t => t.TrialId == trialId && t.IsConfirm).Select(t => t.Id).ToList(); + var trialReadingCriterionConfigList = _trialReadingCriterionRepository.Where(t => t.TrialId == trialId && t.IsConfirm).Select(t => new { TrialReadingCriterionId= t.Id ,t.ReadingTool,t.ReadingType, t.IsReadingTaskViewInOrder, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState,t.TaskAllocateObjEnum } ).ToList(); + + //var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState, t.TaskAllocateObjEnum, }).FirstOrDefaultAsync()).IfNullThrowException(); + + //var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == trialReadingCriterionId).Select(x => new { x.ReadingTool, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); - var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState, t.TaskAllocateObjEnum, t.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); var dbMaxCode = _visitTaskRepository.Where(t => t.TrialId == trialId).Select(t => t.Code).DefaultIfEmpty().Max(); @@ -100,14 +103,14 @@ namespace IRaCIS.Core.Application.Service { - foreach (var trialReadingCriterionId in trialReadingCriterionIdList) + foreach (var trialReadingCriterionConfig in trialReadingCriterionConfigList) { - var assignConfigList = await _subjectUserRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.OrignalSubjectUserId == null && t.IsConfirmed).Select(u => new { u.DoctorUserId, u.ArmEnum }).ToListAsync(); + var assignConfigList = await _subjectUserRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.OrignalSubjectUserId == null && t.IsConfirmed).Select(u => new { u.DoctorUserId, u.ArmEnum }).ToListAsync(); - if (trialConfig.ReadingType == ReadingMethod.Double) + if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Double) { //每个访视 根据项目配置生成任务 双审生成两个 var task1 = await _visitTaskRepository.AddAsync(new VisitTask() @@ -125,7 +128,7 @@ namespace IRaCIS.Core.Application.Service TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)), ReadingCategory = ReadingCategory.Visit, - TrialReadingCriterionId = trialReadingCriterionId + TrialReadingCriterionId = trialReadingCriterionConfig.TrialReadingCriterionId }); var task2 = await _visitTaskRepository.AddAsync(new VisitTask() @@ -143,7 +146,7 @@ namespace IRaCIS.Core.Application.Service TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 2, nameof(VisitTask)), ReadingCategory = ReadingCategory.Visit, - TrialReadingCriterionId = trialReadingCriterionId + TrialReadingCriterionId = trialReadingCriterionConfig.TrialReadingCriterionId }); currentMaxCodeInt = currentMaxCodeInt + 2; @@ -156,9 +159,9 @@ namespace IRaCIS.Core.Application.Service { - if (trialConfig.TaskAllocateObjEnum == TaskAllocateObj.Subject) + if (trialReadingCriterionConfig.TaskAllocateObjEnum == TaskAllocateObj.Subject) { - var allocateSubjectArmList = _visitTaskRepository.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.TrialId == trialId && t.DoctorUserId != null && t.ArmEnum != Arm.JudgeArm) + var allocateSubjectArmList = _visitTaskRepository.Where(t => t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.TrialId == trialId && t.DoctorUserId != null && t.ArmEnum != Arm.JudgeArm) .Select(t => new { t.DoctorUserId, t.ArmEnum }).Distinct().ToList(); //当前任务没有分配医生,初次分配 @@ -183,17 +186,17 @@ namespace IRaCIS.Core.Application.Service //并且配置了医生 - if (assignConfigList.Count > 0 && trialConfig.IsFollowVisitAutoAssign) + if (assignConfigList.Count > 0 && trialReadingCriterionConfig.IsFollowVisitAutoAssign) { #region 后续访视 未分配的进行再次分配,重置的或者失效的 需要重新生成新的任务 (PM 有序退回 或者PM 有序 申请重阅) - if (trialConfig.IsReadingTaskViewInOrder) + if (trialReadingCriterionConfig.IsReadingTaskViewInOrder) { //之前有回退到影像上传的访视 那么当前访视一致性核查通过的时候,对后续访视不生成或者分配 当前访视生成但是不分配出去 - var beforeBackVisitTask = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum < subjectVisit.VisitNum && t.ReadingCategory == ReadingCategory.Visit && t.SourceSubjectVisit.CheckState != CheckStateEnum.CVPassed).OrderBy(t => t.VisitTaskNum).FirstOrDefaultAsync(); + var beforeBackVisitTask = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum < subjectVisit.VisitNum && t.ReadingCategory == ReadingCategory.Visit && t.SourceSubjectVisit.CheckState != CheckStateEnum.CVPassed).OrderBy(t => t.VisitTaskNum).FirstOrDefaultAsync(); //之前有回退的,那么当前访视任务生成但是不分配 if (beforeBackVisitTask != null) @@ -206,7 +209,7 @@ namespace IRaCIS.Core.Application.Service { #region 当前访视根据配置规则分配出去 - var defaultState = trialConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated; + var defaultState = trialReadingCriterionConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated; if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm1)) { @@ -229,11 +232,11 @@ namespace IRaCIS.Core.Application.Service #endregion } - var followBackVisitTask = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.ReadingCategory == ReadingCategory.Visit && t.SourceSubjectVisit.CheckState != CheckStateEnum.CVPassed).OrderBy(t => t.VisitTaskNum).FirstOrDefaultAsync(); + var followBackVisitTask = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.ReadingCategory == ReadingCategory.Visit && t.SourceSubjectVisit.CheckState != CheckStateEnum.CVPassed).OrderBy(t => t.VisitTaskNum).FirstOrDefaultAsync(); //存在退回访视1 又退回基线 这种情况 生成任务 考虑基线先一致性核查通过,但是访视1还未通过时 生成任务 var followVisitTaskList = await _visitTaskRepository - .Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.SourceSubjectVisit.CheckState == CheckStateEnum.CVPassed && t.ReadingCategory == ReadingCategory.Visit && t.IsAnalysisCreate == false, true) + .Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.SourceSubjectVisit.CheckState == CheckStateEnum.CVPassed && t.ReadingCategory == ReadingCategory.Visit && t.IsAnalysisCreate == false, true) .WhereIf(followBackVisitTask != null, t => t.VisitTaskNum < followBackVisitTask.VisitTaskNum) .ToListAsync(); @@ -338,7 +341,7 @@ namespace IRaCIS.Core.Application.Service //无序的时候 生成任务并分配出去 else { - var defaultState = trialConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated; + var defaultState = trialReadingCriterionConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated; if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm1)) { @@ -380,7 +383,7 @@ namespace IRaCIS.Core.Application.Service #endregion } - else if (trialConfig.ReadingType == ReadingMethod.Single) + else if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Single) { @@ -398,7 +401,7 @@ namespace IRaCIS.Core.Application.Service SourceSubjectVisitId = subjectVisit.Id, TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)), ReadingCategory = ReadingCategory.Visit, - TrialReadingCriterionId=trialReadingCriterionId + TrialReadingCriterionId= trialReadingCriterionConfig.TrialReadingCriterionId }); @@ -411,10 +414,10 @@ namespace IRaCIS.Core.Application.Service if (isAssignSubjectToDoctor) { - if (trialConfig.TaskAllocateObjEnum == TaskAllocateObj.Subject) + if (trialReadingCriterionConfig.TaskAllocateObjEnum == TaskAllocateObj.Subject) { - if (trialConfig.IsFollowVisitAutoAssign) + if (trialReadingCriterionConfig.IsFollowVisitAutoAssign) { @@ -441,7 +444,7 @@ namespace IRaCIS.Core.Application.Service #region 重阅/退回的时候,需要将取消分配的访视类型的 任务重新分配 - if (trialConfig.IsReadingTaskViewInOrder) + if (trialReadingCriterionConfig.IsReadingTaskViewInOrder) { //之前有回退的访视 那么当前访视一致性核查通过的时候,对后续访视不生成或者分配 当前访视生成但是不分配出去 @@ -452,7 +455,7 @@ namespace IRaCIS.Core.Application.Service { #region 访视2 PM 回退 基线回退 访视2先一致性核查通过,生成访视2任务,但是不分配 - var defaultState = trialConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated; + var defaultState = trialReadingCriterionConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated; singleTask.TaskAllocationState = defaultState; @@ -537,7 +540,7 @@ namespace IRaCIS.Core.Application.Service //无序的时候 生成任务并分配出去 else { - var defaultState = trialConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated; + var defaultState = trialReadingCriterionConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated; singleTask.TaskAllocationState = defaultState; diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index ae5f2e055..18ca19d14 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -36,6 +36,7 @@ namespace IRaCIS.Core.Application.Service.Allocation private readonly IRepository _visitTaskReReadingRepository; private readonly IRepository _taskMedicalReviewRepository; private readonly IRepository _readingTaskQuestionAnswerRepository; + private readonly IRepository _trialReadingCriterionRepository; public VisitTaskService(IRepository subjectVisitRepository, IRepository visitTaskRepository, IRepository trialRepository, @@ -43,6 +44,7 @@ namespace IRaCIS.Core.Application.Service.Allocation IRepository readModuleRepository, IRepository visitTaskReReadingRepository, IRepository taskMedicalReviewRepository, IRepository readingTaskQuestionAnswerRepository + , IRepository trialReadingCriterionRepository ) { _taskAllocationRuleRepository = taskAllocationRuleRepository; @@ -55,6 +57,8 @@ namespace IRaCIS.Core.Application.Service.Allocation _visitTaskReReadingRepository = visitTaskReReadingRepository; _taskMedicalReviewRepository = taskMedicalReviewRepository; _readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository; + + _trialReadingCriterionRepository = trialReadingCriterionRepository; } @@ -92,7 +96,10 @@ namespace IRaCIS.Core.Application.Service.Allocation /// public async Task BatchAssignDoctorToSubject(BatchAssignDoctorToSubjectCommand command) { - var inOrder = _trialRepository.Where(t => t.Id == command.TrialId).Select(t => t.IsReadingTaskViewInOrder).FirstOrDefault(); + //var inOrder = _trialRepository.Where(t => t.Id == command.TrialId).Select(t => t.IsReadingTaskViewInOrder).FirstOrDefault(); + + var inOrder = _trialReadingCriterionRepository.Where(t => t.Id == command.TrialReadingCriterionId).Select(t => t.IsReadingTaskViewInOrder).FirstOrDefault(); + foreach (var subjectId in command.SubjectIdList) { @@ -552,225 +559,6 @@ namespace IRaCIS.Core.Application.Service.Allocation - /// - /// 自动一次性分配所有未分配的 Subject 给医生 - /// - /// - /// - [HttpPost] - [UnitOfWork] - public async Task AutoSubjectAssignDoctor(AutoSubjectAssignCommand autoSubjectAssignCommand) - { - //自动分配的话,需要把手动分配的给删掉 - - - var trialId = autoSubjectAssignCommand.TrialId; - var isJudge = autoSubjectAssignCommand.IsJudgeDoctor; - - - //获取项目配置 判断应该分配几个医生 - var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.TaskAllocateObjEnum }).FirstOrDefaultAsync()).IfNullThrowException(); - - - //获取 已产生任务的Subject 目前分配情况 - var subjectList = _subjectRepository.Where(t => t.TrialId == trialId) - .WhereIf(isJudge == false, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum != Arm.JudgeArm).Any()) - .WhereIf(isJudge, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum == Arm.JudgeArm).Any()) - ////过滤掉 那些回退的subject - //.Where(t => !t.SubjectVisitList.Any(t => t.IsPMBackOrReReading)) - .Select(t => new - { - SubjectId = t.Id, - - //给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 }), - //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 - }).ToList(); - - //已产生任务的Subject数量(裁判情况下,就是产生裁判任务Subject 的数量) - var subjectCount = subjectList.Count; - - //获取医生列表(裁判是裁判的医生列表) - var waitAllocationDoctorList = _taskAllocationRuleRepository.Where(t => t.TrialId == trialId && t.IsEnable) - .Where(t => t.IsJudgeDoctor == isJudge) - .Select(t => new AutoAssignResultDTO() { DoctorUserId = t.DoctorUserId, PlanReadingRatio = t.PlanReadingRatio, SubjectCount = subjectCount }) - .ToList(); - - if (waitAllocationDoctorList.Count == 0) - { - throw new BusinessValidationFailedException("启用的医生数量为0"); - } - - - //已分配的 医生的情况 - var haveAssignedSubjectDoctorList = subjectList.Clone().SelectMany(t => t.DoctorUserList.Select(c => new { t.SubjectId, c.DoctorUserId, c.ArmEnum })).ToList(); - - //将目前已分配的情况 换到医生的维度 - foreach (var waitAllocationDoctor in waitAllocationDoctorList) - { - waitAllocationDoctor.SubjectArmList = haveAssignedSubjectDoctorList.Where(t => t.DoctorUserId == waitAllocationDoctor.DoctorUserId) - .Select(g => new SubjectArm() - { - SubjectId = g.SubjectId, - ArmEnum = g.ArmEnum - }).ToList(); - } - - - #region 完全按照Subject 遍历去分 - - - //仅仅分配未应用的 而且 没有分配医生的 - foreach (var subject in subjectList.Where(t => t.IsApplyed == false && !t.DoctorUserList.Any())) - { - //该Subject 已经分配的医生数量 - var hasAssignDoctorCount = subject.DoctorUserList.Count(); - - if (isJudge) - { - if (hasAssignDoctorCount > 1) - { - throw new BusinessValidationFailedException("当前有Subject裁判绑定医生数量大于1"); - - } - - var allocateDoctor = waitAllocationDoctorList.OrderByDescending(t => t.Weight).ThenByDescending(t => t.PlanReadingRatio).FirstOrDefault(); - - //将分配结果记录 - waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctor.DoctorUserId).SubjectArmList.Add(new SubjectArm() - { - SubjectId = subject.SubjectId, - ArmEnum = Arm.JudgeArm - }); - - await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = subject.SubjectId, DoctorUserId = allocateDoctor.DoctorUserId, ArmEnum = Arm.JudgeArm, AssignTime = DateTime.Now }); - - } - else - { - - //分配两个医生 - if (trialConfig.ReadingType == ReadingMethod.Double) - { - - - if (hasAssignDoctorCount > 2) - { - throw new BusinessValidationFailedException("双重阅片当前有Subject绑定医生数量大于2"); - - } - - var allocateDoctorList = waitAllocationDoctorList.OrderByDescending(t => t.Weight).ThenByDescending(t => t.PlanReadingRatio).Take(2).ToList(); - - - #region 看阅片人之前在Subject哪个组做的多 - - var preferredDoctor1Arm = waitAllocationDoctorList.Where(t => t.DoctorUserId == allocateDoctorList[0].DoctorUserId) - .SelectMany(t => t.SubjectArmList).GroupBy(t => t.ArmEnum) - .Select(g => new { ArmEnum = g.Key, SubjectCount = g.Count() }) - .OrderByDescending(t => t.SubjectCount).FirstOrDefault()?.ArmEnum; - - var preferredDoctor2Arm = waitAllocationDoctorList.Where(t => t.DoctorUserId == allocateDoctorList[1].DoctorUserId) - .SelectMany(t => t.SubjectArmList).GroupBy(t => t.ArmEnum) - .Select(g => new { ArmEnum = g.Key, SubjectCount = g.Count() }) - .OrderByDescending(t => t.SubjectCount).FirstOrDefault()?.ArmEnum; - - //存放医生分配的Arm - var doctor1Arm = Arm.DoubleReadingArm1; - var doctor2Arm = Arm.DoubleReadingArm2; - - if (preferredDoctor1Arm == null && preferredDoctor2Arm == null || - preferredDoctor1Arm == null && preferredDoctor2Arm == Arm.DoubleReadingArm2 || - preferredDoctor1Arm == Arm.DoubleReadingArm1 && preferredDoctor2Arm == null || - preferredDoctor1Arm == Arm.DoubleReadingArm1 && preferredDoctor2Arm == Arm.DoubleReadingArm2 - ) - { - doctor1Arm = Arm.DoubleReadingArm1; - doctor2Arm = Arm.DoubleReadingArm2; - } - else if (preferredDoctor1Arm == null && preferredDoctor2Arm == Arm.DoubleReadingArm1 || - preferredDoctor1Arm == Arm.DoubleReadingArm2 && preferredDoctor2Arm == Arm.DoubleReadingArm1 || - preferredDoctor1Arm == Arm.DoubleReadingArm2 && preferredDoctor2Arm == null) - { - doctor1Arm = Arm.DoubleReadingArm2; - doctor2Arm = Arm.DoubleReadingArm1; - } - - else if (preferredDoctor1Arm == Arm.DoubleReadingArm1 && preferredDoctor2Arm == Arm.DoubleReadingArm1) - { - doctor1Arm = Arm.DoubleReadingArm1; - doctor2Arm = Arm.DoubleReadingArm2; - } - else if (preferredDoctor1Arm == Arm.DoubleReadingArm2 && preferredDoctor2Arm == Arm.DoubleReadingArm2) - { - doctor1Arm = Arm.DoubleReadingArm2; - doctor2Arm = Arm.DoubleReadingArm1; - } - - #endregion - - - await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = subject.SubjectId, DoctorUserId = allocateDoctorList[0].DoctorUserId, ArmEnum = doctor1Arm, AssignTime = DateTime.Now }); - - - //将分配结果记录 - waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctorList[0].DoctorUserId).SubjectArmList.Add(new SubjectArm() - { - SubjectId = subject.SubjectId, - ArmEnum = doctor1Arm - }); - - - await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = subject.SubjectId, DoctorUserId = allocateDoctorList[1].DoctorUserId, ArmEnum = doctor2Arm, AssignTime = DateTime.Now }); - - //将分配结果记录 - waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctorList[1].DoctorUserId).SubjectArmList.Add(new SubjectArm() - { - SubjectId = subject.SubjectId, - ArmEnum = doctor2Arm - }); - } - else if (trialConfig.ReadingType == ReadingMethod.Single) - { - if (hasAssignDoctorCount > 1) - { - throw new BusinessValidationFailedException("单重阅片当前有Subject绑定医生数量大于1"); - } - - var allocateDoctor = waitAllocationDoctorList.OrderByDescending(t => t.Weight).ThenByDescending(t => t.PlanReadingRatio).FirstOrDefault(); - - //将分配结果记录 - waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctor.DoctorUserId).SubjectArmList.Add(new SubjectArm() - { - SubjectId = subject.SubjectId, - ArmEnum = Arm.SingleReadingArm - }); - - await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = subject.SubjectId, DoctorUserId = allocateDoctor.DoctorUserId, ArmEnum = Arm.SingleReadingArm, AssignTime = DateTime.Now }); - - } - - } - - } - - - #endregion - - - - - - - - await _subjectUserRepository.SaveChangesAsync(); - return ResponseOutput.Ok(); - - } - - - /// @@ -1047,10 +835,16 @@ namespace IRaCIS.Core.Application.Service.Allocation #endregion - var readingTool = await _trialRepository.Where(x => x.Id == iRUnReadSubjectQuery.TrialId).Select(x => x.ReadingTool).FirstOrDefaultAsync(); + //var readingTool = await _trialRepository.Where(x => x.Id == iRUnReadSubjectQuery.TrialId).Select(x => x.ReadingTool).FirstOrDefaultAsync(); + //var isReadingTaskViewInOrder = await _trialRepository.Where(x => x.Id == iRUnReadSubjectQuery.TrialId).Select(x => x.IsReadingTaskViewInOrder).FirstOrDefaultAsync(); + + + var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == iRUnReadSubjectQuery.TrialReadingCriterionId).Select(x => new { x.ReadingTool, x.IsReadingTaskViewInOrder } ).FirstOrDefaultAsync()).IfNullThrowException(); + + var readingTool = criterionConfig.ReadingTool; + var isReadingTaskViewInOrder = criterionConfig.IsReadingTaskViewInOrder; #region 按照Subject 维度 - var isReadingTaskViewInOrder = await _trialRepository.Where(x => x.Id == iRUnReadSubjectQuery.TrialId).Select(x => x.IsReadingTaskViewInOrder).FirstOrDefaultAsync(); if (isReadingTaskViewInOrder) { // var subjectQuery = _subjectRepository.Where(t => t.TrialId == trialId) @@ -1220,7 +1014,11 @@ namespace IRaCIS.Core.Application.Service.Allocation var taskList = await _visitTaskRepository.Where(t => applyReReadingCommand.TaskIdList.Contains(t.Id), true).ToListAsync(); - var trialConfig = (await _trialRepository.Where(t => t.Id == applyReReadingCommand.TrialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); + var trialReadingCriterionId = taskList.First()!.TrialReadingCriterionId; + + //var trialConfig = (await _trialRepository.Where(t => t.Id == applyReReadingCommand.TrialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); + + var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == trialReadingCriterionId).Select(x => new { x.ReadingTool, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); foreach (var task in taskList) { @@ -1253,7 +1051,7 @@ namespace IRaCIS.Core.Application.Service.Allocation // 有序 一个受试者访视重阅未处理完,不能申请其他的 - if (trialConfig.IsReadingTaskViewInOrder) + if (criterionConfig.IsReadingTaskViewInOrder) { if (await _visitTaskReReadingRepository.AnyAsync(t => t.OriginalReReadingTask.TrialId == task.TrialId && t.OriginalReReadingTask.SubjectId == task.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect && t.OriginalReReadingTask.TrialReadingCriterionId == task.TrialReadingCriterionId @@ -1273,7 +1071,7 @@ namespace IRaCIS.Core.Application.Service.Allocation task.ReReadingApplyState = ReReadingApplyState.DocotorHaveApplyed; // 有序 - if (trialConfig.IsReadingTaskViewInOrder) + if (criterionConfig.IsReadingTaskViewInOrder) { if (await _visitTaskReReadingRepository.AnyAsync(t => t.OriginalReReadingTask.TrialId == task.TrialId && t.OriginalReReadingTask.SubjectId == task.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect @@ -1432,7 +1230,8 @@ namespace IRaCIS.Core.Application.Service.Allocation var trialId = agreeReReadingCommand.TrialId; - var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException(); + //var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException(); + foreach (var item in agreeReReadingCommand.ConfirmReReadingList) { @@ -1447,6 +1246,9 @@ namespace IRaCIS.Core.Application.Service.Allocation var origenalTask = (await _visitTaskRepository.Where(t => item.OriginalReReadingTaskId == t.Id).FirstOrDefaultAsync()).IfNullThrowException(); + var criterionConfig = await _trialReadingCriterionRepository.Where(x => x.Id == origenalTask.TrialReadingCriterionId).Select(x => new { x.ReadingTool, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync(); + + //更新申请信息 var visitTaskReReadingAppply = await _visitTaskReReadingRepository.FirstOrDefaultAsync(t => t.Id == item.Id); @@ -1521,7 +1323,7 @@ namespace IRaCIS.Core.Application.Service.Allocation } //有序阅片 - if (trialConfig.IsReadingTaskViewInOrder) + if (criterionConfig.IsReadingTaskViewInOrder) { @@ -1694,7 +1496,7 @@ namespace IRaCIS.Core.Application.Service.Allocation filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == origenalTask.TrialReadingCriterionId); //有序阅片 - if (trialConfig.IsReadingTaskViewInOrder) + if (criterionConfig.IsReadingTaskViewInOrder) { #region 有序 IR 申请 重阅 影响的其他访视查询 @@ -1998,10 +1800,13 @@ namespace IRaCIS.Core.Application.Service.Allocation public async Task PMSetTaskBack(Guid trialId, Guid taskId) { - var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException(); + //var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException(); + var task = (await _visitTaskRepository.Where(t => t.Id == taskId).FirstOrDefaultAsync()).IfNullThrowException(); + var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == task.TrialReadingCriterionId).Select(x => new { x.ReadingTool, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); + if (task.TaskState != TaskState.Effect || task.ReadingCategory != ReadingCategory.Visit || task.ReadingTaskState == ReadingTaskState.HaveSigned || task.TaskAllocationState == TaskAllocationState.NotAllocate) { return ResponseOutput.NotOk("仅仅允许针对已分配、生效、未完成的访视任务进行退回操作,请刷新页面数据"); @@ -2029,7 +1834,7 @@ namespace IRaCIS.Core.Application.Service.Allocation //有序 - if (trialConfig.IsReadingTaskViewInOrder) + if (criterionConfig.IsReadingTaskViewInOrder) { Expression> filterExpression = t => t.TrialId == trialId && t.SubjectId == task.SubjectId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false; @@ -2349,7 +2154,9 @@ namespace IRaCIS.Core.Application.Service.Allocation var filterObj = (await _visitTaskRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == taskId)).IfNullThrowException(); var trialId = filterObj.TrialId; - var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException(); + //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.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); Expression> filterExpression = t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId && t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated; @@ -2373,7 +2180,7 @@ namespace IRaCIS.Core.Application.Service.Allocation //当前任务及其之后的所有访视任务、全局任务、裁判任务、肿瘤学阅片任务 //有序 - if (trialConfig.IsReadingTaskViewInOrder) + if (criterionConfig.IsReadingTaskViewInOrder) { switch (filterObj.ReadingCategory) @@ -2466,7 +2273,7 @@ namespace IRaCIS.Core.Application.Service.Allocation //有序 - if (trialConfig.IsReadingTaskViewInOrder) + if (criterionConfig.IsReadingTaskViewInOrder) { switch (filterObj.ReadingCategory) { @@ -2517,7 +2324,7 @@ namespace IRaCIS.Core.Application.Service.Allocation if (filterObj.ReadingCategory == ReadingCategory.Visit && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) { //有序 - if (trialConfig.IsReadingTaskViewInOrder) + if (criterionConfig.IsReadingTaskViewInOrder) { // 当前任务及其之后的所有访视任务 两个阅片人的 @@ -2555,7 +2362,7 @@ namespace IRaCIS.Core.Application.Service.Allocation if ((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && applyId != null) || (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null)) { //有序 - if (trialConfig.IsReadingTaskViewInOrder) + if (criterionConfig.IsReadingTaskViewInOrder) { if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned) { @@ -2589,7 +2396,7 @@ namespace IRaCIS.Core.Application.Service.Allocation if (((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM) && applyId != null) || (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && applyId == null)) { //有序 - if (trialConfig.IsReadingTaskViewInOrder) + if (criterionConfig.IsReadingTaskViewInOrder) { //申请的访视 要不是重阅重置,要不就是失效 不会存在取消分配 if (influenceTask.ReadingCategory == ReadingCategory.Visit && influenceTask.VisitTaskNum != filterObj.VisitTaskNum) @@ -2637,7 +2444,7 @@ namespace IRaCIS.Core.Application.Service.Allocation else { //有序 - if (trialConfig.IsReadingTaskViewInOrder) + if (criterionConfig.IsReadingTaskViewInOrder) { //申请的访视 要不是重阅重置,要不就是失效 不会存在取消分配 if (influenceTask.ReadingCategory == ReadingCategory.Visit && influenceTask.VisitTaskNum != filterObj.VisitTaskNum) @@ -2698,5 +2505,230 @@ namespace IRaCIS.Core.Application.Service.Allocation return list; } + + + #region 暂时废弃 + + + ///// + ///// 自动一次性分配所有未分配的 Subject 给医生 暂时废弃 + ///// + ///// + ///// + //[HttpPost] + //[UnitOfWork] + //[Obsolete] + //public async Task AutoSubjectAssignDoctor(AutoSubjectAssignCommand autoSubjectAssignCommand) + //{ + // //自动分配的话,需要把手动分配的给删掉 + + + // var trialId = autoSubjectAssignCommand.TrialId; + // var isJudge = autoSubjectAssignCommand.IsJudgeDoctor; + + + // //获取项目配置 判断应该分配几个医生 + // var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id/*, t.ReadingType*/, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.TaskAllocateObjEnum }).FirstOrDefaultAsync()).IfNullThrowException(); + + + // //获取 已产生任务的Subject 目前分配情况 + // var subjectList = _subjectRepository.Where(t => t.TrialId == trialId) + // .WhereIf(isJudge == false, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum != Arm.JudgeArm).Any()) + // .WhereIf(isJudge, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum == Arm.JudgeArm).Any()) + // ////过滤掉 那些回退的subject + // //.Where(t => !t.SubjectVisitList.Any(t => t.IsPMBackOrReReading)) + // .Select(t => new + // { + // SubjectId = t.Id, + + // //给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 }), + // //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 + // }).ToList(); + + // //已产生任务的Subject数量(裁判情况下,就是产生裁判任务Subject 的数量) + // var subjectCount = subjectList.Count; + + // //获取医生列表(裁判是裁判的医生列表) + // var waitAllocationDoctorList = _taskAllocationRuleRepository.Where(t => t.TrialId == trialId && t.IsEnable) + // .Where(t => t.IsJudgeDoctor == isJudge) + // .Select(t => new AutoAssignResultDTO() { DoctorUserId = t.DoctorUserId, PlanReadingRatio = t.PlanReadingRatio, SubjectCount = subjectCount }) + // .ToList(); + + // if (waitAllocationDoctorList.Count == 0) + // { + // throw new BusinessValidationFailedException("启用的医生数量为0"); + // } + + + // //已分配的 医生的情况 + // var haveAssignedSubjectDoctorList = subjectList.Clone().SelectMany(t => t.DoctorUserList.Select(c => new { t.SubjectId, c.DoctorUserId, c.ArmEnum })).ToList(); + + // //将目前已分配的情况 换到医生的维度 + // foreach (var waitAllocationDoctor in waitAllocationDoctorList) + // { + // waitAllocationDoctor.SubjectArmList = haveAssignedSubjectDoctorList.Where(t => t.DoctorUserId == waitAllocationDoctor.DoctorUserId) + // .Select(g => new SubjectArm() + // { + // SubjectId = g.SubjectId, + // ArmEnum = g.ArmEnum + // }).ToList(); + // } + + + // #region 完全按照Subject 遍历去分 + + + // //仅仅分配未应用的 而且 没有分配医生的 + // foreach (var subject in subjectList.Where(t => t.IsApplyed == false && !t.DoctorUserList.Any())) + // { + // //该Subject 已经分配的医生数量 + // var hasAssignDoctorCount = subject.DoctorUserList.Count(); + + // if (isJudge) + // { + // if (hasAssignDoctorCount > 1) + // { + // throw new BusinessValidationFailedException("当前有Subject裁判绑定医生数量大于1"); + + // } + + // var allocateDoctor = waitAllocationDoctorList.OrderByDescending(t => t.Weight).ThenByDescending(t => t.PlanReadingRatio).FirstOrDefault(); + + // //将分配结果记录 + // waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctor.DoctorUserId).SubjectArmList.Add(new SubjectArm() + // { + // SubjectId = subject.SubjectId, + // ArmEnum = Arm.JudgeArm + // }); + + // await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = subject.SubjectId, DoctorUserId = allocateDoctor.DoctorUserId, ArmEnum = Arm.JudgeArm, AssignTime = DateTime.Now }); + + // } + // else + // { + + // //分配两个医生 + // if (trialConfig.ReadingType == ReadingMethod.Double) + // { + + + // if (hasAssignDoctorCount > 2) + // { + // throw new BusinessValidationFailedException("双重阅片当前有Subject绑定医生数量大于2"); + + // } + + // var allocateDoctorList = waitAllocationDoctorList.OrderByDescending(t => t.Weight).ThenByDescending(t => t.PlanReadingRatio).Take(2).ToList(); + + + // #region 看阅片人之前在Subject哪个组做的多 + + // var preferredDoctor1Arm = waitAllocationDoctorList.Where(t => t.DoctorUserId == allocateDoctorList[0].DoctorUserId) + // .SelectMany(t => t.SubjectArmList).GroupBy(t => t.ArmEnum) + // .Select(g => new { ArmEnum = g.Key, SubjectCount = g.Count() }) + // .OrderByDescending(t => t.SubjectCount).FirstOrDefault()?.ArmEnum; + + // var preferredDoctor2Arm = waitAllocationDoctorList.Where(t => t.DoctorUserId == allocateDoctorList[1].DoctorUserId) + // .SelectMany(t => t.SubjectArmList).GroupBy(t => t.ArmEnum) + // .Select(g => new { ArmEnum = g.Key, SubjectCount = g.Count() }) + // .OrderByDescending(t => t.SubjectCount).FirstOrDefault()?.ArmEnum; + + // //存放医生分配的Arm + // var doctor1Arm = Arm.DoubleReadingArm1; + // var doctor2Arm = Arm.DoubleReadingArm2; + + // if (preferredDoctor1Arm == null && preferredDoctor2Arm == null || + // preferredDoctor1Arm == null && preferredDoctor2Arm == Arm.DoubleReadingArm2 || + // preferredDoctor1Arm == Arm.DoubleReadingArm1 && preferredDoctor2Arm == null || + // preferredDoctor1Arm == Arm.DoubleReadingArm1 && preferredDoctor2Arm == Arm.DoubleReadingArm2 + // ) + // { + // doctor1Arm = Arm.DoubleReadingArm1; + // doctor2Arm = Arm.DoubleReadingArm2; + // } + // else if (preferredDoctor1Arm == null && preferredDoctor2Arm == Arm.DoubleReadingArm1 || + // preferredDoctor1Arm == Arm.DoubleReadingArm2 && preferredDoctor2Arm == Arm.DoubleReadingArm1 || + // preferredDoctor1Arm == Arm.DoubleReadingArm2 && preferredDoctor2Arm == null) + // { + // doctor1Arm = Arm.DoubleReadingArm2; + // doctor2Arm = Arm.DoubleReadingArm1; + // } + + // else if (preferredDoctor1Arm == Arm.DoubleReadingArm1 && preferredDoctor2Arm == Arm.DoubleReadingArm1) + // { + // doctor1Arm = Arm.DoubleReadingArm1; + // doctor2Arm = Arm.DoubleReadingArm2; + // } + // else if (preferredDoctor1Arm == Arm.DoubleReadingArm2 && preferredDoctor2Arm == Arm.DoubleReadingArm2) + // { + // doctor1Arm = Arm.DoubleReadingArm2; + // doctor2Arm = Arm.DoubleReadingArm1; + // } + + // #endregion + + + // await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = subject.SubjectId, DoctorUserId = allocateDoctorList[0].DoctorUserId, ArmEnum = doctor1Arm, AssignTime = DateTime.Now }); + + + // //将分配结果记录 + // waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctorList[0].DoctorUserId).SubjectArmList.Add(new SubjectArm() + // { + // SubjectId = subject.SubjectId, + // ArmEnum = doctor1Arm + // }); + + + // await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = subject.SubjectId, DoctorUserId = allocateDoctorList[1].DoctorUserId, ArmEnum = doctor2Arm, AssignTime = DateTime.Now }); + + // //将分配结果记录 + // waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctorList[1].DoctorUserId).SubjectArmList.Add(new SubjectArm() + // { + // SubjectId = subject.SubjectId, + // ArmEnum = doctor2Arm + // }); + // } + // else if (trialConfig.ReadingType == ReadingMethod.Single) + // { + // if (hasAssignDoctorCount > 1) + // { + // throw new BusinessValidationFailedException("单重阅片当前有Subject绑定医生数量大于1"); + // } + + // var allocateDoctor = waitAllocationDoctorList.OrderByDescending(t => t.Weight).ThenByDescending(t => t.PlanReadingRatio).FirstOrDefault(); + + // //将分配结果记录 + // waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctor.DoctorUserId).SubjectArmList.Add(new SubjectArm() + // { + // SubjectId = subject.SubjectId, + // ArmEnum = Arm.SingleReadingArm + // }); + + // await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = subject.SubjectId, DoctorUserId = allocateDoctor.DoctorUserId, ArmEnum = Arm.SingleReadingArm, AssignTime = DateTime.Now }); + + // } + + // } + + // } + + + // #endregion + + + + + + + + // await _subjectUserRepository.SaveChangesAsync(); + // return ResponseOutput.Ok(); + + //} + + + #endregion } } diff --git a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs index 1d744bb4a..58101930c 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs @@ -175,6 +175,27 @@ namespace IRaCIS.Core.Domain.Models /// public bool IsReadingTaskViewInOrder { get; set; } = true; + + //任务分配对象 + public TaskAllocateObj TaskAllocateObjEnum { get; set; } + + + //后续访视任务自动分配 + public bool IsFollowVisitAutoAssign { get; set; } = true; + + //后续全局自动分配 + public bool IsFollowGlobalVisitAutoAssign { get; set; } = true; + + public bool IsFollowJudgeTaskAutoAssign { get; set; } = true; + + public TaskAllocateDefaultState FollowJudgeTaskAutoAssignDefaultState { get; set; } = TaskAllocateDefaultState.Allocated; + + //后续访视自动分配默认状态 + public TaskAllocateDefaultState FollowVisitAutoAssignDefaultState { get; set; } = TaskAllocateDefaultState.Allocated; + + //后续全局自动分配默认状态 + public TaskAllocateDefaultState FollowGlobalVisitAutoAssignDefaultState { get; set; } = TaskAllocateDefaultState.Allocated; + #endregion /// diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs index 63e69acc3..ac521030d 100644 --- a/IRaCIS.Core.Domain/Trial/Trial.cs +++ b/IRaCIS.Core.Domain/Trial/Trial.cs @@ -337,24 +337,24 @@ namespace IRaCIS.Core.Domain.Models public DateTime? DeletedTime { get; set; } public Guid? DeleteUserId { get; set; } - // - public TaskAllocateObj TaskAllocateObjEnum { get; set; } + //// + //public TaskAllocateObj TaskAllocateObjEnum { get; set; } - //Զ - public bool IsFollowVisitAutoAssign { get; set; } = true; + ////Զ + //public bool IsFollowVisitAutoAssign { get; set; } = true; - //ȫԶ - public bool IsFollowGlobalVisitAutoAssign { get; set; } = true; + ////ȫԶ + //public bool IsFollowGlobalVisitAutoAssign { get; set; } = true; - public bool IsFollowJudgeTaskAutoAssign { get; set; } = true; + //public bool IsFollowJudgeTaskAutoAssign { get; set; } = true; - public TaskAllocateDefaultState FollowJudgeTaskAutoAssignDefaultState { get; set; } = TaskAllocateDefaultState.Allocated; + //public TaskAllocateDefaultState FollowJudgeTaskAutoAssignDefaultState { get; set; } = TaskAllocateDefaultState.Allocated; - //ԶĬ״̬ - public TaskAllocateDefaultState FollowVisitAutoAssignDefaultState { get; set; } = TaskAllocateDefaultState.Allocated; + ////ԶĬ״̬ + //public TaskAllocateDefaultState FollowVisitAutoAssignDefaultState { get; set; } = TaskAllocateDefaultState.Allocated; - //ȫԶĬ״̬ - public TaskAllocateDefaultState FollowGlobalVisitAutoAssignDefaultState { get; set; } = TaskAllocateDefaultState.Allocated; + ////ȫԶĬ״̬ + //public TaskAllocateDefaultState FollowGlobalVisitAutoAssignDefaultState { get; set; } = TaskAllocateDefaultState.Allocated; ////Ƭʾ