diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 124994922..283d2e51c 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -1131,7 +1131,7 @@ namespace IRaCIS.Application.Services }); var thisAnswer = tableAnswers.Where(x => x.QuestionId == item.Id).ToList(); - var orders = thisAnswer.OrderBy(x => x.RowIndex).Select(x=>x.RowId).Distinct().ToList(); + var orders = thisAnswer.Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList(); item.TableQuestions.Answers = new List>(); @@ -1141,15 +1141,12 @@ namespace IRaCIS.Application.Services QuestionMark.Part, }; - foreach (var x in orders) + orders.ForEach(x => { Dictionary answers = new Dictionary(); - var rowInfo = tableAnsweRowInfos.Where(y => y.Id==x).FirstOrDefault(); - //if (rowInfo == null) - //{ - // continue; - //} - + var rowInfo = tableAnsweRowInfos.Where(y => y.RowIndex == x && y.QuestionId == item.Id).FirstOrDefault(); + + var rowAnswer = thisAnswer.Where(y => y.RowId == rowInfo.Id).OrderBy(y => y.ShowOrder).ToList(); var organInfo = organInfos.Where(x => x.Id == rowInfo.OrganInfoId).FirstOrDefault(); @@ -1247,7 +1244,7 @@ namespace IRaCIS.Application.Services item.TableQuestions.Answers.Add(answers); - }; + }); if (item.Childrens != null && item.Childrens.Count != 0) {