You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
167 lines
6.0 KiB
167 lines
6.0 KiB
package com.ynxbd.common.action.pay;
|
|
|
|
import com.ynxbd.common.action.base.BaseAction;
|
|
import com.ynxbd.common.bean.HisRecipe;
|
|
import com.ynxbd.common.dao.his.HisMedicalTestDao;
|
|
import com.ynxbd.common.helper.common.DateHelper;
|
|
import com.ynxbd.common.result.Result;
|
|
import com.ynxbd.common.result.ResultEnum;
|
|
import com.ynxbd.wx.wxfactory.WxMedicalHelper;
|
|
import com.ynxbd.wx.wxfactory.bean.MedicalOrder;
|
|
import com.ynxbd.wx.wxfactory.medical.MdConfig;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.struts2.convention.annotation.Action;
|
|
import org.apache.struts2.convention.annotation.Namespace;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @Author wsq
|
|
* @Date 2020/9/14 15:43
|
|
* @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
|
|
*/
|
|
@Slf4j
|
|
@Namespace("/medical_test")
|
|
public class MedicalTestAction extends BaseAction {
|
|
|
|
/**
|
|
* 获取未缴费项目
|
|
*/
|
|
@Action("getDevRecipeUnPayList")
|
|
public Result getDevRecipeUnPayList(String patientId, String begDate, String endDate) {
|
|
log.info("[处方Dev]未缴费项目查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate);
|
|
if (patientId == null || begDate == null || endDate == null) {
|
|
return Result.error(ResultEnum.PARAM_IS_DEFECT);
|
|
}
|
|
|
|
if (!MdConfig.IS_DEV) {
|
|
return Result.error("环境错误");
|
|
}
|
|
|
|
int days = DateHelper.intervalDays(begDate, endDate, true);
|
|
List<HisRecipe> hisRecipes = HisMedicalTestDao.devUnPayList(patientId, days);
|
|
|
|
List<HisRecipe> resultList = new ArrayList<>();
|
|
for (HisRecipe hisRecipe : hisRecipes) {
|
|
if (hisRecipe.getDate() != null && DateHelper.inDateRange(begDate, endDate, hisRecipe.getDate(), DateHelper.DateEnum.yyyy_MM_dd)) {
|
|
resultList.add(hisRecipe);
|
|
}
|
|
}
|
|
return Result.success(resultList);
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取未缴费项目
|
|
*/
|
|
@Action("getDevRecipePaidList")
|
|
public Result getDevRecipePaidList(String patientId, String begDate, String endDate) {
|
|
log.info("[处方Dev]已缴费项目查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate);
|
|
if (patientId == null || begDate == null || endDate == null) {
|
|
return Result.error(ResultEnum.PARAM_IS_DEFECT);
|
|
}
|
|
|
|
if (!MdConfig.IS_DEV) {
|
|
return Result.error("环境错误");
|
|
}
|
|
|
|
List<HisRecipe> resultList = HisMedicalTestDao.devPaidRecipeList(patientId, begDate, endDate);
|
|
return Result.success(resultList);
|
|
}
|
|
|
|
//
|
|
// /**
|
|
// * [测试环境]医保下单
|
|
// */
|
|
// @Action("orderTest")
|
|
// public Result orderTest(String payCode, String openid, String patientId, String cardNo, String realName, String treatNum, String recipeJson, String payWay, String payOrdId, String payAuthNo, String mdTrtId, String chrgBchno, String mdUserId, String totalFee, String hifpFee, String insuranceFee, String acctFee, String cashFee) {
|
|
// String accessToken = "58_CaCDNzX8RKc4iIHyU_s3uASYDdVd2MsInZw7sulyMHAiUO6Gw3f_DYtrX7HZjLd2rVwb-F8w9m117U5yI1oFcn8Y5CPNjAP7ljnazghIYYg6yACsO2vIEes6O3bCYx69Pj2GlVSAQi81sD3aSAPfACAEMB";
|
|
//
|
|
// MedicalService.createOrder(
|
|
// accessToken,
|
|
// payCode,
|
|
// openid,
|
|
// patientId,
|
|
// cardNo,
|
|
// realName,
|
|
// treatNum,
|
|
// recipeJson,
|
|
// payWay,
|
|
// payOrdId,
|
|
// payAuthNo,
|
|
// mdTrtId,
|
|
// chrgBchno,
|
|
// mdUserId,
|
|
// totalFee,
|
|
// acctFee,
|
|
// hifpFee,
|
|
// insuranceFee,
|
|
// cashFee,
|
|
// "recipe");
|
|
//
|
|
// return Result.success();
|
|
// }
|
|
|
|
|
|
/**
|
|
* [医保]微信支付订单查询
|
|
*
|
|
* @param accessToken accessToken
|
|
* @param outTradeNo 订单号
|
|
* @param medTransId 医保交易流水号
|
|
*/
|
|
@Action("queryWxOrder")
|
|
public Result queryWxOrder(String accessToken, String outTradeNo, String medTransId) {
|
|
log.info("【医保】现金退费 outTradeNo={}, medTransId={}", outTradeNo, medTransId);
|
|
|
|
MedicalOrder order = WxMedicalHelper.queryOrder(accessToken, outTradeNo, medTransId);
|
|
if (order.isOk()) {
|
|
return Result.success(order);
|
|
}
|
|
return Result.error(order.getMessage());
|
|
}
|
|
|
|
|
|
|
|
//
|
|
// /**
|
|
// * 用户信息获取 | 医保上传 | 医保支付下单
|
|
// */
|
|
// @Action("getUserInfo")
|
|
// public Result getUserInfo(String openid, String qrCode) {
|
|
// try {
|
|
// MedicalUserInfo info = MedicalService.getUserInfo(openid, qrCode);
|
|
// return Result.success();
|
|
// } catch (ServiceException e) {
|
|
// return Result.error(e);
|
|
// }
|
|
// }
|
|
|
|
|
|
// /**
|
|
// * HIS医保退费(上线)
|
|
// */
|
|
// @Action("refundMedical")
|
|
// public Result refundMedical(String openid, String qrCode, String fpNum) {
|
|
// try {
|
|
// log.info("[医保退费] openid={}, qrCode={}, fpNum={}", openid, qrCode, fpNum);
|
|
// Result refundResultObj = refund(outTradeNo, bankTransNo, tradeNo, payAuthNo, chrgBchno.substring(1), mdUserId, cashFee, acctFee);
|
|
// recipeDao.updateRefundResult(tradeNo, refundResultObj.isSuccess()
|
|
// ? WxPayHelper.OK : refundResultObj.getMessage());
|
|
//
|
|
// } catch (ServiceException e) {
|
|
// return Result.error(e);
|
|
// }
|
|
// }
|
|
|
|
// /**
|
|
// * HIS记账
|
|
// */
|
|
// @Action("hisAccounts")
|
|
// public Result hisAccounts(String mdUserId, String tradeNo, String bankTransNo, BigDecimal cashFee) {
|
|
// JsonResult jsonResult = HisMedicalDao.medicalPay(mdUserId, DateHelper.getCurDate(), DateHelper.getCurTime(), tradeNo, bankTransNo, cashFee);
|
|
// return Result.success(jsonResult);
|
|
// }
|
|
|
|
}
|
|
|