From 6fcb670a89a32df1109534669bf477bac826dd7b Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 4 Dec 2025 14:16:47 +0800 Subject: [PATCH] =?UTF-8?q?OCT=E5=AF=BC=E5=85=A5=E4=BF=AE=E6=94=B91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/Dto/ReadingCalculateViewModel.cs | 50 +++++++ .../ReadingCalculate/OCTCalculateService.cs | 141 +++++++++++++++++- IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs | 49 +++++- 3 files changed, 235 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs index e26dfe49a..f8bd9af08 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs @@ -264,6 +264,35 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public int ThirdData { get; set; } + /// + /// 巨噬细胞浸润测量 + /// + public string MacrophageInfiltrationMeasurement { get; set; } + + + /// + /// 巨噬细胞浸润角度测量 + /// + public string MacrophageInfiltrationAngle { get; set; } + + /// + /// 微通道测量 + /// + public string MicrochannelMeasurement { get; set; } + + /// + /// 胆固醇结晶测量 + /// + public string CholesterolCrystalMeasurement { get; set; } + + /// + /// 官腔面积测量 + /// + public string LumenAreaMeasurement { get; set; } + + + + public decimal Avg { get { return ( FirstData*1m + SecondData * 1m + ThirdData * 1m) / 3; @@ -282,6 +311,27 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// 值 /// public decimal Data { get; set; } + + /// + /// 巨噬细胞浸润测量 + /// + public string MacrophageInfiltrationMeasurement { get; set; } + + + /// + /// 巨噬细胞浸润角度测量 + /// + public decimal MacrophageInfiltrationAngle { get; set; } + + /// + /// 微通道测量 + /// + public string MicrochannelMeasurement { get; set; } + + /// + /// 胆固醇结晶测量 + /// + public string CholesterolCrystalMeasurement { get; set; } } public class FileToDataTableDto diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs index 946f79244..38657795a 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs @@ -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 isPresent = new Dictionary() + { + { "有","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, diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs index 116988839..990f44eb8 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs @@ -2392,25 +2392,50 @@ namespace IRaCIS.Core.Domain.Share Undetermined = 1021, /// - /// 巨噬细胞浸润 + /// 巨噬细胞浸润汇总 /// MacrophageInfiltration = 1022, /// - /// 巨噬细胞延伸角度 + /// 巨噬细胞延伸角度汇总 /// MacrophageExtensionAngle = 1023, /// - /// 微通道 + /// 微通道汇总 /// Microchannels = 1024, /// - /// 胆固醇结晶 + /// 胆固醇结晶汇总 /// CholesterolCrystallization = 1025, + /// + /// 巨噬细胞浸润测量 + /// + MacrophageInfiltrationMeasurement = 1026, + + /// + /// 巨噬细胞浸润角度测量 + /// + MacrophageInfiltrationAngle = 1027, + + /// + /// 微通道测量 + /// + MicrochannelMeasurement = 1028, + + /// + /// 胆固醇结晶测量 + /// + CholesterolCrystalMeasurement = 1029, + + /// + /// 官腔面积测量 + /// + LumenAreaMeasurement = 1030, + @@ -2445,6 +2470,22 @@ namespace IRaCIS.Core.Domain.Share liverSegmentation = 1106, } + /// + /// 有(1)、无(0) + /// + public enum IsPresent + { + /// + /// 无 + /// + NonExistence = 0, + + /// + /// 有 + /// + Existence = 1, + + } /// /// 脂肪肝分级