From fdb32f8a94ccb20034977462ab3f3719a7f80b2f Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Wed, 30 Mar 2022 14:30:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/InspectionController.cs | 11 +-- .../IRaCIS.Core.Application.xml | 37 ++++++++ .../Common/DTO/FrontAuditConfigViewModel.cs | 8 ++ .../Service/Common/FrontAuditConfigService.cs | 3 + .../Service/Inspection/DTO/InspectionModel.cs | 30 +++++++ .../Service/Inspection/InspectionService.cs | 85 ++++++++++++++++++- IRaCIS.Core.Domain/Common/FrontAuditConfig.cs | 7 ++ IRaCIS.Core.Domain/Trial/DataInspection.cs | 5 +- 8 files changed, 176 insertions(+), 10 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/InspectionController.cs b/IRaCIS.Core.API/Controllers/InspectionController.cs index 78e0bc10e..8d2df1464 100644 --- a/IRaCIS.Core.API/Controllers/InspectionController.cs +++ b/IRaCIS.Core.API/Controllers/InspectionController.cs @@ -137,21 +137,18 @@ namespace IRaCIS.Core.API.Controllers public async Task AddOrUpdateSubject(InsSubjectCommand opt) { - + opt.AuditInfo.SubjectName = opt.OptCommand.ShortName; var fun = await _subjectService.AddOrUpdateSubject(opt.OptCommand); + opt.AuditInfo.SubjectId = Guid.Parse(fun.Data); var statusdata = new { Status = 1, - OutEnrollmentTime = DateTime.Now.ToString("yyyy-MM-dd"), - VisitOverTime = DateTime.Now.ToString("yyyy-MM-dd"), + //OutEnrollmentTime = DateTime.Now.ToString("yyyy-MM-dd"), + //VisitOverTime = DateTime.Now.ToString("yyyy-MM-dd"), Reason = string.Empty, }; - - - - return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun, statusdata); } diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 1736c74e8..0df7fc7a5 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -600,6 +600,36 @@ 子类 + + + 创建人名称 + + + + + 项目名称 + + + + + 中心名称 + + + + + 受试者名称 + + + + + 访视名称 + + + + + 角色名称 + + 配置 基础逻辑信息 @@ -704,6 +734,13 @@ 初始化状态对象 + + + 设置项目以及名称 + + + + 项目外部人员 录入流程相关 diff --git a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs index ce07b8013..0a667ce46 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs @@ -42,6 +42,10 @@ namespace IRaCIS.Core.Application.ViewModel public int? Sort { get; set; } + public string? EnumList { get; set; } + + public string? DictionaryKey { get; set; } + } @@ -93,6 +97,10 @@ namespace IRaCIS.Core.Application.ViewModel public int? Sort { get; set; } + public string EnumList { get; set; } = string.Empty; + + public string DictionaryKey { get; set; } = string.Empty; + } diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs index ebc523445..a83a64975 100644 --- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs @@ -70,6 +70,9 @@ namespace IRaCIS.Core.Application.Service Sort=data.Sort, ValueCN = data.ValueCN, ChildrenTypeValue = leftchildrenType.Value, + EnumList=data.EnumList, + DictionaryKey=data.DictionaryKey + }; query = query diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs index 3cfb86dfa..e7098a26b 100644 --- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs +++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs @@ -35,7 +35,35 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO public bool IsSign { get; set; } public string JsonDetail { get; set; } = string.Empty; + /// + /// 创建人名称 + /// + public string CreateUserName { get; set; } = string.Empty; + /// + /// 项目名称 + /// + public string TrialName { get; set; } = string.Empty; + + /// + /// 中心名称 + /// + public string SiteName { get; set; } = string.Empty; + + /// + /// 受试者名称 + /// + public string SubjectName { get; set; } = string.Empty; + + /// + /// 访视名称 + /// + public string SubjectVisitName { get; set; } = string.Empty; + + /// + /// 角色名称 + /// + public string RoleName { get; set; } = string.Empty; ////需要单独处理 @@ -144,6 +172,8 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO public string SubjectCode { get; set; } = string.Empty; + + } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index f88b50ae7..538f7f39d 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -68,6 +68,11 @@ namespace IRaCIS.Core.Application.Service.Inspection UserFirstName = leftuser.FirstName, UserLastName = leftuser.LastName, SubjectCode=leftsubject.Code, + SubjectName=data.SubjectName, + SubjectVisitName=data.SubjectVisitName, + CreateUserName = data.CreateUserName, + RoleName=data.RoleName, + TrialName=data.TrialName, }; query = query.WhereIf(!dto.BlindName.IsNullOrEmpty(), x => x.BlindName == dto.BlindName) @@ -245,6 +250,7 @@ namespace IRaCIS.Core.Application.Service.Inspection add.CreateUserId = _userInfo.Id; add.SignId = signId; add.IP = _userInfo.IP; + await SetInspectionNameValue(add); await _repository.AddAsync(add); if (addDto.OptType.ToLower() == "Add".ToLower()&& Statusdata!=null) { @@ -265,7 +271,13 @@ namespace IRaCIS.Core.Application.Service.Inspection IP = add.IP, ModuleType = add.ModuleType, TrialId = add.TrialId, - JsonDetail = JsonConvert.SerializeObject(Statusdata) + JsonDetail = JsonConvert.SerializeObject(Statusdata), + TrialName=add.TrialName, + SiteName=add.SiteName, + SubjectName=add.SubjectName, + SubjectVisitName=add.SubjectVisitName, + CreateUserName=add.CreateUserName, + RoleName=add.RoleName, }; await _repository.AddAsync(ststus); @@ -275,5 +287,76 @@ namespace IRaCIS.Core.Application.Service.Inspection return ResponseOutput.Ok(success); } + + /// + /// 设置项目以及名称 + /// + /// + /// + public async Task SetInspectionNameValue(DataInspection Data) + { + #region 项目名称 + if (Data.TrialName.IsNullOrEmpty()) + { + Data.TrialName = (await _repository.GetQueryable().FirstOrDefaultAsync(x => x.Id == Data.TrialId))?.ExperimentName; + } + #endregion + + + #region 测试中心名称 + if (Data.SiteName.IsNullOrEmpty()) + { + Data.SiteName = (await _repository.GetQueryable().FirstOrDefaultAsync(x => x.Id == Data.SiteId))?.SiteName; + } + #endregion + + #region 受试者 + if (Data.SubjectName.IsNullOrEmpty()) + { + var subjectdata = await _repository.GetQueryable().FirstOrDefaultAsync(x => x.Id == Data.SubjectId); + if (subjectdata != null) + { + Data.SubjectName = subjectdata.FirstName + subjectdata.LastName; + } + } + #endregion + + #region 访视 + if (Data.SubjectVisitName.IsNullOrEmpty()) + { + Data.SubjectVisitName = (await _repository.GetQueryable().FirstOrDefaultAsync(x => x.Id == Data.SubjectVisitId))?.VisitName; + } + #endregion + + #region 创建者 + if (Data.CreateUserName.IsNullOrEmpty() || Data.RoleName.IsNullOrEmpty()) + { + var userdata = await _repository.GetQueryable().Where(x => x.Id == Data.CreateUserId).GroupJoin(_repository.GetQueryable(), a => a.UserTypeId, b => b.Id, (a, b) => new + { + UserName = a.FirstName + a.LastName, + Role = b + }).SelectMany(a => a.Role, (m, n) => new + { + UserName = m.UserName, + RoleName = n.UserTypeShortName + }).FirstOrDefaultAsync(); + + if (userdata != null) + { + if (Data.CreateUserName.IsNullOrEmpty()) + { + Data.CreateUserName = userdata?.UserName; + } + + + if (Data.RoleName.IsNullOrEmpty()) + { + Data.RoleName = userdata?.RoleName; + } + } + } + #endregion + + } } } diff --git a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs index 47fa11975..caca40986 100644 --- a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs +++ b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs @@ -101,6 +101,13 @@ namespace IRaCIS.Core.Domain.Models public int? Sort { get; set; } + + public string EnumList { get; set; } + + public string DictionaryKey { get; set; } + + + } } diff --git a/IRaCIS.Core.Domain/Trial/DataInspection.cs b/IRaCIS.Core.Domain/Trial/DataInspection.cs index d7bef0159..54d9c1a12 100644 --- a/IRaCIS.Core.Domain/Trial/DataInspection.cs +++ b/IRaCIS.Core.Domain/Trial/DataInspection.cs @@ -120,11 +120,12 @@ namespace IRaCIS.Core.Domain.Models public string SubjectName { get; set; } /// - /// 创建人名称 + /// 访视名称 /// public string SubjectVisitName { get; set; } + /// - /// 创建人名称 + /// 角色名称 /// public string RoleName { get; set; }