From c0a383ef58fead25464c3a4f5770521cbb80ecdc Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 1 Jun 2026 16:41:40 +0800 Subject: [PATCH] =?UTF-8?q?MRIPDFF=20=E4=BF=AE=E6=94=B91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MRIPDFFAdvanceCalculateService.cs | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/MRIPDFFAdvanceCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/MRIPDFFAdvanceCalculateService.cs index adb586594..735c53616 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/MRIPDFFAdvanceCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/MRIPDFFAdvanceCalculateService.cs @@ -170,7 +170,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate - var dictionList = await _dictionaryRepository.Where(x => x.Parent.Code == "LiverSegmentation").OrderBy(x => x.ShowOrder).ToListAsync(); + var dictionList = await _dictionaryRepository.Where(x => x.Parent.Code == "Liver4Segmentation").OrderBy(x => x.ShowOrder).ToListAsync(); var tableQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.FatFraction).FirstNotNullAsync(); @@ -297,7 +297,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate public async Task ReadingCalculate(ReadingCalculateDto inDto, List? calculateType = null) { - await this.CalculateAvg(inDto); + //await this.CalculateAvg(inDto); inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId); var needAddList = new List(); List calculateList = new List() @@ -456,54 +456,54 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate /// 计算平均值 /// /// - public async Task CalculateAvg(ReadingCalculateDto inDto) - { - // 脂肪分数的表格问题Id - var questionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction).FirstOrDefault(); + //public async Task CalculateAvg(ReadingCalculateDto inDto) + //{ + // // 脂肪分数的表格问题Id + // var questionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction).FirstOrDefault(); - List tableAnswers = new List(); + // List tableAnswers = new List(); - foreach (var item in questionInfo.TableRowInfoList) - { - var avg = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).FirstOrDefault(); - var avgAnswer = string.Empty; - List questionMarks = new List() - { - QuestionMark.FirstMeasurement, - QuestionMark.SecondMeasurement, - QuestionMark.ThirdMeasurement, - QuestionMark.FourthMeasurement, - }; - var answers = item.TableQuestionList.Where(x => questionMarks.Contains(x.QuestionMark)).Select(x=>x.Answer).ToList(); - if (answers.Count() == 4 && !answers.Any(x => x.IsNullOrEmpty())) - { - var avgAnswernum= answers.Select(x=>x.IsNullOrEmptyReturn0()).Average(x=>x); - avgAnswer = decimal.Round(avgAnswernum, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString()); - } - if(item.TableQuestionList.Where(x => x.QuestionMark== QuestionMark.IsMeasurable).Select(x => x.Answer).FirstOrDefault().EqEnum(YesOrNoOrNa.No)) - { - avgAnswer = "NE"; - } - tableAnswers.Add(new ReadingTableQuestionAnswer() - { - Answer = avgAnswer, - VisitTaskId = inDto.VisitTaskId, - QuestionId = avg.QuestionId, - TableQuestionId = avg.TableQuestionId, - TrialId = inDto.TrialId, - RowIndex = avg.RowIndex, - RowId = avg.RowId, + // foreach (var item in questionInfo.TableRowInfoList) + // { + // var avg = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).FirstOrDefault(); + // var avgAnswer = string.Empty; + // List questionMarks = new List() + // { + // QuestionMark.FirstMeasurement, + // QuestionMark.SecondMeasurement, + // QuestionMark.ThirdMeasurement, + // QuestionMark.FourthMeasurement, + // }; + // var answers = item.TableQuestionList.Where(x => questionMarks.Contains(x.QuestionMark)).Select(x=>x.Answer).ToList(); + // if (answers.Count() == 4 && !answers.Any(x => x.IsNullOrEmpty())) + // { + // var avgAnswernum= answers.Select(x=>x.IsNullOrEmptyReturn0()).Average(x=>x); + // avgAnswer = decimal.Round(avgAnswernum, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString()); + // } + // if(item.TableQuestionList.Where(x => x.QuestionMark== QuestionMark.IsMeasurable).Select(x => x.Answer).FirstOrDefault().EqEnum(YesOrNoOrNa.No)) + // { + // avgAnswer = "NE"; + // } + // tableAnswers.Add(new ReadingTableQuestionAnswer() + // { + // Answer = avgAnswer, + // VisitTaskId = inDto.VisitTaskId, + // QuestionId = avg.QuestionId, + // TableQuestionId = avg.TableQuestionId, + // TrialId = inDto.TrialId, + // RowIndex = avg.RowIndex, + // RowId = avg.RowId, - }); + // }); - await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId && x.TableQuestionId == avg.TableQuestionId); - } + // await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId && x.TableQuestionId == avg.TableQuestionId); + // } - await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); - await _readingTableQuestionAnswerRepository.SaveChangesAsync(); + // await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); + // await _readingTableQuestionAnswerRepository.SaveChangesAsync(); - } + //} @@ -523,12 +523,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var rowInfo = readingData.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction) .SelectMany(x => x.TableRowInfoList).ToList(); - var tableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.AverageValue && x.Answer.IsNotNullOrEmpty())).ToList(); + //var tableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.AverageValue && x.Answer.IsNotNullOrEmpty())).ToList(); - if (tableQuestionList.Count() != 8) - { - throw new BusinessValidationFailedException(_localizer["MRIPDFF_AllNeedToBeMark"]); - } + //if (tableQuestionList.Count() != 4) + //{ + // throw new BusinessValidationFailedException(_localizer["MRIPDFF_AllNeedToBeMark"]); + //} try {