Browse Source

调整惠民活动计算折扣的位置

hurugang 2 years ago
parent
commit
a19d223e61

+ 7 - 6
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -458,7 +458,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         //計算第二部位和DR费用
         setSecondPartAndDrFeeForCharge(mzChargeDetails, mzYjReqMap, tcNoMap, reqAmountMap, zdChargeItemMap);
         //预览的时候获取费用明细,需要打折,不是预览而是入库的时候不打折,因为入库后会有一次重新计算 计算惠民活动
-        formatPriceRoundDetail(mzChargeDetail, mzChargeDetails, mzPatientMi, mzChargeDetailList, maxOrderNo, itemNo, receiptNo, YesNoEnum.YES.equals(yesNo) ? true : false);
+        formatPriceRoundDetail(mzChargeDetail, mzChargeDetails, mzPatientMi, mzChargeDetailList, maxOrderNo, itemNo, receiptNo,  true);
         //yes 预览需要将原数据库中已存在的明细与临时生成的一起返回
         if (YesNoEnum.YES.equals(yesNo)) {
             for (MzChargeDetail mcd : mzChargeDetailList) {
@@ -738,7 +738,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         //所有应收费用的明细 将所有费用按照类型归类
         Map<String, BigDecimal> feeMap = new HashMap<>();
         //实际应付金额
-        BigDecimal totalPayable = getTotalPayable(mzChargeDetailList, feeMap, true);
+        BigDecimal totalPayable = getTotalPayable(mzChargeDetailList, feeMap, false);
         //实际应付金额  四舍五入后的值 收费员收的钱小数点后只有一位有效值
         BigDecimal totalPayableRound = totalPayable.setScale(1, BigDecimal.ROUND_HALF_UP);
         //单病种收费不设置金额,所以自动设置金额
@@ -2874,7 +2874,6 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         List<MzChargeDetail> mzChargeDetailList = mzPrescriptionVo.getMzChargeDetailList();
         Integer receiptNo = 1;
         YesNoEnum yesNo = YesNoEnum.YES;
-
         List<MzChargeDetail> mzChargeDetails = getMzChargeDetails(mzChargeDetail, yesNo, receiptNo, mzYjReqs, mzChargeDetailList, mzPrescriptionVo.getZgmztczf());
         //总金额
         BigDecimal amount = BigDecimal.ZERO;
@@ -4904,7 +4903,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                         discount = discountService.getDiscountRate(YesNoEnum.NO.code, mzChargeDetail.getWarnDept(), mzChargeDetail.getChargeItemCode());
                     }
                     if (discount == null && StringUtils.isNotBlank(mzChargeDetail.getExecDept())) {
-                        discount = discountService.getDiscountRate(YesNoEnum.NO.code, mzChargeDetail.getExecDept(), mzChargeDetail.getChargeItemCode());
+                        discount = discountService.getDiscountRate(YesNoEnum.YES.code, mzChargeDetail.getExecDept(), mzChargeDetail.getChargeItemCode());
                     }
                     if (discount != null) {
                         if (YesNoEnum.YES.code.equals(discount.getDiscountType())) {
@@ -4937,7 +4936,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
      * 将总金额的零头转做四舍五入的收费明细记录
      *
      * @param mzChargeDetail
-     * @param mzChargeDetails
+     * @param mzChargeDetails 非原处方明细表数据 ,动态添加的数据
      * @param mzPatientMi
      * @param mzChargeDetailList
      * @param maxOrderNo
@@ -4947,7 +4946,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
     private void formatPriceRoundDetail(MzChargeDetail mzChargeDetail, List<MzChargeDetail> mzChargeDetails, MzPatientMi mzPatientMi, List<MzChargeDetail> mzChargeDetailList, Integer maxOrderNo, Integer itemNo, Integer receiptNo, boolean needDiscount) {
         List<MzChargeDetail> temp = new ArrayList<>();
         temp.addAll(mzChargeDetailList);
-        temp.addAll(mzChargeDetails);
+        if(mzChargeDetails!=null){
+            temp.addAll(mzChargeDetails);
+        }
         if (temp != null && temp.size() > 0) {
             BigDecimal totalFee = BigDecimal.ZERO;
             //所有应收费用的明细 将所有费用按照类型归类