diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 374e0f2ee..6044df4f3 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -607,7 +607,7 @@ 测试邮件 带附件 填充word --前端不需 - + 为空 代表 正常任务自动发送,为true 代表医学审核手动发送 为false 代表医学审核自动发送 diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index b7bdc4cf8..846d73da6 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -175,13 +175,13 @@ namespace IRaCIS.Core.Application.Service - private async Task DealMedicalReviewTasKGenerateAndIsSendAsync(Guid trialId, bool? isMedicalReviewAndSuggestApplyReReading, string pdAnswer, List taskIdList, List minUserIdList) + private async Task DealMedicalReviewTasKGenerateAndIsSendAsync(Guid trialId, bool? isHandSend, string pdAnswer, List taskIdList, List minUserIdList) { var isNeedSend = true; //手动发送的时候,也有可能答案是是 此时是 这里不发送,发送已经生成的文件 - if (pdAnswer == "是" && isMedicalReviewAndSuggestApplyReReading==null) + if (pdAnswer == "是" && isHandSend==null) { isNeedSend = true; @@ -189,7 +189,7 @@ namespace IRaCIS.Core.Application.Service else { //正常阅片为否的 - if (isMedicalReviewAndSuggestApplyReReading == null) + if (isHandSend == null) { isNeedSend = false; @@ -200,7 +200,7 @@ namespace IRaCIS.Core.Application.Service } } - else if (isMedicalReviewAndSuggestApplyReReading == true) + else if (isHandSend == true) { //手动发送 isNeedSend = false; @@ -223,12 +223,12 @@ namespace IRaCIS.Core.Application.Service /// 测试邮件 带附件 填充word --前端不需 /// /// - /// + /// 为空 代表 正常任务自动发送,为true 代表医学审核手动发送 为false 代表医学审核自动发送 /// /// /// /// - public async Task BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isMedicalReviewAndSuggestApplyReReading, EmailStoreSendMode emailStoreMode, string sendFileRelativePath) + public async Task BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isHandSend, EmailStoreSendMode emailStoreMode, string sendFileRelativePath) { CommonDocumentBusinessScenario? businessScenarioEnum = null; @@ -464,6 +464,13 @@ namespace IRaCIS.Core.Application.Service //入组确认 根据每个标准配置的是否自动发送,发送邮件与否 if (businessScenarioEnum == CommonDocumentBusinessScenario.EnrollConfirmed) { + if (await _repository.Where().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() && + x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion)) + { + answer = "是"; + } + + //如果其他阅片人已经做了,说明发送了入组确认报告,第二个人做完就不发送了 if (await _visitTaskRepository.AnyAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && t.Id != visitTaskId && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId)) @@ -472,13 +479,8 @@ namespace IRaCIS.Core.Application.Service } else { - - if (await _repository.Where().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() && - x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion)) + if (answer == "是") { - - answer = "是"; - //把另外一个人的任务设置为不加急(如果项目加急是否 subject 加急是否) var urgent = _repository.Where(t => t.Id == taskInfo.SourceSubjectVisitId).Select(t => new { IsSubjectUrgent = t.Subject.IsUrgent, t.Trial.IsUrgent }).FirstOrDefault(); @@ -487,9 +489,10 @@ namespace IRaCIS.Core.Application.Service await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && t.Id != visitTaskId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId, u => new VisitTask() { IsUrgent = false }); } - } - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, new List() { visitTaskId }, minUserIdList); + + + isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList); } @@ -541,7 +544,7 @@ namespace IRaCIS.Core.Application.Service throw new BusinessValidationFailedException("单重有序阅片 该类型的任务不应进入此处逻辑,请联系后台开发核查!"); } - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, new List() { visitTaskId }, minUserIdList); + isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList); } @@ -566,7 +569,7 @@ namespace IRaCIS.Core.Application.Service answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType); - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); + isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); } //双人 产生裁判,并且裁判完成 发 @@ -575,7 +578,7 @@ namespace IRaCIS.Core.Application.Service 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); + isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); } else @@ -612,7 +615,7 @@ namespace IRaCIS.Core.Application.Service answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType); - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); + isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); } //双人全局产生裁判 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) @@ -621,7 +624,7 @@ namespace IRaCIS.Core.Application.Service 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); + isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); } else @@ -675,7 +678,7 @@ namespace IRaCIS.Core.Application.Service { answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType); - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, new List() { visitTaskId }, minUserIdList); + isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList); } //双重 截止访视只在阅片期的时候存在 要求PD确认的访视 肯定是非截止访视 else if (taskInfo.ReadingType == ReadingMethod.Double && taskInfo.ArbitrationRule == ArbitrationRule.Visit) @@ -691,14 +694,14 @@ namespace IRaCIS.Core.Application.Service answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType); - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); + isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); } 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); - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); + isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); } @@ -949,7 +952,7 @@ namespace IRaCIS.Core.Application.Service } else { - return ResponseOutput.NotOk("当前Subject最新PD访视阅片任务完成状态不符合发送条件"); + return ResponseOutput.NotOk("当前受试者最新PD访视阅片任务完成状态不符合发送条件"); } } @@ -961,7 +964,7 @@ namespace IRaCIS.Core.Application.Service if (existReadModule == null) { - return ResponseOutput.NotOk("项目配置了阅片期仲裁,但是当前Subject最新PD访视没有影像学阅片期"); + return ResponseOutput.NotOk("项目配置了阅片期仲裁,但是当前受试者最新PD访视没有影像学阅片期"); } else { @@ -995,7 +998,7 @@ namespace IRaCIS.Core.Application.Service else { - return ResponseOutput.NotOk("当前Subject最新PD访视阅片期任务完成状态不符合发送条件"); + return ResponseOutput.NotOk("当前受试者最新PD访视阅片期任务完成状态不符合发送条件"); } } @@ -1018,7 +1021,7 @@ namespace IRaCIS.Core.Application.Service if (task == null) { - return ResponseOutput.NotOk("当前Subject最新PD访视任务未阅片完成"); + return ResponseOutput.NotOk("当前受试者最新PD访视任务未阅片完成"); } else { @@ -1041,7 +1044,7 @@ namespace IRaCIS.Core.Application.Service } else { - return ResponseOutput.NotOk("当前Subject阅片期任务未阅片完成"); + return ResponseOutput.NotOk("当前受试者阅片期任务未阅片完成"); } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs index 80dcbd86c..e94290fbb 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs @@ -11,6 +11,7 @@ using Newtonsoft.Json; using IRaCIS.Core.Application.Service; using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.Filter; +using IRaCIS.Core.Domain.Models; namespace IRaCIS.Application.Services { @@ -451,6 +452,8 @@ namespace IRaCIS.Application.Services // 创建任务关联关系 await this.CreateTaskRelated(inDto.VisitTaskId); + + await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(inDto.VisitTaskId); return ResponseOutput.Ok(result); }