Uat_Study
parent
3cba1e5b78
commit
ccd6935dcb
|
@ -14,7 +14,15 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
{
|
||||
public List<VisitTaskInfo> VisitTaskList { get; set; }
|
||||
|
||||
public List<VisitTaskGroupAnswerDto> TaskQuestions { get; set; }
|
||||
}
|
||||
|
||||
public class VisitTaskGroupAnswerDto
|
||||
{
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public List<VisitTaskGroupInfo> Questions { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class VisitTaskGroupInfo
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
CriterionId= criterionId,
|
||||
TrialId=visitTask.TrialId,
|
||||
};
|
||||
//await ReadingCalculate(readingData);
|
||||
await ReadingCalculate(readingData);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -108,77 +108,133 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
#region 表格问题相关
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片报告
|
||||
/// </summary>
|
||||
/// <param name="indto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto)
|
||||
{
|
||||
GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto();
|
||||
|
||||
//public async Task<> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto)
|
||||
//{
|
||||
// GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto();
|
||||
var taskInfoList = await _visitTaskRepository.Where(x => x.SubjectId == indto.SubjectId && x.TaskState == TaskState.Effect
|
||||
&& x.ReadingCategory == ReadingCategory.Visit && !x.IsAnalysisCreate && x.ReadingTaskState == ReadingTaskState.HaveSigned
|
||||
).OrderBy(x => x.VisitTaskNum).Select(x => new VisitTaskInfo()
|
||||
{
|
||||
VisitTaskId = x.Id,
|
||||
TaskName = x.TaskName,
|
||||
VisitTaskNum = x.VisitTaskNum,
|
||||
}).ToListAsync();
|
||||
|
||||
// var taskInfoList = await _visitTaskRepository.Where(x => x.SubjectId == indto.SubjectId && x.TaskState == TaskState.Effect
|
||||
// && x.ReadingCategory == ReadingCategory.Visit && !x.IsAnalysisCreate && x.ReadingTaskState == ReadingTaskState.HaveSigned
|
||||
// ).OrderBy(x => x.VisitTaskNum).Select(x => new VisitTaskInfo()
|
||||
// {
|
||||
// VisitTaskId = x.Id,
|
||||
// TaskName = x.TaskName,
|
||||
// VisitTaskNum = x.VisitTaskNum,
|
||||
// }).ToListAsync();
|
||||
result.VisitTaskList = taskInfoList;
|
||||
|
||||
var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList();
|
||||
|
||||
var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == indto.TrialId && x.IsConfirm).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).ToListAsync();
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).ToListAsync();
|
||||
|
||||
|
||||
// var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList();
|
||||
|
||||
// var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == indto.TrialId && x.IsConfirm).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
// var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).ToListAsync();
|
||||
// var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).ToListAsync();
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
|
||||
|
||||
// var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
// var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<VisitTaskGroupInfo> questions = questionList.Where(x => x.Type == "group").OrderBy(x => x.ShowOrder).Select(x => new VisitTaskGroupInfo()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
QuestionName = x.QuestionName,
|
||||
ShowOrder = x.ShowOrder,
|
||||
}).ToList();
|
||||
|
||||
// // 第一级
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.QuestionList = questionList.Where(x => x.GroupName == item.GroupName).OrderBy(x => x.ShowOrder).Select(x => new VisitTaskQuestionInfo()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
QuestionName = x.QuestionName,
|
||||
ShowOrder = x.ShowOrder,
|
||||
|
||||
// List<VisitTaskGroupInfo> questions = questionList.Where(x => x.Type == "group").OrderBy(x => x.ShowOrder).Select(x => new VisitTaskGroupInfo()
|
||||
// {
|
||||
// QuestionId = x.Id,
|
||||
// GroupName=x.GroupName,
|
||||
// QuestionName = x.QuestionName,
|
||||
// ShowOrder = x.ShowOrder,
|
||||
// }).ToList();
|
||||
}).ToList();
|
||||
|
||||
// foreach (var item in questions)
|
||||
// {
|
||||
// item.QuestionList = questionList.Where(x => x.GroupName == item.GroupName).OrderBy(x => x.ShowOrder).Select(x => new VisitTaskQuestionInfo()
|
||||
// {
|
||||
// GroupName = x.GroupName,
|
||||
// QuestionId = x.Id,
|
||||
// QuestionName = x.QuestionName,
|
||||
// ShowOrder = x.ShowOrder,
|
||||
foreach (var question in item.QuestionList)
|
||||
{
|
||||
question.TableRowQuestionList = new List<VistTaskTableQuestionRowInfo>()
|
||||
{
|
||||
};
|
||||
VistTaskTableQuestionRowInfo questionInfo = new VistTaskTableQuestionRowInfo()
|
||||
{
|
||||
|
||||
// }).ToList();
|
||||
RowIndex = 0,
|
||||
OrderMark = String.Empty,
|
||||
TableQuestionList = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new VistTaskTableQuestionInfo()
|
||||
{
|
||||
Answer = String.Empty,
|
||||
QuestionId = question.QuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
ShowOrder = x.ShowOrder,
|
||||
QuestionName = x.QuestionName,
|
||||
|
||||
// foreach (var question in item.QuestionList)
|
||||
// {
|
||||
// question.TableRowQuestionList = new List<VistTaskTableQuestionRowInfo>()
|
||||
// {
|
||||
}).ToList()
|
||||
|
||||
};
|
||||
|
||||
// };
|
||||
// VistTaskTableQuestionRowInfo questionInfo = new VistTaskTableQuestionRowInfo()
|
||||
// {
|
||||
question.TableRowQuestionList.Add(questionInfo);
|
||||
|
||||
// RowIndex = 0,
|
||||
// OrderMark = String.Empty,
|
||||
// TableQuestionList=tableQuestionList.Where(x=>x.ReadingQuestionId== question.QuestionId).Select(x=> new VistTaskTableQuestionInfo() {
|
||||
// Answer=String.Empty,
|
||||
// GroupName=question
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
// })
|
||||
#region 构造答案
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
result.TaskQuestions = new List<VisitTaskGroupAnswerDto>();
|
||||
foreach (var item in taskInfoList)
|
||||
{
|
||||
var itemQuestions = questions.Clone();
|
||||
foreach (var group in itemQuestions)
|
||||
{
|
||||
group.QuestionList.ForEach(x =>
|
||||
{
|
||||
x.Answer = answers.Where(n => n.VisitTaskId == item.VisitTaskId && x.QuestionId == x.QuestionId).Select(x => x.Answer).FirstOrDefault() ?? String.Empty;
|
||||
var tableQuestionAnswers = tableAnswers.Where(n => n.QuestionId == n.QuestionId && n.VisitTaskId == item.VisitTaskId).GroupBy(y => new { y.RowIndex }).Select(y => new
|
||||
{
|
||||
RowIndex = y.Key.RowIndex,
|
||||
Answer = y.ToList(),
|
||||
});
|
||||
List<VistTaskTableQuestionRowInfo> questionRowInfos = new List<VistTaskTableQuestionRowInfo>();
|
||||
var answerModel = x.TableRowQuestionList.FirstOrDefault() ?? new VistTaskTableQuestionRowInfo();
|
||||
tableQuestionAnswers.ForEach(y =>
|
||||
{
|
||||
VistTaskTableQuestionRowInfo rowInfo = answerModel.Clone();
|
||||
rowInfo.RowIndex = y.RowIndex;
|
||||
rowInfo.TableQuestionList.ForEach(z =>
|
||||
{
|
||||
z.Answer = y.Answer.Where(n => n.TableQuestionId == z.TableQuestionId && n.QuestionId == z.QuestionId).Select(n => n.Answer).FirstOrDefault() ?? String.Empty;
|
||||
|
||||
});
|
||||
questionRowInfos.Add(rowInfo);
|
||||
});
|
||||
|
||||
//}
|
||||
x.TableRowQuestionList = questionRowInfos;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
result.TaskQuestions.Add(new VisitTaskGroupAnswerDto() {
|
||||
|
||||
VisitTaskId=item.VisitTaskId,
|
||||
Questions= itemQuestions
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取表格答案行信息
|
||||
|
|
Loading…
Reference in New Issue