using IRaCIS.Core.Domain.Models; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration.Json; 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; } public int LoginMaxFailCount { get; set; } public int LoginFailLockMinutes { get; set; } public int AutoLoginOutMinutes { get; set; } public bool OpenLoginMFA { get; set; } /// /// 连续阅片时间 (min) /// public int ContinuousReadingTimeMin { get; set; } /// /// 休息时间 (min) /// public int ReadingRestTimeMin { get; set; } /// /// 是否需要修改密码 /// public bool IsNeedChangePassWord { get; set; } /// /// 修改密码的天数 /// public int ChangePassWordDays { get; set; } } public class SystemEmailSendConfig { public int Port { get; set; } public string Host { get; set; } public string FromEmail { get; set; } public string FromName { get; set; } public string AuthorizationCode { get; set; } public string SiteUrl { get; set; } public string OrganizationName { get; set; } public string OrganizationNameCN { get; set; } public string CompanyName { get; set; } public string CompanyNameCN { get; set; } public string CompanyShortName { get; set; } public string CompanyShortNameCN { get; set; } } public class EncreptResponseOption { public bool IsEnable { get; set; } public List ApiPathList { 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 int ImageShareExpireDays { get; set; } = 7; public static string SystemSiteCodePrefix { get; set; } public static string BlindTaskPrefix { get; set; } /// /// 用户默认密码 /// 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"); SystemSiteCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("SystemSiteCodePrefix"); ImageShareExpireDays = configuration.GetSection("IRaCISBasicConfig").GetValue("ImageShareExpireDays"); BlindTaskPrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("BlindTaskPrefix"); } //获取实体编码字符串 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"); case nameof(Site): return SystemSiteCodePrefix + codeInt.ToString("D4"); default: return string.Empty; } } } }