From c4cbe5cfe6d0de75b4c59d540a396168e512b455 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Wed, 22 Jun 2022 16:34:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Allocation/VisitTaskHelpeService.cs | 63 +++++++++++++++++++ .../Reading/ReadingImageTaskService.cs | 10 ++- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 1264398e9..8d32e60d2 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -374,6 +374,69 @@ namespace IRaCIS.Core.Application.Service + } + } + else if (generateTaskCommand.ReadingCategory == ReadingCategory.Oncology) + { + if (trialConfig.ReadingType == ReadingMethod.Double) + { + foreach (var item in generateTaskCommand.ReadingGenerataTaskList) + { + //每个访视 根据项目配置生成任务 双审生成两个 + var task1 = await _visitTaskRepository.AddAsync(new VisitTask() + { + TrialId = trialId, + SubjectId = item.SubjectId, + IsUrgent = item.IsUrgent, + TaskName = item.ReadingName, + ArmEnum = Arm.DoubleReadingArm1,//特殊 + Code = currentMaxCodeInt + 1, + SouceReadModuleId = item.ReadModuleId, + TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)), + ReadingCategory = ReadingCategory.Oncology + }); + var task2 = await _visitTaskRepository.AddAsync(new VisitTask() + { + TrialId = trialId, + SubjectId = item.SubjectId, + IsUrgent = item.IsUrgent, + TaskName = item.ReadingName, + ArmEnum = Arm.DoubleReadingArm2,//特殊 + Code = currentMaxCodeInt + 2, + SouceReadModuleId = item.ReadModuleId, + TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 2, nameof(VisitTask)), + ReadingCategory = ReadingCategory.Oncology + }); + currentMaxCodeInt = currentMaxCodeInt + 2; + _provider.Set($"{trialId }_{ StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt + 2, TimeSpan.FromMinutes(30)); + } + } + else + { + foreach (var item in generateTaskCommand.ReadingGenerataTaskList) + { + var singleTask = await _visitTaskRepository.AddAsync(new VisitTask() + { + TrialId = trialId, + SubjectId = item.SubjectId, + IsUrgent = item.IsUrgent, + TaskName = item.ReadingName, + ArmEnum = Arm.SingleReadingArm, //特殊 + Code = currentMaxCodeInt + 1, + SouceReadModuleId = item.ReadModuleId, + TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)), + ReadingCategory = ReadingCategory.Oncology + }); + + singleTask.AllocateTime = DateTime.Now; + + currentMaxCodeInt = currentMaxCodeInt + 1; + + _provider.Set($"{trialId }_{ StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt + 1, TimeSpan.FromMinutes(30)); + } + + + } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index b9d1ab155..9691a8cc7 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -314,7 +314,6 @@ namespace IRaCIS.Application.Services await this.TriggerJudgeQuestionNew(inDto.VisitTaskId); // 添加阅片期任务 await this.AddReadingTask(inDto.VisitTaskId); - // 完成阅片修改状态 await this.FinishReadUpdateState(inDto.VisitTaskId); return ResponseOutput.Ok(result); @@ -329,7 +328,6 @@ namespace IRaCIS.Application.Services var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstOrDefaultAsync(); if (!await _visitTaskRepository.AnyAsync(x => x.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && x.SouceReadModuleId == taskInfo.SouceReadModuleId && x.ReadingTaskState != ReadingTaskState.HaveSigned)) { - if (taskInfo.SouceReadModuleId != null) { await _readModuleRepository.UpdatePartialFromQueryAsync(taskInfo.SouceReadModuleId.Value, x => new ReadModule @@ -344,7 +342,6 @@ namespace IRaCIS.Application.Services ReadingStatus = ReadingStatusEnum.ReadCompleted }); } - await _subjectVisitRepository.SaveChangesAsync(); } } @@ -408,6 +405,13 @@ namespace IRaCIS.Application.Services ReadingCategory = typeChange[x.ModuleType], }).ToListAsync(); needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList(); + await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand() + { + + ReadingCategory = ReadingCategory.Oncology, + TrialId = taskInfo.TrialId, + ReadingGenerataTaskList = needReadList + }); break; } }