From 3d671c79ea31024873a1d83c3a28bc39a01e3ed8 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 21 Jul 2025 15:33:58 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E7=BB=91=E5=AE=9A=E7=9A=84=E6=A0=87?= =?UTF-8?q?=E8=AE=B0=E4=B8=8D=E8=AE=A9=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/ReadingImageTask/ReadingImageTaskService.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 8a22002ca..80331ff54 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -354,7 +354,14 @@ namespace IRaCIS.Core.Application.Service [HttpPost("{id:guid}")] public async Task DeleteCustomTag(Guid id) { + + if (await _readingTaskQuestionMarkRepository.AnyAsync(t => (t.Id == id || t.MarkId == id) && t.QuestionId != null)) + { + throw new BusinessValidationFailedException(_localizer["ReadingCustomTag_CannotDelete"]); + } + var success = await _readingTaskQuestionMarkRepository.DeleteFromQueryAsync(t => t.Id == id||t.MarkId==id, true); + return ResponseOutput.Ok(); } From fed62ce5e3928dfe67a0e4b8e7f7a792e4c1e328 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 21 Jul 2025 16:55:38 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReadingImageTaskService.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 80331ff54..a30bad09f 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2205,6 +2205,27 @@ namespace IRaCIS.Core.Application.Service await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => markids.Contains(x.MarkId)&&x.QuestionId==null ); + // 这里还不能直接删除 因为可能该问题绑定的原标记为a 现在新绑定的标记要为b 那么就需要把原标记a的绑定关系删除 + + var oldMark=await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId) && x.MarkId != null).ToListAsync(); + + // 这里稽查又要记录为新增 只能把原标记记录为先删除再添加 不然稽查又对不上 + List oldAddMark=new List (); + + foreach (var item in oldMark) + { + if (addOrUpdatemarkList.Any(x => x.QuestionId == item.QuestionId && x.MarkId != item.MarkId)) + { + var olditem = item.Clone(); + + olditem.QuestionId = null; + olditem.TableQuestionId = null; + olditem.RowId = null; + olditem.RowIndex = null; + oldAddMark.Add(olditem); + } + } + await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId)); var datetime = DateTime.Now; @@ -2217,7 +2238,9 @@ namespace IRaCIS.Core.Application.Service x.CreateTime = datetime; x.FristAddTaskId = questionMarkList.Where(y => y.QuestionId == x.QuestionId).Select(x => x.FristAddTaskId).FirstOrDefault() ?? inDto.VisitTaskId; }); - await _readingTaskQuestionMarkRepository.AddRangeAsync(markList); + // 原来移除关系的 已经删除 这里要添加 为什么要先删再加 因为稽查需要记录 稽查的记录方式为Add + oldAddMark.AddRange(markList); + await _readingTaskQuestionMarkRepository.AddRangeAsync(oldAddMark); } From d93cfb6a4df0339f569e49c09935e3bfd0fc1641 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 22 Jul 2025 14:02:49 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A8=BD=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReadingImageTaskService.cs | 112 +++++++++++++----- .../Common/AuditingData.cs | 2 +- 2 files changed, 81 insertions(+), 33 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index a30bad09f..59ee1e8b1 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2196,51 +2196,99 @@ namespace IRaCIS.Core.Application.Service async Task addOrEditmark(List addOrUpdatemarkList) { + #region 老的代码 + //var markids = addOrUpdatemarkList.Select(x => x.MarkId).Where(x => x != null).Distinct().ToList(); - var markids= addOrUpdatemarkList.Select(x => x.MarkId).Where(x => x != null).Distinct().ToList(); + //var markQuestionIds = addOrUpdatemarkList.Select(y => (Guid?)y.QuestionId).ToList(); - var markQuestionIds= addOrUpdatemarkList.Select(y => (Guid?)y.QuestionId).ToList(); - - // 绑定的历史标记的话 相当于要把历史标记改为现在的标记 先删再添加 得到的结果一样 - await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => markids.Contains(x.MarkId)&&x.QuestionId==null ); + //// 绑定的历史标记的话 相当于要把历史标记改为现在的标记 先删再添加 得到的结果一样 + //await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => markids.Contains(x.MarkId) && x.QuestionId == null); - // 这里还不能直接删除 因为可能该问题绑定的原标记为a 现在新绑定的标记要为b 那么就需要把原标记a的绑定关系删除 + //// 这里还不能直接删除 因为可能该问题绑定的原标记为a 现在新绑定的标记要为b 那么就需要把原标记a的绑定关系删除 - var oldMark=await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId) && x.MarkId != null).ToListAsync(); + //var oldMark = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId) && x.MarkId != null).ToListAsync(); - // 这里稽查又要记录为新增 只能把原标记记录为先删除再添加 不然稽查又对不上 - List oldAddMark=new List (); + //// 这里稽查又要记录为新增 只能把原标记记录为先删除再添加 不然稽查又对不上 + //List oldAddMark = new List(); - foreach (var item in oldMark) + //foreach (var item in oldMark) + //{ + // if (addOrUpdatemarkList.Any(x => x.QuestionId == item.QuestionId && x.MarkId != item.MarkId)) + // { + // var olditem = item.Clone(); + + // olditem.QuestionId = null; + // olditem.TableQuestionId = null; + // olditem.RowId = null; + // olditem.RowIndex = null; + // oldAddMark.Add(olditem); + // } + //} + + //await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId)); + + //var datetime = DateTime.Now; + + //var markList = _mapper.Map, List>(addOrUpdatemarkList); + //markList.ForEach(x => + //{ + // x.Id = NewId.NextGuid(); + // x.VisitTaskId = inDto.VisitTaskId; + // x.CreateTime = datetime; + // x.FristAddTaskId = questionMarkList.Where(y => y.QuestionId == x.QuestionId).Select(x => x.FristAddTaskId).FirstOrDefault() ?? inDto.VisitTaskId; + //}); + //// 原来移除关系的 已经删除 这里要添加 为什么要先删再加 因为稽查需要记录 稽查的记录方式为Add + //oldAddMark.AddRange(markList); + //await _readingTaskQuestionMarkRepository.AddRangeAsync(oldAddMark); + #endregion + + foreach (var item in addOrUpdatemarkList) { - if (addOrUpdatemarkList.Any(x => x.QuestionId == item.QuestionId && x.MarkId != item.MarkId)) + var oldMark = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == item.QuestionId).FirstOrDefaultAsync(); + if (oldMark != null) { - var olditem = item.Clone(); + // 这种情况要先移除原来标记的绑定关系 + if (oldMark.MarkId != item.MarkId) + { + await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.Id == oldMark.Id, x => new ReadingTaskQuestionMark() + { + QuestionId = null, + TableQuestionId = null, + RowId = null, + RowIndex = null, + }); - olditem.QuestionId = null; - olditem.TableQuestionId = null; - olditem.RowId = null; - olditem.RowIndex = null; - oldAddMark.Add(olditem); + var newMark = _mapper.Map(item); + newMark.Id = NewId.NextGuid(); + newMark.VisitTaskId = inDto.VisitTaskId; + newMark.FristAddTaskId = inDto.VisitTaskId; + await _readingTaskQuestionMarkRepository.AddAsync(newMark); + } + else + { + // 这种情况直接更新 + await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.Id == oldMark.Id, x => new ReadingTaskQuestionMark() + { + MeasureData = item.MeasureData ?? string.Empty, + OtherMeasureData = item.OtherMeasureData ?? string.Empty, + PicturePath = item.PicturePath ?? string.Empty, + OtherPicturePath = item.OtherPicturePath ?? string.Empty, + MarkTool = item.MarkTool ?? string.Empty, + + }); + } + } + else + { + var newMark = _mapper.Map(item); + newMark.Id = NewId.NextGuid(); + newMark.VisitTaskId = inDto.VisitTaskId; + newMark.FristAddTaskId = inDto.VisitTaskId; + await _readingTaskQuestionMarkRepository.AddAsync(newMark); } } - await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId)); - - var datetime = DateTime.Now; - - var markList = _mapper.Map, List>(addOrUpdatemarkList); - markList.ForEach(x => - { - x.Id = NewId.NextGuid(); - x.VisitTaskId = inDto.VisitTaskId; - x.CreateTime = datetime; - x.FristAddTaskId = questionMarkList.Where(y => y.QuestionId == x.QuestionId).Select(x => x.FristAddTaskId).FirstOrDefault() ?? inDto.VisitTaskId; - }); - // 原来移除关系的 已经删除 这里要添加 为什么要先删再加 因为稽查需要记录 稽查的记录方式为Add - oldAddMark.AddRange(markList); - await _readingTaskQuestionMarkRepository.AddRangeAsync(oldAddMark); } diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 26bb4439e..0e830cf62 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -3181,7 +3181,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common TableQuestionName = tableQuestionName, Answer = answer, LiverSegmentation = liverSegmentation, - }, _userInfo.AuditIdentification); + }); } //保存影像质量 多条记录,只记录一条稽查 From 36750cc81cd21d88c5f510b4ce746bd32b41bf99 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 22 Jul 2025 15:33:56 +0800 Subject: [PATCH 04/10] =?UTF-8?q?Revert=20"=E4=BF=AE=E6=94=B9=E7=A8=BD?= =?UTF-8?q?=E6=9F=A5"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d93cfb6a4df0339f569e49c09935e3bfd0fc1641. --- .../ReadingImageTaskService.cs | 112 +++++------------- .../Common/AuditingData.cs | 2 +- 2 files changed, 33 insertions(+), 81 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 59ee1e8b1..a30bad09f 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2196,99 +2196,51 @@ namespace IRaCIS.Core.Application.Service async Task addOrEditmark(List addOrUpdatemarkList) { - #region 老的代码 - //var markids = addOrUpdatemarkList.Select(x => x.MarkId).Where(x => x != null).Distinct().ToList(); - //var markQuestionIds = addOrUpdatemarkList.Select(y => (Guid?)y.QuestionId).ToList(); + var markids= addOrUpdatemarkList.Select(x => x.MarkId).Where(x => x != null).Distinct().ToList(); - //// 绑定的历史标记的话 相当于要把历史标记改为现在的标记 先删再添加 得到的结果一样 - //await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => markids.Contains(x.MarkId) && x.QuestionId == null); + var markQuestionIds= addOrUpdatemarkList.Select(y => (Guid?)y.QuestionId).ToList(); + + // 绑定的历史标记的话 相当于要把历史标记改为现在的标记 先删再添加 得到的结果一样 + await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => markids.Contains(x.MarkId)&&x.QuestionId==null ); - //// 这里还不能直接删除 因为可能该问题绑定的原标记为a 现在新绑定的标记要为b 那么就需要把原标记a的绑定关系删除 + // 这里还不能直接删除 因为可能该问题绑定的原标记为a 现在新绑定的标记要为b 那么就需要把原标记a的绑定关系删除 - //var oldMark = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId) && x.MarkId != null).ToListAsync(); + var oldMark=await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId) && x.MarkId != null).ToListAsync(); - //// 这里稽查又要记录为新增 只能把原标记记录为先删除再添加 不然稽查又对不上 - //List oldAddMark = new List(); + // 这里稽查又要记录为新增 只能把原标记记录为先删除再添加 不然稽查又对不上 + List oldAddMark=new List (); - //foreach (var item in oldMark) - //{ - // if (addOrUpdatemarkList.Any(x => x.QuestionId == item.QuestionId && x.MarkId != item.MarkId)) - // { - // var olditem = item.Clone(); - - // olditem.QuestionId = null; - // olditem.TableQuestionId = null; - // olditem.RowId = null; - // olditem.RowIndex = null; - // oldAddMark.Add(olditem); - // } - //} - - //await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId)); - - //var datetime = DateTime.Now; - - //var markList = _mapper.Map, List>(addOrUpdatemarkList); - //markList.ForEach(x => - //{ - // x.Id = NewId.NextGuid(); - // x.VisitTaskId = inDto.VisitTaskId; - // x.CreateTime = datetime; - // x.FristAddTaskId = questionMarkList.Where(y => y.QuestionId == x.QuestionId).Select(x => x.FristAddTaskId).FirstOrDefault() ?? inDto.VisitTaskId; - //}); - //// 原来移除关系的 已经删除 这里要添加 为什么要先删再加 因为稽查需要记录 稽查的记录方式为Add - //oldAddMark.AddRange(markList); - //await _readingTaskQuestionMarkRepository.AddRangeAsync(oldAddMark); - #endregion - - foreach (var item in addOrUpdatemarkList) + foreach (var item in oldMark) { - var oldMark = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == item.QuestionId).FirstOrDefaultAsync(); - if (oldMark != null) + if (addOrUpdatemarkList.Any(x => x.QuestionId == item.QuestionId && x.MarkId != item.MarkId)) { - // 这种情况要先移除原来标记的绑定关系 - if (oldMark.MarkId != item.MarkId) - { - await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.Id == oldMark.Id, x => new ReadingTaskQuestionMark() - { - QuestionId = null, - TableQuestionId = null, - RowId = null, - RowIndex = null, - }); + var olditem = item.Clone(); - var newMark = _mapper.Map(item); - newMark.Id = NewId.NextGuid(); - newMark.VisitTaskId = inDto.VisitTaskId; - newMark.FristAddTaskId = inDto.VisitTaskId; - await _readingTaskQuestionMarkRepository.AddAsync(newMark); - } - else - { - // 这种情况直接更新 - await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.Id == oldMark.Id, x => new ReadingTaskQuestionMark() - { - MeasureData = item.MeasureData ?? string.Empty, - OtherMeasureData = item.OtherMeasureData ?? string.Empty, - PicturePath = item.PicturePath ?? string.Empty, - OtherPicturePath = item.OtherPicturePath ?? string.Empty, - MarkTool = item.MarkTool ?? string.Empty, - - }); - } - } - else - { - var newMark = _mapper.Map(item); - newMark.Id = NewId.NextGuid(); - newMark.VisitTaskId = inDto.VisitTaskId; - newMark.FristAddTaskId = inDto.VisitTaskId; - await _readingTaskQuestionMarkRepository.AddAsync(newMark); + olditem.QuestionId = null; + olditem.TableQuestionId = null; + olditem.RowId = null; + olditem.RowIndex = null; + oldAddMark.Add(olditem); } } + await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId)); + + var datetime = DateTime.Now; + + var markList = _mapper.Map, List>(addOrUpdatemarkList); + markList.ForEach(x => + { + x.Id = NewId.NextGuid(); + x.VisitTaskId = inDto.VisitTaskId; + x.CreateTime = datetime; + x.FristAddTaskId = questionMarkList.Where(y => y.QuestionId == x.QuestionId).Select(x => x.FristAddTaskId).FirstOrDefault() ?? inDto.VisitTaskId; + }); + // 原来移除关系的 已经删除 这里要添加 为什么要先删再加 因为稽查需要记录 稽查的记录方式为Add + oldAddMark.AddRange(markList); + await _readingTaskQuestionMarkRepository.AddRangeAsync(oldAddMark); } diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 0e830cf62..26bb4439e 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -3181,7 +3181,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common TableQuestionName = tableQuestionName, Answer = answer, LiverSegmentation = liverSegmentation, - }); + }, _userInfo.AuditIdentification); } //保存影像质量 多条记录,只记录一条稽查 From e3e83612fc66410b8e010cd3fec9d2c0a5588337 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 22 Jul 2025 15:57:15 +0800 Subject: [PATCH 05/10] =?UTF-8?q?Reapply=20"=E4=BF=AE=E6=94=B9=E7=A8=BD?= =?UTF-8?q?=E6=9F=A5"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 36750cc81cd21d88c5f510b4ce746bd32b41bf99. --- .../ReadingImageTaskService.cs | 112 +++++++++++++----- .../Common/AuditingData.cs | 2 +- 2 files changed, 81 insertions(+), 33 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index a30bad09f..59ee1e8b1 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2196,51 +2196,99 @@ namespace IRaCIS.Core.Application.Service async Task addOrEditmark(List addOrUpdatemarkList) { + #region 老的代码 + //var markids = addOrUpdatemarkList.Select(x => x.MarkId).Where(x => x != null).Distinct().ToList(); - var markids= addOrUpdatemarkList.Select(x => x.MarkId).Where(x => x != null).Distinct().ToList(); + //var markQuestionIds = addOrUpdatemarkList.Select(y => (Guid?)y.QuestionId).ToList(); - var markQuestionIds= addOrUpdatemarkList.Select(y => (Guid?)y.QuestionId).ToList(); - - // 绑定的历史标记的话 相当于要把历史标记改为现在的标记 先删再添加 得到的结果一样 - await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => markids.Contains(x.MarkId)&&x.QuestionId==null ); + //// 绑定的历史标记的话 相当于要把历史标记改为现在的标记 先删再添加 得到的结果一样 + //await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => markids.Contains(x.MarkId) && x.QuestionId == null); - // 这里还不能直接删除 因为可能该问题绑定的原标记为a 现在新绑定的标记要为b 那么就需要把原标记a的绑定关系删除 + //// 这里还不能直接删除 因为可能该问题绑定的原标记为a 现在新绑定的标记要为b 那么就需要把原标记a的绑定关系删除 - var oldMark=await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId) && x.MarkId != null).ToListAsync(); + //var oldMark = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId) && x.MarkId != null).ToListAsync(); - // 这里稽查又要记录为新增 只能把原标记记录为先删除再添加 不然稽查又对不上 - List oldAddMark=new List (); + //// 这里稽查又要记录为新增 只能把原标记记录为先删除再添加 不然稽查又对不上 + //List oldAddMark = new List(); - foreach (var item in oldMark) + //foreach (var item in oldMark) + //{ + // if (addOrUpdatemarkList.Any(x => x.QuestionId == item.QuestionId && x.MarkId != item.MarkId)) + // { + // var olditem = item.Clone(); + + // olditem.QuestionId = null; + // olditem.TableQuestionId = null; + // olditem.RowId = null; + // olditem.RowIndex = null; + // oldAddMark.Add(olditem); + // } + //} + + //await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId)); + + //var datetime = DateTime.Now; + + //var markList = _mapper.Map, List>(addOrUpdatemarkList); + //markList.ForEach(x => + //{ + // x.Id = NewId.NextGuid(); + // x.VisitTaskId = inDto.VisitTaskId; + // x.CreateTime = datetime; + // x.FristAddTaskId = questionMarkList.Where(y => y.QuestionId == x.QuestionId).Select(x => x.FristAddTaskId).FirstOrDefault() ?? inDto.VisitTaskId; + //}); + //// 原来移除关系的 已经删除 这里要添加 为什么要先删再加 因为稽查需要记录 稽查的记录方式为Add + //oldAddMark.AddRange(markList); + //await _readingTaskQuestionMarkRepository.AddRangeAsync(oldAddMark); + #endregion + + foreach (var item in addOrUpdatemarkList) { - if (addOrUpdatemarkList.Any(x => x.QuestionId == item.QuestionId && x.MarkId != item.MarkId)) + var oldMark = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == item.QuestionId).FirstOrDefaultAsync(); + if (oldMark != null) { - var olditem = item.Clone(); + // 这种情况要先移除原来标记的绑定关系 + if (oldMark.MarkId != item.MarkId) + { + await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.Id == oldMark.Id, x => new ReadingTaskQuestionMark() + { + QuestionId = null, + TableQuestionId = null, + RowId = null, + RowIndex = null, + }); - olditem.QuestionId = null; - olditem.TableQuestionId = null; - olditem.RowId = null; - olditem.RowIndex = null; - oldAddMark.Add(olditem); + var newMark = _mapper.Map(item); + newMark.Id = NewId.NextGuid(); + newMark.VisitTaskId = inDto.VisitTaskId; + newMark.FristAddTaskId = inDto.VisitTaskId; + await _readingTaskQuestionMarkRepository.AddAsync(newMark); + } + else + { + // 这种情况直接更新 + await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.Id == oldMark.Id, x => new ReadingTaskQuestionMark() + { + MeasureData = item.MeasureData ?? string.Empty, + OtherMeasureData = item.OtherMeasureData ?? string.Empty, + PicturePath = item.PicturePath ?? string.Empty, + OtherPicturePath = item.OtherPicturePath ?? string.Empty, + MarkTool = item.MarkTool ?? string.Empty, + + }); + } + } + else + { + var newMark = _mapper.Map(item); + newMark.Id = NewId.NextGuid(); + newMark.VisitTaskId = inDto.VisitTaskId; + newMark.FristAddTaskId = inDto.VisitTaskId; + await _readingTaskQuestionMarkRepository.AddAsync(newMark); } } - await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && markQuestionIds.Contains(x.QuestionId)); - - var datetime = DateTime.Now; - - var markList = _mapper.Map, List>(addOrUpdatemarkList); - markList.ForEach(x => - { - x.Id = NewId.NextGuid(); - x.VisitTaskId = inDto.VisitTaskId; - x.CreateTime = datetime; - x.FristAddTaskId = questionMarkList.Where(y => y.QuestionId == x.QuestionId).Select(x => x.FristAddTaskId).FirstOrDefault() ?? inDto.VisitTaskId; - }); - // 原来移除关系的 已经删除 这里要添加 为什么要先删再加 因为稽查需要记录 稽查的记录方式为Add - oldAddMark.AddRange(markList); - await _readingTaskQuestionMarkRepository.AddRangeAsync(oldAddMark); } diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 26bb4439e..0e830cf62 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -3181,7 +3181,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common TableQuestionName = tableQuestionName, Answer = answer, LiverSegmentation = liverSegmentation, - }, _userInfo.AuditIdentification); + }); } //保存影像质量 多条记录,只记录一条稽查 From 5ea31ee1b057e96d79bb6828713c49e40cc6596b Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 22 Jul 2025 16:13:04 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/AuditingData.cs | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 0e830cf62..c2627720d 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -3168,11 +3168,23 @@ namespace IRaCIS.Core.Infra.EFCore.Common generalId = IdentifierHelper.CreateGuid(entity.VisitTaskId.ToString(), entity.QuestionId.ToString(), entity.RowId.ToString(), entity.TableQuestionId.ToString(), "ReadingTaskQuestionMark"); } + + bool isDistinctionInterface = true; + var customPrefix=string.Empty; + // 自定义表格 和问题添加标记的时候 要记录为 添加标记 + if ((_userInfo.RequestUrl == "ReadingImageTask/saveVisitTaskQuestions" + || _userInfo.RequestUrl == "saveTableQuestionMark/-10") && type== "Add") + { + isDistinctionInterface = false; + customPrefix = "ReadingImageTask/submitCustomTag"; + } + await InsertInspection(entity, type, x => new InspectionConvertDTO() { VisitTaskId = entity.VisitTaskId, GeneralId = generalId, ObjectRelationParentId = entity.VisitTaskId, + IsDistinctionInterface = isDistinctionInterface, }, new { @@ -3181,7 +3193,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common TableQuestionName = tableQuestionName, Answer = answer, LiverSegmentation = liverSegmentation, - }); + },string.Empty, customPrefix); } //保存影像质量 多条记录,只记录一条稽查 @@ -3996,8 +4008,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common /// 类型 /// 表达式 /// 其他对象 + /// 额外标识 + /// 自定义前缀 /// - public async Task InsertInspection(T entityObj, string type, Expression> expression = null, object otherItem = null, string auditIdentification = "") where T : Entity + public async Task InsertInspection(T entityObj, string type, Expression> expression = null, object otherItem = null, string auditIdentification = "", string customPrefix = "") where T : Entity { InspectionConvertDTO inspection = new InspectionConvertDTO(); @@ -4014,7 +4028,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common var generalId = (inspection.GeneralId != null && inspection.GeneralId != Guid.Empty) ? inspection.GeneralId : entityObj.Id; inspection.GeneralId = generalId; - inspection.Identification = GetInspectionRecordIdentification(entityObj, type, inspection.IsDistinctionInterface, inspection.IsSelfDefine, auditIdentification) + inspection.ExtraIndentification; + inspection.Identification = GetInspectionRecordIdentification(entityObj, type, inspection.IsDistinctionInterface, inspection.IsSelfDefine, auditIdentification, customPrefix) + inspection.ExtraIndentification; //将实体对象属性 映射到稽查实体 MapEntityPropertyToAuditEntity(entityObj, inspection); @@ -4224,7 +4238,15 @@ namespace IRaCIS.Core.Infra.EFCore.Common /// 获取稽查记录的标识符 部分业务会进行特殊处理 /// /// - public string GetInspectionRecordIdentification(T entityObj, string type, bool IsDistinctionInterface = true, bool isSelfDefine = false, string auditIdentification = "") + /// + /// + /// + /// + /// + /// + /// 自定义前缀 某些接口需要用同一个稽查 + /// + public string GetInspectionRecordIdentification(T entityObj, string type, bool IsDistinctionInterface = true, bool isSelfDefine = false, string auditIdentification = "",string customPrefix="") { //var entityType = _dbContext.Model.FindEntityType(entityObj.GetType()); //var tableName = entityType.GetTableName(); @@ -4271,6 +4293,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common result = result + "/" + auditIdentification; } + if (customPrefix.IsNotNullOrEmpty()) + { + result = customPrefix+"/"+ result + "/"; + } + return result; } From 18d2ea7d3117e9d752a5280157a3a9eb5fb61f70 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 22 Jul 2025 16:18:01 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index c2627720d..cc087a636 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -3172,7 +3172,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common bool isDistinctionInterface = true; var customPrefix=string.Empty; // 自定义表格 和问题添加标记的时候 要记录为 添加标记 - if ((_userInfo.RequestUrl == "ReadingImageTask/saveVisitTaskQuestions" + if ((_userInfo.RequestUrl == "SaveTaskQuestion/-10" || _userInfo.RequestUrl == "saveTableQuestionMark/-10") && type== "Add") { isDistinctionInterface = false; From a8224aa0183ccd79dc01d7cfa4691d634260b60f Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 22 Jul 2025 16:22:52 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index cc087a636..729539dfa 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -4295,7 +4295,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common if (customPrefix.IsNotNullOrEmpty()) { - result = customPrefix+"/"+ result + "/"; + result = customPrefix + "/" + result; } return result; From 85ff14f1607af98fe1f4b0ad6bea2eb78357b18f Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Wed, 23 Jul 2025 09:08:57 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E7=A8=BD=E6=9F=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReadingImageTaskService.cs | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 59ee1e8b1..bf5aaddd8 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2281,11 +2281,35 @@ namespace IRaCIS.Core.Application.Service } else { - var newMark = _mapper.Map(item); - newMark.Id = NewId.NextGuid(); - newMark.VisitTaskId = inDto.VisitTaskId; - newMark.FristAddTaskId = inDto.VisitTaskId; - await _readingTaskQuestionMarkRepository.AddAsync(newMark); + // 这种情况可能是绑定历史的标记 + + if (item.MarkId != null && (await _readingTaskQuestionMarkRepository.AnyAsync(x => x.VisitTaskId == inDto.VisitTaskId&& x.QuestionId == null && x.MarkId == item.MarkId))) + { + + var oldMarkItem = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.MarkId == item.MarkId && x.QuestionId == null).FirstOrDefaultAsync(); + + await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.Id == oldMarkItem.Id, x => new ReadingTaskQuestionMark() + { + QuestionId = item.QuestionId, + TableQuestionId = item.TableQuestionId, + RowId = item.RowId, + MeasureData = item.MeasureData ?? string.Empty, + OtherMeasureData = item.OtherMeasureData ?? string.Empty, + PicturePath = item.PicturePath ?? string.Empty, + OtherPicturePath = item.OtherPicturePath ?? string.Empty, + MarkTool = item.MarkTool ?? string.Empty, + }); + } + else + { + var newMark = _mapper.Map(item); + newMark.Id = NewId.NextGuid(); + newMark.VisitTaskId = inDto.VisitTaskId; + newMark.FristAddTaskId = inDto.VisitTaskId; + await _readingTaskQuestionMarkRepository.AddAsync(newMark); + } + + } } From 76fe4ae8a81df9576f5883adbfd9bf6dfdbfd2ba Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Wed, 23 Jul 2025 09:16:38 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 729539dfa..d062cb454 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -3171,9 +3171,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common bool isDistinctionInterface = true; var customPrefix=string.Empty; + + // 对于一个标记绑定两个问题的不计稽查 + var exixtsMark = await _dbContext.ReadingTaskQuestionMark.AnyAsync(t => t.MarkId == entity.MarkId); // 自定义表格 和问题添加标记的时候 要记录为 添加标记 if ((_userInfo.RequestUrl == "SaveTaskQuestion/-10" - || _userInfo.RequestUrl == "saveTableQuestionMark/-10") && type== "Add") + || _userInfo.RequestUrl == "saveTableQuestionMark/-10") && type== "Add"&&!exixtsMark) { isDistinctionInterface = false; customPrefix = "ReadingImageTask/submitCustomTag";