From 660846a0d859c487e513a3dc08242d689dabc8e8 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Wed, 31 Jan 2024 11:22:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/CriterionCalculateDto.cs | 12 ++++- .../LuganoCalculateService.cs | 49 +++++++++++++------ 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs index adcca1fe9..d68e11325 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs @@ -22,9 +22,17 @@ namespace IRaCIS.Core.Application.ViewModel } - public class GetSplitPPdInDto - { + public class GetSplitPPdOutDto + { public Guid RowId { get; set; } + + public decimal AllPPD { get; set; } + } + + public class GetSplitPPdInDto + { + + public Guid VisitTaskId { get; set; } } public class ReadingTaskQuestionAnswerDto : ReadingTaskQuestionAnswer diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs index 8c0d89da3..b1a2c4efd 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs @@ -997,27 +997,48 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } } + + + + /// /// 获取分裂病灶的PPd之和 不包括当前的主病灶 /// /// [HttpPost] - public async Task GetSplitPPdSum(GetSplitPPdInDto inDto) + public async Task> GetSplitPPdSum(GetSplitPPdInDto inDto) { - var rowinfo = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).FirstNotNullAsync(); - - - var ppdAnswerList = await _readingTableQuestionAnswerRepository.Where(x => - x.VisitTaskId == rowinfo.VisitTaskId && - x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.PPD && - x.QuestionId == rowinfo.QuestionId && - x.RowIndex > (int)Math.Floor(rowinfo.RowIndex) && x.RowIndex < ((int)Math.Floor(rowinfo.RowIndex) + 1) - ).Select(x => x.Answer).ToListAsync(); - - var allPPd = ppdAnswerList.Select(x => x.IsNullOrEmptyReturn0()).Sum(); - - return allPPd; + List result = new List(); + var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); + var targetQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId && x.LesionType == LesionType.TargetLesion).FirstOrDefaultAsync(); + if (targetQuestion != null) + { + var ppdAnswerList = await _readingTableQuestionAnswerRepository.Where(x => + x.VisitTaskId == inDto.VisitTaskId && + x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.PPD && + x.QuestionId == targetQuestion.Id) + .Select(x => new { + x.RowId, + x.RowIndex, + x.Answer + }).ToListAsync(); + var answerList = ppdAnswerList.Select(x => new { + x.RowId, + x.RowIndex, + Answer = x.Answer.IsNullOrEmptyReturn0() + }).ToList(); + var maxRowIndex = answerList.Max(x => x.RowIndex); + for (int i = 1; i < maxRowIndex; i++) + { + result.Add(new GetSplitPPdOutDto() + { + RowId = answerList.Where(x => x.RowIndex == i).Select(x => x.RowId).FirstOrDefault(), + AllPPD = answerList.Where(x => x.RowIndex > i && x.RowIndex < (i + 1)).Sum(x => x.Answer), + }); + } + } + return result; } #region 将上一次的访视病灶添加到这一次