修改分配任务
This commit is contained in:
@@ -100,6 +100,17 @@ namespace IRaCIS.Core.Application.Triggers
|
||||
});
|
||||
|
||||
|
||||
if (trialConfig.TaskAllocateDefaultState == TaskAllocateDefaultState.Allocated)
|
||||
{
|
||||
task1.TaskState =TaskState.Allocated;
|
||||
task2.TaskState = TaskState.Allocated;
|
||||
}
|
||||
else if (trialConfig.TaskAllocateDefaultState == TaskAllocateDefaultState.InitAllocated)
|
||||
{
|
||||
task1.TaskState = TaskState.InitAllocated;
|
||||
task2.TaskState = TaskState.InitAllocated;
|
||||
}
|
||||
|
||||
if (trialConfig.TaskAllocateObjEnum == TaskAllocateObj.Subject)
|
||||
{
|
||||
|
||||
@@ -115,25 +126,25 @@ namespace IRaCIS.Core.Application.Triggers
|
||||
if (allocateStat.Any(t => t.ArmList.Any(t => t == 1)))
|
||||
{
|
||||
//找到最优的需要分配任务的医生
|
||||
task1.DoctorUserId = allocateStat.Where(t => t.ArmList.Any(t => t == 1)).OrderByDescending(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.PlanReadingRatio).ThenBy(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.TotalTaskCount).FirstOrDefault().DoctorUserId;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
task1.DoctorUserId = allocateStat.OrderByDescending(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.TotalTaskCount).FirstOrDefault().DoctorUserId;
|
||||
task1.DoctorUserId = allocateStat.OrderByDescending(t => t.PlanReadingRatio).ThenBy(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.TotalTaskCount).FirstOrDefault().DoctorUserId;
|
||||
}
|
||||
|
||||
//是否有做过Arm2的医生
|
||||
if (allocateStat.Any(t => t.ArmList.Any(t => t == 2)))
|
||||
{
|
||||
//找到最优的需要分配任务的医生
|
||||
task2.DoctorUserId = allocateStat.Where(t => t.ArmList.Any(t => t == 2)).OrderByDescending(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.PlanReadingRatio).ThenBy(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.TotalTaskCount).FirstOrDefault().DoctorUserId;
|
||||
}
|
||||
else
|
||||
{
|
||||
task2.DoctorUserId = allocateStat.OrderByDescending(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.TotalTaskCount).Skip(1).FirstOrDefault().DoctorUserId;
|
||||
task2.DoctorUserId = allocateStat.OrderByDescending(t => t.PlanReadingRatio).ThenBy(t => t.TotalTaskCount * t.PlanReadingRatio * 0.01 - t.TotalTaskCount).Skip(1).FirstOrDefault().DoctorUserId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -143,7 +154,7 @@ namespace IRaCIS.Core.Application.Triggers
|
||||
}
|
||||
|
||||
//手动分配的时候 如果只分配了Arm1 没有分配Arm2 就会有问题
|
||||
if (allocateSubjectArmList.Any(t => t.ArmEnum == 1) && allocateSubjectArmList.Any(t => t.ArmEnum == 2))
|
||||
if (!(allocateSubjectArmList.Any(t => t.ArmEnum == 1) && allocateSubjectArmList.Any(t => t.ArmEnum == 2)))
|
||||
{
|
||||
throw new BusinessValidationFailedException("请确认是否改了配置,或者手动分配时,只分配了一个Arm ");
|
||||
}
|
||||
@@ -153,7 +164,8 @@ namespace IRaCIS.Core.Application.Triggers
|
||||
task2.DoctorUserId = allocateSubjectArmList.FirstOrDefault(t => t.ArmEnum == 2).DoctorUserId;
|
||||
}
|
||||
|
||||
|
||||
task1.AllocateTime = DateTime.Now;
|
||||
task2.AllocateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user