Commit bc0056a2 authored by gaozhaochen's avatar gaozhaochen

update: 中智用户信息查询

parent f5cb6f8f
package cn.sh.stc.sict.cloud.common.core.constant.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 中智用户体系枚举
*
* @author gao
* @date 2023/04/27 15:16
*/
@AllArgsConstructor
@Getter
public enum ZzUserApiEnum {
/**
* 中智用户体系公众号信息
*/
DAPUQIAO("/dpq", "wxd831bfb5879b3522", "booking.hpdapuqiao.com", "42502942300"),
WAITAN("/wt", "wx8f9db9da2fbe1d5b", "booking.hpwaitan.com", "42503639100"),
WULIQIAO("/wlq", "wxa29d485b25f6aaf0", "gzh.hpwlq.com", "79705627000"),
HUAIHAIZHONGLU("/hhzl", "wxf2cbbfdc28aa93e6", "gzh.hphuaihai.com", "42502940700"),
RUIJINERLU("/rjel", "wxf0b1f6ee9e16effd", "booking.shruier.cn", "42502992500"),
YUYUAN("/yy", "wx3691d4535427bfc5", "gzh.yuyuanswydt.cn", "42502884200"),
XIAODONGMEN("/xdm", "wx1e4ca6fecfa4a0bb", "gzh.hpxiaodongmen.com", "42507025800"),
LAOXIMEN("/lxm", "wxdf6e240a731c70ea", "booking.hplxmsw.cn", "42507018600");
private final String relativePath;
private final String appid;
private final String domain;
private final String institutionCode;
public static ZzUserApiEnum find(String appid) {
return Arrays.stream(values())
.filter(institution -> institution.appid.equals(appid))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("No Institution with appid " + appid));
}
}
......@@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONUtil;
import cn.sh.stc.sict.cloud.common.core.constant.enums.ZzUserApiEnum;
import cn.sh.stc.sict.cloud.common.core.dto.WOAWDUserInfo;
import cn.sh.stc.sict.cloud.common.core.dto.WOAZzUserInfo;
import cn.sh.stc.sict.cloud.common.core.dto.XSZYUserInfo;
......@@ -97,21 +98,24 @@ public class WoaUtil {
*/
private final static String WOA_ZZ_PROXY_PASS_URL = "http://30.30.5.74:9988/woa/zz";
// private final static String WOA_ZZ_PROXY_PASS_URL = "https://booking.hpdapuqiao.com";
private final static String ZZ_USER_INFO_API_URL = WOA_ZZ_PROXY_PASS_URL + "/api/Other/GetPerson";
private final static String ZZ_USER_INFO_API_URL = "/api/Other/GetPerson";
//private final static String WOA_WD_PROXY_PASS_URL = "https://wxgzh.shjyhpfy.com/api/hosservice/visit/GetUserInfoByToken";
private final static String WOA_WD_PROXY_PASS_URL = "http://30.30.5.74:9988/woa/wd";
private final static String WOA_WD_USER_INFO_URL = WOA_WD_PROXY_PASS_URL + "/api/hosservice/visit/GetUserInfoByToken";
public WOAZzUserInfo getZzUserInfo(String accessToken) {
public WOAZzUserInfo getZzUserInfo(String appid, String accessToken) {
try {
HttpResponse response = HttpRequest.get(ZZ_USER_INFO_API_URL)
ZzUserApiEnum zzUserApiEnum = ZzUserApiEnum.find(appid);
String url = WOA_ZZ_PROXY_PASS_URL + zzUserApiEnum.getRelativePath() + ZZ_USER_INFO_API_URL;
HttpResponse response = HttpRequest.get(url)
.header("access-token", accessToken)
.execute();
if (response.getStatus() != 200) {
log.error("中智获取用户信息异常-1");
return null;
}
log.error("response = {}", JSONUtil.toJsonStr(response.body()));
return JSONUtil.toBean(response.body(), WOAZzUserInfo.class);
} catch (Exception ex) {
log.error("中智token获取用户信息异-2!");
......
......@@ -12,7 +12,13 @@ import lombok.Data;
@Data
public class UserInfo {
/**
* 登陆人openId
*/
private String openId;
/**
* 登陆人公众号appdId
*/
private String appId;
/**
* 医院公众号登陆的用户包含医院代码
......
......@@ -212,7 +212,7 @@ public class SysUserBaseServiceImpl extends ServiceImpl<SysUserBaseMapper, SysUs
String token = infoArray[2];
String hospitalCode = infoArray[3];
WOAZzUserInfo zzUserInfo = WoaUtil.getZzUserInfo(token);
WOAZzUserInfo zzUserInfo = WoaUtil.getZzUserInfo(appId, token);
String zzUserInfoStr = JSONUtil.toJsonStr(zzUserInfo);
log.error("woa.login.zzUser = {}", zzUserInfoStr);
if (ObjectUtil.isNull(zzUserInfo) || StrUtil.isBlank(zzUserInfo.getId())) {
......@@ -248,6 +248,7 @@ public class SysUserBaseServiceImpl extends ServiceImpl<SysUserBaseMapper, SysUs
UserInfo info = new UserInfo();
info.setSysUserBase(user);
info.setAppId(appId);
info.setOpenId(zzUserInfo.getId());
// 设置医疗机构代码,后续查询只显示当前医疗机构下的查询结果
......
......@@ -17,6 +17,7 @@ import cn.sh.stc.sict.theme.hphy.model.HpDeptInfo;
import cn.sh.stc.sict.theme.hphy.model.HpDocInfo;
import cn.sh.stc.sict.theme.hphy.service.HpDeptInfoService;
import cn.sh.stc.sict.theme.hphy.service.HpDocInfoService;
import cn.sh.stc.sict.theme.hphy.util.BusyIdlePredictionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -79,14 +80,17 @@ public class HpHzjlServiceImpl extends ServiceImpl<HpHzjlMapper, HpHzjl> impleme
continue;
}
// 忙闲预测
result.addAll(hpgpBusyIdlePredictionService.listByDept(dept, startTime, endTime));
resultDeptSize++;
List<HpgpBusyIdlePrediction> hasRemainNum = BusyIdlePredictionUtil.getHasRemainNum(hpgpBusyIdlePredictionService.listByDept(dept, startTime, endTime));
if (CollUtil.isNotEmpty(hasRemainNum)) {
result.addAll(hasRemainNum);
resultDeptSize++;
}
}
}
// 历史科室查询结果少于3个时,采用热点科室数据补充
if (resultDeptSize < MAX_DEPT_SIZE) {
List<HpgpKsHot> hotList = hpgpKsHotService.listHotDept(hospitalCode, MAX_DEPT_SIZE - resultDeptSize);
List<HpgpKsHot> hotList = hpgpKsHotService.listHotDept(hospitalCode, 3);
hotList.forEach(hot -> {
HpDeptInfo dept = new HpDeptInfo();
dept.setHosOrgCode(hot.getHospitalCode());
......@@ -94,10 +98,14 @@ public class HpHzjlServiceImpl extends ServiceImpl<HpHzjlMapper, HpHzjl> impleme
dept.setOneDeptCode(hot.getOneDeptCode());
dept.setDeptCode(hot.getDeptCode());
dept.setDeptName(hot.getDeptName());
result.addAll(hpgpBusyIdlePredictionService.listByDept(dept, startTime, endTime));
// 忙闲预测
List<HpgpBusyIdlePrediction> hasRemainNum = BusyIdlePredictionUtil.getHasRemainNum(hpgpBusyIdlePredictionService.listByDept(dept, startTime, endTime));
if (CollUtil.isNotEmpty(hasRemainNum)) {
result.addAll(hasRemainNum);
}
});
}
return result;
return BusyIdlePredictionUtil.getHasRemainNum(result);
}
@Override
......
......@@ -168,7 +168,7 @@ public class HphyPatientBaseController {
}
// 中智用户系统公众号
if (LoginTypeEnum.WOA_ZZ.getType().equals(source)) {
WOAZzUserInfo zzUserInfo = WoaUtil.getZzUserInfo(token);
WOAZzUserInfo zzUserInfo = WoaUtil.getZzUserInfo(current.getAppId(), token);
log.error("zzUser = {}", zzUserInfo);
base = hphyPatientBaseService.saveWoaZzInfo(current, zzUserInfo);
}
......@@ -190,8 +190,8 @@ public class HphyPatientBaseController {
// 更新卡号卡类型
if (LoginTypeEnum.WOA_NL.getType().equals(source)) {
log.error("woaXszyUser = {}", current.getXszyUserInfo());
XSZYUserInfo xszyUserInfo = JSONUtil.toBean(current.getXszyUserInfo(), XSZYUserInfo.class);
log.error("woaXszyUser = {}", xszyUserInfo);
base.setMediCardType(xszyUserInfo.getMediCardType());
base.setMediCardId(xszyUserInfo.getMediCardId());
hphyPatientBaseService.updateById(base);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment