2、HIS的SOAP抽离为对象管理调用,因住院结算医保调用环境为测试服务,增加维护难度,调整为用参数控制调用环境。 3、SOAP调用异常后读取流异常处理,优化读取数据操作。 4、请求HIS接口时,使用了雪花id作为请求id,可能会出现时钟回拨,导致导致调用异常,调整为uuid。 5、新增京颐支付相关接口。 6、住院结算医保支付接口新增,处理医保支付传递的公共参数进行合并。 7、新增处方开单字典查询接口 8、查询住院费用清单(住院中)接口返回的数量为小数导致数据解析失败的问题修复。debug
parent
f7902f9581
commit
e3165b196d
64 changed files with 2311 additions and 1590 deletions
@ -0,0 +1,33 @@ |
||||
package com.ynxbd.common.action.xk; |
||||
|
||||
import com.ynxbd.common.action.base.BaseAction; |
||||
import com.ynxbd.common.dao.his.HisXKDao; |
||||
import com.ynxbd.common.result.Result; |
||||
import com.ynxbd.common.result.ResultEnum; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.struts2.convention.annotation.Action; |
||||
import org.apache.struts2.convention.annotation.Namespace; |
||||
|
||||
import java.util.List; |
||||
|
||||
|
||||
@Slf4j |
||||
@Namespace("/xk") |
||||
public class XKAction extends BaseAction { |
||||
|
||||
|
||||
@Action("queryDict") |
||||
public Result queryDict(String callNo, String type) { |
||||
if (!"xbd2026".equals(callNo)) { |
||||
return Result.error(ResultEnum.PARAM_IS_INVALID); |
||||
} |
||||
log.info("[开方]字典查询 type={}", type); |
||||
if (type == null) { |
||||
return Result.error(ResultEnum.PARAM_IS_DEFECT); |
||||
} |
||||
|
||||
List<?> dataList = new HisXKDao().queryHisRxDict(type); |
||||
return Result.success(dataList); |
||||
} |
||||
|
||||
} |
||||
@ -1,50 +0,0 @@ |
||||
package com.ynxbd.common.helper.his; |
||||
|
||||
import com.ynxbd.common.result.JsonResult; |
||||
import com.ynxbd.common.result.JsonResultEnum; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
public class HisDevHelper { |
||||
|
||||
// 测试环境---------------------------------------------------------------------------
|
||||
/** |
||||
* 测试环境 |
||||
* |
||||
* @param hisEnum 枚举 |
||||
* @param params 发送的参数 |
||||
* @return 响应的xml数据 |
||||
*/ |
||||
public static String getDevResponseXml(HisEnum hisEnum, Map<String, Object> params) { |
||||
return HisHelper.getResponseXml(hisEnum, HisHelper.HIS_SOAP_DEV_URL, params); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public static JsonResult getDevJsonResult(HisEnum hisEnum, Map<String, Object> params) { |
||||
JsonResult result = JsonResult.xmlToBean(getDevResponseXml(hisEnum, params), JsonResultEnum.SYS_HIS); |
||||
if (result == null) { // 如果返回为空可能为超时
|
||||
return HisHelper.createTimeoutResult(); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public static JsonResult getDevJsonResult(HisEnum hisEnum, JsonResult.MapParams params) { |
||||
Map<String, Object> requestParams = new HashMap<>(); |
||||
if (params != null) { |
||||
params.setParams(requestParams); |
||||
} |
||||
return getDevJsonResult(hisEnum, requestParams); |
||||
} |
||||
|
||||
} |
||||
@ -1,414 +0,0 @@ |
||||
package com.ynxbd.common.helper.his; |
||||
|
||||
import com.ynxbd.common.action.pay.PEnum; |
||||
import com.ynxbd.common.bean.enums.MerchantEnum; |
||||
import com.ynxbd.common.bean.pay.Order; |
||||
import com.ynxbd.common.helper.ProperHelper; |
||||
import com.ynxbd.common.helper.common.CodeHelper; |
||||
import com.ynxbd.common.helper.common.ErrorHelper; |
||||
import com.ynxbd.common.helper.common.SnowHelper; |
||||
import com.ynxbd.common.helper.common.SoapHelper; |
||||
import com.ynxbd.common.result.JsonResult; |
||||
import com.ynxbd.common.result.JsonResultEnum; |
||||
import com.ynxbd.common.service.MiddleOfficeService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang3.ObjectUtils; |
||||
import org.dom4j.DocumentException; |
||||
import org.dom4j.DocumentHelper; |
||||
import org.dom4j.Element; |
||||
import org.dom4j.Node; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Slf4j |
||||
public class HisHelper { |
||||
public static final String SOAP_ENV = "<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" "; |
||||
|
||||
// 微信
|
||||
public static final String WECHAT_CALL_NO = "843242395"; |
||||
// 支付宝
|
||||
public static final String ALI_CALL_NO = "675448357"; |
||||
|
||||
// private static final String NS = "http://tempuri.org/";
|
||||
// private static String HIS_WSD_URL;
|
||||
|
||||
// webService请求地址
|
||||
protected static final String HIS_SOAP_URL; |
||||
protected static final String HIS_SOAP_DEV_URL; |
||||
|
||||
// HIS医保环境
|
||||
// protected static final String HIS_DEV_MI_URL;
|
||||
// protected static final String HIS_PROD_MI_URL;
|
||||
|
||||
protected static final String HIS_WX_MED_URL; |
||||
protected static final String HIS_ALI_MED_URL; |
||||
|
||||
|
||||
// 是否强制打印HIS响应的xml
|
||||
private static final Boolean IS_LOG_RESP; |
||||
// 是否使用"<![CDATA[]]>"阻止解析
|
||||
private static final Boolean IS_REQ_CDATA; |
||||
|
||||
// 是否传递openid给HIS推送消息
|
||||
public static final Boolean IS_PUSH_MSG; |
||||
// 是否开启支付宝蓝旗调用call_no
|
||||
public static final Boolean IS_ALI_MER; |
||||
|
||||
// 开启预结算(第1开关)(如果HIS未限制-则存在直接入库风险!!!!!!!!!!!!!!!!!!)
|
||||
public static final boolean IS_RECIPE_PREPAY; |
||||
|
||||
static { |
||||
ProperHelper config = new ProperHelper().read("webservice.properties"); |
||||
|
||||
String url = config.getString("his.url"); |
||||
String devUrl = config.getString("his.dev_url"); |
||||
|
||||
// 医保---------------------------------------------------------
|
||||
String mdUrl = config.getString("his.md_url"); // 微信医保旧版地址
|
||||
String wxMedUrl = config.getString("his.wx_med_url"); |
||||
String aliMedUrl = config.getString("his.ali_med_url"); |
||||
|
||||
IS_LOG_RESP = config.getBoolean("his.is_log_resp", false); |
||||
IS_PUSH_MSG = config.getBoolean("his.is_push_msg", false); |
||||
IS_ALI_MER = config.getBoolean("his.is_ali_mer", false); |
||||
IS_REQ_CDATA = config.getBoolean("his.is_req_cdata", false); |
||||
IS_RECIPE_PREPAY = config.getBoolean("his.is_recipe_prepay", false); |
||||
|
||||
if (url == null) { |
||||
log.error("WebService配置文件读取失败"); |
||||
} |
||||
HIS_SOAP_URL = initSoapURL(url); |
||||
HIS_SOAP_DEV_URL = initSoapURL(devUrl); |
||||
|
||||
// 医保---------------------------------
|
||||
HIS_WX_MED_URL = initSoapURL(wxMedUrl == null ? mdUrl : wxMedUrl); |
||||
HIS_ALI_MED_URL = initSoapURL(aliMedUrl); |
||||
} |
||||
|
||||
private static String initSoapURL(String ip) { |
||||
if (ObjectUtils.isEmpty(ip)) { |
||||
return null; |
||||
} |
||||
if (ip.contains("http")) { |
||||
return ip; |
||||
} |
||||
return "http://" + ip + "/WebService_AB.dll/soap/IInterface_AB"; |
||||
} |
||||
|
||||
/** |
||||
* 生成HIS订单号 |
||||
*/ |
||||
public static List<Order> getHisTradeNo(String prefix, List<Long> ids, PEnum pEnum) { |
||||
if (pEnum == null) { |
||||
return null; |
||||
} |
||||
return CodeHelper.createTradeNo(prefix, pEnum.ORDER_CODE.toUpperCase(), ids); |
||||
} |
||||
|
||||
/** |
||||
* 生成HIS订单号 |
||||
*/ |
||||
public static String getHisTradeNo(String prefix, PEnum pEnum) { |
||||
if (pEnum == null) { |
||||
return null; |
||||
} |
||||
return prefix + pEnum.ORDER_CODE.toUpperCase() + "001"; |
||||
} |
||||
|
||||
|
||||
// // 修改callNo为阿里code
|
||||
// public static void putCallNoByMer(MerchantEnum merchantEnum, Map<String, Object> params) {
|
||||
// if (merchantEnum == null) return;
|
||||
//
|
||||
// if (merchantEnum.equals(MerchantEnum.ALI) || merchantEnum.equals(MerchantEnum.ALI_MEDICAL)) {
|
||||
// params.put("CallNo", ALI_CALL_NO);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/** |
||||
* webService请求工具类(枚举版) |
||||
* |
||||
* @param hisEnum 枚举 |
||||
* @param params 发送的参数 |
||||
* @return 响应的xml数据 |
||||
*/ |
||||
public static String getResponseXml(HisEnum hisEnum, Map<String, Object> params) { |
||||
return getResponseXml(hisEnum, HIS_SOAP_URL, params); |
||||
} |
||||
|
||||
/** |
||||
* webService请求工具类(枚举版) |
||||
* |
||||
* @param hisEnum 枚举 |
||||
* @param params 发送的参数 |
||||
* @return 响应的xml数据 |
||||
*/ |
||||
public static String getResponseXml(HisEnum hisEnum, String soapUrl, Map<String, Object> params) { |
||||
return getResponseXmlForCallNo(hisEnum, soapUrl, params); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* webService请求工具类(枚举版) |
||||
* |
||||
* @param hisEnum 枚举 |
||||
* @param soapUrl 路径 |
||||
* @param params 参数 |
||||
* @return 响应xml |
||||
*/ |
||||
public static String getResponseXmlForCallNo(HisEnum hisEnum, String soapUrl, Map<String, Object> params) { |
||||
String method = hisEnum.METHOD; |
||||
String transactionCode = hisEnum.CODE; |
||||
|
||||
if (params == null || transactionCode == null || method == null) { |
||||
log.info("[WebService]-{ map | transactionCode | method 为空 }"); |
||||
return null; |
||||
} |
||||
Object callNo = params.get("CallNo"); |
||||
if (ObjectUtils.isEmpty(callNo)) { |
||||
params.put("CallNo", WECHAT_CALL_NO); |
||||
} |
||||
params.put("TransactionCode", transactionCode); |
||||
|
||||
String result = null; |
||||
try { |
||||
String reqId = SnowHelper.nextStrId(); |
||||
long begTime = System.currentTimeMillis(); // 开始时间
|
||||
String hisResponse = SoapHelper.post("HIS", soapUrl, null, SOAP_ENV + |
||||
"xmlns:urn=\"urn:Interface_ABIntf-IInterface_AB\">" + |
||||
"<soapenv:Header/><soapenv:Body>" + |
||||
"<urn:" + method + " soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">" + |
||||
"<InputStr xsi:type=\"xsd:string\">" + |
||||
(IS_REQ_CDATA ? "<![CDATA[" : "") + |
||||
"<Request>" + SoapHelper.requestParams("HIS", transactionCode, reqId, params) + "</Request>" + |
||||
(IS_REQ_CDATA ? "]]>" : "") + |
||||
"</InputStr></urn:" + method + "></soapenv:Body></soapenv:Envelope>" |
||||
); |
||||
long endTime = System.currentTimeMillis(); // 结束时间
|
||||
String takeTime = (endTime - begTime) + "ms"; // 耗时
|
||||
if (hisResponse == null) { |
||||
log.info("[{}]HIS请求无响应[rid:{}]-耗时:[{}]", transactionCode, reqId, takeTime); |
||||
return null; |
||||
} |
||||
|
||||
//解析响应消息,使用SAXReader对象
|
||||
org.dom4j.Document document = DocumentHelper.parseText(hisResponse); |
||||
if (document == null) { |
||||
log.info("[{}]HIS响应内容解析失败[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, hisResponse); |
||||
return null; |
||||
} |
||||
|
||||
List<Node> nodes = document.selectNodes("//return"); |
||||
if (nodes.isEmpty()) { |
||||
log.info("[{}]HIS请求失败[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, hisResponse); |
||||
return null; |
||||
} |
||||
|
||||
Element element = (Element) nodes.get(0); |
||||
result = element.getText(); |
||||
if (hisEnum.IS_LOG_RESP) { // 是否打印返回的xml
|
||||
log.info("[{}]HIS请求成功[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, result); |
||||
|
||||
} else { |
||||
if (IS_LOG_RESP) { // 配置文件强制要求打印xml
|
||||
if (!HisEnum.AP_Query_Statement.equals(hisEnum) && !HisEnum.Query_Area.equals(hisEnum)) { |
||||
log.info("[强制打印][{}]HIS请求成功[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, result); |
||||
} |
||||
} |
||||
} |
||||
} catch (DocumentException e) { |
||||
ErrorHelper.println(e); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public static JsonResult getJsonResult(HisEnum hisEnum, Map<String, Object> params) { |
||||
JsonResult result = JsonResult.xmlToBean(getResponseXml(hisEnum, params), JsonResultEnum.SYS_HIS); |
||||
if (result == null) { // 如果返回为空可能为超时
|
||||
return createTimeoutResult(); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
public static void putAliCallNo(MerchantEnum merchantEnum, Map<String, Object> params) { |
||||
if (IS_ALI_MER && params != null && merchantEnum != null) { |
||||
if (merchantEnum.equals(MerchantEnum.ALI) || merchantEnum.equals(MerchantEnum.ALI_MEDICAL)) { |
||||
params.put("CallNo", ALI_CALL_NO); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public static JsonResult getJsonResultByMer(HisEnum hisEnum, MerchantEnum merchantEnum, Map<String, Object> params) { |
||||
putAliCallNo(merchantEnum, params); |
||||
return getJsonResult(hisEnum, params); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public static JsonResult getJsonResult(HisEnum hisEnum, JsonResult.MapParams params) { |
||||
Map<String, Object> requestParams = new HashMap<>(); |
||||
if (params != null) { |
||||
params.setParams(requestParams); |
||||
} |
||||
return getJsonResult(hisEnum, requestParams); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public static JsonResult getJsonResultByMer(HisEnum hisEnum, MerchantEnum merchantEnum, JsonResult.MapParams params) { |
||||
Map<String, Object> requestParams = new HashMap<>(); |
||||
if (params != null) { |
||||
params.setParams(requestParams); |
||||
} |
||||
return getJsonResultByMer(hisEnum, merchantEnum, requestParams); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public static JsonResult createErrorResult(String message) { |
||||
if (ObjectUtils.isEmpty(message)) { |
||||
message = "【HIS】请求参数缺失"; |
||||
} |
||||
return JsonResult.createErrorResult(message, JsonResultEnum.SYS_HIS); |
||||
} |
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
protected static JsonResult createTimeoutResult() { |
||||
return JsonResult.createTimeoutResult("【HIS】请求超时", JsonResultEnum.SYS_HIS); |
||||
} |
||||
|
||||
/** |
||||
* 字符串集转xml |
||||
* |
||||
* @param xmlTag xml标签 |
||||
* @param strList 字符串集 |
||||
* @return xml |
||||
*/ |
||||
public static String strListToXml(String xmlTag, List<String> strList) { |
||||
StringBuilder sb = new StringBuilder(); |
||||
for (String val : strList) { |
||||
sb.append("<").append(xmlTag).append(">").append(val).append("</").append(xmlTag).append(">"); |
||||
} |
||||
return sb.toString(); |
||||
} |
||||
|
||||
|
||||
// /**
|
||||
// * [支付宝] xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @param hisEnum 接口枚举
|
||||
// * @param params 参数
|
||||
// * @param merchantEnum 支付类型
|
||||
// * @return JsonResult
|
||||
// */
|
||||
// public static JsonResult getJsonResult(HisEnum hisEnum, Map<String, Object> params, MerchantEnum merchantEnum) {
|
||||
// JsonResult result = JsonResult.xmlToBean(getResponseXml(hisEnum, params, merchantEnum), JsonResultEnum.SYS_HIS);
|
||||
// if (result == null) { // 如果返回为空可能为超时
|
||||
// return createTimeoutResult();
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult getJsonResult(HisEnum hisEnum, JsonResult.MapParams params, MerchantEnum merchantEnum) {
|
||||
// Map<String, Object> requestParams = new HashMap<>();
|
||||
// if (params != null) {
|
||||
// params.setParams(requestParams);
|
||||
// }
|
||||
// return getJsonResult(hisEnum, requestParams, merchantEnum);
|
||||
// }
|
||||
|
||||
|
||||
// /**
|
||||
// * 根据订单号获取类型
|
||||
// *
|
||||
// * @param bankTransNo 交易流水号
|
||||
// * @param tradeNo HIS订单号
|
||||
// * @return 类型
|
||||
// */
|
||||
// public static String getTypeByPEnum(String bankTransNo, String tradeNo) throws ServiceException {
|
||||
// if (!PayService.isNewOrder(bankTransNo, tradeNo)) {
|
||||
// throw new ServiceException(ResultEnum.REFUND_IS_OLD_ORDER_NUM);
|
||||
// }
|
||||
// int len = tradeNo.length();
|
||||
// String middleCode1 = tradeNo.substring(len - 4, len - 3);
|
||||
// String middleCode2 = tradeNo.substring(len - 4, len - 2);
|
||||
// for (PEnum item : PEnum.values()) {
|
||||
// if (item.ORDER_CODE.equals(middleCode1) || item.ORDER_CODE.equals(middleCode2)) {
|
||||
// return item.CODE;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @param xml xml
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static HisResult xmlToBean(String xml) {
|
||||
// if (xml == null || "".equals(xml)) {
|
||||
// log.info("HIS response xml is null");
|
||||
// return HisResult.createErrorHisResult("[HIS]获取xml数据失败");
|
||||
// }
|
||||
//
|
||||
// JSONObject respObj;
|
||||
// try {
|
||||
// Document document = DocumentHelper.parseText(xml);
|
||||
// Element root = document.getRootElement(); // 获取根节点元素对象
|
||||
// respObj = HisResult.nodeToJsonObject(root);
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// Set<String> keys = respObj.keySet();
|
||||
// for (String key : keys) {
|
||||
// if (!key.equals("TransactionCode") && !key.equals("ResponseCode") && !key.equals("ResponseMessage") && !key.equals("PatientName")) {
|
||||
// map.put(key, respObj.getString(key));
|
||||
// }
|
||||
// }
|
||||
// respObj.put("DataMap", map);
|
||||
// } catch (DocumentException e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return HisResult.createErrorHisResult(e.getMessage());
|
||||
// }
|
||||
// HisResult hisResult = JSON.toJavaObject(respObj, HisResult.class);
|
||||
// if (hisResult.getResponseCode() != 0) {
|
||||
// log.info("HIS Error Message:[{}]", hisResult.getResponseMessage());
|
||||
// }
|
||||
// return hisResult;
|
||||
// }
|
||||
} |
||||
@ -1,84 +0,0 @@ |
||||
package com.ynxbd.common.helper.his; |
||||
|
||||
import com.ynxbd.common.bean.enums.MerchantEnum; |
||||
import com.ynxbd.common.result.JsonResult; |
||||
import com.ynxbd.common.result.JsonResultEnum; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang3.ObjectUtils; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Slf4j |
||||
public class HisMedHelper { |
||||
|
||||
/** |
||||
* 医保环境 |
||||
* |
||||
* @param hisEnum 枚举 |
||||
* @param params 发送的参数 |
||||
* @return 响应的xml数据 |
||||
*/ |
||||
private static String getResponseXml(MerchantEnum merchantEnum, HisEnum hisEnum, Map<String, Object> params) { |
||||
if (merchantEnum == null) { |
||||
log.error("[HIS医保接口]merchantEnum is null"); |
||||
return null; |
||||
} |
||||
String soapUrl = merchantEnum.isWx() ? HisHelper.HIS_WX_MED_URL : HisHelper.HIS_ALI_MED_URL; |
||||
if (ObjectUtils.isEmpty(soapUrl)) { |
||||
log.error("[HIS医保接口]soapUrl is null"); |
||||
return null; |
||||
} |
||||
return HisHelper.getResponseXml(hisEnum, merchantEnum.isWx() ? HisHelper.HIS_WX_MED_URL : HisHelper.HIS_ALI_MED_URL, params); |
||||
} |
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public static JsonResult getJsonResult(MerchantEnum merchantEnum, HisEnum hisEnum, Map<String, Object> params) { |
||||
HisHelper.putAliCallNo(merchantEnum, params); |
||||
|
||||
JsonResult result = JsonResult.xmlToBean(getResponseXml(merchantEnum, hisEnum, params), JsonResultEnum.SYS_HIS); |
||||
if (result == null) { // 如果返回为空可能为超时
|
||||
return HisHelper.createTimeoutResult(); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public static JsonResult getJsonResult(MerchantEnum merchantEnum, HisEnum hisEnum, JsonResult.MapParams params) { |
||||
Map<String, Object> requestParams = new HashMap<>(); |
||||
if (params != null) { |
||||
params.setParams(requestParams); |
||||
} |
||||
return getJsonResult(merchantEnum, hisEnum, requestParams); |
||||
} |
||||
|
||||
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult getJsonResult(boolean isDev, HisEnum hisEnum, Map<String, Object> params) {
|
||||
// return getJsonResultByMer(isDev, hisEnum, null, params);
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult getJsonResult(boolean isDev, HisEnum hisEnum, JsonResult.MapParams params) {
|
||||
// return getJsonResultByMer(isDev, hisEnum, null, params);
|
||||
// }
|
||||
|
||||
|
||||
} |
||||
@ -1,31 +1,31 @@ |
||||
package com.ynxbd.common.helper.his; |
||||
|
||||
import com.alipay.api.AlipayApiException; |
||||
import com.alipay.api.AlipayClient; |
||||
import com.alipay.api.DefaultAlipayClient; |
||||
import com.alipay.api.request.AlipayDataBillAccountlogQueryRequest; |
||||
import com.alipay.api.response.AlipayDataBillAccountlogQueryResponse; |
||||
import com.ynxbd.ali.config.AliConfig; |
||||
import com.ynxbd.common.helper.common.JsonHelper; |
||||
|
||||
public class AliOldHelper { |
||||
|
||||
public static void test(String begDate, String endDate, String outTradeNo) throws AlipayApiException { |
||||
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AliConfig.APP_ID, AliConfig.APP_PRIVATE_KEY, "json", "GBK", AliConfig.ALI_PUBLIC_KEY, "RSA2"); |
||||
AlipayDataBillAccountlogQueryRequest request = new AlipayDataBillAccountlogQueryRequest(); |
||||
request.setBizContent("{" + |
||||
" \"start_time\":\"" + begDate + " 00:00:00\"," + |
||||
" \"end_time\":\"" + endDate + " 00:00:00\"," + |
||||
" \"merchant_order_no\":\"" + outTradeNo + "\"," + |
||||
"}"); |
||||
AlipayDataBillAccountlogQueryResponse response = alipayClient.execute(request); |
||||
System.out.println(JsonHelper.toJsonString(response)); |
||||
if (response.isSuccess()) { |
||||
System.out.println("调用成功"); |
||||
} else { |
||||
System.out.println("调用失败"); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
package com.ynxbd.common.his; |
||||
|
||||
import com.alipay.api.AlipayApiException; |
||||
import com.alipay.api.AlipayClient; |
||||
import com.alipay.api.DefaultAlipayClient; |
||||
import com.alipay.api.request.AlipayDataBillAccountlogQueryRequest; |
||||
import com.alipay.api.response.AlipayDataBillAccountlogQueryResponse; |
||||
import com.ynxbd.ali.config.AliConfig; |
||||
import com.ynxbd.common.helper.common.JsonHelper; |
||||
|
||||
public class AliOldHelper { |
||||
|
||||
public static void test(String begDate, String endDate, String outTradeNo) throws AlipayApiException { |
||||
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AliConfig.APP_ID, AliConfig.APP_PRIVATE_KEY, "json", "GBK", AliConfig.ALI_PUBLIC_KEY, "RSA2"); |
||||
AlipayDataBillAccountlogQueryRequest request = new AlipayDataBillAccountlogQueryRequest(); |
||||
request.setBizContent("{" + |
||||
" \"start_time\":\"" + begDate + " 00:00:00\"," + |
||||
" \"end_time\":\"" + endDate + " 00:00:00\"," + |
||||
" \"merchant_order_no\":\"" + outTradeNo + "\"," + |
||||
"}"); |
||||
AlipayDataBillAccountlogQueryResponse response = alipayClient.execute(request); |
||||
System.out.println(JsonHelper.toJsonString(response)); |
||||
if (response.isSuccess()) { |
||||
System.out.println("调用成功"); |
||||
} else { |
||||
System.out.println("调用失败"); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,252 @@ |
||||
package com.ynxbd.common.his; |
||||
|
||||
import com.ynxbd.common.bean.enums.MerchantEnum; |
||||
import com.ynxbd.common.helper.common.ErrorHelper; |
||||
import com.ynxbd.common.helper.common.SoapHelper; |
||||
import com.ynxbd.common.result.JsonResult; |
||||
import com.ynxbd.common.result.JsonResultEnum; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang3.ObjectUtils; |
||||
import org.dom4j.DocumentException; |
||||
import org.dom4j.DocumentHelper; |
||||
import org.dom4j.Element; |
||||
import org.dom4j.Node; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.UUID; |
||||
|
||||
@Slf4j |
||||
public class HisClient { |
||||
private final String soapUrl; |
||||
|
||||
private HisClient() { |
||||
this.soapUrl = null; |
||||
} |
||||
|
||||
public HisClient(String soapUrl) { |
||||
this.soapUrl = soapUrl; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* webService请求工具类(枚举版) |
||||
* |
||||
* @param hisEnum 枚举 |
||||
* @param params 参数 |
||||
* @return 响应xml |
||||
*/ |
||||
public String call(HisEnum hisEnum, Map<String, Object> params) { |
||||
String reqSoapUrl = this.soapUrl; |
||||
if (ObjectUtils.isEmpty(reqSoapUrl)) { |
||||
log.error("[WebService]-soapUrl为空"); |
||||
return null; |
||||
} |
||||
String method = hisEnum.METHOD; |
||||
String transactionCode = hisEnum.CODE; |
||||
|
||||
if (params == null || transactionCode == null || method == null) { |
||||
log.error("[WebService]-{ map | transactionCode | method 为空 }"); |
||||
return null; |
||||
} |
||||
Object callNo = params.get("CallNo"); |
||||
if (ObjectUtils.isEmpty(callNo)) { |
||||
params.put("CallNo", HisConfig.WECHAT_CALL_NO); |
||||
} |
||||
params.put("TransactionCode", transactionCode); |
||||
|
||||
String result = null; |
||||
try { |
||||
String reqId = UUID.randomUUID().toString(); |
||||
long begTime = System.currentTimeMillis(); // 开始时间
|
||||
String hisResponse = SoapHelper.post("HIS", reqSoapUrl, null, HisConfig.SOAP_ENV + |
||||
"xmlns:urn=\"urn:Interface_ABIntf-IInterface_AB\">" + |
||||
"<soapenv:Header/><soapenv:Body>" + |
||||
"<urn:" + method + " soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">" + |
||||
"<InputStr xsi:type=\"xsd:string\">" + |
||||
(HisConfig.IS_REQ_CDATA ? "<![CDATA[" : "") + |
||||
"<Request>" + SoapHelper.requestParams("HIS", transactionCode, reqId, params) + "</Request>" + |
||||
(HisConfig.IS_REQ_CDATA ? "]]>" : "") + |
||||
"</InputStr></urn:" + method + "></soapenv:Body></soapenv:Envelope>" |
||||
); |
||||
long endTime = System.currentTimeMillis(); // 结束时间
|
||||
String takeTime = (endTime - begTime) + "ms"; // 耗时
|
||||
if (hisResponse == null) { |
||||
log.info("[{}]HIS请求无响应[rid:{}]-耗时:[{}]", transactionCode, reqId, takeTime); |
||||
return null; |
||||
} |
||||
|
||||
//解析响应消息,使用SAXReader对象
|
||||
org.dom4j.Document document = DocumentHelper.parseText(hisResponse); |
||||
if (document == null) { |
||||
log.info("[{}]HIS响应内容解析失败[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, hisResponse); |
||||
return null; |
||||
} |
||||
|
||||
List<Node> nodes = document.selectNodes("//return"); |
||||
if (nodes.isEmpty()) { |
||||
log.info("[{}]HIS请求失败[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, hisResponse); |
||||
return null; |
||||
} |
||||
|
||||
Element element = (Element) nodes.get(0); |
||||
result = element.getText(); |
||||
if (hisEnum.IS_LOG_RESP) { // 是否打印返回的xml
|
||||
log.info("[{}]HIS请求成功[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, result); |
||||
|
||||
} else { |
||||
if (HisConfig.IS_LOG_RESP) { // 配置文件强制要求打印xml
|
||||
if (!HisEnum.AP_Query_Statement.equals(hisEnum) && !HisEnum.Query_Area.equals(hisEnum)) { |
||||
log.info("[强制打印][{}]HIS请求成功[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, result); |
||||
} |
||||
} |
||||
} |
||||
} catch (DocumentException e) { |
||||
ErrorHelper.println(e); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public JsonResult getJsonResult(HisEnum hisEnum, Map<String, Object> params) { |
||||
JsonResult result = JsonResult.xmlToBean(call(hisEnum, params), JsonResultEnum.SYS_HIS); |
||||
if (result == null) { // 如果返回为空可能为超时
|
||||
return createTimeoutResult(); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
public void putAliCallNo(MerchantEnum merchantEnum, Map<String, Object> params) { |
||||
if (HisConfig.IS_ALI_MER && params != null && merchantEnum != null) { |
||||
if (merchantEnum.equals(MerchantEnum.ALI) || merchantEnum.equals(MerchantEnum.ALI_MEDICAL)) { |
||||
params.put("CallNo", HisConfig.ALI_CALL_NO); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public JsonResult getJsonResultByMer(HisEnum hisEnum, MerchantEnum merchantEnum, Map<String, Object> params) { |
||||
putAliCallNo(merchantEnum, params); |
||||
return getJsonResult(hisEnum, params); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public JsonResult getJsonResult(HisEnum hisEnum, JsonResult.MapParams params) { |
||||
Map<String, Object> requestParams = new HashMap<>(); |
||||
if (params != null) { |
||||
params.setParams(requestParams); |
||||
} |
||||
return getJsonResult(hisEnum, requestParams); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public JsonResult getJsonResultByMer(HisEnum hisEnum, MerchantEnum merchantEnum, JsonResult.MapParams params) { |
||||
Map<String, Object> requestParams = new HashMap<>(); |
||||
if (params != null) { |
||||
params.setParams(requestParams); |
||||
} |
||||
return getJsonResultByMer(hisEnum, merchantEnum, requestParams); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public JsonResult createErrorResult(String message) { |
||||
if (ObjectUtils.isEmpty(message)) { |
||||
message = "【HIS】请求参数缺失"; |
||||
} |
||||
return JsonResult.createErrorResult(message, JsonResultEnum.SYS_HIS); |
||||
} |
||||
|
||||
/** |
||||
* xml响应数据组装成为JSON数据 |
||||
* |
||||
* @return 封装好的对象 |
||||
*/ |
||||
public JsonResult createTimeoutResult() { |
||||
return JsonResult.createTimeoutResult("【HIS】请求超时", JsonResultEnum.SYS_HIS); |
||||
} |
||||
|
||||
|
||||
// /**
|
||||
// * 根据订单号获取类型
|
||||
// *
|
||||
// * @param bankTransNo 交易流水号
|
||||
// * @param tradeNo HIS订单号
|
||||
// * @return 类型
|
||||
// */
|
||||
// public static String getTypeByPEnum(String bankTransNo, String tradeNo) throws ServiceException {
|
||||
// if (!PayService.isNewOrder(bankTransNo, tradeNo)) {
|
||||
// throw new ServiceException(ResultEnum.REFUND_IS_OLD_ORDER_NUM);
|
||||
// }
|
||||
// int len = tradeNo.length();
|
||||
// String middleCode1 = tradeNo.substring(len - 4, len - 3);
|
||||
// String middleCode2 = tradeNo.substring(len - 4, len - 2);
|
||||
// for (PEnum item : PEnum.values()) {
|
||||
// if (item.ORDER_CODE.equals(middleCode1) || item.ORDER_CODE.equals(middleCode2)) {
|
||||
// return item.CODE;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @param xml xml
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static HisResult xmlToBean(String xml) {
|
||||
// if (xml == null || "".equals(xml)) {
|
||||
// log.info("HIS response xml is null");
|
||||
// return HisResult.createErrorHisResult("[HIS]获取xml数据失败");
|
||||
// }
|
||||
//
|
||||
// JSONObject respObj;
|
||||
// try {
|
||||
// Document document = DocumentHelper.parseText(xml);
|
||||
// Element root = document.getRootElement(); // 获取根节点元素对象
|
||||
// respObj = HisResult.nodeToJsonObject(root);
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// Set<String> keys = respObj.keySet();
|
||||
// for (String key : keys) {
|
||||
// if (!key.equals("TransactionCode") && !key.equals("ResponseCode") && !key.equals("ResponseMessage") && !key.equals("PatientName")) {
|
||||
// map.put(key, respObj.getString(key));
|
||||
// }
|
||||
// }
|
||||
// respObj.put("DataMap", map);
|
||||
// } catch (DocumentException e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return HisResult.createErrorHisResult(e.getMessage());
|
||||
// }
|
||||
// HisResult hisResult = JSON.toJavaObject(respObj, HisResult.class);
|
||||
// if (hisResult.getResponseCode() != 0) {
|
||||
// log.info("HIS Error Message:[{}]", hisResult.getResponseMessage());
|
||||
// }
|
||||
// return hisResult;
|
||||
// }
|
||||
} |
||||
@ -0,0 +1,74 @@ |
||||
package com.ynxbd.common.his; |
||||
|
||||
import com.ynxbd.common.helper.common.*; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang3.ObjectUtils; |
||||
|
||||
@Slf4j |
||||
public class HisConfig { |
||||
public static final String SOAP_ENV = "<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" "; |
||||
|
||||
// 微信
|
||||
public static final String WECHAT_CALL_NO = "843242395"; |
||||
// 支付宝
|
||||
public static final String ALI_CALL_NO = "675448357"; |
||||
|
||||
// private static final String NS = "http://tempuri.org/";
|
||||
// private static String HIS_WSD_URL;
|
||||
|
||||
// webService请求地址
|
||||
public static final String HIS_SOAP_URL; |
||||
public static final String HIS_SOAP_DEV_URL; |
||||
|
||||
// HIS医保环境
|
||||
// protected static final String HIS_DEV_MI_URL;
|
||||
// protected static final String HIS_PROD_MI_URL;
|
||||
|
||||
protected static final String HIS_WX_MED_URL; |
||||
protected static final String HIS_ALI_MED_URL; |
||||
|
||||
|
||||
// 是否强制打印HIS响应的xml
|
||||
public static final Boolean IS_LOG_RESP; |
||||
// 是否使用"<![CDATA[]]>"阻止解析
|
||||
public static final Boolean IS_REQ_CDATA; |
||||
|
||||
// 是否传递openid给HIS推送消息
|
||||
public static final Boolean IS_PUSH_MSG; |
||||
// 是否开启支付宝蓝旗调用call_no
|
||||
public static final Boolean IS_ALI_MER; |
||||
|
||||
// 开启预结算(第1开关)(如果HIS未限制-则存在直接入库风险!!!!!!!!!!!!!!!!!!)
|
||||
public static final boolean IS_RX_PREPAY; |
||||
|
||||
static { |
||||
XmlConfigHelper config = new XmlConfigHelper().read("webservice.xml", "his"); |
||||
|
||||
IS_LOG_RESP = config.getBoolean("is_log_resp", false); |
||||
IS_PUSH_MSG = config.getBoolean("is_push_msg", false); |
||||
IS_ALI_MER = config.getBoolean("is_ali_mer", false); |
||||
IS_REQ_CDATA = config.getBoolean("is_req_cdata", false); |
||||
IS_RX_PREPAY = config.getBoolean("is_rx_prepay", false); |
||||
|
||||
String url = config.getString("url"); |
||||
if (url == null) { |
||||
log.error("WebService配置文件读取失败"); |
||||
} |
||||
HIS_SOAP_URL = initSoapURL(url); |
||||
HIS_SOAP_DEV_URL = initSoapURL(config.getString("dev_url")); |
||||
|
||||
// 医保---------------------------------
|
||||
HIS_WX_MED_URL = initSoapURL(config.getString("wx_med_url")); |
||||
HIS_ALI_MED_URL = initSoapURL(config.getString("ali_med_url")); |
||||
} |
||||
|
||||
private static String initSoapURL(String ip) { |
||||
if (ObjectUtils.isEmpty(ip)) { |
||||
return null; |
||||
} |
||||
if (ip.contains("http")) { |
||||
return ip; |
||||
} |
||||
return "http://" + ip + "/WebService_AB.dll/soap/IInterface_AB"; |
||||
} |
||||
} |
||||
@ -1,142 +1,142 @@ |
||||
package com.ynxbd.common.helper.his; |
||||
|
||||
public enum HisEnum { |
||||
AP_Query_Hospital("查询医院列表", "1", "AP_Query_Hospital", true), |
||||
|
||||
AP_Query_Patient("[患者]获取用户绑定信息", "1001", "AP_Query_Patient", true), |
||||
AP_Binding_Card("[患者]身份证绑定", "1002", "AP_Binding_Card", true), |
||||
AP_UnBinding_Card("[患者]身份证解绑", "1003", "AP_UnBinding_Card", true), |
||||
AP_Query_GMC_Patient("[患者]医共体ID查询", "1015", "UniversalInterface", true), |
||||
|
||||
Medical_Insurance_Bill("[医保]查询患者医保结算清单", "1008", "UniversalInterface", true), |
||||
|
||||
// 快速发药[自定义]
|
||||
QuickDrugDispense("[处方]快速发药", "11001", "UniversalInterface", true), |
||||
|
||||
TPP_QR_Reg("[第三方]扫码挂号", "11002", "UniversalInterface", true), |
||||
|
||||
// 标准物价查询[自定义]
|
||||
Recipe_Query_StandardPrice("[价格]标准物价查询", "8002", "UniversalInterface", false), |
||||
|
||||
// 就诊记录[自定义]
|
||||
Query_TreatRecords("查询就诊记录", "1004", "UniversalInterface", true), |
||||
|
||||
// 报告------------------
|
||||
AP_Query_PEISReport("[报告]体检报告", "9001", "AP_Query_PEISReport", true), |
||||
AP_Query_CheckApplication("[报告]检查申请单", "5001", "AP_Query_CheckApplication", false), |
||||
AP_Query_InspectionApplication("[报告]检验(化验)申请单", "5002", "AP_Query_InspectionApplication", false), |
||||
|
||||
// 挂号记录---------------
|
||||
AP_Query_Regist("[挂号记录]查询历史挂号记录", "2004", "AP_Query_Regist", true), |
||||
AP_Query_Reservation("[预约挂号]查询预约记录", "3004", "AP_Query_Reservation", true), |
||||
|
||||
// 分时段挂号---------
|
||||
AP_Query_Dept_New("[分时段挂号]查询科室列表", "7001", "AP_Query_Dept_New", false), |
||||
AP_Query_Doct_New("[分时段挂号]根据科室查询医生列表", "7002", "AP_Query_Doct_New", true), |
||||
AP_Query_Register_Source_New("[分时段挂号]根据医生查询号源 ", "7003", "AP_Query_Register_Source_New", false), |
||||
AP_Regist_New("[分时段挂号]执行挂号", "7004", "AP_Regist_New", true), |
||||
AP_Occupy_Source_New("[分时段挂号]占号", "7005", "AP_Occupy_Source_New", true), |
||||
|
||||
// 普通挂号---------------
|
||||
AP_Regist("[今日挂号]执行挂号", "2003", "AP_Regist", true), |
||||
AP_Query_Dept("[今日挂号]查询科室列表", "2001", "AP_Query_Dept", true), |
||||
AP_Query_Doct("[今日挂号]根据科室查询医生列表", "2002", "AP_Query_Doct", true), |
||||
// ----------------------
|
||||
AP_Query_Reservation_Dept("[预约挂号]查询科室列表", "3001", "AP_Query_Reservation_Dept", true), |
||||
AP_Query_Reservation_Doct("[预约挂号]根据科室查询医生列表", "3002", "AP_Query_Reservation_Doct", true), |
||||
AP_Reservation("[预约挂号]执行预约", "3003", "AP_Reservation", true), |
||||
AP_Recall_Reservation("[预约挂号]取消预约", "3006", "AP_Recall_Reservation", true), |
||||
|
||||
AP_Refund_Register("[今日挂号]取消预约", "4007", "AP_Refund_Register", true), |
||||
|
||||
//排班记录
|
||||
AP_Doctor_Schedule("[排班]医生排班表","8003","UniversalInterface",true), |
||||
Query_Area("[地区]查询行政区划","8005","UniversalInterface",false), |
||||
|
||||
// 支付[自定义]------------------
|
||||
Create_Self_Help("[处方]生成自助申请单", "10001", "UniversalInterface", true), |
||||
Query_Self_Help("[处方]查询自助申请单信息", "10002", "UniversalInterface", true), |
||||
|
||||
AP_Query_UnPay_Invoice("[处方]查询待缴费项目", "4001", "AP_Query_UnPay_Invoice", true), |
||||
AP_Query_OutpatientFee("[处方]查询已缴费项目", "5005", "AP_Query_OutpatientFee", true), |
||||
AP_Pay_Invoice("[处方]更新recipeId参数为List,支持多个处方单同时缴费", "4002", "AP_Pay_Invoice", true), |
||||
|
||||
AP_PrePay_Invoice_New("[处方]预结算", "4004", "AP_PrePay_Invoice_New", true), |
||||
AP_Pay_Invoice_New("[处方]预结算缴费", "4005", "AP_Pay_Invoice_New", true), |
||||
|
||||
YDZF_QueryDiseaseInfo("[医保]获取慢性病列表","4006","YDZF_QueryDiseaseInfo",true), |
||||
|
||||
AP_Query_Statement("查询对账报表", "5007", "AP_Query_Statement", false), |
||||
AP_Query_Transaction("查询交易流水", "5008", "AP_Query_Transaction", true), |
||||
AP_Query_StatementByFPNum("根据发票号查询交易流水", "5011", "AP_Query_StatementByFPNum", true), |
||||
|
||||
//
|
||||
Medical_PayOrders("[医保]处方下单接口", "40022", "YDZF_PayOrders", true), |
||||
Medical_Refund("[医保]退费", "40024", "YDZF_RefundOrder", true), |
||||
Medical_PAY("[医保]HIS医保结算", "40023", "YDZF_SaveToHIS", true), |
||||
Medical_QueryOrderStatus("[医保]查询医保结算信息", "40025", "YDZF_QueryOrderStatus", true), |
||||
|
||||
// 住院-------------------------
|
||||
YDZF_UploadFeesInfo_ZY("[住院][医保]6201上传费用明细 + 6202 支付下单", "4009", "YDZF_UploadFeesInfo_ZY", true), |
||||
YDZF_SaveToHIS_ZY("[住院][医保]HIS结算(住院) 6301", "4010", "YDZF_SaveToHIS_ZY", true), |
||||
|
||||
AP_Query_Prepay("[住院]查询预交金缴费记录(出院后)", "5003", "AP_Query_Prepay", true), |
||||
AP_Query_InpatientFee("[住院]查询住院费用清单(住院中)", "5004", "AP_Query_InpatientFee", true), |
||||
AP_Query_InpatientSummaryFee("[住院]查询住院日费用汇总(住院中)", "5006", "AP_Query_InpatientSummaryFee", true), |
||||
|
||||
Query_OutPatientRecords("[住院]通过患者ID查询住院记录(出院后)", "1011", "UniversalInterface", true), |
||||
Query_OutHospTreatFee("[住院]通过住院号查询费用明细(出院后)", "1012", "UniversalInterface", true), |
||||
|
||||
|
||||
Query_InHospPrepay("[住院]预交金缴费", "4003", "UniversalInterface", true), |
||||
Query_InHospByTreatNum("[住院]通过住院号查询患者信息(含预交金)", "1005", "UniversalInterface", true), |
||||
Query_InHospByPatientId("[住院]通过患者ID查询在院患者信息(目前只能查询住院中)", "1006", "UniversalInterface", true), |
||||
|
||||
XK_GET_TREAT_LIST("[互联网医院]查询就诊记录列表", "13001", "UniversalInterface", true), |
||||
XK_CREATE_TREAT("[互联网医院]创建就诊记录", "13002", "UniversalInterface", true), |
||||
XK_QUERY_TREAT("[互联网医院]查询就诊记录诊断信息", "13003", "UniversalInterface", true), |
||||
XK_DOC_CA("[互联网医院]查询医生电子签名", "13004", "UniversalInterface", true), |
||||
XK_INQUIRY_FEE("[互联网医院]查询问诊费用信息","13005","UniversalInterface", true), |
||||
|
||||
XK_CREATE_INQUIRY("[互联网医院]创建问诊记录","13006","UniversalInterface",true), |
||||
|
||||
XK_MEDICAL_RECIPE("[互联网医院]处方医保双通道流转","13007","UniversalInterface",true), |
||||
|
||||
XK_QUERY_RE_REGISTER("[互联网医院]查询复诊挂号费","13008","UniversalInterface",true), |
||||
|
||||
Query_TreatMedicalRecord("[病历]查询门诊病历", "1014", "UniversalInterface", false), |
||||
|
||||
// 在线签到
|
||||
AP_Query_SignIn("[在线签到]查询预约待签到记录","7007","AP_Query_SignIn",true), |
||||
AP_SignIN("[在线签到]执行预约签到","7008","AP_SignIn",true), |
||||
AP_Query_Line_SignIn("[在线签到]查询已挂号未签到记录","7009","AP_Query_LineSignIn",false), |
||||
AP_Line_SignIN("[在线签到]执行挂号患者签到","7010","AP_LineSignIn",true), |
||||
|
||||
// 自助开单
|
||||
SH_SELF_HELP_QUERY("[查询自助开单信息]","10003","UniversalInterface",true), |
||||
SH_SELF_HELP_CREATE("[创建自助开单申请单]","10004","UniversalInterface",true), |
||||
|
||||
QUERY_ELECTRON_INVOICE("[查询电子发票信息]","8004","UniversalInterface",false), |
||||
|
||||
QUERY_AUTH_AGENT("委托人信息[查询]","11003","UniversalInterface", true), |
||||
ADD_AUTH_AGENT("委托人信息[新增]","11004","UniversalInterface",true), |
||||
UPDATE_AUTH_AGENT("委托人信息[修改]","11005","UniversalInterface",true), |
||||
DELETE_AUTH_AGENT("委托人信息[删除]","11006","UniversalInterface",true), |
||||
|
||||
HIS_XK_RX_DICT("开方字典查询","13010","UniversalInterface",false), |
||||
HIS_XK_RX_CREATE("线上开方","13011","UniversalInterface",true), |
||||
; |
||||
|
||||
public final String NAME; |
||||
public final String CODE; |
||||
public final String METHOD; |
||||
public final boolean IS_LOG_RESP; // 是否打印xml
|
||||
|
||||
|
||||
HisEnum(String NAME, String CODE, String METHOD, boolean IS_LOG_RESP) { |
||||
this.NAME = NAME; |
||||
this.CODE = CODE; |
||||
this.METHOD = METHOD; |
||||
this.IS_LOG_RESP = IS_LOG_RESP; |
||||
} |
||||
} |
||||
package com.ynxbd.common.his; |
||||
|
||||
public enum HisEnum { |
||||
AP_Query_Hospital("查询医院列表", "1", "AP_Query_Hospital", true), |
||||
|
||||
AP_Query_Patient("[患者]获取用户绑定信息", "1001", "AP_Query_Patient", true), |
||||
AP_Binding_Card("[患者]身份证绑定", "1002", "AP_Binding_Card", true), |
||||
AP_UnBinding_Card("[患者]身份证解绑", "1003", "AP_UnBinding_Card", true), |
||||
AP_Query_GMC_Patient("[患者]医共体ID查询", "1015", "UniversalInterface", true), |
||||
|
||||
Medical_Insurance_Bill("[医保]查询患者医保结算清单", "1008", "UniversalInterface", true), |
||||
|
||||
// 快速发药[自定义]
|
||||
QuickDrugDispense("[处方]快速发药", "11001", "UniversalInterface", true), |
||||
|
||||
TPP_QR_Reg("[第三方]扫码挂号", "11002", "UniversalInterface", true), |
||||
|
||||
// 标准物价查询[自定义]
|
||||
Recipe_Query_StandardPrice("[价格]标准物价查询", "8002", "UniversalInterface", false), |
||||
|
||||
// 就诊记录[自定义]
|
||||
Query_TreatRecords("查询就诊记录", "1004", "UniversalInterface", true), |
||||
|
||||
// 报告------------------
|
||||
AP_Query_PEISReport("[报告]体检报告", "9001", "AP_Query_PEISReport", true), |
||||
AP_Query_CheckApplication("[报告]检查申请单", "5001", "AP_Query_CheckApplication", false), |
||||
AP_Query_InspectionApplication("[报告]检验(化验)申请单", "5002", "AP_Query_InspectionApplication", false), |
||||
|
||||
// 挂号记录---------------
|
||||
AP_Query_Regist("[挂号记录]查询历史挂号记录", "2004", "AP_Query_Regist", true), |
||||
AP_Query_Reservation("[预约挂号]查询预约记录", "3004", "AP_Query_Reservation", true), |
||||
|
||||
// 分时段挂号---------
|
||||
AP_Query_Dept_New("[分时段挂号]查询科室列表", "7001", "AP_Query_Dept_New", false), |
||||
AP_Query_Doct_New("[分时段挂号]根据科室查询医生列表", "7002", "AP_Query_Doct_New", true), |
||||
AP_Query_Register_Source_New("[分时段挂号]根据医生查询号源 ", "7003", "AP_Query_Register_Source_New", false), |
||||
AP_Regist_New("[分时段挂号]执行挂号", "7004", "AP_Regist_New", true), |
||||
AP_Occupy_Source_New("[分时段挂号]占号", "7005", "AP_Occupy_Source_New", true), |
||||
|
||||
// 普通挂号---------------
|
||||
AP_Regist("[今日挂号]执行挂号", "2003", "AP_Regist", true), |
||||
AP_Query_Dept("[今日挂号]查询科室列表", "2001", "AP_Query_Dept", true), |
||||
AP_Query_Doct("[今日挂号]根据科室查询医生列表", "2002", "AP_Query_Doct", true), |
||||
// ----------------------
|
||||
AP_Query_Reservation_Dept("[预约挂号]查询科室列表", "3001", "AP_Query_Reservation_Dept", true), |
||||
AP_Query_Reservation_Doct("[预约挂号]根据科室查询医生列表", "3002", "AP_Query_Reservation_Doct", true), |
||||
AP_Reservation("[预约挂号]执行预约", "3003", "AP_Reservation", true), |
||||
AP_Recall_Reservation("[预约挂号]取消预约", "3006", "AP_Recall_Reservation", true), |
||||
|
||||
AP_Refund_Register("[今日挂号]取消预约", "4007", "AP_Refund_Register", true), |
||||
|
||||
//排班记录
|
||||
AP_Doctor_Schedule("[排班]医生排班表","8003","UniversalInterface",true), |
||||
Query_Area("[地区]查询行政区划","8005","UniversalInterface",false), |
||||
|
||||
// 支付[自定义]------------------
|
||||
Create_Self_Help("[处方]生成自助申请单", "10001", "UniversalInterface", true), |
||||
Query_Self_Help("[处方]查询自助申请单信息", "10002", "UniversalInterface", true), |
||||
|
||||
AP_Query_UnPay_Invoice("[处方]查询待缴费项目", "4001", "AP_Query_UnPay_Invoice", true), |
||||
AP_Query_OutpatientFee("[处方]查询已缴费项目", "5005", "AP_Query_OutpatientFee", true), |
||||
AP_Pay_Invoice("[处方]更新recipeId参数为List,支持多个处方单同时缴费", "4002", "AP_Pay_Invoice", true), |
||||
|
||||
AP_PrePay_Invoice_New("[处方]预结算", "4004", "AP_PrePay_Invoice_New", true), |
||||
AP_Pay_Invoice_New("[处方]预结算缴费", "4005", "AP_Pay_Invoice_New", true), |
||||
|
||||
YDZF_QueryDiseaseInfo("[医保]获取慢性病列表","4006","YDZF_QueryDiseaseInfo",true), |
||||
|
||||
AP_Query_Statement("查询对账报表", "5007", "AP_Query_Statement", false), |
||||
AP_Query_Transaction("查询交易流水", "5008", "AP_Query_Transaction", true), |
||||
AP_Query_StatementByFPNum("根据发票号查询交易流水", "5011", "AP_Query_StatementByFPNum", true), |
||||
|
||||
//
|
||||
Medical_PayOrders("[医保]处方下单接口", "40022", "YDZF_PayOrders", true), |
||||
Medical_Refund("[医保]退费", "40024", "YDZF_RefundOrder", true), |
||||
Medical_PAY("[医保]HIS医保结算", "40023", "YDZF_SaveToHIS", true), |
||||
Medical_QueryOrderStatus("[医保]查询医保结算信息", "40025", "YDZF_QueryOrderStatus", true), |
||||
|
||||
// 住院-------------------------
|
||||
YDZF_UploadFeesInfo_ZY("[住院][医保]6201上传费用明细 + 6202 支付下单", "4009", "YDZF_UploadFeesInfo_ZY", true), |
||||
YDZF_SaveToHIS_ZY("[住院][医保]HIS结算(住院) 6301", "4010", "YDZF_SaveToHIS_ZY", true), |
||||
|
||||
AP_Query_Prepay("[住院]查询预交金缴费记录(出院后)", "5003", "AP_Query_Prepay", true), |
||||
AP_Query_InpatientFee("[住院]查询住院费用清单(住院中)", "5004", "AP_Query_InpatientFee", true), |
||||
AP_Query_InpatientSummaryFee("[住院]查询住院日费用汇总(住院中)", "5006", "AP_Query_InpatientSummaryFee", true), |
||||
|
||||
Query_OutPatientRecords("[住院]通过患者ID查询住院记录(出院后)", "1011", "UniversalInterface", true), |
||||
Query_OutHospTreatFee("[住院]通过住院号查询费用明细(出院后)", "1012", "UniversalInterface", true), |
||||
|
||||
|
||||
Query_InHospPrepay("[住院]预交金缴费", "4003", "UniversalInterface", true), |
||||
Query_InHospByTreatNum("[住院]通过住院号查询患者信息(含预交金)", "1005", "UniversalInterface", true), |
||||
Query_InHospByPatientId("[住院]通过患者ID查询在院患者信息(目前只能查询住院中)", "1006", "UniversalInterface", true), |
||||
|
||||
XK_GET_TREAT_LIST("[互联网医院]查询就诊记录列表", "13001", "UniversalInterface", true), |
||||
XK_CREATE_TREAT("[互联网医院]创建就诊记录", "13002", "UniversalInterface", true), |
||||
XK_QUERY_TREAT("[互联网医院]查询就诊记录诊断信息", "13003", "UniversalInterface", true), |
||||
XK_DOC_CA("[互联网医院]查询医生电子签名", "13004", "UniversalInterface", true), |
||||
XK_INQUIRY_FEE("[互联网医院]查询问诊费用信息","13005","UniversalInterface", true), |
||||
|
||||
XK_CREATE_INQUIRY("[互联网医院]创建问诊记录","13006","UniversalInterface",true), |
||||
|
||||
XK_MEDICAL_RECIPE("[互联网医院]处方医保双通道流转","13007","UniversalInterface",true), |
||||
|
||||
XK_QUERY_RE_REGISTER("[互联网医院]查询复诊挂号费","13008","UniversalInterface",true), |
||||
|
||||
Query_TreatMedicalRecord("[病历]查询门诊病历", "1014", "UniversalInterface", false), |
||||
|
||||
// 在线签到
|
||||
AP_Query_SignIn("[在线签到]查询预约待签到记录","7007","AP_Query_SignIn",true), |
||||
AP_SignIN("[在线签到]执行预约签到","7008","AP_SignIn",true), |
||||
AP_Query_Line_SignIn("[在线签到]查询已挂号未签到记录","7009","AP_Query_LineSignIn",false), |
||||
AP_Line_SignIN("[在线签到]执行挂号患者签到","7010","AP_LineSignIn",true), |
||||
|
||||
// 自助开单
|
||||
SH_SELF_HELP_QUERY("[查询自助开单信息]","10003","UniversalInterface",true), |
||||
SH_SELF_HELP_CREATE("[创建自助开单申请单]","10004","UniversalInterface",true), |
||||
|
||||
QUERY_ELECTRON_INVOICE("[查询电子发票信息]","8004","UniversalInterface",false), |
||||
|
||||
QUERY_AUTH_AGENT("委托人信息[查询]","11003","UniversalInterface", true), |
||||
ADD_AUTH_AGENT("委托人信息[新增]","11004","UniversalInterface",true), |
||||
UPDATE_AUTH_AGENT("委托人信息[修改]","11005","UniversalInterface",true), |
||||
DELETE_AUTH_AGENT("委托人信息[删除]","11006","UniversalInterface",true), |
||||
|
||||
HIS_XK_RX_DICT("开方字典查询","13010","UniversalInterface",false), |
||||
HIS_XK_RX_CREATE("线上开方","13011","UniversalInterface",true), |
||||
; |
||||
|
||||
public final String NAME; |
||||
public final String CODE; |
||||
public final String METHOD; |
||||
public final boolean IS_LOG_RESP; // 是否打印xml
|
||||
|
||||
|
||||
HisEnum(String NAME, String CODE, String METHOD, boolean IS_LOG_RESP) { |
||||
this.NAME = NAME; |
||||
this.CODE = CODE; |
||||
this.METHOD = METHOD; |
||||
this.IS_LOG_RESP = IS_LOG_RESP; |
||||
} |
||||
} |
||||
@ -0,0 +1,92 @@ |
||||
package com.ynxbd.common.his; |
||||
|
||||
import com.ynxbd.common.action.pay.PEnum; |
||||
import com.ynxbd.common.bean.enums.MerchantEnum; |
||||
import com.ynxbd.common.bean.pay.Order; |
||||
import com.ynxbd.common.helper.common.CodeHelper; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Slf4j |
||||
public class HisFactory { |
||||
private static class NULL_CLIENT { |
||||
private static final HisClient INSTANCE = new HisClient(null); |
||||
} |
||||
|
||||
private static class PROD_CLIENT { |
||||
private static final HisClient INSTANCE = new HisClient(HisConfig.HIS_SOAP_URL); |
||||
} |
||||
|
||||
private static class DEV_CLIENT { |
||||
private static final HisClient INSTANCE = new HisClient(HisConfig.HIS_SOAP_DEV_URL); |
||||
} |
||||
|
||||
private static class WX_MED_CLIENT { |
||||
private static final HisClient INSTANCE = new HisClient(HisConfig.HIS_WX_MED_URL); |
||||
} |
||||
|
||||
private static class ALI_MED_CLIENT { |
||||
private static final HisClient INSTANCE = new HisClient(HisConfig.HIS_ALI_MED_URL); |
||||
} |
||||
|
||||
public static HisClient His() { |
||||
return PROD_CLIENT.INSTANCE; |
||||
} |
||||
|
||||
// HIS环境切换
|
||||
public static HisClient His(boolean isDev) { |
||||
return isDev ? DEV_CLIENT.INSTANCE : PROD_CLIENT.INSTANCE; |
||||
} |
||||
|
||||
// HIS医保
|
||||
public static HisClient HisMed(MerchantEnum merchantEnum) { |
||||
return HisMed(merchantEnum, false); |
||||
} |
||||
|
||||
public static HisClient HisMed(MerchantEnum merchantEnum, boolean isDev) { |
||||
if (merchantEnum == null) { |
||||
return NULL_CLIENT.INSTANCE; |
||||
} |
||||
if (isDev) { |
||||
return DEV_CLIENT.INSTANCE; |
||||
} |
||||
return merchantEnum.isWx() ? WX_MED_CLIENT.INSTANCE : ALI_MED_CLIENT.INSTANCE; |
||||
} |
||||
|
||||
/** |
||||
* 生成HIS订单号 |
||||
*/ |
||||
public static List<Order> getHisTradeNo(String prefix, List<Long> ids, PEnum pEnum) { |
||||
if (pEnum == null) { |
||||
return null; |
||||
} |
||||
return CodeHelper.createTradeNo(prefix, pEnum.ORDER_CODE.toUpperCase(), ids); |
||||
} |
||||
|
||||
/** |
||||
* 生成HIS订单号 |
||||
*/ |
||||
public static String getHisTradeNo(String prefix, PEnum pEnum) { |
||||
if (pEnum == null) { |
||||
return null; |
||||
} |
||||
return prefix + pEnum.ORDER_CODE.toUpperCase() + "001"; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 字符串集转xml |
||||
* |
||||
* @param xmlTag xml标签 |
||||
* @param strList 字符串集 |
||||
* @return xml |
||||
*/ |
||||
public static String strListToXml(String xmlTag, List<String> strList) { |
||||
StringBuilder sb = new StringBuilder(); |
||||
for (String val : strList) { |
||||
sb.append("<").append(xmlTag).append(">").append(val).append("</").append(xmlTag).append(">"); |
||||
} |
||||
return sb.toString(); |
||||
} |
||||
} |
||||
@ -0,0 +1,50 @@ |
||||
//package com.ynxbd.common.his;
|
||||
//
|
||||
//import com.ynxbd.common.result.JsonResult;
|
||||
//import com.ynxbd.common.result.JsonResultEnum;
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//public class HisDevHelper {
|
||||
//
|
||||
// // 测试环境---------------------------------------------------------------------------
|
||||
// /**
|
||||
// * 测试环境
|
||||
// *
|
||||
// * @param hisEnum 枚举
|
||||
// * @param params 发送的参数
|
||||
// * @return 响应的xml数据
|
||||
// */
|
||||
// public static String getDevResponseXml(HisEnum hisEnum, Map<String, Object> params) {
|
||||
// return HisHelper.getResponseXml(hisEnum, HisHelper.HIS_SOAP_DEV_URL, params);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult getDevJsonResult(HisEnum hisEnum, Map<String, Object> params) {
|
||||
// JsonResult result = JsonResult.xmlToBean(getDevResponseXml(hisEnum, params), JsonResultEnum.SYS_HIS);
|
||||
// if (result == null) { // 如果返回为空可能为超时
|
||||
// return HisHelper.createTimeoutResult();
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult getDevJsonResult(HisEnum hisEnum, JsonResult.MapParams params) {
|
||||
// Map<String, Object> requestParams = new HashMap<>();
|
||||
// if (params != null) {
|
||||
// params.setParams(requestParams);
|
||||
// }
|
||||
// return getDevJsonResult(hisEnum, requestParams);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@ -0,0 +1,341 @@ |
||||
//package com.ynxbd.common.his;
|
||||
//
|
||||
//import com.ynxbd.common.action.pay.PEnum;
|
||||
//import com.ynxbd.common.bean.enums.MerchantEnum;
|
||||
//import com.ynxbd.common.bean.pay.Order;
|
||||
//import com.ynxbd.common.helper.ProperHelper;
|
||||
//import com.ynxbd.common.helper.common.CodeHelper;
|
||||
//import com.ynxbd.common.helper.common.ErrorHelper;
|
||||
//import com.ynxbd.common.helper.common.SnowHelper;
|
||||
//import com.ynxbd.common.helper.common.SoapHelper;
|
||||
//import com.ynxbd.common.result.JsonResult;
|
||||
//import com.ynxbd.common.result.JsonResultEnum;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.apache.commons.lang3.ObjectUtils;
|
||||
//import org.dom4j.DocumentException;
|
||||
//import org.dom4j.DocumentHelper;
|
||||
//import org.dom4j.Element;
|
||||
//import org.dom4j.Node;
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.UUID;
|
||||
//
|
||||
//@Slf4j
|
||||
//public class HisHelper {
|
||||
// /**
|
||||
// * 生成HIS订单号
|
||||
// */
|
||||
// public static List<Order> getHisTradeNo(String prefix, List<Long> ids, PEnum pEnum) {
|
||||
// if (pEnum == null) {
|
||||
// return null;
|
||||
// }
|
||||
// return CodeHelper.createTradeNo(prefix, pEnum.ORDER_CODE.toUpperCase(), ids);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 生成HIS订单号
|
||||
// */
|
||||
// public static String getHisTradeNo(String prefix, PEnum pEnum) {
|
||||
// if (pEnum == null) {
|
||||
// return null;
|
||||
// }
|
||||
// return prefix + pEnum.ORDER_CODE.toUpperCase() + "001";
|
||||
// }
|
||||
//
|
||||
//
|
||||
//// // 修改callNo为阿里code
|
||||
//// public static void putCallNoByMer(MerchantEnum merchantEnum, Map<String, Object> params) {
|
||||
//// if (merchantEnum == null) return;
|
||||
////
|
||||
//// if (merchantEnum.equals(MerchantEnum.ALI) || merchantEnum.equals(MerchantEnum.ALI_MEDICAL)) {
|
||||
//// params.put("CallNo", ALI_CALL_NO);
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * webService请求工具类(枚举版)
|
||||
// *
|
||||
// * @param hisEnum 枚举
|
||||
// * @param params 发送的参数
|
||||
// * @return 响应的xml数据
|
||||
// */
|
||||
// public static String getResponseXml(HisEnum hisEnum, Map<String, Object> params) {
|
||||
// return getResponseXml(hisEnum, HisConfig.HIS_SOAP_URL, params);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * webService请求工具类(枚举版)
|
||||
// *
|
||||
// * @param hisEnum 枚举
|
||||
// * @param params 发送的参数
|
||||
// * @return 响应的xml数据
|
||||
// */
|
||||
// public static String getResponseXml(HisEnum hisEnum, String soapUrl, Map<String, Object> params) {
|
||||
// return getResponseXmlForCallNo(hisEnum, soapUrl, params);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * webService请求工具类(枚举版)
|
||||
// *
|
||||
// * @param hisEnum 枚举
|
||||
// * @param soapUrl 路径
|
||||
// * @param params 参数
|
||||
// * @return 响应xml
|
||||
// */
|
||||
// public static String getResponseXmlForCallNo(HisEnum hisEnum, String soapUrl, Map<String, Object> params) {
|
||||
// String method = hisEnum.METHOD;
|
||||
// String transactionCode = hisEnum.CODE;
|
||||
//
|
||||
// if (params == null || transactionCode == null || method == null) {
|
||||
// log.info("[WebService]-{ map | transactionCode | method 为空 }");
|
||||
// return null;
|
||||
// }
|
||||
// Object callNo = params.get("CallNo");
|
||||
// if (ObjectUtils.isEmpty(callNo)) {
|
||||
// params.put("CallNo", HisConfig.WECHAT_CALL_NO);
|
||||
// }
|
||||
// params.put("TransactionCode", transactionCode);
|
||||
//
|
||||
// String result = null;
|
||||
// try {
|
||||
// String reqId = UUID.randomUUID().toString();
|
||||
// long begTime = System.currentTimeMillis(); // 开始时间
|
||||
// String hisResponse = SoapHelper.post("HIS", soapUrl, null, HisConfig.SOAP_ENV +
|
||||
// "xmlns:urn=\"urn:Interface_ABIntf-IInterface_AB\">" +
|
||||
// "<soapenv:Header/><soapenv:Body>" +
|
||||
// "<urn:" + method + " soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">" +
|
||||
// "<InputStr xsi:type=\"xsd:string\">" +
|
||||
// (HisConfig.IS_REQ_CDATA ? "<![CDATA[" : "") +
|
||||
// "<Request>" + SoapHelper.requestParams("HIS", transactionCode, reqId, params) + "</Request>" +
|
||||
// (HisConfig.IS_REQ_CDATA ? "]]>" : "") +
|
||||
// "</InputStr></urn:" + method + "></soapenv:Body></soapenv:Envelope>"
|
||||
// );
|
||||
// long endTime = System.currentTimeMillis(); // 结束时间
|
||||
// String takeTime = (endTime - begTime) + "ms"; // 耗时
|
||||
// if (hisResponse == null) {
|
||||
// log.info("[{}]HIS请求无响应[rid:{}]-耗时:[{}]", transactionCode, reqId, takeTime);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// //解析响应消息,使用SAXReader对象
|
||||
// org.dom4j.Document document = DocumentHelper.parseText(hisResponse);
|
||||
// if (document == null) {
|
||||
// log.info("[{}]HIS响应内容解析失败[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, hisResponse);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// List<Node> nodes = document.selectNodes("//return");
|
||||
// if (nodes.isEmpty()) {
|
||||
// log.info("[{}]HIS请求失败[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, hisResponse);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// Element element = (Element) nodes.get(0);
|
||||
// result = element.getText();
|
||||
// if (hisEnum.IS_LOG_RESP) { // 是否打印返回的xml
|
||||
// log.info("[{}]HIS请求成功[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, result);
|
||||
//
|
||||
// } else {
|
||||
// if (HisConfig.IS_LOG_RESP) { // 配置文件强制要求打印xml
|
||||
// if (!HisEnum.AP_Query_Statement.equals(hisEnum) && !HisEnum.Query_Area.equals(hisEnum)) {
|
||||
// log.info("[强制打印][{}]HIS请求成功[rid:{}]-耗时:[{}]-返回xml={}", transactionCode, reqId, takeTime, result);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (DocumentException e) {
|
||||
// ErrorHelper.println(e);
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult getJsonResult(HisEnum hisEnum, Map<String, Object> params) {
|
||||
// JsonResult result = JsonResult.xmlToBean(getResponseXml(hisEnum, params), JsonResultEnum.SYS_HIS);
|
||||
// if (result == null) { // 如果返回为空可能为超时
|
||||
// return createTimeoutResult();
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// public static void putAliCallNo(MerchantEnum merchantEnum, Map<String, Object> params) {
|
||||
// if (HisConfig.IS_ALI_MER && params != null && merchantEnum != null) {
|
||||
// if (merchantEnum.equals(MerchantEnum.ALI) || merchantEnum.equals(MerchantEnum.ALI_MEDICAL)) {
|
||||
// params.put("CallNo", HisConfig.ALI_CALL_NO);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult getJsonResultByMer(HisEnum hisEnum, MerchantEnum merchantEnum, Map<String, Object> params) {
|
||||
// putAliCallNo(merchantEnum, params);
|
||||
// return getJsonResult(hisEnum, params);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult getJsonResult(HisEnum hisEnum, JsonResult.MapParams params) {
|
||||
// Map<String, Object> requestParams = new HashMap<>();
|
||||
// if (params != null) {
|
||||
// params.setParams(requestParams);
|
||||
// }
|
||||
// return getJsonResult(hisEnum, requestParams);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult getJsonResultByMer(HisEnum hisEnum, MerchantEnum merchantEnum, JsonResult.MapParams params) {
|
||||
// Map<String, Object> requestParams = new HashMap<>();
|
||||
// if (params != null) {
|
||||
// params.setParams(requestParams);
|
||||
// }
|
||||
// return getJsonResultByMer(hisEnum, merchantEnum, requestParams);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult createErrorResult(String message) {
|
||||
// if (ObjectUtils.isEmpty(message)) {
|
||||
// message = "【HIS】请求参数缺失";
|
||||
// }
|
||||
// return JsonResult.createErrorResult(message, JsonResultEnum.SYS_HIS);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// protected static JsonResult createTimeoutResult() {
|
||||
// return JsonResult.createTimeoutResult("【HIS】请求超时", JsonResultEnum.SYS_HIS);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 字符串集转xml
|
||||
// *
|
||||
// * @param xmlTag xml标签
|
||||
// * @param strList 字符串集
|
||||
// * @return xml
|
||||
// */
|
||||
// public static String strListToXml(String xmlTag, List<String> strList) {
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// for (String val : strList) {
|
||||
// sb.append("<").append(xmlTag).append(">").append(val).append("</").append(xmlTag).append(">");
|
||||
// }
|
||||
// return sb.toString();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // /**
|
||||
//// * [支付宝] xml响应数据组装成为JSON数据
|
||||
//// *
|
||||
//// * @param hisEnum 接口枚举
|
||||
//// * @param params 参数
|
||||
//// * @param merchantEnum 支付类型
|
||||
//// * @return JsonResult
|
||||
//// */
|
||||
//// public static JsonResult getJsonResult(HisEnum hisEnum, Map<String, Object> params, MerchantEnum merchantEnum) {
|
||||
//// JsonResult result = JsonResult.xmlToBean(getResponseXml(hisEnum, params, merchantEnum), JsonResultEnum.SYS_HIS);
|
||||
//// if (result == null) { // 如果返回为空可能为超时
|
||||
//// return createTimeoutResult();
|
||||
//// }
|
||||
//// return result;
|
||||
//// }
|
||||
//
|
||||
//// /**
|
||||
//// * xml响应数据组装成为JSON数据
|
||||
//// *
|
||||
//// * @return 封装好的对象
|
||||
//// */
|
||||
//// public static JsonResult getJsonResult(HisEnum hisEnum, JsonResult.MapParams params, MerchantEnum merchantEnum) {
|
||||
//// Map<String, Object> requestParams = new HashMap<>();
|
||||
//// if (params != null) {
|
||||
//// params.setParams(requestParams);
|
||||
//// }
|
||||
//// return getJsonResult(hisEnum, requestParams, merchantEnum);
|
||||
//// }
|
||||
//
|
||||
//
|
||||
// // /**
|
||||
//// * 根据订单号获取类型
|
||||
//// *
|
||||
//// * @param bankTransNo 交易流水号
|
||||
//// * @param tradeNo HIS订单号
|
||||
//// * @return 类型
|
||||
//// */
|
||||
//// public static String getTypeByPEnum(String bankTransNo, String tradeNo) throws ServiceException {
|
||||
//// if (!PayService.isNewOrder(bankTransNo, tradeNo)) {
|
||||
//// throw new ServiceException(ResultEnum.REFUND_IS_OLD_ORDER_NUM);
|
||||
//// }
|
||||
//// int len = tradeNo.length();
|
||||
//// String middleCode1 = tradeNo.substring(len - 4, len - 3);
|
||||
//// String middleCode2 = tradeNo.substring(len - 4, len - 2);
|
||||
//// for (PEnum item : PEnum.values()) {
|
||||
//// if (item.ORDER_CODE.equals(middleCode1) || item.ORDER_CODE.equals(middleCode2)) {
|
||||
//// return item.CODE;
|
||||
//// }
|
||||
//// }
|
||||
//// return null;
|
||||
//// }
|
||||
//
|
||||
//
|
||||
//// /**
|
||||
//// * xml响应数据组装成为JSON数据
|
||||
//// *
|
||||
//// * @param xml xml
|
||||
//// * @return 封装好的对象
|
||||
//// */
|
||||
//// public static HisResult xmlToBean(String xml) {
|
||||
//// if (xml == null || "".equals(xml)) {
|
||||
//// log.info("HIS response xml is null");
|
||||
//// return HisResult.createErrorHisResult("[HIS]获取xml数据失败");
|
||||
//// }
|
||||
////
|
||||
//// JSONObject respObj;
|
||||
//// try {
|
||||
//// Document document = DocumentHelper.parseText(xml);
|
||||
//// Element root = document.getRootElement(); // 获取根节点元素对象
|
||||
//// respObj = HisResult.nodeToJsonObject(root);
|
||||
//// Map<String, Object> map = new HashMap<>();
|
||||
//// Set<String> keys = respObj.keySet();
|
||||
//// for (String key : keys) {
|
||||
//// if (!key.equals("TransactionCode") && !key.equals("ResponseCode") && !key.equals("ResponseMessage") && !key.equals("PatientName")) {
|
||||
//// map.put(key, respObj.getString(key));
|
||||
//// }
|
||||
//// }
|
||||
//// respObj.put("DataMap", map);
|
||||
//// } catch (DocumentException e) {
|
||||
//// ErrorHelper.println(e);
|
||||
//// return HisResult.createErrorHisResult(e.getMessage());
|
||||
//// }
|
||||
//// HisResult hisResult = JSON.toJavaObject(respObj, HisResult.class);
|
||||
//// if (hisResult.getResponseCode() != 0) {
|
||||
//// log.info("HIS Error Message:[{}]", hisResult.getResponseMessage());
|
||||
//// }
|
||||
//// return hisResult;
|
||||
//// }
|
||||
//}
|
||||
@ -0,0 +1,84 @@ |
||||
//package com.ynxbd.common.his;
|
||||
//
|
||||
//import com.ynxbd.common.bean.enums.MerchantEnum;
|
||||
//import com.ynxbd.common.result.JsonResult;
|
||||
//import com.ynxbd.common.result.JsonResultEnum;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.apache.commons.lang3.ObjectUtils;
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//@Slf4j
|
||||
//public class HisMedHelper {
|
||||
//
|
||||
// /**
|
||||
// * 医保环境
|
||||
// *
|
||||
// * @param hisEnum 枚举
|
||||
// * @param params 发送的参数
|
||||
// * @return 响应的xml数据
|
||||
// */
|
||||
// private static String getResponseXml(MerchantEnum merchantEnum, HisEnum hisEnum, Map<String, Object> params) {
|
||||
// if (merchantEnum == null) {
|
||||
// log.error("[HIS医保接口]merchantEnum is null");
|
||||
// return null;
|
||||
// }
|
||||
// String soapUrl = merchantEnum.isWx() ? HisConfig.HIS_WX_MED_URL : HisConfig.HIS_ALI_MED_URL;
|
||||
// if (ObjectUtils.isEmpty(soapUrl)) {
|
||||
// log.error("[HIS医保接口]soapUrl is null");
|
||||
// return null;
|
||||
// }
|
||||
// return HisHelper.getResponseXml(hisEnum, merchantEnum.isWx() ? HisConfig.HIS_WX_MED_URL : HisConfig.HIS_ALI_MED_URL, params);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult getJsonResult(MerchantEnum merchantEnum, HisEnum hisEnum, Map<String, Object> params) {
|
||||
// HisHelper.putAliCallNo(merchantEnum, params);
|
||||
//
|
||||
// JsonResult result = JsonResult.xmlToBean(getResponseXml(merchantEnum, hisEnum, params), JsonResultEnum.SYS_HIS);
|
||||
// if (result == null) { // 如果返回为空可能为超时
|
||||
// return HisHelper.createTimeoutResult();
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * xml响应数据组装成为JSON数据
|
||||
// *
|
||||
// * @return 封装好的对象
|
||||
// */
|
||||
// public static JsonResult getJsonResult(MerchantEnum merchantEnum, HisEnum hisEnum, JsonResult.MapParams params) {
|
||||
// Map<String, Object> requestParams = new HashMap<>();
|
||||
// if (params != null) {
|
||||
// params.setParams(requestParams);
|
||||
// }
|
||||
// return getJsonResult(merchantEnum, hisEnum, requestParams);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // /**
|
||||
//// * xml响应数据组装成为JSON数据
|
||||
//// *
|
||||
//// * @return 封装好的对象
|
||||
//// */
|
||||
//// public static JsonResult getJsonResult(boolean isDev, HisEnum hisEnum, Map<String, Object> params) {
|
||||
//// return getJsonResultByMer(isDev, hisEnum, null, params);
|
||||
//// }
|
||||
//
|
||||
//// /**
|
||||
//// * xml响应数据组装成为JSON数据
|
||||
//// *
|
||||
//// * @return 封装好的对象
|
||||
//// */
|
||||
//// public static JsonResult getJsonResult(boolean isDev, HisEnum hisEnum, JsonResult.MapParams params) {
|
||||
//// return getJsonResultByMer(isDev, hisEnum, null, params);
|
||||
//// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
@ -1,459 +1,459 @@ |
||||
//package com.ynxbd.common.helper.his;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSON;
|
||||
//import com.alibaba.fastjson.JSONArray;
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//import com.alibaba.fastjson.TypeReference;
|
||||
//import com.ynxbd.common.helper.common.ErrorHelper;
|
||||
//import org.dom4j.Attribute;
|
||||
//import org.dom4j.Element;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//
|
||||
//import java.math.BigDecimal;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * HIS响应数据
|
||||
// *
|
||||
// * @Author wsq
|
||||
// * @Date 2020/7/29 13:26
|
||||
// * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
|
||||
// */
|
||||
//
|
||||
//public class HisResult {
|
||||
// private final static Logger log = LoggerFactory.getLogger(HisResult.class);
|
||||
//
|
||||
// // 响应状态码
|
||||
// private Integer responseCode;
|
||||
// // 响应信息
|
||||
// private String responseMessage;
|
||||
// // HIS响应码
|
||||
// private String transactionCode;
|
||||
// // 数据
|
||||
// private Map<String, Object> dataMap;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 创建一个异常信息
|
||||
// *
|
||||
// * @param message 异常信息
|
||||
// * @return 模拟his异常信息
|
||||
// */
|
||||
// public static HisResult createErrorHisResult(String message) {
|
||||
// HisResult hisResult = new HisResult();
|
||||
// hisResult.setResponseCode(500); //
|
||||
// hisResult.setResponseMessage(message);
|
||||
// return hisResult;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 String
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public String getDataMapString(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// if (val == null) {
|
||||
// return null;
|
||||
// }
|
||||
// String v = val.toString().trim();
|
||||
// return "".equals(v) ? null : v;
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 BigDecimal
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public BigDecimal getDataMapBigDecimal(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// return val == null ? null : new BigDecimal(val.toString());
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 Integer
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public Integer getDataMapInteger(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// return val == null ? null : Integer.parseInt(val.toString());
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 Boolean
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public Boolean getDataMapBoolean(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// return val == null ? null : Boolean.parseBoolean(val.toString());
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 Long
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public Long getDataMapLong(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// return val == null ? null : Long.parseLong(val.toString());
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 Double
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public Double getDataMapDouble(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// return val == null ? null : Double.parseDouble(val.toString());
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取根节点包含相同节点数据
|
||||
// * 如:
|
||||
// * <roots>
|
||||
// * # <root>1</root>
|
||||
// * # <root>2</root>
|
||||
// * </roots>
|
||||
// *
|
||||
// * @param clazz 类型
|
||||
// * @param rootNode 根节点名
|
||||
// * @param nodes 子节点名,可变长参数
|
||||
// * @return 集合
|
||||
// */
|
||||
// public <T> List<T> getDataMapList(Class<T> clazz, String rootNode, String... nodes) {
|
||||
// JSONArray jsonArray = getJsonArray(rootNode, nodes);
|
||||
// return decodeList(jsonArray.toString(), clazz);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取嵌套多层的JSONArray
|
||||
// *
|
||||
// * @param rooNode 根节点
|
||||
// * @param nodes 子节点,可变长参数
|
||||
// * @return json数组
|
||||
// */
|
||||
// public JSONArray getJsonArray(String rooNode, String... nodes) {
|
||||
// Object rootObj = this.dataMap.get(rooNode);
|
||||
// String result = rootObj == null ? JSON.toJSONString(new JSONArray()) : rootObj.toString();
|
||||
// try {
|
||||
// JSONArray jsonArray;
|
||||
// JSONObject jsonObject;
|
||||
// for (String node : nodes) {
|
||||
// jsonArray = JSONArray.parseArray(result);
|
||||
// if (jsonArray == null || jsonArray.size() == 0) {
|
||||
// return new JSONArray();
|
||||
// }
|
||||
// if (jsonArray.size() == 1) { // 如果只有一个值继续处理
|
||||
// jsonObject = jsonArray.getJSONObject(0);
|
||||
// result = JSON.toJSONString(jsonObject.getJSONArray(node));
|
||||
// } else { // 如果有多个值返回当前数组
|
||||
// result = JSON.toJSONString(jsonArray);
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("JSON数据转换失败");
|
||||
// ErrorHelper.println(e);
|
||||
// }
|
||||
// return JSONArray.parseArray(result);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * JSON树形结构数据向下JSONArray中传递
|
||||
// *
|
||||
// * @param jsonArray 根节点
|
||||
// * @param properties 节点属性,可变长参数
|
||||
// * @return JSONArray
|
||||
// */
|
||||
// public <T> List<T> jsonParentToChild(Class<T> clazz, JSONArray jsonArray, String rootNode, String... properties) {
|
||||
// JSONArray result = new JSONArray();
|
||||
// JSONObject jsonObject, childNode;
|
||||
// JSONArray nodeJsonArr;
|
||||
// for (int i = 0; i < jsonArray.size(); i++) {
|
||||
// jsonObject = jsonArray.getJSONObject(i);
|
||||
// nodeJsonArr = jsonObject.getJSONArray(rootNode);
|
||||
// for (int j = 0; j < nodeJsonArr.size(); j++) {
|
||||
// childNode = nodeJsonArr.getJSONObject(j);
|
||||
// for (String property : properties) {
|
||||
// for (String key : jsonObject.keySet()) { // 忽略大小写
|
||||
// if (key.toLowerCase().equals(property.toLowerCase())) {
|
||||
// property = key;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// String propertyVal = jsonObject.getString(property);
|
||||
// childNode.put(property, propertyVal);
|
||||
// }
|
||||
// result.add(childNode);
|
||||
// }
|
||||
// }
|
||||
// return decodeList(JSON.toJSONString(result), clazz);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap为bean
|
||||
// *
|
||||
// * @param clazz 类型
|
||||
// * @return bean
|
||||
// */
|
||||
// public <T> T getDataMapBean(Class<T> clazz) {
|
||||
// return decodeBean(JSONObject.toJSONString(this.dataMap), clazz);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap为bean
|
||||
// *
|
||||
// * @param clazz 类型
|
||||
// * @return bean
|
||||
// */
|
||||
// public <T> T getDataMapBean(Class<T> clazz, String rooNode, String... nodes) {
|
||||
// JSONObject jsonObject = getJsonObject(rooNode, nodes);
|
||||
// if (jsonObject == null) {
|
||||
// jsonObject = new JSONObject();
|
||||
// }
|
||||
// return decodeBean(jsonObject.toJSONString(), clazz);
|
||||
// }
|
||||
//
|
||||
//// /**
|
||||
//// * 获取DataMap为bean
|
||||
//// *
|
||||
//// * @param rooNode 根节点
|
||||
//// * @param nodes 子节点
|
||||
//// * @return bean
|
||||
//// */
|
||||
//// public JSONObject getDataMapObject(String rooNode, String... nodes) {
|
||||
//// JSONObject jsonObject = getJsonObject(rooNode, nodes);
|
||||
//// if (jsonObject == null) {
|
||||
//// jsonObject = new JSONObject();
|
||||
//// }
|
||||
//// return decodeBean(jsonObject.toJSONString());
|
||||
//// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取嵌套多层的JSONArray
|
||||
// *
|
||||
// * @param rooNode 根节点
|
||||
// * @param nodes 子节点,可变长参数
|
||||
// * @return json对象
|
||||
// */
|
||||
// public JSONObject getJsonObject(String rooNode, String... nodes) {
|
||||
// Object rootObj = this.dataMap.get(rooNode);
|
||||
// String result = rootObj == null ? new JSONObject().toJSONString() : rootObj.toString();
|
||||
// try {
|
||||
// JSONArray jsonArray = JSONArray.parseArray(result);
|
||||
// if (jsonArray == null || jsonArray.size() == 0) {
|
||||
// return new JSONObject();
|
||||
// }
|
||||
//
|
||||
// JSONObject jsonObject = jsonArray.getJSONObject(0);
|
||||
// if (jsonObject == null) {
|
||||
// return new JSONObject();
|
||||
// }
|
||||
//
|
||||
// if (nodes.length == 0) {
|
||||
// result = jsonObject.toJSONString();
|
||||
// }
|
||||
//
|
||||
// for (String node : nodes) {
|
||||
// result = jsonObject.getJSONObject(node).toJSONString();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("JSON数据转换失败");
|
||||
// ErrorHelper.println(e);
|
||||
// }
|
||||
// return JSONObject.parseObject(result);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // ---------------------------------------------------------------
|
||||
//
|
||||
// /**
|
||||
// * fastJson反序列化Bean
|
||||
// *
|
||||
// * @param json json
|
||||
// * @param clazz 类型
|
||||
// * @return bean
|
||||
// */
|
||||
// public static <T> T decodeBean(String json, Class<T> clazz) {
|
||||
// return JSON.parseObject(json, clazz);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * fastJson反序列化List
|
||||
// *
|
||||
// * @param json json
|
||||
// * @param clazz 类型
|
||||
// * @return List<T>
|
||||
// */
|
||||
// public static <T> List<T> decodeList(String json, Class<T> clazz) {
|
||||
// return decode(json, new TypeReference<List<T>>(clazz) {
|
||||
// });
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * fastJson反序列化
|
||||
// *
|
||||
// * @param json json
|
||||
// * @param typeReference 类型
|
||||
// * @return 反序列化后的值
|
||||
// */
|
||||
// public static <T> T decode(String json, TypeReference<T> typeReference) {
|
||||
// try {
|
||||
// return JSON.parseObject(json, typeReference);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 递归-Element转JSONObject
|
||||
// *
|
||||
// * @param rootNode 根节点
|
||||
// * @return JSONObject
|
||||
// */
|
||||
// public static JSONObject nodeToJsonObject(Element rootNode) {
|
||||
// JSONObject result = new JSONObject();
|
||||
// // 当前节点的名称、文本内容和属性
|
||||
// for (Attribute attr : rootNode.attributes()) {// 遍历当前节点的所有属性
|
||||
// result.put(attr.getName(), attr.getValue());
|
||||
// }
|
||||
//
|
||||
// // 递归遍历当前节点所有的子节点
|
||||
// List<Element> listElement = rootNode.elements();// 所有一级子节点的list
|
||||
// if (!listElement.isEmpty()) {
|
||||
// String name, val;
|
||||
//
|
||||
// for (Element e : listElement) {// 遍历所有一级子节点
|
||||
// name = e.getName();
|
||||
// val = e.getTextTrim();
|
||||
// if (e.attributes().isEmpty() && e.elements().isEmpty()) // 判断一级节点是否有属性和子节点
|
||||
// result.put(name, val.equals("") ? null : val); // 沒有则将当前节点作为上级节点的属性对待
|
||||
// else {
|
||||
// if (!result.containsKey(e.getName())) { // 判断父节点是否存在该一级节点名称的属性
|
||||
// result.put(name, new JSONArray());// 没有则创建
|
||||
// }
|
||||
// JSONArray jsonArray = (JSONArray) result.get(name);
|
||||
// jsonArray.add(nodeToJsonObject(e)); // 将该一级节点放入该节点名称的属性对应的值中
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//// public static void main(String[] args) {
|
||||
//// String testXml = "<?xml version=\"1.0\" encoding=\"GB2312\"?><Response><TransactionCode>2001</TransactionCode><ResponseCode>0</ResponseCode><ResponseMessage>成功</ResponseMessage><Dept><Code>0201</Code><Name>急诊科</Name><Intro>全科医疗</Intro><Address>门诊楼</Address></Dept><Dept><Code>0202</Code><Name>院办</Name><Intro>全科医疗</Intro><Address></Address></Dept><Dept><Code>0203</Code><Name>重症医学科</Name><Intro>全科医疗</Intro><Address></Address></Dept><Dept><Code>0205</Code><Name>急诊科(二楼)</Name><Intro>全科医疗</Intro><Address>门诊二楼</Address></Dept><Dept><Code>0206</Code><Name>血液透析室</Name><Intro>全科医疗</Intro><Address>住院部一楼</Address></Dept><Dept><Code>0207</Code><Name>120急救中心</Name><Intro>全科医疗</Intro><Address></Address></Dept><Dept><Code>0301</Code><Name>内二科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(五</Address></Dept><Dept><Code>0304</Code><Name>门诊部(二楼)</Name><Intro>内科</Intro><Address>门诊二楼</Address></Dept><Dept><Code>0305</Code><Name>门诊部(三楼)</Name><Intro>内科</Intro><Address>门诊三楼</Address></Dept><Dept><Code>0306</Code><Name>消化内科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(六</Address></Dept><Dept><Code>0307</Code><Name>心内科</Name><Intro>内科</Intro><Address>住院部五楼医生办公室</Address></Dept><Dept><Code>0308</Code><Name>呼吸科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(六</Address></Dept><Dept><Code>0309</Code><Name>精神心理科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(七</Address></Dept><Dept><Code>0310</Code><Name>内分泌科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(七</Address></Dept><Dept><Code>0311</Code><Name>内一科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(一</Address></Dept><Dept><Code>0312</Code><Name>肾内科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(六</Address></Dept><Dept><Code>0313</Code><Name>神经内科</Name><Intro>内科</Intro><Address>住院部四楼医生办公室</Address></Dept><Dept><Code>0401</Code><Name>外科</Name><Intro>外科</Intro><Address></Address></Dept><Dept><Code>0402</Code><Name>外一科</Name><Intro>外科</Intro><Address>住院部二楼</Address></Dept><Dept><Code>0403</Code><Name>外二科</Name><Intro>外科</Intro><Address>医技综合楼七楼</Address></Dept><Dept><Code>0404</Code><Name>外三科</Name><Intro>外科</Intro><Address>住院部三楼</Address></Dept><Dept><Code>0406</Code><Name>外(皮肤)科门诊</Name><Intro>外科</Intro><Address>门诊二楼</Address></Dept><Dept><Code>0501</Code><Name>妇产科</Name><Intro>妇产科</Intro><Address>门诊二楼</Address></Dept><Dept><Code>0712</Code><Name>儿科</Name><Intro>儿科</Intro><Address>门诊三楼</Address></Dept><Dept><Code>1100</Code><Name>耳鼻咽喉科</Name><Intro>耳鼻咽喉科</Intro><Address>医技综合楼五楼</Address></Dept><Dept><Code>1101</Code><Name>五官科</Name><Intro>耳鼻咽喉科</Intro><Address>医技综合楼五楼</Address></Dept><Dept><Code>1201</Code><Name>口腔科</Name><Intro>口腔科</Intro><Address>门诊三楼</Address></Dept><Dept><Code>1300</Code><Name>皮肤科</Name><Intro>皮肤科</Intro><Address>外科专家诊室</Address></Dept><Dept><Code>1601</Code><Name>抗病毒治疗室</Name><Intro>传染科</Intro><Address></Address></Dept><Dept><Code>1607</Code><Name>感染性疾病科</Name><Intro>传染科</Intro><Address></Address></Dept><Dept><Code>2100</Code><Name>中医康复科</Name><Intro>康复医学科</Intro><Address></Address></Dept><Dept><Code>2101</Code><Name>疼痛科门诊</Name><Intro>康复医学科</Intro><Address>门诊三楼</Address></Dept><Dept><Code>3205</Code><Name>功能科</Name><Intro>医学影象科</Intro><Address></Address></Dept><Dept><Code>5001</Code><Name>中医科</Name><Intro>中医科</Intro><Address></Address></Dept><Dept><Code>5002</Code><Name>中医肛肠科门诊</Name><Intro>中医科</Intro><Address>门诊三楼</Address></Dept><Dept><Code>5201</Code><Name>针灸科</Name><Intro>中西医结合</Intro><Address></Address></Dept></Response>";
|
||||
//// // 对象封装
|
||||
//// WsResult wsResult = WsResult.xmlToBean(testXml);
|
||||
//// System.out.println(wsResult);
|
||||
//// List<DeptBean> dept = wsResult.getDataMapList("Dept", DeptBean.class);
|
||||
////
|
||||
//// for (DeptBean d : dept) {
|
||||
//// System.out.println(d);
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
// public HisResult() {
|
||||
// }
|
||||
//
|
||||
// public HisResult(Integer responseCode, String responseMessage, String transactionCode, Map<String, Object> dataMap) {
|
||||
// this.responseCode = responseCode;
|
||||
// this.responseMessage = responseMessage;
|
||||
// this.transactionCode = transactionCode;
|
||||
// this.dataMap = dataMap;
|
||||
// }
|
||||
//
|
||||
// public Integer getResponseCode() {
|
||||
// return responseCode;
|
||||
// }
|
||||
//
|
||||
// public void setResponseCode(Integer responseCode) {
|
||||
// this.responseCode = responseCode;
|
||||
// }
|
||||
//
|
||||
// public String getResponseMessage() {
|
||||
// return responseMessage;
|
||||
// }
|
||||
//
|
||||
// public void setResponseMessage(String responseMessage) {
|
||||
// this.responseMessage = responseMessage;
|
||||
// }
|
||||
//
|
||||
// public String getTransactionCode() {
|
||||
// return transactionCode;
|
||||
// }
|
||||
//
|
||||
// public void setTransactionCode(String transactionCode) {
|
||||
// this.transactionCode = transactionCode;
|
||||
// }
|
||||
//
|
||||
// public Map<String, Object> getDataMap() {
|
||||
// return dataMap;
|
||||
// }
|
||||
//
|
||||
// public void setDataMap(Map<String, Object> dataMap) {
|
||||
// this.dataMap = dataMap;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "WsResult{" +
|
||||
// "responseCode=" + responseCode +
|
||||
// ", responseMessage='" + responseMessage + '\'' +
|
||||
// ", transactionCode='" + transactionCode + '\'' +
|
||||
// ", dataMap=" + dataMap +
|
||||
// '}';
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//package com.ynxbd.common.his;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSON;
|
||||
//import com.alibaba.fastjson.JSONArray;
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//import com.alibaba.fastjson.TypeReference;
|
||||
//import com.ynxbd.common.helper.common.ErrorHelper;
|
||||
//import org.dom4j.Attribute;
|
||||
//import org.dom4j.Element;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//
|
||||
//import java.math.BigDecimal;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * HIS响应数据
|
||||
// *
|
||||
// * @Author wsq
|
||||
// * @Date 2020/7/29 13:26
|
||||
// * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
|
||||
// */
|
||||
//
|
||||
//public class HisResult {
|
||||
// private final static Logger log = LoggerFactory.getLogger(HisResult.class);
|
||||
//
|
||||
// // 响应状态码
|
||||
// private Integer responseCode;
|
||||
// // 响应信息
|
||||
// private String responseMessage;
|
||||
// // HIS响应码
|
||||
// private String transactionCode;
|
||||
// // 数据
|
||||
// private Map<String, Object> dataMap;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 创建一个异常信息
|
||||
// *
|
||||
// * @param message 异常信息
|
||||
// * @return 模拟his异常信息
|
||||
// */
|
||||
// public static HisResult createErrorHisResult(String message) {
|
||||
// HisResult hisResult = new HisResult();
|
||||
// hisResult.setResponseCode(500); //
|
||||
// hisResult.setResponseMessage(message);
|
||||
// return hisResult;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 String
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public String getDataMapString(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// if (val == null) {
|
||||
// return null;
|
||||
// }
|
||||
// String v = val.toString().trim();
|
||||
// return "".equals(v) ? null : v;
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 BigDecimal
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public BigDecimal getDataMapBigDecimal(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// return val == null ? null : new BigDecimal(val.toString());
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 Integer
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public Integer getDataMapInteger(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// return val == null ? null : Integer.parseInt(val.toString());
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 Boolean
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public Boolean getDataMapBoolean(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// return val == null ? null : Boolean.parseBoolean(val.toString());
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 Long
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public Long getDataMapLong(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// return val == null ? null : Long.parseLong(val.toString());
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap的值 Double
|
||||
// *
|
||||
// * @param nodeName 节点名称
|
||||
// * @return nodeVal 节点值
|
||||
// */
|
||||
// public Double getDataMapDouble(String nodeName) {
|
||||
// try {
|
||||
// Object val = this.dataMap.get(nodeName);
|
||||
// return val == null ? null : Double.parseDouble(val.toString());
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取根节点包含相同节点数据
|
||||
// * 如:
|
||||
// * <roots>
|
||||
// * # <root>1</root>
|
||||
// * # <root>2</root>
|
||||
// * </roots>
|
||||
// *
|
||||
// * @param clazz 类型
|
||||
// * @param rootNode 根节点名
|
||||
// * @param nodes 子节点名,可变长参数
|
||||
// * @return 集合
|
||||
// */
|
||||
// public <T> List<T> getDataMapList(Class<T> clazz, String rootNode, String... nodes) {
|
||||
// JSONArray jsonArray = getJsonArray(rootNode, nodes);
|
||||
// return decodeList(jsonArray.toString(), clazz);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取嵌套多层的JSONArray
|
||||
// *
|
||||
// * @param rooNode 根节点
|
||||
// * @param nodes 子节点,可变长参数
|
||||
// * @return json数组
|
||||
// */
|
||||
// public JSONArray getJsonArray(String rooNode, String... nodes) {
|
||||
// Object rootObj = this.dataMap.get(rooNode);
|
||||
// String result = rootObj == null ? JSON.toJSONString(new JSONArray()) : rootObj.toString();
|
||||
// try {
|
||||
// JSONArray jsonArray;
|
||||
// JSONObject jsonObject;
|
||||
// for (String node : nodes) {
|
||||
// jsonArray = JSONArray.parseArray(result);
|
||||
// if (jsonArray == null || jsonArray.size() == 0) {
|
||||
// return new JSONArray();
|
||||
// }
|
||||
// if (jsonArray.size() == 1) { // 如果只有一个值继续处理
|
||||
// jsonObject = jsonArray.getJSONObject(0);
|
||||
// result = JSON.toJSONString(jsonObject.getJSONArray(node));
|
||||
// } else { // 如果有多个值返回当前数组
|
||||
// result = JSON.toJSONString(jsonArray);
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("JSON数据转换失败");
|
||||
// ErrorHelper.println(e);
|
||||
// }
|
||||
// return JSONArray.parseArray(result);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * JSON树形结构数据向下JSONArray中传递
|
||||
// *
|
||||
// * @param jsonArray 根节点
|
||||
// * @param properties 节点属性,可变长参数
|
||||
// * @return JSONArray
|
||||
// */
|
||||
// public <T> List<T> jsonParentToChild(Class<T> clazz, JSONArray jsonArray, String rootNode, String... properties) {
|
||||
// JSONArray result = new JSONArray();
|
||||
// JSONObject jsonObject, childNode;
|
||||
// JSONArray nodeJsonArr;
|
||||
// for (int i = 0; i < jsonArray.size(); i++) {
|
||||
// jsonObject = jsonArray.getJSONObject(i);
|
||||
// nodeJsonArr = jsonObject.getJSONArray(rootNode);
|
||||
// for (int j = 0; j < nodeJsonArr.size(); j++) {
|
||||
// childNode = nodeJsonArr.getJSONObject(j);
|
||||
// for (String property : properties) {
|
||||
// for (String key : jsonObject.keySet()) { // 忽略大小写
|
||||
// if (key.toLowerCase().equals(property.toLowerCase())) {
|
||||
// property = key;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// String propertyVal = jsonObject.getString(property);
|
||||
// childNode.put(property, propertyVal);
|
||||
// }
|
||||
// result.add(childNode);
|
||||
// }
|
||||
// }
|
||||
// return decodeList(JSON.toJSONString(result), clazz);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap为bean
|
||||
// *
|
||||
// * @param clazz 类型
|
||||
// * @return bean
|
||||
// */
|
||||
// public <T> T getDataMapBean(Class<T> clazz) {
|
||||
// return decodeBean(JSONObject.toJSONString(this.dataMap), clazz);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取DataMap为bean
|
||||
// *
|
||||
// * @param clazz 类型
|
||||
// * @return bean
|
||||
// */
|
||||
// public <T> T getDataMapBean(Class<T> clazz, String rooNode, String... nodes) {
|
||||
// JSONObject jsonObject = getJsonObject(rooNode, nodes);
|
||||
// if (jsonObject == null) {
|
||||
// jsonObject = new JSONObject();
|
||||
// }
|
||||
// return decodeBean(jsonObject.toJSONString(), clazz);
|
||||
// }
|
||||
//
|
||||
//// /**
|
||||
//// * 获取DataMap为bean
|
||||
//// *
|
||||
//// * @param rooNode 根节点
|
||||
//// * @param nodes 子节点
|
||||
//// * @return bean
|
||||
//// */
|
||||
//// public JSONObject getDataMapObject(String rooNode, String... nodes) {
|
||||
//// JSONObject jsonObject = getJsonObject(rooNode, nodes);
|
||||
//// if (jsonObject == null) {
|
||||
//// jsonObject = new JSONObject();
|
||||
//// }
|
||||
//// return decodeBean(jsonObject.toJSONString());
|
||||
//// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取嵌套多层的JSONArray
|
||||
// *
|
||||
// * @param rooNode 根节点
|
||||
// * @param nodes 子节点,可变长参数
|
||||
// * @return json对象
|
||||
// */
|
||||
// public JSONObject getJsonObject(String rooNode, String... nodes) {
|
||||
// Object rootObj = this.dataMap.get(rooNode);
|
||||
// String result = rootObj == null ? new JSONObject().toJSONString() : rootObj.toString();
|
||||
// try {
|
||||
// JSONArray jsonArray = JSONArray.parseArray(result);
|
||||
// if (jsonArray == null || jsonArray.size() == 0) {
|
||||
// return new JSONObject();
|
||||
// }
|
||||
//
|
||||
// JSONObject jsonObject = jsonArray.getJSONObject(0);
|
||||
// if (jsonObject == null) {
|
||||
// return new JSONObject();
|
||||
// }
|
||||
//
|
||||
// if (nodes.length == 0) {
|
||||
// result = jsonObject.toJSONString();
|
||||
// }
|
||||
//
|
||||
// for (String node : nodes) {
|
||||
// result = jsonObject.getJSONObject(node).toJSONString();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("JSON数据转换失败");
|
||||
// ErrorHelper.println(e);
|
||||
// }
|
||||
// return JSONObject.parseObject(result);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // ---------------------------------------------------------------
|
||||
//
|
||||
// /**
|
||||
// * fastJson反序列化Bean
|
||||
// *
|
||||
// * @param json json
|
||||
// * @param clazz 类型
|
||||
// * @return bean
|
||||
// */
|
||||
// public static <T> T decodeBean(String json, Class<T> clazz) {
|
||||
// return JSON.parseObject(json, clazz);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * fastJson反序列化List
|
||||
// *
|
||||
// * @param json json
|
||||
// * @param clazz 类型
|
||||
// * @return List<T>
|
||||
// */
|
||||
// public static <T> List<T> decodeList(String json, Class<T> clazz) {
|
||||
// return decode(json, new TypeReference<List<T>>(clazz) {
|
||||
// });
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * fastJson反序列化
|
||||
// *
|
||||
// * @param json json
|
||||
// * @param typeReference 类型
|
||||
// * @return 反序列化后的值
|
||||
// */
|
||||
// public static <T> T decode(String json, TypeReference<T> typeReference) {
|
||||
// try {
|
||||
// return JSON.parseObject(json, typeReference);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 递归-Element转JSONObject
|
||||
// *
|
||||
// * @param rootNode 根节点
|
||||
// * @return JSONObject
|
||||
// */
|
||||
// public static JSONObject nodeToJsonObject(Element rootNode) {
|
||||
// JSONObject result = new JSONObject();
|
||||
// // 当前节点的名称、文本内容和属性
|
||||
// for (Attribute attr : rootNode.attributes()) {// 遍历当前节点的所有属性
|
||||
// result.put(attr.getName(), attr.getValue());
|
||||
// }
|
||||
//
|
||||
// // 递归遍历当前节点所有的子节点
|
||||
// List<Element> listElement = rootNode.elements();// 所有一级子节点的list
|
||||
// if (!listElement.isEmpty()) {
|
||||
// String name, val;
|
||||
//
|
||||
// for (Element e : listElement) {// 遍历所有一级子节点
|
||||
// name = e.getName();
|
||||
// val = e.getTextTrim();
|
||||
// if (e.attributes().isEmpty() && e.elements().isEmpty()) // 判断一级节点是否有属性和子节点
|
||||
// result.put(name, val.equals("") ? null : val); // 沒有则将当前节点作为上级节点的属性对待
|
||||
// else {
|
||||
// if (!result.containsKey(e.getName())) { // 判断父节点是否存在该一级节点名称的属性
|
||||
// result.put(name, new JSONArray());// 没有则创建
|
||||
// }
|
||||
// JSONArray jsonArray = (JSONArray) result.get(name);
|
||||
// jsonArray.add(nodeToJsonObject(e)); // 将该一级节点放入该节点名称的属性对应的值中
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//// public static void main(String[] args) {
|
||||
//// String testXml = "<?xml version=\"1.0\" encoding=\"GB2312\"?><Response><TransactionCode>2001</TransactionCode><ResponseCode>0</ResponseCode><ResponseMessage>成功</ResponseMessage><Dept><Code>0201</Code><Name>急诊科</Name><Intro>全科医疗</Intro><Address>门诊楼</Address></Dept><Dept><Code>0202</Code><Name>院办</Name><Intro>全科医疗</Intro><Address></Address></Dept><Dept><Code>0203</Code><Name>重症医学科</Name><Intro>全科医疗</Intro><Address></Address></Dept><Dept><Code>0205</Code><Name>急诊科(二楼)</Name><Intro>全科医疗</Intro><Address>门诊二楼</Address></Dept><Dept><Code>0206</Code><Name>血液透析室</Name><Intro>全科医疗</Intro><Address>住院部一楼</Address></Dept><Dept><Code>0207</Code><Name>120急救中心</Name><Intro>全科医疗</Intro><Address></Address></Dept><Dept><Code>0301</Code><Name>内二科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(五</Address></Dept><Dept><Code>0304</Code><Name>门诊部(二楼)</Name><Intro>内科</Intro><Address>门诊二楼</Address></Dept><Dept><Code>0305</Code><Name>门诊部(三楼)</Name><Intro>内科</Intro><Address>门诊三楼</Address></Dept><Dept><Code>0306</Code><Name>消化内科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(六</Address></Dept><Dept><Code>0307</Code><Name>心内科</Name><Intro>内科</Intro><Address>住院部五楼医生办公室</Address></Dept><Dept><Code>0308</Code><Name>呼吸科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(六</Address></Dept><Dept><Code>0309</Code><Name>精神心理科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(七</Address></Dept><Dept><Code>0310</Code><Name>内分泌科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(七</Address></Dept><Dept><Code>0311</Code><Name>内一科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(一</Address></Dept><Dept><Code>0312</Code><Name>肾内科</Name><Intro>内科</Intro><Address>门诊三楼内科专家(六</Address></Dept><Dept><Code>0313</Code><Name>神经内科</Name><Intro>内科</Intro><Address>住院部四楼医生办公室</Address></Dept><Dept><Code>0401</Code><Name>外科</Name><Intro>外科</Intro><Address></Address></Dept><Dept><Code>0402</Code><Name>外一科</Name><Intro>外科</Intro><Address>住院部二楼</Address></Dept><Dept><Code>0403</Code><Name>外二科</Name><Intro>外科</Intro><Address>医技综合楼七楼</Address></Dept><Dept><Code>0404</Code><Name>外三科</Name><Intro>外科</Intro><Address>住院部三楼</Address></Dept><Dept><Code>0406</Code><Name>外(皮肤)科门诊</Name><Intro>外科</Intro><Address>门诊二楼</Address></Dept><Dept><Code>0501</Code><Name>妇产科</Name><Intro>妇产科</Intro><Address>门诊二楼</Address></Dept><Dept><Code>0712</Code><Name>儿科</Name><Intro>儿科</Intro><Address>门诊三楼</Address></Dept><Dept><Code>1100</Code><Name>耳鼻咽喉科</Name><Intro>耳鼻咽喉科</Intro><Address>医技综合楼五楼</Address></Dept><Dept><Code>1101</Code><Name>五官科</Name><Intro>耳鼻咽喉科</Intro><Address>医技综合楼五楼</Address></Dept><Dept><Code>1201</Code><Name>口腔科</Name><Intro>口腔科</Intro><Address>门诊三楼</Address></Dept><Dept><Code>1300</Code><Name>皮肤科</Name><Intro>皮肤科</Intro><Address>外科专家诊室</Address></Dept><Dept><Code>1601</Code><Name>抗病毒治疗室</Name><Intro>传染科</Intro><Address></Address></Dept><Dept><Code>1607</Code><Name>感染性疾病科</Name><Intro>传染科</Intro><Address></Address></Dept><Dept><Code>2100</Code><Name>中医康复科</Name><Intro>康复医学科</Intro><Address></Address></Dept><Dept><Code>2101</Code><Name>疼痛科门诊</Name><Intro>康复医学科</Intro><Address>门诊三楼</Address></Dept><Dept><Code>3205</Code><Name>功能科</Name><Intro>医学影象科</Intro><Address></Address></Dept><Dept><Code>5001</Code><Name>中医科</Name><Intro>中医科</Intro><Address></Address></Dept><Dept><Code>5002</Code><Name>中医肛肠科门诊</Name><Intro>中医科</Intro><Address>门诊三楼</Address></Dept><Dept><Code>5201</Code><Name>针灸科</Name><Intro>中西医结合</Intro><Address></Address></Dept></Response>";
|
||||
//// // 对象封装
|
||||
//// WsResult wsResult = WsResult.xmlToBean(testXml);
|
||||
//// System.out.println(wsResult);
|
||||
//// List<DeptBean> dept = wsResult.getDataMapList("Dept", DeptBean.class);
|
||||
////
|
||||
//// for (DeptBean d : dept) {
|
||||
//// System.out.println(d);
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
// public HisResult() {
|
||||
// }
|
||||
//
|
||||
// public HisResult(Integer responseCode, String responseMessage, String transactionCode, Map<String, Object> dataMap) {
|
||||
// this.responseCode = responseCode;
|
||||
// this.responseMessage = responseMessage;
|
||||
// this.transactionCode = transactionCode;
|
||||
// this.dataMap = dataMap;
|
||||
// }
|
||||
//
|
||||
// public Integer getResponseCode() {
|
||||
// return responseCode;
|
||||
// }
|
||||
//
|
||||
// public void setResponseCode(Integer responseCode) {
|
||||
// this.responseCode = responseCode;
|
||||
// }
|
||||
//
|
||||
// public String getResponseMessage() {
|
||||
// return responseMessage;
|
||||
// }
|
||||
//
|
||||
// public void setResponseMessage(String responseMessage) {
|
||||
// this.responseMessage = responseMessage;
|
||||
// }
|
||||
//
|
||||
// public String getTransactionCode() {
|
||||
// return transactionCode;
|
||||
// }
|
||||
//
|
||||
// public void setTransactionCode(String transactionCode) {
|
||||
// this.transactionCode = transactionCode;
|
||||
// }
|
||||
//
|
||||
// public Map<String, Object> getDataMap() {
|
||||
// return dataMap;
|
||||
// }
|
||||
//
|
||||
// public void setDataMap(Map<String, Object> dataMap) {
|
||||
// this.dataMap = dataMap;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "WsResult{" +
|
||||
// "responseCode=" + responseCode +
|
||||
// ", responseMessage='" + responseMessage + '\'' +
|
||||
// ", transactionCode='" + transactionCode + '\'' +
|
||||
// ", dataMap=" + dataMap +
|
||||
// '}';
|
||||
// }
|
||||
//}
|
||||
//
|
||||
@ -1 +1 @@ |
||||
# \u5F00\u542F\u5904\u65B9\u9884\u7ED3\u7B97\uFF08\u7B2C2\u5F00\u5173\uFF09\uFF08\u6CE8\u610F\u8BE5\u914D\u7F6E\u9700\u8054\u7CFBhis\u5F00\u53D1\u8005\u786E\u8BA4\u652F\u6301\u624D\u80FD\u5F00\u542F\uFF0C\u5426\u5219\u5B58\u5728\u98CE\u9669\uFF01\uFF09
his.is_recipe_prepay=false
# \u672C\u5730
#his.url=127.0.0.1:8888
# HIS\u662F\u5426\u5F00\u542F\u652F\u4ED8\u5B9D\u5206\u5F00\u5BF9\u8D26
his.is_ali_mer=false
# \u662F\u5426\u5F3A\u5236\u6253\u5370webservice\u7684xml\u8FD4\u56DE\u6570\u636E
his.is_log_resp=true
# \u5DDE\u50A3\u533B\u4F7F\u7528
his.is_req_cdata=false
# \u662F\u5426\u4F20\u9012openid\u7ED9his\u63A8\u9001\u6D88\u606F
his.is_push_msg=false
#-------------------------------
# \u6D4B\u8BD5\u73AF\u5883
his.dev_url=200.200.200.60:7777
# \u533B\u4FDD===========================
# \u65E7\u914D\u7F6E
his.md_url=127.0.0.1:7777
# \u5FAE\u4FE1\u533B\u4FDD
his.wx_med_url=10.20.10.7:7885
# \u652F\u4ED8\u5B9D\u533B\u4FDD
his.ali_med_url=10.20.10.7:7885
# \u6D4B\u8BD5============================================================
# \u516C\u53F8\u6D4B\u8BD5
#his.url=192.168.12.10:8888
# \u77F3\u6797\u53BF\u533B\u9662
#his.url=200.200.200.105:8888
# \u5FB7\u5B8F\u4E2D\u533B
his.url=200.200.200.60:7777
# \u7EA2\u6CB3\u5DDE\u533B\u9662
#his.url=10.20.10.6:8888
# \u8292\u5E02\u5987\u5E7C
#his.url=192.168.11.7:8888
# \u5B81\u8497\u5987\u5E7C
#his.url=172.19.3.15:8888
# \u5B81\u8497\u53BF\u533B\u9662
#his.url=192.168.10.8:8888
# \u516C\u53F8\u6D4B\u8BD5
#his.url=192.168.12.39:8888
#\u666F\u6D2A\u4E2D\u50A3\u533B
#his.url=192.168.197.217:8888
# \u516C\u53F8\u6D4B\u8BD5
#his.url=192.168.12.10:8888
# \u7EA2\u6CB3
#his.url=10.20.10.6:8888
# \u7EA2\u6CB3\u533B\u4FDD
#his.url=10.20.10.6:8888
#his.url=192.168.12.10:8888
#his.md_url=192.168.1.128:7885
#his.dev_url=10.20.10.6:9988
# \u6C38\u80DC
#his.url=200.200.200.20:8888
# \u5FB7\u5B8F\u4E2D\u533B
#his.url=200.200.200.60:8888
# \u534E\u576A
#his.url=192.168.1.115:8888
# \u8499\u81EA\u4E2D\u533B
#his.url=192.168.0.228:8888
# \u7389\u9F99
#his.url=192.168.0.17:8888
#
#his.url=172.16.10.15:8888
# \u7984\u529D\u949F\u7231
#his.url=200.200.200.5:8888
# \u8499\u81EA\u5E02\u4EBA\u6C11\u533B\u9662
#his.url=200.200.200.174:8080
# \u5143\u8C0B
#his.url=200.200.200.29:8888
# \u5143\u8C0B\u533B\u4FDD
#his.dev_url=200.200.200.36:9999
# \u8292\u5E02
#his.url=192.168.100.8:8888
# \u7EA2\u6CB3\u5987\u5E7C\u4FDD\u5065\u9662
#his.url=192.168.1.204:8888
# \u8292\u5E02\u5987\u5E7C
#his.url=192.168.11.7:8888
#
#his.url=10.10.11.23:8888
# \u77F3\u6797
#his.url=192.168.10.10:8888
# \u5BCC\u6C11
#his.url=200.200.201.27:8888
# \u897F\u53CC\u7248\u7EB3
#his.url=10.10.11.23:8888
#wx.password=ynxbd@6910 |
||||
his.is_recipe_prepay=false
# \u672C\u5730
#his.url=127.0.0.1:8888
# HIS\u662F\u5426\u5F00\u542F\u652F\u4ED8\u5B9D\u5206\u5F00\u5BF9\u8D26
his.is_ali_mer=false
# \u662F\u5426\u5F3A\u5236\u6253\u5370webservice\u7684xml\u8FD4\u56DE\u6570\u636E
his.is_log_resp=true
# \u5DDE\u50A3\u533B\u4F7F\u7528
his.is_req_cdata=false
# \u662F\u5426\u4F20\u9012openid\u7ED9his\u63A8\u9001\u6D88\u606F
his.is_push_msg=false
#-------------------------------
# \u6D4B\u8BD5\u73AF\u5883
his.dev_url=200.200.200.60:7777
# \u533B\u4FDD===========================
# \u65E7\u914D\u7F6E
his.md_url=127.0.0.1:7777
# \u5FAE\u4FE1\u533B\u4FDD
his.wx_med_url=10.20.10.7:7885
# \u652F\u4ED8\u5B9D\u533B\u4FDD
his.ali_med_url=10.20.10.7:7885
# \u6D4B\u8BD5============================================================
# \u516C\u53F8\u6D4B\u8BD5
#his.url=192.168.12.10:8888
# \u77F3\u6797\u53BF\u533B\u9662
#his.url=200.200.200.105:8888
# \u5FB7\u5B8F\u4E2D\u533B
his.url=200.200.200.60:7777
# \u7EA2\u6CB3\u5DDE\u533B\u9662
#his.url=10.20.10.6:8888
# \u8292\u5E02\u5987\u5E7C
#his.url=192.168.11.7:8888
# \u5B81\u8497\u5987\u5E7C
#his.url=172.19.3.15:8888
# \u5B81\u8497\u53BF\u533B\u9662
#his.url=192.168.10.8:8888
# \u516C\u53F8\u6D4B\u8BD5
#his.url=192.168.12.39:8888
#\u666F\u6D2A\u4E2D\u50A3\u533B
#his.url=192.168.197.217:8888
# \u516C\u53F8\u6D4B\u8BD5
#his.url=192.168.12.10:8888
# \u7EA2\u6CB3
#his.url=10.20.10.6:8888
# \u7EA2\u6CB3\u533B\u4FDD
#his.url=10.20.10.6:8888
#his.url=192.168.12.10:8888
#his.md_url=192.168.1.128:7885
#his.dev_url=10.20.10.6:9988
# \u6C38\u80DC
#his.url=200.200.200.20:8888
# \u5FB7\u5B8F\u4E2D\u533B
#his.url=200.200.200.60:8888
# \u534E\u576A
#his.url=192.168.1.115:8888
# \u8499\u81EA\u4E2D\u533B
#his.url=192.168.0.228:8888
# \u7389\u9F99
#his.url=192.168.0.17:8888
#
#his.url=172.16.10.15:8888
# \u7984\u529D\u949F\u7231
#his.url=200.200.200.5:8888
# \u8499\u81EA\u5E02\u4EBA\u6C11\u533B\u9662
#his.url=200.200.200.174:8080
# \u5143\u8C0B
#his.url=200.200.200.29:8888
# \u5143\u8C0B\u533B\u4FDD
#his.dev_url=200.200.200.36:9999
# \u8292\u5E02
#his.url=192.168.100.8:8888
# \u7EA2\u6CB3\u5987\u5E7C\u4FDD\u5065\u9662
#his.url=192.168.1.204:8888
# \u8292\u5E02\u5987\u5E7C
#his.url=192.168.11.7:8888
#
#his.url=10.10.11.23:8888
# \u77F3\u6797
#his.url=192.168.10.10:8888
# \u5BCC\u6C11
#his.url=200.200.201.27:8888
# \u897F\u53CC\u7248\u7EB3
#his.url=10.10.11.23:8888
#wx.password=ynxbd@6910 |
||||
@ -0,0 +1 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?>
<config>
<his>
<is_req_cdata name="州傣医使用-[def:false]">false</is_req_cdata>
<!-- 处方预结算(第2开关)(注意该配置需联系his开发者确认支持才能开启,否则存在风险!) -->
<is_rx_prepay name="处方预结算[风险][def:false]">false</is_rx_prepay>
<!-- 开关配置 -->
<is_ali_mer name="HIS是否开启支付宝分开对账-[def:false]">false</is_ali_mer>
<is_log_resp name="是否强制打印响应xml数据-[def:false]">false</is_log_resp>
<is_push_msg name="是否传递openid给His推送消息-[def:false]">false</is_push_msg>
<!-- 医保 -->
<wx_med_url name="[微信医保]">127.0.0.1:8888</wx_med_url>
<ali_med_url name="[支付宝医保]">127.0.0.1:8888</ali_med_url>
<!-- HIS -->
<dev_url name="[测试环境]">200.200.200.60:7777</dev_url>
<!-- <url name="[正式环境]">200.200.200.60:7777</url>-->
<url name="德宏中医">200.200.200.60:7777</url>
</his>
</config> |
||||
Loading…
Reference in new issue