OCT导入修改1

This commit is contained in:
he
2025-12-04 14:16:47 +08:00
parent 7e39692cc4
commit 6fcb670a89
3 changed files with 235 additions and 5 deletions
@@ -326,6 +326,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
FirstData = int.Parse(dataTable.Rows[i]["B"].ToString()),
SecondData = int.Parse(dataTable.Rows[i]["C"].ToString()),
ThirdData = int.Parse(dataTable.Rows[i]["D"].ToString()),
MacrophageInfiltrationMeasurement= dataTable.Rows[i]["E"].ToString()??string.Empty,
MacrophageInfiltrationAngle = dataTable.Rows[i]["F"].ToString() ?? string.Empty,
MicrochannelMeasurement = dataTable.Rows[i]["G"].ToString() ?? string.Empty,
CholesterolCrystalMeasurement = dataTable.Rows[i]["H"].ToString() ?? string.Empty,
LumenAreaMeasurement = dataTable.Rows[i]["I"].ToString() ?? string.Empty,
});
}
measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
@@ -342,6 +347,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var maxnum = 0;
Dictionary<string, string> isPresent = new Dictionary<string, string>()
{
{ "有","1"},
{ "无","0"},
{ "Existence","1"},
{ "Non-existence","0"},
};
foreach (var item in measuredValueList)
{
@@ -429,6 +441,75 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.AvgFCT).Select(x => x.Id).FirstOrDefault(),
});
try
{
// 新加的5个问题
// 巨噬细胞浸润测量
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = isPresent[item.MacrophageInfiltrationMeasurement.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.MacrophageInfiltrationMeasurement).Select(x => x.Id).FirstOrDefault(),
});
// 巨噬细胞浸润角度测量
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.MacrophageInfiltrationAngle.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.MacrophageInfiltrationAngle).Select(x => x.Id).FirstOrDefault(),
});
// 微通道测量
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = isPresent[item.MicrochannelMeasurement.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.MicrochannelMeasurement).Select(x => x.Id).FirstOrDefault(),
});
// 胆固醇结晶测量
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = isPresent[item.CholesterolCrystalMeasurement.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.CholesterolCrystalMeasurement).Select(x => x.Id).FirstOrDefault(),
});
// 官腔面积测量
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.LumenAreaMeasurement.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.LumenAreaMeasurement).Select(x => x.Id).FirstOrDefault(),
});
}
catch (Exception)
{
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
}
// 添加其他问题答案
foreach (var otherQuestion in tableQuestionList.Where(x => !tableAnswers.Any(y => y.TableQuestionId == x.Id && y.RowId == newRowId)))
@@ -783,6 +864,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
PlaqueNum = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => int.Parse(x.Answer)).FirstOrDefault(),
Data = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AvgFCT).Select(x => decimal.Parse(x.Answer)).FirstOrDefault(),
MacrophageInfiltrationMeasurement = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MacrophageInfiltrationMeasurement).Select(x => x.Answer).FirstOrDefault()??string.Empty,
MacrophageInfiltrationAngle = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MacrophageInfiltrationAngle).Select(x => x.Answer.IsNullOrEmptyReturn0()).FirstOrDefault(),
MicrochannelMeasurement = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MicrochannelMeasurement).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
CholesterolCrystalMeasurement = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.CholesterolCrystalMeasurement).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
});
}
@@ -887,6 +972,60 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.AvgMinFCT).Select(x => x.Id).FirstOrDefault(),
});
// 巨噬细胞浸润测量
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = oCTFCTInfos.Any(x => x.PlaqueNum == item&&x.MacrophageInfiltrationMeasurement.EqEnum(IsPresent.Existence))? IsPresent.Existence.GetEnumInt(): IsPresent.NonExistence.GetEnumInt(),
Id = NewId.NextGuid(),
QuestionId = patchDataStatisticsInfo.Id,
TrialId = inDto.TrialId,
VisitTaskId = inDto.VisitTaskId,
RowId = newRowId,
RowIndex = item,
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.MacrophageInfiltration).Select(x => x.Id).FirstOrDefault(),
});
// 巨噬细胞浸润角度测量
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = oCTFCTInfos.Where(x => x.PlaqueNum == item).Count() == 0 ? string.Empty : oCTFCTInfos.Where(x => x.PlaqueNum == item).Max(x=>x.MacrophageInfiltrationAngle).ToString(),
Id = NewId.NextGuid(),
QuestionId = patchDataStatisticsInfo.Id,
TrialId = inDto.TrialId,
VisitTaskId = inDto.VisitTaskId,
RowId = newRowId,
RowIndex = item,
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.MacrophageExtensionAngle).Select(x => x.Id).FirstOrDefault(),
});
// 微通道
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = oCTFCTInfos.Any(x => x.PlaqueNum == item && x.MicrochannelMeasurement.EqEnum(IsPresent.Existence)) ? IsPresent.Existence.GetEnumInt() : IsPresent.NonExistence.GetEnumInt(),
Id = NewId.NextGuid(),
QuestionId = patchDataStatisticsInfo.Id,
TrialId = inDto.TrialId,
VisitTaskId = inDto.VisitTaskId,
RowId = newRowId,
RowIndex = item,
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.Microchannels).Select(x => x.Id).FirstOrDefault(),
});
// 胆固醇结晶测量
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = oCTFCTInfos.Any(x => x.PlaqueNum == item && x.CholesterolCrystalMeasurement.EqEnum(IsPresent.Existence)) ? IsPresent.Existence.GetEnumInt() : IsPresent.NonExistence.GetEnumInt(),
Id = NewId.NextGuid(),
QuestionId = patchDataStatisticsInfo.Id,
TrialId = inDto.TrialId,
VisitTaskId = inDto.VisitTaskId,
RowId = newRowId,
RowIndex = item,
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.CholesterolCrystallization).Select(x => x.Id).FirstOrDefault(),
});
// 脂质角度平均值
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
@@ -913,7 +1052,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.MaxAvgLipidAngle).Select(x => x.Id).FirstOrDefault(),
});
// 待定指标
// 斑块类型
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = string.Empty,