diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs index 2073ec29..83db23a6 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs @@ -333,11 +333,18 @@ namespace IRaCIS.Application.Services }; if (criterionType != CriterionType.PCWG3) { + var agreeOrNotAnswer = globalReadingQuestion.Where(y => y.TaskId == x.VisitTaskId && y.GlobalAnswerType == GlobalAnswerType.AgreeOrNot).Select(x => x.Answer).FirstOrDefault() ?? string.Empty; + + if (agreeOrNotAnswer.IsNullOrEmpty()&& lastGlobalTask.RelatedVisitTaskIdList.Contains(x.VisitTaskId)) + { + agreeOrNotAnswer = "1"; + } + x.AgreeOrNot = new List() { new GlobalQuestionInfo() { - Answer = globalReadingQuestion.Where(y => y.TaskId == x.VisitTaskId && y.GlobalAnswerType == GlobalAnswerType.AgreeOrNot).Select(x => x.Answer).FirstOrDefault() ?? string.Empty, + Answer = agreeOrNotAnswer, QuestionName = "", Type = "input", GlobalAnswerType=GlobalAnswerType.AgreeOrNot, diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 4f6bc80a..3e2a6f83 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -917,6 +917,7 @@ namespace IRaCIS.Application.Services Unit = x.Unit, }).ToList(); }); + var thisAnswer = tableAnswers.Where(x => x.QuestionId == item.Id).ToList(); var orders = thisAnswer.Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList(); item.TableQuestions.Answers = new List>(); @@ -1390,11 +1391,11 @@ namespace IRaCIS.Application.Services if (inDto.RowIndex % 1 == 0) { - if (questionInfo.MaxQuestionCount != null && questionInfo.MaxQuestionCount != 0) + if (questionInfo.MaxQuestionCount != null && questionInfo.MaxQuestionCount != 0&& inDto.RowId==null) { if (questionInfo.MaxQuestionCount < ( - (await _readingTableAnswerRowInfoRepository.Where(x => x.RowIndex != inDto.RowIndex && ((x.RowIndex % 1) == 0) && x.VisitTaskId == inDto.VisitTaskId + (await _readingTableAnswerRowInfoRepository.Where(x => ((x.RowIndex % 1) == 0) && x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId ).CountAsync()) + 1)) {