1、xml配置文件读取新增读取指定节点配置,并调整消息推送配置为新配置,并调整部分字段名称和注释。

2、智能导诊查询用户信息调整为openid查询,返回科室列表调整为有号源的科室。
debug
王绍全 1 week ago
parent e3522163c1
commit 3d36e15159
  1. 2
      src/main/java/com/ynxbd/common/action/RegisterAction.java
  2. 14
      src/main/java/com/ynxbd/common/action/test/TestAction.java
  3. 5
      src/main/java/com/ynxbd/common/dao/his/HisRegisterDao.java
  4. 19
      src/main/java/com/ynxbd/common/helper/common/XmlConfigHelper.java
  5. 25
      src/main/java/com/ynxbd/common/service/AIGuidanceService.java
  6. 7
      src/main/java/com/ynxbd/common/service/PatientService.java
  7. 100
      src/main/java/com/ynxbd/jy/helper/JYPayHelper.java
  8. 103
      src/main/java/com/ynxbd/wx/config/MessagePushConfig.java
  9. 4
      src/main/resources/jy-pay-config.xml
  10. 21
      src/main/resources/message-push.properties
  11. 34
      src/main/resources/wx-msg-push.xml

@ -90,7 +90,7 @@ public class RegisterAction extends BaseAction {
return Result.error(ResultEnum.PARAM_IS_DEFECT);
}
List<Dept> deptList = new HisRegisterDao().getTimeDeptList(begDate, endDate, deptCode, "1");
List<Dept> deptList = new HisRegisterDao().getTimeDeptList(begDate, endDate, deptCode);
MerchantEnum merchantEnum = MerchantEnum.findEnumByCode(merCode);
if (MerchantEnum.ALI.equals(merchantEnum)) {

@ -8,6 +8,7 @@ import com.ynxbd.common.helper.common.SmsHelper;
import com.ynxbd.common.result.Result;
import com.ynxbd.common.result.ResultEnum;
import com.ynxbd.common.result.ServiceException;
import com.ynxbd.wx.config.MessagePushConfig;
import com.ynxbd.wx.config.TZReserveConfig;
import com.ynxbd.wx.config.WeChatConfig;
import com.ynxbd.wx.wxfactory.WxMedHelper;
@ -131,6 +132,19 @@ public class TestAction extends BaseAction {
return Result.redirect("/wx/test02/log_test");
}
@Action("wx_push_test")
public Result wx_push_test() {
System.out.println("HOST_URL:" + MessagePushConfig.HOST_URL);
System.out.println("[挂号]缴费通知:" + MessagePushConfig.REG_PAID_URL);
System.out.println("[挂号]取消预约:" + MessagePushConfig.REG_CANCEL_URL);
System.out.println("[挂号]AI:" + MessagePushConfig.REG_AI_URL);
System.out.println("[处方]缴费通知:" + MessagePushConfig.RX_PAID_URL);
System.out.println("产科建档:" + MessagePushConfig.OBS_DOCUMENT_URL);
return Result.success();
}
// @Action("lock")
// public String lock() {
// return Result.success(update());

@ -738,16 +738,15 @@ public class HisRegisterDao {
* @param begDate 开始时间
* @param endDate 结束时间
* @param deptCode 科室编码-空为所有
* @param canRegFlag [空或0为所有科室; 1:返回有号源的科室]
*/
public List<Dept> getTimeDeptList(String begDate, String endDate, String deptCode, String canRegFlag) {
public List<Dept> getTimeDeptList(String begDate, String endDate, String deptCode) {
List<Dept> deptList = new ArrayList<>();
Map<String, Object> params = new HashMap<>();
params.put("DeptCode", deptCode);// 空为所有
params.put("RegistBegDate", begDate);
params.put("RegistEndDate", endDate);
params.put("CanRegistFlag", canRegFlag); // [空或0为所有科室; 1:返回有号源的科室]
params.put("CanRegistFlag", "1"); // [空或0为所有科室; 1:返回有号源的科室]
JsonResult JsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_Dept_New, params);
if (!JsonResult.success()) {

@ -50,6 +50,23 @@ public class XmlConfigHelper {
this.isEnable = isEnable;
}
/**
* 获取配置文件节点
*
* @param nodeName 节点名
* @return Integer
*/
public XmlConfigHelper getConfigNode(String nodeName) {
try {
XmlConfigHelper config = new XmlConfigHelper();
config.root = root.element(nodeName);
return config;
} catch (Exception e) {
return null;
}
}
/**
* 获取配置文件Boolean值,可设默认值
*
@ -115,7 +132,7 @@ public class XmlConfigHelper {
public Integer getInteger(String rootNode) {
try {
String val = getString(rootNode, null);
return ObjectUtils.isEmpty(val)? null : Integer.parseInt(val.trim());
return ObjectUtils.isEmpty(val) ? null : Integer.parseInt(val.trim());
} catch (Exception e) {
e.printStackTrace();
return null;

@ -85,7 +85,7 @@ public class AIGuidanceService {
List<Dept> deptList;
if (HCAIGuidanceConfig.IS_SPLIT_TIME_REG) { // 分时段
String curDate = DateHelper.getCurDate();
deptList = new HisRegisterDao().getTimeDeptList(curDate, DateHelper.getMoveDate(curDate, 7), "", "0");
deptList = new HisRegisterDao().getTimeDeptList(curDate, DateHelper.getMoveDate(curDate, 7), "");
} else {
deptList = new RegService().queryHisRegDeptList();
}
@ -95,32 +95,31 @@ public class AIGuidanceService {
AIDept addItem;
List<Dept> children;
for (Dept dept : deptList) {
addItem = createAIDept(webReqURL, dept);
children = dept.getChildren();
boolean hasChildren = children != null && !children.isEmpty();
addItem = createAIDept(webReqURL, dept, hasChildren ? 1 : 2);
if (addItem == null) {
continue;
}
dataList.add(addItem);
children = dept.getChildren();
boolean hasChildren = children != null && !children.isEmpty();
if (hasChildren) {
for (Dept childDept : children) {
childDept.setSubDeptCode(childDept.getDeptCode());
childDept.setDeptCode(dept.getDeptCode());
addItem = createAIDept(webReqURL, childDept);
addItem = createAIDept(webReqURL, childDept, 2);
if (addItem == null) {
continue;
}
dataList.add(addItem);
}
} else {
dataList.add(addItem);
}
}
return Result.success(ResultEnum.AI_SUCCESS, dataList);
}
private AIDept createAIDept(String webReqURL, Dept dept) {
private AIDept createAIDept(String webReqURL, Dept dept, int level) {
AIDept item = new AIDept();
String subDeptCode = dept.getSubDeptCode();
boolean isSubDept = !ObjectUtils.isEmpty(subDeptCode);
@ -133,7 +132,7 @@ public class AIGuidanceService {
item.setDeptName(deptName);
item.setDeptIntro(dept.getDescription() == null ? "暂无内容" : dept.getDescription()); // 科室简介
item.setDeptAddr(dept.getAddress() == null ? "暂无内容" : dept.getAddress()); // 科室地址
item.setLevel(2);
item.setLevel(level);
item.setParentDeptId(isSubDept ? dept.getDeptCode() : "");
item.setFeatureFlag(0); // 是否特色科室
item.setTreatrange(""); // 诊疗范围
@ -309,18 +308,19 @@ public class AIGuidanceService {
return Result.success(ResultEnum.AI_SUCCESS, resp);
}
Patient patient = new PatientService().queryOnePatientByPatientId(patientId);
if (patient == null) {
List<Patient> patients = new PatientService().queryPatientListByOpenId(patientId);
if (patients.isEmpty()) {
return Result.success(ResultEnum.AI_SUCCESS, resp);
}
for (Patient patient : patients) {
String birthday = patient.getBirthday();
String idCardNo = patient.getIdCardNo();
if ((ObjectUtils.isEmpty(birthday) || birthday.length() != 10) && !ObjectUtils.isEmpty(idCardNo)) {
birthday = IDNumberHelper.getBirthday(idCardNo);
}
if (birthday == null) {
return Result.success(ResultEnum.AI_SUCCESS, resp);
continue;
}
AIPatient item = new AIPatient();
@ -335,6 +335,7 @@ public class AIGuidanceService {
item.setLastBindTime(bindTime == null ? DateHelper.getCurDateTime() : bindTime);
item.setRelation(ObjectUtils.isEmpty(patient.getIdCardNo()) ? "2" : "6"); // 2子女; 6其他
cardList.add(item);
}
resp.put("cardList", cardList);
return Result.success(ResultEnum.AI_SUCCESS, resp);

@ -628,6 +628,13 @@ public class PatientService {
return patients.isEmpty() ? null : patients.get(0);
}
public List<Patient> queryPatientListByOpenId(String openid) {
if (ObjectUtils.isEmpty(openid)) {
return new ArrayList<>();
}
return new PatientDao().selectListByToken(openid, null);
}
// /**
// * [维护]替换患者id为医共体id

@ -0,0 +1,100 @@
package com.ynxbd.jy.helper;
import com.alibaba.fastjson.JSONObject;
import com.ynxbd.common.bean.enums.MerchantEnum;
import com.ynxbd.common.helper.common.ErrorHelper;
import com.ynxbd.common.helper.common.JsonHelper;
import com.ynxbd.wx.config.WeChatConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import weixin.popular.api.PayMchAPI;
import weixin.popular.bean.paymch.Unifiedorder;
import weixin.popular.bean.paymch.UnifiedorderResult;
import java.math.BigDecimal;
import java.util.UUID;
// 京颐支付
@Slf4j
public class JYPayHelper {
/**
* 商户创建订单
*
* @param merchantEnum 枚举
* @param title 商品标题
* @param totalFee 订单金额
* @param outTradeNo 订单号
* @param notifyType 回调类型
* @param ip ip地址
* @param payOpenId 用于下单的openId
* @param msgOpenId 用于推送的openId
* @return 成功返回 json, 否则返回null
*/
public static JSONObject createOrder(MerchantEnum merchantEnum, String title, String totalFee, String outTradeNo, String notifyType, String ip, String payOpenId, String msgOpenId) {
// try {
// if (ObjectUtils.isEmpty(payOpenId) || ObjectUtils.isEmpty(outTradeNo)
// || merchantEnum == null || totalFee == null || notifyType == null) {
// log.info("【京硕】下单参数缺失");
// return null;
// }
//
// String cents;
// try {
// cents = new BigDecimal(totalFee).movePointRight(2).toString(); // 金额转换=>单位分
// } catch (Exception e) {
// ErrorHelper.println(e);
// log.info("【京硕】统一下单金额转换异常");
// return null;
// }
//
// String appId = merchantEnum.APP_ID;
// String mchId = WeChatConfig.MCH_ID;
// String mchKey = WeChatConfig.MCH_KEY;
// String nonce = UUID.randomUUID().toString().replace("-", "");
//
// Unifiedorder unifiedorder = new Unifiedorder();
// unifiedorder.setAppid(appId);
// unifiedorder.setMch_id(mchId);
// unifiedorder.setNonce_str(nonce);
// unifiedorder.setOpenid(payOpenId);
// unifiedorder.setOut_trade_no(outTradeNo);
// unifiedorder.setBody(title);
//
// unifiedorder.setTotal_fee(cents); // 金额分
// unifiedorder.setSpbill_create_ip(ip);
// unifiedorder.setNotify_url(WeChatConfig.getBaseURL() + merchantEnum.NOTIFY_URL);
// unifiedorder.setTrade_type("JSAPI");
// // 额外参数
// unifiedorder.setAttach(notifyType);
//
// log.info("【京硕】统一下单 {},{},{},{},{},{},{},{}", appId, mchId, nonce, title, outTradeNo, totalFee, ip, merchantEnum.NOTIFY_URL);
//
// // 微信统一下单
// UnifiedorderResult unifiedorderResult = PayMchAPI.payUnifiedorder(unifiedorder, mchKey);
// log.info("【京硕】统一下单返回:{}", JsonHelper.toJsonString(unifiedorderResult));
// if (unifiedorderResult == null) {
// log.info("【京硕】统一下单失败");
// return null;
// }
//
// String result_code = unifiedorderResult.getResult_code();
// // 下单是否成功
// Boolean sign_status = unifiedorderResult.getSign_status();
// if (!SUCCESS.equals(result_code) || sign_status == null || !sign_status) {
// log.info("【京硕】统一下单返回异常信息:sign_status={}, err_code=[ {} ], err_code_des=[ {} ]", sign_status, unifiedorderResult.getErr_code(), unifiedorderResult.getErr_code_des());
// return null;
// }
// String json = weixin.popular.util.PayUtil.generateMchPayJsRequestJson(unifiedorderResult.getPrepay_id(), appId, mchKey);
// if (json != null) {
// return JsonHelper.parseObject(json);
// }
// } catch (Exception e) {
// log.error("【京硕】统一下单异常信息:{}", e.getMessage());
// ErrorHelper.println(e);
// }
// return null;
return null;
}
}

@ -5,7 +5,7 @@ import com.ynxbd.common.bean.enums.MerchantEnum;
import com.ynxbd.common.bean.pay.Recipe;
import com.ynxbd.common.bean.pay.Register;
import com.ynxbd.common.dao.PatientDao;
import com.ynxbd.common.helper.ProperHelper;
import com.ynxbd.common.helper.common.XmlConfigHelper;
import com.ynxbd.common.helper.http.OkHttpHelper;
import com.ynxbd.wx.pwe.PWEHelper;
import com.ynxbd.wx.utils.DesEncryptHelper;
@ -21,64 +21,75 @@ public class MessagePushConfig {
private MessagePushConfig() {
}
public static final String ORGANIZENAME;
public static final String ORGANIZENAME = "4B80803106B38A5F";
// 挂号导航是否开启功能=====================================
/**
* 消息推送链接
*/
public static final String HOST_URL;
// [挂号]导航推送
public static final boolean REG_NAVIGATE_IS_ENABLE;
// 挂号导航请求链接
public static final String REG_NAVIGATE_URL;
// 挂号成功DateTime是否开启功能==================================
public static final boolean REG_IS_ENABLE;
// 挂号请求链接
public static final String REG_URL;
// [挂号]缴费通知
public static final boolean REG_PAID_IS_ENABLE;
public static final String REG_PAID_URL;
// 是否开启功能============================================
// [挂号]取消预约
public static final boolean REG_CANCEL_IS_ENABLE;
// 消息推送链接
public static final String REG_CANCEL_URL;
public static final String OBS_DOCUMENT;
// 是否开启功能============================================
public static final boolean RECIPE_IS_ENABLE;
// [挂号]AI
public static final String REG_AI_URL;
public static final boolean REG_AI_IS_ENABLE;
/**
* 消息推送主链接
*/
public static final String HOST_URL;
// [处方]缴费通知
public static final boolean RX_PAID_IS_ENABLE;
public static final String RX_PAID_URL;
// 消息推送链接
public static final String RECIPE_URL;
// 产科建档
public static final boolean OBS_DOCUMENT_IS_ENABLE;
public static final String OBS_DOCUMENT_URL;
static {
ProperHelper config = new ProperHelper().read("message-push.properties");
XmlConfigHelper config = new XmlConfigHelper().read("wx-msg-push.xml");
ORGANIZENAME = "4B80803106B38A5F";
HOST_URL = config.getString("host_url","");
if (ObjectUtils.isEmpty(HOST_URL)) {
log.error("【消息推送】配置文件wx-msg-push.xml读取失败");
}
REG_NAVIGATE_IS_ENABLE = config.getBoolean("msg.reg.navigate.is_enable", false);
REG_NAVIGATE_URL = config.getString("msg.reg.navigate.url");
//
REG_IS_ENABLE = config.getBoolean("msg.reg.is_enable", false);
REG_URL = config.getString("msg.reg.url");
OBS_DOCUMENT = config.getString("msg.obs.document");
//
REG_CANCEL_IS_ENABLE = config.getBoolean("msg.reg.cancel.is_enable", false);
REG_CANCEL_URL = config.getString("msg.reg.cancel.url");
HOST_URL = config.getString("msg.host.url");
//
RECIPE_IS_ENABLE = config.getBoolean("msg.recipe.is_enable", false);
RECIPE_URL = config.getString("msg.recipe.url");
// [挂号]导航推送
XmlConfigHelper regNavigateConfig = config.getConfigNode("reg_navigate");
REG_NAVIGATE_IS_ENABLE = regNavigateConfig.getBoolean("is_enable", false);
REG_NAVIGATE_URL = HOST_URL + regNavigateConfig.getString("api");
REG_AI_IS_ENABLE = config.getBoolean("msg.ai.is_enable", false);
REG_AI_URL = config.getString("msg.ai.url");
// [挂号]缴费通知
XmlConfigHelper regPaidConfig = config.getConfigNode("reg_paid");
REG_PAID_IS_ENABLE = regPaidConfig.getBoolean("is_enable", false);
REG_PAID_URL = HOST_URL + regPaidConfig.getString("api");
if (REG_CANCEL_URL == null) {
log.error("【消息推送】配置文件message-push.properties读取失败");
}
// [挂号]取消预约
XmlConfigHelper regCancelConfig = config.getConfigNode("reg_cancel");
REG_CANCEL_IS_ENABLE = regCancelConfig.getBoolean("is_enable", false);
REG_CANCEL_URL = HOST_URL + regCancelConfig.getString("api");
// [挂号]AI
XmlConfigHelper regAIConfig = config.getConfigNode("reg_ai");
REG_AI_IS_ENABLE = regAIConfig.getBoolean("is_enable", false);
REG_AI_URL = HOST_URL + regAIConfig.getString("api");
// [处方]缴费通知
XmlConfigHelper rxPaidConfig = config.getConfigNode("rx_paid");
RX_PAID_IS_ENABLE = rxPaidConfig.getBoolean("is_enable", false);
RX_PAID_URL = HOST_URL + rxPaidConfig.getString("api");
// 产科建档
XmlConfigHelper obsDocumentConfig = config.getConfigNode("obs_document");
OBS_DOCUMENT_IS_ENABLE = obsDocumentConfig.getBoolean("is_enable", false);
OBS_DOCUMENT_URL = HOST_URL + obsDocumentConfig.getString("api");
}
@ -135,7 +146,7 @@ public class MessagePushConfig {
public static void regPush(MerchantEnum merchantEnum, Register reg) {
try {
if (!merchantEnum.equals(MerchantEnum.WX)
|| !REG_IS_ENABLE || reg == null || ObjectUtils.isEmpty(REG_URL)) {
|| !REG_PAID_IS_ENABLE || reg == null || ObjectUtils.isEmpty(REG_PAID_URL)) {
return;
}
@ -163,7 +174,7 @@ public class MessagePushConfig {
String time = (ObjectUtils.isEmpty(begTime) || ObjectUtils.isEmpty(endTime)) ? "" : (" " + begTime + "-" + endTime);
OkHttpHelper.getAsync(REG_URL, params -> {
OkHttpHelper.getAsync(REG_PAID_URL, params -> {
params.put("openId", DesEncryptHelper.enCode(openid));
params.put("patientName", patient.getName() + " ID:" + patientId);
params.put("deptName", deptName);
@ -282,7 +293,7 @@ public class MessagePushConfig {
public static void regObsDocument(MerchantEnum merchantEnum, Register reg) {
try {
if (!merchantEnum.equals(MerchantEnum.WX)
|| reg == null || ObjectUtils.isEmpty(OBS_DOCUMENT)) {
|| reg == null || ObjectUtils.isEmpty(OBS_DOCUMENT_URL)) {
return;
}
@ -300,7 +311,7 @@ public class MessagePushConfig {
.add("organizeName", ORGANIZENAME)
.add("buttonName", "进入产科建档系统")
.build();
OkHttpHelper.post(OBS_DOCUMENT, requestBody);
OkHttpHelper.post(OBS_DOCUMENT_URL, requestBody);
} catch (Exception e) {
log.warn("[推送]产科建档推送通知错误-{}", e.getMessage());
}
@ -359,7 +370,7 @@ public class MessagePushConfig {
*/
public static void recipePush(List<Recipe> recipeList, String treatNum, String patientId, String openid, String tip) {
try {
if (!RECIPE_IS_ENABLE || ObjectUtils.isEmpty(RECIPE_URL)) {
if (!RX_PAID_IS_ENABLE || ObjectUtils.isEmpty(RX_PAID_URL)) {
return;
}
@ -383,7 +394,7 @@ public class MessagePushConfig {
return;
}
OkHttpHelper.getAsync(RECIPE_URL, params -> {
OkHttpHelper.getAsync(RX_PAID_URL, params -> {
params.put("openId", DesEncryptHelper.enCode(openid));
params.put("patientName", patient.getName() + " ID:" + patientId);
params.put("content", tip);

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<config>
</config>

@ -1,21 +0,0 @@
# 消息推送
# 挂号-导航推送
msg.host.url = http://127.0.0.1:8123/MessagePlatform/
msg.reg.navigate.is_enable=false
msg.reg.navigate.url=http://127.0.0.1:8123/MessagePlatform/daoyixun
# 挂号-文字提示推送
msg.reg.is_enable=false
msg.reg.url=http://127.0.0.1:8123/MessagePlatform/appointmentsuccess
# 挂号-取消预约推送
msg.reg.cancel.is_enable=false
msg.reg.cancel.url=http://127.0.0.1:8123/MessagePlatform/appointmentcancel
# 缴费
msg.recipe.is_enable=false
msg.recipe.url=http://127.0.0.1:8123/MessagePlatform/paymentsuccess
# 产科建档
msg.obs.document = http://127.0.0.1:8123/MessagePlatform/business/universal
msg.ai.is_enable = false
msg.ai.url = http://127.0.0.1:8123/MessagePlatform/business/universal

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<config>
<host_url name="链接">http://127.0.0.1:8123/MessagePlatform/</host_url>
<reg_navigate name="[挂号]导航推送">
<is_enable>false</is_enable>
<api>daoyixun</api>
</reg_navigate>
<reg_paid name="[挂号]缴费通知">
<is_enable>false</is_enable>
<api>appointmentsuccess</api>
</reg_paid>
<reg_cancel name="[挂号]取消预约">
<is_enable>false</is_enable>
<api>appointmentcancel</api>
</reg_cancel>
<reg_ai name="[挂号]AI">
<is_enable>false</is_enable>
<api>business/universal</api>
</reg_ai>
<rx_paid name="[处方]缴费通知">
<is_enable>false</is_enable>
<api>paymentsuccess</api>
</rx_paid>
<obs_document name="产科建档">
<is_enable>false</is_enable>
<api>business/universal</api>
</obs_document>
</config>
Loading…
Cancel
Save