From 596bb9fa9924209e42c5727ca3001e30d3e1bef0 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 8 Jun 2022 17:45:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/TaskAllocationRuleViewModel.cs | 2 +- .../SubjectVisitCheckPassedTrigger.cs | 24 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs index 806207274..9bacbbbab 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs @@ -44,7 +44,7 @@ namespace IRaCIS.Core.Application.ViewModel public Guid DoctorUserId { get; set; } - public List ArmList { get; set; } + public List ArmList { get; set; } = new List(); //public double? TargetCount => TotalTaskCount * PlanReadingRatio * 0.01; diff --git a/IRaCIS.Core.Application/Triggers/SubjectVisitCheckPassedTrigger.cs b/IRaCIS.Core.Application/Triggers/SubjectVisitCheckPassedTrigger.cs index 799c71e23..9a66856e7 100644 --- a/IRaCIS.Core.Application/Triggers/SubjectVisitCheckPassedTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/SubjectVisitCheckPassedTrigger.cs @@ -122,27 +122,31 @@ namespace IRaCIS.Core.Application.Triggers { //排除已经入选其他Arm的阅片人 - //是否有做过Arm1的医生 - if (allocateStat.Any(t => t.ArmList.Any(t => t == 1))) + //是否有做过Arm1的医生 有新的医生未分配 按照最优法找 + if (allocateStat.Any(t => t.ArmList.Any(t => t == 1)) && !allocateStat.Any(t=>t.ArmList.Count==0)) { - //找到最优的需要分配任务的医生 - task1.DoctorUserId = allocateStat.Where(t => t.ArmList.Any(t => t == 1)).OrderByDescending(t=>t.PlanReadingRatio).ThenBy(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.TotalTaskCount).FirstOrDefault().DoctorUserId; + + task1.DoctorUserId = allocateStat.Where(t => t.ArmList.Any(t => t == 1)).OrderByDescending(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.SelfTaskCount).ThenByDescending(t => t.PlanReadingRatio).FirstOrDefault().DoctorUserId; } else { - task1.DoctorUserId = allocateStat.OrderByDescending(t => t.PlanReadingRatio).ThenBy(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.TotalTaskCount).FirstOrDefault().DoctorUserId; + //找到最优的需要分配任务的医生 + task1.DoctorUserId = allocateStat.OrderByDescending(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.SelfTaskCount).ThenByDescending(t => t.PlanReadingRatio).FirstOrDefault().DoctorUserId; + + allocateStat.FirstOrDefault(t => t.DoctorUserId == task1.DoctorUserId).ArmList.Add(1); } - //是否有做过Arm2的医生 - if (allocateStat.Any(t => t.ArmList.Any(t => t == 2))) + //是否有做过Arm2的医生 有新的医生未分配 按照最优法找 + if (allocateStat.Any(t => t.ArmList.Any(t => t == 2)) && !allocateStat.Any(t => t.ArmList.Count == 0)) { - //找到最优的需要分配任务的医生 - task2.DoctorUserId = allocateStat.Where(t => t.ArmList.Any(t => t == 2)).OrderByDescending(t => t.PlanReadingRatio).ThenBy(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.TotalTaskCount).FirstOrDefault().DoctorUserId; + + task2.DoctorUserId = allocateStat.Where(t => t.ArmList.Any(t => t == 2)).OrderByDescending(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.SelfTaskCount).ThenByDescending(t => t.PlanReadingRatio).FirstOrDefault().DoctorUserId; } else { - task2.DoctorUserId = allocateStat.OrderByDescending(t => t.PlanReadingRatio).ThenBy(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.TotalTaskCount).Skip(1).FirstOrDefault().DoctorUserId; + //找到最优的需要分配任务的医生 + task2.DoctorUserId = allocateStat.OrderByDescending(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.SelfTaskCount).ThenByDescending(t => t.PlanReadingRatio).Skip(1).FirstOrDefault().DoctorUserId; } }