Compare commits
9 Commits
8d2d948ea2
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ea8bc523d | ||
|
|
9282ef6ada | ||
|
|
cbf1ae116e | ||
|
|
9cfc3b853c | ||
|
|
7afc484640 | ||
|
|
2a30428954 | ||
|
|
9073957bf0 | ||
|
|
fb732e8445 | ||
|
|
a2420d61fd |
3
.idea/CoolRequestSetting.xml
generated
3
.idea/CoolRequestSetting.xml
generated
@@ -3,9 +3,8 @@
|
||||
<component name="CoolRequestSetting">
|
||||
<option name="serializePaths">
|
||||
<list>
|
||||
<option value="C:\Users\Sang\.config\.cool-request\request\serialize\1bd30efc62b741008bc315a5b375dfce" />
|
||||
<option value="C:\Users\Sang\.config\.cool-request\request\serialize\7c9ed71f67784c07ae7eca219e9a539a" />
|
||||
<option value="C:\Users\Sang\.config\.cool-request\request\serialize\e73208943ce7420d81abaa46dddeaa89" />
|
||||
<option value="C:\Users\Sang\.config\.cool-request\request\serialize\3876892f78a44bb7a7008fd29db477eb" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="projectCachePath" value="project-a9a67828-45d7-44aa-a811-3ecda9f37cac" />
|
||||
|
||||
4
.idea/MarsCodeWorkspaceAppSettings.xml
generated
4
.idea/MarsCodeWorkspaceAppSettings.xml
generated
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="com.codeverse.userSettings.MarscodeWorkspaceAppSettingsState">
|
||||
<option name="ckgOperationStatus" value="SUCCESS" />
|
||||
<option name="progress" value="0.9927478" />
|
||||
<option name="ckgOperationStatus" value="DELETE" />
|
||||
<option name="lastCKGNotifyTime" value="1770603565559" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -7,10 +7,10 @@
|
||||
<map>
|
||||
<entry key="com.zeroturnaround.jrebel.FormatVersion" value="7.0.0" />
|
||||
<entry key="jrebelEnabled" value="true" />
|
||||
<entry key="lastExternalPluginCheckTime" value="1760511839624" />
|
||||
<entry key="lastExternalPluginCheckTime" value="1770600825542" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="version" value="11" />
|
||||
<option name="version" value="15" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
|
||||
@@ -80,14 +80,22 @@ public class GuahaoTask {
|
||||
} else {
|
||||
cancelSuccess = true;
|
||||
log.info("退号成功");
|
||||
if (vo.getZfamount().equals("0.00")){
|
||||
log.info("0元挂号,跳过退费处理");
|
||||
refundSuccess = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 执行退费
|
||||
Map<String, Object> refundResult = reserve8Service.MOP_BillsPayedRefund(vo);
|
||||
log.info("退费结果: {}", refundResult + ",判断结果:" + (refundResult != null ? refundResult.get("return_code") : "null"));
|
||||
boolean isSuccess = refundResult != null &&
|
||||
("1".equals(refundResult.get("returncode")) ||
|
||||
"SUCCESS".equals(refundResult.get("return_code"))) &&
|
||||
("success".equals(refundResult.get("refundResult")) ||
|
||||
"SUCCESS".equals(refundResult.get("result_code")));
|
||||
|
||||
if (refundResult == null ||
|
||||
!"SUCCESS".equals(refundResult.get("return_code")) ||
|
||||
!"SUCCESS".equals(refundResult.get("result_code"))) {
|
||||
if (!isSuccess) {
|
||||
reserve8Mapper.insertRefundError(vo);
|
||||
log.warn("退费接口返回失败: {}", refundResult);
|
||||
log.warn("退费失败,继续处理下一个记录");
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.guahao.api.walkinto.model.PayQueryDTO;
|
||||
import com.guahao.api.walkinto.service.WxPayService;
|
||||
import com.guahao.common.config.WxPayConfig;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import com.guahao.common.util.AmountUtil;
|
||||
import com.guahao.common.util.SoapUtil;
|
||||
import com.guahao.common.util.XmlUtil;
|
||||
import com.guahao.h5.hsjc.mapper.HsjcMapper;
|
||||
@@ -21,7 +22,9 @@ import com.guahao.h5.hsjc.service.HsjcService;
|
||||
import com.guahao.h5.hsjc.service.TXSendMsg;
|
||||
import com.guahao.h5.hsjc.vo.HsjcVo;
|
||||
import com.guahao.h5.message.service.MessageCenterService;
|
||||
import com.guahao.h5.reserve.mapper.BinganMapper;
|
||||
import com.guahao.h5.reserve.mapper.Reserve8Mapper;
|
||||
import com.guahao.h5.reserve.vo.BingAnVO;
|
||||
import com.guahao.h5.reserve.vo.HisRefundVo;
|
||||
import com.guahao.h5.reserve.vo.Reserve8Vo;
|
||||
import com.guahao.h5.user.mapper.UserCardMapper;
|
||||
@@ -31,6 +34,7 @@ import com.guahao.h5.user.model.UserOrder;
|
||||
import com.guahao.h5.user.model.UserVo;
|
||||
import com.guahao.h5.user.service.UserOrderService;
|
||||
import com.guahao.h5.user.service.UserService;
|
||||
import com.guahao.h5.yb.model.OrderInfoVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -104,6 +108,8 @@ public class ApiPayController {
|
||||
|
||||
@Autowired
|
||||
UserOrderMapper userOrderMapper;
|
||||
@Autowired
|
||||
BinganMapper BinganMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
@@ -153,6 +159,23 @@ public class ApiPayController {
|
||||
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 +207,71 @@ public class ApiPayController {
|
||||
@PostMapping("/wxpay/refundOrder")
|
||||
@WebLog(description = "refundOrder")
|
||||
public Object refundOrder(@RequestParam("powertranid") String powertranid,
|
||||
@RequestParam("money") String money
|
||||
@RequestParam("money") String money,
|
||||
@RequestParam("type") String type
|
||||
) {
|
||||
String paramTip = "";
|
||||
try {
|
||||
paramTip = String.format(" >>> requestObj:%s", JSONUtil.toJsonStr(powertranid));
|
||||
log.info("退款开始校验订单金额");
|
||||
//安全校验订单和金额是否对应
|
||||
String StartName = powertranid.substring(0,2).toUpperCase();
|
||||
switch (StartName){
|
||||
case "TL":
|
||||
List<Reserve8Vo> vos = reserve8Mapper.getReserveListByhisorderno(powertranid);
|
||||
if(vos.size()>0){
|
||||
if(!vos.get(0).getZfamount().equals(AmountUtil.parseAmount( money))){
|
||||
return ResponseResult.sysError("订单金额与退费金额不一致");
|
||||
}
|
||||
}else {
|
||||
return ResponseResult.sysError("挂号订单不存在");
|
||||
}
|
||||
break;
|
||||
case "YB":
|
||||
OrderInfoVO orderInfoVO = hsjcMapper.selectByhospOrder(powertranid);
|
||||
if (orderInfoVO!=null){
|
||||
if(!orderInfoVO.getOwnPayAmt().equals(AmountUtil.parseAmount( money))){
|
||||
return ResponseResult.sysError("订单金额与退费金额不一致");
|
||||
}
|
||||
}else {
|
||||
return ResponseResult.sysError("医保订单不存在");
|
||||
}
|
||||
break;
|
||||
case "YC":
|
||||
UserOrder userOrder = userOrderMapper.selectInfoByCode(powertranid);
|
||||
if (userOrder != null) {
|
||||
if(!money.equals(AmountUtil.doubleToStr(userOrder.getMoney()))){
|
||||
return ResponseResult.sysError("订单金额与退费金额不一致");
|
||||
}
|
||||
}else {
|
||||
return ResponseResult.sysError("住院预交订单不存在");
|
||||
}
|
||||
break;
|
||||
case "BA":
|
||||
BingAnVO bingAnVO = BinganMapper.selectByOrderNo(powertranid);
|
||||
if (bingAnVO != null) {
|
||||
if(!bingAnVO.getAmount().equals(AmountUtil.parseAmount(money))){
|
||||
return ResponseResult.sysError("订单金额与退费金额不一致");
|
||||
}
|
||||
}else {
|
||||
return ResponseResult.sysError("病案订单不存在");
|
||||
}
|
||||
break;
|
||||
case "MZ":
|
||||
HsjcVo vo = hsjcMapper.getMzjfListByFlow2(powertranid);
|
||||
if (vo != null) {
|
||||
if(!vo.getZfamount().equals(money)){
|
||||
return ResponseResult.sysError("订单金额与退费金额不一致");
|
||||
}
|
||||
}else {
|
||||
return ResponseResult.sysError("门诊缴费订单不存在");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ResponseResult.sysError("订单类型不存在");
|
||||
}
|
||||
|
||||
Map map = wxPayService.refundOrder(powertranid,money);
|
||||
Map map = wxPayService.refundOrder(powertranid,money,type);
|
||||
return ResponseResult.success(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -187,7 +187,7 @@ public class WxPayService {
|
||||
txSendMsg.SendNotifyYJJ(uo,openid);
|
||||
}else {
|
||||
//写入his失败,执行退款处理
|
||||
refundOrder(uo.getCode(),AmountUtil.doubleToStr(uo.getMoney()));
|
||||
refundOrder(uo.getCode(),AmountUtil.doubleToStr(uo.getMoney()),"微信");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -424,7 +424,7 @@ public class WxPayService {
|
||||
} else {
|
||||
log.error("挂号确认失败,将自动退款: " + mapConfirm.get("errormsg"));
|
||||
// 可以考虑发起退款
|
||||
refundOrder(outTradeNo, String.valueOf(reserveVo.getZfamount()));
|
||||
refundOrder(outTradeNo, String.valueOf(reserveVo.getZfamount()),"微信");
|
||||
}
|
||||
} else {
|
||||
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<>();
|
||||
data.put("appid", wxPayConfig.getAppId());
|
||||
data.put("mch_id", wxPayConfig.getMchId());
|
||||
@@ -553,7 +553,11 @@ public class WxPayService {
|
||||
String money = WxPayDUtil.yuanToFee(amount);
|
||||
data.put("total_fee", money);
|
||||
data.put("refund_fee", money);
|
||||
if (type.equals("微信")){
|
||||
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()); // 操作员 = 商户号
|
||||
|
||||
CloseableHttpClient client = null;
|
||||
@@ -721,6 +725,7 @@ public class WxPayService {
|
||||
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")){
|
||||
//业务处理逻辑......
|
||||
@@ -733,34 +738,69 @@ public class WxPayService {
|
||||
|
||||
userOrderMapper.SelectUserOrderByCode(outTradeNo,3);
|
||||
|
||||
|
||||
InterfaceCount interfaceCount = new InterfaceCount();
|
||||
interfaceCount.setUserId(Integer.toString(uo.getUser_id()));
|
||||
interfaceCount.setInterfaceIdentification("YCTF");
|
||||
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")){
|
||||
HsjcVo hsjcvo = new HsjcVo();
|
||||
hsjcvo.setOrderno(outTradeNo);
|
||||
List<HsjcVo> list = hsjcMapper.getMzjfListByFlow(hsjcvo);
|
||||
hsjcvo = list.get(0);
|
||||
|
||||
}else if (outTradeNo.substring(0, 2).equals("MZ")){
|
||||
// getMzjfListByFlow
|
||||
HsjcVo hsjcvo = hsjcMapper.getMzjfListByFlow2(outTradeNo);
|
||||
// hsjcvo = list.get(0);
|
||||
if (hsjcvo != null && hsjcvo.getAppStatus() == 5){
|
||||
log.info("门诊已经退过费用");
|
||||
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||
}
|
||||
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);
|
||||
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||
}else if (outTradeNo.substring(0, 2).equals("BA")){
|
||||
|
||||
// 手动病案退款
|
||||
binganMapper.updateByOrderNoAndStatus(outTradeNo);
|
||||
// InterfaceCount interfaceCount = new InterfaceCount();
|
||||
// interfaceCount.setUserId(Integer.toString(hsjcvo.getUserId()));
|
||||
// interfaceCount.setInterfaceIdentification("BATF");
|
||||
// interfaceCountService.updateInterfaceConut(interfaceCount);
|
||||
}else if (outTradeNo.substring(0, 2).equals("BA")){
|
||||
BingAnVO bingAnVO = binganMapper.selectByOrderNo(outTradeNo);
|
||||
if (bingAnVO != null && bingAnVO.getStatus() == 0){
|
||||
log.info("病案已经退过费用");
|
||||
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||
}
|
||||
// 手动病案退款
|
||||
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. 冪等处理
|
||||
@@ -905,6 +945,175 @@ 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")){
|
||||
// getMzjfListByFlow
|
||||
HsjcVo hsjcvo = hsjcMapper.getMzjfListByFlow2(outTradeNo);
|
||||
// hsjcvo = list.get(0);
|
||||
if (hsjcvo != null && hsjcvo.getAppStatus() == 5){
|
||||
log.info("门诊已经退过费用");
|
||||
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||
}
|
||||
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);
|
||||
if (bingAnVO != null && bingAnVO.getStatus() == 0){
|
||||
log.info("病案已经退过费用");
|
||||
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||
}
|
||||
|
||||
// 手动病案退款
|
||||
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);
|
||||
|
||||
}
|
||||
if (refundVo.getPaytype() != null && !refundVo.getPaytype().isEmpty() ){
|
||||
// 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>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -255,12 +255,11 @@ public class XmlUtil {
|
||||
str.append("<YBTCAmount>");
|
||||
str.append(vo.getYbtcamount());
|
||||
str.append("</YBTCAmount>");
|
||||
if (vo.getYboutmsg() != null || vo.getYboutmsg() != ""){
|
||||
yboutmsg = vo.getYboutmsg();
|
||||
}
|
||||
if (vo.getYboutmsg() != null && !vo.getYboutmsg().isEmpty()) {
|
||||
str.append("<YBOutMsg>");
|
||||
str.append(yboutmsg);
|
||||
str.append(vo.getYboutmsg());
|
||||
str.append("</YBOutMsg>");
|
||||
}
|
||||
str.append("<HisOperNum>");
|
||||
str.append(vo.getHisopernum());
|
||||
str.append("</HisOperNum>");
|
||||
@@ -2216,10 +2215,21 @@ public class XmlUtil {
|
||||
str.append(vo.getOrderno());
|
||||
str.append("</PowerTranID>");
|
||||
str.append("<Pages>");
|
||||
str.append(vo.getPages());
|
||||
str.append(vo.getPages()*vo.getCopies());
|
||||
str.append("</Pages>");
|
||||
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("</request>");
|
||||
str.append("]]>");
|
||||
|
||||
@@ -6,8 +6,10 @@ import com.guahao.WebLog;
|
||||
import com.guahao.api.counts.model.InterfaceCount;
|
||||
import com.guahao.api.counts.service.InterfaceCountService;
|
||||
// import com.guahao.api.walkinto.service.PayService;
|
||||
import com.guahao.common.annotation.CheckPatientId;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import com.guahao.common.util.SafeUtil;
|
||||
import com.guahao.common.util.XmlUtil;
|
||||
import com.guahao.h5.hsjc.mapper.HsjcMapper;
|
||||
import com.guahao.h5.hsjc.service.HsjcService;
|
||||
@@ -63,6 +65,7 @@ public class HsjcController {
|
||||
|
||||
@RequestMapping("/opPacscx")
|
||||
@WebLog(description = "opPacscx")
|
||||
@CheckPatientId(userIdParam="userId",patientIdParam = "QueryCode")
|
||||
public Object opPacscx(Integer userId, String token,
|
||||
String QueryCode, Integer QueryType, String StartTime, String EndTime) {
|
||||
|
||||
@@ -147,6 +150,7 @@ public class HsjcController {
|
||||
|
||||
@RequestMapping("/opDjqr")
|
||||
@WebLog(description = "opDjqr")
|
||||
@CheckPatientId(userIdParam="userId",patientIdParam = "patientid")
|
||||
public Object opDjqr(Integer userId, String token, String patientid, String jsonData) {
|
||||
try {
|
||||
int retToken = getUserToken(userId, token);
|
||||
@@ -170,6 +174,7 @@ public class HsjcController {
|
||||
|
||||
@RequestMapping("/opDjcx")
|
||||
@WebLog(description = "opDjcx")
|
||||
@CheckPatientId(userIdParam="userId",patientIdParam = "PatientId")
|
||||
public Object opDjcx(Integer userId, String token, String PatientId, Integer QueryType, String OrderNo) {
|
||||
try {
|
||||
int retToken = getUserToken(userId, token);
|
||||
@@ -197,6 +202,7 @@ public class HsjcController {
|
||||
|
||||
@RequestMapping("/GetPdfReportsAddress")
|
||||
@WebLog(description = "GetPdfReportsAddress")
|
||||
@CheckPatientId(userIdParam="userId",patientIdParam = "PatientsID")
|
||||
public Object GetPdfReportsAddress(Integer userId,
|
||||
String token,
|
||||
String PatientsID,
|
||||
@@ -220,6 +226,7 @@ public class HsjcController {
|
||||
}
|
||||
@RequestMapping("/opLMQuery")
|
||||
@WebLog(description = "opLMQuery")
|
||||
@CheckPatientId(userIdParam="userId",patientIdParam = "QueryCode")
|
||||
public Object opLMQuery(Integer userId, String token,
|
||||
String QueryCode, Integer QueryType, String StartTime, String EndTime) {
|
||||
try {
|
||||
@@ -237,6 +244,7 @@ public class HsjcController {
|
||||
|
||||
@RequestMapping("/opLBQuery")
|
||||
@WebLog(description = "opLBQuery")
|
||||
@CheckPatientId(userIdParam="userId",patientIdParam = "PatientId")
|
||||
public Object opLBQuery(Integer userId, String token,
|
||||
String FlowNo, String PatientId, Integer InsuranceType) {
|
||||
try {
|
||||
|
||||
@@ -68,4 +68,6 @@ public interface HsjcMapper {
|
||||
List<HsjcVo> selectOrderList(String patientId);
|
||||
|
||||
List<OrderInfoVO> selectListByStatus(String status);
|
||||
|
||||
HsjcVo getMzjfListByFlow2(String outTradeNo);
|
||||
}
|
||||
@@ -215,6 +215,9 @@ public class HsjcService {
|
||||
item.put("price", getElementText(dataRow, "price"));
|
||||
item.put("category", getElementText(dataRow, "category"));
|
||||
item.put("description", getElementText(dataRow, "description"));
|
||||
item.put("class", getElementText(dataRow, "class"));
|
||||
item.put("program_list", getElementText(dataRow, "program_list"));
|
||||
item.put("effect", getElementText(dataRow, "effect"));
|
||||
|
||||
dataList.add(item);
|
||||
}
|
||||
@@ -1313,9 +1316,11 @@ public class HsjcService {
|
||||
// str.append("0.00");
|
||||
// str.append("</YBTCAmount>");
|
||||
|
||||
if (vo.getYboutmsg() != null && !vo.getYboutmsg().isEmpty()) {
|
||||
str.append("<YBOutMsg>");
|
||||
str.append(vo.getYboutmsg());
|
||||
str.append("</YBOutMsg>");
|
||||
}
|
||||
str.append("<HisOperNum>");
|
||||
str.append(vo.getHisopernum());
|
||||
str.append("</HisOperNum>");
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.guahao.h5.reserve.controller;
|
||||
|
||||
import com.guahao.WebLog;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import com.guahao.common.util.SafeUtil;
|
||||
import com.guahao.h5.reserve.service.BinganService;
|
||||
import com.guahao.h5.reserve.vo.BingAnPayVO;
|
||||
import com.guahao.h5.reserve.vo.BingAnVO;
|
||||
@@ -35,6 +36,8 @@ public class BingAnController {
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private BinganService binganService;
|
||||
@Autowired
|
||||
private SafeUtil safeUtil;
|
||||
|
||||
@RequestMapping(
|
||||
value = "/apiBayj",
|
||||
@@ -65,7 +68,7 @@ public class BingAnController {
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/apiGetBAList", method = RequestMethod.POST)
|
||||
@WebLog(description = "apiGetBAList")
|
||||
@WebLog(description = "查询病案信息通过userId")
|
||||
public Object apiGetBAList(Integer userId,String token) {
|
||||
try {
|
||||
int retToken = getUserToken(userId,token);
|
||||
@@ -80,6 +83,61 @@ public class BingAnController {
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/apiGetBAList2", method = RequestMethod.POST)
|
||||
@WebLog(description = "查询病案信息通过patientId或者住院号")
|
||||
public Object apiGetBAList2(Integer userId,String token,String method,String patientId,String hosNum) {
|
||||
try {
|
||||
int retToken = 0;
|
||||
if (method != null && method.equals("sfs")){
|
||||
retToken = 1;
|
||||
}else {
|
||||
retToken = getUserToken(userId,token);
|
||||
}
|
||||
if (retToken != 0) {
|
||||
List<BingAnVO> list = null;
|
||||
if (patientId != null && !patientId.isEmpty()) {
|
||||
Boolean hasUser = safeUtil.hasUser(userId, patientId);
|
||||
if (!hasUser) {
|
||||
return ResponseResult.sysError("用户未绑定该患者病案信息,无法查询");
|
||||
}
|
||||
// 处理 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)
|
||||
@WebLog(description = "apiDeleteApplication")
|
||||
public Object apiDeleteApplication(Integer id,Integer userId,String token) {
|
||||
@@ -87,7 +145,7 @@ public class BingAnController {
|
||||
int retToken = getUserToken(userId,token);
|
||||
if (retToken != 0) {
|
||||
// log.info("病案邮寄");
|
||||
Integer i = binganService.apiDeleteApplication(id);
|
||||
Integer i = binganService.apiDeleteApplication(id,userId);
|
||||
if (i == 1){
|
||||
return ResponseResult.success();
|
||||
}else {
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.guahao.WebLog;
|
||||
import com.guahao.api.walkinto.service.PayService;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.annotation.CheckPatientId;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import com.guahao.common.util.SoapUtil;
|
||||
@@ -64,6 +65,7 @@ public class ReserveController {
|
||||
*/
|
||||
@RequestMapping(value = "/opRegisterCancelList", method = RequestMethod.POST)
|
||||
@WebLog(description = "opRegisterCancelList")
|
||||
@CheckPatientId(userIdParam="userId",patientIdParam = "PatientId")
|
||||
public Object opRegisterCancelList(Integer userId,String token,
|
||||
String PatientId, Integer SearchType, String StartTime, String EndTime) {
|
||||
try {
|
||||
@@ -112,6 +114,7 @@ public class ReserveController {
|
||||
*/
|
||||
@RequestMapping(value = "/opRegisterListQuery", method = RequestMethod.POST)
|
||||
@WebLog(description = "opRegisterListQuery")
|
||||
@CheckPatientId(userIdParam="userId",patientIdParam = "PatientId")
|
||||
public Object opRegisterListQuery(Integer userId,String token,
|
||||
String PatientId, Integer SearchType, String StartTime, String EndTime) {
|
||||
try {
|
||||
@@ -144,6 +147,7 @@ public class ReserveController {
|
||||
*/
|
||||
@RequestMapping(value = "/opBillsPayedRefundQuery", method = RequestMethod.POST)
|
||||
@WebLog(description = "opBillsPayedRefundQuery")
|
||||
@CheckPatientId(userIdParam="userId",patientIdParam = "PatientId")
|
||||
public Object opBillsPayedRefundQuery(Integer userId,String token,
|
||||
String PatientId, String FlowNo) {
|
||||
try {
|
||||
@@ -174,8 +178,8 @@ public class ReserveController {
|
||||
*/
|
||||
@RequestMapping(value = "/opBillsPayedRefund", method = RequestMethod.POST)
|
||||
@WebLog(description = "opBillsPayedRefund")
|
||||
// 移除了 @Transactional(rollbackFor = Exception.class) 注解,取消事务控制
|
||||
public Object opBillsPayedRefund(HisRefundVo vo) {
|
||||
//可改造成callable多线程,返回结果判断,加快速度
|
||||
try {
|
||||
log.info("退费vo: {}", vo);
|
||||
// 1. 执行退号
|
||||
@@ -195,9 +199,13 @@ public class ReserveController {
|
||||
// 2. 执行退费
|
||||
refundResult = reserve8Service.MOP_BillsPayedRefund(vo);
|
||||
log.info("退费结果: {}", refundResult + ",判断结果:" + refundResult.get("return_code"));
|
||||
if (refundResult == null ||
|
||||
!"SUCCESS".equals(refundResult.get("return_code")) ||
|
||||
!"SUCCESS".equals(refundResult.get("result_code"))) {
|
||||
boolean isSuccess = refundResult != null &&
|
||||
("1".equals(refundResult.get("returncode")) ||
|
||||
"SUCCESS".equals(refundResult.get("return_code"))) &&
|
||||
("success".equals(refundResult.get("refundResult")) ||
|
||||
"SUCCESS".equals(refundResult.get("result_code")));
|
||||
|
||||
if (!isSuccess) {
|
||||
log.warn("退费接口返回失败: {}", refundResult);
|
||||
// 将失败内容存到数据库,进行每1小时一次退款任务
|
||||
reserve8Service.insertRefundError(vo);
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.guahao.h5.reserve.vo.BingAnVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@@ -16,7 +17,7 @@ public interface BinganMapper {
|
||||
List<BingAnVO> selectListByUserId(Integer userId);
|
||||
|
||||
|
||||
Integer deleteApplication(Integer id);
|
||||
Integer deleteApplication(Integer id, Integer userId);
|
||||
|
||||
BingAnVO selectByOrderNo(@Param("outTradeNo") String outTradeNo);
|
||||
|
||||
@@ -29,4 +30,10 @@ public interface BinganMapper {
|
||||
void updateById(String payOrderNo, Integer id);
|
||||
|
||||
void updateByOrderNoAndStatus(String orderno);
|
||||
|
||||
int updateByCopies(Integer id, Integer copies, BigDecimal amount);
|
||||
|
||||
List<BingAnVO> selectListByPatientId(String patientId);
|
||||
|
||||
List<BingAnVO> selectListByHosNum(String hosNum);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.guahao.h5.yb.model.OrderInfoVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -15,7 +15,13 @@ public interface BinganService {
|
||||
|
||||
List<BingAnVO> apiGetBAList(Integer userId);
|
||||
|
||||
Integer apiDeleteApplication(Integer id);
|
||||
Integer apiDeleteApplication(Integer id, Integer userId);
|
||||
|
||||
Map<String, String> apiBAPay(BingAnPayVO vo, HttpServletRequest request);
|
||||
|
||||
int apiUpdateBA(BingAnVO vo);
|
||||
|
||||
List<BingAnVO> apiGetBAListByPatientId(String patientId);
|
||||
|
||||
List<BingAnVO> apiGetBAListByHosNum(String hosNum);
|
||||
}
|
||||
|
||||
@@ -178,8 +178,8 @@ public class BinganServiceImpl implements BinganService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer apiDeleteApplication(Integer id) {
|
||||
return binganMapper.deleteApplication(id);
|
||||
public Integer apiDeleteApplication(Integer id, Integer userId) {
|
||||
return binganMapper.deleteApplication(id,userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -250,4 +250,20 @@ public class BinganServiceImpl implements BinganService {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,6 +295,8 @@ public class Reserve8Service {
|
||||
mapRes.put("result", payorderno);
|
||||
mapRes.put("id", vo.getUserId());
|
||||
mapRes.put("recode", "0");
|
||||
mapRes.put("refundResult", "success");
|
||||
mapRes.put("returncode", "1");
|
||||
}else {
|
||||
log.debug("MOP_BillsPayedRefund:" + " failed");
|
||||
mapRes.put("result", "his failed");
|
||||
@@ -379,7 +381,7 @@ public class Reserve8Service {
|
||||
} else if (vo.getHisopernum().equals("wx") || vo.getHisopernum().equals("GZH")) {
|
||||
log.debug("微信退款");
|
||||
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);
|
||||
if ("SUCCESS".equals(objectMap.get("return_code")) &&
|
||||
"SUCCESS".equals(objectMap.get("result_code"))) {
|
||||
|
||||
@@ -47,6 +47,7 @@ public class BingAnVO {
|
||||
private MultipartFile powerOfAttorneyFile;// 授权委托书(对应前端的powerOfAttorneyFile)
|
||||
private BigDecimal selectAmount; //查询费
|
||||
private Integer pages; //页数
|
||||
private Integer copies; // 打印份数
|
||||
private BigDecimal amount; //需支付金额
|
||||
private Integer status; //支付状态
|
||||
private Integer send; //领取状态
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.guahao.h5.hsjc.mapper.HsjcMapper;
|
||||
import com.guahao.h5.hsjc.vo.HsjcVo;
|
||||
import com.guahao.h5.reserve.mapper.Reserve8Mapper;
|
||||
import com.guahao.h5.reserve.vo.Reserve8Vo;
|
||||
import com.guahao.h5.sfs.service.SfsService;
|
||||
import com.guahao.h5.token.service.TokenService;
|
||||
import com.guahao.h5.token.vo.TokenVo;
|
||||
import com.guahao.h5.yb.model.OrderInfoVO;
|
||||
@@ -17,7 +18,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author SangChengZhi
|
||||
@@ -33,13 +36,20 @@ public class SfsController {
|
||||
private Reserve8Mapper reserve8Mapper;
|
||||
@Autowired
|
||||
private HsjcMapper hsjcMapper;
|
||||
@Autowired
|
||||
private SfsService sfsService;
|
||||
|
||||
@RequestMapping(value = "/selectGuaHaoList", method = RequestMethod.POST)
|
||||
@WebLog(description = "收费室查询用户的挂号记录")
|
||||
public Object opRegisterCancelList(Integer userId,String token,
|
||||
public Object opRegisterCancelList(Integer userId,String token,String method,
|
||||
@RequestParam("patientId") String PatientId) {
|
||||
try {
|
||||
int retToken = getUserToken(userId, token);
|
||||
int retToken = 0;
|
||||
if (method != null && method.equals("sfs")){
|
||||
retToken = 1;
|
||||
}else {
|
||||
retToken = getUserToken(userId,token);
|
||||
}
|
||||
if (retToken != 0) {
|
||||
List<Reserve8Vo> list = reserve8Mapper.selectGuaHaoList(PatientId);
|
||||
return ResponseResult.success(list);
|
||||
@@ -71,10 +81,15 @@ public class SfsController {
|
||||
|
||||
@RequestMapping(value = "/selectYbByPatientId", method = RequestMethod.POST)
|
||||
@WebLog(description = "查询医保已缴费信息")
|
||||
public Object selectYbByPatientId(Integer userId, String token,
|
||||
public Object selectYbByPatientId(Integer userId, String token,String method,
|
||||
@RequestParam("patientId") String patientId) {
|
||||
try {
|
||||
int retToken = getUserToken(userId, token);
|
||||
int retToken = 0;
|
||||
if (method != null && method.equals("sfs")){
|
||||
retToken = 1;
|
||||
}else {
|
||||
retToken = getUserToken(userId,token);
|
||||
}
|
||||
if (retToken != 0) {
|
||||
List<OrderInfoVO> list = reserve8Mapper.selectYbByPatientId(patientId);
|
||||
return ResponseResult.success(list);
|
||||
@@ -87,10 +102,15 @@ public class SfsController {
|
||||
}
|
||||
@RequestMapping(value = "/selectOrderList", method = RequestMethod.POST)
|
||||
@WebLog(description = "查询门诊自费已缴费信息")
|
||||
public Object selectOrderList(Integer userId, String token,
|
||||
public Object selectOrderList(Integer userId, String token,String method,
|
||||
@RequestParam("patientId") String patientId) {
|
||||
try {
|
||||
int retToken = getUserToken(userId, token);
|
||||
int retToken = 0;
|
||||
if (method != null && method.equals("sfs")){
|
||||
retToken = 1;
|
||||
}else {
|
||||
retToken = getUserToken(userId,token);
|
||||
}
|
||||
if (retToken != 0) {
|
||||
List<HsjcVo> list = hsjcMapper.selectOrderList(patientId);
|
||||
return ResponseResult.success(list);
|
||||
@@ -101,6 +121,26 @@ public class SfsController {
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/SumWxBalance", method = RequestMethod.POST)
|
||||
@WebLog(description = "查询微信当前账户余额")
|
||||
public Object SumWxBalance() {
|
||||
try {
|
||||
Map<String, BigDecimal> balances = sfsService.SumWxBalance();
|
||||
return ResponseResult.success(balances);
|
||||
} catch (Exception e) {
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/DelWxBalance", method = RequestMethod.POST)
|
||||
@WebLog(description = "查询微信当前账户退费")
|
||||
public Object DelWxBalance() {
|
||||
try {
|
||||
Map<String, BigDecimal> balances = sfsService.DelWxBalance();
|
||||
return ResponseResult.success(balances);
|
||||
} catch (Exception e) {
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* token验证
|
||||
|
||||
@@ -5,9 +5,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.guahao.WebLog;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import com.guahao.common.util.HttpClientUtil;
|
||||
import com.guahao.common.util.SoapUtil;
|
||||
import com.guahao.common.util.VeDate;
|
||||
import com.guahao.common.util.*;
|
||||
import com.guahao.h5.message.vo.MessageCenterVo;
|
||||
import com.guahao.h5.token.service.TokenService;
|
||||
import com.guahao.h5.token.vo.TokenVo;
|
||||
@@ -19,7 +17,6 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.guahao.common.util.XmlUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -49,6 +46,8 @@ public class UserController {
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private SafeUtil safeUtil;
|
||||
|
||||
@RequestMapping(value = "/test1")
|
||||
public void createActivityQrCode(String content, HttpServletResponse response) {
|
||||
@@ -352,6 +351,17 @@ public Object getAccessToken() {
|
||||
|
||||
// Integer iQueryType = 1;
|
||||
Integer iQueryBusiness = 0;
|
||||
Boolean hasCard = true;
|
||||
if (queryType == 7){
|
||||
//queryCode身份证
|
||||
hasCard = safeUtil.hasUserByIdCard(userId, queryCode);
|
||||
}else {
|
||||
//queryCode是patientId
|
||||
hasCard = safeUtil.hasUser(userId, queryCode);
|
||||
}
|
||||
if (!hasCard) {
|
||||
return ResponseResult.sysError("您当前未绑定该就诊卡,无法查询");
|
||||
}
|
||||
try {
|
||||
String strXML = XmlUtil.getCardReqXml(queryCode, queryType, iQueryBusiness);// 封装请求数据
|
||||
String responseStr = SoapUtil.soapMethod(strXML);// 发送请求
|
||||
|
||||
@@ -4,8 +4,10 @@ package com.guahao.h5.user.controller;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.guahao.WebLog;
|
||||
import com.guahao.api.Inventory.service.InventoryService;
|
||||
import com.guahao.common.annotation.CheckPatientId;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import com.guahao.common.util.HttpClientUtil;
|
||||
import com.guahao.common.util.SafeUtil;
|
||||
import com.guahao.h5.token.service.TokenService;
|
||||
import com.guahao.h5.token.vo.TokenVo;
|
||||
import com.guahao.h5.user.service.UserOrderService;
|
||||
@@ -38,6 +40,8 @@ public class UserOrderController {
|
||||
|
||||
@Autowired
|
||||
private InventoryService inventoryService;
|
||||
@Autowired
|
||||
private SafeUtil safeUtil;
|
||||
|
||||
@RequestMapping("/pay")
|
||||
@WebLog(description = "pay")
|
||||
@@ -52,6 +56,10 @@ public class UserOrderController {
|
||||
if (retToken == 0) {
|
||||
return ResponseResult.sysLoginError();
|
||||
}
|
||||
Boolean hasCard = safeUtil.hasUserByIdCard(uid, cardno);
|
||||
if (!hasCard) {
|
||||
return ResponseResult.sysError("您当前未绑定该就诊卡,无法操作");
|
||||
}
|
||||
Map<String, String> str = service.pay(uid, cardno, money, num,request);
|
||||
return ResponseResult.success(token, str);
|
||||
} catch (Exception e) {
|
||||
@@ -85,6 +93,17 @@ public class UserOrderController {
|
||||
if (retToken == 0) {
|
||||
return ResponseResult.sysLoginError();
|
||||
}
|
||||
Boolean hasCard = true;
|
||||
if (QueryType == 7){
|
||||
//queryCode身份证
|
||||
hasCard = safeUtil.hasUserByIdCard(uid, QueryCode);
|
||||
}else {
|
||||
//queryCode是patientId
|
||||
hasCard = safeUtil.hasUser(uid, QueryCode);
|
||||
}
|
||||
if (!hasCard) {
|
||||
return ResponseResult.sysError("您当前未绑定该就诊卡,无法查询");
|
||||
}
|
||||
String str = service.InHosChargeRecordQuery(QueryCode, QueryType, StartTime, EndTime);
|
||||
return ResponseResult.success(str);
|
||||
} catch (Exception e) {
|
||||
@@ -102,6 +121,7 @@ public class UserOrderController {
|
||||
*/
|
||||
@RequestMapping("/yjjXeQuery")
|
||||
@WebLog(description = "预交金限额查询")
|
||||
@CheckPatientId(userIdParam="uid",patientIdParam = "patientId")
|
||||
public Object yjjXeQuery(
|
||||
@RequestParam(value = "userId", required = false) Integer uid,
|
||||
@RequestParam(value = "token", required = false) String token,
|
||||
@@ -139,6 +159,17 @@ public class UserOrderController {
|
||||
if (retToken == 0) {
|
||||
return ResponseResult.sysLoginError();
|
||||
}
|
||||
Boolean hasCard = true;
|
||||
if (QueryType == 7){
|
||||
//queryCode身份证
|
||||
hasCard = safeUtil.hasUserByIdCard(uid, QueryCode);
|
||||
}else {
|
||||
//queryCode是patientId
|
||||
hasCard = safeUtil.hasUser(uid, QueryCode);
|
||||
}
|
||||
if (!hasCard) {
|
||||
return ResponseResult.sysError("您当前未绑定该就诊卡,无法查询");
|
||||
}
|
||||
String str = service.InHosPatientInfoQuery(QueryCode, QueryType);
|
||||
return ResponseResult.success(str);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -53,5 +53,5 @@ public interface UserCardMapper extends BaseMapper<UserCard> {
|
||||
|
||||
List<UserCardVo> selectByPatientId(@Param("patientId") String patientId);
|
||||
|
||||
List<String> selectByUserId(Integer uid);
|
||||
List<UserCardVo> selectByUserId(Integer userId);
|
||||
}
|
||||
|
||||
@@ -16,4 +16,6 @@ public interface UserOrderMapper extends BaseMapper<UserOrder> {
|
||||
void SelectUserOrderByCode(String outTradeNo, int type);
|
||||
|
||||
Integer yjjXeQuery(String patientId, String hisDate);
|
||||
|
||||
UserOrder selectInfoByCode(String powertranid);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.guahao.h5.user.service;
|
||||
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.util.SafeUtil;
|
||||
import com.guahao.common.util.SoapUtil;
|
||||
import com.guahao.common.util.XmlUtil;
|
||||
import com.guahao.h5.message.service.MessageCenterService;
|
||||
import com.guahao.h5.message.vo.MessageCenterVo;
|
||||
import com.guahao.h5.user.mapper.UserCardMapper;
|
||||
import com.guahao.h5.user.model.UserCard;
|
||||
import com.guahao.h5.user.model.UserCardVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -26,6 +28,8 @@ public class UserCardService {
|
||||
|
||||
@Autowired
|
||||
private MessageCenterService messageCenterService;
|
||||
@Autowired
|
||||
private SafeUtil safeUtil;
|
||||
|
||||
/**
|
||||
* 查询本地所有就诊卡
|
||||
@@ -67,6 +71,8 @@ public class UserCardService {
|
||||
*/
|
||||
public int queryUserCard(UserCardVo vo) throws Exception {
|
||||
int resultInt = 0;
|
||||
// 清除该用户的缓存,确保下次查询能拿到最新数据
|
||||
safeUtil.clearUserCardCache(vo.getUserId());
|
||||
log.info("开始执行查询queryUserCard");
|
||||
//isModify 0 -- 查询 1 -- 修改
|
||||
if (vo.getIsModify().equals("0")) {
|
||||
@@ -246,6 +252,8 @@ public class UserCardService {
|
||||
*/
|
||||
public int insertUserCard(UserCardVo vo) throws Exception {
|
||||
int resultInt = 0;
|
||||
// 清除该用户的缓存,确保下次查询能拿到最新数据
|
||||
safeUtil.clearUserCardCache(vo.getUserId());
|
||||
if (vo.getId() == null) {
|
||||
resultInt = userCardMapper.selectCardCount(vo);
|
||||
if (resultInt != 0) {
|
||||
@@ -340,6 +348,12 @@ public class UserCardService {
|
||||
* 删除就诊卡
|
||||
*/
|
||||
public int deleteUserCard(Integer userId,Integer id) throws Exception {
|
||||
// 清除该用户的缓存,确保下次查询能拿到最新数据
|
||||
safeUtil.clearUserCardCache(userId);
|
||||
return userCardMapper.deleteUserCard(userId,id);
|
||||
}
|
||||
|
||||
public List<UserCardVo> selectByUserId(Integer userId) {
|
||||
return userCardMapper.selectByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.util.MD5Util;
|
||||
import com.guahao.common.util.VeDate;
|
||||
import com.guahao.h5.user.mapper.UserMapper;
|
||||
import com.guahao.h5.user.model.UserCard;
|
||||
import com.guahao.h5.user.model.UserCardVo;
|
||||
import com.guahao.h5.user.model.UserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -197,4 +199,25 @@ public class UserService {
|
||||
}
|
||||
return userMapper.isBlack(userId);
|
||||
}
|
||||
public Boolean hasUser(Integer userId, String patientId) {
|
||||
//判断该id下是否有绑定所查的用户信息
|
||||
List<UserCardVo> list = userCardService.selectByUserId(userId);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查用户是否绑定了特定的就诊卡号
|
||||
for (UserCardVo userCard : list) {
|
||||
if (patientId.equals(userCard.getCardNo())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<UserCardVo> queryUserCardsByUserId(Integer userId) {
|
||||
return userCardService.selectByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.guahao.h5.token.service.TokenService;
|
||||
import com.guahao.h5.token.vo.TokenVo;
|
||||
import com.guahao.h5.user.mapper.UserCardMapper;
|
||||
import com.guahao.h5.user.mapper.UserMapper;
|
||||
import com.guahao.h5.user.model.UserCard;
|
||||
import com.guahao.h5.user.model.UserCardVo;
|
||||
import com.guahao.h5.user.model.UserVo;
|
||||
import com.guahao.h5.user.service.UserService;
|
||||
@@ -98,10 +99,10 @@ public class YbController {
|
||||
String json = ybService.getPayAuthCode(qrcode,openid);
|
||||
JSONObject jsonObject1 = JSON.parseObject(json);
|
||||
String payAuthNo = jsonObject1.getString("pay_auth_no");
|
||||
List<String> cardList = userCardMapper.selectByUserId(uid);
|
||||
List<UserCardVo> cardList = userCardMapper.selectByUserId(uid);
|
||||
if (cardList.size() > 0){
|
||||
cardList.forEach(cardNo -> {
|
||||
hsjcMapper.updatePayAuthNoList(payAuthNo,cardNo);
|
||||
cardList.forEach(vo -> {
|
||||
hsjcMapper.updatePayAuthNoList(payAuthNo,vo.getCardNo());
|
||||
});
|
||||
}
|
||||
IDVO vo =userCardMapper.queryUserCardDefaltByOpenid(openid);
|
||||
|
||||
@@ -12,6 +12,9 @@ import java.util.Objects;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/find")
|
||||
/**
|
||||
* 对账平台接口
|
||||
*/
|
||||
public class DownloadZipController {
|
||||
|
||||
// ZIP 文件所在目录
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
server.port=8089
|
||||
#server.servlet.context-path=/WGZH
|
||||
#server.servlet.context-path=/nxgzh
|
||||
#公众号配置
|
||||
wechat.AppId=wx45acd2b4907cb8f4
|
||||
wechat.AppSecret=895b90585c4698485c07e113711eac85
|
||||
|
||||
@@ -283,6 +283,9 @@
|
||||
<select id="selectListByStatus" resultType="com.guahao.h5.yb.model.OrderInfoVO">
|
||||
select * from order_info where status = #{status}
|
||||
</select>
|
||||
<select id="getMzjfListByFlow2" resultType="com.guahao.h5.hsjc.vo.HsjcVo">
|
||||
select * from user_mzjf where orderno =#{outTradeNo}
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 新增门诊缴费 -->
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
deleted = 1
|
||||
where
|
||||
id = #{id}
|
||||
And user_id = #{userId}
|
||||
</update>
|
||||
<update id="updateReptnoByOrderNo">
|
||||
update express
|
||||
@@ -44,6 +45,12 @@
|
||||
SET status = 0
|
||||
WHERE orderno = #{orderno}
|
||||
</update>
|
||||
<update id="updateByCopies">
|
||||
UPDATE express
|
||||
SET copies = #{copies},
|
||||
amount = #{amount}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="checkSameNameRecordToday" resultType="java.lang.Boolean">
|
||||
SELECT COUNT(*) > 0
|
||||
@@ -61,4 +68,10 @@
|
||||
<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>
|
||||
<select id="selectListByPatientId" resultType="com.guahao.h5.reserve.vo.BingAnVO">
|
||||
SELECT * FROM express WHERE patient_id = #{patientId} and deleted = 0 and status = 2;
|
||||
</select>
|
||||
<select id="selectListByHosNum" resultType="com.guahao.h5.reserve.vo.BingAnVO">
|
||||
SELECT * FROM express WHERE hos_number = #{hosNum} and deleted = 0 and status = 2;
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -151,8 +151,9 @@
|
||||
<select id="selectByPatientId" resultType="com.guahao.h5.user.model.UserCardVo">
|
||||
select * from user_card where patient_id = #{patientId} AND deleted = 0
|
||||
</select>
|
||||
<select id="selectByUserId" resultType="java.lang.String">
|
||||
select card_no from user_card where user_id = #{uid} AND deleted = 0
|
||||
|
||||
<select id="selectByUserId" resultType="com.guahao.h5.user.model.UserCardVo">
|
||||
select * from user_card where user_id = #{userId} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!--新增就诊卡-->
|
||||
|
||||
@@ -18,4 +18,7 @@
|
||||
AND type = 1
|
||||
AND card_no = #{patientId};
|
||||
</select>
|
||||
<select id="selectInfoByCode" resultType="com.guahao.h5.user.model.UserOrder">
|
||||
select * from user_order where code = #{code}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user