一致性分析修改

Uat_Study
hang 2022-07-18 09:24:38 +08:00
parent fee18e4295
commit 5836b3c109
2 changed files with 32 additions and 25 deletions

View File

@ -145,13 +145,17 @@ namespace IRaCIS.Core.Application.Service
//最后一个访视添加全局 //最后一个访视添加全局
if (filterObj.IsGenerateGlobalTask)
{
var globalTask = (subject.VisitTaskList.Take(filterObj.PlanVisitCount).Last()).Clone();
globalTask.TaskName = (int)globalTask.VisitTaskNum + "Global";
globalTask.TaskBlindName = (int)globalTask.VisitTaskNum + "Global";
globalTask.ReadingCategory = ReadingCategory.Global;
globalTask.VisitTaskNum += ReadingCommon.TaskNumDic[ReadingCategory.Global];
subject.VisitTaskList.Add(globalTask);
}
var globalTask = (subject.VisitTaskList.Take(filterObj.PlanVisitCount).Last()).Clone();
globalTask.TaskName =(int) globalTask.VisitTaskNum+"Global";
globalTask.TaskBlindName = (int)globalTask.VisitTaskNum + "Global";
globalTask.ReadingCategory = ReadingCategory.Global;
globalTask.VisitTaskNum += ReadingCommon.TaskNumDic[ReadingCategory.Global];
subject.VisitTaskList.Add(globalTask);
await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand() await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand()
{ {
@ -209,7 +213,7 @@ namespace IRaCIS.Core.Application.Service
//单重阅片没有组件一致性 //单重阅片没有组件一致性
subjectQuery = _subjectRepository.Where(t => t.TrialId == trialId && t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).Select(t=>t.DoctorUserId).Distinct().Count()==2 subjectQuery = _subjectRepository.Where(t => t.TrialId == trialId && t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).Select(t => t.DoctorUserId).Distinct().Count() == 2
&& t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).GroupBy(t => new { t.SubjectId, t.VisitTaskNum }).Where(g => g.Count() == 2).Count() >= filterObj.PlanVisitCount); && t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).GroupBy(t => new { t.SubjectId, t.VisitTaskNum }).Where(g => g.Count() == 2).Count() >= filterObj.PlanVisitCount);
@ -297,8 +301,8 @@ namespace IRaCIS.Core.Application.Service
var subjectList = query.ToList(); var subjectList = query.ToList();
var doctorUserIdQuery = from enroll in _repository.Where<Enroll>(t => t.TrialId == trialId).Where(t => t.EnrollReadingCategoryList.Any(c => c.ReadingCategory == ReadingCategory.Global || c.ReadingCategory == ReadingCategory.Visit)) var doctorUserIdQuery = from enroll in _repository.Where<Enroll>(t => t.TrialId == trialId).Where(t => t.EnrollReadingCategoryList.Any(c => c.ReadingCategory == ReadingCategory.Global || c.ReadingCategory == ReadingCategory.Visit))
join user in _repository.Where<User>() on enroll.DoctorId equals user.DoctorId join user in _repository.Where<User>() on enroll.DoctorId equals user.DoctorId
select user.Id; select user.Id;
var configDoctorUserIdList = await doctorUserIdQuery.ToListAsync(); var configDoctorUserIdList = await doctorUserIdQuery.ToListAsync();
@ -327,7 +331,7 @@ namespace IRaCIS.Core.Application.Service
foreach (var task in subject.TaskList.Take(filterObj.PlanVisitCount)) foreach (var task in subject.TaskList.Take(filterObj.PlanVisitCount))
{ {
subjectAddTaskList.Add( new VisitTaskGroupSimpleDTO() subjectAddTaskList.Add(new VisitTaskGroupSimpleDTO()
{ {
ReadingCategory = task.ReadingCategory, ReadingCategory = task.ReadingCategory,
ReadingTaskState = task.ReadingTaskState, ReadingTaskState = task.ReadingTaskState,
@ -338,18 +342,23 @@ namespace IRaCIS.Core.Application.Service
VisitTaskNum = task.VisitTaskNum, VisitTaskNum = task.VisitTaskNum,
TrialId = task.TrialId, TrialId = task.TrialId,
DoctorUserId = needAddDoctorUserId, DoctorUserId = needAddDoctorUserId,
ArmEnum=Arm.GroupConsistentArm ArmEnum = Arm.GroupConsistentArm
}); });
} }
//最后一个访视添加全局 //最后一个访视添加全局
var globalTask = (subject.TaskList.Take(filterObj.PlanVisitCount).Last()).Clone();
globalTask.TaskName = (int)globalTask.VisitTaskNum + "Global"; if (filterObj.IsGenerateGlobalTask)
globalTask.TaskBlindName = (int)globalTask.VisitTaskNum + "Global"; {
globalTask.ReadingCategory = ReadingCategory.Global; var globalTask = (subject.TaskList.Take(filterObj.PlanVisitCount).Last()).Clone();
globalTask.VisitTaskNum += ReadingCommon.TaskNumDic[ReadingCategory.Global]; globalTask.TaskName = (int)globalTask.VisitTaskNum + "Global";
subjectAddTaskList.Add(globalTask); globalTask.TaskBlindName = (int)globalTask.VisitTaskNum + "Global";
globalTask.ReadingCategory = ReadingCategory.Global;
globalTask.VisitTaskNum += ReadingCommon.TaskNumDic[ReadingCategory.Global];
subjectAddTaskList.Add(globalTask);
}
} }
@ -406,7 +415,7 @@ namespace IRaCIS.Core.Application.Service
if (filterObj.IsHaveReadingPeriod == true) if (filterObj.IsHaveReadingPeriod == true)
{ {
//这里的过滤条件 不能用 where(comonTaskFilter) 会报错,奇怪的问题 只能重新写一遍 //这里的过滤条件 不能用 where(comonTaskFilter) 会报错,奇怪的问题 只能重新写一遍
visitTaskFilter = visitTaskFilter.And(c => c.Subject.SubjectVisitTaskList.Any(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] &&t.ReadingCategory==ReadingCategory.Global && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned && visitTaskFilter = visitTaskFilter.And(c => c.Subject.SubjectVisitTaskList.Any(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && t.ReadingCategory == ReadingCategory.Global && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned &&
t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now && (t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject))); t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now && (t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject)));
} }

View File

@ -916,8 +916,8 @@ namespace IRaCIS.Core.Application.Service
throw new BusinessValidationFailedException("出现脏数据 任务来源字段没有值"); throw new BusinessValidationFailedException("出现脏数据 任务来源字段没有值");
} }
//PM 回退了 但是还没生成任务 //PM 回退了 但是还没生成任务 当前任务编号前有访视进行了回退就不允许分配
if( await _subjectVisitRepository.AnyAsync(t=>t.SubjectId== visitTask.SubjectId && t.IsPMBackOrReReading)) if( await _subjectVisitRepository.AnyAsync(t=>t.SubjectId== visitTask.SubjectId && t.IsPMBackOrReReading &&t.VisitNum <= visitTask.VisitTaskNum))
{ {
return ResponseOutput.NotOk("该受试者有访视进入了退回流程,还未经过一致性核查通过,不允许分配"); return ResponseOutput.NotOk("该受试者有访视进入了退回流程,还未经过一致性核查通过,不允许分配");
} }
@ -1014,7 +1014,7 @@ namespace IRaCIS.Core.Application.Service
} }
Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == task.TrialId && t.SubjectId == task.SubjectId && t.TaskState == TaskState.Effect Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == task.TrialId && t.SubjectId == task.SubjectId && t.TaskState == TaskState.Effect
&& t.ReadingTaskState == ReadingTaskState.HaveSigned && t.DoctorUserId == task.DoctorUserId && t.IsAnalysisCreate == false; && 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)))
@ -1079,8 +1079,6 @@ namespace IRaCIS.Core.Application.Service
var origenalTask = (await _visitTaskRepository.Where(t => item.OriginalReReadingTaskId == t.Id, true).FirstOrDefaultAsync()).IfNullThrowException(); var origenalTask = (await _visitTaskRepository.Where(t => item.OriginalReReadingTaskId == t.Id, true).FirstOrDefaultAsync()).IfNullThrowException();
//更新原始任务 当前任务处理 //更新原始任务 当前任务处理
origenalTask.ReReadingApplyState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? ReReadingApplyState.Agree : ReReadingApplyState.Reject); origenalTask.ReReadingApplyState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? ReReadingApplyState.Agree : ReReadingApplyState.Reject);
origenalTask.TaskState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? TaskState.HaveReturned : origenalTask.TaskState); origenalTask.TaskState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? TaskState.HaveReturned : origenalTask.TaskState);