From 7e454467d18ce45cd9fff23dc386225b78122ca7 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Wed, 8 Jul 2026 14:42:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=8B=E5=80=BC=E5=88=86=E5=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 6 +- .../General/GeneralCalculateService.cs | 68 ++++++++++++++++++- 2 files changed, 69 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 4083d5c21..6ea8aa5ab 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -17537,17 +17537,17 @@ - 质疑 + ���� - 一致性核查 + һ���Ժ˲� - 复制 + ���� diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs index 01f7dc0b0..a97a7be6d 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs @@ -1,4 +1,5 @@ -using DocumentFormat.OpenXml.Drawing.Spreadsheet; +using Amazon.Runtime.Internal.Transform; +using DocumentFormat.OpenXml.Drawing.Spreadsheet; using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Application.ViewModel; @@ -10,6 +11,7 @@ using MassTransit.Saga; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using MiniExcelLibs; +using System.Collections.Immutable; using System.Data; using System.IO; using System.Text; @@ -18,6 +20,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate { public class GeneralCalculateService(IRepository _readingTableQuestionAnswerRepository, IRepository _visitTaskRepository, + IRepository _segmentationRepository, + IRepository _segmentRepository, + IRepository _segmentBindingRepository, + IRepository _readingTaskQuestionMarkRepository, IRepository _readingNoneDicomMarkRepository, IRepository _readingNoneDicomMarkBindingRepository, @@ -255,7 +261,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var questionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync(); var noneDicomMarkList = await _readingNoneDicomMarkRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync(); var noneDicomMarkBindingList = await _readingNoneDicomMarkBindingRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync(); - + Dictionary lesionRelationship = new Dictionary() { }; foreach (var item in tableRowList) { if (item.SplitOrMergeType == SplitOrMergeType.Merged) @@ -272,6 +278,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate if (historyRow != null) { + lesionRelationship.Add(historyRow.Id, item.Id); item.StudyId = historyRow.StudyId; item.SeriesId = historyRow.SeriesId; item.InstanceId = historyRow.InstanceId; @@ -380,6 +387,63 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate item.Id = NewId.NextGuid(); } + + #region 分割 + Dictionary segmentationRelationship = new Dictionary() { }; + var segmentationList = _segmentationRepository.Where(t => t.VisitTaskId == historyTaskId).ToList(); + + foreach (var item in segmentationList) + { + + var newSegmentationId = NewId.NextSequentialGuid(); + segmentationRelationship.Add(item.Id, newSegmentationId); + item.Id = newSegmentationId; + item.VisitTaskId = taskinfo.Id; + } + + + Dictionary segmentRelationship = new Dictionary() { }; + var segmentList = _segmentRepository.Where(t => t.VisitTaskId == historyTaskId).ToList(); + foreach (var item in segmentList) + { + var newSegmentationId = NewId.NextSequentialGuid(); + segmentRelationship.Add(item.Id, newSegmentationId); + if (segmentationRelationship.ContainsKey(item.SegmentationId)) + { + item.SegmentationId = segmentationRelationship[item.SegmentationId]; + } + item.Id = newSegmentationId; + item.VisitTaskId = taskinfo.Id; + } + + var segmentBindingList = _segmentBindingRepository.Where(x => x.VisitTaskId == historyTaskId).ToList(); + + foreach (var item in segmentBindingList) + { + if (segmentationRelationship.ContainsKey(item.SegmentationId)) + { + item.SegmentationId = segmentationRelationship[item.SegmentationId]; + } + if (segmentRelationship.ContainsKey(item.SegmentId)) + { + item.SegmentId = segmentRelationship[item.SegmentId]; + } + + if (item.RowId != null && lesionRelationship.ContainsKey(item.RowId.Value)) + { + item.RowId = lesionRelationship[item.RowId.Value]; + } + item.Id = NewId.NextSequentialGuid(); + item.VisitTaskId = taskinfo.Id; + } + + + _ = _segmentationRepository.AddRangeAsync(segmentationList).Result; + _ = _segmentRepository.AddRangeAsync(segmentList).Result; + _ = _segmentBindingRepository.AddRangeAsync(segmentBindingList).Result; + #endregion + + await _readingNoneDicomMarkRepository.AddRangeAsync(noneDicomMarkList);