浏览代码

添加临床科室医疗成本表(全成本)相关代码

JammeyJiang 3 月之前
父节点
当前提交
1c743eee4a

+ 9 - 1
src/main/java/com/kcim/service/StandardReportService.java

@@ -1,5 +1,6 @@
 package com.kcim.service;
 
+import com.kcim.vo.ClinicalDeptFullCostVO;
 import com.kcim.vo.DeptFullDirectCostVO;
 import com.kcim.vo.ClinicalDeptMedicalCostVO;
 import com.kcim.vo.DeptDirectMedicalCostVO;
@@ -21,9 +22,16 @@ public interface StandardReportService {
     List<DeptFullDirectCostVO> getDeptFullDirectCost(String computeDate);
 
     /**
-     * 科室成本明细表
+     * 获取临床服务类科室全成本(医疗成本)
      * @param computeDate 核算年月
      * @return 报表数据
      */
     List<ClinicalDeptMedicalCostVO> getClinicalDeptMedicalCost(String computeDate);
+
+    /**
+     * 获取临床服务类科室全成本(全成本)
+     * @param computeDate 核算年月
+     * @return 报表数据
+     */
+    List<ClinicalDeptFullCostVO> getClinicalDeptFullCost(String computeDate);
 }

+ 147 - 3
src/main/java/com/kcim/service/impl/StandardReportServiceImpl.java

@@ -204,15 +204,159 @@ public class StandardReportServiceImpl implements StandardReportService {
         }
         // 转成List便于处理
         List<ClinicalDeptMedicalCostVO> reportList = reportMap.values().stream().collect(Collectors.toList());
-        // 创建计对象
+        // 创建计对象
         ClinicalDeptMedicalCostVO subtotalVo = createSubtotalVo(reportList.get(NumberConstant.ZERO),"科室全成本合计",ClinicalDeptMedicalCostVO.class);
-        //将科室的金额加到计对象中
+        //将科室的金额加到计对象中
         reportList.forEach(item -> addBigDecimalFields(item, subtotalVo));
-        // 计加到列表最后面
+        // 计加到列表最后面
         reportList.add(subtotalVo);
         return reportList;
     }
 
+    /**
+     * 获取临床服务类科室全成本报表数据
+     * @param computeDate 核算年月
+     * @return 报表数据
+     */
+    @Override
+    public List<ClinicalDeptFullCostVO> getClinicalDeptFullCost(String computeDate) {
+        DateTime parse = DateUtil.parse(computeDate);
+        int year = DateUtil.year(parse);
+        int month = DateUtil.month(parse) + 1;
+
+        // 获取科室直接成本
+        List<AllocationQuery> allocationQueryList = allocationQueryService.getAllByDate(UserContext.getCurrentLoginHospId(), year, month);
+        if (CollectionUtils.isEmpty(allocationQueryList)) {
+            return new ArrayList<>();
+        }
+
+        // 获取所有的标准字典数据
+        StandCostDictMapVO standCostDictMaps = getStandCostDictMaps();
+
+        // 处理 allocationQueryList 数据
+        Map<String, ClinicalDeptFullCostVO> reportMap = new HashMap<>();
+
+        // 转换为ClinicalDeptFullCostVO(一个责任中心只一条记录)
+        for (AllocationQuery allocationQuery : allocationQueryList) {
+            addClinicalDeptFullCostVO(reportMap, allocationQuery, standCostDictMaps);
+        }
+
+        // 转成List便于处理
+        List<ClinicalDeptFullCostVO> reportList = reportMap.values().stream().collect(Collectors.toList());
+
+        // 创建合计对象
+        ClinicalDeptFullCostVO subtotalVo = createSubtotalVo(reportList.get(NumberConstant.ZERO), "科室全成本合计", ClinicalDeptFullCostVO.class);
+
+        // 将科室的金额加到合计对象中
+        reportList.forEach(item -> addBigDecimalFields(item, subtotalVo));
+
+        // 合计加到列表最后面
+        reportList.add(subtotalVo);
+
+        return reportList;
+    }
+
+    /**
+     * 添加临床服务类科室全成本明细
+     * @param reportMap
+     * @param allocationQuery
+     * @param standCostDictMaps
+     */
+    private void addClinicalDeptFullCostVO(Map<String, ClinicalDeptFullCostVO> reportMap, AllocationQuery allocationQuery, StandCostDictMapVO standCostDictMaps) {
+        String responsibilityCode = allocationQuery.getResponsibilityCode();
+        Responsibility responsibility = standCostDictMaps.getResponsibilityMap().get(responsibilityCode);
+        if (responsibility == null) {
+            return; // 添加 null 检查
+        }
+
+        String accountingCode = allocationQuery.getAccountingCode();
+        Accounting account = standCostDictMaps.getAccountingMap().get(accountingCode);
+        if (account == null) {
+            return; // 添加 null 检查
+        }
+
+        DictDataVo accountType = standCostDictMaps.getAccountingTypeMap().get(account.getType());
+        if (accountType == null) {
+            return; // 添加 null 检查
+        }
+        DictDataVo costType = standCostDictMaps.getCostTypeMap().get(account.getCostType());
+        DictDataVo standardShareLevel = standCostDictMaps.getStandardShareLevelMap().get(responsibility.getStandardShareLevel());
+
+        ClinicalDeptFullCostVO reportVO = new ClinicalDeptFullCostVO();
+        if (reportMap.containsKey(allocationQuery.getResponsibilityCode())) {
+            reportVO = reportMap.get(allocationQuery.getResponsibilityCode());
+        } else {
+            // 生成科室成本报表信息
+            initDeptCostReport(reportVO, responsibility, accountType, costType, standardShareLevel);
+            // 初始化所有费用字段为0
+            BeanUtil.initBigDecimalFieldsToZero(reportVO);
+        }
+
+        // 根据费用类型累加到对应字段
+        switch (costType.getValue()) {
+            case "1":
+                if (NumberConstant.ONE.equals(allocationQuery.getOriginType().intValue())) {
+                    reportVO.setMedicalCostTotalDirect(reportVO.getMedicalCostTotalDirect().add(allocationQuery.getAmount()));
+                } else {
+                    reportVO.setMedicalCostTotalIndirect(reportVO.getMedicalCostTotalIndirect().add(allocationQuery.getAmount()));
+                }
+                reportVO.setMedicalCostTotal(reportVO.getMedicalCostTotal().add(allocationQuery.getAmount()));
+                break;
+            case "2":
+                if (NumberConstant.ONE.equals(allocationQuery.getOriginType().intValue())) {
+                    reportVO.setFinancialProjectFundsDirect(reportVO.getFinancialProjectFundsDirect().add(allocationQuery.getAmount()));
+                } else {
+                    reportVO.setFinancialProjectFundsIndirect(reportVO.getFinancialProjectFundsIndirect().add(allocationQuery.getAmount()));
+                }
+                reportVO.setFinancialProjectFunds(reportVO.getFinancialProjectFunds().add(allocationQuery.getAmount()));
+                break;
+            case "3":
+                if (NumberConstant.ONE.equals(allocationQuery.getOriginType().intValue())) {
+                    reportVO.setNonPeerFinancialFundsDirect(reportVO.getNonPeerFinancialFundsDirect().add(allocationQuery.getAmount()));
+                } else {
+                    reportVO.setNonPeerFinancialFundsIndirect(reportVO.getNonPeerFinancialFundsIndirect().add(allocationQuery.getAmount()));
+                }
+                reportVO.setNonPeerFinancialFunds(reportVO.getNonPeerFinancialFunds().add(allocationQuery.getAmount()));
+                break;
+            case "4":
+                if (NumberConstant.ONE.equals(allocationQuery.getOriginType().intValue())) {
+                    reportVO.setEducationalExpensesDirect(reportVO.getEducationalExpensesDirect().add(allocationQuery.getAmount()));
+                } else {
+                    reportVO.setEducationalExpensesIndirect(reportVO.getEducationalExpensesIndirect().add(allocationQuery.getAmount()));
+                }
+                reportVO.setEducationalExpenses(reportVO.getEducationalExpenses().add(allocationQuery.getAmount()));
+                break;
+            case "5":
+                if (NumberConstant.ONE.equals(allocationQuery.getOriginType().intValue())) {
+                    reportVO.setAssetDisposalFeesDirect(reportVO.getAssetDisposalFeesDirect().add(allocationQuery.getAmount()));
+                } else {
+                    reportVO.setAssetDisposalFeesIndirect(reportVO.getAssetDisposalFeesIndirect().add(allocationQuery.getAmount()));
+                }
+                reportVO.setAssetDisposalFees(reportVO.getAssetDisposalFees().add(allocationQuery.getAmount()));
+                break;
+            default:
+                break;
+        }
+
+        // 不是医院全成本的都是医疗全成本
+        if (!NumberConstant.THREE_S.equals(costType.getExpandOne())) {
+            if (NumberConstant.ONE.equals(allocationQuery.getOriginType().intValue())) {
+                reportVO.setMedicalTotalCostDirect(reportVO.getMedicalTotalCostDirect().add(allocationQuery.getAmount()));
+            } else {
+                reportVO.setMedicalTotalCostIndirect(reportVO.getMedicalTotalCostIndirect().add(allocationQuery.getAmount()));
+            }
+            reportVO.setMedicalTotalCost(reportVO.getMedicalTotalCost().add(allocationQuery.getAmount()));
+        }
+
+        // 医院全成本合计
+        if (NumberConstant.ONE.equals(allocationQuery.getOriginType().intValue())) {
+            reportVO.setHospitalTotalCostDirect(reportVO.getHospitalTotalCostDirect().add(allocationQuery.getAmount()));
+        } else {
+            reportVO.setHospitalTotalCostIndirect(reportVO.getHospitalTotalCostIndirect().add(allocationQuery.getAmount()));
+        }
+        reportVO.setHospitalTotalCost(reportVO.getHospitalTotalCost().add(allocationQuery.getAmount()));
+    }
+
     /**
      * 添加科室成本明细
      * @param reportMap 

+ 118 - 0
src/main/java/com/kcim/vo/ClinicalDeptFullCostVO.java

@@ -0,0 +1,118 @@
+package com.kcim.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 临床服务类科室全成本报表VO类
+ * 用于封装临床科室的各类成本数据,包括医疗成本、财政项目拨款经费、非同级财政拨款项目经费等
+ */
+@Data
+public class ClinicalDeptFullCostVO extends BaseDeptCostReportVO {
+
+    /**
+     * 医疗成本合计 - 直接成本
+     */
+    private BigDecimal medicalCostTotalDirect = BigDecimal.ZERO;
+
+    /**
+     * 医疗成本合计 - 间接成本
+     */
+    private BigDecimal medicalCostTotalIndirect = BigDecimal.ZERO;
+
+    /**
+     * 医疗成本合计 - 全成本
+     */
+    private BigDecimal medicalCostTotal = BigDecimal.ZERO;
+
+    /**
+     * 财政项目拨款经费形成的各项费用 - 直接成本
+     */
+    private BigDecimal financialProjectFundsDirect = BigDecimal.ZERO;
+
+    /**
+     * 财政项目拨款经费形成的各项费用 - 间接成本
+     */
+    private BigDecimal financialProjectFundsIndirect = BigDecimal.ZERO;
+
+    /**
+     * 财政项目拨款经费形成的各项费用 - 全成本
+     */
+    private BigDecimal financialProjectFunds = BigDecimal.ZERO;
+
+    /**
+     * 非同级财政拨款项目经费形成的各项费用 - 直接成本
+     */
+    private BigDecimal nonPeerFinancialFundsDirect = BigDecimal.ZERO;
+
+    /**
+     * 非同级财政拨款项目经费形成的各项费用 - 间接成本
+     */
+    private BigDecimal nonPeerFinancialFundsIndirect = BigDecimal.ZERO;
+
+    /**
+     * 非同级财政拨款项目经费形成的各项费用 - 全成本
+     */
+    private BigDecimal nonPeerFinancialFunds = BigDecimal.ZERO;
+
+    /**
+     * 医疗全成本合计 - 直接成本
+     */
+    private BigDecimal medicalTotalCostDirect = BigDecimal.ZERO;
+
+    /**
+     * 医疗全成本合计 - 间接成本
+     */
+    private BigDecimal medicalTotalCostIndirect = BigDecimal.ZERO;
+
+    /**
+     * 医疗全成本合计 - 全成本
+     */
+    private BigDecimal medicalTotalCost = BigDecimal.ZERO;
+
+    /**
+     * 科教经费形成的各项费用 - 直接成本
+     */
+    private BigDecimal educationalExpensesDirect = BigDecimal.ZERO;
+
+    /**
+     * 科教经费形成的各项费用 - 间接成本
+     */
+    private BigDecimal educationalExpensesIndirect = BigDecimal.ZERO;
+
+    /**
+     * 科教经费形成的各项费用 - 全成本
+     */
+    private BigDecimal educationalExpenses = BigDecimal.ZERO;
+
+    /**
+     * 资产处置费用、上缴上级费用、对附属单位补助费用、其他费用等 - 直接成本
+     */
+    private BigDecimal assetDisposalFeesDirect = BigDecimal.ZERO;
+
+    /**
+     * 资产处置费用、上缴上级费用、对附属单位补助费用、其他费用等 - 间接成本
+     */
+    private BigDecimal assetDisposalFeesIndirect = BigDecimal.ZERO;
+
+    /**
+     * 资产处置费用、上缴上级费用、对附属单位补助费用、其他费用等 - 全成本
+     */
+    private BigDecimal assetDisposalFees = BigDecimal.ZERO;
+
+    /**
+     * 医院全成本合计 - 直接成本
+     */
+    private BigDecimal hospitalTotalCostDirect = BigDecimal.ZERO;
+
+    /**
+     * 医院全成本合计 - 间接成本
+     */
+    private BigDecimal hospitalTotalCostIndirect = BigDecimal.ZERO;
+
+    /**
+     * 医院全成本合计 - 全成本
+     */
+    private BigDecimal hospitalTotalCost = BigDecimal.ZERO;
+}

+ 7 - 5
src/main/java/com/kcim/web/StandardReportController.java

@@ -34,13 +34,15 @@ public class StandardReportController extends AbstractController {
         return Result.ok(standardReportService.getDeptFullDirectCost(computeDate));
     }
 
-    /**
-     * 获取科室成本明细数据
-     *
-     * @return 科室成本明细数据列表
-     */
+    @ApiOperation("获取临床服务类科室全成本(医疗成本)")
     @GetMapping("/getClinicalDeptMedicalCost")
     public Result getClinicalDeptMedicalCost(@RequestParam String computeDate) {
         return Result.ok(standardReportService.getClinicalDeptMedicalCost(computeDate));
     }
+
+    @ApiOperation("获取临床服务类科室全成本(全成本)")
+    @GetMapping("/getClinicalDeptFullCost")
+    public Result getClinicalDeptFullCost(@RequestParam String computeDate) {
+        return Result.ok(standardReportService.getClinicalDeptFullCost(computeDate));
+    }
 }