Commit 6cbc453dc0e2d7c13e17ab002fecd75d101cc43e

Authored by liquanyu
1 parent cdbfd6ee89
Exists in master and in 1 other branch dev

配置

Showing 3 changed files with 46 additions and 2 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/WeiXinUtil.java View file @ 6cbc453
... ... @@ -174,5 +174,40 @@
174 174 return null;
175 175 }
176 176  
  177 +
  178 +
  179 + /**
  180 + * 获取公众号的openid
  181 + *
  182 + * @param code 登录时获取的code
  183 + * @return 微信方获取openid
  184 + */
  185 + public static String getGzOpenId(String code) {
  186 + if (StringUtil.isEmpty(code)) {
  187 + return null;
  188 + }
  189 + try {
  190 + StringBuilder reqUrl = new StringBuilder();
  191 + reqUrl.append("/sns/jscode2session?appid=").append(Constant.PAT_APP_ID).
  192 + append("&secret="). append(Constant.WX_SECRET).append("&js_code=").append(code).
  193 + append("&grant_type=").append(Constant.GRANT_TYPE);
  194 + log.info("getWxOpenId url : {}",reqUrl);
  195 + String response = HttpUtil.getData(Constant.WEIXIN_SERVER + reqUrl);
  196 +
  197 + log.info("getWxOpenId jscode2session response : {}" , response);
  198 + if (StringUtil.isNotEmpty(response))
  199 + {
  200 + Map<String, Object> result = JsonUtil.str2Map(response, HashMap.class);
  201 + if (result.containsKey(OPEN_ID_KEY))
  202 + {
  203 + return result.get(OPEN_ID_KEY).toString();
  204 + }
  205 + }
  206 + } catch (Exception e) {
  207 + log.error("getWxOpenId by code: {}", code, e);
  208 + }
  209 + return null;
  210 + }
  211 +
177 212 }
talkonlineweb/src/main/resources/application-prod.yml View file @ 6cbc453
... ... @@ -32,4 +32,13 @@
32 32  
33 33 proxyIP:
34 34 proxyPort:
  35 +
  36 +#获取医院患者信息配置
  37 +patient:
  38 + #医院接口地址(String)
  39 + url: https://rp-zk-api.healthbaby.com.cn:8094/his/zkfy/getZkfyPatientList
  40 + #需要预建医院获得医院名称(String)
  41 + hospitalName: 周口市妇幼保健院
  42 + #需要预建医院获得id(Integer)
  43 + hospital: 16
talkonlineweb/src/main/resources/application.yml View file @ 6cbc453
... ... @@ -11,7 +11,7 @@
11 11 resources:
12 12 add-mappings: false
13 13 profiles:
14   - active: dev
  14 + active: prod
15 15 logging:
16 16 config: classpath:logback-spring.xml
17 17