diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index d47c2a248..b18255bf7 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -1063,6 +1063,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public string Answer { get; set; } + public bool IsGlobalAnswer { get; set; } = false; + /// /// 问题类型 /// diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs index be7cd25bd..6e30cdef7 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs @@ -213,19 +213,40 @@ namespace IRaCIS.Application.Services var globalReadingQuestion = await _readingGlobalTaskInfoRepository.Where(x => x.GlobalTaskId == inDto.VisitTaskId).ToListAsync(); var criterionType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskInfo.TrialReadingCriterionId).Select(x => x.CriterionType).FirstOrDefaultAsync(); - //if (criterionType == CriterionType.PCWG3) - //{ - // result.TaskList.ForEach(x => - // { - // x.BeforeQuestionList.ForEach(y => - // { - // var globalAnswer = globalReadingQuestion.Where(z => z.QuestionId == y.QuestionId).Select(z => z.Answer).FirstOrDefault(); - // y.Answer = globalAnswer.IsNullOrEmpty() ? y.Answer : globalAnswer; - // }); - // }); - //} - + // 如果不是PCWG3 Before的Answer取自于 上一次全局阅片的结果, 如果没有上一次全局阅片的结果 取访视的答案 + + var lastGlobalTask = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Global && + x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && + x.SubjectId == taskInfo.SubjectId && x.IsAnalysisCreate == taskInfo.IsAnalysisCreate && x.TaskState == TaskState.Effect && x.VisitTaskNum < taskInfo.VisitTaskNum) + .Where(x => x.DoctorUserId == taskInfo.DoctorUserId) + .FirstOrDefaultAsync(); + + List? globalAnswers = new List(); + if (lastGlobalTask != null) + { + globalAnswers = await _readingGlobalTaskInfoRepository.Where(x => x.GlobalTaskId == lastGlobalTask.Id).ToListAsync(); + } + + if (criterionType != CriterionType.PCWG3) + { + result.TaskList.ForEach(x => + { + + x.BeforeQuestionList.ForEach(y => + { + + var globalAnswer = globalAnswers.Where(z => z.QuestionId == y.QuestionId).Select(z => z.Answer).FirstOrDefault(); + if (!globalAnswer.IsNullOrEmpty()) + { + y.Answer = globalAnswer; + y.IsGlobalAnswer = true; + } + + }); + }); + } + result.TaskList.ForEach(x => { x.AfterQuestionList = x.BeforeQuestionList.Where(x=>x.IsJudgeQuestion).GroupJoin( @@ -317,16 +338,8 @@ namespace IRaCIS.Application.Services // 找到上一个全局阅片 - var lastGlobalTask = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Global && - x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && - x.SubjectId == taskInfo.SubjectId && x.IsAnalysisCreate == taskInfo.IsAnalysisCreate && x.TaskState == TaskState.Effect && x.VisitTaskNum < taskInfo.VisitTaskNum) - .Where(x => x.DoctorUserId == taskInfo.DoctorUserId) - .FirstOrDefaultAsync(); - List? globalAnswers = new List (); - if (lastGlobalTask != null) - { - globalAnswers= await _readingGlobalTaskInfoRepository.Where(x => x.GlobalTaskId == lastGlobalTask.Id).ToListAsync(); - } + + result.TaskList.ForEach(x => { foreach (var item in x.AfterQuestionList.Where(x => x.QuestionType == QuestionType.SiteVisitForTumorEvaluation)) diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs index ab958a4e5..1fefd61f0 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs @@ -960,6 +960,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate return nameof(YesOrNoOrNa.NA); } + var targetCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.TargetLesion).SelectMany(x => x.TableRowInfoList).Count(); + if (targetCount == 0) + { + return nameof(YesOrNoOrNa.NA); + } + var decimalAnswerList = await GetLowSODVisit(inDto); return decimalAnswerList.OrderBy(x => x.SOD).Select(x => x.BlindName).FirstOrDefault() ?? string.Empty; }