Compare commits
No commits in common. "a7db67adb6f2506144a88b58f7a43c4f1eb1b200" and "f925f8969ada9601f474e5374690f6ed551d1cad" have entirely different histories.
a7db67adb6
...
f925f8969a
|
|
@ -397,6 +397,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
{
|
{
|
||||||
//_logger.LogError("测试计算");
|
//_logger.LogError("测试计算");
|
||||||
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
|
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
|
||||||
|
// await _generalCalculateService.LogRecord(readingData, "其他既往新病灶", LesionType.OtherPreviousNewLesion);
|
||||||
if (type == null)
|
if (type == null)
|
||||||
{
|
{
|
||||||
await ReadingCalculate(readingData);
|
await ReadingCalculate(readingData);
|
||||||
|
|
@ -455,32 +456,56 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
|
|
||||||
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
||||||
{
|
{
|
||||||
// EEM求和
|
////靶病灶径线之和(SOD)
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.EEMSun,GetDecimalNullFun=GetEEM},
|
//new ReadingCalculateData (){QuestionType=QuestionType.SOD,GetDecimalNullFun=GetSODData},
|
||||||
|
|
||||||
// (EEM-Lumen)求和
|
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.EEMLumenSum,GetDecimalNullFun=GetEEMLumenSum},
|
|
||||||
|
|
||||||
// 计算NTAV的(EEM-Lumen)求和/回撤中的图像数
|
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.NTAVEEMLumenSumOrRetraceImageCount,GetDecimalNullFun=GetNTAVEEMLumenSumOrRetraceImageCount},
|
|
||||||
|
|
||||||
// 冠状动脉粥样硬化体积百分比(PAV)
|
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.PAV,GetDecimalNullFun=GetPAV},
|
|
||||||
|
|
||||||
// 总动脉粥样硬化体积(NTAV)
|
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.NTAV,GetDecimalNullFun=GetNTAV},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 没有靶病灶只计算最后几个
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
|
@ -489,7 +514,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
//计算答案
|
//计算答案
|
||||||
|
if (inDto.IsOnlyChangeAllTask == false)
|
||||||
|
{
|
||||||
|
|
||||||
#region 计算答案
|
#region 计算答案
|
||||||
if (calculate.GetDecimalFun != null)
|
if (calculate.GetDecimalFun != null)
|
||||||
|
|
@ -500,8 +526,26 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
else if (calculate.GetDecimalNullFun != null)
|
else if (calculate.GetDecimalNullFun != null)
|
||||||
{
|
{
|
||||||
var value = await calculate.GetDecimalNullFun(inDto);
|
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();
|
item.Answer = value == null ? string.Empty : value.Value.ToString();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (calculate.GetStringFun != null)
|
else if (calculate.GetStringFun != null)
|
||||||
{
|
{
|
||||||
item.Answer = await calculate.GetStringFun(inDto);
|
item.Answer = await calculate.GetStringFun(inDto);
|
||||||
|
|
@ -540,6 +584,18 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
ReadingQuestionTrialId = item.QuestionId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改全局
|
||||||
|
if (inDto.IsChangeOtherTask && calculate.ChangeAllTaskFun != null)
|
||||||
|
{
|
||||||
|
await calculate.ChangeAllTaskFun(new ChangeAllTaskDto()
|
||||||
|
{
|
||||||
|
calculateDto = inDto,
|
||||||
|
QuestionId = item.QuestionId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -578,91 +634,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 计算NTAV的EEM
|
///// 计算NTAV的EEM
|
||||||
/// </summary>
|
///// </summary>
|
||||||
/// <param name="inDto"></param>
|
///// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
///// <returns></returns>
|
||||||
public async Task<decimal?> GetEEM(ReadingCalculateDto inDto)
|
//public async Task<decimal> GetEEM(ReadingCalculateDto inDto)
|
||||||
{
|
//{
|
||||||
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
// var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
|
||||||
.Where(x => x.QuestionMark == QuestionMark.ElasticAreaDiffValue).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
|
//}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取(EEM-Lumen)求和
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inDto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<decimal?> GetEEMLumenSum(ReadingCalculateDto inDto)
|
|
||||||
{
|
|
||||||
var eMM= await GetEEM(inDto);
|
|
||||||
var lumenAreaSum = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
|
||||||
.Where(x => x.QuestionMark == QuestionMark.LumenArea).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
|
|
||||||
if (eMM == 0 || lumenAreaSum == 0)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return eMM / lumenAreaSum;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 计算NTAV的(EEM-Lumen)求和/回撤中的图像数
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inDto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<decimal?> GetNTAVEEMLumenSumOrRetraceImageCount(ReadingCalculateDto inDto)
|
|
||||||
{
|
|
||||||
var eEMLumenSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMLumenSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
|
||||||
var retracedFramesNumber = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.RetracedFramesNumber).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
|
||||||
|
|
||||||
if (eEMLumenSum == 0 || retracedFramesNumber == 0)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return eEMLumenSum / retracedFramesNumber;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 冠状动脉粥样硬化体积百分比(PAV)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inDto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<decimal?> GetPAV(ReadingCalculateDto inDto)
|
|
||||||
{
|
|
||||||
var result =await GetEEMLumenSum(inDto);
|
|
||||||
if (result == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return result.Value * 200;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 总动脉粥样硬化体积(NTAV)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inDto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<decimal?> GetNTAV(ReadingCalculateDto inDto)
|
|
||||||
{
|
|
||||||
var result = await GetNTAVEEMLumenSumOrRetraceImageCount(inDto);
|
|
||||||
var medianFrame= inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.MedianFrame).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
|
||||||
if (result == null|| medianFrame==0)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return result.Value * medianFrame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#region 将上一次的访视病灶添加到这一次
|
#region 将上一次的访视病灶添加到这一次
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1772,17 +1772,7 @@ public enum SUVChangeVSBaseline
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 触发iRECSIT后的新病灶
|
/// 触发iRECSIT后的新病灶
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TriggeringIRECSIT = 8,
|
TriggeringIRECSIT = 8
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// FCT
|
|
||||||
/// </summary>
|
|
||||||
FCT = 101,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 各匹配片段测量值
|
|
||||||
/// </summary>
|
|
||||||
MatchValues = 102,
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2042,47 +2032,7 @@ public enum SUVChangeVSBaseline
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SUVmax
|
/// SUVmax
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SUVmax = 20,
|
SUVmax = 20
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 外弹力膜面积
|
|
||||||
/// </summary>
|
|
||||||
ElasticArea = 1001,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 管腔面积
|
|
||||||
/// </summary>
|
|
||||||
LumenArea = 1002,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 外弹力膜与管腔面积差值
|
|
||||||
/// </summary>
|
|
||||||
ElasticAreaDiffValue = 1003,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// FCT第一次测量值
|
|
||||||
/// </summary>
|
|
||||||
FirstFCT = 1011,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// FCT第二次测量值
|
|
||||||
/// </summary>
|
|
||||||
SecondFCT = 1012,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// FCT第三次测量值
|
|
||||||
/// </summary>
|
|
||||||
ThirdFCT = 1013,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// FCT三次测量最小值
|
|
||||||
/// </summary>
|
|
||||||
MinFCT = 1014,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// FCT三次测量平均值
|
|
||||||
/// </summary>
|
|
||||||
AvgMin=1015,
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2444,51 +2394,6 @@ public enum SUVChangeVSBaseline
|
||||||
/// 影像质量问题
|
/// 影像质量问题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ImageQualityProblem = 67,
|
ImageQualityProblem = 67,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 回撤中的图像帧数
|
|
||||||
/// </summary>
|
|
||||||
RetracedFramesNumber = 1003,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 队列分析图像帧数的中位数
|
|
||||||
/// </summary>
|
|
||||||
MedianFrame = 1004,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// EEM求和
|
|
||||||
/// </summary>
|
|
||||||
EEMSun = 1005,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// (EEM-Lumen)求和
|
|
||||||
/// </summary>
|
|
||||||
EEMLumenSum = 1006,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 计算NTAV的(EEM-Lumen)求和/回撤中的图像数
|
|
||||||
/// </summary>
|
|
||||||
NTAVEEMLumenSumOrRetraceImageCount = 1007,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 冠状动脉粥样硬化体积百分比(PAV)
|
|
||||||
/// </summary>
|
|
||||||
PAV = 1008,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 总动脉粥样硬化体积(NTAV)
|
|
||||||
/// </summary>
|
|
||||||
NTAV = 1009,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 匹配动脉段最小的FCT
|
|
||||||
/// </summary>
|
|
||||||
MinFCT = 1010,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 平均最小FCT
|
|
||||||
/// </summary>
|
|
||||||
AverageMinFCT = 1011,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue