|
|
|
@@ -62,7 +62,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<(PageOutput<SubjectAssignStat>,object)> GetSubjectAssignAndTaskStatList(SubjectAssignStatQuery querySubjectAssign)
|
|
|
|
|
public async Task<(PageOutput<SubjectAssignStat>, object)> GetSubjectAssignAndTaskStatList(SubjectAssignStatQuery querySubjectAssign)
|
|
|
|
|
{
|
|
|
|
|
var subjectQuery = _subjectRepository.Where(t => t.TrialId == querySubjectAssign.TrialId && t.SubjectVisitTaskList.Any())
|
|
|
|
|
.WhereIf(querySubjectAssign.SiteId != null, t => t.SiteId == querySubjectAssign.SiteId)
|
|
|
|
@@ -89,7 +89,11 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|
|
|
|
{
|
|
|
|
|
foreach (var doctorArm in command.DoctorArmList)
|
|
|
|
|
{
|
|
|
|
|
await _subjectUserRepository.AddAsync(new SubjectUser() { ArmEnum = doctorArm.ArmEnum, DoctorUserId = doctorArm.DoctorUserId, SubjectId = subjectId, AssignTime = DateTime.Now });
|
|
|
|
|
if(!await _subjectUserRepository.AnyAsync(t=>t.SubjectId == subjectId && t.DoctorUserId == doctorArm.DoctorUserId && t.ArmEnum == doctorArm.ArmEnum && t.IsConfirmed && t.OrignalSubjectUserId == null))
|
|
|
|
|
{
|
|
|
|
|
await _subjectUserRepository.AddAsync(new SubjectUser() { ArmEnum = doctorArm.ArmEnum, DoctorUserId = doctorArm.DoctorUserId, SubjectId = subjectId, AssignTime = DateTime.Now });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -99,6 +103,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 阅片人维度 Subject统计表
|
|
|
|
|
/// </summary>
|
|
|
|
@@ -112,6 +118,53 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取Subject 分配医生情况
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="subjectId"></param>
|
|
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<List<SubjectUserDTO>> GetSubjectAssignedDoctorList(Guid subjectId)
|
|
|
|
|
{
|
|
|
|
|
var list = await _subjectUserRepository.Where(t => t.SubjectId == subjectId && t.OrignalSubjectUserId == null && t.IsConfirmed).ProjectTo<SubjectUserDTO>(_mapper.ConfigurationProvider).ToListAsync();
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 取消Subject 分配的医生
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="commandList"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
/// <exception cref="BusinessValidationFailedException"></exception>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IResponseOutput> CancelSubjectAssignedDoctor(List<CancelSubjectAssignedDoctorCommand> commandList)
|
|
|
|
|
{
|
|
|
|
|
foreach (var command in commandList.Where(t => t.IsCancelAssign))
|
|
|
|
|
{
|
|
|
|
|
if(await _visitTaskRepository.AnyAsync(t=>t.SubjectId==command.SubjectId && t.DoctorUserId==command.DoctorUserId && t.ArmEnum==command.ArmEnum && t.ReadingTaskState != ReadingTaskState.WaitReading))
|
|
|
|
|
{
|
|
|
|
|
throw new BusinessValidationFailedException("当前医生已开始做该Subject的任务,不允许取消分配");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await _subjectUserRepository.DeleteFromQueryAsync(t => t.Id == command.Id);
|
|
|
|
|
|
|
|
|
|
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum, u => new VisitTask()
|
|
|
|
|
{
|
|
|
|
|
AllocateTime=null,
|
|
|
|
|
DoctorUserId=null,
|
|
|
|
|
TaskAllocationState=TaskAllocationState.NotAllocate
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await _visitTaskRepository.SaveChangesAsync();
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取手动分配 未分配的Subject列表(IsHaveAssigned 传递false)
|
|
|
|
@@ -767,7 +820,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|
|
|
|
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory)
|
|
|
|
|
.WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode)&& t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode) && t.IsAnalysisCreate==false))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode) && t.IsAnalysisCreate == false))
|
|
|
|
|
.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) || t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode))
|
|
|
|
|
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
|
|
|
|
@@ -879,7 +932,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|
|
|
|
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.OriginalReReadingTask.DoctorUserId == queryVisitTask.DoctorUserId)
|
|
|
|
|
.WhereIf(queryVisitTask.ReadingTaskState != null, t => t.OriginalReReadingTask.ReadingTaskState == queryVisitTask.ReadingTaskState)
|
|
|
|
|
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.OriginalReReadingTask.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.OriginalReReadingTask.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode)&& t.OriginalReReadingTask.IsAnalysisCreate) || (t.OriginalReReadingTask.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode)&& t.OriginalReReadingTask.IsAnalysisCreate==false))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.OriginalReReadingTask.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode) && t.OriginalReReadingTask.IsAnalysisCreate) || (t.OriginalReReadingTask.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode) && t.OriginalReReadingTask.IsAnalysisCreate == false))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.OriginalReReadingTask.TaskName.Contains(queryVisitTask.TaskName) || t.NewReReadingTask.TaskBlindName.Contains(queryVisitTask.TaskName))
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.OriginalReReadingTask.Subject.Code.Contains(queryVisitTask.SubjectCode) || t.OriginalReReadingTask.BlindSubjectCode.Contains(queryVisitTask.SubjectCode))
|
|
|
|
|
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime > queryVisitTask.BeginAllocateDate)
|
|
|
|
@@ -1305,7 +1358,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|
|
|
|
|
|
|
|
|
#region 影响的任务
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var influenceTaskList = await _visitTaskRepository.Where(filterExpression, true).ToListAsync();
|
|
|
|
|
|
|
|
|
@@ -1949,7 +2002,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|
|
|
|
{
|
|
|
|
|
influenceTask.TaskState = TaskState.HaveReturned;
|
|
|
|
|
|
|
|
|
|
origenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id,OptType=ReReadingOrBackOptType.Return });
|
|
|
|
|
origenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return });
|
|
|
|
|
}
|
|
|
|
|
else if (influenceTask.ReadingTaskState == ReadingTaskState.Reading)
|
|
|
|
|
{
|
|
|
|
|