Revert "拷贝病灶"
continuous-integration/drone/push Build is running Details

This reverts commit 282e56e5fc.
Test_IRC_Net10
he 2026-08-03 16:47:31 +08:00
parent fab6c8c55a
commit e346593ebb
2 changed files with 2 additions and 126 deletions

View File

@ -3974,16 +3974,6 @@
<param name="visitTaskId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.GeneralCalculateService.IsSameCustomRowAnswer(IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo,IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo,System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer})">
<summary>
自定义病灶判断是否是同一个病灶 除了根据器官判断还需要根据复制前值的答案是否相等
</summary>
<param name="currentRow"></param>
<param name="historyRow"></param>
<param name="currentAnswerList"></param>
<param name="historyAnswerList"></param>
<returns></returns>
</member>
<member name="F:IRaCIS.Core.Application.Service.ReadingCalculate.ReadingCalculateService.CalculateServiceDic">
<summary>
标准和服务对应
@ -10242,11 +10232,6 @@
问题分类
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetFilterTableQuestionInDto.QuestionClassify">
<summary>
问题分类
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SetOncologyQuestion.EvaluationResult">
<summary>
评估结果
@ -15030,13 +15015,6 @@
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.GetFilterTableQuestion(IRaCIS.Core.Application.Service.Reading.Dto.GetFilterTableQuestionInDto)">
<summary>
获取单个表格问题及答案 过滤问题
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.GetCustomTableQuestionAnswer(IRaCIS.Core.Application.Service.Reading.Dto.GetCustomTableQuestionAnswerInDto)">
<summary>
获取自定义问题以及答案

View File

@ -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<CopyTableAnswerRowInfo>(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<ReadingTableAnswerRowInfo>(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;
}
/// <summary>
/// 自定义病灶判断是否是同一个病灶 除了根据器官判断还需要根据复制前值的答案是否相等
/// </summary>
/// <param name="currentRow"></param>
/// <param name="historyRow"></param>
/// <param name="currentAnswerList"></param>
/// <param name="historyAnswerList"></param>
/// <returns></returns>
private bool IsSameCustomRowAnswer(ReadingTableAnswerRowInfo currentRow, ReadingTableAnswerRowInfo historyRow,
List<ReadingTableQuestionAnswer> currentAnswerList, List<ReadingTableQuestionAnswer> 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);
}
}
}