Przeglądaj źródła

添加医院科室诊次成本表相关代码

JammeyJiang 3 miesięcy temu
rodzic
commit
cb20b42a6c

+ 1 - 1
src/main/java/com/kcim/dao/mapper/AllocationQueryMapper.java

@@ -31,7 +31,7 @@ public interface AllocationQueryMapper extends BaseMapper<AllocationQuery> {
     BigDecimal getTotalByAccountAndRespCode(@Param("hospId") Long hospId, @Param("dateYear") int dateYear, @Param("month") int month, @Param("accountCode") String accountCode, @Param("responsibilityCode") String responsibilityCode);
 
     /**
-     * 获取医院所有会计科目成本
+     * 获取医院所有会计科目成本(临床层的)
      * @param hospId
      * @param dateYear
      * @param month

+ 7 - 0
src/main/java/com/kcim/service/StandardReportService.java

@@ -54,4 +54,11 @@ public interface StandardReportService {
      */
     List<HospitalVisitCostCompositionVO> getHospitalVisitCostComposition(String computeDate);
 
+    /**
+     * 获取医院科室诊次成本表数据
+     * @param computeDate 核算年月
+     * @return 报表数据
+     */
+    List<DeptFullDirectCostVO> getHospitalDeptVisitCost(String computeDate);
+
 }

+ 251 - 168
src/main/java/com/kcim/service/impl/StandardReportServiceImpl.java

@@ -1,13 +1,12 @@
 package com.kcim.service.impl;
 
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
 import com.kcim.common.constants.Constant;
 import com.kcim.common.constants.NumberConstant;
 import com.kcim.common.constants.ParameterConstant;
 import com.kcim.common.constants.SplitConstant;
 import com.kcim.common.exception.CostException;
 import com.kcim.common.util.BeanUtil;
+import com.kcim.common.util.ComputeDateUtils;
 import com.kcim.common.util.UserContext;
 import com.kcim.dao.model.*;
 import com.kcim.dao.repository.AccountingRepository;
@@ -18,7 +17,6 @@ import com.kcim.service.CenterService;
 import com.kcim.service.IncomeCollectionService;
 import com.kcim.service.StandardReportService;
 import com.kcim.vo.*;
-import com.kcim.vo.HospitalDeptCostAllocationVO;
 import com.kcim.web.reponse.ComputeProfitCollectResponse;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -64,9 +62,8 @@ public class StandardReportServiceImpl implements StandardReportService {
      */
     @Override
     public List<DeptDirectMedicalCostVO> getDeptDirectMedicalCost(String computeDate) {
-        DateTime parse = DateUtil.parse(computeDate);
-        int year = DateUtil.year(parse);
-        int month = DateUtil.month(parse) + 1;
+        Integer year = ComputeDateUtils.getComputeYear(computeDate);
+        Integer month = ComputeDateUtils.getComputeMonth(computeDate);
         //获取科室直接成本
         List<AllocationQuery> allocationQueryList = allocationQueryService.getCostByDate(UserContext.getCurrentLoginHospId(), year, month, NumberConstant.ONE);
         if(CollectionUtils.isEmpty(allocationQueryList)){
@@ -132,9 +129,8 @@ public class StandardReportServiceImpl implements StandardReportService {
      */
     @Override
     public List<DeptFullDirectCostVO> getDeptFullDirectCost(String computeDate) {
-        DateTime parse = DateUtil.parse(computeDate);
-        int year = DateUtil.year(parse);
-        int month = DateUtil.month(parse) + 1;
+        Integer year = ComputeDateUtils.getComputeYear(computeDate);
+        Integer month = ComputeDateUtils.getComputeMonth(computeDate);
         
         // 获取科室直接成本
         List<AllocationQuery> allocationQueryList = allocationQueryService.getCostByDate(UserContext.getCurrentLoginHospId(), year, month, NumberConstant.ONE);
@@ -200,9 +196,8 @@ public class StandardReportServiceImpl implements StandardReportService {
      */
     @Override
     public List<ClinicalDeptMedicalCostVO> getClinicalDeptMedicalCost(String computeDate) {
-        DateTime parse = DateUtil.parse(computeDate);
-        int year = DateUtil.year(parse);
-        int month = DateUtil.month(parse) + 1;
+        Integer year = ComputeDateUtils.getComputeYear(computeDate);
+        Integer month = ComputeDateUtils.getComputeMonth(computeDate);
         // 获取科室直接成本
         List<AllocationQuery> allocationQueryList = allocationQueryService.getAllByDate(UserContext.getCurrentLoginHospId(), year, month);
         if (CollectionUtils.isEmpty(allocationQueryList)) {
@@ -234,9 +229,8 @@ public class StandardReportServiceImpl implements StandardReportService {
      */
     @Override
     public List<ClinicalDeptFullCostVO> getClinicalDeptFullCost(String computeDate) {
-        DateTime parse = DateUtil.parse(computeDate);
-        int year = DateUtil.year(parse);
-        int month = DateUtil.month(parse) + 1;
+        Integer year = ComputeDateUtils.getComputeYear(computeDate);
+        Integer month = ComputeDateUtils.getComputeMonth(computeDate);
 
         // 获取科室直接成本
         List<AllocationQuery> allocationQueryList = allocationQueryService.getAllByDate(UserContext.getCurrentLoginHospId(), year, month);
@@ -277,9 +271,8 @@ public class StandardReportServiceImpl implements StandardReportService {
      */
     @Override
     public ComputeProfitCollectResponse getClinicalDeptFullCostAnalysis(String computeDate) {
-        DateTime parse = DateUtil.parse(computeDate);
-        int year = DateUtil.year(parse);
-        int month = DateUtil.month(parse) + 1;
+        Integer year = ComputeDateUtils.getComputeYear(computeDate);
+        Integer month = ComputeDateUtils.getComputeMonth(computeDate);
 
         // 获取科室成本
         List<AllocationQuery> allocationQueryList = allocationQueryService.getAllByDate(UserContext.getCurrentLoginHospId(), year, month);
@@ -386,6 +379,246 @@ public class StandardReportServiceImpl implements StandardReportService {
         return response;
     }
 
+    /**
+     * 获取医院科室成本分摊汇总表数据
+     * @param computeDate 核算年月
+     * @return 报表数据
+     */
+    @Override
+    public List<HospitalDeptCostAllocationVO> getHospitalDeptCostAllocation(String computeDate) {
+        Integer year = ComputeDateUtils.getComputeYear(computeDate);
+        Integer month = ComputeDateUtils.getComputeMonth(computeDate);
+
+        // 获取科室成本
+        List<AllocationQuery> allocationQueryList = allocationQueryService.getAllByDate(UserContext.getCurrentLoginHospId(), year, month);
+        if (CollectionUtils.isEmpty(allocationQueryList)) {
+            throw new CostException("医院未分摊本月数据");
+        }
+
+        // 获取所有的标准字典数据
+        StandCostDictMapVO standCostDictMaps = getStandCostDictMaps();
+
+        // 处理 allocationQueryList 数据
+        Map<String, HospitalDeptCostAllocationVO> deptCostAllocationMap = new HashMap<>();
+
+        // 转换为HospitalDeptCostAllocationVO(一个责任中心只一条记录)
+        for (AllocationQuery allocationQuery : allocationQueryList) {
+            addHospitalDeptCostAllocationVO(deptCostAllocationMap, allocationQuery, standCostDictMaps);
+        }
+
+        // 转成List便于处理
+        List<HospitalDeptCostAllocationVO> reportList = new ArrayList<>(deptCostAllocationMap.values());
+        //创建总计
+        HospitalDeptCostAllocationVO grandTotal = createSubtotalVo(reportList.get(NumberConstant.ZERO), "总计", HospitalDeptCostAllocationVO.class);
+        // 按responsibilitySort正序排序
+        reportList.sort(Comparator.comparing(HospitalDeptCostAllocationVO::getResponsibilitySort,
+                Comparator.nullsLast(Comparator.naturalOrder())));
+
+        // 按标准分级分组
+        Map<String, List<HospitalDeptCostAllocationVO>> shareLevelGroup = reportList.stream()
+                .collect(Collectors.groupingBy(HospitalDeptCostAllocationVO::getStandardShareLevel));
+
+        // 科室标准分级按顺序号倒序排序
+        List<DictDataVo> standardShareLevelList = standCostDictMaps.getStandardShareLevelDict();
+        standardShareLevelList.sort(Comparator.comparing(DictDataVo::getSort, Comparator.nullsLast(Comparator.reverseOrder())));
+
+        // 创建各层级小计并按正确顺序插入
+        List<HospitalDeptCostAllocationVO> result = new ArrayList<>();
+        for (DictDataVo shareLevel : standardShareLevelList) {
+            List<HospitalDeptCostAllocationVO> deptCostAllocationVOS = shareLevelGroup.get(shareLevel.getCode());
+            if (CollectionUtils.isEmpty(deptCostAllocationVOS)) {
+                continue;
+            }
+            // 添加该分类下的所有记录
+            result.addAll(deptCostAllocationVOS);
+            // 创建小计对象
+            HospitalDeptCostAllocationVO subtotalVo = createSubtotalVo(deptCostAllocationVOS.get(NumberConstant.ZERO), String.format("%s小计", shareLevel.getName()), HospitalDeptCostAllocationVO.class);
+            //将科室的金额加到小计对象中
+            deptCostAllocationVOS.forEach(item -> addBigDecimalFields(item, subtotalVo));
+            // 小计的金额加到总计
+            addBigDecimalFields(subtotalVo, grandTotal);
+            // 添加小计行
+            result.add(subtotalVo);
+        }
+        // 总计加到列表最后面
+        result.add(grandTotal);
+        return result;
+    }
+
+    /**
+     * 获取医院诊次成本构成表数据
+     * @param computeDate 核算年月
+     * @return 报表数据
+     */
+    @Override
+    public List<HospitalVisitCostCompositionVO> getHospitalVisitCostComposition(String computeDate) {
+        Integer year = ComputeDateUtils.getComputeYear(computeDate);
+        Integer month = ComputeDateUtils.getComputeMonth(computeDate);
+
+        // 获取科室成本
+        List<AllocationQuery> allocationQueryList = allocationQueryService.getAcountAccounts(UserContext.getCurrentLoginHospId(), year, month);
+        if (CollectionUtils.isEmpty(allocationQueryList)) {
+            throw new CostException("医院未分摊本月数据");
+        }
+        //获取分摊参数
+        List<ShareParamValue> shareParamValueList = shareParamValueRepository.getList(computeDate);
+        if (CollectionUtils.isEmpty(shareParamValueList)) {
+            throw new CostException("未获取医院本月分摊参数数据");
+        }
+        // 获取所有的标准字典数据
+        StandCostDictMapVO standCostDictMaps = getStandCostDictMaps();
+        //获取成本会计科目字典
+        List<DictDataVo> accountingTypeDict = standCostDictMaps.getAccountingTypeDict();
+        List<DictDataVo> costAccountingTypeDict = accountingTypeDict.stream().filter(dictDataVo -> NumberConstant.TWO_S.equals(dictDataVo.getValue())).collect(Collectors.toList());
+        // 初始化成本项目映射
+        Map<String, HospitalVisitCostCompositionVO> costItemMap =createHospitalVisitCostCompositionVO(costAccountingTypeDict);
+        // 处理分配查询数据
+        for (AllocationQuery allocationQuery : allocationQueryList) {
+            String accountingCode = allocationQuery.getAccountingCode();
+            Accounting account = standCostDictMaps.getAccountingMap().get(accountingCode);
+            if (account == null) {
+                continue;
+            }
+            DictDataVo costType = standCostDictMaps.getCostTypeMap().get(account.getCostType());
+            HospitalVisitCostCompositionVO vo = costItemMap.get(account.getType());
+            // 医疗成本
+            if ("1".equals(costType.getExpandOne())) {
+                vo.setMedicalCost(vo.getMedicalCost().add(allocationQuery.getAmount()));
+            }
+            // 医疗全成本
+            if (!"3".equals(costType.getExpandOne())) {
+                vo.setMedicalFullCost(vo.getMedicalFullCost().add(allocationQuery.getAmount()));
+            }
+            // 医院全成本
+            vo.setHospitalFullCost(vo.getHospitalFullCost().add(allocationQuery.getAmount()));
+        }
+        //获取诊次床日分摊参数代码
+        String[] visitsBedDaysParamCode = getVisitsBedDaysParamCode();
+
+        // 诊次分摊参数值
+        BigDecimal visitParamValue = getParamValue(shareParamValueList, visitsBedDaysParamCode[NumberConstant.ZERO]);
+//        // 床日分摊参数值
+//        BigDecimal bedDaysParamValue = getParamValue(shareParamValueList, visitsBedDaysParamCode[NumberConstant.ONE]);
+
+        //处理总计和药品小计
+        HospitalVisitCostCompositionVO totalVo = new HospitalVisitCostCompositionVO();
+        totalVo.setCostItem("总计");
+        HospitalVisitCostCompositionVO drugTotalVo = new HospitalVisitCostCompositionVO();
+        totalVo.setCostItem("药品费");
+        // 转成List便于处理
+        List<HospitalVisitCostCompositionVO> reportList = costItemMap.values().stream().collect(Collectors.toList());
+        for (HospitalVisitCostCompositionVO item : reportList) {
+            //计算每诊次的医疗全成本
+            item.setHospitalFullCost(getPercent(visitParamValue,totalVo.getHospitalFullCost()));
+            //计算每诊次的医疗成本
+            item.setMedicalCost(getPercent(visitParamValue,totalVo.getMedicalCost()));
+            //计算每诊次的医院全成本
+            item.setHospitalFullCost(getPercent(visitParamValue,totalVo.getMedicalFullCost()));
+            // 将金额加到总计对象中
+            addBigDecimalFields(item, totalVo);
+            /// 将金额加到药品对象中
+            if(NumberConstant.THREE_S.equals(item.getCostType())){
+                addBigDecimalFields(item, drugTotalVo);
+            }
+        }
+        //添加到列表的指定位置
+        reportList.add(NumberConstant.TWO,drugTotalVo);
+        reportList.add(NumberConstant.ZERO,totalVo);
+        return reportList;
+    }
+    /**
+     * 获取医院科室诊次成本表数据
+     * @param computeDate 核算年月
+     * @return 报表数据
+     */
+    @Override
+    public List<DeptFullDirectCostVO> getHospitalDeptVisitCost(String computeDate) {
+        Integer year = ComputeDateUtils.getComputeYear(computeDate);
+        Integer month = ComputeDateUtils.getComputeMonth(computeDate);
+
+        // 获取科室成本
+        List<AllocationQuery> allocationQueryList = allocationQueryService.getRespAcountAccounts(UserContext.getCurrentLoginHospId(), year, month);
+        if (CollectionUtils.isEmpty(allocationQueryList)) {
+            throw new CostException("医院未分摊本月数据");
+        }
+        // 获取所有的标准字典数据
+        StandCostDictMapVO standCostDictMaps = getStandCostDictMaps();
+
+        // 获取分摊参数
+        List<ShareParamValue> shareParamValueList = shareParamValueRepository.getList(computeDate);
+        if (CollectionUtils.isEmpty(shareParamValueList)) {
+            throw new CostException("未获取医院本月分摊参数数据");
+        }
+        // 获取诊次床日分摊参数代码
+        String[] visitsBedDaysParamCode = getVisitsBedDaysParamCode();
+        BigDecimal visitParamValue = getParamValue(shareParamValueList, visitsBedDaysParamCode[NumberConstant.ZERO]);
+
+        // 处理 allocationQueryList 数据
+        Map<String, DeptFullDirectCostVO> deptVisitCostMap = new HashMap<>();
+
+        for (AllocationQuery allocationQuery : allocationQueryList) {
+            String responsibilityCode = allocationQuery.getTargetResponsibilityCode();
+            Responsibility responsibility = standCostDictMaps.getResponsibilityMap().get(responsibilityCode);
+            if (responsibility == null) {
+                continue;
+            }
+            String accountingCode = allocationQuery.getAccountingCode();
+            Accounting account = standCostDictMaps.getAccountingMap().get(accountingCode);
+            if (account == null) {
+                continue;
+            }
+            //只处理临床科室
+            if(NumberConstant.FOUR.equals(responsibility.getStandardShareLevel())){
+                continue;
+            }
+
+            DeptFullDirectCostVO vo = new DeptFullDirectCostVO();
+            if (deptVisitCostMap.containsKey(responsibilityCode)) {
+                vo = deptVisitCostMap.get(responsibilityCode);
+            } else {
+                // 初始化科室信息
+                vo.setResponsibilityCode(responsibility.getResponsibilityCode());
+                vo.setResponsibilityName(responsibility.getResponsibilityName());
+                vo.setResponsibilitySort(responsibility.getSort());
+                // 初始化所有费用字段为0
+                BeanUtil.initBigDecimalFieldsToZero(vo);
+            }
+            DictDataVo costType = standCostDictMaps.getCostTypeMap().get(account.getCostType());
+            // 医疗成本
+            if ("1".equals(costType.getExpandOne())) {
+                vo.setMedicalCostTotal(vo.getMedicalCostTotal().add(allocationQuery.getAmount()));
+            }
+            // 医疗全成本
+            if (!"3".equals(costType.getExpandOne())) {
+                vo.setMedicalTotalCost(vo.getMedicalTotalCost().add(allocationQuery.getAmount()));
+            }
+            // 医院全成本
+            vo.setHospitalTotalCost(vo.getHospitalTotalCost().add(allocationQuery.getAmount()));
+        }
+
+        // 转成List便于处理
+        List<DeptFullDirectCostVO> reportList = new ArrayList<>(deptVisitCostMap.values());
+        // 创建总计对象
+        DeptFullDirectCostVO grandTotal = createSubtotalVo(reportList.get(NumberConstant.ZERO), "总计", DeptFullDirectCostVO.class);
+        // 计算每诊次成本
+        for (DeptFullDirectCostVO vo : reportList) {
+            // 计算每诊次医疗成本
+            vo.setMedicalCostTotal(getPercent(vo.getMedicalCostTotal(), visitParamValue));
+            // 计算每诊次医疗全成本
+            vo.setMedicalTotalCost(getPercent(vo.getMedicalTotalCost(), visitParamValue));
+            // 计算每诊次医院全成本
+            vo.setHospitalTotalCost(getPercent(vo.getHospitalTotalCost(), visitParamValue));
+            // 将各科室金额累加到总计对象
+            reportList.forEach(item -> addBigDecimalFields(item, grandTotal));
+        }
+        // 按responsibilitySort正序排序
+        reportList.sort(Comparator.comparing(DeptFullDirectCostVO::getResponsibilitySort,
+                Comparator.nullsLast(Comparator.naturalOrder())));
+        // 添加总计行
+        reportList.add(NumberConstant.ZERO,grandTotal);
+        return reportList;
+    }
+
     /**
      * 获取可是指定项目的金额
      * @param dept
@@ -1045,156 +1278,6 @@ public class StandardReportServiceImpl implements StandardReportService {
         return split;
     }
 
-    /**
-     * 获取医院科室成本分摊汇总表数据
-     * @param computeDate 核算年月
-     * @return 报表数据
-     */
-    @Override
-    public List<HospitalDeptCostAllocationVO> getHospitalDeptCostAllocation(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)) {
-            throw new CostException("医院未分摊本月数据");
-        }
-
-        // 获取所有的标准字典数据
-        StandCostDictMapVO standCostDictMaps = getStandCostDictMaps();
-
-        // 处理 allocationQueryList 数据
-        Map<String, HospitalDeptCostAllocationVO> deptCostAllocationMap = new HashMap<>();
-
-        // 转换为HospitalDeptCostAllocationVO(一个责任中心只一条记录)
-        for (AllocationQuery allocationQuery : allocationQueryList) {
-            addHospitalDeptCostAllocationVO(deptCostAllocationMap, allocationQuery, standCostDictMaps);
-        }
-
-        // 转成List便于处理
-        List<HospitalDeptCostAllocationVO> reportList = new ArrayList<>(deptCostAllocationMap.values());
-        //创建总计
-        HospitalDeptCostAllocationVO grandTotal = createSubtotalVo(reportList.get(NumberConstant.ZERO), "总计", HospitalDeptCostAllocationVO.class);
-        // 按responsibilitySort正序排序
-        reportList.sort(Comparator.comparing(HospitalDeptCostAllocationVO::getResponsibilitySort,
-                Comparator.nullsLast(Comparator.naturalOrder())));
-
-        // 按标准分级分组
-        Map<String, List<HospitalDeptCostAllocationVO>> shareLevelGroup = reportList.stream()
-                .collect(Collectors.groupingBy(HospitalDeptCostAllocationVO::getStandardShareLevel));
-
-        // 科室标准分级按顺序号倒序排序
-        List<DictDataVo> standardShareLevelList = standCostDictMaps.getStandardShareLevelDict();
-        standardShareLevelList.sort(Comparator.comparing(DictDataVo::getSort, Comparator.nullsLast(Comparator.reverseOrder())));
-
-        // 创建各层级小计并按正确顺序插入
-        List<HospitalDeptCostAllocationVO> result = new ArrayList<>();
-        for (DictDataVo shareLevel : standardShareLevelList) {
-            List<HospitalDeptCostAllocationVO> deptCostAllocationVOS = shareLevelGroup.get(shareLevel.getCode());
-            if (CollectionUtils.isEmpty(deptCostAllocationVOS)) {
-                continue;
-            }
-            // 添加该分类下的所有记录
-            result.addAll(deptCostAllocationVOS);
-            // 创建小计对象
-            HospitalDeptCostAllocationVO subtotalVo = createSubtotalVo(deptCostAllocationVOS.get(NumberConstant.ZERO), String.format("%s小计", shareLevel.getName()), HospitalDeptCostAllocationVO.class);
-            //将科室的金额加到小计对象中
-            deptCostAllocationVOS.forEach(item -> addBigDecimalFields(item, subtotalVo));
-            // 小计的金额加到总计
-            addBigDecimalFields(subtotalVo, grandTotal);
-            // 添加小计行
-            result.add(subtotalVo);
-        }
-        // 总计加到列表最后面
-        result.add(grandTotal);
-        return result;
-    }
-
-    /**
-     * 获取医院诊次成本构成表数据
-     * @param computeDate 核算年月
-     * @return 报表数据
-     */
-    @Override
-    public List<HospitalVisitCostCompositionVO> getHospitalVisitCostComposition(String computeDate) {
-        DateTime parse = DateUtil.parse(computeDate);
-        int year = DateUtil.year(parse);
-        int month = DateUtil.month(parse) + 1;
-
-        // 获取科室成本
-        List<AllocationQuery> allocationQueryList = allocationQueryService.getAcountAccounts(UserContext.getCurrentLoginHospId(), year, month);
-        if (CollectionUtils.isEmpty(allocationQueryList)) {
-            throw new CostException("医院未分摊本月数据");
-        }
-        //获取分摊参数
-        List<ShareParamValue> shareParamValueList = shareParamValueRepository.getList(computeDate);
-        if (CollectionUtils.isEmpty(shareParamValueList)) {
-            throw new CostException("未获取医院本月分摊参数数据");
-        }
-        // 获取所有的标准字典数据
-        StandCostDictMapVO standCostDictMaps = getStandCostDictMaps();
-        //获取成本会计科目字典
-        List<DictDataVo> accountingTypeDict = standCostDictMaps.getAccountingTypeDict();
-        List<DictDataVo> costAccountingTypeDict = accountingTypeDict.stream().filter(dictDataVo -> NumberConstant.TWO_S.equals(dictDataVo.getValue())).collect(Collectors.toList());
-        // 初始化成本项目映射
-        Map<String, HospitalVisitCostCompositionVO> costItemMap =createHospitalVisitCostCompositionVO(costAccountingTypeDict);
-        // 处理分配查询数据
-        for (AllocationQuery allocationQuery : allocationQueryList) {
-            String accountingCode = allocationQuery.getAccountingCode();
-            Accounting account = standCostDictMaps.getAccountingMap().get(accountingCode);
-            if (account == null) {
-                continue;
-            }
-            DictDataVo costType = standCostDictMaps.getCostTypeMap().get(account.getCostType());
-            HospitalVisitCostCompositionVO vo = costItemMap.get(account.getType());
-            // 医疗成本
-            if ("1".equals(costType.getExpandOne())) {
-                vo.setMedicalCost(vo.getMedicalCost().add(allocationQuery.getAmount()));
-            }
-            // 医疗全成本
-            if (!"3".equals(costType.getExpandOne())) {
-                vo.setMedicalFullCost(vo.getMedicalFullCost().add(allocationQuery.getAmount()));
-            }
-            // 医院全成本
-            vo.setHospitalFullCost(vo.getHospitalFullCost().add(allocationQuery.getAmount()));
-        }
-        //获取诊次床日分摊参数代码
-        String[] visitsBedDaysParamCode = getVisitsBedDaysParamCode();
-
-        // 诊次分摊参数值
-        BigDecimal visitParamValue = getParamValue(shareParamValueList, visitsBedDaysParamCode[NumberConstant.ZERO]);
-//        // 床日分摊参数值
-//        BigDecimal bedDaysParamValue = getParamValue(shareParamValueList, visitsBedDaysParamCode[NumberConstant.ONE]);
-
-        //处理总计和药品小计
-        HospitalVisitCostCompositionVO totalVo = new HospitalVisitCostCompositionVO();
-        totalVo.setCostItem("总计");
-        HospitalVisitCostCompositionVO drugTotalVo = new HospitalVisitCostCompositionVO();
-        totalVo.setCostItem("药品费");
-        // 转成List便于处理
-        List<HospitalVisitCostCompositionVO> reportList = costItemMap.values().stream().collect(Collectors.toList());
-        for (HospitalVisitCostCompositionVO item : reportList) {
-            //计算每诊次的医疗全成本
-            item.setHospitalFullCost(getPercent(visitParamValue,totalVo.getHospitalFullCost()));
-            //计算每诊次的医疗成本
-            item.setMedicalCost(getPercent(visitParamValue,totalVo.getMedicalCost()));
-            //计算每诊次的医院全成本
-            item.setHospitalFullCost(getPercent(visitParamValue,totalVo.getMedicalFullCost()));
-            // 将金额加到总计对象中
-            addBigDecimalFields(item, totalVo);
-            /// 将金额加到药品对象中
-            if(NumberConstant.THREE_S.equals(item.getCostType())){
-                addBigDecimalFields(item, drugTotalVo);
-            }
-        }
-        //添加到列表的指定位置
-        reportList.add(NumberConstant.TWO,drugTotalVo);
-        reportList.add(NumberConstant.ZERO,totalVo);
-        return reportList;
-    }
-
     /**
      * 添加医院科室成本分摊数据
      * @param deptCostAllocationMap 科室成本分摊Map

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

@@ -34,35 +34,41 @@ public class StandardReportController extends AbstractController {
         return Result.ok(standardReportService.getDeptFullDirectCost(computeDate));
     }
 
-    @ApiOperation("获取临床服务类科室全成本(医疗成本)")
+    @ApiOperation("临床服务类科室全成本(医疗成本)")
     @GetMapping("/getClinicalDeptMedicalCost")
     public Result getClinicalDeptMedicalCost(@RequestParam String computeDate) {
         return Result.ok(standardReportService.getClinicalDeptMedicalCost(computeDate));
     }
 
-    @ApiOperation("获取临床服务类科室全成本(全成本)")
+    @ApiOperation("临床服务类科室全成本(全成本)")
     @GetMapping("/getClinicalDeptFullCost")
     public Result getClinicalDeptFullCost(@RequestParam String computeDate) {
         return Result.ok(standardReportService.getClinicalDeptFullCost(computeDate));
     }
 
-    @ApiOperation("获取临床服务类科室全成本构成分析表")
+    @ApiOperation("临床服务类科室全成本构成分析表")
     @GetMapping("/getClinicalDeptFullCostAnalysis")
     public Result getClinicalDeptFullCostAnalysis(@RequestParam String computeDate) {
         return Result.ok(standardReportService.getClinicalDeptFullCostAnalysis(computeDate));
     }
 
-    @ApiOperation("获取医院科室成本分摊汇总表")
+    @ApiOperation("医院科室成本分摊汇总表")
     @GetMapping("/getHospitalDeptCostAllocation")
     public Result getHospitalDeptCostAllocation(@RequestParam String computeDate) {
         return Result.ok(standardReportService.getHospitalDeptCostAllocation(computeDate));
     }
 
-    @ApiOperation("获取医院诊次成本构成表")
+    @ApiOperation("医院诊次成本构成表")
     @GetMapping("/getHospitalVisitCostComposition")
     public Result getHospitalVisitCostComposition(@RequestParam String computeDate) {
         return Result.ok(standardReportService.getHospitalVisitCostComposition(computeDate));
     }
 
+    @ApiOperation("医院科室诊次成本表")
+    @GetMapping("/getHospitalDeptVisitCost")
+    public Result getHospitalDeptVisitCost(@RequestParam String computeDate) {
+        return Result.ok(standardReportService.getHospitalDeptVisitCost(computeDate));
+    }
+
 
 }

+ 9 - 7
src/main/resources/mapper/AllocationQueryMapper.xml

@@ -91,18 +91,20 @@
             accounting_code,
             IFNULL( sum( amount ), 0 ) AS amount
         FROM
-            cost_allocation_query
+            cost_allocation_query a
+            INNER JOIN cost_responsibility b on .a.target_responsibility_code=b.responsibility_code AND b.delete_time=0 AND b.hosp_id= #{hospId}
         WHERE
-            date_year = #{dateYear}
-          AND date_month = #{month}
-          AND hosp_id = #{hospId}
-          AND delete_time = 0
+            a.date_year = #{dateYear}
+          AND a.date_month = #{month}
+          AND a.hosp_id = #{hospId}
+          AND a.delete_time = 0
+          AND b.standard_share_level=4
         GROUP BY
-            accounting_code
+            a.accounting_code
     </select>
     <select id="getRespAcountAccounts" resultType="com.kcim.dao.model.AllocationQuery">
         SELECT
-            responsibility_code,
+            target_responsibility_code as responsibility_code,
             accounting_code,
             IFNULL( sum( amount ), 0 ) AS amount
         FROM