Uat_Study
parent
77db9ac7dc
commit
ac155b7ce2
|
@ -127,41 +127,37 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
{
|
||||
await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = command.TrialId, TrialReadingCriterionId = command.TrialReadingCriterionId, ArmEnum = doctorArm.ArmEnum, DoctorUserId = doctorArm.DoctorUserId, SubjectId = subjectId, AssignTime = DateTime.Now });
|
||||
|
||||
//task.SuggesteFinishedTime = task.IsUrgent ? DateTime.Now.AddDays(2) : DateTime.Now.AddDays(7);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Expression<Func<VisitTask, bool>> updateWhere = t => t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.SubjectId == subjectId && t.ArmEnum == doctorArm.ArmEnum && t.TrialId == command.TrialId && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false;
|
||||
Expression<Func<VisitTask, bool>> updateWhere = t => t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.SubjectId == subjectId && t.ArmEnum == doctorArm.ArmEnum && t.TrialId == command.TrialId && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false;
|
||||
|
||||
if (inOrder)
|
||||
if (inOrder)
|
||||
{
|
||||
|
||||
if (await _subjectVisitRepository.AnyAsync(t => t.SubjectId == subjectId && t.CheckState != CheckStateEnum.CVPassed))
|
||||
{
|
||||
var notCheckPassedMinVisitNum = await _subjectVisitRepository.Where(t => t.SubjectId == subjectId && t.CheckState != CheckStateEnum.CVPassed).OrderBy(t => t.VisitNum).Select(t => t.VisitNum).FirstOrDefaultAsync();
|
||||
|
||||
if (await _subjectVisitRepository.AnyAsync(t => t.SubjectId == subjectId && t.CheckState != CheckStateEnum.CVPassed))
|
||||
{
|
||||
var notCheckPassedMinVisitNum = await _subjectVisitRepository.Where(t => t.SubjectId == subjectId && t.CheckState != CheckStateEnum.CVPassed).OrderBy(t => t.VisitNum).Select(t => t.VisitNum).FirstOrDefaultAsync();
|
||||
|
||||
updateWhere = updateWhere.And(t => t.VisitTaskNum < notCheckPassedMinVisitNum);
|
||||
|
||||
}
|
||||
updateWhere = updateWhere.And(t => t.VisitTaskNum < notCheckPassedMinVisitNum);
|
||||
|
||||
}
|
||||
|
||||
|
||||
await _visitTaskRepository
|
||||
.UpdatePartialFromQueryAsync(updateWhere,
|
||||
u => new VisitTask()
|
||||
{
|
||||
AllocateTime = DateTime.Now,
|
||||
DoctorUserId = doctorArm.DoctorUserId,
|
||||
TaskAllocationState = TaskAllocationState.Allocated,
|
||||
|
||||
SuggesteFinishedTime = DateTime.Now.AddDays(7),
|
||||
});
|
||||
|
||||
|
||||
//task.SuggesteFinishedTime = task.IsUrgent ? DateTime.Now.AddDays(2) : DateTime.Now.AddDays(7);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
await _visitTaskRepository
|
||||
.UpdatePartialFromQueryAsync(updateWhere,
|
||||
u => new VisitTask()
|
||||
{
|
||||
AllocateTime = DateTime.Now,
|
||||
DoctorUserId = doctorArm.DoctorUserId,
|
||||
TaskAllocationState = TaskAllocationState.Allocated,
|
||||
|
||||
SuggesteFinishedTime = DateTime.Now.AddDays(7),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue