From 5dab6ef30b551ed9a06901f5cea30d9bd70a0683 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Mon, 25 Sep 2023 13:13:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/Dto/ReadingCalculateViewModel.cs | 5 + .../General/GeneralCalculateService.cs | 1 + .../LuganoCalculateService.cs | 96 +++++++++++++++---- 3 files changed, 83 insertions(+), 19 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs index 453edfb96..a8c54a077 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs @@ -263,6 +263,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public LesionType? LesionType { get; set; } + /// + /// 序号标记 + /// + public string OrderMark { get; set; } = string.Empty; + public QuestionType? QuestionType { get; set; } public List TableRowInfoList = new List(); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs index faaf8a8ad..06b726a3a 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs @@ -122,6 +122,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate LesionType = x.LesionType, QuestionId = x.Id, QuesionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us), + OrderMark=x.OrderMark, QuestionType = x.QuestionType, ValueType = x.ValueType, }).ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs index 1def50633..a93ca0b96 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs @@ -505,6 +505,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate // 影像学整体肿瘤评估 new ReadingCalculateData (){QuestionType=QuestionType.ImgOncology,GetStringFun=GetImgOncology}, + + + //SUVmax + new ReadingCalculateData (){QuestionType=QuestionType.SUVmax,GetDecimalFun=GetSuvMax}, + + // SUVmax所在病灶 + new ReadingCalculateData (){QuestionType=QuestionType.SUVmaxLesion,GetStringFun=GetSuvMaxFocus}, ////靶病灶径线之和(SOD) //new ReadingCalculateData (){QuestionType=QuestionType.SOD,GetDecimalNullFun=GetSODData}, @@ -549,38 +556,38 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate }; // 没有靶病灶只计算最后几个 - if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).Sum(x => x.TableRowInfoList.Count()) == 0) - { + //if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).Sum(x => x.TableRowInfoList.Count()) == 0) + //{ - List questionTypes = new List() - { - QuestionType.TargetLesion, - QuestionType.NoTargetLesion, - QuestionType.NewLesions, - QuestionType.Tumor, - QuestionType.ExistDisease, - }; + // List questionTypes = new List() + // { + // QuestionType.TargetLesion, + // QuestionType.NoTargetLesion, + // QuestionType.NewLesions, + // QuestionType.Tumor, + // QuestionType.ExistDisease, + // }; - // 没有靶病灶就删除其他几个答案的值 - var isNeedDeleteTypes = calculateList.Where(x => !questionTypes.Contains(x.QuestionType)).Select(x => x.QuestionType).ToList(); + // // 没有靶病灶就删除其他几个答案的值 + // var isNeedDeleteTypes = calculateList.Where(x => !questionTypes.Contains(x.QuestionType)).Select(x => x.QuestionType).ToList(); - var isNeedDeleteIds = inDto.QuestionInfo.Where(x => x.QuestionType != null && isNeedDeleteTypes.Contains(x.QuestionType.Value)).Select(x => x.QuestionId).ToList(); + // var isNeedDeleteIds = inDto.QuestionInfo.Where(x => x.QuestionType != null && isNeedDeleteTypes.Contains(x.QuestionType.Value)).Select(x => x.QuestionId).ToList(); - await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && isNeedDeleteIds.Contains(x.ReadingQuestionTrialId), x => new ReadingTaskQuestionAnswer - { - Answer = string.Empty - }); + // await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && isNeedDeleteIds.Contains(x.ReadingQuestionTrialId), x => new ReadingTaskQuestionAnswer + // { + // Answer = string.Empty + // }); - calculateList = calculateList.Where(x => questionTypes.Contains(x.QuestionType)).ToList(); + // calculateList = calculateList.Where(x => questionTypes.Contains(x.QuestionType)).ToList(); - } + //} if (calculateType != null) { @@ -1952,6 +1959,57 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate #endregion + #region SuvMax所在病灶 + + /// + /// SuvMax所在病灶 + /// + /// + /// + public async Task GetSuvMaxFocus(ReadingCalculateDto inDto) + { + var rowInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList(); + + + + var tableQuestions = rowInfo.SelectMany(x => x.TableQuestionList).ToList(); + + var maxSuv = tableQuestions.Where(x => x.QuestionMark == QuestionMark.SUVmax).Select(x =>new { + x.RowIndex, + Answer= x.Answer.IsNullOrEmptyReturn0(), + + + }).OrderByDescending(x=>x.Answer).FirstOrDefault(); + if (maxSuv == null) + { + return string.Empty; + } + else + { + var orderMark = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).FirstOrDefault().OrderMark; + return orderMark+ maxSuv.RowIndex.GetLesionMark(); + } + + + } + #endregion + + #region SuvMax + /// + /// 最大sum + /// + /// + /// + public async Task GetSuvMax(ReadingCalculateDto inDto) + { + var rowInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList(); + var tableQuestions = rowInfo.SelectMany(x => x.TableQuestionList).ToList(); + + var maxSuv = tableQuestions.Where(x => x.QuestionMark == QuestionMark.SUVmax).Select(x => x.Answer.IsNullOrEmptyReturn0()).MaxOrDefault(); + return maxSuv; + } + #endregion + #region 影像学整体肿瘤评估 /// /// 影像学整体肿瘤评估