From 3d6d64175ba6555a7694f335ce91b30ca021a8ba Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 26 Sep 2024 15:03:01 +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 --- .../ReadingJudgeTaskService.cs | 22 ++++++++++++++++++- .../ReadingCalculate/IVUSCalculateService.cs | 8 +++---- .../ReadingCalculate/OCTCalculateService.cs | 8 +++---- .../Common/ReadingCommon.cs | 21 ++++++++++++++++++ .../_IRaCIS/IQueryableExtensions.cs | 20 +++++++++++++++++ 5 files changed, 70 insertions(+), 9 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs index e5b3639b3..f90b1687d 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs @@ -90,7 +90,7 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task GetJudgeReadingInfo(GetJudgeReadingInfo inDto) { - var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); + var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x=>x.TrialReadingCriterion).FirstNotNullAsync(); var criterionType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == visitTask.TrialReadingCriterionId).Select(x => x.CriterionType).FirstNotNullAsync(); @@ -397,6 +397,26 @@ namespace IRaCIS.Core.Application.Service break; } + switch (visitTask.TrialReadingCriterion.CriterionType) + { + case CriterionType.IVUS: + case CriterionType.OCT: + + judgeInfo.VisitInfoList.ForEach(x => + { + var maxNum = x.VisitTaskInfoList.Select(y => y.JudgeQuestionList.Where(z => z.Answer != "NA").Count()).MaxOrDefault(); + x.VisitTaskInfoList.ForEach(z => + { + z.JudgeQuestionList=z.JudgeQuestionList.Take(maxNum).ToList(); + + }); + + + }); + + break; + } + return judgeInfo; } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs index 226e8d6a4..8f58b5c82 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs @@ -505,7 +505,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate else if (calculate.GetDecimalNullFun != null) { var value = await calculate.GetDecimalNullFun(inDto); - item.Answer = value == null ? string.Empty : value.Value.ToString(); + item.Answer = value == null ? "NA" : value.Value.ToString(); } else if (calculate.GetStringFun != null) { @@ -943,7 +943,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate public async Task GetPlaque1PVA(ReadingCalculateDto inDto) { return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PAV).SelectMany(x => x.TableRowInfoList).Where(x=>x.TableQuestionList.Any(y=>y.QuestionMark==QuestionMark.PlaqueNumber&&y.Answer.IsNullOrEmptyReturn0()==1)).SelectMany(x => x.TableQuestionList) - .Where(x => x.QuestionMark == QuestionMark.PAV).Select(x=>x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0(); + .Where(x => x.QuestionMark == QuestionMark.PAV).Select(x=>x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull(); } /// @@ -954,7 +954,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate public async Task GetPlaque2PVA(ReadingCalculateDto inDto) { return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PAV).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 2)).SelectMany(x => x.TableQuestionList) - .Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0(); + .Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull(); } /// @@ -965,7 +965,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate public async Task GetPlaque3PVA(ReadingCalculateDto inDto) { return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PAV).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 3)).SelectMany(x => x.TableQuestionList) - .Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0(); + .Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull(); } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs index fa58baeec..4a45aa158 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs @@ -815,7 +815,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate else if (calculate.GetDecimalNullFun != null) { var value = await calculate.GetDecimalNullFun(inDto); - item.Answer = value == null ? string.Empty : value.Value.ToString(); + item.Answer = value == null ? "NA" : value.Value.ToString(); } else if (calculate.GetStringFun != null) { @@ -1062,7 +1062,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate public async Task GetPlaque1MinFCT(ReadingCalculateDto inDto) { return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PatchDataStatistics).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 1)).SelectMany(x => x.TableQuestionList) - .Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0(); + .Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull(); } /// @@ -1073,7 +1073,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate public async Task GetPlaque2MinFCT(ReadingCalculateDto inDto) { return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PatchDataStatistics).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 2)).SelectMany(x => x.TableQuestionList) - .Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0(); + .Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull(); } /// @@ -1084,7 +1084,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate public async Task GetPlaque3MinFCT(ReadingCalculateDto inDto) { return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PatchDataStatistics).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 3)).SelectMany(x => x.TableQuestionList) - .Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0(); + .Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull(); } /// diff --git a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs index cc0ea5866..41196b603 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs @@ -208,6 +208,27 @@ namespace IRaCIS.Core.Infra.EFCore.Common } } + public static decimal? IsNullOrEmptyReturnNull(this string value) + { + try + { + if (value == null || value == string.Empty || value == "NA") + { + return null; + + } + else + { + return decimal.Parse(value); + } + } + catch (Exception) + { + + return 0; + } + } + public static decimal IsNullOrEmptyReturn0(this string value) { try diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryableExtensions.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryableExtensions.cs index c63e27389..bd599160b 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryableExtensions.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryableExtensions.cs @@ -50,5 +50,25 @@ namespace IRaCIS.Core.Infrastructure.Extention } } + /// + /// 查询字符串 为null 返回指定字符 + /// + /// + /// + /// + public static string FirstIsNullReturnValue(this IEnumerable source,string value) + { + var result = source.FirstOrDefault(); + + if (result == null || result == string.Empty) + { + return value; + } + else + { + return result; + } + } + } }