From e5f8b3dc71b2e04d0eb92c4705646e631efab208 Mon Sep 17 00:00:00 2001
From: he <109787524@qq.com>
Date: Mon, 9 Sep 2024 13:20:14 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ReadingCalculate/OCTCalculateService.cs | 191 ++++++++----------
IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs | 26 +++
2 files changed, 110 insertions(+), 107 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
index 5d498ca23..be1f463e3 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
@@ -441,6 +441,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
+
///
/// 自动计算
///
@@ -456,56 +457,30 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
List calculateList = new List()
{
- ////靶病灶径线之和(SOD)
- //new ReadingCalculateData (){QuestionType=QuestionType.SOD,GetDecimalNullFun=GetSODData},
+ // 匹配动脉段最小FCT
+ 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 questionTypes = new List()
- {
- 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)
{
calculateList = calculateList.Where(x => calculateType.Contains(x.QuestionType)).ToList();
}
- var typeNAList = new List
- {
- QuestionType.SODChange,
- QuestionType.SODPercent,
- QuestionType.LowestIncrease,
- QuestionType.LowPercent,
- };
+
foreach (var calculate in calculateList)
{
@@ -514,87 +489,56 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
if (item != null)
{
//计算答案
- if (inDto.IsOnlyChangeAllTask == false)
+
+
+ #region 计算答案
+ if (calculate.GetDecimalFun != null)
{
+ item.Answer = (await calculate.GetDecimalFun(inDto)).ToString();
- #region 计算答案
- if (calculate.GetDecimalFun != null)
- {
- item.Answer = (await calculate.GetDecimalFun(inDto)).ToString();
+ }
+ else if (calculate.GetDecimalNullFun != null)
+ {
+ 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
+ // 修改修约小数位数
- }
- 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 valueOfTypes = new List() {
+ List valueOfTypes = new List() {
ValueOfType.Decimals,
ValueOfType.Percentage
};
- if (inDto.DigitPlaces != -1)
+ if (inDto.DigitPlaces != -1)
+ {
+ try
{
- try
+
+ if (valueOfTypes.Contains(item.ValueType))
{
-
- if (valueOfTypes.Contains(item.ValueType))
- {
- item.Answer = decimal.Round(decimal.Parse(item.Answer ?? "0"), inDto.DigitPlaces).ToString("F" + inDto.DigitPlaces.ToString());
- }
- }
- catch (Exception)
- {
-
-
+ item.Answer = decimal.Round(decimal.Parse(item.Answer ?? "0"), inDto.DigitPlaces).ToString("F" + inDto.DigitPlaces.ToString());
}
}
-
-
-
- needAddList.Add(new ReadingTaskQuestionAnswer()
+ catch (Exception)
{
- Answer = item.Answer,
- ReadingQuestionTrialId = item.QuestionId,
- });
+
+
+ }
}
- // 修改全局
- if (inDto.IsChangeOtherTask && calculate.ChangeAllTaskFun != null)
+
+
+ needAddList.Add(new ReadingTaskQuestionAnswer()
{
- await calculate.ChangeAllTaskFun(new ChangeAllTaskDto()
- {
- calculateDto = inDto,
- QuestionId = item.QuestionId,
- });
- }
-
+ Answer = item.Answer,
+ ReadingQuestionTrialId = item.QuestionId,
+ });
}
}
@@ -668,6 +612,39 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
+ ///
+ /// 脂质角度最大值
+ ///
+ ///
+ ///
+ public async Task 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;
+ }
+
+ ///
+ /// 脂质角度平均值
+ ///
+ ///
+ ///
+ public async Task 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 将上一次的访视病灶添加到这一次
///
diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
index 2bfd71ae7..68f314c54 100644
--- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
+++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
@@ -1784,6 +1784,11 @@ public enum SUVChangeVSBaseline
///
MatchValues = 102,
+ ///
+ /// 脂质角度
+ ///
+ LipidAngle = 103,
+
}
@@ -2084,6 +2089,11 @@ public enum SUVChangeVSBaseline
///
AvgMin=1015,
+ ///
+ /// 脂质角度
+ ///
+ LipidAngle = 1016,
+
}
@@ -2489,6 +2499,22 @@ public enum SUVChangeVSBaseline
/// 平均最小FCT
///
AverageMinFCT = 1011,
+
+
+ ///
+ /// 脂质角度
+ ///
+ LipidAngle = 1012,
+
+ ///
+ /// 脂质角度平均值
+ ///
+ AvgLipidAngle = 1013,
+
+ ///
+ /// 脂质角度最大值
+ ///
+ MaxLipidAngle = 1014,
}