修改一版

Uat_Study
he 2022-08-04 17:47:50 +08:00
parent ef72b3bfa1
commit 875e1e1c7b
2 changed files with 85 additions and 3 deletions

View File

@ -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<QCQuestionAnswer> Childrens = new List<QCQuestionAnswer>();
}
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
{

View File

@ -10,17 +10,20 @@ namespace IRaCIS.Core.Application.Image.QA
public class QCListService : BaseService, IQCListService
{
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
private readonly IRepository<TrialQCQuestionAnswer> _trialQCQuestionAnswerRepository;
private readonly IRepository<TrialQCQuestion> _trialQCQuestionRepository;
private readonly IRepository<ConsistencyCheckFile> _consistencyCheckFileRepository;
public QCListService(
IRepository<SubjectVisit> subjectVisitRepository,
IRepository<TrialQCQuestionAnswer> trialQCQuestionAnswerRepository,
IRepository<TrialQCQuestion> trialQCQuestionRepository,
IRepository<ConsistencyCheckFile> consistencyCheckFileRepository
)
{
_subjectVisitRepository = subjectVisitRepository;
this._trialQCQuestionAnswerRepository = trialQCQuestionAnswerRepository;
this._trialQCQuestionRepository = trialQCQuestionRepository;
this._consistencyCheckFileRepository = consistencyCheckFileRepository;
}
@ -575,6 +578,54 @@ namespace IRaCIS.Core.Application.Image.QA
};
}
/// <summary>
/// 获取质控问题答案
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<List<QCQuestionAnswer>> 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<QCQuestionAnswer> dataList)
{
parent.Childrens = dataList.Where(x => x.ParentId == parent.Id).ToList();
if (parent.Childrens.Count != 0)
{
parent.Childrens.ForEach(x =>
{
GetQuestionChild(x, dataList);
});
}
}
/// <summary>
/// 获取某次访视 QC 问题核对答案 列表 初始化进去的时候是模板项QC填写了就是对应的内容
/// </summary>