diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index fa4842694..82d538458 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1230,6 +1230,11 @@ 非淋巴结靶病灶长径之和 decimal + + + SOD变化百分比 + + 所有淋巴结靶病灶的短径小于10mm diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs index a226a5faf..0494c18fc 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs @@ -23,6 +23,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public decimal SumOfDiameter { get; set; } + /// + /// SOD变化百分比 + /// + public decimal SODPercent { get; set; } + /// /// 所有淋巴结靶病灶的短径小于10mm /// diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCalculateService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCalculateService.cs index a11d23efa..80f47f384 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCalculateService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCalculateService.cs @@ -591,7 +591,7 @@ namespace IRaCIS.Core.Application.Service { if (inDto.IsBaseLine) { - return nameof(YesOrNoOrNa.NA); + return YesOrNoOrNa.NA.GetEnumInt(); } var LastVisitTaskId = await this.GetLastVisitTaskId(inDto); @@ -615,7 +615,7 @@ namespace IRaCIS.Core.Application.Service } } - return isExists? nameof(YesOrNoOrNa.Yes) : nameof(YesOrNoOrNa.No); + return isExists? YesOrNoOrNa.Yes.GetEnumInt() : YesOrNoOrNa.No.GetEnumInt(); } #endregion @@ -659,7 +659,7 @@ namespace IRaCIS.Core.Application.Service var newLesions = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesions).Select(x => x.Answer).FirstOrDefault(); var result = await _tumorAssessmentRepository.Where(x => x.TargetLesion.GetEnumInt() == targetLesion && x.NonTargetLesions.GetEnumInt() == noTargetLesion && x.NewLesion.GetEnumInt() == newLesions).Select(x => x.OverallEfficacy).ToListAsync(); - return result.Count == 0 ? string.Empty : result[0].GetEnumInt(); + return result.Count == 0 ? OverallAssessment.NA.GetEnumInt() : result[0].GetEnumInt(); } #endregion @@ -860,6 +860,9 @@ namespace IRaCIS.Core.Application.Service //所有淋巴结靶病灶的短径小于10mm bool DiameterLessThan10 = true, + // SOD变化百分比 + SODPercent = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SODPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()), + // SOD 百分比与基线期SOD相比减小≥30% bool SODPercentBigger30 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SODPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) >= (decimal)0.3, @@ -959,7 +962,7 @@ namespace IRaCIS.Core.Application.Service result = TargetAssessment.NE; } - else if (!resultData.ExixtsNETargetLesion) + else if (!resultData.ExixtsNETargetLesion&& resultData.SumOfDiameter==0&& resultData.SODPercent == 0) { result = TargetAssessment.ND; } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index c6446c0b9..0f01da641 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -2011,13 +2011,27 @@ namespace IRaCIS.Application.Services throw new BusinessValidationFailedException($"相同问题传入两次!"); } - var questions = await _readingTableQuestionTrialRepository.Where(x => tableQuestionIds.Contains(x.Id) && x.MaxRowCount != null && x.MaxRowCount != 0).ToListAsync(); + var questionInfo = await _readingQuestionTrialRepository.Where(x => x.Id == inDto.QuestionId).FirstNotNullAsync(); + if (questionInfo.MaxQuestionCount!=null) + { + if (questionInfo.MaxQuestionCount < + ( + (await _readingTableAnswerRowInfoRepository.Where(x => x.RowIndex != inDto.RowIndex && ((x.RowIndex % 1) == 0) && x.VisitTaskId == inDto.VisitTaskId + && x.QuestionId == inDto.QuestionId + ).CountAsync()) + 1)) + { + throw new BusinessValidationFailedException($"当前提交问题最大问题数为{questionInfo.MaxQuestionCount}!"); + } + } - foreach (var item in questions) + + var tableQuestions = await _readingTableQuestionTrialRepository.Where(x => tableQuestionIds.Contains(x.Id) && x.MaxRowCount != null && x.MaxRowCount != 0).ToListAsync(); + + foreach (var item in tableQuestions) { var answer = inDto.AnswerList.Where(x => x.TableQuestionId == item.Id).Select(x => x.Answer).FirstOrDefault(); - var rowCount = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.TableQuestionId == item.Id && x.Answer == answer && x.RowIndex != inDto.RowIndex).CountAsync(); + var rowCount = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.TableQuestionId == item.Id&& ((x.RowIndex % 1) == 0) && x.Answer == answer && x.RowIndex != inDto.RowIndex).CountAsync(); if (rowCount > item.MaxRowCount.Value - 1) {