From 15a2294688d1b36fc435930477720b9052728107 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 1 Mar 2023 11:06:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=91=E9=80=81=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 11 +++++ .../Document/TrialEmailNoticeConfigService.cs | 49 ++++++++++++------- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 2635cb74..374e0f2e 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -628,6 +628,17 @@ + + + + + 任务Id + 任务类型 + 标准类型 + 是否是全局产生(区分裁判任务) + + + 选择人员下拉 diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index 94357f9d..b7bdc4cf 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -572,8 +572,8 @@ namespace IRaCIS.Core.Application.Service //双人 产生裁判,并且裁判完成 发 else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1) { - - answer = await TranslatePdStateAsync(taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().Id, ReadingCategory.Judge, taskInfo.CriterionType); + var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value; + answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Visit, taskInfo.CriterionType); isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); @@ -618,7 +618,8 @@ namespace IRaCIS.Core.Application.Service else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Global).Count() == 2) { - answer = await TranslatePdStateAsync(taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().Id, ReadingCategory.Judge, taskInfo.CriterionType); + var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value; + answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Global, taskInfo.CriterionType); isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); @@ -681,7 +682,8 @@ namespace IRaCIS.Core.Application.Service { //在两位阅片人读完访视后,如果有裁判者等裁判读完,如果无裁判则等第二个人的读完 - var taskList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync(); + var taskList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect + && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync(); //这里要求 到这里已经如果有裁判 已经生成裁判了保存数据库 if (taskList.Count == 2 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit) == 2) @@ -693,8 +695,9 @@ namespace IRaCIS.Core.Application.Service } else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1) { + var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value; + answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Visit, taskInfo.CriterionType); - answer = await TranslatePdStateAsync(taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().Id, ReadingCategory.Judge, taskInfo.CriterionType); isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); @@ -1084,8 +1087,16 @@ namespace IRaCIS.Core.Application.Service } - - private async Task TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType) + /// + /// + /// + /// 任务Id + /// 任务类型 + /// 标准类型 + /// 是否是全局产生(区分裁判任务) + /// + /// + private async Task TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType, bool? IsGlobalGenerate=null) { var answer = string.Empty; @@ -1123,15 +1134,15 @@ namespace IRaCIS.Core.Application.Service } } - else if (readingCategory == ReadingCategory.Judge) - { - //var judgeResultTaskId = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.JudgeResultTaskId).FirstNotNullAsync(); + //else if (readingCategory == ReadingCategory.Judge) + //{ + // var judgeResultTaskId = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.JudgeResultTaskId).FirstNotNullAsync(); - var questionAnsewer = await _repository.Where(t => t.VisitTaskId == visitTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.Tumor).FirstNotNullAsync(); + // var questionAnsewer = await _repository.Where(t => t.VisitTaskId == judgeResultTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.Tumor).FirstNotNullAsync(); - answer = questionAnsewer.Answer; - } + // answer = questionAnsewer.Answer; + //} else { throw new BusinessValidationFailedException("不应有 除访视、裁判、全局其他类型的任务进行发送邮件,请核查业务逻辑"); @@ -1163,14 +1174,14 @@ namespace IRaCIS.Core.Application.Service answer = questionAnsewer.Answer; } - else if (readingCategory == ReadingCategory.Judge) - { - //var judgeResultTaskId = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.JudgeResultTaskId).FirstNotNullAsync(); + //else if (readingCategory == ReadingCategory.Judge) + //{ + // //var judgeResultTaskId = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.JudgeResultTaskId).FirstNotNullAsync(); - var questionAnsewer = await _repository.Where(t => t.VisitTaskId == visitTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.SiteVisitForTumorEvaluation).FirstNotNullAsync(); + // var questionAnsewer = await _repository.Where(t => t.VisitTaskId == visitTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.SiteVisitForTumorEvaluation).FirstNotNullAsync(); - answer = questionAnsewer.Answer; - } + // answer = questionAnsewer.Answer; + //} else { throw new BusinessValidationFailedException("不应有 除访视、裁判、全局其他类型的任务进行发送邮件,请核查业务逻辑");