From e898f17873002f86c2900106476b58bf4488d10f Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 3 Jul 2025 16:17:32 +0800 Subject: [PATCH] =?UTF-8?q?PCWG=20=E5=85=A8=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Document/TrialEmailNoticeConfigService.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index 46bae4d87..69d9280d6 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -19,6 +19,7 @@ using IRaCIS.Core.Infra.EFCore.Common; using IRaCIS.Core.Infrastructure; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Spire.Doc; using System.Linq.Dynamic.Core; @@ -1283,9 +1284,24 @@ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && x.Readi break; case CriterionType.PCWG3: - var questionAnsewer = await _readingGlobalTaskInfoRepository.Where(t => t.TaskId == visitTaskId && t.TrialReadingQuestion.QuestionType == QuestionType.SiteVisitForTumorEvaluation).FirstNotNullAsync(); + var questionAnsewer = await _readingGlobalTaskInfoRepository.Where(t => t.TaskId == visitTaskId && t.TrialReadingQuestion.QuestionType == QuestionType.SiteVisitForTumorEvaluation).FirstOrDefaultAsync(); + if (questionAnsewer != null&& questionAnsewer.Answer.IsNotNullOrEmpty()) + { + answer = questionAnsewer.Answer; + } + else + { + var visittaskList=await _visitTaskRepository.Where(t => t.Id == visitTaskId ).Select(x=>x.RelatedVisitTaskIdList).FirstOrDefaultAsync(); - answer = questionAnsewer.Answer; + var task = await _visitTaskRepository.Where(x => visittaskList.Contains(x.Id) && x.ReadingCategory == ReadingCategory.Visit).OrderByDescending(x => x.VisitTaskNum).FirstOrDefaultAsync(); + if (task != null) + { + answer= await _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == task.Id && t.ReadingQuestionTrial.QuestionType == QuestionType.SiteVisitForTumorEvaluation) + .Select(t => t.Answer).FirstOrDefaultAsync(); + } + } + + break;