123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- 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");
- }
- /**************************************************************************************/
- /**************************************************************************************/
- }
|