using IRaCIS.Core.Domain.Models;
using 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; }
public static string DefaultInternalOrganizationName { get; set; }
public static int ImageShareExpireDays { get; set; } = 7;
///
/// 用户默认密码
///
public static readonly string DefaultPassword = "123456";
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");
DefaultPassword= configuration.GetSection("IRaCISBasicConfig").GetValue("DefaultPassword");
DefaultInternalOrganizationName = configuration.GetSection("IRaCISBasicConfig").GetValue("DefaultInternalOrganizationName");
ImageShareExpireDays = configuration.GetSection("IRaCISBasicConfig").GetValue("ImageShareExpireDays");
}
//获取实体编码字符串
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");
case nameof(VisitTask):
return "W" + codeInt.ToString("D5");
default:
return string.Empty;
}
}
}
}