From 0840d57689a7a7004b62b56fbd2300fc3b324289 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 11 Dec 2025 17:19:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LuganoCalculateService.cs | 39 ++++++++++++++----- .../LuganoWithoutPETCalculateService.cs | 39 ++++++++++++++----- .../RECIST1Point1CalculateService.cs | 4 +- 3 files changed, 63 insertions(+), 19 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs index 58876c832..86294b8f0 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs @@ -1953,10 +1953,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var baseLineSpleenLength = await GetBaseLineSpleenLength(inDto); - var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); + var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturnNull(); + + if (presentSpleenLength == null) + { + return string.Empty; + } if (baseLineSpleenLength - 130 > 0 && presentSpleenLength > 130) { - return ReserveDecimal((presentSpleenLength - 130 - (baseLineSpleenLength - 130)) * 100 / (baseLineSpleenLength - 130), inDto.DigitPlaces); + return ReserveDecimal((presentSpleenLength.Value - 130 - (baseLineSpleenLength - 130)) * 100 / (baseLineSpleenLength - 130), inDto.DigitPlaces); } else { @@ -1981,11 +1986,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } if (TaskAnswer.Count() == 0) { - return "0"; + return string.Empty; + } + var presentSpd = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturnNull(); + if (presentSpd == null) + { + return string.Empty; } - var presentSpd = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); var lowSplenoncus = TaskAnswer.OrderBy(x => x.SpleenLength).Select(x => x.SpleenLength).FirstOrDefault(); - return (presentSpd - lowSplenoncus).ToString(); + return (presentSpd.Value - lowSplenoncus).ToString(); } @@ -2011,8 +2020,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate return "NA"; } - var lowSplenoncus = taskAnswer.OrderBy(x => x.SpleenLength).FirstOrDefault(); - return lowSplenoncus.BlindName; + var lowSplenoncus = taskAnswer.Where(x=>x.SpleenLength!=0).OrderBy(x => x.SpleenLength).FirstOrDefault(); + if (lowSplenoncus != null) + { + return lowSplenoncus.BlindName; + } + else + { + return string.Empty; + } + } @@ -3015,10 +3032,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } var baseLineTaskId = await GetBaseLineTaskId(inDto); - var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); + var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturnNull(); + if(presentSpleenLength==null) + { + return string.Empty; + } var baseLineSpleenLength = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == baseLineTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0(); - return (presentSpleenLength - baseLineSpleenLength).ToString(); + return (presentSpleenLength.Value - baseLineSpleenLength).ToString(); } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs index 610d83594..80e2f74ee 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs @@ -1953,10 +1953,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var baseLineSpleenLength = await GetBaseLineSpleenLength(inDto); - var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); + var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturnNull(); + + if (presentSpleenLength == null) + { + return string.Empty; + } if (baseLineSpleenLength - 130 > 0 && presentSpleenLength > 130) { - return ReserveDecimal((presentSpleenLength - 130 - (baseLineSpleenLength - 130)) * 100 / (baseLineSpleenLength - 130), inDto.DigitPlaces); + return ReserveDecimal((presentSpleenLength.Value - 130 - (baseLineSpleenLength - 130)) * 100 / (baseLineSpleenLength - 130), inDto.DigitPlaces); } else { @@ -1981,11 +1986,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } if (TaskAnswer.Count() == 0) { - return "0"; + return string.Empty; + } + var presentSpd = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturnNull(); + if (presentSpd == null) + { + return string.Empty; } - var presentSpd = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); var lowSplenoncus = TaskAnswer.OrderBy(x => x.SpleenLength).Select(x => x.SpleenLength).FirstOrDefault(); - return (presentSpd - lowSplenoncus).ToString(); + return (presentSpd.Value - lowSplenoncus).ToString(); } @@ -2011,8 +2020,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate return "NA"; } - var lowSplenoncus = taskAnswer.OrderBy(x => x.SpleenLength).FirstOrDefault(); - return lowSplenoncus.BlindName; + var lowSplenoncus = taskAnswer.Where(x => x.SpleenLength != 0).OrderBy(x => x.SpleenLength).FirstOrDefault(); + if (lowSplenoncus != null) + { + return lowSplenoncus.BlindName; + } + else + { + return string.Empty; + } + } @@ -3015,10 +3032,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } var baseLineTaskId = await GetBaseLineTaskId(inDto); - var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); + var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturnNull(); + if (presentSpleenLength == null) + { + return string.Empty; + } var baseLineSpleenLength = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == baseLineTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0(); - return (presentSpleenLength - baseLineSpleenLength).ToString(); + return (presentSpleenLength.Value - baseLineSpleenLength).ToString(); } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs index c93824f17..66379bbe9 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs @@ -593,13 +593,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate TableQuestionId = x.TableQuestionId, TrialId = x.TrialId, VisitTaskId = visitTaskId, - }); + }).ToList(); var addList = _mapper.Map>(tableRowAnswers); + + await _generalCalculateService.CopyHistoryAnswer(taskinfo, addList, tableAnswers); await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList); await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);