diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index 186372a45..30d7fee57 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -152,12 +152,12 @@ namespace IRaCIS.Application.Services { var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.IsConfirm && x.TrialId == inDto.TrialId).Select(x => x.Id).FirstOrDefaultAsync(); - var questions = await _readingQuestionTrialRepository.Where(x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == criterionId&&x.Type!="table") + var questions = await _readingQuestionTrialRepository.Where(x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == criterionId&&x.Type!=ReadingQestionType.Table) .ProjectTo(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync(); var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync(); - var result = questions.Where(x => x.Type == "group").ToList(); + var result = questions.Where(x => x.Type == ReadingQestionType.Group).ToList(); foreach (var item in result) { @@ -170,7 +170,7 @@ namespace IRaCIS.Application.Services private void GetDicomReadingAnswer(DicomReadingQuestionAnswer item,List questions,List answers) { item.Answer = answers.Where(x => x.ReadingQuestionTrialId == item.Id).Select(x => x.Answer).FirstIsNullReturnEmpty(); - item.Childrens = questions.Where(x => x.ParentId == item.Id||((item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)) ).ToList(); + item.Childrens = questions.Where(x => x.ParentId == item.Id||((item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName)) ).ToList(); if (item.Childrens != null && item.Childrens.Count > 0) { foreach (var question in item.Childrens) @@ -221,7 +221,7 @@ namespace IRaCIS.Application.Services // 第一级 #region 构造问题 - List questions = questionList.Where(x => x.Type == "group").OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() + List questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() { QuestionId = x.Id, GroupName = x.GroupName, @@ -234,7 +234,7 @@ namespace IRaCIS.Application.Services // 分组 foreach (var item in questions) { - item.Childrens = questionList.Where(x => x.GroupName == item.GroupName&&x.Type!= "group").OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() + item.Childrens = questionList.Where(x => x.GroupName == item.GroupName&&x.Type!= ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() { GroupName = x.GroupName, QuestionId = x.Id, @@ -352,9 +352,9 @@ namespace IRaCIS.Application.Services #region 获取问题及答案 var qusetionList = await _readingQuestionTrialRepository.Where(x=>x.ReadingQuestionCriterionTrialId== criterion.Id) - .ProjectTo(_mapper.ConfigurationProvider).Where(x=>x.IsShowInDicom && (x.Type == "table"||x.Type== "group")).OrderBy(x => x.ShowOrder).ToListAsync(); + .ProjectTo(_mapper.ConfigurationProvider).Where(x=>x.IsShowInDicom && (x.Type == ReadingQestionType.Table||x.Type== ReadingQestionType.Group)).OrderBy(x => x.ShowOrder).ToListAsync(); - var usedGurops = qusetionList.Where(x => x.Type == "table").Select(x => x.GroupName).ToList(); + var usedGurops = qusetionList.Where(x => x.Type == ReadingQestionType.Table).Select(x => x.GroupName).ToList(); qusetionList = qusetionList.Where(x =>usedGurops.Contains(x.GroupName)).ToList(); var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync(); @@ -395,13 +395,13 @@ namespace IRaCIS.Application.Services IsPublicPage = firstData.IsPublicPage, }; - var pageGroupList = newPageQusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); + var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); pageGroupList.ForEach(x => { this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, tableAnswers, tableAnsweRowInfos); }); - page.Childrens = pageGroupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); + page.Childrens = pageGroupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList(); groupList.Add(page); } @@ -412,13 +412,13 @@ namespace IRaCIS.Application.Services { qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId == null).ToList(); - groupList = qusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); + groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); groupList.ForEach(x => { this.FindChildQuestion(x, qusetionList, tableQuestionList, tableAnswers, tableAnsweRowInfos); }); - groupList = groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); + groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList(); result.SinglePage = groupList; @@ -443,7 +443,7 @@ namespace IRaCIS.Application.Services /// private void FindChildQuestion(TrialReadQuestionData item, List questionlists, List tableQuestionLists,List tableAnswers,List tableAnsweRowInfos) { - item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); + item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); item.TableQuestions = new TrialReadTableQuestion(); item.TableQuestions.Questions = tableQuestionLists.Where(x => x.ReadingQuestionId == item.Id).OrderBy(x=>x.ShowOrder).ToList(); @@ -1157,13 +1157,13 @@ namespace IRaCIS.Application.Services IsPublicPage = firstData.IsPublicPage, }; - var pageGroupList = newPageQusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); + var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); pageGroupList.ForEach(x => { this.FindChildQuestion(x, newPageQusetionList, tableQuestionList); }); - page.Childrens = pageGroupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); + page.Childrens = pageGroupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList(); groupList.Add(page); } @@ -1174,13 +1174,13 @@ namespace IRaCIS.Application.Services { qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId == null).ToList(); - groupList = qusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); + groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); groupList.ForEach(x => { this.FindChildQuestion(x, qusetionList, tableQuestionList); }); - groupList = groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); + groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList(); result.SinglePage = groupList; @@ -1269,13 +1269,13 @@ namespace IRaCIS.Application.Services //qusetionList = qusetionList.Where(x => x.ParentId == null).ToList(); - groupList = qusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); + groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); groupList.ForEach(x => { this.FindSystemChildQuestion(x, qusetionList, tableQuestionList); }); - groupList = groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); + groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList(); result.SinglePage = groupList; @@ -1292,7 +1292,7 @@ namespace IRaCIS.Application.Services /// public void FindSystemChildQuestion(GetSystemReadingQuestionOutDto item, List questionlists,List tableQuestions) { - item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); + item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); item.Childrens.AddRange(tableQuestions.Where(x => x.ReadingQuestionId == item.Id).Select(x => new GetSystemReadingQuestionOutDto { @@ -1614,7 +1614,7 @@ namespace IRaCIS.Application.Services [NonDynamicMethod] public void FindChildQuestion(GetTrialReadingQuestionOutDto item, List questionlists,List tableQuestions) { - item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); + item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); item.Childrens.AddRange(tableQuestions.Where(x => x.ReadingQuestionId == item.Id).Select(x => new GetTrialReadingQuestionOutDto diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index ec0a4a01e..88cb60258 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -1308,7 +1308,7 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task> GetTrialGroupNameList(GetTrialGroupNameListInDto inDto) { - var result = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.CriterionId && x.Type == "group") + var result = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.CriterionId && x.Type == ReadingQestionType.Group) .Where(x=>x.ReadingCriterionPageId==inDto.ReadingCriterionPageId) .Select(x => x.GroupName).ToListAsync(); @@ -1325,7 +1325,7 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task> GetSystemGroupNameList(GetTrialGroupNameListInDto inDto) { - var result = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.CriterionId && x.Type == "group") + var result = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.CriterionId && x.Type == ReadingQestionType.Group) .Select(x => x.GroupName).ToListAsync(); return result; diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs index 78b8bc87b..09849a37e 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs @@ -7,9 +7,18 @@ using System.Threading.Tasks; namespace IRaCIS.Core.Domain.Share { - /// - /// 模块枚举 - /// + + public static class ReadingQestionType + { + + public static readonly string Table = "table"; + + public static readonly string Group = "group"; + } + + /// + /// 模块枚举 + /// public enum ModuleTypeEnum { ///