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; + } + } + } }