فهرست منبع

08 28 02 全院损益计算

hr 4 سال پیش
والد
کامیت
7dae0e8f4d
1فایلهای تغییر یافته به همراه5 افزوده شده و 6 حذف شده
  1. 5 6
      src/main/java/com/imed/costaccount/service/impl/HospProfitAndLossServiceImpl.java

+ 5 - 6
src/main/java/com/imed/costaccount/service/impl/HospProfitAndLossServiceImpl.java

@@ -94,7 +94,6 @@ public class HospProfitAndLossServiceImpl extends ServiceImpl<HospProfitAndLossM
             Integer calcType = i.getCalcType();
             if (calcType == CalcTypeEnum.BY_ACCOUNT.getType()) {
                 // 按会计科目计算
-
                 HospProfitAndLoss loss = calcByAccount(hospId, i, incomes, allocationQueries);
                 if (Objects.isNull(loss)) {
                     return;
@@ -145,9 +144,9 @@ public class HospProfitAndLossServiceImpl extends ServiceImpl<HospProfitAndLossM
                 HospProfitAndLoss loss = new HospProfitAndLoss();
                 loss.setDateYear(year).setDateMonth(month).setReportName(ele.getPaymentsName()).setReportNum(ele.getId().intValue())
                         .setCreateTime(System.currentTimeMillis()).setAmount(ele.getTotalAmount()).setHospId(hospId);
-                if (ele.getPaymentsType() == 2) {
-                    loss.setAmount(BigDecimal.ZERO.subtract(ele.getTotalAmount()));
-                }
+//                if (ele.getPaymentsType() == 2) {
+//                    loss.setAmount(BigDecimal.ZERO.subtract(ele.getTotalAmount()));
+//                }
                 list.add(loss);
             });
         }
@@ -300,7 +299,7 @@ public class HospProfitAndLossServiceImpl extends ServiceImpl<HospProfitAndLossM
         if (allocations.isEmpty()) {
             throw new CostException("医院未分摊本月数据");
         }
-        BigDecimal reduce = allocations.stream().map(Allocation::getAmount).reduce(BigDecimal.ZERO, BigDecimal::subtract);
+        BigDecimal reduce = allocations.stream().map(Allocation::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
         HospProfitAndLoss loss = new HospProfitAndLoss();
         return loss.setReportName(reportForm.getReportName()).setReportNum(reportForm.getNum())
                 .setAmount(reduce).setCreateTime(System.currentTimeMillis()).setHospId(hospId);
@@ -327,7 +326,7 @@ public class HospProfitAndLossServiceImpl extends ServiceImpl<HospProfitAndLossM
                     .reduce(BigDecimal.ZERO, BigDecimal::add);
             BigDecimal costAmount = allocationQueries.stream().filter(j -> i.equals(j.getAccountingCode())).map(AllocationQuery::getAmount)
                     .reduce(BigDecimal.ZERO, BigDecimal::add);
-            BigDecimal total = incomeAmount.subtract(costAmount);
+            BigDecimal total = incomeAmount.add(costAmount);
             calcTotal.set(calcTotal.get().add(total));
         });
         HospProfitAndLoss loss = new HospProfitAndLoss();