From 00cdea630c2f15054a7814422213c16b92e88f6f Mon Sep 17 00:00:00 2001 From: "{872297557@qq.com}" <872297557@qq.com> Date: Tue, 20 Dec 2022 11:20:54 +0800 Subject: [PATCH] =?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 --- IRaCIS.Core.Domain/SQLFile/Test.sql | 3 +++ IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs | 14 +++++++++----- .../Common/Dto/SetDictionaryValueDto.cs | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Domain/SQLFile/Test.sql b/IRaCIS.Core.Domain/SQLFile/Test.sql index 45b6e89f0..5f8139169 100644 --- a/IRaCIS.Core.Domain/SQLFile/Test.sql +++ b/IRaCIS.Core.Domain/SQLFile/Test.sql @@ -148,5 +148,8 @@ update DataInspection set VisitTaskId= substring(JsonDetail,CHARINDEX('VisitTask update DataInspection set VisitTaskId= substring(JsonDetail,CHARINDEX('VisitTaskId":"',JsonDetail)+14,36) where EntityName='ReadingMedicineQuestionAnswer' +update DataInspection set SubjectVisitId=null where EntityName='ReadModule' + + diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 97f8b3cd3..4d002f030 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -873,12 +873,15 @@ namespace IRaCIS.Core.Infra.EFCore.Common //保证Id 唯一 cloneEntity.Id = IdentifierHelper.CreateGuid(firstEntity.GlobalTaskId.ToString(), firstEntity.TaskId.ToString()); + var trialReadingCriterionId = await _dbContext.VisitTask.Where(t => t.Id == cloneEntity.GlobalTaskId).Select(t => t.TrialReadingCriterionId).FirstOrDefaultAsync(); await InsertInspection(cloneEntity, type, x => new InspectionConvertDTO() { VisitTaskId = x.TaskId, + TrialReadingCriterionId= trialReadingCriterionId, + ObjectRelationParentId = x.TaskId, }, new { Reason = group.Where(t => t.QuestionId == null && t.GlobalAnswerType == GlobalAnswerType.Reason).FirstOrDefault()?.Answer, @@ -1796,7 +1799,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common ObjectRelationParentId2 = entity.TrialReadingCriterionId, - SubjectVisitId = x.SubjectVisitId, + //SubjectVisitId = x.SubjectVisitId, IsDistinctionInterface = false, }); } @@ -2056,18 +2059,19 @@ namespace IRaCIS.Core.Infra.EFCore.Common SiteId = inspection.SiteId, SubjectId = inspection.SubjectId, SubjectVisitId = inspection.SubjectVisitId, - TrialId = inspection.TrialId + TrialId = inspection.TrialId, + TrialReadingCriterionId=inspection.TrialReadingCriterionId }; if (inspection.VisitTaskId != null) { - if (generalData.TrialId == null || generalData.SiteId == null || generalData.SubjectId == null) + if (generalData.TrialId == null || generalData.SiteId == null || generalData.SubjectId == null || generalData.TrialReadingCriterionId == null) { - var info = await _dbContext.VisitTask.Where(x => x.Id == inspection.VisitTaskId).Select(x => new { SubjectCode = x.Subject.Code, TrialSiteCode = x.Subject.TrialSite.TrialSiteCode, SubjectId = x.SubjectId, x.Subject.SiteId, x.TrialId, x.SourceSubjectVisitId, ReadModuleSubjectVisitId = (Guid?)x.ReadModule.SubjectVisitId }).FirstOrDefaultAsync(); - + var info = await _dbContext.VisitTask.Where(x => x.Id == inspection.VisitTaskId).Select(x => new { SubjectCode = x.Subject.Code, TrialSiteCode = x.Subject.TrialSite.TrialSiteCode, SubjectId = x.SubjectId, x.Subject.SiteId, x.TrialId, x.SourceSubjectVisitId, ReadModuleSubjectVisitId = (Guid?)x.ReadModule.SubjectVisitId ,x.TrialReadingCriterionId }).FirstOrDefaultAsync(); + generalData.TrialReadingCriterionId= info?.TrialReadingCriterionId ?? generalData.TrialReadingCriterionId; generalData.TrialId = info?.TrialId ?? generalData.TrialId; generalData.SubjectId = info?.SubjectId ?? generalData.SubjectId; generalData.SiteId = info?.SiteId ?? generalData.SiteId; diff --git a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs index 48fed4357..11404e29b 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs @@ -178,6 +178,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto /// public Guid? SubjectVisitId { get; set; } + public Guid? TrialReadingCriterionId { get; set; } + /// /// 项目名称