|
@@ -5861,7 +5861,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
MzReceiptSerial tempMzReceiptSerial = null;
|
|
|
if (mzReceiptSerials != null && mzReceiptSerials.size() > 0) {
|
|
|
for (MzReceiptSerial ms : mzReceiptSerials) {
|
|
|
- if (!Constants.BYJZ.equals(ms.getChequeType()) && !Constants.YBJZ.equals(ms.getChequeType())) {
|
|
|
+ if (hashChargeDetailEqualTotalAmount(ms,totalAmount)) {
|
|
|
tempMzReceiptSerial = CloneUtil.clone(ms);
|
|
|
if (tempMzReceiptSerial != null) {
|
|
|
tempMzReceiptSerial.setReceiptNo(receiptNo + 1);
|
|
@@ -5920,19 +5920,68 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
if (tempMzReceiptSerial == null) {
|
|
|
return newList;
|
|
|
}
|
|
|
- MzReceiptSerial fundPayMzReceiptSerial = CloneUtil.clone(tempMzReceiptSerial);
|
|
|
- fundPayMzReceiptSerial.setChequeType(Constants.YBJZ);
|
|
|
- fundPayMzReceiptSerial.setTotalCharge(payInfo.getFundPay());
|
|
|
- if (totalAmount.compareTo(payInfo.getFundPay()) > 0) {
|
|
|
- fundPayMzReceiptSerial.resetParams();
|
|
|
+ MzReceiptSerial ybjzMs = CloneUtil.clone(tempMzReceiptSerial);
|
|
|
+ ybjzMs.setTotalCharge(payInfo.getFundPay());
|
|
|
+ ybjzMs.setChequeType(Constants.YBJZ);
|
|
|
+ newList.add(ybjzMs);
|
|
|
+ MzReceiptSerial gzMs = CloneUtil.clone(tempMzReceiptSerial);
|
|
|
+ if(Convert.toBigDecimal(payInfo.getAcctPay(),BigDecimal.ZERO).compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ gzMs.setTotalCharge(payInfo.getAcctPay());
|
|
|
+ gzMs.setChequeType(Convert.toInt(payInfo.getCardType(),1) == 1 ? Constants.SSHIYBGZ : Constants.SHENYGZ);
|
|
|
+ newList.add(gzMs);
|
|
|
+ }
|
|
|
+ if(totalAmount.compareTo(payInfo.getFundPay().add(Convert.toBigDecimal(payInfo.getAcctPay(),BigDecimal.ZERO))) > 0){
|
|
|
+ MzReceiptSerial fundPayMzReceiptSerial = CloneUtil.clone(tempMzReceiptSerial);
|
|
|
+ //与收费方式保持一致
|
|
|
+ fundPayMzReceiptSerial.setChequeType(Constants.CASH);
|
|
|
+ fundPayMzReceiptSerial.setTotalCharge(totalAmount.subtract(payInfo.getFundPay().add(Convert.toBigDecimal(payInfo.getAcctPay(),BigDecimal.ZERO))));
|
|
|
+ newList.add(fundPayMzReceiptSerial);
|
|
|
+ //有自费的金额,情况医保费用明细
|
|
|
+ ybjzMs.resetParams();
|
|
|
+ gzMs.resetParams();
|
|
|
+ }else {
|
|
|
+ if(Convert.toBigDecimal(payInfo.getAcctPay(),BigDecimal.ZERO).compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ ybjzMs.resetParams();
|
|
|
+ }
|
|
|
}
|
|
|
- newList.add(fundPayMzReceiptSerial);
|
|
|
- BigDecimal selfAmount = totalAmount.subtract(payInfo.getFundPay());
|
|
|
- tempMzReceiptSerial.setTotalCharge(selfAmount);
|
|
|
- newList.add(tempMzReceiptSerial);
|
|
|
return newList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @description: 是否收费明细等于总金额
|
|
|
+ * @author: lihong
|
|
|
+ * @date: 2024/8/8 9:44
|
|
|
+ * @param: ms
|
|
|
+ * @return: boolean
|
|
|
+ **/
|
|
|
+ private boolean hashChargeDetailEqualTotalAmount(MzReceiptSerial ms, BigDecimal totalAmount) {
|
|
|
+ BigDecimal total = Convert.toBigDecimal(ms.getCharge1(), BigDecimal.ZERO)
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge2(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge3(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge4(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge5(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge6(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge7(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge8(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge9(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge10(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge11(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge12(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge13(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge14(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge15(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge16(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge17(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge18(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge19(), BigDecimal.ZERO))
|
|
|
+ .add(Convert.toBigDecimal(ms.getCharge20(), BigDecimal.ZERO));
|
|
|
+ if(total.compareTo(totalAmount) == 0 || total.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 根据已经存在本院记账记录产生新的退款记录和重收记录
|