更新读片状态

This commit is contained in:
2022-06-17 13:54:54 +08:00
parent 77f478c293
commit 3f573d6c11
6 changed files with 35 additions and 24 deletions
@@ -25,13 +25,14 @@ namespace IRaCIS.Core.Application.Service
private readonly IRepository<Trial> _trialRepository;
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
private readonly IRepository<TaskAllocationRule> _taskAllocationRuleRepository;
private readonly IRepository<Subject> _subjectRepository;
private readonly IRepository<SubjectUser> _subjectUserRepository;
private readonly IRepository<ReadModule> _readModuleRepository;
public VisitTaskService(IRepository<VisitTask> visitTaskRepository, IRepository<Trial> trialRepository, IRepository<SubjectVisit> subjectVisitRepository,
IRepository<Subject> subjectRepository, IRepository<SubjectUser> subjectUserRepository, IRepository<TaskAllocationRule> taskAllocationRuleRepository
IRepository<Subject> subjectRepository, IRepository<SubjectUser> subjectUserRepository, IRepository<TaskAllocationRule> taskAllocationRuleRepository, IRepository<ReadModule> readModuleRepository
)
{
_taskAllocationRuleRepository = taskAllocationRuleRepository;
@@ -40,6 +41,7 @@ namespace IRaCIS.Core.Application.Service
_subjectVisitRepository = subjectVisitRepository;
_subjectRepository = subjectRepository;
_subjectUserRepository = subjectUserRepository;
_readModuleRepository = readModuleRepository;
}
/// <summary>
@@ -447,6 +449,10 @@ namespace IRaCIS.Core.Application.Service
task.AllocateTime = DateTime.Now;
task.TaskState = TaskState.Allocated;
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == task.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.ImageReading });
await _readModuleRepository.BatchUpdateNoTrackingAsync(t => t.Id == task.SouceReadModuleId, u => new ReadModule() { ReadingStatus = ReadingStatusEnum.ImageReading });
}
else
{
@@ -798,8 +804,8 @@ namespace IRaCIS.Core.Application.Service
doctor1Arm = 1;
doctor2Arm = 2;
}
else if ( (preferredDoctor1Arm == null && preferredDoctor2Arm == 1)||
(preferredDoctor1Arm == 2 && preferredDoctor2Arm == 1)||
else if ((preferredDoctor1Arm == null && preferredDoctor2Arm == 1) ||
(preferredDoctor1Arm == 2 && preferredDoctor2Arm == 1) ||
(preferredDoctor1Arm == 2 && preferredDoctor2Arm == null))
{
doctor1Arm = 2;
@@ -810,7 +816,7 @@ namespace IRaCIS.Core.Application.Service
{
doctor1Arm = 1;
doctor2Arm = 2;
}
}
else if (preferredDoctor1Arm == 2 && preferredDoctor2Arm == 2)
{
doctor1Arm = 2;
@@ -820,27 +826,27 @@ 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 });
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[0].DoctorUserId, ArmEnum = doctor1Arm, AssignTime = DateTime.Now });
waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctorList[0].DoctorUserId).SubjectArmList.Add(new SubjectArm()
{
SubjectId = subject.SubjectId,
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 });
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
});
waitAllocationDoctorList.FirstOrDefault(t => t.DoctorUserId == allocateDoctorList[1].DoctorUserId).SubjectArmList.Add(new SubjectArm()
{
SubjectId = subject.SubjectId,
ArmEnum = doctor2Arm
});
//}
}