OCT 修改1
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
ae624730aa
commit
31158fed0e
|
|
@ -244,11 +244,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public class OCTFCTUploadData
|
||||
{
|
||||
/// <summary>
|
||||
/// 斑块编号
|
||||
/// </summary>
|
||||
public int PlaqueNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 第一次
|
||||
/// </summary>
|
||||
|
|
@ -290,7 +285,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// </summary>
|
||||
public decimal? LumenAreaMeasurement { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 脂质角度
|
||||
/// </summary>
|
||||
public decimal? LipidAngle { get; set; }
|
||||
|
||||
|
||||
public decimal Avg { get {
|
||||
|
|
|
|||
|
|
@ -338,15 +338,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
{
|
||||
measuredValueList.Add(new OCTFCTUploadData()
|
||||
{
|
||||
PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
|
||||
FirstData = getdecimalData(dataTable.Rows[i]["B"].ToString()),
|
||||
SecondData = getdecimalData(dataTable.Rows[i]["C"].ToString()),
|
||||
ThirdData = getdecimalData(dataTable.Rows[i]["D"].ToString()),
|
||||
MacrophageInfiltrationMeasurement = dataTable.Rows[i]["E"].ToString() ?? string.Empty,
|
||||
MacrophageInfiltrationAngle = getdecimalEmptyData(dataTable.Rows[i]["F"].ToString() ?? string.Empty),
|
||||
MicrochannelMeasurement =dataTable.Rows[i]["G"].ToString() ?? string.Empty,
|
||||
CholesterolCrystalMeasurement = dataTable.Rows[i]["H"].ToString() ?? string.Empty,
|
||||
LumenAreaMeasurement = getdecimalEmptyData(dataTable.Rows[i]["I"].ToString() ?? string.Empty),
|
||||
//PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
|
||||
FirstData = getdecimalData(dataTable.Rows[i]["A"].ToString()),
|
||||
SecondData = getdecimalData(dataTable.Rows[i]["B"].ToString()),
|
||||
ThirdData = getdecimalData(dataTable.Rows[i]["C"].ToString()),
|
||||
MacrophageInfiltrationMeasurement = dataTable.Rows[i]["D"].ToString() ?? string.Empty,
|
||||
MacrophageInfiltrationAngle = getdecimalEmptyData(dataTable.Rows[i]["E"].ToString() ?? string.Empty),
|
||||
MicrochannelMeasurement =dataTable.Rows[i]["F"].ToString() ?? string.Empty,
|
||||
CholesterolCrystalMeasurement = dataTable.Rows[i]["G"].ToString() ?? string.Empty,
|
||||
LumenAreaMeasurement = getdecimalEmptyData(dataTable.Rows[i]["H"].ToString() ?? string.Empty),
|
||||
LipidAngle = getdecimalEmptyData(dataTable.Rows[i]["I"].ToString() ?? string.Empty),
|
||||
});
|
||||
}
|
||||
catch (Exception)
|
||||
|
|
@ -356,7 +357,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
}
|
||||
|
||||
}
|
||||
measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -366,12 +367,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
throw new BusinessValidationFailedException(_localizer["Service_TemplateException", errorRows]);
|
||||
}
|
||||
|
||||
List<int> nums = new List<int>() { 1, 2, 3 };
|
||||
if (measuredValueList.Any(x => !nums.Contains(x.PlaqueNum)))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["IVUSOCT_PlaqueNum123"]);
|
||||
}
|
||||
|
||||
Dictionary<string, string> isPresent = new Dictionary<string, string>()
|
||||
{
|
||||
{ "有","1"},
|
||||
|
|
@ -442,16 +437,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
});
|
||||
|
||||
// 编号
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = item.PlaqueNum.ToString(),
|
||||
QuestionId = questionInfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = newRowId,
|
||||
RowIndex = maxnum,
|
||||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
//tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
//{
|
||||
// Answer = item.PlaqueNum.ToString(),
|
||||
// QuestionId = questionInfo.Id,
|
||||
// TrialId = taskinfo.TrialId,
|
||||
// VisitTaskId = taskinfo.Id,
|
||||
// RowId = newRowId,
|
||||
// RowIndex = maxnum,
|
||||
// TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
|
||||
//});
|
||||
|
||||
var avg = item.Avg.ToString();
|
||||
|
||||
|
|
@ -570,6 +565,18 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.LumenAreaMeasurement).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
// 脂质角度
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = item.LipidAngle.ToString(),
|
||||
QuestionId = questionInfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = newRowId,
|
||||
RowIndex = maxnum,
|
||||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.LipidAngle).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
|
@ -636,173 +643,176 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
[HttpPost]
|
||||
public async Task UploadOCTLipidAngleTemplate()
|
||||
{
|
||||
var request = httpContext.HttpContext!.Request;
|
||||
var file = request.Form.Files[0];
|
||||
Guid visitTaskId = Guid.Parse(request.Form["VisitTaskId"]);
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.Subject).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
var uploadInfo = await _generalCalculateService.GetDataTableFromUpload(file, "OCTLipidAngle", taskinfo.TrialId);
|
||||
List<string> sheetNames = new List<string>()
|
||||
{
|
||||
"脂质角度","LipidAngle"
|
||||
};
|
||||
#region 这个导入没有了 代码全部注释
|
||||
//var request = httpContext.HttpContext!.Request;
|
||||
//var file = request.Form.Files[0];
|
||||
//Guid visitTaskId = Guid.Parse(request.Form["VisitTaskId"]);
|
||||
//var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.Subject).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
//var uploadInfo = await _generalCalculateService.GetDataTableFromUpload(file, "OCTLipidAngle", taskinfo.TrialId);
|
||||
//List<string> sheetNames = new List<string>()
|
||||
//{
|
||||
// "脂质角度","LipidAngle"
|
||||
//};
|
||||
|
||||
if (sheetNames.Intersect(uploadInfo.SheetNames).Count() == 0)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
|
||||
}
|
||||
var dataTable = uploadInfo.DataTable;
|
||||
//if (sheetNames.Intersect(uploadInfo.SheetNames).Count() == 0)
|
||||
//{
|
||||
// throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
|
||||
//}
|
||||
//var dataTable = uploadInfo.DataTable;
|
||||
|
||||
var values = new TemplateData()
|
||||
{
|
||||
SubjectID = taskinfo.BlindSubjectCode.IsNullOrEmpty() ? taskinfo.Subject.Code : taskinfo.BlindSubjectCode,
|
||||
TaskBlindName = taskinfo.TaskBlindName,
|
||||
};
|
||||
//var values = new TemplateData()
|
||||
//{
|
||||
// SubjectID = taskinfo.BlindSubjectCode.IsNullOrEmpty() ? taskinfo.Subject.Code : taskinfo.BlindSubjectCode,
|
||||
// TaskBlindName = taskinfo.TaskBlindName,
|
||||
//};
|
||||
|
||||
if (values.SubjectID != dataTable.Rows[0]["B"].ToString() || values.TaskBlindName != dataTable.Rows[1]["B"].ToString())
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["IVUS_UploadVisitTaskError"]);
|
||||
}
|
||||
//if (values.SubjectID != dataTable.Rows[0]["B"].ToString() || values.TaskBlindName != dataTable.Rows[1]["B"].ToString())
|
||||
//{
|
||||
// throw new BusinessValidationFailedException(_localizer["IVUS_UploadVisitTaskError"]);
|
||||
//}
|
||||
|
||||
var digitPlaces = taskinfo.TrialReadingCriterion.DigitPlaces ?? 0;
|
||||
decimal getdecimalData(string value)
|
||||
{
|
||||
return decimal.Parse(decimal.Round(decimal.Parse(value ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString()));
|
||||
}
|
||||
;
|
||||
//var digitPlaces = taskinfo.TrialReadingCriterion.DigitPlaces ?? 0;
|
||||
//decimal getdecimalData(string value)
|
||||
//{
|
||||
// return decimal.Parse(decimal.Round(decimal.Parse(value ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString()));
|
||||
//}
|
||||
//;
|
||||
|
||||
List<OCTFCTUploadData> measuredValueList = new List<OCTFCTUploadData>();
|
||||
var errorRow = new List<int> { };
|
||||
//List<OCTFCTUploadData> measuredValueList = new List<OCTFCTUploadData>();
|
||||
//var errorRow = new List<int> { };
|
||||
|
||||
for (int i = 3; i < dataTable.Rows.Count; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
measuredValueList.Add(new OCTFCTUploadData()
|
||||
{
|
||||
PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
|
||||
FirstData = getdecimalData(dataTable.Rows[i]["B"].ToString()),
|
||||
//for (int i = 3; i < dataTable.Rows.Count; i++)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// measuredValueList.Add(new OCTFCTUploadData()
|
||||
// {
|
||||
// PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
|
||||
// FirstData = getdecimalData(dataTable.Rows[i]["B"].ToString()),
|
||||
|
||||
});
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// });
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
|
||||
errorRow.Add(i+1);
|
||||
}
|
||||
// errorRow.Add(i + 1);
|
||||
// }
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
|
||||
//measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
|
||||
|
||||
if (errorRow.Count() > 0)
|
||||
{
|
||||
var errorRows = string.Join(',', errorRow.Select(i => i.ToString()));
|
||||
throw new BusinessValidationFailedException(_localizer["Service_TemplateException", errorRows]);
|
||||
}
|
||||
//if (errorRow.Count() > 0)
|
||||
//{
|
||||
// var errorRows = string.Join(',', errorRow.Select(i => i.ToString()));
|
||||
// throw new BusinessValidationFailedException(_localizer["Service_TemplateException", errorRows]);
|
||||
//}
|
||||
|
||||
|
||||
List<int> nums = new List<int>() { 1, 2, 3 };
|
||||
if (measuredValueList.Any(x => !nums.Contains(x.PlaqueNum)))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["IVUSOCT_PlaqueNum123"]);
|
||||
}
|
||||
//List<int> nums = new List<int>() { 1, 2, 3 };
|
||||
//if (measuredValueList.Any(x => !nums.Contains(x.PlaqueNum)))
|
||||
//{
|
||||
// throw new BusinessValidationFailedException(_localizer["IVUSOCT_PlaqueNum123"]);
|
||||
//}
|
||||
|
||||
|
||||
foreach (var item in measuredValueList)
|
||||
{
|
||||
if (item.FirstData > 360)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["IVUS_LipidAngleLess360"]);
|
||||
}
|
||||
}
|
||||
//foreach (var item in measuredValueList)
|
||||
//{
|
||||
// if (item.FirstData > 360)
|
||||
// {
|
||||
// throw new BusinessValidationFailedException(_localizer["IVUS_LipidAngleLess360"]);
|
||||
// }
|
||||
//}
|
||||
|
||||
var questionInfo = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.LipidAngle).FirstNotNullAsync();
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.Id).ToListAsync();
|
||||
List<ReadingTableAnswerRowInfo> tableAnsweRowInfos = new List<ReadingTableAnswerRowInfo>();
|
||||
List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
|
||||
//var questionInfo = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.LipidAngle).FirstNotNullAsync();
|
||||
//var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.Id).ToListAsync();
|
||||
//List<ReadingTableAnswerRowInfo> tableAnsweRowInfos = new List<ReadingTableAnswerRowInfo>();
|
||||
//List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
|
||||
|
||||
var maxnum = 0;
|
||||
//var maxnum = 0;
|
||||
|
||||
|
||||
foreach (var item in measuredValueList)
|
||||
{
|
||||
maxnum = maxnum + 1;
|
||||
var newRowId = NewId.NextGuid();
|
||||
// 斑块数据统计
|
||||
tableAnsweRowInfos.Add(new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
Id = newRowId,
|
||||
QuestionId = questionInfo.Id,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
RowIndex = maxnum,
|
||||
IsCurrentTaskAdd = true,
|
||||
BlindName = taskinfo.TaskBlindName,
|
||||
OrderMark = questionInfo.OrderMark,
|
||||
FristAddTaskId = taskinfo.Id,
|
||||
RowMark = questionInfo.OrderMark + decimal.Parse(maxnum.ToString()).GetLesionMark()
|
||||
});
|
||||
//foreach (var item in measuredValueList)
|
||||
//{
|
||||
// maxnum = maxnum + 1;
|
||||
// var newRowId = NewId.NextGuid();
|
||||
// // 斑块数据统计
|
||||
// tableAnsweRowInfos.Add(new ReadingTableAnswerRowInfo()
|
||||
// {
|
||||
// Id = newRowId,
|
||||
// QuestionId = questionInfo.Id,
|
||||
// VisitTaskId = taskinfo.Id,
|
||||
// TrialId = taskinfo.TrialId,
|
||||
// RowIndex = maxnum,
|
||||
// IsCurrentTaskAdd = true,
|
||||
// BlindName = taskinfo.TaskBlindName,
|
||||
// OrderMark = questionInfo.OrderMark,
|
||||
// FristAddTaskId = taskinfo.Id,
|
||||
// RowMark = questionInfo.OrderMark + decimal.Parse(maxnum.ToString()).GetLesionMark()
|
||||
// });
|
||||
|
||||
// 编号
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = item.PlaqueNum.ToString(),
|
||||
QuestionId = questionInfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = newRowId,
|
||||
RowIndex = maxnum,
|
||||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
// // 编号
|
||||
// tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
// {
|
||||
// Answer = item.PlaqueNum.ToString(),
|
||||
// QuestionId = questionInfo.Id,
|
||||
// TrialId = taskinfo.TrialId,
|
||||
// VisitTaskId = taskinfo.Id,
|
||||
// RowId = newRowId,
|
||||
// RowIndex = maxnum,
|
||||
// TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
|
||||
// });
|
||||
|
||||
var avg = item.Avg.ToString();
|
||||
// var avg = item.Avg.ToString();
|
||||
|
||||
|
||||
if (taskinfo.TrialReadingCriterion.DigitPlaces != -1)
|
||||
{
|
||||
avg = decimal.Round(decimal.Parse(avg ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString());
|
||||
// if (taskinfo.TrialReadingCriterion.DigitPlaces != -1)
|
||||
// {
|
||||
// avg = decimal.Round(decimal.Parse(avg ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString());
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
// 脂质角度
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = item.FirstData.ToString(),
|
||||
QuestionId = questionInfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = newRowId,
|
||||
RowIndex = maxnum,
|
||||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.LipidAngle).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
// // 脂质角度
|
||||
// tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
// {
|
||||
// Answer = item.FirstData.ToString(),
|
||||
// QuestionId = questionInfo.Id,
|
||||
// TrialId = taskinfo.TrialId,
|
||||
// VisitTaskId = taskinfo.Id,
|
||||
// RowId = newRowId,
|
||||
// RowIndex = maxnum,
|
||||
// TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.LipidAngle).Select(x => x.Id).FirstOrDefault(),
|
||||
// });
|
||||
|
||||
// 添加其他问题答案
|
||||
foreach (var otherQuestion in tableQuestionList.Where(x => !tableAnswers.Any(y => y.TableQuestionId == x.Id && y.RowId == newRowId)))
|
||||
{
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = string.Empty,
|
||||
QuestionId = questionInfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = newRowId,
|
||||
RowIndex = maxnum,
|
||||
TableQuestionId = otherQuestion.Id,
|
||||
});
|
||||
}
|
||||
}
|
||||
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
||||
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(tableAnsweRowInfos);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
// // 添加其他问题答案
|
||||
// foreach (var otherQuestion in tableQuestionList.Where(x => !tableAnswers.Any(y => y.TableQuestionId == x.Id && y.RowId == newRowId)))
|
||||
// {
|
||||
// tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
// {
|
||||
// Answer = string.Empty,
|
||||
// QuestionId = questionInfo.Id,
|
||||
// TrialId = taskinfo.TrialId,
|
||||
// VisitTaskId = taskinfo.Id,
|
||||
// RowId = newRowId,
|
||||
// RowIndex = maxnum,
|
||||
// TableQuestionId = otherQuestion.Id,
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
//await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
||||
//await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
||||
//await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
//await _readingTableAnswerRowInfoRepository.AddRangeAsync(tableAnsweRowInfos);
|
||||
//await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
//await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
|
||||
await this.CalculateTask(new CalculateTaskInDto()
|
||||
{
|
||||
//await this.CalculateTask(new CalculateTaskInDto()
|
||||
//{
|
||||
|
||||
// VisitTaskId = taskinfo.Id,
|
||||
//});
|
||||
#endregion
|
||||
|
||||
VisitTaskId = taskinfo.Id,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -814,7 +824,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
/// <returns></returns>
|
||||
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
|
||||
{
|
||||
return;
|
||||
|
||||
#region 计算 这里顺序非常重要 后面计算的值要依赖前面计算的结果
|
||||
var needAddList = new List<ReadingTaskQuestionAnswer>();
|
||||
|
||||
|
|
@ -824,23 +834,33 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
ComputationTrigger.SaveEICRFQuestions,
|
||||
|
||||
};
|
||||
if (!computationTriggers.Contains(inDto.ComputationTrigger))
|
||||
{
|
||||
// 计算斑块统计数据
|
||||
await this.CalculatePatchDataStatistics(inDto);
|
||||
inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
||||
}
|
||||
//if (!computationTriggers.Contains(inDto.ComputationTrigger))
|
||||
//{
|
||||
// // 计算斑块统计数据
|
||||
// await this.CalculatePatchDataStatistics(inDto);
|
||||
// inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
||||
//}
|
||||
|
||||
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
||||
{
|
||||
// 斑块1-匹配动脉段最小FCT
|
||||
new ReadingCalculateData (){QuestionType=QuestionType.Plaque1MinFCT,GetDecimalNullFun=GetPlaque1MinFCT},
|
||||
//// 斑块1-匹配动脉段最小FCT
|
||||
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque1MinFCT,GetDecimalNullFun=GetPlaque1MinFCT},
|
||||
|
||||
// 斑块2-匹配动脉段最小FCT
|
||||
new ReadingCalculateData (){QuestionType=QuestionType.Plaque2MinFCT,GetDecimalNullFun=GetPlaque2MinFCT},
|
||||
// // 斑块2-匹配动脉段最小FCT
|
||||
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque2MinFCT,GetDecimalNullFun=GetPlaque2MinFCT},
|
||||
|
||||
// 斑块3-匹配动脉段最小FCT
|
||||
new ReadingCalculateData (){QuestionType=QuestionType.Plaque3MinFCT,GetDecimalNullFun=GetPlaque3MinFCT},
|
||||
// // 斑块3-匹配动脉段最小FCT
|
||||
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque3MinFCT,GetDecimalNullFun=GetPlaque3MinFCT},
|
||||
|
||||
|
||||
// 匹配动脉段最小FCT
|
||||
new ReadingCalculateData (){QuestionType=QuestionType.MatchingTheMinimumFCT,GetDecimalNullFun=GetMinFCT},
|
||||
|
||||
// 平均最小FCT
|
||||
new ReadingCalculateData (){QuestionType=QuestionType.AvgMinFCT,GetDecimalNullFun=GetAvgFCT},
|
||||
|
||||
// 脂质角度平均值
|
||||
new ReadingCalculateData (){QuestionType=QuestionType.AvgLipidAngle,GetDecimalNullFun=GetAvgLipidAngle},
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1220,6 +1240,41 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
.Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 匹配动脉段最小FCT (平均值的最小值)
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<decimal?> GetMinFCT(ReadingCalculateDto inDto)
|
||||
{
|
||||
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FCT).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||
.Where(x => x.QuestionMark == QuestionMark.AvgFCT).Select(x => x.Answer.IsNullOrEmptyReturn0()).MinOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 平均最小FCT (平均值的平均值)
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<decimal?> GetAvgFCT(ReadingCalculateDto inDto)
|
||||
{
|
||||
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FCT).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||
.Where(x => x.QuestionMark == QuestionMark.AvgFCT).Select(x => x.Answer.IsNullOrEmptyReturn0()).Average();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 脂质角度平均值
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<decimal?> GetAvgLipidAngle(ReadingCalculateDto inDto)
|
||||
{
|
||||
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FCT).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||
.Where(x => x.QuestionMark == QuestionMark.LipidAngle).Select(x => x.Answer.IsNullOrEmptyReturn0()).Average();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 验证访视提交
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -2970,6 +2970,41 @@ namespace IRaCIS.Core.Domain.Share
|
|||
/// </summary>
|
||||
TargetSegmentRemarks = 1012,
|
||||
|
||||
/// <summary>
|
||||
/// ROI起始回撤距离
|
||||
/// </summary>
|
||||
ROIStart = 1013,
|
||||
|
||||
/// <summary>
|
||||
/// ROI终止回撤距离
|
||||
/// </summary>
|
||||
ROIEnd = 1014,
|
||||
|
||||
/// <summary>
|
||||
/// ROI段落总长度
|
||||
/// </summary>
|
||||
ROIAllLength = 1015,
|
||||
|
||||
/// <summary>
|
||||
/// 匹配动脉段最小FCT
|
||||
/// </summary>
|
||||
MatchingTheMinimumFCT = 1022,
|
||||
|
||||
/// <summary>
|
||||
/// 平均最小FCT
|
||||
/// </summary>
|
||||
AvgMinFCT = 1023,
|
||||
|
||||
/// <summary>
|
||||
/// 脂质角度平均值
|
||||
/// </summary>
|
||||
AvgLipidAngle = 1024,
|
||||
|
||||
/// <summary>
|
||||
/// 脂质角度最大值
|
||||
/// </summary>
|
||||
MaxLipidAngle = 1025,
|
||||
|
||||
/// <summary>
|
||||
/// 脂肪分数总平均值
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue