Uat_Study
parent
9d314cbff4
commit
4ac06a689f
|
@ -338,181 +338,7 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto)
|
public async Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto)
|
||||||
{
|
{
|
||||||
|
return await _readingCalculateService.GetReadingReportEvaluation(indto);
|
||||||
|
|
||||||
GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto();
|
|
||||||
|
|
||||||
result.CalculateResult = await _readingCalculateService.GetReportVerify(new GetReportVerifyInDto() {
|
|
||||||
VisitTaskId=indto.VisitTaskId
|
|
||||||
});
|
|
||||||
|
|
||||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
|
|
||||||
|
|
||||||
//if (visitTaskInfo.TaskState != TaskState.Effect)
|
|
||||||
//{
|
|
||||||
// throw new BusinessValidationFailedException($"当前任务已失效!");
|
|
||||||
//}
|
|
||||||
result.ReadingTaskState = visitTaskInfo.ReadingTaskState;
|
|
||||||
var taskInfoList = await _visitTaskRepository
|
|
||||||
// 失效的只查看自己
|
|
||||||
.WhereIf(visitTaskInfo.TaskState != TaskState.Effect,x=>x.Id== indto.VisitTaskId)
|
|
||||||
.Where(x => (x.SubjectId == visitTaskInfo.SubjectId && x.TaskState == TaskState.Effect
|
|
||||||
&&x.IsAnalysisCreate==visitTaskInfo.IsAnalysisCreate
|
|
||||||
&&x.IsSelfAnalysis== visitTaskInfo.IsSelfAnalysis
|
|
||||||
&& x.ArmEnum== visitTaskInfo.ArmEnum
|
|
||||||
&&x.TrialReadingCriterionId==visitTaskInfo.TrialReadingCriterionId
|
|
||||||
&& x.ReadingCategory == ReadingCategory.Visit && !x.IsAnalysisCreate && x.ReadingTaskState == ReadingTaskState.HaveSigned) || x.Id == indto.VisitTaskId
|
|
||||||
).OrderBy(x => x.VisitTaskNum).Select(x => new VisitTaskInfo()
|
|
||||||
{
|
|
||||||
BlindName = x.SourceSubjectVisit.BlindName,
|
|
||||||
IsBaseLine=x.SourceSubjectVisit.IsBaseLine,
|
|
||||||
VisitTaskId = x.Id,
|
|
||||||
TaskName = x.TaskName,
|
|
||||||
VisitTaskNum = x.VisitTaskNum,
|
|
||||||
IsCurrentTask = x.Id == indto.VisitTaskId,
|
|
||||||
|
|
||||||
}).ToListAsync();
|
|
||||||
|
|
||||||
result.VisitTaskList = taskInfoList;
|
|
||||||
|
|
||||||
var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList();
|
|
||||||
|
|
||||||
var criterionId = visitTaskInfo.TrialReadingCriterionId;
|
|
||||||
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).ToListAsync();
|
|
||||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync();
|
|
||||||
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).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<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
|
||||||
{
|
|
||||||
QuestionId = x.Id,
|
|
||||||
GroupName = x.GroupName,
|
|
||||||
IsShowInDicom = x.IsShowInDicom,
|
|
||||||
Type = x.Type,
|
|
||||||
QuestionType=x.QuestionType,
|
|
||||||
LesionType=x.LesionType,
|
|
||||||
QuestionGenre =x.QuestionGenre,
|
|
||||||
DictionaryCode =x.DictionaryCode,
|
|
||||||
TypeValue = x.TypeValue,
|
|
||||||
QuestionName = x.QuestionName,
|
|
||||||
ShowOrder = x.ShowOrder,
|
|
||||||
ValueType=x.ValueType,
|
|
||||||
Unit=x.Unit,
|
|
||||||
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
// 分组
|
|
||||||
foreach (var item in questions)
|
|
||||||
{
|
|
||||||
item.Childrens = questionList.Where(x => x.GroupName == item.GroupName && x.Type != ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
|
||||||
{
|
|
||||||
GroupName = x.GroupName,
|
|
||||||
QuestionId = x.Id,
|
|
||||||
IsShowInDicom = x.IsShowInDicom,
|
|
||||||
QuestionName = x.QuestionName,
|
|
||||||
LesionType = x.LesionType,
|
|
||||||
QuestionGenre = x.QuestionGenre,
|
|
||||||
DictionaryCode = x.DictionaryCode,
|
|
||||||
Type = x.Type,
|
|
||||||
QuestionType=x.QuestionType,
|
|
||||||
TypeValue = x.TypeValue,
|
|
||||||
ShowOrder = x.ShowOrder,
|
|
||||||
OrderMark = x.OrderMark,
|
|
||||||
ValueType = x.ValueType,
|
|
||||||
Unit = x.Unit,
|
|
||||||
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
// 问题
|
|
||||||
foreach (var question in item.Childrens)
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (var task in taskInfoList)
|
|
||||||
{
|
|
||||||
|
|
||||||
question.Answer.Add(new TaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
|
||||||
TaskName = task.TaskName,
|
|
||||||
VisitTaskId = task.VisitTaskId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构造表格行数据
|
|
||||||
|
|
||||||
|
|
||||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
|
||||||
{
|
|
||||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
|
||||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
|
||||||
SplitOrMergeType = x.SplitOrMergeType,
|
|
||||||
LesionType = question.LesionType,
|
|
||||||
IsCanEditPosition =x.IsCanEditPosition,
|
|
||||||
RowIndex =x.RowIndex,
|
|
||||||
BlindName=x.BlindName,
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var row in question.Childrens)
|
|
||||||
{
|
|
||||||
// tableQuestion
|
|
||||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
|
||||||
{
|
|
||||||
QuestionName = x.QuestionName,
|
|
||||||
QuestionId = x.ReadingQuestionId,
|
|
||||||
TableQuestionId = x.Id,
|
|
||||||
Type = x.Type,
|
|
||||||
LesionType = question.LesionType,
|
|
||||||
TableQuestionType = x.TableQuestionType,
|
|
||||||
DictionaryCode = x.DictionaryCode,
|
|
||||||
QuestionMark = x.QuestionMark,
|
|
||||||
TypeValue = x.TypeValue,
|
|
||||||
RowIndex = row.RowIndex,
|
|
||||||
ShowOrder = x.ShowOrder,
|
|
||||||
ValueType = x.ValueType,
|
|
||||||
Unit = x.Unit,
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var tableQuestion in row.Childrens)
|
|
||||||
{
|
|
||||||
foreach (var task in taskInfoList)
|
|
||||||
{
|
|
||||||
|
|
||||||
tableQuestion.Answer.Add(new TaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
|
||||||
TaskName = task.TaskName,
|
|
||||||
VisitTaskId = task.VisitTaskId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
result.TaskQuestions = questions;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -133,5 +133,37 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
|
|
||||||
return readingData;
|
return readingData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取阅片报告任务List
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="visitTaskId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<VisitTaskInfo>> GetReadingReportTaskList(Guid visitTaskId)
|
||||||
|
{
|
||||||
|
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||||
|
|
||||||
|
var taskInfoList = await _visitTaskRepository
|
||||||
|
// 失效的只查看自己
|
||||||
|
.WhereIf(visitTaskInfo.TaskState != TaskState.Effect, x => x.Id == visitTaskId)
|
||||||
|
.Where(x => (x.SubjectId == visitTaskInfo.SubjectId && x.TaskState == TaskState.Effect
|
||||||
|
&& x.IsAnalysisCreate == visitTaskInfo.IsAnalysisCreate
|
||||||
|
&& x.IsSelfAnalysis == visitTaskInfo.IsSelfAnalysis
|
||||||
|
&& x.ArmEnum == visitTaskInfo.ArmEnum
|
||||||
|
&& x.TrialReadingCriterionId == visitTaskInfo.TrialReadingCriterionId
|
||||||
|
&& x.ReadingCategory == ReadingCategory.Visit && !x.IsAnalysisCreate && x.ReadingTaskState == ReadingTaskState.HaveSigned) || x.Id == visitTaskId
|
||||||
|
).OrderBy(x => x.VisitTaskNum).Select(x => new VisitTaskInfo()
|
||||||
|
{
|
||||||
|
BlindName = x.SourceSubjectVisit.BlindName,
|
||||||
|
IsBaseLine = x.SourceSubjectVisit.IsBaseLine,
|
||||||
|
VisitTaskId = x.Id,
|
||||||
|
TaskName = x.TaskName,
|
||||||
|
VisitTaskNum = x.VisitTaskNum,
|
||||||
|
IsCurrentTask = x.Id == visitTaskId,
|
||||||
|
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
return taskInfoList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,13 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<object> GetReportVerify(GetReportVerifyInDto inDto);
|
Task<object> GetReportVerify(GetReportVerifyInDto inDto);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取阅片报告
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="indto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,5 +16,12 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// <param name="visitTaskId"></param>
|
/// <param name="visitTaskId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<ReadingCalculateDto> GetReadingCalculateDto(Guid visitTaskId);
|
Task<ReadingCalculateDto> GetReadingCalculateDto(Guid visitTaskId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取阅片报告任务List
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="visitTaskId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<VisitTaskInfo>> GetReadingReportTaskList(Guid visitTaskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,5 +37,12 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<object> GetReportVerify(GetReportVerifyInDto inDto);
|
Task<object> GetReportVerify(GetReportVerifyInDto inDto);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取阅片报告
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="indto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,205 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
|
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region 获取阅片报告
|
||||||
|
/// <summary>
|
||||||
|
/// 获取阅片报告
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="indto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto)
|
||||||
|
{
|
||||||
|
GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto();
|
||||||
|
|
||||||
|
result.CalculateResult = await this.GetReportVerify(new GetReportVerifyInDto()
|
||||||
|
{
|
||||||
|
VisitTaskId = indto.VisitTaskId
|
||||||
|
});
|
||||||
|
|
||||||
|
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
|
||||||
|
|
||||||
|
|
||||||
|
result.ReadingTaskState = visitTaskInfo.ReadingTaskState;
|
||||||
|
var taskInfoList = await _generalCalculateService.GetReadingReportTaskList(indto.VisitTaskId);
|
||||||
|
|
||||||
|
result.VisitTaskList = taskInfoList;
|
||||||
|
|
||||||
|
var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList();
|
||||||
|
|
||||||
|
var criterionId = visitTaskInfo.TrialReadingCriterionId;
|
||||||
|
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId)
|
||||||
|
.Where(x=>x.LesionType!=LesionType.AlwaysNewLesions&&x.LesionType!=LesionType.AlwaysNewLesions)
|
||||||
|
.ToListAsync();
|
||||||
|
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||||
|
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||||
|
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
// 新病灶
|
||||||
|
var questionNewLesions = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == visitTaskInfo.TrialReadingCriterionId && x.LesionType == LesionType.NewLesions).FirstNotNullAsync();
|
||||||
|
|
||||||
|
// 既往新病灶
|
||||||
|
var questionAlwaysLesions = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == visitTaskInfo.TrialReadingCriterionId && x.LesionType == LesionType.AlwaysNewLesions).FirstNotNullAsync();
|
||||||
|
|
||||||
|
foreach (var item in tableAnsweRowInfos)
|
||||||
|
{
|
||||||
|
if (item.QuestionId == questionAlwaysLesions.Id)
|
||||||
|
{
|
||||||
|
item.QuestionId = questionNewLesions.Id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in answers)
|
||||||
|
{
|
||||||
|
if (item.ReadingQuestionTrialId == questionAlwaysLesions.Id)
|
||||||
|
{
|
||||||
|
item.ReadingQuestionTrialId = questionNewLesions.Id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in tableAnswers)
|
||||||
|
{
|
||||||
|
if (item.QuestionId == questionAlwaysLesions.Id)
|
||||||
|
{
|
||||||
|
item.QuestionId = questionNewLesions.Id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 第一级 分组
|
||||||
|
|
||||||
|
#region 构造问题
|
||||||
|
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||||
|
{
|
||||||
|
QuestionId = x.Id,
|
||||||
|
GroupName = x.GroupName,
|
||||||
|
IsShowInDicom = x.IsShowInDicom,
|
||||||
|
Type = x.Type,
|
||||||
|
QuestionType = x.QuestionType,
|
||||||
|
LesionType = x.LesionType,
|
||||||
|
QuestionGenre = x.QuestionGenre,
|
||||||
|
DictionaryCode = x.DictionaryCode,
|
||||||
|
TypeValue = x.TypeValue,
|
||||||
|
QuestionName = x.QuestionName,
|
||||||
|
ShowOrder = x.ShowOrder,
|
||||||
|
ValueType = x.ValueType,
|
||||||
|
Unit = x.Unit,
|
||||||
|
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
// 分组
|
||||||
|
foreach (var item in questions)
|
||||||
|
{
|
||||||
|
// 问题
|
||||||
|
item.Childrens = questionList.Where(x => x.GroupName == item.GroupName && x.Type != ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||||
|
{
|
||||||
|
GroupName = x.GroupName,
|
||||||
|
QuestionId = x.Id,
|
||||||
|
IsShowInDicom = x.IsShowInDicom,
|
||||||
|
QuestionName = x.QuestionName,
|
||||||
|
LesionType = x.LesionType,
|
||||||
|
QuestionGenre = x.QuestionGenre,
|
||||||
|
DictionaryCode = x.DictionaryCode,
|
||||||
|
Type = x.Type,
|
||||||
|
QuestionType = x.QuestionType,
|
||||||
|
TypeValue = x.TypeValue,
|
||||||
|
ShowOrder = x.ShowOrder,
|
||||||
|
OrderMark = x.OrderMark,
|
||||||
|
ValueType = x.ValueType,
|
||||||
|
Unit = x.Unit,
|
||||||
|
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
// 问题
|
||||||
|
foreach (var question in item.Childrens)
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach (var task in taskInfoList)
|
||||||
|
{
|
||||||
|
|
||||||
|
question.Answer.Add(new TaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||||
|
TaskName = task.TaskName,
|
||||||
|
VisitTaskId = task.VisitTaskId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造表格行数据
|
||||||
|
|
||||||
|
|
||||||
|
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||||
|
{
|
||||||
|
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||||
|
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||||
|
SplitOrMergeType = x.SplitOrMergeType,
|
||||||
|
LesionType = question.LesionType,
|
||||||
|
IsCanEditPosition = x.IsCanEditPosition,
|
||||||
|
RowIndex = x.RowIndex,
|
||||||
|
BlindName = x.BlindName,
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var row in question.Childrens)
|
||||||
|
{
|
||||||
|
// tableQuestion
|
||||||
|
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||||
|
{
|
||||||
|
QuestionName = x.QuestionName,
|
||||||
|
QuestionId = x.ReadingQuestionId,
|
||||||
|
TableQuestionId = x.Id,
|
||||||
|
Type = x.Type,
|
||||||
|
LesionType = question.LesionType,
|
||||||
|
TableQuestionType = x.TableQuestionType,
|
||||||
|
DictionaryCode = x.DictionaryCode,
|
||||||
|
QuestionMark = x.QuestionMark,
|
||||||
|
TypeValue = x.TypeValue,
|
||||||
|
RowIndex = row.RowIndex,
|
||||||
|
ShowOrder = x.ShowOrder,
|
||||||
|
ValueType = x.ValueType,
|
||||||
|
Unit = x.Unit,
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var tableQuestion in row.Childrens)
|
||||||
|
{
|
||||||
|
foreach (var task in taskInfoList)
|
||||||
|
{
|
||||||
|
|
||||||
|
tableQuestion.Answer.Add(new TaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||||
|
TaskName = task.TaskName,
|
||||||
|
VisitTaskId = task.VisitTaskId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
result.TaskQuestions = questions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 将上一次的病灶信息添加到这一次
|
/// 将上一次的病灶信息添加到这一次
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -64,6 +64,172 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
private decimal? sODData;
|
private decimal? sODData;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 获取阅片报告
|
||||||
|
/// <summary>
|
||||||
|
/// 获取阅片报告
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="indto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto)
|
||||||
|
{
|
||||||
|
GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto();
|
||||||
|
|
||||||
|
result.CalculateResult = await this.GetReportVerify(new GetReportVerifyInDto()
|
||||||
|
{
|
||||||
|
VisitTaskId = indto.VisitTaskId
|
||||||
|
});
|
||||||
|
|
||||||
|
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
|
||||||
|
|
||||||
|
|
||||||
|
result.ReadingTaskState = visitTaskInfo.ReadingTaskState;
|
||||||
|
var taskInfoList = await _generalCalculateService.GetReadingReportTaskList(indto.VisitTaskId);
|
||||||
|
|
||||||
|
result.VisitTaskList = taskInfoList;
|
||||||
|
|
||||||
|
var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList();
|
||||||
|
|
||||||
|
var criterionId = visitTaskInfo.TrialReadingCriterionId;
|
||||||
|
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).ToListAsync();
|
||||||
|
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||||
|
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).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<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||||
|
{
|
||||||
|
QuestionId = x.Id,
|
||||||
|
GroupName = x.GroupName,
|
||||||
|
IsShowInDicom = x.IsShowInDicom,
|
||||||
|
Type = x.Type,
|
||||||
|
QuestionType = x.QuestionType,
|
||||||
|
LesionType = x.LesionType,
|
||||||
|
QuestionGenre = x.QuestionGenre,
|
||||||
|
DictionaryCode = x.DictionaryCode,
|
||||||
|
TypeValue = x.TypeValue,
|
||||||
|
QuestionName = x.QuestionName,
|
||||||
|
ShowOrder = x.ShowOrder,
|
||||||
|
ValueType = x.ValueType,
|
||||||
|
Unit = x.Unit,
|
||||||
|
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
// 分组
|
||||||
|
foreach (var item in questions)
|
||||||
|
{
|
||||||
|
item.Childrens = questionList.Where(x => x.GroupName == item.GroupName && x.Type != ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||||
|
{
|
||||||
|
GroupName = x.GroupName,
|
||||||
|
QuestionId = x.Id,
|
||||||
|
IsShowInDicom = x.IsShowInDicom,
|
||||||
|
QuestionName = x.QuestionName,
|
||||||
|
LesionType = x.LesionType,
|
||||||
|
QuestionGenre = x.QuestionGenre,
|
||||||
|
DictionaryCode = x.DictionaryCode,
|
||||||
|
Type = x.Type,
|
||||||
|
QuestionType = x.QuestionType,
|
||||||
|
TypeValue = x.TypeValue,
|
||||||
|
ShowOrder = x.ShowOrder,
|
||||||
|
OrderMark = x.OrderMark,
|
||||||
|
ValueType = x.ValueType,
|
||||||
|
Unit = x.Unit,
|
||||||
|
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
// 问题
|
||||||
|
foreach (var question in item.Childrens)
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach (var task in taskInfoList)
|
||||||
|
{
|
||||||
|
|
||||||
|
question.Answer.Add(new TaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||||
|
TaskName = task.TaskName,
|
||||||
|
VisitTaskId = task.VisitTaskId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造表格行数据
|
||||||
|
|
||||||
|
|
||||||
|
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||||
|
{
|
||||||
|
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||||
|
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||||
|
SplitOrMergeType = x.SplitOrMergeType,
|
||||||
|
LesionType = question.LesionType,
|
||||||
|
IsCanEditPosition = x.IsCanEditPosition,
|
||||||
|
RowIndex = x.RowIndex,
|
||||||
|
BlindName = x.BlindName,
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var row in question.Childrens)
|
||||||
|
{
|
||||||
|
// tableQuestion
|
||||||
|
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||||
|
{
|
||||||
|
QuestionName = x.QuestionName,
|
||||||
|
QuestionId = x.ReadingQuestionId,
|
||||||
|
TableQuestionId = x.Id,
|
||||||
|
Type = x.Type,
|
||||||
|
LesionType = question.LesionType,
|
||||||
|
TableQuestionType = x.TableQuestionType,
|
||||||
|
DictionaryCode = x.DictionaryCode,
|
||||||
|
QuestionMark = x.QuestionMark,
|
||||||
|
TypeValue = x.TypeValue,
|
||||||
|
RowIndex = row.RowIndex,
|
||||||
|
ShowOrder = x.ShowOrder,
|
||||||
|
ValueType = x.ValueType,
|
||||||
|
Unit = x.Unit,
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var tableQuestion in row.Childrens)
|
||||||
|
{
|
||||||
|
foreach (var task in taskInfoList)
|
||||||
|
{
|
||||||
|
|
||||||
|
tableQuestion.Answer.Add(new TaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||||
|
TaskName = task.TaskName,
|
||||||
|
VisitTaskId = task.VisitTaskId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
result.TaskQuestions = questions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 测试计算
|
/// 测试计算
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -78,6 +244,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 计算任务
|
/// 计算任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -152,6 +152,25 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取阅片报告
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="indto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto inDto)
|
||||||
|
{
|
||||||
|
var service = await this.GetService(inDto.VisitTaskId);
|
||||||
|
|
||||||
|
if (service != null)
|
||||||
|
{
|
||||||
|
return await service.GetReadingReportEvaluation(inDto);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new GetReadingReportEvaluationOutDto();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue