From ed8ac7bfefb9a7d4296190b4935ac013883808eb Mon Sep 17 00:00:00 2001 From: gaozhaochen Date: Mon, 14 Nov 2022 18:30:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20->=20=E9=A6=99=E5=B1=B1?= =?UTF-8?q?=E4=B8=AD=E5=8C=BB=E9=99=A2=E7=94=A8=E6=88=B7=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sict/cloud/common/core/util/WoaUtil.java | 44 ++++++++++++++----- .../mp/HphyPatientBaseController.java | 10 +++++ .../mapper/hpgp/HpgpDepartmentRankMapper.xml | 4 +- 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/util/WoaUtil.java b/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/util/WoaUtil.java index fc5649b..71432e2 100644 --- a/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/util/WoaUtil.java +++ b/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/util/WoaUtil.java @@ -2,7 +2,7 @@ package cn.sh.stc.sict.cloud.common.core.util; import cn.hutool.core.collection.ListUtil; import cn.hutool.core.convert.Convert; -import cn.sh.stc.sict.cloud.common.core.constant.Constant; +import cn.hutool.json.JSONUtil; import cn.sh.stc.sict.cloud.common.core.dto.XSZYUserInfo; import lombok.experimental.UtilityClass; import lombok.extern.slf4j.Slf4j; @@ -22,22 +22,41 @@ import ngari.openapi.Response; @UtilityClass public class WoaUtil { - // 香山中医医院公众号用户信息获取接口地址(纳里) - private final static String XSZY_USER_URL = "https://openapi.ngarihealth.com/openapi/gateway"; + /** + * 香山中医医院公众号用户信息获取接口地址(纳里) + */ + private final static String WOA_XSZY_URL = "https://openapi.ngarihealth.com"; + private final static String WOA_XSZY_GATEWAY_URL = "/openapi/gateway"; + /** + * 内网代理请求地址 + */ + private final static String WOA_XSZY_PROXY_PASS_URL = "http://30.30.5.74:9988/woa/xszy"; + /** + * 获取用户信息请求地址 + */ + private final static String WOA_XSZY_USER_INFO_API_URL = WOA_XSZY_PROXY_PASS_URL + WOA_XSZY_GATEWAY_URL; - // 接口授权信息 + /** + * 接口授权信息 + */ private final static String APP_KEY = "ngari635f7f4b0e980e63"; private final static String APP_SECRET = "0e980e634196fcde"; - // 获取用户信息服务ID + /** + * 获取用户信息服务ID + */ private final static String SERVICE_ID = "openapi.authenticationService"; - // 获取用户信息方法 + /** + * 获取用户信息方法 + */ private final static String METHOD = "apiGetUserInfo"; - - // 响应头请求唯一ID - private final static String RESPONSE_HEADER_REQUEST_ID = "X-Ca-Request-Id"; - - // 香山中医医院编码 + /** + * 响应头请求唯一ID + */ + private final static String RESPONSE_HEADER_REQUEST_ID = "X-Ca-RequestId"; + /** + * 香山中医医院编码 + */ private final static String XSZY_HOSPITAL_CODE = "42502905200"; /** @@ -50,7 +69,7 @@ public class WoaUtil { //如果开启加密,则必填 String encodingAesKey = ""; - Client client = new Client(XSZY_USER_URL, APP_KEY, APP_SECRET, encodingAesKey); + Client client = new Client(WOA_XSZY_USER_INFO_API_URL, APP_KEY, APP_SECRET, encodingAesKey); try { // 入参说明[授权码,是否回调,拓展参数] @@ -64,6 +83,7 @@ public class WoaUtil { return xszyUserInfo; } else { log.error("香山中医医院公众号token获取用户信息异常-1,requestId = [{}],caError = [{}],error = [{}]", response.getHeader(RESPONSE_HEADER_REQUEST_ID), response.getCaErrorMsg(), response.getErrorMessage()); + log.error(JSONUtil.toJsonStr(response)); return null; } } catch (Exception ex) { diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientBaseController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientBaseController.java index 11daa84..e8ca6ae 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientBaseController.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientBaseController.java @@ -187,4 +187,14 @@ public class HphyPatientBaseController { List cardList = hpPatientCardService.listByUserId(current.getId()); return new R(cardList); } + + @ApiOperation("第三方公众号进入系统时,获取患者信息") + @GetMapping("/third-party/woa") + public R getwoa(@RequestParam("source") String source, + @RequestParam("token") String token) { + log.error("source = {}, token = {}", source, token); + XSZYUserInfo xszyUserInfo = WoaUtil.getXszyUserInfo(token); + return new R(xszyUserInfo); + } + } diff --git a/smart-health-modules/theme-schema/src/main/resources/mapper/hpgp/HpgpDepartmentRankMapper.xml b/smart-health-modules/theme-schema/src/main/resources/mapper/hpgp/HpgpDepartmentRankMapper.xml index a9b3ed9..ace4cab 100644 --- a/smart-health-modules/theme-schema/src/main/resources/mapper/hpgp/HpgpDepartmentRankMapper.xml +++ b/smart-health-modules/theme-schema/src/main/resources/mapper/hpgp/HpgpDepartmentRankMapper.xml @@ -22,8 +22,8 @@ dr.rank_score rankScore, d.one_dept_code oneDeptCode, d.dept_code subDeptCode - from hpgp_department_rank_1028 dr - join hp_dept_info_copy1 d on (dr.hospital_code = d.hos_org_code and dr.one_dept_code = d.one_dept_code and dr.dept_code = d.dept_code) + from hpgp_department_rank dr + join hp_dept_info d on (dr.hospital_code = d.hos_org_code and dr.one_dept_code = d.one_dept_code and dr.dept_code = d.dept_code) -- 2.22.0