申请提示

Uat_Study
hang 2022-10-08 16:43:29 +08:00
parent 4c831b146f
commit 55aa88f6c6
1 changed files with 122 additions and 134 deletions

View File

@ -98,13 +98,13 @@ namespace IRaCIS.Core.Application.Service.Allocation
{ {
foreach (var doctorArm in command.DoctorArmList) foreach (var doctorArm in command.DoctorArmList)
{ {
if (!await _subjectUserRepository.Where(t=>t.TrialReadingCriterionId==command.TrialReadingCriterionId).AnyAsync(t => t.SubjectId == subjectId && t.DoctorUserId == doctorArm.DoctorUserId && t.ArmEnum == doctorArm.ArmEnum && t.IsConfirmed && t.OrignalSubjectUserId == null)) if (!await _subjectUserRepository.Where(t => t.TrialReadingCriterionId == command.TrialReadingCriterionId).AnyAsync(t => t.SubjectId == subjectId && t.DoctorUserId == doctorArm.DoctorUserId && t.ArmEnum == doctorArm.ArmEnum && t.IsConfirmed && t.OrignalSubjectUserId == null))
{ {
await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = command.TrialId, TrialReadingCriterionId=command.TrialReadingCriterionId, ArmEnum = doctorArm.ArmEnum, DoctorUserId = doctorArm.DoctorUserId, SubjectId = subjectId, AssignTime = DateTime.Now }); await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = command.TrialId, TrialReadingCriterionId = command.TrialReadingCriterionId, ArmEnum = doctorArm.ArmEnum, DoctorUserId = doctorArm.DoctorUserId, SubjectId = subjectId, AssignTime = DateTime.Now });
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)
{ {
@ -189,14 +189,14 @@ namespace IRaCIS.Core.Application.Service.Allocation
{ {
foreach (var command in cancelCommand.CancelList.Where(t => t.IsCancelAssign)) foreach (var command in cancelCommand.CancelList.Where(t => t.IsCancelAssign))
{ {
if (await _visitTaskRepository.AnyAsync(t => t.TrialReadingCriterionId== cancelCommand.TrialReadingCriterionId && t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState != ReadingTaskState.WaitReading)) if (await _visitTaskRepository.AnyAsync(t => t.TrialReadingCriterionId == cancelCommand.TrialReadingCriterionId && t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState != ReadingTaskState.WaitReading))
{ {
throw new BusinessValidationFailedException("当前医生已开始做该Subject 该标准的任务,不允许取消分配"); throw new BusinessValidationFailedException("当前医生已开始做该Subject 该标准的任务,不允许取消分配");
} }
await _subjectUserRepository.DeleteFromQueryAsync(t => t.Id == command.Id); await _subjectUserRepository.DeleteFromQueryAsync(t => t.Id == command.Id);
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.TrialReadingCriterionId== cancelCommand.TrialReadingCriterionId && t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState == ReadingTaskState.WaitReading && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false, u => new VisitTask() await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.TrialReadingCriterionId == cancelCommand.TrialReadingCriterionId && t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState == ReadingTaskState.WaitReading && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false, u => new VisitTask()
{ {
AllocateTime = null, AllocateTime = null,
DoctorUserId = null, DoctorUserId = null,
@ -1093,7 +1093,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
else else
{ {
var taskQuery = _visitTaskRepository.Where(x => x.TrialId == iRUnReadSubjectQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId==trialReadingCriterionId) var taskQuery = _visitTaskRepository.Where(x => x.TrialId == iRUnReadSubjectQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId)
.Where(x => !x.Subject.IsDeleted); .Where(x => !x.Subject.IsDeleted);
IRUnReadOutDto iRUnReadOut = new IRUnReadOutDto() IRUnReadOutDto iRUnReadOut = new IRUnReadOutDto()
@ -1127,10 +1127,10 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// </summary> /// </summary>
/// <param name="trialId"></param> /// <param name="trialId"></param>
/// <returns></returns> /// <returns></returns>
public (int, IOrderedQueryable<IRUnReadSubjectView>) GetOrderReadingIQueryable(Guid trialId,Guid? trialReadingCriterionId) public (int, IOrderedQueryable<IRUnReadSubjectView>) GetOrderReadingIQueryable(Guid trialId, Guid? trialReadingCriterionId)
{ {
var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id ) var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id)
.WhereIf(trialReadingCriterionId!=null,t=>t.TrialReadingCriterionId==trialReadingCriterionId) .WhereIf(trialReadingCriterionId != null, t => t.TrialReadingCriterionId == trialReadingCriterionId)
.Where(x => !x.Subject.IsDeleted) .Where(x => !x.Subject.IsDeleted)
.Where(t => (t.ReadingTaskState != ReadingTaskState.HaveSigned || t.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed || t.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) && t.TaskState == TaskState.Effect) .Where(t => (t.ReadingTaskState != ReadingTaskState.HaveSigned || t.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed || t.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) && t.TaskState == TaskState.Effect)
.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode }); .GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode });
@ -1153,7 +1153,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
ReadingCategory = u.ReadingCategory, ReadingCategory = u.ReadingCategory,
IsAnalysisCreate = u.IsAnalysisCreate, IsAnalysisCreate = u.IsAnalysisCreate,
TrialReadingCriterionId=u.TrialReadingCriterionId, TrialReadingCriterionId = u.TrialReadingCriterionId,
}).ToList(), }).ToList(),
}).Where(x => x.UnReadTaskCount > 0).OrderBy(x => x.SubjectId); }).Where(x => x.UnReadTaskCount > 0).OrderBy(x => x.SubjectId);
@ -1218,7 +1218,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
{ {
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).ToListAsync();
var trialConfig = (await _trialRepository.Where(t => t.Id == applyReReadingCommand.TrialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); var trialConfig = (await _trialRepository.Where(t => t.Id == applyReReadingCommand.TrialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException();
@ -1238,6 +1238,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
{ {
if (task.IsAnalysisCreate) if (task.IsAnalysisCreate)
@ -1250,23 +1251,22 @@ namespace IRaCIS.Core.Application.Service.Allocation
throw new BusinessValidationFailedException("PM 仅仅允许对访视类型的任务申请重阅"); throw new BusinessValidationFailedException("PM 仅仅允许对访视类型的任务申请重阅");
} }
// 有序 一个受试者访视重阅未处理完,不能申请其他的
if (trialConfig.IsReadingTaskViewInOrder)
{
if (await _visitTaskReReadingRepository.AnyAsync(t => t.OriginalReReadingTask.TrialId == task.TrialId && t.OriginalReReadingTask.SubjectId == task.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect
&& t.OriginalReReadingTask.TrialReadingCriterionId==task.TrialReadingCriterionId
&& t.OriginalReReadingTask.ReadingTaskState == ReadingTaskState.HaveSigned && t.RequestReReadingType == RequestReReadingType.TrialGroupApply && t.RequestReReadingResultEnum == RequestReReadingResult.Default))
{
return ResponseOutput.NotOk("当前为有序阅片,该受试者已有访视已申请重阅还未处理,暂不能继续申请重阅");
}
}
task.ReReadingApplyState = ReReadingApplyState.TrialGroupHaveApplyed; task.ReReadingApplyState = ReReadingApplyState.TrialGroupHaveApplyed;
//// 有序
//if (trialConfig.IsReadingTaskViewInOrder)
//{
// // 当前访视之前 已有任务申请
// if (await _visitTaskRepository.AnyAsync(t => t.TrialId == task.TrialId && t.SubjectId == task.SubjectId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Visit
// && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.VisitTaskNum <= task.VisitTaskNum && t.Id != task.Id && t.ReReadingApplyState == ReReadingApplyState.HaveApplyed))
// {
// return ResponseOutput.NotOk("当前为有序阅片,之前有访视,或其他IR的本次访视已申请重阅还未处理不允许申请");
// }
//}
//else
//{
//}
} }
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer) if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer)
{ {
@ -1276,25 +1276,51 @@ namespace IRaCIS.Core.Application.Service.Allocation
if (trialConfig.IsReadingTaskViewInOrder) if (trialConfig.IsReadingTaskViewInOrder)
{ {
if (await _visitTaskReReadingRepository.AnyAsync(t => t.OriginalReReadingTask.TrialId == task.TrialId && t.OriginalReReadingTask.SubjectId == task.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect
&& t.OriginalReReadingTask.TrialReadingCriterionId == task.TrialReadingCriterionId
&& t.OriginalReReadingTask.ReadingTaskState == ReadingTaskState.HaveSigned && t.RequestReReadingType == RequestReReadingType.DocotorApply && t.RequestReReadingResultEnum == RequestReReadingResult.Default))
{
return ResponseOutput.NotOk("当前为有序阅片,该受试者已有访视已申请重阅还未处理,暂不能继续申请重阅");
}
Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == task.TrialId && t.SubjectId == task.SubjectId && t.TaskState == TaskState.Effect
//在PM 的申请重阅的影响列表里也不能申请重阅
var pmApply = await _visitTaskReReadingRepository.Where(t => t.OriginalReReadingTask.TrialId == task.TrialId && t.OriginalReReadingTask.SubjectId == task.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect && t.OriginalReReadingTask.ReadingCategory == ReadingCategory.Visit
&& t.OriginalReReadingTask.ReadingTaskState == ReadingTaskState.HaveSigned && t.RequestReReadingType == RequestReReadingType.TrialGroupApply && t.RequestReReadingResultEnum == RequestReReadingResult.Default).Include(t=>t.OriginalReReadingTask).FirstOrDefaultAsync();
if (pmApply != null)
{
var originalTask = pmApply.OriginalReReadingTask;
//PM 有序影响列表
if (await _visitTaskRepository.Where(t => t.TrialId == originalTask.TrialId && t.SubjectId == originalTask.SubjectId && t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated && t.IsAnalysisCreate == false && t.TrialReadingCriterionId == originalTask.TrialReadingCriterionId && t.VisitTaskNum > originalTask.VisitTaskNum).AnyAsync(t => t.VisitTaskNum == task.VisitTaskNum))
{
return ResponseOutput.NotOk("当前为有序阅片,影像存在问题,项目组已申请回退,暂不能申请重阅");
}
}
Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == task.TrialId && t.SubjectId == task.SubjectId && t.TaskState == TaskState.Effect && t.TrialReadingCriterionId==task.TrialReadingCriterionId
&& t.ReadingTaskState == ReadingTaskState.HaveSigned && t.DoctorUserId == task.DoctorUserId && t.IsAnalysisCreate == false && t.VisitTaskNum > task.VisitTaskNum; && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.DoctorUserId == task.DoctorUserId && t.IsAnalysisCreate == false && t.VisitTaskNum > task.VisitTaskNum;
if (task.ReadingCategory == ReadingCategory.Judge && await _visitTaskRepository.AnyAsync(filterExpression.And(t => t.ReadingCategory == ReadingCategory.Global))) if (task.ReadingCategory == ReadingCategory.Judge && await _visitTaskRepository.AnyAsync(filterExpression.And(t => t.ReadingCategory == ReadingCategory.Global)))
{ {
throw new BusinessValidationFailedException("只允许申请该受试者阅片人最后一次完成全局任务重阅"); throw new BusinessValidationFailedException("有序阅片,只允许申请该受试者阅片人最后一次完成全局任务重阅");
} }
if (task.ReadingCategory == ReadingCategory.Oncology && await _visitTaskRepository.AnyAsync(filterExpression.And(t => t.ReadingCategory == ReadingCategory.Oncology))) if (task.ReadingCategory == ReadingCategory.Oncology && await _visitTaskRepository.AnyAsync(filterExpression.And(t => t.ReadingCategory == ReadingCategory.Oncology)))
{ {
throw new BusinessValidationFailedException("只允许申请该受试者阅片人最后一次完成肿瘤学任务重阅"); throw new BusinessValidationFailedException("有序阅片,只允许申请该受试者阅片人最后一次完成肿瘤学任务重阅");
} }
if (task.ReadingCategory == ReadingCategory.Judge && await _visitTaskRepository.AnyAsync(filterExpression.And(t => t.ReadingCategory == ReadingCategory.Judge))) if (task.ReadingCategory == ReadingCategory.Judge && await _visitTaskRepository.AnyAsync(filterExpression.And(t => t.ReadingCategory == ReadingCategory.Judge)))
{ {
throw new BusinessValidationFailedException("只允许申请该受试者阅片人最后一次完成裁判的任务重阅"); throw new BusinessValidationFailedException("有序阅片,只允许申请该受试者阅片人最后一次完成裁判的任务重阅");
} }
} }
@ -1421,20 +1447,20 @@ namespace IRaCIS.Core.Application.Service.Allocation
visitTaskReReadingAppply.RequestReReadingRejectReason = agreeReReadingCommand.RequestReReadingRejectReason; visitTaskReReadingAppply.RequestReReadingRejectReason = agreeReReadingCommand.RequestReReadingRejectReason;
// 当前访视之前 已有任务申请 //// 当前访视之前 已有任务申请
if (trialConfig.IsReadingTaskViewInOrder) //if (trialConfig.IsReadingTaskViewInOrder)
{ //{
var query = _visitTaskReReadingRepository.Where(t => t.OriginalReReadingTask.SubjectId == origenalTask.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect && t.OriginalReReadingTask.ReadingCategory == ReadingCategory.Visit // var query = _visitTaskReReadingRepository.Where(t => t.OriginalReReadingTask.SubjectId == origenalTask.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect && t.OriginalReReadingTask.ReadingCategory == ReadingCategory.Visit
&& t.OriginalReReadingTask.ReadingTaskState == ReadingTaskState.HaveSigned && t.OriginalReReadingTask.VisitTaskNum > origenalTask.VisitTaskNum && t.RequestReReadingResultEnum == RequestReReadingResult.Default) // && t.OriginalReReadingTask.ReadingTaskState == ReadingTaskState.HaveSigned && t.OriginalReReadingTask.VisitTaskNum > origenalTask.VisitTaskNum && t.RequestReReadingResultEnum == RequestReReadingResult.Default)
.Where(t => t.OriginalReReadingTask.IsAnalysisCreate == origenalTask.IsAnalysisCreate); // .Where(t => t.OriginalReReadingTask.IsAnalysisCreate == origenalTask.IsAnalysisCreate);
if (await query.AnyAsync()) // if (await query.AnyAsync())
{ // {
return ResponseOutput.NotOk("当前为有序阅片,当前访视之后,也申请了重阅 必须从后向前处理"); // return ResponseOutput.NotOk("当前为有序阅片,当前访视之后,也申请了重阅 必须从后向前处理");
} // }
} //}
Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == trialId && t.SubjectId == origenalTask.SubjectId && t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated; Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == trialId && t.SubjectId == origenalTask.SubjectId && t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated;
@ -1444,57 +1470,37 @@ namespace IRaCIS.Core.Application.Service.Allocation
if (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree) if (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree)
{ {
////有序 同一访视其他申请
//if (trialConfig.IsReadingTaskViewInOrder)
//{
// await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.OriginalReReadingTask.SubjectId == visitTaskReReadingAppply.OriginalReReadingTask.SubjectId && t.OriginalReReadingTask.VisitTaskNum > origenalTask.VisitTaskNum, u => new VisitTaskReReading()
// {
// RequestReReadingConfirmUserId = _userInfo.Id,
// RequestReReadingResultEnum = RequestReReadingResult.Agree,
// });
//}
//if(visitTaskReReadingAppply.RequestReReadingType)
#region PM 申请双重阅片 同一访视 其他已申请的任务也修改为同意
await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.OriginalReReadingTask.SubjectId == origenalTask.SubjectId &&
t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed &&
//t.RequestReReadingResultEnum==RequestReReadingResult.Default &&
t.RequestReReadingType == RequestReReadingType.TrialGroupApply &&
t.OriginalReReadingTask.VisitTaskNum == origenalTask.VisitTaskNum &&
t.Id != item.Id, u => new VisitTaskReReading()
{
RequestReReadingConfirmUserId = _userInfo.Id,
RequestReReadingResultEnum = RequestReReadingResult.Agree,
});
//只更新 PM 申请 同一访视的数据
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == origenalTask.SubjectId &&
t.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed &&
t.IsAnalysisCreate == origenalTask.IsAnalysisCreate &&
t.VisitTaskNum == origenalTask.VisitTaskNum &&
t.Id != origenalTask.Id, u => new VisitTask()
{
ReReadingApplyState = ReReadingApplyState.Agree
});
#endregion
//PM申请 SPM / CPM审批 回退访视,在此不生成访视任务 影响多个标准的任务 //PM申请 SPM / CPM审批 回退访视,在此不生成访视任务 影响多个标准的任务
if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.TrialGroupApply && (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)) if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.TrialGroupApply && (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM))
{ {
#region PM 申请两个IR 同一访视,其他人的申请记录也设置为同意 不会出现,因为在未处理前 一个Subject只能申请一次
// await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.OriginalReReadingTask.SubjectId == origenalTask.SubjectId &&
// t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed &&
// t.RequestReReadingType == RequestReReadingType.TrialGroupApply &&
//t.OriginalReReadingTask.VisitTaskNum == origenalTask.VisitTaskNum &&
//t.Id != item.Id, u => new VisitTaskReReading()
//{
// RequestReReadingConfirmUserId = _userInfo.Id,
// RequestReReadingResultEnum = RequestReReadingResult.Agree,
//});
// //只更新 PM 申请 同一访视的数据
// await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == origenalTask.SubjectId &&
// t.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed &&
// t.TrialReadingCriterionId == origenalTask.TrialReadingCriterionId &&
// t.IsAnalysisCreate == origenalTask.IsAnalysisCreate &&
// t.VisitTaskNum == origenalTask.VisitTaskNum &&
// t.Id != origenalTask.Id, u => new VisitTask()
// {
// ReReadingApplyState = ReReadingApplyState.Agree
// });
#endregion
// 不管有序 无序 都会 回退访视 // 不管有序 无序 都会 回退访视
if (origenalTask.ReadingCategory == ReadingCategory.Visit) if (origenalTask.ReadingCategory == ReadingCategory.Visit)
{ {
@ -1591,49 +1597,6 @@ namespace IRaCIS.Core.Application.Service.Allocation
else else
{ {
#region old
////阅片任务产生了裁判
//if (origenalTask.JudgeVisitTaskId != null)
//{
// //裁判任务是否已阅片完成
// var judgeTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == origenalTask.JudgeVisitTaskId);
// if (judgeTask.ReadingTaskState == ReadingTaskState.HaveSigned)
// {
// judgeTask.TaskState = TaskState.HaveReturned;
// }
// //裁判任务未完
// else
// {
// judgeTask.TaskState = TaskState.Adbandon;
// }
//}
////不管是否触发裁判 阅片任务退回,待影像重传后重新分 配给原阅片人
//if (trialConfig.ReadingType == ReadingMethod.Double)
//{
// //考虑该访视 另外一个阅片人的任务也同时退回
// var otherTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.SourceSubjectVisitId == origenalTask.SourceSubjectVisitId && t.Id != origenalTask.Id && t.TaskState == TaskState.Effect);
// if (otherTask.ReadingTaskState == ReadingTaskState.HaveSigned)
// {
// otherTask.TaskState = TaskState.HaveReturned;
// }
// else
// {
// otherTask.TaskState = TaskState.Adbandon;
// }
//}
#endregion
// 1.当前任务及裁判任务 // 1.当前任务及裁判任务
// 2.影响所有阅片人的任务 // 2.影响所有阅片人的任务
@ -1692,10 +1655,35 @@ namespace IRaCIS.Core.Application.Service.Allocation
//IR申请 PM 审批 注意这里有一致性分析的申请同意 不会回退访视,在此要生成影响的访视任务 //IR申请 PM 审批 注意这里有一致性分析的申请同意 不会回退访视,在此要生成影响的访视任务
else if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.DocotorApply && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) else if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.DocotorApply && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
{ {
#region 两个IR 申请同一访视,其他人的申请记录也设置为同意
await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.OriginalReReadingTask.SubjectId == origenalTask.SubjectId &&
t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed &&
t.RequestReReadingType == RequestReReadingType.DocotorApply &&
t.OriginalReReadingTask.VisitTaskNum == origenalTask.VisitTaskNum &&
t.Id != item.Id, u => new VisitTaskReReading()
{
RequestReReadingConfirmUserId = _userInfo.Id,
RequestReReadingResultEnum = RequestReReadingResult.Agree,
});
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == origenalTask.SubjectId &&
t.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed &&
t.TrialReadingCriterionId == origenalTask.TrialReadingCriterionId &&
t.IsAnalysisCreate == origenalTask.IsAnalysisCreate &&
t.VisitTaskNum == origenalTask.VisitTaskNum &&
t.Id != origenalTask.Id, u => new VisitTask()
{
ReReadingApplyState = ReReadingApplyState.Agree
});
#endregion
//影响申请标准的任务 //影响申请标准的任务
filterExpression = filterExpression.And(t => t.TrialReadingCriterionId==origenalTask.TrialReadingCriterionId); filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == origenalTask.TrialReadingCriterionId);
//有序阅片 //有序阅片
if (trialConfig.IsReadingTaskViewInOrder) if (trialConfig.IsReadingTaskViewInOrder)
@ -1719,7 +1707,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
case ReadingCategory.Global: case ReadingCategory.Global:
filterExpression = filterExpression.And(t => t.VisitTaskNum > origenalTask.VisitTaskNum && filterExpression = filterExpression.And(t => t.VisitTaskNum > origenalTask.VisitTaskNum &&
((t.DoctorUserId == origenalTask.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global)) || (t.ReadingCategory == ReadingCategory.Oncology) || (t.ReadingCategory == ReadingCategory.Judge)) ||t.Id==origenalTask.Id); ((t.DoctorUserId == origenalTask.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global)) || (t.ReadingCategory == ReadingCategory.Oncology) || (t.ReadingCategory == ReadingCategory.Judge)) || t.Id == origenalTask.Id);
break; break;
case ReadingCategory.Oncology: case ReadingCategory.Oncology:
@ -2377,7 +2365,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException(); var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException();
Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId && t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated; Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId && t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated;
//是否是一致性分析任务 (一致性分析的任务 不会产生裁判 肿瘤学 仅仅有生成的访视和全局) //是否是一致性分析任务 (一致性分析的任务 不会产生裁判 肿瘤学 仅仅有生成的访视和全局)
@ -2386,7 +2374,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
//重阅影响 //重阅影响
if (isReReading) if (isReReading)
{ {
filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == filterObj.TrialReadingCriterionId); filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == filterObj.TrialReadingCriterionId);
//IR 申请 PM 同意 仅仅影响自己 //IR 申请 PM 同意 仅仅影响自己
@ -2444,7 +2432,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
(t.DoctorUserId == filterObj.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global)) (t.DoctorUserId == filterObj.DoctorUserId && ((t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.WaitReading) || t.ReadingCategory == ReadingCategory.Global))
|| (t.ReadingCategory == ReadingCategory.Oncology) || (t.ReadingCategory == ReadingCategory.Oncology)
|| (t.ReadingCategory == ReadingCategory.Judge) || (t.ReadingCategory == ReadingCategory.Judge)
) ||t.Id==filterObj.Id); ) || t.Id == filterObj.Id);
break; break;