|
|
|
@@ -104,7 +104,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
|
|
|
|
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
|
|
|
|
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode))
|
|
|
|
|
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
|
|
|
|
@@ -138,7 +138,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
|
|
|
|
|
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
|
|
|
|
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
|
|
|
|
.WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode))
|
|
|
|
@@ -175,7 +175,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
|
|
|
|
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory)
|
|
|
|
|
.WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode))
|
|
|
|
|
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
|
|
|
|
@@ -210,7 +210,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
|
|
|
|
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
|
|
|
|
.WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode))
|
|
|
|
|
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
|
|
|
|
@@ -323,7 +323,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
|
|
|
|
|
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
|
|
|
|
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode))
|
|
|
|
|
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
|
|
|
|
@@ -358,7 +358,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
|
|
|
|
|
|
|
|
|
.WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode))
|
|
|
|
|
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
|
|
|
|
@@ -430,12 +430,12 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
var armEnum = assginSubjectDoctorCommand.DoctorUserIdArmList.Where(t => t.DoctorUserId == doctorUserId).First().ArmEnum;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (await _subjectUserRepository.AnyAsync(t => t.TrialId == trialId && t.SubjectId == subjectId && t.DoctorUserId == doctorUserId && t.ArmEnum != armEnum))
|
|
|
|
|
if (await _subjectUserRepository.AnyAsync(t => t.TrialId == trialId && t.SubjectId == subjectId && t.DoctorUserId == doctorUserId && t.ArmEnum != armEnum && t.OrignalSubjectUserId==null))
|
|
|
|
|
{
|
|
|
|
|
throw new BusinessValidationFailedException("有Subject 在其他Arm组已有该医生,不允许在新的组添加该医生");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (await _subjectUserRepository.AnyAsync(t => t.TrialId == trialId && t.SubjectId == subjectId && t.DoctorUserId == doctorUserId && t.ArmEnum == armEnum))
|
|
|
|
|
if (await _subjectUserRepository.AnyAsync(t => t.TrialId == trialId && t.SubjectId == subjectId && t.DoctorUserId == doctorUserId && t.ArmEnum == armEnum && t.OrignalSubjectUserId == null))
|
|
|
|
|
{
|
|
|
|
|
throw new BusinessValidationFailedException("有Subject 已有该Arm组的医生,不允许继续分配,请刷新页面,确认页面数据是否过期");
|
|
|
|
|
}
|
|
|
|
@@ -466,7 +466,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
{
|
|
|
|
|
foreach (var subjectId in cancelSubjectAssignCommand.SubjectIdList)
|
|
|
|
|
{
|
|
|
|
|
if (await _visitTaskRepository.AnyAsync(t => t.SubjectId == subjectId && t.DoctorUserId != null && t.ArmEnum == Arm.JudgeArm))
|
|
|
|
|
if (await _visitTaskRepository.AnyAsync(t => t.SubjectId == subjectId && t.DoctorUserId != null && t.ArmEnum == Arm.JudgeArm ))
|
|
|
|
|
{
|
|
|
|
|
throw new BusinessValidationFailedException("有Subject任务已应用,不允许取消分配");
|
|
|
|
|
}
|
|
|
|
@@ -540,7 +540,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
if (assignConfirmCommand.SubjectDoctorUserList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
subjectDoctorIdArmList = _subjectUserRepository.Where(t => t.SubjectId == subjectId).Select(t => new DoctorArm() { DoctorUserId = t.DoctorUserId, ArmEnum = t.ArmEnum }).ToList();
|
|
|
|
|
subjectDoctorIdArmList = _subjectUserRepository.Where(t => t.SubjectId == subjectId && t.OrignalSubjectUserId == null).Select(t => new DoctorArm() { DoctorUserId = t.DoctorUserId, ArmEnum = t.ArmEnum }).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@@ -560,7 +560,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
{
|
|
|
|
|
task.DoctorUserId = subjectDoctorArm.DoctorUserId;
|
|
|
|
|
task.AllocateTime = DateTime.Now;
|
|
|
|
|
task.TaskState = TaskState.Allocated;
|
|
|
|
|
task.TaskAllocationState = TaskAllocationState.Allocated;
|
|
|
|
|
|
|
|
|
|
task.SuggesteFinishedTime = task.IsUrgent ? DateTime.Now.AddDays(2) : DateTime.Now.AddDays(7);
|
|
|
|
|
|
|
|
|
@@ -615,8 +615,10 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
.Select(t => new
|
|
|
|
|
{
|
|
|
|
|
SubjectId = t.Id,
|
|
|
|
|
DoctorUserList = t.SubjectDoctorList.Where(t => isJudge ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Select(t => new { t.DoctorUserId, t.ArmEnum }),
|
|
|
|
|
IsApplyed = t.SubjectDoctorList.Where(t => isJudge ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).SelectMany(t => t.SubjectArmVisitTaskList).Any(c => c.DoctorUserId != null)
|
|
|
|
|
|
|
|
|
|
//给Subject分配医生的时候, 未确认绑定关系的
|
|
|
|
|
DoctorUserList = t.SubjectDoctorList.Where(t => isJudge ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t=> t.OrignalSubjectUserId==null).Select(t => new { t.DoctorUserId, t.ArmEnum }),
|
|
|
|
|
IsApplyed = t.SubjectDoctorList.Where(t => isJudge ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.OrignalSubjectUserId == null).SelectMany(t => t.SubjectArmVisitTaskList).Any(c => c.DoctorUserId != null)
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
//已产生任务的Subject数量(裁判情况下,就是产生裁判任务Subject 的数量)
|
|
|
|
@@ -815,7 +817,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
if (visitTask.SourceSubjectVisitId != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(await _visitTaskRepository.AnyAsync(t=>t.SourceSubjectVisitId== visitTask.SourceSubjectVisitId && t.DoctorUserId== assignSubjectTaskToDoctorCommand.DoctorUserId && t.Id != visitTask.Id))
|
|
|
|
|
if (await _visitTaskRepository.AnyAsync(t => t.SourceSubjectVisitId == visitTask.SourceSubjectVisitId && t.DoctorUserId == assignSubjectTaskToDoctorCommand.DoctorUserId && t.Id != visitTask.Id))
|
|
|
|
|
{
|
|
|
|
|
return ResponseOutput.NotOk("其中一个任务已分配给该医生,不允许分配");
|
|
|
|
|
}
|
|
|
|
@@ -836,7 +838,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
|
|
|
|
|
visitTask.AllocateTime = DateTime.Now;
|
|
|
|
|
visitTask.DoctorUserId = assignSubjectTaskToDoctorCommand.DoctorUserId;
|
|
|
|
|
visitTask.TaskState = TaskState.Allocated;
|
|
|
|
|
visitTask.TaskAllocationState = TaskAllocationState.Allocated;
|
|
|
|
|
|
|
|
|
|
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.ImageReading });
|
|
|
|
|
|
|
|
|
@@ -858,13 +860,13 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
|
|
|
|
|
else if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.Confirm)
|
|
|
|
|
{
|
|
|
|
|
visitTask.TaskState = TaskState.Allocated;
|
|
|
|
|
visitTask.TaskAllocationState = TaskAllocationState.Allocated;
|
|
|
|
|
}
|
|
|
|
|
else if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.CancelAssign)
|
|
|
|
|
{
|
|
|
|
|
visitTask.AllocateTime = null;
|
|
|
|
|
visitTask.DoctorUserId = null;
|
|
|
|
|
visitTask.TaskState = TaskState.NotAllocate;
|
|
|
|
|
visitTask.TaskAllocationState = TaskAllocationState.NotAllocate;
|
|
|
|
|
|
|
|
|
|
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.TaskAllocate });
|
|
|
|
|
|
|
|
|
@@ -885,15 +887,18 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
[UnitOfWork]
|
|
|
|
|
public async Task<IResponseOutput> ApplyReReading(ApplyReReadingCommand applyReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService)
|
|
|
|
|
{
|
|
|
|
|
var taskList = await _visitTaskRepository.Where(t => applyReReadingCommand.TaskIdList.Contains(t.Id), true).Include(t=>t.JudgeVisitTask).ToListAsync();
|
|
|
|
|
var taskList = await _visitTaskRepository.Where(t => applyReReadingCommand.TaskIdList.Contains(t.Id), true).Include(t => t.JudgeVisitTask).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var reReadingTaskList = taskList.Clone();
|
|
|
|
|
|
|
|
|
|
foreach (var task in taskList)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(await _visitTaskRepository.AnyAsync(t=>t.OriginalReReadingId==task.Id))
|
|
|
|
|
{
|
|
|
|
|
throw new BusinessValidationFailedException("已产生重阅任务,不允许再次申请");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
task.IsReReading = true;
|
|
|
|
|
task.RequestReReadingReason = applyReReadingCommand.RequestReReadingReason;
|
|
|
|
|
task.RequestReReadingType = applyReReadingCommand.RequestReReadingTypeEnum;
|
|
|
|
|
task.RequestReReadingTime = DateTime.Now;
|
|
|
|
@@ -902,16 +907,15 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
//产生了裁判
|
|
|
|
|
if (task.JudgeVisitTaskId != null)
|
|
|
|
|
{
|
|
|
|
|
if(task.ReadingTaskState==ReadingTaskState.WaitReading || task.ReadingTaskState == ReadingTaskState.Reading)
|
|
|
|
|
if (task.ReadingTaskState == ReadingTaskState.WaitReading || task.ReadingTaskState == ReadingTaskState.Reading)
|
|
|
|
|
{
|
|
|
|
|
task.JudgeVisitTask.ReadingTaskState = ReadingTaskState.HaveCanceled;
|
|
|
|
|
task.JudgeVisitTask.TaskState = TaskState.HaveCanceled;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
task.JudgeVisitTask.ReadingTaskState = ReadingTaskState.HaveReturned;
|
|
|
|
|
task.JudgeVisitTask.TaskState = TaskState.HaveReturned;
|
|
|
|
|
|
|
|
|
|
//task.JudgeVisitTask.IsJudgeTaskReturn = true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -953,6 +957,7 @@ namespace IRaCIS.Core.Application.Service
|
|
|
|
|
|
|
|
|
|
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => agreeReReadingCommand.TaskIdList.Contains(t.Id), u => new VisitTask()
|
|
|
|
|
{
|
|
|
|
|
IsReReading = true,
|
|
|
|
|
RequestReReadingResultEnum = agreeReReadingCommand.RequestReReadingResultEnum,
|
|
|
|
|
RequestReReadingConfirmUserId = _userInfo.Id
|
|
|
|
|
}, true);
|
|
|
|
|