SystemConf.java 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. package com.yihu.jw.util;
  2. import org.springframework.stereotype.Component;
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5. import java.util.Properties;
  6. @Component
  7. public class SystemConf {
  8. // 别处登录
  9. public static final int LOGIN_OTHER = 999;
  10. // 登录超时
  11. public static final int LOGIN_TIMEOUT = 998;
  12. // 未登录
  13. public static final int NOT_LOGIN = 997;
  14. // 文件保存临时路径
  15. private static final String TEMP_PATH = "upload_temp_path";
  16. // 血糖餐前最小值
  17. public static final double HEALTH_STANDARD_ST_MIN_BEFORE = 4;
  18. // 血糖餐前最大值
  19. public static final double HEALTH_STANDARD_ST_MAX_BEFORE = 7;
  20. // 血糖餐后最小值
  21. public static final double HEALTH_STANDARD_ST_MIN_AFTER = 4;
  22. // 血糖餐后最大值
  23. public static final double HEALTH_STANDARD_ST_MAX_AFTER = 11.1;
  24. // 舒张压最小值
  25. public static final double HEALTH_STANDARD_SZY_MIN = 60;
  26. // 舒张压最大值
  27. public static final double HEALTH_STANDARD_SZY_MAX = 90;
  28. // 收缩压最小值
  29. public static final double HEALTH_STANDARD_SSY_MIN = 90;
  30. // 收缩压最大值
  31. public static final double HEALTH_STANDARD_SSY_MAX = 140;
  32. // 同一手机号大最短信数
  33. public static final int MAX_SMS_MOBILE = 5;
  34. // 发送短信验证码间隔(分钟)
  35. public static final int SMS_INTERVAL = 2;
  36. private static Object lock = new Object();
  37. // 全局系统配置信息
  38. private static SystemConf systemConf;
  39. // 系统配置文件
  40. private Properties systemProperties;
  41. //im列表
  42. private String imListGet;
  43. public static SystemConf getInstance() {
  44. if (systemConf == null) {
  45. synchronized (lock) {
  46. systemConf = new SystemConf();
  47. }
  48. }
  49. return systemConf;
  50. }
  51. /**
  52. * 加载系统配置文件
  53. *
  54. * @return
  55. */
  56. public Properties getSystemProperties() {
  57. if (systemProperties == null) {
  58. InputStream is = null;
  59. try {
  60. is = this.getClass().getResourceAsStream("/system.properties");
  61. systemProperties = new Properties();
  62. systemProperties.load(is);
  63. } catch (IOException e1) {
  64. e1.printStackTrace();
  65. } finally {
  66. if (is != null) {
  67. try {
  68. is.close();
  69. } catch (IOException e) {
  70. e.printStackTrace();
  71. }
  72. }
  73. }
  74. }
  75. return systemProperties;
  76. }
  77. /**
  78. * 短信接口地址
  79. */
  80. public String getSmsUrl() {
  81. return getSystemProperties().getProperty("yihu_sms_url");
  82. }
  83. /**
  84. * 短信企业编号
  85. */
  86. public String getSmsCode() {
  87. return getSystemProperties().getProperty("yihu_sms_code");
  88. }
  89. /**
  90. * 短信用户名
  91. */
  92. public String getSmsName() {
  93. return getSystemProperties().getProperty("yihu_sms_name");
  94. }
  95. /**
  96. * 短信登录密码
  97. */
  98. public String getSmsPassword() {
  99. return getSystemProperties().getProperty("yihu_sms_password");
  100. }
  101. ;
  102. /**
  103. * 挂号接口地址
  104. */
  105. public String getGuahaoUrl() {
  106. return getSystemProperties().getProperty("yihu_guahao_url");
  107. }
  108. /**
  109. * 挂号接口对接appid
  110. */
  111. public String getGuahaoAppid() {
  112. return getSystemProperties().getProperty("yihu_guahao_appid");
  113. }
  114. /**
  115. * 挂号接口对接app secret
  116. */
  117. public String getGuahaoSecret() {
  118. return getSystemProperties().getProperty("yihu_guahao_secret");
  119. }
  120. /**
  121. * 获取文件保存的临时路径
  122. *
  123. * @return
  124. */
  125. public String getTempPath() {
  126. return getSystemProperties().getProperty(TEMP_PATH);
  127. }
  128. /**
  129. * 获取图片存在地址
  130. *
  131. * @return
  132. */
  133. /**
  134. * 获取服务全路径
  135. *
  136. * @return
  137. */
  138. /******************************** 挂号配置 ********************************************/
  139. /**
  140. * 获取厦门预约服务地址
  141. */
  142. public String getXMGuahaoUrl() {
  143. return getSystemProperties().getProperty("guahao_url");
  144. }
  145. /**
  146. * 获取厦门预约服务命名空间
  147. */
  148. public String getXMGuahaoNamespace() {
  149. return getSystemProperties().getProperty("guahao_namespace");
  150. }
  151. /****************************************************************************************/
  152. /********************************* EHR配置 **********************************************/
  153. /**
  154. * 是否启用EHR演示
  155. */
  156. public Boolean getEhrUsed() {
  157. return Boolean.valueOf(getSystemProperties().getProperty("ehr_used"));
  158. }
  159. /**
  160. * EHR档案服务地址
  161. */
  162. public String getEhrServices() {
  163. return getSystemProperties().getProperty("ehr_services");
  164. }
  165. /**
  166. * EHR底层地址
  167. */
  168. public String getEhrServicesBase() {
  169. return getSystemProperties().getProperty("ehr_services_base");
  170. }
  171. /**************************************************************************************/
  172. /**************************************************************************************/
  173. }