From e346593ebb512e10f9536cd456327951fd370d33 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 3 Aug 2026 16:47:31 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E6=8B=B7=E8=B4=9D=E7=97=85=E7=81=B6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 282e56e5fc07c31e67bb4d9e977069a5d16b4ea3. --- .../IRaCIS.Core.Application.xml | 22 ---- .../General/GeneralCalculateService.cs | 106 +----------------- 2 files changed, 2 insertions(+), 126 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 5c7e4e102..97d8edbb8 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -3974,16 +3974,6 @@ - - - 自定义病灶判断是否是同一个病灶 除了根据器官判断还需要根据复制前值的答案是否相等 - - - - - - - 标准和服务对应 @@ -10242,11 +10232,6 @@ 问题分类 - - - 问题分类 - - 评估结果 @@ -15030,13 +15015,6 @@ - - - 获取单个表格问题及答案 过滤问题 - - - - 获取自定义问题以及答案 diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs index 4f6fc942f..831b93073 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs @@ -258,8 +258,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate if (historyTaskId != Guid.Empty) { - var criterionType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).Select(x => x.CriterionType).FirstOrDefaultAsync(); - var historyTableRowList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == historyTaskId).Include(x => x.ReadingQuestionTrial).ToListAsync(); + var historyTableRowList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync(); var historyTableAnswerList = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync(); @@ -279,11 +278,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate { continue; } - - // 自定义标准(SelfDefine)的病灶IdentityRowId不可靠 除了根据器官判断还需要根据复制前值的答案是否相等 优先用答案匹配 - var historyRow = historyTableRowList - .WhereIf(criterionType == CriterionType.SelfDefine,x => IsSameCustomRowAnswer(item, x, tableAnswerList, historyTableAnswerList)) - .Where(x => + var historyRow = historyTableRowList.Where(x => x.QuestionId == item.QuestionId && x.RowIndex == item.RowIndex && x.IdentityRowId == item.IdentityRowId && @@ -316,77 +311,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } } - // 将失效任务在当前访视新增的病灶添加过来 - // 例如现在是访视三,把失效任务访视三中在访视三新增的病灶(FristAddTaskId == historyTaskId)添加过来 - var historyAddRowList = historyTableRowList.Where(x => x.FristAddTaskId == historyTaskId && x.SplitOrMergeType != SplitOrMergeType.Merged).ToList(); - var historyRowIdSet = historyTableRowList.Select(x => x.Id).ToHashSet(); - - foreach (var historyRow in historyAddRowList) - { - // 判断当前任务是否已经存在该病灶 失效任务新增的病灶IdentityRowId是新建的不会与当前任务重复 - bool isExist = tableRowList.Any(x => x.QuestionId == historyRow.QuestionId && x.IdentityRowId != null && x.IdentityRowId == historyRow.IdentityRowId); - - if (isExist) - { - continue; - } - - // 通过CopyTableAnswerRowInfo映射复制行字段 - var copyRow = _mapper.Map(historyRow); - copyRow.Id = NewId.NextGuid(); - copyRow.VisitTaskId = taskinfo.Id; - copyRow.MeasureData = historyRow.MeasureData.Replace(historyTaskId.ToString(), taskinfo.Id.ToString()); - copyRow.IsCurrentTaskAdd = true; - copyRow.FristAddTaskId = taskinfo.Id; - - var newRow = _mapper.Map(copyRow); - // CopyTableAnswerRowInfo没有Other和PET/CT融合字段 单独复制 - newRow.OtherMeasureData = historyRow.OtherMeasureData.Replace(historyTaskId.ToString(), taskinfo.Id.ToString()); - newRow.OtherInstanceId = historyRow.OtherInstanceId; - newRow.OtherSeriesId = historyRow.OtherSeriesId; - newRow.OtherStudyId = historyRow.OtherStudyId; - newRow.OtherMarkTool = historyRow.OtherMarkTool; - newRow.OtherPicturePath = historyRow.OtherPicturePath; - newRow.OtherNumberOfFrames = historyRow.OtherNumberOfFrames; - newRow.PTSeriesId = historyRow.PTSeriesId; - newRow.CTSeriesId = historyRow.CTSeriesId; - - tableRowList.Add(newRow); - if (!lesionRelationship.ContainsKey(historyRow.Id)) - { - lesionRelationship.Add(historyRow.Id, newRow.Id); - } - - // 复制该病灶的表格答案 - historyTableAnswerList.Where(x => x.RowId == historyRow.Id).ForEach(x => - { - tableAnswerList.Add(new ReadingTableQuestionAnswer() - { - Id = NewId.NextGuid(), - Answer = x.Answer, - QuestionId = x.QuestionId, - VisitTaskId = taskinfo.Id, - TrialId = x.TrialId, - RowIndex = x.RowIndex, - TableQuestionId = x.TableQuestionId, - RowId = newRow.Id, - }); - }); - } - - // 处理新增病灶的分割合并关系 新增病灶已经在tableRowList里 通过SplitRowId/MergeRowId是否指向失效任务的行来识别 - tableRowList.ForEach(x => - { - if (x.SplitRowId != null && historyRowIdSet.Contains(x.SplitRowId.Value)) - { - x.SplitRowId = lesionRelationship.ContainsKey(x.SplitRowId.Value) ? lesionRelationship[x.SplitRowId.Value] : (Guid?)null; - } - if (x.MergeRowId != null && historyRowIdSet.Contains(x.MergeRowId.Value)) - { - x.MergeRowId = lesionRelationship.ContainsKey(x.MergeRowId.Value) ? lesionRelationship[x.MergeRowId.Value] : (Guid?)null; - } - }); - // 复制外层问题 answerList.ForEach(x => { @@ -996,31 +920,5 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate }); return taskInfoList; } - - /// - /// 自定义病灶判断是否是同一个病灶 除了根据器官判断还需要根据复制前值的答案是否相等 - /// - /// - /// - /// - /// - /// - private bool IsSameCustomRowAnswer(ReadingTableAnswerRowInfo currentRow, ReadingTableAnswerRowInfo historyRow, - List currentAnswerList, List historyAnswerList) - { - // 复制前值的答案:即当前任务从上一次有效访视复制过来的答案,自定义阅片只有IsCopy的问题会复制值,非空的就是复制前值 - var currentAnswers = currentAnswerList.Where(x => x.RowId == currentRow.Id && !x.Answer.IsNullOrEmpty()) - .GroupBy(x => x.TableQuestionId).ToDictionary(x => x.Key, x => x.First().Answer); - var historyAnswers = historyAnswerList.Where(x => x.RowId == historyRow.Id && !x.Answer.IsNullOrEmpty()) - .GroupBy(x => x.TableQuestionId).ToDictionary(x => x.Key, x => x.First().Answer); - - // 没有复制前值可以比较时 只根据器官判断 - if (currentAnswers.Count == 0) - { - return true; - } - - return currentAnswers.All(x => historyAnswers.TryGetValue(x.Key, out var historyAnswer) && historyAnswer == x.Value); - } } }