From 8fdfe16dd28565afcb84d64102ad72f1d14ed9fd Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Wed, 30 Mar 2022 17:01:00 +0800 Subject: [PATCH] =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 10 +++++ .../Service/Inspection/DTO/InspectionModel.cs | 11 +++++ .../Service/Inspection/InspectionService.cs | 45 ++++++++----------- IRaCIS.Core.Domain/Trial/DataInspection.cs | 10 +++++ .../Context/IRaCISDBContext.cs | 6 ++- 5 files changed, 55 insertions(+), 27 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 668684c3c..8e2cd6ce7 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -630,6 +630,16 @@ 角色名称 + + + 中心Code + + + + + 项目编码 + + 配置 基础逻辑信息 diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs index 26a986ced..2f1d6c296 100644 --- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs +++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs @@ -66,6 +66,17 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO public string RoleName { get; set; } = string.Empty; + /// + /// 中心Code + /// + public string SiteCode { get; set; } = string.Empty; + + /// + /// 项目编码 + /// + public string ResearchProgramNo { get; set; } = string.Empty; + + ////需要单独处理 //public string IP { get; set; } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index fbf201a03..a2a050b66 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -73,6 +73,8 @@ namespace IRaCIS.Core.Application.Service.Inspection CreateUserName = data.CreateUserName, RoleName=data.RoleName, TrialName=data.TrialName, + SiteCode=data.SiteCode, + ResearchProgramNo=data.ResearchProgramNo, }; query = query.WhereIf(!dto.BlindName.IsNullOrEmpty(), x => x.BlindName == dto.BlindName) @@ -254,32 +256,14 @@ namespace IRaCIS.Core.Application.Service.Inspection await _repository.AddAsync(add); if (addDto.OptType.ToLower() == "Add".ToLower()&& Statusdata!=null) { - - DataInspection ststus = new DataInspection() - { - SignId = signId, - SiteId = add.SiteId, - SubjectId = add.SubjectId, - SubjectVisitId = add.SubjectVisitId, - IsSign = add.IsSign, - BlindName = add.BlindName, - ChildrenType = "Status", - OptType = "Init", - CreateTime = add.CreateTime.AddSeconds(1), - CreateUserId = add.CreateUserId, - IP = add.IP, - ModuleType = add.ModuleType, - TrialId = add.TrialId, - JsonDetail = JsonConvert.SerializeObject(Statusdata), - TrialName=add.TrialName, - SiteName=add.SiteName, - SubjectCode = add.SubjectCode, - SubjectVisitName=add.SubjectVisitName, - CreateUserName=add.CreateUserName, - RoleName=add.RoleName, - }; + DataInspection ststus=JsonConvert.DeserializeObject(JsonConvert.SerializeObject(add))??new DataInspection(); + ststus.CreateTime = add.CreateTime.AddSeconds(1); + ststus.JsonDetail = JsonConvert.SerializeObject(Statusdata); + ststus.ChildrenType = "Status"; + ststus.OptType = "Init"; + ststus.Id = Guid.NewGuid(); await _repository.AddAsync(ststus); } @@ -296,23 +280,32 @@ namespace IRaCIS.Core.Application.Service.Inspection public async Task SetInspectionNameValue(DataInspection Data) { #region 项目名称 + + var trialdata = await _repository.GetQueryable().FirstOrDefaultAsync(x => x.Id == Data.TrialId); + Data.ResearchProgramNo = trialdata?.ResearchProgramNo; if (Data.TrialName.IsNullOrEmpty()) { - Data.TrialName = (await _repository.GetQueryable().FirstOrDefaultAsync(x => x.Id == Data.TrialId))?.ExperimentName; + Data.TrialName = trialdata?.ExperimentName; } #endregion #region 测试中心名称 + + var sitedata = await _repository.GetQueryable().FirstOrDefaultAsync(x => x.Id == Data.SiteId); + Data.SiteCode = sitedata?.SiteCode; if (Data.SiteName.IsNullOrEmpty()) { - Data.SiteName = (await _repository.GetQueryable().FirstOrDefaultAsync(x => x.Id == Data.SiteId))?.SiteName; + Data.SiteName = sitedata?.SiteName; } #endregion #region 受试者 + + if (Data.SubjectCode.IsNullOrEmpty()) { + Data.SubjectCode = (await _repository.GetQueryable().FirstOrDefaultAsync(x => x.Id == Data.SubjectId))?.Code; } #endregion diff --git a/IRaCIS.Core.Domain/Trial/DataInspection.cs b/IRaCIS.Core.Domain/Trial/DataInspection.cs index 36c85d26b..5e06dba41 100644 --- a/IRaCIS.Core.Domain/Trial/DataInspection.cs +++ b/IRaCIS.Core.Domain/Trial/DataInspection.cs @@ -129,6 +129,16 @@ namespace IRaCIS.Core.Domain.Models /// public string RoleName { get; set; } + /// + /// 中心Code + /// + public string SiteCode { get; set; } + + /// + /// 项目编码 + /// + public string ResearchProgramNo { get; set; } + } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 4e238decd..83c9a8810 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -307,7 +307,11 @@ namespace IRaCIS.Core.Infra.EFCore case EntityState.Added: if (t.Entity is IAuditAdd addEntity) { - addEntity.CreateTime = DateTime.UtcNow.AddHours(8); + if (addEntity.CreateTime == default(DateTime)) + { + addEntity.CreateTime = DateTime.UtcNow.AddHours(8); + } + addEntity.CreateUserId = _userInfo.Id; }