脾脏验证
This commit is contained in:
@@ -12,6 +12,7 @@ using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Linq;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
@@ -1769,36 +1770,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region 最低
|
||||
var visitTaskIds = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == taskinfo.ArmEnum
|
||||
&& x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect
|
||||
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).ToListAsync();
|
||||
|
||||
var questionId = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.QuestionType == QuestionType.SpleenLength).Select(x => x.Id).FirstNotNullAsync();
|
||||
var answerList = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)
|
||||
&& x.ReadingQuestionTrialId == questionId )
|
||||
.Select(x => new
|
||||
{
|
||||
x.Answer,
|
||||
x.VisitTaskId,
|
||||
}).ToListAsync();
|
||||
|
||||
var lowSpleenLength = answerList.Select(x => new
|
||||
{
|
||||
Answer = x.Answer.IsNullOrEmptyReturn0(),
|
||||
x.VisitTaskId
|
||||
}).OrderBy(x => x.Answer).Select(x=>x.Answer).FirstOrDefault();
|
||||
#endregion
|
||||
|
||||
|
||||
var result = SpleenAssessment.Stabilization;
|
||||
var lowSpleenLength = await this.GetLowSpleenLength(taskinfo);
|
||||
|
||||
|
||||
var result = SpleenAssessment.Stabilization;
|
||||
|
||||
|
||||
var presentSpd = spleenLength;
|
||||
@@ -1857,15 +1834,97 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
return result.GetEnumInt();
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 获取最低垂直径
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task<decimal> GetLowSpleenLength(VisitTask taskinfo)
|
||||
{
|
||||
var visitTaskIds = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == taskinfo.ArmEnum
|
||||
&& x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect
|
||||
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).ToListAsync();
|
||||
|
||||
#region 获取脾脏评估
|
||||
var questionId = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.QuestionType == QuestionType.SpleenLength).Select(x => x.Id).FirstNotNullAsync();
|
||||
var answerList = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)
|
||||
&& x.ReadingQuestionTrialId == questionId)
|
||||
.Select(x => new
|
||||
{
|
||||
x.Answer,
|
||||
x.VisitTaskId,
|
||||
}).ToListAsync();
|
||||
|
||||
var lowSpleenLength = answerList.Select(x => new
|
||||
{
|
||||
Answer = x.Answer.IsNullOrEmptyReturn0(),
|
||||
x.VisitTaskId
|
||||
}).OrderBy(x => x.Answer).Select(x => x.Answer).FirstOrDefault();
|
||||
|
||||
return lowSpleenLength;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取脾脏评估
|
||||
/// 获取脾脏验证
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <param name="visitTaskId"></param>
|
||||
/// <param name="spleenLength"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetSplenicEvaluation(ReadingCalculateDto inDto)
|
||||
[HttpPost]
|
||||
public async Task<object> GetSplenicVerify(Guid visitTaskId, decimal spleenLength)
|
||||
{
|
||||
var presentSpd = spleenLength;
|
||||
ReadingCalculateDto inDto = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
|
||||
|
||||
// 基线垂直径
|
||||
var baseLineSpleenLength = await GetBaseLineSpleenLength(inDto);
|
||||
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||
|
||||
var differenceValue = presentSpd - baseLineSpleenLength;
|
||||
|
||||
//与基线相比脾肿大增加的百分比
|
||||
decimal percentage = 0;
|
||||
if (baseLineSpleenLength != 0)
|
||||
{
|
||||
percentage = differenceValue * 100 / (baseLineSpleenLength - 130);
|
||||
}
|
||||
var baseLineTaskId = await GetBaseLineTaskId(inDto);
|
||||
|
||||
// 最低垂直经
|
||||
var lowSpleenLength= await this.GetLowSpleenLength(taskinfo);
|
||||
|
||||
// 基线状态
|
||||
var baseLineState = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == baseLineTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SplenicStatus).Select(x => x.Answer).FirstOrDefaultAsync();
|
||||
|
||||
return new
|
||||
{
|
||||
|
||||
//基线垂直径
|
||||
BaseLineSpleenLength = baseLineSpleenLength,
|
||||
//与基线相比脾肿大增加的百分比
|
||||
PercentageIncreaseFromBaseline = percentage,
|
||||
// 最低垂直经
|
||||
LowSpleenLength = lowSpleenLength,
|
||||
// 基线状态
|
||||
BaseLineState = baseLineState,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region 获取脾脏评估
|
||||
|
||||
/// <summary>
|
||||
/// 获取脾脏评估
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetSplenicEvaluation(ReadingCalculateDto inDto)
|
||||
{
|
||||
|
||||
return inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SplenicStatus).Select(x => x.Answer).FirstIsNullReturnEmpty();
|
||||
|
||||
Reference in New Issue
Block a user