diff --git a/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/constant/UserConstant.java b/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/constant/UserConstant.java index 8e20d798adf766e77bcba7ec23a131dc8c0b142a..c81a95a7101d5cba41b585d36e4d74b101903bfc 100644 --- a/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/constant/UserConstant.java +++ b/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/constant/UserConstant.java @@ -3,4 +3,15 @@ package cn.sh.stc.sict.cloud.common.core.constant; public class UserConstant { public final static String USER_SOURCE_MOBILE = "mobile"; public final static String USER_SOURCE_SSB = "wd_ssb"; + + /** + * 0:社保卡 + * 1:医保卡 + * 2:统一自费就诊卡 + * 9:其他卡 + */ + public final static String SOCIAL_SECURITY_CARD = "0"; + public final static String MEDICAL_INSURANCE_CARD = "1"; + public final static String UNIFIED_MEDICAL_TREATMENT_EXPENSE_CARD = "2"; + public final static String OTHER_CARD = "9"; } diff --git a/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/dto/XSZYUserInfo.java b/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/dto/XSZYUserInfo.java index 95a0b2835dcb6c2c1683596d9bf24ce9e3231189..b5110e0617eea9cd09607ba09679b24c0d269ce0 100644 --- a/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/dto/XSZYUserInfo.java +++ b/cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/dto/XSZYUserInfo.java @@ -1,6 +1,8 @@ package cn.sh.stc.sict.cloud.common.core.dto; +import cn.hutool.core.util.StrUtil; +import cn.sh.stc.sict.cloud.common.core.constant.UserConstant; import lombok.Data; /** @@ -43,6 +45,41 @@ public class XSZYUserInfo { * 医院编码 */ private String hospitalCode; + /** + * 卡类型0:社保卡;1:医保卡;2:统一自费就诊卡;9:其他卡 + */ + private String mediCardType; + + /** + * 卡号 + */ + private String mediCardId; + + /** + * 将纳里用户卡类型映射为挂号时的卡类型 + * 1:就诊卡 + * 2:医保卡 + * 3:病历号 + * 4:健康卡 + * 5:社保卡 + * 6:住院卡 + * 7:院内健健康卡 + * 8:体检卡 + */ + public static String fromNlType(String mediCardType) { + if (StrUtil.isBlank(mediCardType)) { + return null; + } + if (mediCardType.equals("5")) { + return UserConstant.SOCIAL_SECURITY_CARD; + } else if (mediCardType.equals("2")) { + return UserConstant.MEDICAL_INSURANCE_CARD; + } else if (mediCardType.equals("1")) { + return UserConstant.UNIFIED_MEDICAL_TREATMENT_EXPENSE_CARD; + } else { + return UserConstant.OTHER_CARD; + } + } } 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 56e508a524bd2211aa6d00b7d2426ea08b07fa74..330768483515d0f380c111ff0e8513d839214161 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 @@ -38,7 +38,7 @@ public class WoaUtil { /** * 获取用户信息请求地址 */ - private final static String WOA_XSZY_USER_INFO_API_URL = WOA_XSZY_URL + WOA_XSZY_GATEWAY_URL; + private final static String WOA_XSZY_USER_INFO_API_URL = WOA_XSZY_PROXY_PASS_URL + WOA_XSZY_GATEWAY_URL; /** * 接口授权信息 diff --git a/smart-health-modules/cloud-upms/cloud-upms-biz/src/main/java/cn/sh/stc/sict/cloud/upms/service/impl/SysUserBaseServiceImpl.java b/smart-health-modules/cloud-upms/cloud-upms-biz/src/main/java/cn/sh/stc/sict/cloud/upms/service/impl/SysUserBaseServiceImpl.java index 1ba6ae29af11ed6f68cb4b6e55d326a7e3a7cc63..590934c3e9bcea6363e32a65588845224a7a4454 100644 --- a/smart-health-modules/cloud-upms/cloud-upms-biz/src/main/java/cn/sh/stc/sict/cloud/upms/service/impl/SysUserBaseServiceImpl.java +++ b/smart-health-modules/cloud-upms/cloud-upms-biz/src/main/java/cn/sh/stc/sict/cloud/upms/service/impl/SysUserBaseServiceImpl.java @@ -121,11 +121,17 @@ public class SysUserBaseServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/AppointmentController.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/AppointmentController.java index c439400b16a7d025d8306e046cdde1b0246d57dc..958860f164dc80366fd27eb7d154b40298bb2794 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/AppointmentController.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/AppointmentController.java @@ -79,9 +79,10 @@ public class AppointmentController { return new R().error("未找到患者信息!"); } boolean isNullCard = (StrUtil.isBlank(order.getMediCardId()) || StrUtil.isBlank(order.getMediCardType())) - && StrUtil.isBlank(patient.getMediCardId()) || StrUtil.isBlank(patient.getMediCardType()); + && (StrUtil.isBlank(patient.getMediCardId()) || StrUtil.isBlank(patient.getMediCardType())); // 有卡预约时检查就诊卡信息 if (WanDaConstant.ORDER_MODEL_1.equals(hos.getOrderMode()) && isNullCard) { + log.error("患者信息:{},预约信息:{}", JSONUtil.toJsonStr(patient), JSONUtil.toJsonStr(order)); return new R().error("请补充患者就诊卡信息!"); } String deptName = ""; @@ -139,8 +140,16 @@ public class AppointmentController { order.setNumSourceFrom(WanDaConstant.NUM_SOURCE_FROM); order.setPatient_type(WanDaConstant.PATIENT_TYPE_NORMAL); if (StrUtil.isBlank(order.getMediCardId()) || StrUtil.isBlank(order.getMediCardType())) { - order.setMediCardId(patient.getMediCardId()); - order.setMediCardType(patient.getMediCardType()); + log.error("自动设置卡类型"); + order.setMediCardId(""); + order.setMediCardType(""); + + if (StrUtil.isAllNotBlank(patient.getMediCardId(), patient.getMediCardType()) + && WanDaConstant.ORDER_MODEL_1.equals(hos.getOrderMode())) { + log.error("卡号= {},卡类型={}", patient.getMediCardId(), patient.getMediCardType()); + order.setMediCardId(patient.getMediCardId()); + order.setMediCardType(patient.getMediCardType()); + } } order.setUserBD(DateUtil.format(IdcardUtil.getBirthDate(patient.getCertId()), DatePattern.NORM_DATE_PATTERN)); AppResult result = WanDaHttpUtil.submitOrderByUserInfo(order); 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 895604abd088fc0693a372489cd0ddff025823f6..5b648af330162e64b08aa5693444fdf653b6033d 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 @@ -188,6 +188,15 @@ public class HphyPatientBaseController { SecurityUtils.updateCurrent(current); } + // 更新卡号卡类型 + if (LoginTypeEnum.WOA_NL.getType().equals(source)) { + XSZYUserInfo xszyUserInfo = JSONUtil.toBean(current.getXszyUserInfo(), XSZYUserInfo.class); + log.error("woaXszyUser = {}", xszyUserInfo); + base.setMediCardType(xszyUserInfo.getMediCardType()); + base.setMediCardId(xszyUserInfo.getMediCardId()); + hphyPatientBaseService.updateById(base); + } + return new R(base); } diff --git a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientBaseServiceImpl.java b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientBaseServiceImpl.java index df49f0e73a0fa1c2866c970ce08a892c74937d8e..d8830198d0172661bd7b7d666f334c79853fa470 100644 --- a/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientBaseServiceImpl.java +++ b/smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientBaseServiceImpl.java @@ -95,6 +95,10 @@ public class HphyPatientBaseServiceImpl extends ServiceImpl getHasRemainNum(List hpgpBusyIdlePredictionList) { + if (CollUtil.isEmpty(hpgpBusyIdlePredictionList)) { + return Collections.emptyList(); + } + + // 当前医院近七天有号的三个科室 + List deptCodeList = hpgpBusyIdlePredictionList.stream() + // 按科室分组,并统计每个科室可预约号源总量 + .collect(Collectors.groupingBy(HpgpBusyIdlePrediction::getDeptCode, + Collectors.summingInt(item -> Optional.ofNullable(item.getRemainNum()).orElse(0)))) + .entrySet().stream() + // 按可预约号源进行排序,取排名前三的科室 + .sorted(Collections.reverseOrder(Map.Entry.comparingByValue())) + .map(Map.Entry::getKey) + .limit(3) + .collect(Collectors.toList()); + + return hpgpBusyIdlePredictionList.stream().filter(item -> deptCodeList.contains(item.getDeptCode())).collect(Collectors.toList()); + + } +} diff --git a/smart-health-modules/theme-schema/src/main/resources/mapper/HpHzjlMapper.xml b/smart-health-modules/theme-schema/src/main/resources/mapper/hpgp/HpHzjlMapper.xml similarity index 100% rename from smart-health-modules/theme-schema/src/main/resources/mapper/HpHzjlMapper.xml rename to smart-health-modules/theme-schema/src/main/resources/mapper/hpgp/HpHzjlMapper.xml