|
|
@@ -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
|