|
@@ -10,6 +10,7 @@ import cn.hnthyy.thmz.Utils.Tools;
|
|
|
import cn.hnthyy.thmz.comment.UserLoginToken;
|
|
|
import cn.hnthyy.thmz.common.Constants;
|
|
|
import cn.hnthyy.thmz.common.exception.BizException;
|
|
|
+import cn.hnthyy.thmz.common.model.ResultCode;
|
|
|
import cn.hnthyy.thmz.entity.MzException;
|
|
|
import cn.hnthyy.thmz.entity.his.mz.*;
|
|
|
import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
|
|
@@ -31,6 +32,7 @@ import cn.hnthyy.thmz.enums.MzfzStatusEnum;
|
|
|
import cn.hnthyy.thmz.enums.NumberEnum;
|
|
|
import cn.hnthyy.thmz.enums.PayMarkEnum;
|
|
|
import cn.hnthyy.thmz.enums.YesNoEnum;
|
|
|
+import cn.hnthyy.thmz.mapper.his.mz.MzDepositFileMapper;
|
|
|
import cn.hnthyy.thmz.mapper.his.mz.MzOrderLockMapper;
|
|
|
import cn.hnthyy.thmz.pageDto.MzChargeDetailPageDto;
|
|
|
import cn.hnthyy.thmz.service.his.mz.*;
|
|
@@ -42,6 +44,7 @@ import cn.hnthyy.thmz.service.his.zd.ZdChargeItemService;
|
|
|
import cn.hnthyy.thmz.service.his.zd.ZdChequeTypeService;
|
|
|
import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
|
|
|
import cn.hnthyy.thmz.service.his.zy.ZyZdAuditItemService;
|
|
|
+import cn.hnthyy.thmz.service.pay.NongPayService;
|
|
|
import cn.hnthyy.thmz.service.thmz.*;
|
|
|
import cn.hnthyy.thmz.vo.ChargeFeeParamsVo;
|
|
|
import cn.hnthyy.thmz.vo.MzDepositFileVo;
|
|
@@ -124,6 +127,13 @@ public class MzChargeDetailController {
|
|
|
private MzVisitTableService mzVisitTableService;
|
|
|
@Autowired
|
|
|
private RationalUseService rationalUseService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private NongPayService nongPayService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MzDepositFileMapper mzDepositFileMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private WindowsService windowsService;
|
|
|
@Autowired
|
|
@@ -847,7 +857,7 @@ public class MzChargeDetailController {
|
|
|
BigDecimal tempAmount = price.multiply(BigDecimal.valueOf(md.getQuantity() == null ? 1D : md.getQuantity())).multiply(BigDecimal.valueOf(md.getDrugWin() == null ? 1D : md.getDrugWin()));
|
|
|
returnMzChargeDetail.setAmount(returnMzChargeDetail.getAmount().add(tempAmount));
|
|
|
}
|
|
|
- returnMzChargeDetail.setAmount(returnMzChargeDetail.getAmount().setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
+ returnMzChargeDetail.setAmount(returnMzChargeDetail.getAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
return returnMzChargeDetail;
|
|
|
}
|
|
|
|
|
@@ -1032,6 +1042,30 @@ public class MzChargeDetailController {
|
|
|
List<MzDepositFile> needRefundList = (List<MzDepositFile>) map.get("needRefundList");
|
|
|
if (YesNoEnum.YES.code.equals(mzDepositFileVo.getRefundType()) && needRefundList != null && needRefundList.size() > 0 && StringUtils.isNotBlank(windowsDb.getMisPosRouterCode())) {
|
|
|
for (MzDepositFile mzDepositFile : needRefundList) {
|
|
|
+
|
|
|
+ // 如果是聚合支付退款
|
|
|
+ if(Constants.JHZF.equals(mzDepositFile.getChequeType())) {
|
|
|
+ Map<String, String> body = new HashMap<>();
|
|
|
+ body.put("refundAmount", mzDepositFile.getAmountStr());
|
|
|
+ body.put("mchOrderNo", mzDepositFile.getTraceNo());
|
|
|
+ body.put("refundReason", "门诊缴费退款");
|
|
|
+ com.alibaba.fastjson.JSONObject response = nongPayService.refundOrder(body);
|
|
|
+ if(Objects.equals(response.getInteger("code"), ResultCode.pay_error.getCode())) {
|
|
|
+ resultMap.put("code", -2);
|
|
|
+ resultMap.put("message", "退费失败,请询问收费处!");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ System.out.println("com.alibaba.fastjson.JSONObject.toJSONString(response)");
|
|
|
+ System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(response));
|
|
|
+ com.alibaba.fastjson.JSONObject data = response.getJSONObject("data");
|
|
|
+ String refundNo = data.getString("mchRefundNo");
|
|
|
+ String outRefundNo = data.getString("refundOrderId");
|
|
|
+ System.out.println("mchRefundNo = " + refundNo);
|
|
|
+ System.out.println("refundOrderId = " + outRefundNo);
|
|
|
+ mzDepositFileMapper.updateRefundByPatientId(mzDepositFile.getPatientId(), mzDepositFile.getTimes(), refundNo, outRefundNo);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
JSONObject jsonObject = transactionService.refund(windowsDb.getMisPosRouterCode(), mzDepositFile.getAmount(), mzDepositFile.getPsordnum() + "_" + mzDepositFile.getAmountStr(), null, mzDepositFile.getChequeType(), mzDepositFile.getParChannel(), mzDepositFile.getPsordnum(), mzDepositFile.getTransDate(), mzDepositFile.getAgtordnum());
|
|
|
if (jsonObject == null) {
|
|
|
resultMap.put("code", -2);
|