diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs index c07f1cdb6..7b9f7990f 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs @@ -97,6 +97,22 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate // 既往新病灶 var questionAlwaysLesions = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == visitTaskInfo.TrialReadingCriterionId && x.LesionType == LesionType.AlwaysNewLesions).FirstNotNullAsync(); + + + var newLesionTableQuestions = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionNewLesions.Id).ToListAsync(); + var alwaysNewLesionsTableQuestions = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionAlwaysLesions.Id).ToListAsync(); + + Dictionary alwaysTableQuestionIdDic = new Dictionary(); + + alwaysNewLesionsTableQuestions.ForEach(x => + { + + alwaysTableQuestionIdDic.Add( + x.Id, + newLesionTableQuestions.Where(y => y.QuestionName == x.QuestionName).Select(y => y.Id).FirstOrDefault() + ); + }); + foreach (var item in tableAnsweRowInfos) { if (item.QuestionId == questionAlwaysLesions.Id) @@ -119,6 +135,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate { item.QuestionId = questionNewLesions.Id; } + + item.TableQuestionId = alwaysTableQuestionIdDic[item.TableQuestionId]; } @@ -352,10 +370,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate ); }); - var maxNewLesionsRowIndex = tableRowAnswers.Where(x => x.QuestionId == alwaysNewLesionsQuestion.Id).OrderByDescending(x => x.RowIndex).Select(x => x.RowIndex).FirstOrDefault(); - maxNewLesionsRowIndex = Math.Floor(maxNewLesionsRowIndex); - - foreach (var item in tableRowAnswers.Where(x => x.QuestionId == newLesionQuestion.Id).OrderBy(x=>x.RowIndex)) {