diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index 5c80fb192..681a8bd9f 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -663,6 +663,15 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto } + public class GetSystemReadingQuestionPageDto + { + public List SinglePage { get; set; } + + public List MultiPage { get; set; } + + public List PublicPage { get; set; } + } + public class GetTrialReadingQuestionPageDto { public List SinglePage { get; set; } @@ -672,7 +681,238 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public List PublicPage{ get; set; } } - + public class TableQuestionDataInfo + { + /// + /// 问题ID + /// + public Guid ReadingQuestionId { get; set; } + + /// + /// Type + /// + public string Type { get; set; } + + /// + /// ParentId + /// + public Guid? ParentId { get; set; } + + /// + ///父问题触发值 + /// + public string ParentTriggerValue { get; set; } + + /// + /// 问题名称 + /// + public string QuestionName { get; set; } + + /// + /// IsRequired + /// + public int IsRequired { get; set; } + + /// + /// 排序号 + /// + public int ShowOrder { get; set; } + + /// + /// 值 + /// + public string TypeValue { get; set; } + + /// + /// 是否启用 + /// + public bool IsEnable { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 创建用户 + /// + public Guid CreateUserId { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 显示父问题 + /// + public Guid? RelevanceId { get; set; } + + /// + /// 显示父问题的值 + /// + public string RelevanceValue { get; set; } + + /// + /// 是否显示 + /// + public int ShowQuestion { get; set; } + + /// + /// 最大问题数 + /// + public int? MaxRowCount { get; set; } + + /// + /// 数据表名称 + /// + public string DataTableName { get; set; } + + /// + /// 数据列 + /// + public string DataTableColumn { get; set; } + + + /// + /// 关联父问题 + /// + public Guid? DependParentId { get; set; } + + /// + /// 是否关联 + /// + public IsDepend IsDepend { get; set; } + + /// + /// 表格问题类型 + /// + public TableQuestionType? TableQuestionType { get; set; } + + + /// + /// 问题标识 + /// + public QuestionMark? QuestionMark { get; set; } + } + + + public class GetSystemReadingQuestionOutDto + { + + public Guid Id { get; set; } + + /// + /// 系统标准Id + /// + public Guid ReadingQuestionCriterionSystemId { get; set; } + + /// + /// 类型 + /// + public string Type { get; set; } + + /// + /// 父问题触发 + /// + public string ParentTriggerValue { get; set; } + + /// + /// 问题名称 + /// + public string QuestionName { get; set; } + + /// + /// 是否是必须 + /// + public IsRequired IsRequired { get; set; } + + /// + /// 排序 + /// + public int ShowOrder { get; set; } + + /// + /// 父问题ID + /// + public Guid? ParentId { get; set; } + + /// + /// 类型值 + /// + public string TypeValue { get; set; } + + /// + /// 是否启用 + /// + public bool IsEnable { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 是否是裁判问题 + /// + public bool IsJudgeQuestion { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 关联ID + /// + public Guid? RelevanceId { get; set; } + + /// + /// 关联Value + /// + public string RelevanceValue { get; set; } = string.Empty; + + /// + /// 分组 + /// + public string GroupName { get; set; } + + /// + /// 图片数量 + /// + public int ImageCount { get; set; } = 1; + + /// + /// 是否显示 + /// + public ShowQuestion ShowQuestion { get; set; } = ShowQuestion.Show; + + /// + /// 最大问题数 + /// + public int? MaxQuestionCount { get; set; } + + /// + /// 病灶类型 + /// + public LesionType? LesionType { get; set; } + + /// + /// 问题类型 + /// + public QuestionType? QuestionType { get; set; } + + /// + /// 是否显示在Dicom阅片中 + /// + public bool IsShowInDicom { get; set; } + + + + public List TableQuestions { get; set; } + + public List Childrens { get; set; } + } public class GetTrialReadingQuestionOutDto { @@ -770,6 +1010,31 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public ShowQuestion ShowQuestion { get; set; } + + + + /// + /// 最大问题数 + /// + public int? MaxQuestionCount { get; set; } + + /// + /// 病灶类型 + /// + public LesionType? LesionType { get; set; } + + /// + /// 问题类型 + /// + public QuestionType? QuestionType { get; set; } + + /// + /// 是否显示在Dicom阅片中 + /// + public bool IsShowInDicom { get; set; } = false; + + public List TableQuestions { get; set; } + public List Childrens { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index c21bc07c7..2daf9091f 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -41,6 +41,7 @@ namespace IRaCIS.Application.Services private readonly IRepository _readingCriterionPageRepository; private readonly IRepository _readingJudgeInfoRepository; private readonly IRepository _readModuleRepository; + private readonly IRepository _readingTableQuestionSystemRepository; private readonly IRepository _readingTaskQuestionAnswerRepository; private readonly IRepository _readingQuestionCriterionTrialRepository; private readonly IRepository _readingQuestionCriterionSystemRepository; @@ -64,6 +65,7 @@ namespace IRaCIS.Application.Services IRepository readingCriterionPageRepository, IRepository readingJudgeInfoRepository, IRepository readModuleRepository, + IRepository readingTableQuestionSystemRepository, IRepository readingTaskQuestionAnswerRepository, IRepository readingQuestionCriterionTrialRepository, IRepository readingQuestionCriterionSystemRepository, @@ -86,6 +88,7 @@ namespace IRaCIS.Application.Services this._readingCriterionPageRepository = readingCriterionPageRepository; this._readingJudgeInfoRepository = readingJudgeInfoRepository; this._readModuleRepository = readModuleRepository; + this._readingTableQuestionSystemRepository = readingTableQuestionSystemRepository; this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository; this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository; this._readingQuestionCriterionSystemRepository = readingQuestionCriterionSystemRepository; @@ -864,36 +867,24 @@ namespace IRaCIS.Application.Services /// /// [HttpPost] - public async Task GetSystemReadingQuestion(GetSystemReadingQuestionInDto inDto) + public async Task GetSystemReadingQuestion(GetSystemReadingQuestionInDto inDto) { - var result = new GetTrialReadingQuestionPageDto(); - var query = from data in _readingQuestionSystem.Where(x => x.ReadingQuestionCriterionSystemId == inDto.Id) - select new GetTrialReadingQuestionOutDto() - { - ReadingQuestionTrialId = data.Id, - ParentTriggerValue = data.ParentTriggerValue, - GroupName = data.GroupName, - QuestionName = data.QuestionName, - IsRequired = data.IsRequired, - ShowOrder = data.ShowOrder, - ParentId = data.ParentId, - TypeValue = data.TypeValue, - Answer = string.Empty, - ShowQuestion=data.ShowQuestion, - PageShowOrder = data.ShowOrder, - Type=data.Type, - }; + var result = new GetSystemReadingQuestionPageDto(); + var qusetionList =await _readingQuestionSystem.Where(x => x.ReadingQuestionCriterionSystemId == inDto.Id) + .ProjectTo(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync(); - var qusetionList = await query.OrderBy(x => x.ShowOrder).ToListAsync(); - var groupList = new List(); + var tableQuestionList =await _readingTableQuestionSystemRepository.Where(x => x.SystemCriterionId == inDto.Id) + .ProjectTo(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync(); - qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId == null).ToList(); + var groupList = new List(); + + qusetionList = qusetionList.Where(x => x.ParentId == null).ToList(); groupList = qusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); groupList.ForEach(x => { - this.FindChildQuestion(x, qusetionList); + this.FindSystemChildQuestion(x, qusetionList, tableQuestionList); }); groupList = groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); @@ -901,47 +892,30 @@ namespace IRaCIS.Application.Services result.SinglePage = groupList; - return (result); + return result; } - #endregion - #region 获取阅片任务和答案 /// - /// 获取阅片任务和答案 + /// 获取系统 /// - /// - private async Task> GetTaskAndAnswer(Guid visitTaskId) + /// + /// + /// + public void FindSystemChildQuestion(GetSystemReadingQuestionOutDto item, List questionlists,List tableQuestions) { - var taskQuery = from questionAnswer in _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId) - join trialQuestion in _readingQuestionTrialRepository.AsQueryable() on questionAnswer.ReadingQuestionTrialId equals trialQuestion.Id - select new GetTrialReadingQuestionOutDto() - { - ReadingQuestionTrialId = trialQuestion.Id, - ReadingQuestionCriterionTrialId = trialQuestion.ReadingQuestionCriterionTrialId, - TrialId = trialQuestion.TrialId, - Type = trialQuestion.Type, - ParentTriggerValue = trialQuestion.ParentTriggerValue, - GroupName = trialQuestion.GroupName, - QuestionName = trialQuestion.QuestionName, - IsRequired = trialQuestion.IsRequired, - ShowOrder = trialQuestion.ShowOrder, - ParentId = trialQuestion.ParentId, - TypeValue = trialQuestion.TypeValue, - Answer = questionAnswer.Answer - }; - var qusetionList = await taskQuery.OrderBy(x => x.ShowOrder).ToListAsync(); - List groupList = qusetionList.Where(x => x.ParentId == null).ToList(); - groupList.ForEach(x => + item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); + item.TableQuestions = tableQuestions.Where(x => x.ReadingQuestionId == item.Id).ToList(); + if (item.Childrens != null && item.Childrens.Count != 0) { - this.FindChildQuestion(x, qusetionList); - }); - - return groupList; + item.Childrens.ForEach(x => + { + this.FindSystemChildQuestion(x, questionlists, tableQuestions); + }); + } } #endregion - /// /// 获取阅片的受试者信息 /// @@ -1214,7 +1188,7 @@ namespace IRaCIS.Application.Services } } - + #endregion #region 保存任务问题 diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 347923918..1cb426e22 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -51,6 +51,10 @@ namespace IRaCIS.Core.Application.Service #region 阅片问题 + CreateMap(); + + CreateMap(); + CreateMap() .ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder));