From fa979b57ccb09592ba7226514e07a9633010610a Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 14 Jul 2025 14:31:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReadingImageTaskService.cs | 72 ++++++++++++++++++- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 035705fe2..9900dc3f9 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -214,11 +214,77 @@ namespace IRaCIS.Core.Application.Service }); - await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.RowId == inDto.RowId.Value && x.TableQuestionId == inDto.TableQuestionId); + var originalMarkInfo = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.RowId == inDto.RowId.Value && x.TableQuestionId == inDto.TableQuestionId).FirstOrDefaultAsync(); + + if (originalMarkInfo == null) + { + if (inDto.MeasureData != string.Empty) + { + var readingTaskQuestionMark = _mapper.Map(inDto); + + await _readingTaskQuestionMarkRepository.AddAsync(readingTaskQuestionMark); + } + + } + else + { + // 如果MeasureData为空,且没有其他任务有该标记,则删除该标记 + if (inDto.MeasureData == string.Empty) + { + if (await _readingTaskQuestionMarkRepository.AnyAsync(x => x.MarkId == inDto.MarkId && x.Id != originalMarkInfo.Id)) + { + await _readingTaskQuestionMarkRepository.DeleteAsync(originalMarkInfo); + } + else + { + await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.Id == originalMarkInfo.Id, x => new ReadingTaskQuestionMark() + { + InstanceId = null, + SeriesId = null, + StudyId = null, + MarkTool = string.Empty, + // PicturePath = string.Empty, 稽查需要显示截图 + NumberOfFrames = null, + MeasureData = string.Empty, + OrderMarkName = string.Empty, + OtherInstanceId = null, + OtherSeriesId = null, + OtherStudyId = null, + OtherMarkTool = string.Empty, + OtherPicturePath = string.Empty, + OtherNumberOfFrames = null, + OtherMeasureData = string.Empty, + }); + } + + } + else + { + await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.Id == originalMarkInfo.Id, x => new ReadingTaskQuestionMark() + { + InstanceId = inDto.InstanceId, + SeriesId = inDto.SeriesId, + StudyId = inDto.StudyId, + MarkTool = inDto.MarkTool, + PicturePath = inDto.PicturePath, + NumberOfFrames = inDto.NumberOfFrames, + MeasureData = inDto.MeasureData, + OrderMarkName = inDto.OrderMarkName, + OtherInstanceId = inDto.OtherInstanceId, + OtherSeriesId = inDto.OtherSeriesId, + OtherStudyId = inDto.OtherStudyId, + OtherMarkTool = inDto.OtherMarkTool, + OtherPicturePath = inDto.OtherPicturePath, + OtherNumberOfFrames = inDto.OtherNumberOfFrames, + OtherMeasureData = inDto.OtherMeasureData, + }); + } + } + + + - var readingTaskQuestionMark = _mapper.Map(inDto); - await _readingTaskQuestionMarkRepository.AddAsync(readingTaskQuestionMark); await _readingTaskQuestionMarkRepository.SaveChangesAsync(); await _readingCalculateService.CalculateTask(new CalculateTaskInDto()