Merge branch 'Test.IRC' of http://192.168.3.69:2000/XCKJ/irc-netcore-api into Test.IRC

IRC_NewDev
hang 2023-10-30 17:53:56 +08:00
commit 3d3ac28848
2 changed files with 32 additions and 21 deletions

View File

@ -450,6 +450,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
} }
/// <summary> /// <summary>
/// 自动计算 /// 自动计算
/// </summary> /// </summary>
@ -470,16 +471,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
new ReadingCalculateData (){QuestionType=QuestionType.SPD,GetDecimalFun=GetSPD}, new ReadingCalculateData (){QuestionType=QuestionType.SPD,GetDecimalFun=GetSPD},
// 与基线相比SPD变化的百分比 // 与基线相比SPD变化的百分比
new ReadingCalculateData (){QuestionType=QuestionType.SPDChange,GetDecimalFun=CompareBaselineSPD}, new ReadingCalculateData (){QuestionType=QuestionType.SPDChange,GetStringFun=CompareBaselineSPD},
// 与基线相比脾肿大增加的百分比 // 与基线相比脾肿大增加的百分比
new ReadingCalculateData (){QuestionType=QuestionType.SplenoncusChange,GetDecimalFun=GetSplenoncusChange}, new ReadingCalculateData (){QuestionType=QuestionType.SplenoncusChange,GetStringFun=GetSplenoncusChange},
// 与最低点相比脾脏垂直径长度的增加值 // 与最低点相比脾脏垂直径长度的增加值
new ReadingCalculateData (){QuestionType=QuestionType.SplenoncusAdd,GetDecimalFun=GetSplenoncusAdd}, new ReadingCalculateData (){QuestionType=QuestionType.SplenoncusAdd,GetStringFun=GetSplenoncusAdd},
// 与基线相比脾垂直径变化值 // 与基线相比脾垂直径变化值
new ReadingCalculateData (){QuestionType=QuestionType.SplenoncusDiameterChange,GetDecimalFun=GetSplenoncusDiameterChange}, new ReadingCalculateData (){QuestionType=QuestionType.SplenoncusDiameterChange,GetStringFun=GetSplenoncusDiameterChange},
// 脾肿垂直径最低点访视 // 脾肿垂直径最低点访视
new ReadingCalculateData (){QuestionType=QuestionType.LowestSplenoncusVisit,GetStringFun=GetLowestSplenoncusVisit}, new ReadingCalculateData (){QuestionType=QuestionType.LowestSplenoncusVisit,GetStringFun=GetLowestSplenoncusVisit},
@ -1622,11 +1623,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// </summary> /// </summary>
/// <param name="inDto"></param> /// <param name="inDto"></param>
/// <returns></returns> /// <returns></returns>
public async Task<decimal> CompareBaselineSPD(ReadingCalculateDto inDto) public async Task<string> CompareBaselineSPD(ReadingCalculateDto inDto)
{ {
if (inDto.IsBaseLine) if (inDto.IsBaseLine)
{ {
return 0; return "NA";
} }
var baseLineTaskId = await GetBaseLineTaskId(inDto); var baseLineTaskId = await GetBaseLineTaskId(inDto);
@ -1635,11 +1636,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var presentSpd = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SPD).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); var presentSpd = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SPD).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
if (baseLineSpd != 0) if (baseLineSpd != 0)
{ {
return (presentSpd - baseLineSpd)*100 / baseLineSpd; return ReserveDecimal((presentSpd - baseLineSpd)*100 / baseLineSpd,inDto.DigitPlaces);
} }
else else
{ {
return 0; return "NA";
} }
} }
#endregion #endregion
@ -1651,24 +1652,24 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// </summary> /// </summary>
/// <param name="inDto"></param> /// <param name="inDto"></param>
/// <returns></returns> /// <returns></returns>
public async Task<decimal> GetSplenoncusChange(ReadingCalculateDto inDto) public async Task<string> GetSplenoncusChange(ReadingCalculateDto inDto)
{ {
if (inDto.IsBaseLine) if (inDto.IsBaseLine)
{ {
return 0; return "NA";
} }
var baseLineSpleenLength = await GetBaseLineSpleenLength(inDto); var baseLineSpleenLength = await GetBaseLineSpleenLength(inDto);
var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
if (baseLineSpleenLength - 130 != 0) if (baseLineSpleenLength - 130 > 0&& presentSpleenLength>130)
{ {
return (presentSpleenLength - 130 - (baseLineSpleenLength - 130))*100 / (baseLineSpleenLength - 130); return ReserveDecimal((presentSpleenLength - 130 - (baseLineSpleenLength - 130))*100 / (baseLineSpleenLength - 130), inDto.DigitPlaces);
} }
else else
{ {
return 0; return "NA";
} }
} }
#endregion #endregion
@ -1680,17 +1681,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// </summary> /// </summary>
/// <param name="inDto"></param> /// <param name="inDto"></param>
/// <returns></returns> /// <returns></returns>
public async Task<decimal> GetSplenoncusAdd(ReadingCalculateDto inDto) public async Task<string> GetSplenoncusAdd(ReadingCalculateDto inDto)
{ {
var TaskAnswer = await GetVisitTaskAnswerList(inDto); var TaskAnswer = await GetVisitTaskAnswerList(inDto);
if (inDto.IsBaseLine) if (inDto.IsBaseLine)
{ {
return 0; return "NA";
} }
var presentSpd = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); var presentSpd = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
var lowSplenoncus = TaskAnswer.OrderBy(x => x.SpleenLength).Select(x => x.SpleenLength).FirstOrDefault(); var lowSplenoncus = TaskAnswer.OrderBy(x => x.SpleenLength).Select(x => x.SpleenLength).FirstOrDefault();
return presentSpd - lowSplenoncus; return (presentSpd - lowSplenoncus).ToString();
} }
@ -1996,7 +1997,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{ {
if (inDto.IsBaseLine) if (inDto.IsBaseLine)
{ {
return SUVChangeVSBaseline.NotEvaluable.GetEnumInt(); return SUVChangeVSBaseline.NA.GetEnumInt();
} }
if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.ExistPET && x.Answer == ReadingYesOrNo.No.GetEnumInt())) if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.ExistPET && x.Answer == ReadingYesOrNo.No.GetEnumInt()))
@ -2427,19 +2428,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// </summary> /// </summary>
/// <param name="inDto"></param> /// <param name="inDto"></param>
/// <returns></returns> /// <returns></returns>
public async Task<decimal> GetSplenoncusDiameterChange(ReadingCalculateDto inDto) public async Task<string> GetSplenoncusDiameterChange(ReadingCalculateDto inDto)
{ {
if (inDto.IsBaseLine) if (inDto.IsBaseLine)
{ {
return 0; return "NA";
} }
var baseLineTaskId = await GetBaseLineTaskId(inDto); var baseLineTaskId = await GetBaseLineTaskId(inDto);
var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
var baseLineSpleenLength = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == baseLineTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0(); var baseLineSpleenLength = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == baseLineTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
return presentSpleenLength - baseLineSpleenLength; return (presentSpleenLength - baseLineSpleenLength).ToString();
} }
@ -2879,7 +2880,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
#endregion #endregion
/// <summary>
/// 保留小数
/// </summary>
/// <param name="answer"></param>
/// <param name="digitPlaces"></param>
/// <returns></returns>
public string ReserveDecimal (decimal answer, int digitPlaces)
{
return decimal.Round(answer, digitPlaces).ToString();
}
#region 脾脏评估 #region 脾脏评估

View File

@ -1076,6 +1076,7 @@ public enum SUVChangeVSBaseline
/// </summary> /// </summary>
NotEvaluable = 4, NotEvaluable = 4,
NA=5,
} }
/// <summary> /// <summary>