修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
8ac2de3434
commit
e5f8b3dc71
|
@ -441,6 +441,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自动计算
|
/// 自动计算
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -456,56 +457,30 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
|
|
||||||
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
||||||
{
|
{
|
||||||
////靶病灶径线之和(SOD)
|
// 匹配动脉段最小FCT
|
||||||
//new ReadingCalculateData (){QuestionType=QuestionType.SOD,GetDecimalNullFun=GetSODData},
|
new ReadingCalculateData (){QuestionType=QuestionType.MinFCT,GetDecimalNullFun=GetAllMinFCT},
|
||||||
|
|
||||||
|
// 平均最小FCT
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.AverageMinFCT,GetDecimalNullFun=GetAvgMinFCT},
|
||||||
|
|
||||||
|
// 脂质角度平均值
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.AvgLipidAngle,GetDecimalNullFun=GetAvgMinLipidAngle},
|
||||||
|
|
||||||
|
// 脂质角度最大值
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.MaxLipidAngle,GetDecimalNullFun=GetAllMaxLipidAngle},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 没有靶病灶只计算最后几个
|
|
||||||
if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).Sum(x => x.TableRowInfoList.Count()) == 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
List<QuestionType> questionTypes = new List<QuestionType>()
|
|
||||||
{
|
|
||||||
QuestionType.TargetLesion,
|
|
||||||
QuestionType.NoTargetLesion,
|
|
||||||
QuestionType.NewLesions,
|
|
||||||
QuestionType.Tumor,
|
|
||||||
QuestionType.ExistDisease,
|
|
||||||
};
|
|
||||||
|
|
||||||
// 没有靶病灶就删除其他几个答案的值
|
|
||||||
var isNeedDeleteTypes = calculateList.Where(x => !questionTypes.Contains(x.QuestionType)).Select(x => x.QuestionType).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
var isNeedDeleteIds = inDto.QuestionInfo.Where(x => x.QuestionType != null && isNeedDeleteTypes.Contains(x.QuestionType.Value)).Select(x => x.QuestionId).ToList();
|
|
||||||
|
|
||||||
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && isNeedDeleteIds.Contains(x.ReadingQuestionTrialId), x => new ReadingTaskQuestionAnswer
|
|
||||||
{
|
|
||||||
Answer = string.Empty
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
calculateList = calculateList.Where(x => questionTypes.Contains(x.QuestionType)).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (calculateType != null)
|
if (calculateType != null)
|
||||||
{
|
{
|
||||||
calculateList = calculateList.Where(x => calculateType.Contains(x.QuestionType)).ToList();
|
calculateList = calculateList.Where(x => calculateType.Contains(x.QuestionType)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
var typeNAList = new List<QuestionType>
|
|
||||||
{
|
|
||||||
QuestionType.SODChange,
|
|
||||||
QuestionType.SODPercent,
|
|
||||||
QuestionType.LowestIncrease,
|
|
||||||
QuestionType.LowPercent,
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var calculate in calculateList)
|
foreach (var calculate in calculateList)
|
||||||
{
|
{
|
||||||
|
@ -514,87 +489,56 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
//计算答案
|
//计算答案
|
||||||
if (inDto.IsOnlyChangeAllTask == false)
|
|
||||||
|
|
||||||
|
#region 计算答案
|
||||||
|
if (calculate.GetDecimalFun != null)
|
||||||
{
|
{
|
||||||
|
item.Answer = (await calculate.GetDecimalFun(inDto)).ToString();
|
||||||
|
|
||||||
#region 计算答案
|
}
|
||||||
if (calculate.GetDecimalFun != null)
|
else if (calculate.GetDecimalNullFun != null)
|
||||||
{
|
{
|
||||||
item.Answer = (await calculate.GetDecimalFun(inDto)).ToString();
|
var value = await calculate.GetDecimalNullFun(inDto);
|
||||||
|
item.Answer = value == null ? string.Empty : value.Value.ToString();
|
||||||
|
}
|
||||||
|
else if (calculate.GetStringFun != null)
|
||||||
|
{
|
||||||
|
item.Answer = await calculate.GetStringFun(inDto);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
// 修改修约小数位数
|
||||||
|
|
||||||
}
|
List<ValueOfType?> valueOfTypes = new List<ValueOfType?>() {
|
||||||
else if (calculate.GetDecimalNullFun != null)
|
|
||||||
{
|
|
||||||
var value = await calculate.GetDecimalNullFun(inDto);
|
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
if (typeNAList.Contains(item.QuestionType ?? QuestionType.SOD))
|
|
||||||
{
|
|
||||||
item.Answer = nameof(YesOrNoOrNa.NA);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
item.Answer = this.nAString;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
|
|
||||||
{
|
|
||||||
item.Answer = value == null ? string.Empty : value.Value.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (calculate.GetStringFun != null)
|
|
||||||
{
|
|
||||||
item.Answer = await calculate.GetStringFun(inDto);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
// 修改修约小数位数
|
|
||||||
|
|
||||||
List<ValueOfType?> valueOfTypes = new List<ValueOfType?>() {
|
|
||||||
|
|
||||||
ValueOfType.Decimals,
|
ValueOfType.Decimals,
|
||||||
ValueOfType.Percentage
|
ValueOfType.Percentage
|
||||||
};
|
};
|
||||||
|
|
||||||
if (inDto.DigitPlaces != -1)
|
if (inDto.DigitPlaces != -1)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try
|
|
||||||
|
if (valueOfTypes.Contains(item.ValueType))
|
||||||
{
|
{
|
||||||
|
item.Answer = decimal.Round(decimal.Parse(item.Answer ?? "0"), inDto.DigitPlaces).ToString("F" + inDto.DigitPlaces.ToString());
|
||||||
if (valueOfTypes.Contains(item.ValueType))
|
|
||||||
{
|
|
||||||
item.Answer = decimal.Round(decimal.Parse(item.Answer ?? "0"), inDto.DigitPlaces).ToString("F" + inDto.DigitPlaces.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
|
||||||
|
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
|
||||||
{
|
{
|
||||||
Answer = item.Answer,
|
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改全局
|
|
||||||
if (inDto.IsChangeOtherTask && calculate.ChangeAllTaskFun != null)
|
|
||||||
|
needAddList.Add(new ReadingTaskQuestionAnswer()
|
||||||
{
|
{
|
||||||
await calculate.ChangeAllTaskFun(new ChangeAllTaskDto()
|
Answer = item.Answer,
|
||||||
{
|
ReadingQuestionTrialId = item.QuestionId,
|
||||||
calculateDto = inDto,
|
});
|
||||||
QuestionId = item.QuestionId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,6 +612,39 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 脂质角度最大值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<decimal?> GetAllMaxLipidAngle(ReadingCalculateDto inDto)
|
||||||
|
{
|
||||||
|
|
||||||
|
var maxLipidAngle = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.LipidAngle).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||||
|
.Where(x => x.QuestionMark == QuestionMark.LipidAngle).Select(x => x.Answer.IsNullOrEmptyReturn0()).Max();
|
||||||
|
if (maxLipidAngle == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return maxLipidAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 脂质角度平均值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<decimal?> GetAvgMinLipidAngle(ReadingCalculateDto inDto)
|
||||||
|
{
|
||||||
|
var avgMinLipidAngle = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.LipidAngle).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||||
|
.Where(x => x.QuestionMark == QuestionMark.LipidAngle).Select(x => x.Answer.IsNullOrEmptyReturn0()).Average();
|
||||||
|
if (avgMinLipidAngle == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return avgMinLipidAngle;
|
||||||
|
}
|
||||||
|
|
||||||
#region 将上一次的访视病灶添加到这一次
|
#region 将上一次的访视病灶添加到这一次
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1784,6 +1784,11 @@ public enum SUVChangeVSBaseline
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MatchValues = 102,
|
MatchValues = 102,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 脂质角度
|
||||||
|
/// </summary>
|
||||||
|
LipidAngle = 103,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2084,6 +2089,11 @@ public enum SUVChangeVSBaseline
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AvgMin=1015,
|
AvgMin=1015,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 脂质角度
|
||||||
|
/// </summary>
|
||||||
|
LipidAngle = 1016,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2489,6 +2499,22 @@ public enum SUVChangeVSBaseline
|
||||||
/// 平均最小FCT
|
/// 平均最小FCT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AverageMinFCT = 1011,
|
AverageMinFCT = 1011,
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 脂质角度
|
||||||
|
/// </summary>
|
||||||
|
LipidAngle = 1012,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 脂质角度平均值
|
||||||
|
/// </summary>
|
||||||
|
AvgLipidAngle = 1013,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 脂质角度最大值
|
||||||
|
/// </summary>
|
||||||
|
MaxLipidAngle = 1014,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue