diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index 659eddc69..e5f06d2ae 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -282,6 +282,37 @@ namespace IRaCIS.Core.Application.Contracts //public bool? IsClosed { get; set; } } + public class QCQuestionAnswer + { + public Guid Id { get; set; } + public string QuestionName { get; set; } = String.Empty; + public bool IsRequired { get; set; } + + public string Type { get; set; } = String.Empty; + + public string Answer { get; set; } = String.Empty; + public string ParentTriggerValue { get; set; } + public Guid? ParentId { get; set; } + public string TypeValue { get; set; } = String.Empty; + public int ShowOrder { get; set; } + + public int? ParentShowOrder { get; set; } + + + + public List Childrens = new List(); + } + public class GetQCQuestionAnswerInDto + { + public Guid SubjectVisit { get; set; } + + public Guid TrialId { get; set; } + + public TrialQCProcess QCProcessEnum { get; set; } + + // 1代表第一个人QC数据 2 代表第二个人QC数据 + public CurrentQC CurrentQCEnum { get; set; } + } public class ForwardQuery : PageInput { diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index 13e2b6b7d..0ac494f87 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -10,17 +10,20 @@ namespace IRaCIS.Core.Application.Image.QA public class QCListService : BaseService, IQCListService { private readonly IRepository _subjectVisitRepository; - + private readonly IRepository _trialQCQuestionAnswerRepository; + private readonly IRepository _trialQCQuestionRepository; private readonly IRepository _consistencyCheckFileRepository; public QCListService( IRepository subjectVisitRepository, - + IRepository trialQCQuestionAnswerRepository, + IRepository trialQCQuestionRepository, IRepository consistencyCheckFileRepository ) { _subjectVisitRepository = subjectVisitRepository; - + this._trialQCQuestionAnswerRepository = trialQCQuestionAnswerRepository; + this._trialQCQuestionRepository = trialQCQuestionRepository; this._consistencyCheckFileRepository = consistencyCheckFileRepository; } @@ -575,6 +578,54 @@ namespace IRaCIS.Core.Application.Image.QA }; } + /// + /// 获取质控问题答案 + /// + /// + /// + [HttpPost] + public async Task> GetQCQuestionAnswer(GetQCQuestionAnswerInDto inDto) + { + var questionAnswerlist =await (from data in _trialQCQuestionRepository.Where(x => x.TrialId == inDto.TrialId && x.IsEnable) + join answer in _trialQCQuestionAnswerRepository.AsQueryable() on data.Id equals answer.TrialQCQuestionConfigureId into answertemp + from leftanswer in answertemp.DefaultIfEmpty() + select new QCQuestionAnswer() + { + Answer = leftanswer.Answer, + ShowOrder = data.ShowOrder, + QuestionName = data.QuestionName, + Id = data.Id, + IsRequired = data.IsRequired, + ParentId = data.ParentId, + ParentTriggerValue = data.ParentTriggerValue, + Type = data.Type, + TypeValue = data.TypeValue + }).ToListAsync(); + + var result = questionAnswerlist.Where(x => x.ParentId == null).ToList(); + result.ForEach(x => { + GetQuestionChild(x, questionAnswerlist); + }); + + return result; + } + + + private void GetQuestionChild(QCQuestionAnswer parent, List dataList) + { + parent.Childrens = dataList.Where(x => x.ParentId == parent.Id).ToList(); + + if (parent.Childrens.Count != 0) + { + parent.Childrens.ForEach(x => + { + GetQuestionChild(x, dataList); + }); + } + + + } + /// /// 获取某次访视 QC 问题核对答案 列表 初始化进去的时候是模板项,QC填写了就是对应的内容 ///