重新发布任务分配算法

Uat_Study
hang 2022-06-16 17:38:15 +08:00
parent aa5846a784
commit a340b0f217
1 changed files with 22 additions and 16 deletions

View File

@ -751,8 +751,8 @@ namespace IRaCIS.Core.Application.Service
} }
//仅仅分配未应用的 //仅仅分配未应用的 而且 没有没有分配医生的
foreach (var subject in subjectList.Where(t => t.IsApplyed == false)) foreach (var subject in subjectList.Where(t => t.IsApplyed == false && !t.DoctorUserList.Any()))
{ {
//该Subject 已经分配的医生数量 //该Subject 已经分配的医生数量
var hasAssignDoctorCount = subject.DoctorUserList.Count(); var hasAssignDoctorCount = subject.DoctorUserList.Count();
@ -818,23 +818,29 @@ namespace IRaCIS.Core.Application.Service
} }
//if(!waitAllocationDoctorList.Where(t=>t.DoctorUserId== allocateDoctorList[0].DoctorUserId).SelectMany(u => u.SubjectArmList).Any(t => t.SubjectId == subject.SubjectId))
//{
await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = subject.SubjectId, DoctorUserId = allocateDoctorList[0].DoctorUserId, ArmEnum = doctor1Arm, AssignTime = DateTime.Now }); await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = subject.SubjectId, DoctorUserId = allocateDoctorList[0].DoctorUserId, ArmEnum = doctor1Arm, AssignTime = DateTime.Now });
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[0].DoctorUserId).SubjectArmList.Add(new SubjectArm() waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctorList[0].DoctorUserId).SubjectArmList.Add(new SubjectArm()
{ {
SubjectId = subject.SubjectId, SubjectId = subject.SubjectId,
ArmEnum = doctor1Arm ArmEnum = doctor1Arm
}); });
//}
//if (!waitAllocationDoctorList.Where(t => t.DoctorUserId == allocateDoctorList[1].DoctorUserId).SelectMany(u => u.SubjectArmList).Any(t => t.SubjectId == subject.SubjectId))
//{
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() waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctorList[1].DoctorUserId).SubjectArmList.Add(new SubjectArm()
{ {
SubjectId = subject.SubjectId, SubjectId = subject.SubjectId,
ArmEnum = doctor2Arm ArmEnum = doctor2Arm
}); });
//}
} }