裁判任务生成

Uat_Study
hang 2022-08-09 17:59:35 +08:00
parent e8295e4201
commit 63c92874c3
2 changed files with 36 additions and 11 deletions

View File

@ -79,7 +79,7 @@ namespace IRaCIS.Core.Application.Service
var trialId = generateTaskCommand.TrialId;
var isAssignSubjectToDoctor = generateTaskCommand.IsAssignSubjectToDoctor;
var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState, t.TaskAllocateObjEnum,t.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException();
var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState, t.TaskAllocateObjEnum, t.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException();
var dbMaxCode = _visitTaskRepository.Where(t => t.TrialId == trialId).Select(t => t.Code).DefaultIfEmpty().Max();
@ -209,7 +209,7 @@ namespace IRaCIS.Core.Application.Service
//存在退回访视1 又退回基线 这种情况 生成任务 考虑基线先一致性核查通过但是访视1还未通过时 生成任务
var followVisitTaskList = await _visitTaskRepository
.Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.SourceSubjectVisit.CheckState == CheckStateEnum.CVPassed && t.ReadingCategory == ReadingCategory.Visit &&t.IsAnalysisCreate==false, true)
.Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.SourceSubjectVisit.CheckState == CheckStateEnum.CVPassed && t.ReadingCategory == ReadingCategory.Visit && t.IsAnalysisCreate == false, true)
.WhereIf(followBackVisitTask != null, t => t.VisitTaskNum < followBackVisitTask.VisitTaskNum)
.ToListAsync();
@ -221,7 +221,7 @@ namespace IRaCIS.Core.Application.Service
foreach (var visitGroup in followVisitGroup)
{
var arm1 = visitGroup.FirstOrDefault(t => t.TaskState == TaskState.Effect && t.TaskAllocationState==TaskAllocationState.NotAllocate && t.DoctorUserId == null && t.ArmEnum == Arm.DoubleReadingArm1);
var arm1 = visitGroup.FirstOrDefault(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.DoctorUserId == null && t.ArmEnum == Arm.DoubleReadingArm1);
if (arm1 != null)
{
arm1.TaskAllocationState = TaskAllocationState.Allocated;
@ -255,7 +255,7 @@ namespace IRaCIS.Core.Application.Service
TaskAllocationState = TaskAllocationState.Allocated,
AllocateTime = DateTime.Now,
DoctorUserId = task1.DoctorUserId,
SuggesteFinishedTime=DateTime.Now.AddDays(7),
SuggesteFinishedTime = DateTime.Now.AddDays(7),
});
currentMaxCodeInt = currentMaxCodeInt + 1;
@ -609,6 +609,27 @@ namespace IRaCIS.Core.Application.Service
generateTaskCommand.Action(newTask);
if (reReadingVisitTask.ReadingCategory == ReadingCategory.Judge)
{
var judgeRecord = await _readingJudgeInfoRepository.Where(t => t.JudgeTaskId == reReadingVisitTask.Id).FirstOrDefaultAsync();
var origenalTaskIdList = new Guid[] { judgeRecord.TaskIdOne, judgeRecord.TaskIdTwo };
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => origenalTaskIdList.Contains(x.Id), x => new VisitTask()
{
JudgeVisitTaskId = newTask.Id
});
await _readingJudgeInfoRepository.AddAsync(new ReadingJudgeInfo()
{
JudgeTaskId = newTask.Id,
SubjectId = judgeRecord.SubjectId,
TrialId = judgeRecord.TrialId,
TaskIdOne = judgeRecord.TaskIdOne,
TaskIdTwo = judgeRecord.TaskIdTwo
});
}
//await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t=>t.)
//是否增加任务类别
@ -688,7 +709,7 @@ namespace IRaCIS.Core.Application.Service
DoctorUserId = task.DoctorUserId,
TaskAllocationState = TaskAllocationState.Allocated,
AllocateTime = DateTime.Now,
SuggesteFinishedTime= DateTime.Now.AddDays(7),
SuggesteFinishedTime = DateTime.Now.AddDays(7),
IsAnalysisCreate = true,
IsSelfAnalysis = false,
@ -724,7 +745,7 @@ namespace IRaCIS.Core.Application.Service
SouceReadModuleId = firstTask.SouceReadModuleId,
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
TaskState = TaskState.Effect,
TaskBlindName= firstTask.TaskName,
TaskBlindName = firstTask.TaskName,
DoctorUserId = subjectUser == null ? null : subjectUser.DoctorUserId,
TaskAllocationState = subjectUser == null ? TaskAllocationState.NotAllocate : TaskAllocationState.Allocated,
AllocateTime = subjectUser == null ? null : DateTime.Now,

View File

@ -1919,6 +1919,10 @@ namespace IRaCIS.Core.Application.Service.Allocation
newTask.AllocateTime = DateTime.Now;
newTask.SuggesteFinishedTime = DateTime.Now.AddDays(7);
//裁判任务 需要进行特殊处理 在重阅逻辑里面处理
//拷贝表单
if (visitTaskReReadingAppply.IsCopyOrigenalForms)
{