修改配置文件,统一实体编码规则

Uat_Study
hang 2022-05-30 16:08:32 +08:00
parent 46ef7cbb4a
commit 29f4a73168
14 changed files with 126 additions and 128 deletions

View File

@ -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);
}

View File

@ -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
}

View File

@ -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;
}
}
}
}

View File

@ -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这里包装减少重复冗余代码

View File

@ -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);

View File

@ -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));

View File

@ -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)
{

View File

@ -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
{

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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; }
}
}

View File

@ -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;
}
}
}