123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- package com.yihu.wlyy.util;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Value;
- 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");
- }
- /**
- * IM地址
- *
- * @return
- */
- @Value("${im.im_list_get}")
- private String im_list_get;
- public String getImListGet() {
- return im_list_get;
- }
- /**
- * 获取文件保存的临时路径
- *
- * @return
- */
- public String getTempPath() {
- return getSystemProperties().getProperty(TEMP_PATH);
- }
- /**
- * 获取图片存在地址
- *
- * @return
- */
- @Value("${images.path}")
- private String imagesPath;
- public String getImagePath() {
- return imagesPath;
- }
- @Value("${wechat.appId}")
- private String appId;
- @Value("${wechat.appSecret}")
- private String appSecret;
- @Value("${wechat.accId}")
- private String accId;
- public String getAppId() {
- return appId;
- }
- public String getAccId() {
- return accId;
- }
- public String getAppSecret() {
- return appSecret;
- }
- /**
- * 获取服务全路径
- *
- * @return
- */
- @Value("${server.server_url}")
- private String server_url;
- public String getServerUrl() {
- return server_url;
- }
- public String getServerUrlStr() {
- return server_url;
- }
- /******************************** 挂号配置 ********************************************/
- /**
- * 获取厦门预约服务地址
- */
- public String getXMGuahaoUrl() {
- return getSystemProperties().getProperty("guahao_url");
- }
- /**
- * 获取厦门预约服务命名空间
- */
- public String getXMGuahaoNamespace() {
- return getSystemProperties().getProperty("guahao_namespace");
- }
- /****************************************************************************************/
- @Value("${sign.check_upload}")
- private String sign_check_upload;
- /**
- * 基卫服务地址
- */
- public String getJwUrl() {
- return getSystemProperties().getProperty("sign_check_upload");
- }
- /********************************* 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");
- }
- /**************************************************************************************/
- /*********************************
- * 健康之路开放平台 配置
- **********************************************/
- @Value("${yihu.yihu_OpenPlatform_url}")
- private String yihu_OpenPlatform_url;
- @Value("${yihu.yihu_OpenPlatform_appId}")
- private String yihu_OpenPlatform_appId;
- @Value("${yihu.yihu_OpenPlatform_secret}")
- private String yihu_OpenPlatform_secret;
- /**
- * 健康之路开放平台url
- */
- public String getYihuOpenPlatformUrl() {
- return yihu_OpenPlatform_url;
- }
- /**
- * 健康之路开放平台渠道号
- */
- public String getYihuOpenPlatformAppId() {
- return yihu_OpenPlatform_appId;
- }
- /**
- * 健康之路开放平台秘钥
- */
- public String getYihuOpenPlatformSecret() {
- return yihu_OpenPlatform_secret;
- }
- /**************************************************************************************/
- /**
- * 获取IM数据库名
- *
- * @return
- */
- @Value("${im.data_base_name}")
- private String im_dataBase_name;
- public String getImDataBaseName() {
- return im_dataBase_name;
- }
- }
|