|
|
|
|
package com.ynxbd.common.action.test;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.ynxbd.ali.helper.AliMIHelper;
|
|
|
|
|
import com.ynxbd.common.action.base.BaseAction;
|
|
|
|
|
import com.ynxbd.common.bean.his.HisTreat;
|
|
|
|
|
import com.ynxbd.common.bean.pay.Recipe;
|
|
|
|
|
import com.ynxbd.common.dao.RecipeDao;
|
|
|
|
|
import com.ynxbd.common.dao.his.HisTreatDao;
|
|
|
|
|
import com.ynxbd.common.helper.common.DateHelper;
|
|
|
|
|
import com.ynxbd.common.helper.common.JsonHelper;
|
|
|
|
|
import com.ynxbd.common.result.Result;
|
|
|
|
|
import com.ynxbd.common.result.ResultEnum;
|
|
|
|
|
import com.ynxbd.common.result.ServiceException;
|
|
|
|
|
import com.ynxbd.wx.wxfactory.WxCacheHelper;
|
|
|
|
|
import com.ynxbd.wx.wxfactory.WxMedicalHelper;
|
|
|
|
|
import com.ynxbd.wx.wxfactory.bean.MIOrder;
|
|
|
|
|
import com.ynxbd.wx.wxfactory.medical.WechatMIConfig;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.struts2.convention.annotation.Action;
|
|
|
|
|
import org.apache.struts2.convention.annotation.Namespace;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author wsq
|
|
|
|
|
* @Date 2021/3/17 10:57
|
|
|
|
|
* @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Namespace("/test02")
|
|
|
|
|
public class TestAction extends BaseAction {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @Action("a")
|
|
|
|
|
// public String a() {
|
|
|
|
|
// String sql = "select * from a limit 0, 100";
|
|
|
|
|
// List<A> data = DataBase.select(sql, A.class);
|
|
|
|
|
// for (A a : data) {
|
|
|
|
|
// System.out.println(data);
|
|
|
|
|
// }
|
|
|
|
|
// return Result.success(data);
|
|
|
|
|
// StringBuilder sb = new StringBuilder();
|
|
|
|
|
// sb.append("http://10.20.10.60:8123/MessagePlatform/DaoYiXun?");
|
|
|
|
|
// sb.append("templateId=");
|
|
|
|
|
// sb.append("6hpr5eY-nnCIkFu2ZeuvFjd0YG1ZwlHOo_ikRSXJUg4");
|
|
|
|
|
// //
|
|
|
|
|
// sb.append("&patientName=");
|
|
|
|
|
// sb.append("患者");
|
|
|
|
|
// //
|
|
|
|
|
// sb.append("&content=");
|
|
|
|
|
// sb.append("内容");
|
|
|
|
|
// //
|
|
|
|
|
// sb.append("&openId=");
|
|
|
|
|
// sb.append("32EBE22EF6C9437575AB7A043E456D25704583EFA5E6BE1B5CB899A6F3B7075A");
|
|
|
|
|
// //
|
|
|
|
|
// sb.append("&deptName=");
|
|
|
|
|
// sb.append("科室");
|
|
|
|
|
// //
|
|
|
|
|
// sb.append("&deptCode=");
|
|
|
|
|
// sb.append("1234");
|
|
|
|
|
// ResponseEntity<String> responseEntity = new RestTemplate().getForEntity("http://10.20.10.60:8123/MessagePlatform/DaoYiXun?templateId=6hpr5eY-nnCIkFu2ZeuvFjd0YG1ZwlHOo_ikRSXJUg4&patientName=王绍全&content=挂号时间&openId=32EBE22EF6C9437575AB7A043E456D25704583EFA5E6BE1B5CB899A6F3B7075A&deptName=方便门诊&deptCode=5201", String.class);
|
|
|
|
|
//
|
|
|
|
|
// String body = responseEntity.getBody();
|
|
|
|
|
// System.out.println(body);
|
|
|
|
|
// System.out.println(responseEntity);
|
|
|
|
|
// return Result.error();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @Action("ocPay")
|
|
|
|
|
// public Result ocPay(String outTradeNo) throws ServiceException {
|
|
|
|
|
// new OutCollectService().ocPayNotify(MerchantEnum.WX, "123", new BigDecimal("0.01"), outTradeNo, "123", "123");
|
|
|
|
|
// return Result.success();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Action("test03")
|
|
|
|
|
public Result test03() throws ServiceException {
|
|
|
|
|
System.out.println("开关" + WechatMIConfig.IS_AUTO_REFUND);
|
|
|
|
|
log.info("日志测试");
|
|
|
|
|
System.out.println(System.getProperty("fileEncoding"));
|
|
|
|
|
System.out.println(System.getProperty("encoding"));
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Action("wx_med_refund_test")
|
|
|
|
|
public Result wx_med_refund_test() throws ServiceException {
|
|
|
|
|
WxMedicalHelper.refundCash("WX_M202f622bb3444a033f7a014a421b", "ORD530100202505100932115202726", new BigDecimal("183.390"), "人工退费");
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Action("ali_med_refund_test")
|
|
|
|
|
public Result ali_med_refund_test() throws Exception {
|
|
|
|
|
AliMIHelper.refundTrade("", "", null, new BigDecimal(""), "退费测试");
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Action("md_add")
|
|
|
|
|
public Result md_add(String outTradeNo) {
|
|
|
|
|
try {
|
|
|
|
|
log.info("[医保]补充订单数据 outTradeNo={}", outTradeNo);
|
|
|
|
|
MIOrder order = WxMedicalHelper.queryOrder(WxCacheHelper.getAccessToken(), outTradeNo, null);
|
|
|
|
|
if (order == null || !order.isOk()) {
|
|
|
|
|
return Result.error("订单未找到");
|
|
|
|
|
}
|
|
|
|
|
if (!"PAYED".equals(order.getInsuranceTradeStatus())) {
|
|
|
|
|
return Result.error("订单未支付");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Recipe recipe = new Recipe();
|
|
|
|
|
recipe.setUpdateTime(new Date());
|
|
|
|
|
recipe.setOpenid(order.getOpenid());
|
|
|
|
|
recipe.setPayStatus(0);
|
|
|
|
|
recipe.setHisStatus(-1);
|
|
|
|
|
recipe.setOutTradeNo(outTradeNo);
|
|
|
|
|
recipe.setChrgBchno(order.getSerialNo());
|
|
|
|
|
recipe.setBankTransNo(order.getMedTransId());
|
|
|
|
|
JSONObject jsonObject = JsonHelper.parseObject(order.getRequestContent());
|
|
|
|
|
|
|
|
|
|
String payOrdId = jsonObject.getString("payOrdId");
|
|
|
|
|
recipe.setTradeNo(payOrdId);
|
|
|
|
|
recipe.setPayOrdId(payOrdId);
|
|
|
|
|
// ==========================
|
|
|
|
|
recipe.setPatientId("1xbd");
|
|
|
|
|
recipe.setMdTrtId("xbd-med");
|
|
|
|
|
recipe.setMdUserId("xbd-med");
|
|
|
|
|
recipe.setPayWay("0");
|
|
|
|
|
|
|
|
|
|
recipe.setHisResult("订单未调用HIS接口");
|
|
|
|
|
recipe.setTotalFee(order.getTotalFee());
|
|
|
|
|
recipe.setPayMoney(order.getCashFee());
|
|
|
|
|
recipe.setAcctFee(order.getInsuranceSelfFee());
|
|
|
|
|
recipe.setHifpFee(order.getInsuranceFundFee());
|
|
|
|
|
|
|
|
|
|
String body = order.getBody();
|
|
|
|
|
String treatNum = body == null ? null : body.substring(4);
|
|
|
|
|
recipe.setTreatNum(treatNum);
|
|
|
|
|
|
|
|
|
|
if (treatNum != null) {
|
|
|
|
|
List<HisTreat> dataList = new HisTreatDao().getInfoByTreatNum(treatNum);
|
|
|
|
|
if (!dataList.isEmpty()) {
|
|
|
|
|
HisTreat hisTreat = dataList.get(0);
|
|
|
|
|
if (hisTreat != null) {
|
|
|
|
|
recipe.setPatientId(hisTreat.getPatientId());
|
|
|
|
|
recipe.setDeptCode(hisTreat.getDeptCode());
|
|
|
|
|
recipe.setDeptName(hisTreat.getDeptName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (new RecipeDao().insertMedical(recipe)) {
|
|
|
|
|
log.info("[医保]补充订单数据 recipe={}", JsonHelper.toJsonString(recipe));
|
|
|
|
|
}
|
|
|
|
|
return Result.success();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("异常:{}", e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @Action("lock")
|
|
|
|
|
// public String lock() {
|
|
|
|
|
// return Result.success(update());
|
|
|
|
|
// }
|
|
|
|
|
// public synchronized Integer update(){
|
|
|
|
|
// int update = DataBase.update("update pay set remark = ? where outTradeNo= ?, updateTime=now()", ps -> {
|
|
|
|
|
// ps.setString(1, CodeHelper.getRandomCode(8));
|
|
|
|
|
// ps.setString(2, "00015d3064434d8c8c4a016b84602f89");
|
|
|
|
|
// });
|
|
|
|
|
// return null;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @Action("api")
|
|
|
|
|
// public Result api(String callNo, String patientId, String refundDesc, String payOrdId) {
|
|
|
|
|
// String verify = request.getHeader("verify");
|
|
|
|
|
// Map<String, Object> map = new HashMap<>();
|
|
|
|
|
//
|
|
|
|
|
// map.put("callNo", callNo);
|
|
|
|
|
// map.put("patientId", patientId);
|
|
|
|
|
// map.put("refundDesc", refundDesc);
|
|
|
|
|
// map.put("payOrdId", payOrdId);
|
|
|
|
|
// map.put("verify", verify);
|
|
|
|
|
//
|
|
|
|
|
// map.put("transNo", "transNo123");
|
|
|
|
|
// map.put("payWay", 4);
|
|
|
|
|
// map.put("bankTransNo", "bankTransNo123");
|
|
|
|
|
// map.put("payMoney", new BigDecimal("0.01"));
|
|
|
|
|
//
|
|
|
|
|
// if (patientId != null && payOrdId != null) {
|
|
|
|
|
// String piMd5 = patientId + payOrdId + "xbd";
|
|
|
|
|
// map.put("wx_verify", DigestUtils.md5Hex(piMd5).toUpperCase());
|
|
|
|
|
// }
|
|
|
|
|
// return Result.success(map);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// @Action(value = "api2")
|
|
|
|
|
// public Result api2(String id) {
|
|
|
|
|
// String post = HttpClientHelper.post("http://127.0.0.1:8081/wx/test02/api.do?a=123", null, null);
|
|
|
|
|
// return Result.success(post);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Action("test")
|
|
|
|
|
public Result test(String billDate) {
|
|
|
|
|
if (!DateHelper.isValidDate(billDate, DateHelper.DateEnum.yyyy_MM_dd)) {
|
|
|
|
|
return Result.error(ResultEnum.PARAM_DATE_ERROR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println(DateHelper.getMoveDate(new Date(), -1));
|
|
|
|
|
if (billDate.equals(DateHelper.getMoveDate(new Date(), -1))) {
|
|
|
|
|
if (!DateHelper.isCurTimeOver("03:00:00")) {
|
|
|
|
|
return Result.error("查询前一天的数据,需要在今天9点15之后");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @Action("refundReg")
|
|
|
|
|
// public Result refundReg() {
|
|
|
|
|
// List<Order> orders = new RegisterDao().selectRefundList("2022-09-22", "2022-09-29");
|
|
|
|
|
// log.info("退费笔数{}", orders.size());
|
|
|
|
|
// if (orders.size() > 60) {
|
|
|
|
|
// return Result.error("退费数量过多");
|
|
|
|
|
// }
|
|
|
|
|
// String payCode = "wx";
|
|
|
|
|
// for (Order item : orders) {
|
|
|
|
|
// String openid = item.getOpenid();
|
|
|
|
|
// if (openid != null && openid.length() == 16) {
|
|
|
|
|
// payCode = "ali";
|
|
|
|
|
// }
|
|
|
|
|
// new RegService().cancelRegRes(payCode, item.getPatientId(), item.getTradeNo(), item.getHisTransNo());
|
|
|
|
|
// }
|
|
|
|
|
// return Result.success();
|
|
|
|
|
// }
|
|
|
|
|
}
|