From 29f4a731686abb54067260493b03d717aad5eb46 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 30 May 2022 16:08:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E7=BB=9F=E4=B8=80=E5=AE=9E=E4=BD=93=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_PipelineExtensions/AuthMiddleware.cs | 2 +- IRaCIS.Core.API/appsettings.json | 30 +++---- .../Config/_AppSettings.cs | 89 +++++++++++++++++++ .../Config}/_StaticData.cs | 0 .../IRaCIS.Core.Application.xml | 15 ++++ .../Service/Doctor/DoctorService.cs | 2 +- .../ImageAndDoc/DicomArchiveService.cs | 2 +- .../Service/Management/UserService.cs | 2 +- .../Service/QC/NoneDicomStudyService.cs | 3 +- .../Service/QC/QCOperationService.cs | 2 +- .../SiteSurvey/TrialSiteSurveyService.cs | 4 +- .../TrialSiteUser/TrialExternalUserService.cs | 2 +- .../ServiceVerifyConfigOption.cs | 19 ---- IRaCIS.Core.Domain.Share/_AppSettings.cs | 82 ----------------- 14 files changed, 126 insertions(+), 128 deletions(-) create mode 100644 IRaCIS.Core.Application/Config/_AppSettings.cs rename {IRaCIS.Core.Domain.Share => IRaCIS.Core.Application/Config}/_StaticData.cs (100%) delete mode 100644 IRaCIS.Core.Domain.Share/ServiceVerifyConfigOption.cs delete mode 100644 IRaCIS.Core.Domain.Share/_AppSettings.cs diff --git a/IRaCIS.Core.API/_PipelineExtensions/AuthMiddleware.cs b/IRaCIS.Core.API/_PipelineExtensions/AuthMiddleware.cs index 7308942e6..9f0a73355 100644 --- a/IRaCIS.Core.API/_PipelineExtensions/AuthMiddleware.cs +++ b/IRaCIS.Core.API/_PipelineExtensions/AuthMiddleware.cs @@ -54,7 +54,7 @@ namespace IRaCIS.WX.CoreApi.Auth } else { - await _provider.SetAsync(userId.ToString(), userId.ToString(), TimeSpan.FromMinutes(AppSettings.LoginExpiredTimeSpan)); + await _provider.SetAsync(userId.ToString(), userId.ToString(), TimeSpan.FromMinutes(15)); httpContext.User = result.Principal; await _next.Invoke(httpContext); } diff --git a/IRaCIS.Core.API/appsettings.json b/IRaCIS.Core.API/appsettings.json index 6c072d149..fc14c9330 100644 --- a/IRaCIS.Core.API/appsettings.json +++ b/IRaCIS.Core.API/appsettings.json @@ -64,28 +64,22 @@ } } }, - "imageShare": { - "ExpireDays": 7 + + "IRaCISBasicConfig": { + + "DoctorCodePrefix": "RE", + + "UserCodePrefix": "U", + + "QCChallengeCodePrefix": "Q", + + "NoneDicomStudyCodePrefix": "ST", + + "DicomStudyCodePrefix": "NST" }, - //网站根地址,为了访问文件 dicom 和上传的文档... 实测发现不用将域名拼接返回,浏览器会自动加上当前ip,避免了多环境读取环境配置文件 - //"RootUrl": "http://localhost:8060", - "GrpcAddress": "http://123.56.181.144:7200", - "HostName": "123.56.181.144", - "PortNumber": "8022", - "UserName": "LongjunHe", - "Password": "zhizhun2018", - "SshHostKeyFingerprint": "", - "GiveUpSecurityAndAcceptAnySshHostKey": true, - "CodePrefix": "RE", - "UserCodePrefix": "U", - "Share": false, // - "FileSizeLimit": 1073741824, - "LoginExpiredTimeSpan": ":15", // Minute - "OpenLog": true, - "AddClinicalInfo": true } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Config/_AppSettings.cs b/IRaCIS.Core.Application/Config/_AppSettings.cs new file mode 100644 index 000000000..f562e5c4f --- /dev/null +++ b/IRaCIS.Core.Application/Config/_AppSettings.cs @@ -0,0 +1,89 @@ +锘縰sing Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration.Json; + +namespace IRaCIS.Core.Domain.Share +{ + /// + /// 澶氱幆澧 閰嶇疆鐜瀹炰綋 + /// + public class ServiceVerifyConfigOption + { + public bool OpenUserComplexPassword { get; set; } + + public bool OpenSignDocumentBeforeWork { get; set; } + + public bool OpenTrialRelationDelete { get; set; } + + public bool OpenLoginLimit { get; set; } + } + + + /// + /// 椤圭洰鍩虹閰嶇疆瑙勫垯 + /// + public class AppSettings + { + public static string DoctorCodePrefix { get; set; } + public static string UserCodePrefix { get; set; } + + + public static string QCChallengeCodePrefix { get; set; } + + public static string DicomStudyCodePrefix { get; set; } + + public static string NoneDicomStudyCodePrefix { get; set; } + + + static AppSettings() + { + var configuration = new ConfigurationBuilder() + .Add(new JsonConfigurationSource + { + Path = "appsettings.json", + ReloadOnChange = true + }) + .Build(); + + DoctorCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("DoctorCodePrefix"); + UserCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("UserCodePrefix"); + QCChallengeCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("QCChallengeCodePrefix"); + NoneDicomStudyCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("NoneDicomStudyCodePrefix"); + DicomStudyCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("DicomStudyCodePrefix"); + + } + + + //鑾峰彇瀹炰綋缂栫爜瀛楃涓 + public static string GetCodeStr(int codeInt ,string typeStr) + { + switch (typeStr) + { + case nameof(Doctor): + + return DoctorCodePrefix + codeInt.ToString("D4"); + + case nameof(User): + + return UserCodePrefix + codeInt.ToString("D4"); + + case nameof(QCChallenge): + + return QCChallengeCodePrefix+ codeInt.ToString("D5"); + + case nameof(NoneDicomStudy): + + return NoneDicomStudyCodePrefix + codeInt.ToString("D5"); + + case nameof(DicomStudy): + + return DicomStudyCodePrefix + codeInt.ToString("D5"); + + default: + return string.Empty; + } + } + + } + + +} \ No newline at end of file diff --git a/IRaCIS.Core.Domain.Share/_StaticData.cs b/IRaCIS.Core.Application/Config/_StaticData.cs similarity index 100% rename from IRaCIS.Core.Domain.Share/_StaticData.cs rename to IRaCIS.Core.Application/Config/_StaticData.cs diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 37aeeb3ce..a53aecc86 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1911,6 +1911,21 @@ 鏋勯犲嚱鏁版敞鍏 + + + 澶氱幆澧 閰嶇疆鐜瀹炰綋 + + + + + 椤圭洰鍩虹閰嶇疆瑙勫垯 + + + + + 鐢ㄦ埛榛樿瀵嗙爜 + + 缁熶竴杩斿洖鍓嶇鏁版嵁鍖呰锛屼箣鍓嶅湪鎺у埗鍣ㄥ寘瑁咃紝鐜板湪淇敼涓哄姩鎬丄pi 鍦≧esultFilter杩欓噷鍖呰锛屽噺灏戦噸澶嶅啑浣欎唬鐮 diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs index 3431cb4b1..70c4b7c51 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs @@ -77,7 +77,7 @@ namespace IRaCIS.Application.Services doctor.Code = (await _doctorRepository.MaxAsync(t => t.Code)) + 1; - doctor.ReviewerCode = AppSettings.CodePrefix + doctor.Code.ToString("D4"); + doctor.ReviewerCode = AppSettings.GetCodeStr(doctor.Code,nameof(Doctor)) ; doctor.Password = MD5Helper.Md5(doctor.Phone); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs index 1db82cb21..fbbf3a4f1 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs @@ -248,7 +248,7 @@ namespace IRaCIS.Core.Application.Services dicomStudy.Code = currentNextCodeInt; - dicomStudy.StudyCode = "ST" + currentNextCodeInt.ToString("D5"); + dicomStudy.StudyCode = AppSettings.GetCodeStr(currentNextCodeInt, nameof(DicomStudy)); _provider.Set($"{addtionalInfo.TrialId }_{ StaticData.StudyMaxCode}", dicomStudy.Code, TimeSpan.FromMinutes(30)); diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 9af2c2f2a..ce13901f8 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -472,7 +472,7 @@ namespace IRaCIS.Application.Services saveItem.Code = await _userRepository.Select(t => t.Code).DefaultIfEmpty().MaxAsync() + 1; - saveItem.UserCode = AppSettings.UserCodePrefix + saveItem.Code.ToString("D4"); + saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User)) ; if (saveItem.IsZhiZhun) { diff --git a/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs b/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs index 9680bf73a..0a5a80307 100644 --- a/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs +++ b/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs @@ -8,6 +8,7 @@ using IRaCIS.Core.Application.Filter; using Nito.AsyncEx; using System.ComponentModel.DataAnnotations; using IRaCIS.Core.Application.Service; +using IRaCIS.Core.Domain.Share; namespace IRaCIS.Core.Application.Contracts { @@ -67,7 +68,7 @@ namespace IRaCIS.Core.Application.Contracts optEntity = await _noneDicomStudyRepository.InsertFromDTOAsync(addOrEditNoneDicomStudy); - optEntity.StudyCode = "NST" + optEntity.Code.ToString("D5"); + optEntity.StudyCode = AppSettings.GetCodeStr(optEntity.Code, nameof(NoneDicomStudy)); } else { diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 3a1ad2271..18645beef 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -110,7 +110,7 @@ namespace IRaCIS.Core.Application.Image.QA qcChallenge.Code = code + 1; qcChallenge.UserTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt; - qcChallenge.ChallengeCode = "Q" + qcChallenge.Code.ToString("D5"); + qcChallenge.ChallengeCode = AppSettings.GetCodeStr(qcChallenge.Code, nameof(QCChallenge)); qcChallenge = await _qcChallengeRepository.AddAsync(qcChallenge, true); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 42e64c81a..4f8155173 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -718,7 +718,7 @@ namespace IRaCIS.Core.Application.Contracts saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - saveItem.UserCode = AppSettings.UserCodePrefix + saveItem.Code.ToString("D4"); + saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User)); saveItem.UserName = saveItem.UserCode; @@ -827,7 +827,7 @@ namespace IRaCIS.Core.Application.Contracts saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - saveItem.UserCode = AppSettings.UserCodePrefix + saveItem.Code.ToString("D4"); + saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User)); ; saveItem.UserName = saveItem.UserCode; diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index dc104c725..a6cde295a 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -114,7 +114,7 @@ namespace IRaCIS.Core.Application.Service generateUser.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - generateUser.UserCode = AppSettings.UserCodePrefix + generateUser.Code.ToString("D4"); + generateUser.UserCode = AppSettings.GetCodeStr(generateUser.Code, nameof(User)); generateUser.UserName = generateUser.UserCode; diff --git a/IRaCIS.Core.Domain.Share/ServiceVerifyConfigOption.cs b/IRaCIS.Core.Domain.Share/ServiceVerifyConfigOption.cs deleted file mode 100644 index 16d3ab2af..000000000 --- a/IRaCIS.Core.Domain.Share/ServiceVerifyConfigOption.cs +++ /dev/null @@ -1,19 +0,0 @@ -锘縰sing Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Configuration.Json; -using System; -using System.Collections.Generic; - -namespace IRaCIS.Core.Domain.Share -{ - public class ServiceVerifyConfigOption - { - public bool OpenUserComplexPassword { get; set; } - - public bool OpenSignDocumentBeforeWork { get; set; } - - - public bool OpenTrialRelationDelete { get; set; } - - public bool OpenLoginLimit { get; set; } - } -} \ No newline at end of file diff --git a/IRaCIS.Core.Domain.Share/_AppSettings.cs b/IRaCIS.Core.Domain.Share/_AppSettings.cs deleted file mode 100644 index eb7038f2e..000000000 --- a/IRaCIS.Core.Domain.Share/_AppSettings.cs +++ /dev/null @@ -1,82 +0,0 @@ -锘縰sing Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Configuration.Json; -using System; -using System.Collections.Generic; - -namespace IRaCIS.Core.Domain.Share -{ - public class AppSettings - { - public static string RootUrl { get; set; } - public static string CodePrefix { get; set; } - public static string UserCodePrefix { get; set; } - public static string VisitPlanNumPrefix { get; set; } - - public static int CodeLength { get; private set; } - public static List ExcludeCodeList { get; private set; } - public static List AnonymizeTagList = new List(); - public static int LoginExpiredTimeSpan { get; private set; } = 15; - public static bool OpenLog { get; set; } = true; - public static bool AddClinicalInfo { get; set; } = true; - public static bool Share { get; set; } = true; - - - static AppSettings() - { - var configuration = new ConfigurationBuilder() - .Add(new JsonConfigurationSource - { - Path = "appsettings.json", - ReloadOnChange = true - }) - .Add(new JsonConfigurationSource - { - Path = "AnonymizeTagSetting.json", - ReloadOnChange = true - }) - .Build(); - - RootUrl = configuration.GetSection("RootUrl").Value; - - CodePrefix = configuration.GetSection("CodePrefix").Value; - - UserCodePrefix = configuration.GetSection("UserCodePrefix").Value; - - VisitPlanNumPrefix = configuration.GetSection("VisitPlanNumPrefix").Value; - try - { - int tempLoginExpiredTimeSpan = 15; - if (int.TryParse(configuration.GetSection("LoginExpiredTimeSpan").Value, out tempLoginExpiredTimeSpan)) - { - LoginExpiredTimeSpan = tempLoginExpiredTimeSpan; - } - OpenLog = Convert.ToBoolean(configuration.GetSection("OpenLog").Value); - AddClinicalInfo = Convert.ToBoolean(configuration.GetSection("AddClinicalInfo").Value); - configuration.GetSection("needAnonymizeTag").Bind(AnonymizeTagList); - Share = Convert.ToBoolean(configuration.GetSection("OpenLog").Value); - } - catch (Exception) - { - - } - - } - - } - - public class AnonymizeTag - { - public string Group { get; set; } - public string Element { get; set; } - public string ReplaceValue { get; set; } - public bool Enable { get; set; } - public AnonymizeTag() { } - public AnonymizeTag(string group, string element, string value, bool enable) - { - Group = group; - Element = element; - ReplaceValue = value; - Enable = enable; - } - } -} \ No newline at end of file