一致性分析修改
parent
fee18e4295
commit
5836b3c109
|
@ -127,7 +127,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
else
|
||||
{
|
||||
var maxCodeStr = _visitTaskRepository.Where(t => t.TrialId == subject.TrialId).OrderByDescending(t => t.BlindSubjectCode).Select(t => t.BlindSubjectCode).FirstOrDefault();
|
||||
|
||||
|
||||
int.TryParse(maxCodeStr, out maxCodeInt);
|
||||
|
||||
blindSubjectCode = (maxCodeInt + 1).ToString($"D{filterObj.BlindSubjectNumberOfPlaces}");
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
||||
|
@ -297,12 +301,12 @@ namespace IRaCIS.Core.Application.Service
|
|||
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))
|
||||
join user in _repository.Where<User>() on enroll.DoctorId equals user.DoctorId
|
||||
select user.Id;
|
||||
join user in _repository.Where<User>() on enroll.DoctorId equals user.DoctorId
|
||||
select user.Id;
|
||||
|
||||
var configDoctorUserIdList = await doctorUserIdQuery.ToListAsync();
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var subject in subjectList.Where(t => t.IsHaveGeneratedTask == false))
|
||||
{
|
||||
|
@ -327,7 +331,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
foreach (var task in subject.TaskList.Take(filterObj.PlanVisitCount))
|
||||
{
|
||||
|
||||
subjectAddTaskList.Add( new VisitTaskGroupSimpleDTO()
|
||||
subjectAddTaskList.Add(new VisitTaskGroupSimpleDTO()
|
||||
{
|
||||
ReadingCategory = task.ReadingCategory,
|
||||
ReadingTaskState = task.ReadingTaskState,
|
||||
|
@ -338,18 +342,23 @@ namespace IRaCIS.Core.Application.Service
|
|||
VisitTaskNum = task.VisitTaskNum,
|
||||
TrialId = task.TrialId,
|
||||
DoctorUserId = needAddDoctorUserId,
|
||||
ArmEnum=Arm.GroupConsistentArm
|
||||
ArmEnum = Arm.GroupConsistentArm
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//最后一个访视添加全局
|
||||
var globalTask = (subject.TaskList.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];
|
||||
subjectAddTaskList.Add(globalTask);
|
||||
|
||||
if (filterObj.IsGenerateGlobalTask)
|
||||
{
|
||||
var globalTask = (subject.TaskList.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];
|
||||
subjectAddTaskList.Add(globalTask);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -406,7 +415,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
if (filterObj.IsHaveReadingPeriod == true)
|
||||
{
|
||||
//这里的过滤条件 不能用 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)));
|
||||
}
|
||||
|
||||
|
|
|
@ -916,8 +916,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
throw new BusinessValidationFailedException("出现脏数据 任务来源字段没有值");
|
||||
}
|
||||
|
||||
//PM 回退了 但是还没生成任务
|
||||
if( await _subjectVisitRepository.AnyAsync(t=>t.SubjectId== visitTask.SubjectId && t.IsPMBackOrReReading))
|
||||
//PM 回退了 但是还没生成任务 当前任务编号前有访视进行了回退就不允许分配
|
||||
if( await _subjectVisitRepository.AnyAsync(t=>t.SubjectId== visitTask.SubjectId && t.IsPMBackOrReReading &&t.VisitNum <= visitTask.VisitTaskNum))
|
||||
{
|
||||
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
|
||||
&& 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)))
|
||||
|
@ -1079,8 +1079,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
var origenalTask = (await _visitTaskRepository.Where(t => item.OriginalReReadingTaskId == t.Id, true).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
|
||||
|
||||
//更新原始任务 当前任务处理
|
||||
origenalTask.ReReadingApplyState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? ReReadingApplyState.Agree : ReReadingApplyState.Reject);
|
||||
origenalTask.TaskState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? TaskState.HaveReturned : origenalTask.TaskState);
|
||||
|
|
Loading…
Reference in New Issue