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 1/5] =?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; + } + } + } } From f9c155a378f78f7c4204f654bce5df89ff1b426b Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 26 Sep 2024 15:05:32 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/ReadingImageTask/ReadingJudgeTaskService.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs index f90b1687d..5856d7d9d 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs @@ -408,10 +408,7 @@ namespace IRaCIS.Core.Application.Service x.VisitTaskInfoList.ForEach(z => { z.JudgeQuestionList=z.JudgeQuestionList.Take(maxNum).ToList(); - }); - - }); break; From 0d4d984135940f6f474fc5b8e4d80aba59c3ea50 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 26 Sep 2024 17:13:27 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ReadingCalculate/IVUSCalculateService.cs | 2 +- .../Service/ReadingCalculate/OCTCalculateService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs index 8f58b5c82..969e93c57 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 ? "NA" : value.Value.ToString(); + item.Answer = value == null ? "NE" : value.Value.ToString(); } else if (calculate.GetStringFun != null) { diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs index 4a45aa158..f00f83cd3 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 ? "NA" : value.Value.ToString(); + item.Answer = value == null ? "NE" : value.Value.ToString(); } else if (calculate.GetStringFun != null) { From f2d9c6fe38f18643b730935037486461dfb972a3 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 26 Sep 2024 17:22:04 +0800 Subject: [PATCH 4/5] =?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 | 21 +++++++++++++++++++ .../Common/ReadingCommon.cs | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs index 5856d7d9d..2ec8f6157 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs @@ -974,6 +974,16 @@ namespace IRaCIS.Core.Application.Service }); break; case JudgeTypeEnum.DifferenceAbsoluteValue: + + var answer1 = taskAnswer1.IsNullOrEmptyReturnNull(); + var answer2 = taskAnswer2.IsNullOrEmptyReturnNull(); + + // 已经判断不相等了 所以只可能有一个为Null + if (answer1 == null || answer2 == null) + { + noteEqual = true; + } + var deffaultValue = taskAnswer1.IsNullOrEmptyReturn0() - taskAnswer2.IsNullOrEmptyReturn0(); if (deffaultValue < 0) { @@ -1000,6 +1010,17 @@ namespace IRaCIS.Core.Application.Service break; case JudgeTypeEnum.PercentageDifference: + + + var answer1P = taskAnswer1.IsNullOrEmptyReturnNull(); + var answer2P = taskAnswer2.IsNullOrEmptyReturnNull(); + + // 已经判断不相等了 所以只可能有一个为Null + if (answer1P == null || answer2P == null) + { + noteEqual = true; + } + var value1 = taskAnswer1.IsNullOrEmptyReturn0(); var value2 = taskAnswer2.IsNullOrEmptyReturn0(); if (value1 == 0 || value2 == 0) diff --git a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs index 41196b603..8a835bc1f 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs @@ -225,7 +225,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common catch (Exception) { - return 0; + return null; } } @@ -253,6 +253,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common + /// /// 获取DisplayName /// From f3c29d35308b6f500a6306b518242c6a002fbc36 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 26 Sep 2024 17:29:01 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs index 2ec8f6157..a2dfba624 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs @@ -404,7 +404,7 @@ namespace IRaCIS.Core.Application.Service judgeInfo.VisitInfoList.ForEach(x => { - var maxNum = x.VisitTaskInfoList.Select(y => y.JudgeQuestionList.Where(z => z.Answer != "NA").Count()).MaxOrDefault(); + var maxNum = x.VisitTaskInfoList.Select(y => y.JudgeQuestionList.Where(z => z.Answer != "NE").Count()).MaxOrDefault(); x.VisitTaskInfoList.ForEach(z => { z.JudgeQuestionList=z.JudgeQuestionList.Take(maxNum).ToList();