修改一版
parent
7dec183a4f
commit
5f32cebc8d
|
@ -353,7 +353,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public Guid TrialId { get; set; }
|
||||
}
|
||||
|
||||
public class GetReadingQuestionAndAnswerOutDto
|
||||
public class GetReadingQuestionAndAnswerOutDto: GetReadingTableQuestionOutDto
|
||||
{
|
||||
|
||||
public bool IsBaseLineTask { get; set; }
|
||||
|
@ -367,6 +367,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public ReadingTaskState ReadingTaskState { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class GetReadingTableQuestionOutDto
|
||||
{
|
||||
public List<TrialReadQuestionData> SinglePage { get; set; }
|
||||
|
||||
public List<TrialReadQuestionData> MultiPage { get; set; }
|
||||
|
@ -374,6 +380,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public List<TrialReadQuestionData> PublicPage { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class TrialReadQuestionData : ReadingQuestionTrial
|
||||
{
|
||||
|
||||
|
|
|
@ -447,51 +447,13 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
//if (taskinfo.TaskState != TaskState.Effect)
|
||||
//{
|
||||
// throw new BusinessValidationFailedException($"当前任务已失效!");
|
||||
//}
|
||||
result.ReadingTaskState = taskinfo.ReadingTaskState;
|
||||
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
result.IsBaseLineTask = taskinfo.SourceSubjectVisitId == baseLineVisitId;
|
||||
|
||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||
var criterionId = taskinfo.TrialReadingCriterionId;
|
||||
|
||||
|
||||
|
||||
|
||||
#region 获取问题及答案
|
||||
|
||||
var qusetionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).ProjectTo<TrialReadQuestionData>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
if (!criterionInfo.IseCRFShowInDicomReading)
|
||||
{
|
||||
qusetionList= qusetionList.Where(x => x.IsShowInDicom && (x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.Group)).OrderBy(x => x.ShowOrder).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();
|
||||
|
||||
qusetionList.ForEach(x =>
|
||||
{
|
||||
x.Answer = answers.Where(y => y.ReadingQuestionTrialId == x.Id).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
var formType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == criterionId).Select(x => x.FormType).FirstOrDefaultAsync();
|
||||
var groupList = new List<TrialReadQuestionData>();
|
||||
|
||||
var qusetionIds = qusetionList.Select(x => x.Id).ToList();
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => qusetionIds.Contains(x.ReadingQuestionId))
|
||||
.ProjectTo<TableQuestionTrial>(_mapper.ConfigurationProvider)
|
||||
.OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
|
||||
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository
|
||||
.ProjectTo<ReadingTableQuestionAnswerInfo>(_mapper.ConfigurationProvider)
|
||||
|
@ -499,7 +461,66 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
if (formType == FormType.MultiplePage)
|
||||
var questionPage = await GetReadingTableQuestion(taskinfo.TrialReadingCriterionId, inDto.VisitTaskId, tableAnswers, tableAnsweRowInfos);
|
||||
|
||||
result.SinglePage = questionPage.SinglePage;
|
||||
result.MultiPage = questionPage.MultiPage;
|
||||
result.PublicPage = questionPage.PublicPage;
|
||||
result.BlindName = visitTaskInfo.TaskBlindName;
|
||||
result.TaskNum = visitTaskInfo.VisitTaskNum;
|
||||
|
||||
return (result, new
|
||||
{
|
||||
readingTaskState = visitTaskInfo.ReadingTaskState,
|
||||
FormType = criterionInfo.FormType,
|
||||
TaskNum = visitTaskInfo.VisitTaskNum,
|
||||
|
||||
}); ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取表格问题及答案 只返回表格问题
|
||||
/// </summary>
|
||||
/// <param name="trialReadingCriterionId"></param>
|
||||
/// <param name="taskId"></param>
|
||||
/// <param name="tableAnswers"></param>
|
||||
/// <param name="tableAnsweRowInfos"></param>
|
||||
/// <returns></returns>
|
||||
[NonDynamicMethod]
|
||||
public async Task<GetReadingTableQuestionOutDto> GetReadingTableQuestion(Guid trialReadingCriterionId, Guid? taskId, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos)
|
||||
{
|
||||
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == trialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
var qusetionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId).ProjectTo<TrialReadQuestionData>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
if (!criterionInfo.IseCRFShowInDicomReading)
|
||||
{
|
||||
qusetionList = qusetionList.Where(x => x.IsShowInDicom && (x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.Group)).OrderBy(x => x.ShowOrder).ToList();
|
||||
}
|
||||
var usedGurops = qusetionList.Where(x => x.Type == ReadingQestionType.Table).Select(x => x.GroupName).ToList();
|
||||
qusetionList = qusetionList.Where(x => usedGurops.Contains(x.GroupName)).ToList();
|
||||
|
||||
if (taskId != null)
|
||||
{
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId).ToListAsync();
|
||||
qusetionList.ForEach(x =>
|
||||
{
|
||||
x.Answer = answers.Where(y => y.ReadingQuestionTrialId == x.Id).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
var groupList = new List<TrialReadQuestionData>();
|
||||
var qusetionIds = qusetionList.Select(x => x.Id).ToList();
|
||||
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => qusetionIds.Contains(x.ReadingQuestionId))
|
||||
.ProjectTo<TableQuestionTrial>(_mapper.ConfigurationProvider)
|
||||
.OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
var result = new GetReadingTableQuestionOutDto();
|
||||
if (criterionInfo.FormType == FormType.MultiplePage)
|
||||
{
|
||||
qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId != null).ToList();
|
||||
var readingCriterionPageIds = qusetionList.OrderBy(x => x.PageShowOrder).Select(x => x.ReadingCriterionPageId).Distinct().ToList();
|
||||
|
@ -544,16 +565,8 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
}
|
||||
|
||||
result.BlindName = visitTaskInfo.TaskBlindName;
|
||||
result.TaskNum = visitTaskInfo.VisitTaskNum;
|
||||
|
||||
return (result, new
|
||||
{
|
||||
readingTaskState = visitTaskInfo.ReadingTaskState,
|
||||
FormType = formType,
|
||||
TaskNum = visitTaskInfo.VisitTaskNum,
|
||||
|
||||
}); ;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -641,8 +654,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 访视任务 - Dicom 阅片 表格问题 病灶的拆分与合并
|
||||
|
||||
|
|
Loading…
Reference in New Issue