新增病案查询接口,修改退费接口
This commit is contained in:
@@ -80,6 +80,11 @@ public class GuahaoTask {
|
|||||||
} else {
|
} else {
|
||||||
cancelSuccess = true;
|
cancelSuccess = true;
|
||||||
log.info("退号成功");
|
log.info("退号成功");
|
||||||
|
if (vo.getZfamount().equals("0.00")){
|
||||||
|
log.info("0元挂号,跳过退费处理");
|
||||||
|
refundSuccess = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 2. 执行退费
|
// 2. 执行退费
|
||||||
Map<String, Object> refundResult = reserve8Service.MOP_BillsPayedRefund(vo);
|
Map<String, Object> refundResult = reserve8Service.MOP_BillsPayedRefund(vo);
|
||||||
|
|||||||
@@ -153,6 +153,23 @@ public class ApiPayController {
|
|||||||
return wxPayService.buildFailResponse("处理异常");
|
return wxPayService.buildFailResponse("处理异常");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 微信退款回调通知接口
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/wxRefund/notify2")
|
||||||
|
@WebLog(description = "wxRefundNotify2")
|
||||||
|
public String wxRefundNotify2(@RequestBody String xmlStr, HttpServletResponse response, HttpServletRequest request) {
|
||||||
|
try {
|
||||||
|
String result = wxPayService.handleWxRefundNotify2(xmlStr);
|
||||||
|
return result;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("微信支付回调处理异常", e);
|
||||||
|
// 返回失败,微信会重试
|
||||||
|
return wxPayService.buildFailResponse("处理异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询微信订单状态
|
* 查询微信订单状态
|
||||||
@@ -184,13 +201,14 @@ public class ApiPayController {
|
|||||||
@PostMapping("/wxpay/refundOrder")
|
@PostMapping("/wxpay/refundOrder")
|
||||||
@WebLog(description = "refundOrder")
|
@WebLog(description = "refundOrder")
|
||||||
public Object refundOrder(@RequestParam("powertranid") String powertranid,
|
public Object refundOrder(@RequestParam("powertranid") String powertranid,
|
||||||
@RequestParam("money") String money
|
@RequestParam("money") String money,
|
||||||
|
@RequestParam("type") String type
|
||||||
) {
|
) {
|
||||||
String paramTip = "";
|
String paramTip = "";
|
||||||
try {
|
try {
|
||||||
paramTip = String.format(" >>> requestObj:%s", JSONUtil.toJsonStr(powertranid));
|
paramTip = String.format(" >>> requestObj:%s", JSONUtil.toJsonStr(powertranid));
|
||||||
|
|
||||||
Map map = wxPayService.refundOrder(powertranid,money);
|
Map map = wxPayService.refundOrder(powertranid,money,type);
|
||||||
return ResponseResult.success(map);
|
return ResponseResult.success(map);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ public class WxPayService {
|
|||||||
txSendMsg.SendNotifyYJJ(uo,openid);
|
txSendMsg.SendNotifyYJJ(uo,openid);
|
||||||
}else {
|
}else {
|
||||||
//写入his失败,执行退款处理
|
//写入his失败,执行退款处理
|
||||||
refundOrder(uo.getCode(),AmountUtil.doubleToStr(uo.getMoney()));
|
refundOrder(uo.getCode(),AmountUtil.doubleToStr(uo.getMoney()),"微信");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -424,7 +424,7 @@ public class WxPayService {
|
|||||||
} else {
|
} else {
|
||||||
log.error("挂号确认失败,将自动退款: " + mapConfirm.get("errormsg"));
|
log.error("挂号确认失败,将自动退款: " + mapConfirm.get("errormsg"));
|
||||||
// 可以考虑发起退款
|
// 可以考虑发起退款
|
||||||
refundOrder(outTradeNo, String.valueOf(reserveVo.getZfamount()));
|
refundOrder(outTradeNo, String.valueOf(reserveVo.getZfamount()),"微信");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.warn("未找到对应订单: " + outTradeNo);
|
log.warn("未找到对应订单: " + outTradeNo);
|
||||||
@@ -541,7 +541,7 @@ public class WxPayService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> refundOrder(String powertranid,String amount) {
|
public Map<String, String> refundOrder(String powertranid,String amount,String type) {
|
||||||
Map<String, String> data = new HashMap<>();
|
Map<String, String> data = new HashMap<>();
|
||||||
data.put("appid", wxPayConfig.getAppId());
|
data.put("appid", wxPayConfig.getAppId());
|
||||||
data.put("mch_id", wxPayConfig.getMchId());
|
data.put("mch_id", wxPayConfig.getMchId());
|
||||||
@@ -553,7 +553,11 @@ public class WxPayService {
|
|||||||
String money = WxPayDUtil.yuanToFee(amount);
|
String money = WxPayDUtil.yuanToFee(amount);
|
||||||
data.put("total_fee", money);
|
data.put("total_fee", money);
|
||||||
data.put("refund_fee", money);
|
data.put("refund_fee", money);
|
||||||
|
if (type.equals("微信")){
|
||||||
data.put("notify_url", "https://nxwj.btlsoln.com/nxgzh/pay/wxRefund/notify");
|
data.put("notify_url", "https://nxwj.btlsoln.com/nxgzh/pay/wxRefund/notify");
|
||||||
|
} else if (type.equals("全部")) {
|
||||||
|
data.put("notify_url", "https://nxwj.btlsoln.com/nxgzh/pay/wxRefund/notify2");
|
||||||
|
}
|
||||||
data.put("op_user_id", wxPayConfig.getMchId()); // 操作员 = 商户号
|
data.put("op_user_id", wxPayConfig.getMchId()); // 操作员 = 商户号
|
||||||
|
|
||||||
CloseableHttpClient client = null;
|
CloseableHttpClient client = null;
|
||||||
@@ -721,6 +725,7 @@ public class WxPayService {
|
|||||||
Reserve8Vo vo = new Reserve8Vo();
|
Reserve8Vo vo = new Reserve8Vo();
|
||||||
vo.setOrderno(outTradeNo);
|
vo.setOrderno(outTradeNo);
|
||||||
List<Reserve8Vo> reserveList = reserve8Mapper.getReserveList(vo);
|
List<Reserve8Vo> reserveList = reserve8Mapper.getReserveList(vo);
|
||||||
|
// HisRefundVo refundVo = new HisRefundVo();
|
||||||
if (reserveList.isEmpty()){
|
if (reserveList.isEmpty()){
|
||||||
if (outTradeNo.substring(0, 2).equals("YC")){
|
if (outTradeNo.substring(0, 2).equals("YC")){
|
||||||
//业务处理逻辑......
|
//业务处理逻辑......
|
||||||
@@ -733,11 +738,12 @@ public class WxPayService {
|
|||||||
|
|
||||||
userOrderMapper.SelectUserOrderByCode(outTradeNo,3);
|
userOrderMapper.SelectUserOrderByCode(outTradeNo,3);
|
||||||
|
|
||||||
|
|
||||||
InterfaceCount interfaceCount = new InterfaceCount();
|
InterfaceCount interfaceCount = new InterfaceCount();
|
||||||
interfaceCount.setUserId(Integer.toString(uo.getUser_id()));
|
interfaceCount.setUserId(Integer.toString(uo.getUser_id()));
|
||||||
interfaceCount.setInterfaceIdentification("YCTF");
|
interfaceCount.setInterfaceIdentification("YCTF");
|
||||||
interfaceCountService.updateInterfaceConut(interfaceCount);
|
interfaceCountService.updateInterfaceConut(interfaceCount);
|
||||||
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
|
||||||
}else if (outTradeNo.substring(0, 2).equals("MZ")){
|
}else if (outTradeNo.substring(0, 2).equals("MZ")){
|
||||||
HsjcVo hsjcvo = new HsjcVo();
|
HsjcVo hsjcvo = new HsjcVo();
|
||||||
hsjcvo.setOrderno(outTradeNo);
|
hsjcvo.setOrderno(outTradeNo);
|
||||||
@@ -745,22 +751,50 @@ public class WxPayService {
|
|||||||
hsjcvo = list.get(0);
|
hsjcvo = list.get(0);
|
||||||
|
|
||||||
hsjcMapper.updateByOutTradeNo(outTradeNo,5);
|
hsjcMapper.updateByOutTradeNo(outTradeNo,5);
|
||||||
|
// refundVo.setPatientid(hsjcvo.getPatientid());
|
||||||
|
// refundVo.setBillsmsg(hsjcvo.getReferno());
|
||||||
|
// refundVo.setPaynature("1");
|
||||||
|
// refundVo.setPaytype("微信");
|
||||||
|
// refundVo.setPowertranid(outTradeNo);
|
||||||
|
// refundVo.setZfamount(hsjcvo.getZfamount());
|
||||||
|
// refundVo.setYbzhamount("0.00");
|
||||||
|
// refundVo.setYbtcamount("0.00");
|
||||||
|
// refundVo.setHisopernum("WX");
|
||||||
|
|
||||||
InterfaceCount interfaceCount = new InterfaceCount();
|
InterfaceCount interfaceCount = new InterfaceCount();
|
||||||
interfaceCount.setUserId(Integer.toString(hsjcvo.getUserId()));
|
interfaceCount.setUserId(Integer.toString(hsjcvo.getUserId()));
|
||||||
interfaceCount.setInterfaceIdentification("MZTF");
|
interfaceCount.setInterfaceIdentification("MZTF");
|
||||||
interfaceCountService.updateInterfaceConut(interfaceCount);
|
interfaceCountService.updateInterfaceConut(interfaceCount);
|
||||||
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
|
||||||
}else if (outTradeNo.substring(0, 2).equals("BA")){
|
|
||||||
|
|
||||||
|
}else if (outTradeNo.substring(0, 2).equals("BA")){
|
||||||
|
BingAnVO bingAnVO = binganMapper.selectByOrderNo(outTradeNo);
|
||||||
// 手动病案退款
|
// 手动病案退款
|
||||||
binganMapper.updateByOrderNoAndStatus(outTradeNo);
|
binganMapper.updateByOrderNoAndStatus(outTradeNo);
|
||||||
// InterfaceCount interfaceCount = new InterfaceCount();
|
|
||||||
// interfaceCount.setUserId(Integer.toString(hsjcvo.getUserId()));
|
// refundVo.setPatientid(bingAnVO.getPatientId());
|
||||||
// interfaceCount.setInterfaceIdentification("BATF");
|
// refundVo.setBillsmsg(bingAnVO.getReptno());
|
||||||
// interfaceCountService.updateInterfaceConut(interfaceCount);
|
// refundVo.setPaynature("1");
|
||||||
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
// refundVo.setPaytype("微信");
|
||||||
|
// refundVo.setPowertranid(outTradeNo);
|
||||||
|
// refundVo.setZfamount(bingAnVO.getAmount().toPlainString());
|
||||||
|
// refundVo.setYbzhamount("0.00");
|
||||||
|
// refundVo.setYbtcamount("0.00");
|
||||||
|
// refundVo.setHisopernum("WX");
|
||||||
|
|
||||||
|
InterfaceCount interfaceCount = new InterfaceCount();
|
||||||
|
interfaceCount.setUserId(bingAnVO.getPatientId());
|
||||||
|
interfaceCount.setInterfaceIdentification("BATF");
|
||||||
|
interfaceCountService.updateInterfaceConut(interfaceCount);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// // his退费
|
||||||
|
// String strXML = XmlUtil.getBillsPayedRefund(refundVo);
|
||||||
|
// log.debug("His退费MOP_BillsPayedRefund req:" + strXML);
|
||||||
|
// // 发送soap请求
|
||||||
|
// String respXml = SoapUtil.soapMethod(strXML);
|
||||||
|
// log.debug("His退费MOP_BillsPayedRefund res:" + respXml);
|
||||||
|
|
||||||
|
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||||
}
|
}
|
||||||
Reserve8Vo reserveVo = reserveList.get(0);
|
Reserve8Vo reserveVo = reserveList.get(0);
|
||||||
// 4. 冪等处理
|
// 4. 冪等处理
|
||||||
@@ -905,6 +939,167 @@ public class WxPayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String handleWxRefundNotify2(String xmlData) {
|
||||||
|
log.info("进入退款回调");
|
||||||
|
try {
|
||||||
|
// 1. 解析外层 XML
|
||||||
|
log.info("微信退款回调通知 XML: " + xmlData);
|
||||||
|
WxPayUtil wxPayUtil = new WxPayUtil();
|
||||||
|
Map<String, String> notifyMap = wxPayUtil.xmlToMap(xmlData);
|
||||||
|
|
||||||
|
String returnCode = notifyMap.get("return_code");
|
||||||
|
if (!"SUCCESS".equals(returnCode)) {
|
||||||
|
log.warn("微信通知失败: return_code={}", returnCode);
|
||||||
|
return "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[处理失败]]></return_msg></xml>";
|
||||||
|
}
|
||||||
|
|
||||||
|
String reqInfo = notifyMap.get("req_info");
|
||||||
|
if (reqInfo == null || reqInfo.isEmpty()) {
|
||||||
|
log.warn("req_info 为空");
|
||||||
|
return "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[参数缺失]]></return_msg></xml>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 解密 req_info(使用 APIv2 key)
|
||||||
|
String apiKey = wxPayConfig.getApiKey(); // 确保这是 32 位的 API 密钥
|
||||||
|
String decryptData;
|
||||||
|
try {
|
||||||
|
decryptData = decryptReqInfo(reqInfo,apiKey);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("解密 req_info 失败", e);
|
||||||
|
return "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[解密失败]]></return_msg></xml>";
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("解密后的退款数据: " + decryptData);
|
||||||
|
|
||||||
|
// 3. 解析明文 XML
|
||||||
|
Map<String, String> refundResult = wxPayUtil.xmlToMap(decryptData);
|
||||||
|
|
||||||
|
String outTradeNo = refundResult.get("out_trade_no");
|
||||||
|
String outRefundNo = refundResult.get("out_refund_no");
|
||||||
|
String refundStatus = refundResult.get("refund_status"); // SUCCESS / FAIL / PROCESSING
|
||||||
|
|
||||||
|
log.info("退款结果: out_trade_no={}, out_refund_no={}, status={}", outTradeNo, outRefundNo, refundStatus);
|
||||||
|
|
||||||
|
//
|
||||||
|
// if (refundService.isAlreadyProcessed(outRefundNo)) {
|
||||||
|
// log.info("退款单 {} 已处理,跳过", outRefundNo);
|
||||||
|
// return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// 5. 处理业务逻辑
|
||||||
|
if ("SUCCESS".equals(refundStatus)) {
|
||||||
|
Reserve8Vo vo = new Reserve8Vo();
|
||||||
|
vo.setOrderno(outTradeNo);
|
||||||
|
List<Reserve8Vo> reserveList = reserve8Mapper.getReserveList(vo);
|
||||||
|
HisRefundVo refundVo = new HisRefundVo();
|
||||||
|
if (reserveList.isEmpty()){
|
||||||
|
if (outTradeNo.substring(0, 2).equals("YC")){
|
||||||
|
//业务处理逻辑......
|
||||||
|
Example example = new Example(UserOrder.class);
|
||||||
|
Example.Criteria criteria = example.createCriteria();
|
||||||
|
criteria.andEqualTo("code", outTradeNo);
|
||||||
|
|
||||||
|
List<UserOrder> list = userOrderMapper.selectByExample(example);
|
||||||
|
UserOrder uo = list.get(0);
|
||||||
|
|
||||||
|
userOrderMapper.SelectUserOrderByCode(outTradeNo,3);
|
||||||
|
// refundVo.setPatientid(uo.getCard_no());
|
||||||
|
// refundVo.setBillsmsg();
|
||||||
|
|
||||||
|
|
||||||
|
InterfaceCount interfaceCount = new InterfaceCount();
|
||||||
|
interfaceCount.setUserId(Integer.toString(uo.getUser_id()));
|
||||||
|
interfaceCount.setInterfaceIdentification("YCTF");
|
||||||
|
interfaceCountService.updateInterfaceConut(interfaceCount);
|
||||||
|
|
||||||
|
}else if (outTradeNo.substring(0, 2).equals("MZ")){
|
||||||
|
HsjcVo hsjcvo = new HsjcVo();
|
||||||
|
hsjcvo.setOrderno(outTradeNo);
|
||||||
|
List<HsjcVo> list = hsjcMapper.getMzjfListByFlow(hsjcvo);
|
||||||
|
hsjcvo = list.get(0);
|
||||||
|
|
||||||
|
hsjcMapper.updateByOutTradeNo(outTradeNo,5);
|
||||||
|
refundVo.setPatientid(hsjcvo.getPatientid());
|
||||||
|
refundVo.setBillsmsg(hsjcvo.getReferno());
|
||||||
|
refundVo.setPaynature("1");
|
||||||
|
refundVo.setPaytype("微信");
|
||||||
|
refundVo.setPowertranid(outTradeNo);
|
||||||
|
refundVo.setZfamount(hsjcvo.getZfamount());
|
||||||
|
refundVo.setYbzhamount("0.00");
|
||||||
|
refundVo.setYbtcamount("0.00");
|
||||||
|
refundVo.setHisopernum("WX");
|
||||||
|
|
||||||
|
InterfaceCount interfaceCount = new InterfaceCount();
|
||||||
|
interfaceCount.setUserId(Integer.toString(hsjcvo.getUserId()));
|
||||||
|
interfaceCount.setInterfaceIdentification("MZTF");
|
||||||
|
interfaceCountService.updateInterfaceConut(interfaceCount);
|
||||||
|
|
||||||
|
}else if (outTradeNo.substring(0, 2).equals("BA")){
|
||||||
|
BingAnVO bingAnVO = binganMapper.selectByOrderNo(outTradeNo);
|
||||||
|
// 手动病案退款
|
||||||
|
binganMapper.updateByOrderNoAndStatus(outTradeNo);
|
||||||
|
|
||||||
|
refundVo.setPatientid(bingAnVO.getPatientId());
|
||||||
|
refundVo.setBillsmsg(bingAnVO.getReptno());
|
||||||
|
refundVo.setPaynature("1");
|
||||||
|
refundVo.setPaytype("微信");
|
||||||
|
refundVo.setPowertranid(outTradeNo);
|
||||||
|
refundVo.setZfamount(bingAnVO.getAmount().toPlainString());
|
||||||
|
refundVo.setYbzhamount("0.00");
|
||||||
|
refundVo.setYbtcamount("0.00");
|
||||||
|
refundVo.setHisopernum("WX");
|
||||||
|
|
||||||
|
InterfaceCount interfaceCount = new InterfaceCount();
|
||||||
|
interfaceCount.setUserId(bingAnVO.getPatientId());
|
||||||
|
interfaceCount.setInterfaceIdentification("BATF");
|
||||||
|
interfaceCountService.updateInterfaceConut(interfaceCount);
|
||||||
|
|
||||||
|
}
|
||||||
|
// his退费
|
||||||
|
String strXML = XmlUtil.getBillsPayedRefund(refundVo);
|
||||||
|
log.debug("His退费MOP_BillsPayedRefund req:" + strXML);
|
||||||
|
// 发送soap请求
|
||||||
|
String respXml = SoapUtil.soapMethod(strXML);
|
||||||
|
log.debug("His退费MOP_BillsPayedRefund res:" + respXml);
|
||||||
|
|
||||||
|
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||||
|
}
|
||||||
|
Reserve8Vo reserveVo = reserveList.get(0);
|
||||||
|
// 4. 冪等处理
|
||||||
|
if (reserveVo.getAppStatus() != null && reserveVo.getAppStatus().intValue() == 1) {
|
||||||
|
// 处理逻辑
|
||||||
|
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!reserveList.isEmpty()) {
|
||||||
|
// 更新状态:1 已退费
|
||||||
|
reserve8Mapper.opAppPayAppoint(outTradeNo, "Y", 1,"");
|
||||||
|
|
||||||
|
// 统计
|
||||||
|
InterfaceCount interfaceCount = new InterfaceCount();
|
||||||
|
interfaceCount.setUserId(Integer.toString(reserveVo.getUserId()));
|
||||||
|
interfaceCount.setInterfaceIdentification("TH");
|
||||||
|
interfaceCountService.updateInterfaceConut(interfaceCount);
|
||||||
|
|
||||||
|
log.info("退款成功,订单 {} 已更新", outTradeNo);
|
||||||
|
} else {
|
||||||
|
log.warn("未找到订单: {}", outTradeNo);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.warn("退款未成功: {}", refundStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. 返回成功
|
||||||
|
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("处理退款回调异常", e);
|
||||||
|
// ❗❗❗ 重要:返回 FAIL,让微信重试!
|
||||||
|
return "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[处理异常]]></return_msg></xml>";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2219,7 +2219,18 @@ public class XmlUtil {
|
|||||||
str.append(vo.getPages());
|
str.append(vo.getPages());
|
||||||
str.append("</Pages>");
|
str.append("</Pages>");
|
||||||
str.append("<ZFamount>");
|
str.append("<ZFamount>");
|
||||||
str.append(vo.getAmount());
|
// 安全的数值减法运算,处理可能的空值和精度问题
|
||||||
|
BigDecimal amount = vo.getAmount();
|
||||||
|
BigDecimal selectAmount = vo.getSelectAmount();
|
||||||
|
BigDecimal result = BigDecimal.ZERO;
|
||||||
|
if (amount != null && selectAmount != null) {
|
||||||
|
result = amount.subtract(selectAmount);
|
||||||
|
} else if (amount != null) {
|
||||||
|
result = amount;
|
||||||
|
} else if (selectAmount != null) {
|
||||||
|
result = selectAmount.negate();
|
||||||
|
}
|
||||||
|
str.append(result);
|
||||||
str.append("</ZFamount>");
|
str.append("</ZFamount>");
|
||||||
str.append("</request>");
|
str.append("</request>");
|
||||||
str.append("]]>");
|
str.append("]]>");
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class BingAnController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@RequestMapping(value = "/apiGetBAList", method = RequestMethod.POST)
|
@RequestMapping(value = "/apiGetBAList", method = RequestMethod.POST)
|
||||||
@WebLog(description = "apiGetBAList")
|
@WebLog(description = "查询病案信息通过userId")
|
||||||
public Object apiGetBAList(Integer userId,String token) {
|
public Object apiGetBAList(Integer userId,String token) {
|
||||||
try {
|
try {
|
||||||
int retToken = getUserToken(userId,token);
|
int retToken = getUserToken(userId,token);
|
||||||
@@ -80,6 +80,51 @@ public class BingAnController {
|
|||||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@RequestMapping(value = "/apiGetBAList2", method = RequestMethod.POST)
|
||||||
|
@WebLog(description = "查询病案信息通过patientId或者住院号")
|
||||||
|
public Object apiGetBAList2(Integer userId,String token,String patientId,String hosNum) {
|
||||||
|
try {
|
||||||
|
int retToken = getUserToken(userId,token);
|
||||||
|
if (retToken != 0) {
|
||||||
|
List<BingAnVO> list = null;
|
||||||
|
if (patientId != null && !patientId.isEmpty()) {
|
||||||
|
// 处理 patientId 相关逻辑
|
||||||
|
log.info("通过patientId查询病案");
|
||||||
|
list = binganService.apiGetBAListByPatientId(patientId);
|
||||||
|
} else if (hosNum != null && !hosNum.isEmpty()) {
|
||||||
|
// 处理 hosNum 相关逻辑
|
||||||
|
log.info("通过住院号查询病案");
|
||||||
|
list = binganService.apiGetBAListByHosNum(hosNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseResult.success(list);
|
||||||
|
} else {
|
||||||
|
return ResponseResult.sysLoginError();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@RequestMapping(value = "/apiUpdateBA", method = RequestMethod.POST)
|
||||||
|
@WebLog(description = "更新病案份数")
|
||||||
|
public Object apiUpdateBA(Integer userId,String token,BingAnVO vo ) {
|
||||||
|
try {
|
||||||
|
int retToken = getUserToken(userId,token);
|
||||||
|
if (retToken != 0) {
|
||||||
|
log.info("更新病案份数,vo:{}",vo);
|
||||||
|
int i = binganService.apiUpdateBA(vo);
|
||||||
|
if (i == 1){
|
||||||
|
return ResponseResult.success();
|
||||||
|
}else {
|
||||||
|
return ResponseResult.sysError("更新失败");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ResponseResult.sysLoginError();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
@RequestMapping(value = "/apiDeleteApplication", method = RequestMethod.POST)
|
@RequestMapping(value = "/apiDeleteApplication", method = RequestMethod.POST)
|
||||||
@WebLog(description = "apiDeleteApplication")
|
@WebLog(description = "apiDeleteApplication")
|
||||||
public Object apiDeleteApplication(Integer id,Integer userId,String token) {
|
public Object apiDeleteApplication(Integer id,Integer userId,String token) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.guahao.h5.reserve.vo.BingAnVO;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -29,4 +30,10 @@ public interface BinganMapper {
|
|||||||
void updateById(String payOrderNo, Integer id);
|
void updateById(String payOrderNo, Integer id);
|
||||||
|
|
||||||
void updateByOrderNoAndStatus(String orderno);
|
void updateByOrderNoAndStatus(String orderno);
|
||||||
|
|
||||||
|
int updateByCopies(Integer id, Integer copies, BigDecimal amount);
|
||||||
|
|
||||||
|
List<BingAnVO> selectListByPatientId(String patientId);
|
||||||
|
|
||||||
|
List<BingAnVO> selectListByHosNum(String hosNum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,10 @@ public interface BinganService {
|
|||||||
Integer apiDeleteApplication(Integer id);
|
Integer apiDeleteApplication(Integer id);
|
||||||
|
|
||||||
Map<String, String> apiBAPay(BingAnPayVO vo, HttpServletRequest request);
|
Map<String, String> apiBAPay(BingAnPayVO vo, HttpServletRequest request);
|
||||||
|
|
||||||
|
int apiUpdateBA(BingAnVO vo);
|
||||||
|
|
||||||
|
List<BingAnVO> apiGetBAListByPatientId(String patientId);
|
||||||
|
|
||||||
|
List<BingAnVO> apiGetBAListByHosNum(String hosNum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,4 +250,20 @@ public class BinganServiceImpl implements BinganService {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int apiUpdateBA(BingAnVO vo) {
|
||||||
|
|
||||||
|
return binganMapper.updateByCopies(vo.getId(),vo.getCopies(),vo.getAmount());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BingAnVO> apiGetBAListByPatientId(String patientId) {
|
||||||
|
return binganMapper.selectListByPatientId(patientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BingAnVO> apiGetBAListByHosNum(String hosNum) {
|
||||||
|
return binganMapper.selectListByHosNum(hosNum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ public class Reserve8Service {
|
|||||||
} else if (vo.getHisopernum().equals("wx") || vo.getHisopernum().equals("GZH")) {
|
} else if (vo.getHisopernum().equals("wx") || vo.getHisopernum().equals("GZH")) {
|
||||||
log.debug("微信退款");
|
log.debug("微信退款");
|
||||||
vo.setPowertranid(vo3.getOrderno());
|
vo.setPowertranid(vo3.getOrderno());
|
||||||
Map<String, String> stringStringMap = wxPayService.refundOrder(vo.getPowertranid(), vo.getZfamount());
|
Map<String, String> stringStringMap = wxPayService.refundOrder(vo.getPowertranid(), vo.getZfamount(),"微信");
|
||||||
Map<String, Object> objectMap = convertStringMapToObjectMap(stringStringMap);
|
Map<String, Object> objectMap = convertStringMapToObjectMap(stringStringMap);
|
||||||
if ("SUCCESS".equals(objectMap.get("return_code")) &&
|
if ("SUCCESS".equals(objectMap.get("return_code")) &&
|
||||||
"SUCCESS".equals(objectMap.get("result_code"))) {
|
"SUCCESS".equals(objectMap.get("result_code"))) {
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class BingAnVO {
|
|||||||
private MultipartFile powerOfAttorneyFile;// 授权委托书(对应前端的powerOfAttorneyFile)
|
private MultipartFile powerOfAttorneyFile;// 授权委托书(对应前端的powerOfAttorneyFile)
|
||||||
private BigDecimal selectAmount; //查询费
|
private BigDecimal selectAmount; //查询费
|
||||||
private Integer pages; //页数
|
private Integer pages; //页数
|
||||||
|
private Integer copies; // 打印份数
|
||||||
private BigDecimal amount; //需支付金额
|
private BigDecimal amount; //需支付金额
|
||||||
private Integer status; //支付状态
|
private Integer status; //支付状态
|
||||||
private Integer send; //领取状态
|
private Integer send; //领取状态
|
||||||
|
|||||||
@@ -44,6 +44,12 @@
|
|||||||
SET status = 0
|
SET status = 0
|
||||||
WHERE orderno = #{orderno}
|
WHERE orderno = #{orderno}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateByCopies">
|
||||||
|
UPDATE express
|
||||||
|
SET copies = #{copies},
|
||||||
|
amount = #{amount}
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="checkSameNameRecordToday" resultType="java.lang.Boolean">
|
<select id="checkSameNameRecordToday" resultType="java.lang.Boolean">
|
||||||
SELECT COUNT(*) > 0
|
SELECT COUNT(*) > 0
|
||||||
@@ -61,4 +67,10 @@
|
|||||||
<select id="selectListByUserIdAndStatus" resultType="com.guahao.h5.reserve.vo.BingAnVO">
|
<select id="selectListByUserIdAndStatus" resultType="com.guahao.h5.reserve.vo.BingAnVO">
|
||||||
SELECT * FROM express WHERE user_id = #{userId} and status = #{status} and deleted = 0 and orderno IS NOT NULL;
|
SELECT * FROM express WHERE user_id = #{userId} and status = #{status} and deleted = 0 and orderno IS NOT NULL;
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectListByPatientId" resultType="com.guahao.h5.reserve.vo.BingAnVO">
|
||||||
|
SELECT * FROM express WHERE patient_id = #{patientId} and deleted = 0;
|
||||||
|
</select>
|
||||||
|
<select id="selectListByHosNum" resultType="com.guahao.h5.reserve.vo.BingAnVO">
|
||||||
|
SELECT * FROM express WHERE hos_number = #{hosNum} and deleted = 0;
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user