修改配置文件,统一实体编码规则
parent
46ef7cbb4a
commit
29f4a73168
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Configuration.Json;
|
||||
|
||||
namespace IRaCIS.Core.Domain.Share
|
||||
{
|
||||
/// <summary>
|
||||
/// 多环境 配置环境实体
|
||||
/// </summary>
|
||||
public class ServiceVerifyConfigOption
|
||||
{
|
||||
public bool OpenUserComplexPassword { get; set; }
|
||||
|
||||
public bool OpenSignDocumentBeforeWork { get; set; }
|
||||
|
||||
public bool OpenTrialRelationDelete { get; set; }
|
||||
|
||||
public bool OpenLoginLimit { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 项目基础配置规则
|
||||
/// </summary>
|
||||
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<string>("DoctorCodePrefix");
|
||||
UserCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue<string>("UserCodePrefix");
|
||||
QCChallengeCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue<string>("QCChallengeCodePrefix");
|
||||
NoneDicomStudyCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue<string>("NoneDicomStudyCodePrefix");
|
||||
DicomStudyCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue<string>("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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1911,6 +1911,21 @@
|
|||
构造函数注入
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption">
|
||||
<summary>
|
||||
多环境 配置环境实体
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Domain.Share.AppSettings">
|
||||
<summary>
|
||||
项目基础配置规则
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:IRaCIS.Core.Domain.Share.StaticData.DefaultPassword">
|
||||
<summary>
|
||||
用户默认密码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Application.Services.BusinessFilter.UnifiedApiResultFilter">
|
||||
<summary>
|
||||
统一返回前端数据包装,之前在控制器包装,现在修改为动态Api 在ResultFilter这里包装,减少重复冗余代码
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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<int>($"{addtionalInfo.TrialId }_{ StaticData.StudyMaxCode}", dicomStudy.Code, TimeSpan.FromMinutes(30));
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
using 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; }
|
||||
}
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
using 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<string> ExcludeCodeList { get; private set; }
|
||||
public static List<AnonymizeTag> AnonymizeTagList = new List<AnonymizeTag>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue