|
|
|
@@ -398,13 +398,39 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 测试计算
|
|
|
|
|
/// 获取是否是最大suvmax 病灶
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="visitTaskId"></param>
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<GetIsSuvMaxLesionOutDto> GetIsSuvMaxLesion(GetIsSuvMaxLesionInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
|
|
|
|
|
|
|
|
|
var maxSuv = await GetSuvMax(readingData);
|
|
|
|
|
|
|
|
|
|
var rowInfo = readingData.QuestionInfo.SelectMany(x => x.TableRowInfoList).ToList();
|
|
|
|
|
var tableQuestions = rowInfo.SelectMany(x => x.TableQuestionList).Where(x=>x.RowId==inDto.RowId).ToList();
|
|
|
|
|
|
|
|
|
|
var lesionMaxSuv = tableQuestions.Where(x => x.QuestionMark == QuestionMark.SUVmax).Select(x => x.Answer.IsNullOrEmptyReturn0()).MaxOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new GetIsSuvMaxLesionOutDto()
|
|
|
|
|
{
|
|
|
|
|
IsSuvMaxLesion = maxSuv == lesionMaxSuv
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 测试计算
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="visitTaskId"></param>
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task TestCalculate(Guid visitTaskId, QuestionType type)
|
|
|
|
|
{
|
|
|
|
|
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
|
|
|
|
@@ -2178,87 +2204,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存脾尖或者脾底进行计算
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="visitTaskId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task SaveSplenicCalculate(Guid visitTaskId)
|
|
|
|
|
{
|
|
|
|
|
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
List<QuestionType?> questionTypes = new List<QuestionType?>
|
|
|
|
|
{
|
|
|
|
|
QuestionType.SplenicTopPosition,
|
|
|
|
|
QuestionType.SplenicBottomPosition,
|
|
|
|
|
QuestionType.SpleenLength,
|
|
|
|
|
QuestionType.SplenicStatus,
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
var questionlist = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId &&
|
|
|
|
|
questionTypes.Contains(x.QuestionType)).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var splenicTopQuestionId = questionlist.Where(x => x.QuestionType == QuestionType.SplenicTopPosition).Select(x => x.Id).FirstOrDefault();
|
|
|
|
|
var splenicBottomQuestionId = questionlist.Where(x => x.QuestionType == QuestionType.SplenicBottomPosition).Select(x => x.Id).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
decimal? spleenLength = null;
|
|
|
|
|
string? splenicState = null;
|
|
|
|
|
|
|
|
|
|
// 脾尖答案
|
|
|
|
|
var splenicTopAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId && x.ReadingQuestionTrialId == splenicTopQuestionId).FirstOrDefaultAsync();
|
|
|
|
|
// 脾底答案
|
|
|
|
|
var splenicBottomAnswer= await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId && x.ReadingQuestionTrialId == splenicBottomQuestionId).FirstOrDefaultAsync();
|
|
|
|
|
|
|
|
|
|
if (splenicTopAnswer != null && splenicBottomAnswer != null)
|
|
|
|
|
{
|
|
|
|
|
spleenLength = splenicTopAnswer.Answer.IsNullOrEmptyReturn0() - splenicBottomAnswer.Answer.IsNullOrEmptyReturn0();
|
|
|
|
|
if(spleenLength<0)
|
|
|
|
|
{
|
|
|
|
|
spleenLength = 0 - spleenLength;
|
|
|
|
|
}
|
|
|
|
|
splenicState =await GetSplenicState(visitTaskId, spleenLength.Value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//脾脏垂直径Id
|
|
|
|
|
var spleenVerticalDiameterQuestionId = questionlist.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Id).FirstOrDefault();
|
|
|
|
|
// 脾脏状态Id
|
|
|
|
|
var splenicStatusQuestionId = questionlist.Where(x => x.QuestionType == QuestionType.SplenicStatus).Select(x => x.Id).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
List<ReadingTaskQuestionAnswer> readingTaskQuestionAnswers = new List<ReadingTaskQuestionAnswer>();
|
|
|
|
|
if (spleenLength != null)
|
|
|
|
|
{
|
|
|
|
|
readingTaskQuestionAnswers.Add(new ReadingTaskQuestionAnswer()
|
|
|
|
|
{
|
|
|
|
|
Answer = spleenLength.Value.ToString(),
|
|
|
|
|
ReadingQuestionTrialId = spleenVerticalDiameterQuestionId,
|
|
|
|
|
VisitTaskId = visitTaskId,
|
|
|
|
|
SubjectId = taskinfo.SubjectId,
|
|
|
|
|
TrialId = taskinfo.TrialId,
|
|
|
|
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (splenicState != null)
|
|
|
|
|
{
|
|
|
|
|
readingTaskQuestionAnswers.Add(new ReadingTaskQuestionAnswer()
|
|
|
|
|
{
|
|
|
|
|
Answer = splenicState.ToString(),
|
|
|
|
|
ReadingQuestionTrialId = splenicStatusQuestionId,
|
|
|
|
|
VisitTaskId = visitTaskId,
|
|
|
|
|
SubjectId = taskinfo.SubjectId,
|
|
|
|
|
TrialId = taskinfo.TrialId,
|
|
|
|
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await _readingTaskQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == visitTaskId && (x.ReadingQuestionTrialId == spleenVerticalDiameterQuestionId || x.ReadingQuestionTrialId == splenicStatusQuestionId));
|
|
|
|
|
await _readingTaskQuestionAnswerRepository.AddRangeAsync(readingTaskQuestionAnswers);
|
|
|
|
|
await _readingTaskQuestionAnswerRepository.SaveChangesAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取脾脏状态
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|