package com.yihu.jw.util; import org.springframework.stereotype.Component; import java.io.IOException; import java.io.InputStream; import java.util.Properties; @Component public class SystemConf { // 别处登录 public static final int LOGIN_OTHER = 999; // 登录超时 public static final int LOGIN_TIMEOUT = 998; // 未登录 public static final int NOT_LOGIN = 997; // 文件保存临时路径 private static final String TEMP_PATH = "upload_temp_path"; // 血糖餐前最小值 public static final double HEALTH_STANDARD_ST_MIN_BEFORE = 4; // 血糖餐前最大值 public static final double HEALTH_STANDARD_ST_MAX_BEFORE = 7; // 血糖餐后最小值 public static final double HEALTH_STANDARD_ST_MIN_AFTER = 4; // 血糖餐后最大值 public static final double HEALTH_STANDARD_ST_MAX_AFTER = 11.1; // 舒张压最小值 public static final double HEALTH_STANDARD_SZY_MIN = 60; // 舒张压最大值 public static final double HEALTH_STANDARD_SZY_MAX = 90; // 收缩压最小值 public static final double HEALTH_STANDARD_SSY_MIN = 90; // 收缩压最大值 public static final double HEALTH_STANDARD_SSY_MAX = 140; // 同一手机号大最短信数 public static final int MAX_SMS_MOBILE = 5; // 发送短信验证码间隔(分钟) public static final int SMS_INTERVAL = 2; private static Object lock = new Object(); // 全局系统配置信息 private static SystemConf systemConf; // 系统配置文件 private Properties systemProperties; //im列表 private String imListGet; public static SystemConf getInstance() { if (systemConf == null) { synchronized (lock) { systemConf = new SystemConf(); } } return systemConf; } /** * 加载系统配置文件 * * @return */ public Properties getSystemProperties() { if (systemProperties == null) { InputStream is = null; try { is = this.getClass().getResourceAsStream("/system.properties"); systemProperties = new Properties(); systemProperties.load(is); } catch (IOException e1) { e1.printStackTrace(); } finally { if (is != null) { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } } } return systemProperties; } /** * 短信接口地址 */ public String getSmsUrl() { return getSystemProperties().getProperty("yihu_sms_url"); } /** * 短信企业编号 */ public String getSmsCode() { return getSystemProperties().getProperty("yihu_sms_code"); } /** * 短信用户名 */ public String getSmsName() { return getSystemProperties().getProperty("yihu_sms_name"); } /** * 短信登录密码 */ public String getSmsPassword() { return getSystemProperties().getProperty("yihu_sms_password"); } ; /** * 挂号接口地址 */ public String getGuahaoUrl() { return getSystemProperties().getProperty("yihu_guahao_url"); } /** * 挂号接口对接appid */ public String getGuahaoAppid() { return getSystemProperties().getProperty("yihu_guahao_appid"); } /** * 挂号接口对接app secret */ public String getGuahaoSecret() { return getSystemProperties().getProperty("yihu_guahao_secret"); } /** * 获取文件保存的临时路径 * * @return */ public String getTempPath() { return getSystemProperties().getProperty(TEMP_PATH); } /** * 获取图片存在地址 * * @return */ /** * 获取服务全路径 * * @return */ /******************************** 挂号配置 ********************************************/ /** * 获取厦门预约服务地址 */ public String getXMGuahaoUrl() { return getSystemProperties().getProperty("guahao_url"); } /** * 获取厦门预约服务命名空间 */ public String getXMGuahaoNamespace() { return getSystemProperties().getProperty("guahao_namespace"); } /****************************************************************************************/ /********************************* EHR配置 **********************************************/ /** * 是否启用EHR演示 */ public Boolean getEhrUsed() { return Boolean.valueOf(getSystemProperties().getProperty("ehr_used")); } /** * EHR档案服务地址 */ public String getEhrServices() { return getSystemProperties().getProperty("ehr_services"); } /** * EHR底层地址 */ public String getEhrServicesBase() { return getSystemProperties().getProperty("ehr_services_base"); } /**************************************************************************************/ /**************************************************************************************/ }