From b825d8f55a2929cc730ae161cfb7ebdc5ef03e3a Mon Sep 17 00:00:00 2001 From: "{872297557@qq.com}" <872297557@qq.com> Date: Fri, 9 Dec 2022 14:19:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A8=BD=E6=9F=A5=E6=A0=87?= =?UTF-8?q?=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs | 1 + .../ReadingImageTaskService.cs | 1 - .../Triggers/ChallengeStateTrigger.cs | 5 ++ .../Triggers/TableQuestionRowTrigger.cs | 55 +++++++++++++++++++ .../ReadingTableAnswerRowInfo.cs | 49 +---------------- .../Common/AuditingData.cs | 26 +++++++-- 6 files changed, 85 insertions(+), 52 deletions(-) create mode 100644 IRaCIS.Core.Application/Triggers/TableQuestionRowTrigger.cs diff --git a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs index 4e17364b..ac0e9fad 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs @@ -41,6 +41,7 @@ namespace IRaCIS.Core.API triggerOptions.AddTrigger(); triggerOptions.AddTrigger(); triggerOptions.AddTrigger(); + triggerOptions.AddTrigger(); }); diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index b134ebc2..c3e1e806 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -1183,7 +1183,6 @@ namespace IRaCIS.Application.Services await _readingTableQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => x.RowId == inDto.RowId && x.TableQuestionId == item.TableQuestionId, x => new ReadingTableQuestionAnswer() { - Answer = item.Answer }); diff --git a/IRaCIS.Core.Application/Triggers/ChallengeStateTrigger.cs b/IRaCIS.Core.Application/Triggers/ChallengeStateTrigger.cs index 7d6fcc1f..24431b77 100644 --- a/IRaCIS.Core.Application/Triggers/ChallengeStateTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/ChallengeStateTrigger.cs @@ -3,6 +3,7 @@ using IRaCIS.Core.Domain.Share; namespace IRaCIS.Core.Application.Triggers { + //访视 质疑状态 触发修改 public class ChallengeStateTrigger : IAfterSaveTrigger { @@ -40,4 +41,8 @@ namespace IRaCIS.Core.Application.Triggers u => new SubjectVisit() { ChallengeState = subjectVisitChallengeState }); } } + + + + } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Triggers/TableQuestionRowTrigger.cs b/IRaCIS.Core.Application/Triggers/TableQuestionRowTrigger.cs new file mode 100644 index 00000000..0fa72d52 --- /dev/null +++ b/IRaCIS.Core.Application/Triggers/TableQuestionRowTrigger.cs @@ -0,0 +1,55 @@ +using EntityFrameworkCore.Triggered; +using IRaCIS.Core.Domain.Share; + +namespace IRaCIS.Core.Application.Triggers +{ + //病灶编号维护 + public class TableQuestionRowTrigger : IBeforeSaveTrigger + { + + + public Task BeforeSave(ITriggerContext context, CancellationToken cancellationToken) + { + Dictionary splitLesionDic = new Dictionary() + { + {1, "a" }, + {2, "b" }, + {3, "c" }, + {4, "d" }, + {5, "e" }, + {6, "f" }, + {7, "g" }, + {8, "h" }, + {9, "i" }, + {10, "j" }, + {11, "k" }, + {12, "l" }, + {13, "m" }, + {14, "n" }, + {15, "o" }, + {16, "p" }, + {17, "q" }, + {18, "r" }, + {19, "s" }, + {20, "t" }, + {21, "u" }, + {22, "v" }, + {23, "w" }, + {24, "x" }, + {25, "y" }, + {26, "z" }, + + }; + if (context.Entity.RowIndex % 1 == 0) + { + context.Entity.RowMark = context.Entity.OrderMark + decimal.ToInt32(context.Entity.RowIndex).ToString().PadLeft(2, '0'); + } + else + { + context.Entity.RowMark = context.Entity.OrderMark + Math.Floor(context.Entity.RowIndex).ToString().PadLeft(2, '0') + splitLesionDic[decimal.ToInt32((context.Entity.RowIndex % 1) * 100)]; + } + + return Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs index 5b0b2de0..135a2fc4 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs @@ -142,54 +142,9 @@ namespace IRaCIS.Core.Domain.Models public ReadingQuestionTrial ReadingQuestionTrial { get; set; } - public string RowMark - { - - get - { - - Dictionary splitLesionDic = new Dictionary() - { - {1, "a" }, - {2, "b" }, - {3, "c" }, - {4, "d" }, - {5, "e" }, - {6, "f" }, - {7, "g" }, - {8, "h" }, - {9, "i" }, - {10, "j" }, - {11, "k" }, - {12, "l" }, - {13, "m" }, - {14, "n" }, - {15, "o" }, - {16, "p" }, - {17, "q" }, - {18, "r" }, - {19, "s" }, - {20, "t" }, - {21, "u" }, - {22, "v" }, - {23, "w" }, - {24, "x" }, - {25, "y" }, - {26, "z" }, - - }; - if (RowIndex % 1 == 0) - { - return this.OrderMark+ decimal.ToInt32(RowIndex).ToString().PadLeft(2, '0'); - } - else - { - return this.OrderMark + Math.Floor(RowIndex).ToString().PadLeft(2, '0') + splitLesionDic[decimal.ToInt32((RowIndex % 1) * 100)]; - } - - } - } + public string RowMark { get; set; } = string.Empty; + } diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index fb4466a4..c6616254 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -670,8 +670,23 @@ namespace IRaCIS.Core.Infra.EFCore.Common var trialReadingCriterionId = tableQuesionList.FirstOrDefault()?.TrialReadingCriterionId; - //获取表名称 类型名称(病灶类型) - var tableName = await _dbContext.ReadingQuestionTrial.Where(t => t.Id == entity.QuestionId).Select(t => t.QuestionName).FirstOrDefaultAsync(); + //获取表名称 类型名称(病灶类型) 不用查 从项目问题的稽查记录里面去取 + //var tableName = await _dbContext.ReadingQuestionTrial.Where(t => t.Id == entity.QuestionId).Select(t => t.QuestionName).FirstOrDefaultAsync(); + + //分裂病灶 需要原病灶的标识 + + //if (_userInfo.RequestUrl == " ReadingImageTask/splitLesion") + + var originalName = string.Empty; + if (entity.SplitRowId != null) + { + + originalName= await _dbContext.ReadingTableAnswerRowInfo.Where(t => t.Id == entity.SplitRowId).Select(t => t.RowMark).FirstOrDefaultAsync(); + } + + + + await InsertInspection(entity, type, x => new InspectionConvertDTO() { @@ -679,11 +694,14 @@ namespace IRaCIS.Core.Infra.EFCore.Common ObjectRelationParentId = x.VisitTaskId, - TrialReadingCriterionId = trialReadingCriterionId + TrialReadingCriterionId = trialReadingCriterionId, + + ObjectRelationParentId2 = x.QuestionId }, new { - TableName= tableName, + OriginalName= originalName, + //TableName = tableName, QuestionAnswerList = //需要手动添加病灶类型