IVUS 修改
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
parent
31158fed0e
commit
8865db72d1
|
|
@ -208,10 +208,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class IVUSMeasuredValue
|
public class IVUSMeasuredValue
|
||||||
{
|
{
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 斑块编号
|
///// 斑块编号
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public int PlaqueNum { get; set; }
|
//public int PlaqueNum { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 外弹力膜面积Emm
|
/// 外弹力膜面积Emm
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using MiniExcelLibs;
|
using MiniExcelLibs;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
{
|
{
|
||||||
|
|
@ -273,7 +274,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
|
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
#region 计算 这里顺序非常重要 后面计算的值要依赖前面计算的结果
|
#region 计算 这里顺序非常重要 后面计算的值要依赖前面计算的结果
|
||||||
var needAddList = new List<ReadingTaskQuestionAnswer>();
|
var needAddList = new List<ReadingTaskQuestionAnswer>();
|
||||||
|
|
||||||
|
|
@ -284,23 +285,34 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
ComputationTrigger.SaveEICRFQuestions,
|
ComputationTrigger.SaveEICRFQuestions,
|
||||||
|
|
||||||
};
|
};
|
||||||
if (!computationTriggers.Contains(inDto.ComputationTrigger))
|
//if (!computationTriggers.Contains(inDto.ComputationTrigger))
|
||||||
{
|
//{
|
||||||
// 计算斑块统计数据
|
// // 计算斑块统计数据
|
||||||
await this.CalculatePatchDataStatisticsAndPVA(inDto);
|
// await this.CalculatePatchDataStatisticsAndPVA(inDto);
|
||||||
inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
// inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
||||||
}
|
//}
|
||||||
|
|
||||||
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
||||||
{
|
{
|
||||||
// 斑块1-PAV
|
//// 斑块1-PAV
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.Plaque1PVA,GetDecimalNullFun=GetPlaque1PVA},
|
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque1PVA,GetDecimalNullFun=GetPlaque1PVA},
|
||||||
|
|
||||||
|
// // 斑块2-PAV
|
||||||
|
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque2PVA,GetDecimalNullFun=GetPlaque2PVA},
|
||||||
|
|
||||||
|
// // 斑块3-PAV
|
||||||
|
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque3PVA,GetDecimalNullFun=GetPlaque3PVA},
|
||||||
|
|
||||||
|
|
||||||
|
// (EEM-Lumen)求和
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.EEMSum,GetDecimalNullFun=GetEmmSum},
|
||||||
|
|
||||||
// 斑块2-PAV
|
// 斑块2-PAV
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.Plaque2PVA,GetDecimalNullFun=GetPlaque2PVA},
|
new ReadingCalculateData (){QuestionType=QuestionType.EEMSubLumenSum,GetDecimalNullFun=GetEEMLumenSum},
|
||||||
|
|
||||||
|
// PAV(冠状动脉粥样硬化体积百分比)
|
||||||
|
new ReadingCalculateData (){QuestionType=QuestionType.PAV,GetDecimalNullFun=GetPAV},
|
||||||
|
|
||||||
// 斑块3-PAV
|
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.Plaque3PVA,GetDecimalNullFun=GetPlaque3PVA},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -471,9 +483,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
{
|
{
|
||||||
iVUSMeasuredValue = new IVUSMeasuredValue()
|
iVUSMeasuredValue = new IVUSMeasuredValue()
|
||||||
{
|
{
|
||||||
PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
|
//PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
|
||||||
Emm = getdecimalData(dataTable.Rows[i]["B"].ToString()),
|
Emm = getdecimalData(dataTable.Rows[i]["A"].ToString()),
|
||||||
Lumen = getdecimalData(dataTable.Rows[i]["C"].ToString()),
|
Lumen = getdecimalData(dataTable.Rows[i]["B"].ToString()),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
|
@ -494,12 +506,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
var errorRows= string.Join(',', errorRow.Select(i => i.ToString()));
|
var errorRows= string.Join(',', errorRow.Select(i => i.ToString()));
|
||||||
throw new BusinessValidationFailedException(_localizer["Service_TemplateException", errorRows]);
|
throw new BusinessValidationFailedException(_localizer["Service_TemplateException", errorRows]);
|
||||||
}
|
}
|
||||||
List<int> nums = new List<int>() { 1, 2, 3 };
|
//List<int> nums = new List<int>() { 1, 2, 3 };
|
||||||
if (measuredValueList.Any(x => !nums.Contains(x.PlaqueNum)))
|
//if (measuredValueList.Any(x => !nums.Contains(x.PlaqueNum)))
|
||||||
{
|
//{
|
||||||
throw new BusinessValidationFailedException(_localizer["IVUSOCT_PlaqueNum123"]);
|
// throw new BusinessValidationFailedException(_localizer["IVUSOCT_PlaqueNum123"]);
|
||||||
}
|
//}
|
||||||
measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
|
//measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
|
||||||
|
|
||||||
|
|
||||||
var questionInfo = await _readingQuestionTrialRepository.Where(x =>x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId&& x.LesionType == LesionType.MatchValues).FirstNotNullAsync();
|
var questionInfo = await _readingQuestionTrialRepository.Where(x =>x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId&& x.LesionType == LesionType.MatchValues).FirstNotNullAsync();
|
||||||
|
|
@ -530,16 +542,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
});
|
});
|
||||||
|
|
||||||
// 编号
|
// 编号
|
||||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
//tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||||
{
|
//{
|
||||||
Answer = item.PlaqueNum.ToString(),
|
// Answer = item.PlaqueNum.ToString(),
|
||||||
QuestionId = questionInfo.Id,
|
// QuestionId = questionInfo.Id,
|
||||||
TrialId = taskinfo.TrialId,
|
// TrialId = taskinfo.TrialId,
|
||||||
VisitTaskId = taskinfo.Id,
|
// VisitTaskId = taskinfo.Id,
|
||||||
RowId = newRowId,
|
// RowId = newRowId,
|
||||||
RowIndex = maxnum,
|
// RowIndex = maxnum,
|
||||||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
|
// TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
|
||||||
});
|
//});
|
||||||
|
|
||||||
var emm = item.Emm.ToString();
|
var emm = item.Emm.ToString();
|
||||||
var lumen=item.Lumen.ToString();
|
var lumen=item.Lumen.ToString();
|
||||||
|
|
@ -891,6 +903,58 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
.Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull();
|
.Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取EMM求和
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<decimal?> GetEmmSum(ReadingCalculateDto inDto)
|
||||||
|
{
|
||||||
|
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||||
|
.Where(x => x.QuestionMark == QuestionMark.ElasticArea).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 = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||||
|
.Where(x => x.QuestionMark == QuestionMark.ElasticArea).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
|
||||||
|
|
||||||
|
var lumen = 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();
|
||||||
|
|
||||||
|
return emm - lumen;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PAV(冠状动脉粥样硬化体积百分比)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<decimal?> GetPAV(ReadingCalculateDto inDto)
|
||||||
|
{
|
||||||
|
var eEMLumenSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMSubLumenSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||||
|
var eEMSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
|
string pav = string.Empty;
|
||||||
|
if (eEMSum != 0)
|
||||||
|
{
|
||||||
|
pav = (eEMLumenSum * 100 / eEMSum).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inDto.DigitPlaces != -1)
|
||||||
|
{
|
||||||
|
|
||||||
|
pav = decimal.Round(decimal.Parse(pav ?? "0"), inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return decimal.Parse(pav);
|
||||||
|
}
|
||||||
|
|
||||||
///// <summary>
|
///// <summary>
|
||||||
///// 计算NTAV的EEM
|
///// 计算NTAV的EEM
|
||||||
|
|
|
||||||
|
|
@ -2985,6 +2985,21 @@ namespace IRaCIS.Core.Domain.Share
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ROIAllLength = 1015,
|
ROIAllLength = 1015,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PAV(冠状动脉粥样硬化体积百分比)
|
||||||
|
/// </summary>
|
||||||
|
PAV =1019,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EEM求和
|
||||||
|
/// </summary>
|
||||||
|
EEMSum = 1020,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// (EEM-Lumen)求和
|
||||||
|
/// </summary>
|
||||||
|
EEMSubLumenSum = 1021,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 匹配动脉段最小FCT
|
/// 匹配动脉段最小FCT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue