|
@@ -532,7 +532,7 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
* @return 报表数据
|
|
* @return 报表数据
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public List<DeptFullDirectCostVO> getHospitalDeptVisitCost(String computeDate) {
|
|
|
|
|
|
|
+ public List<HospitalVisitCostCompositionVO> getHospitalDeptVisitCost(String computeDate) {
|
|
|
Integer year = ComputeDateUtils.getComputeYear(computeDate);
|
|
Integer year = ComputeDateUtils.getComputeYear(computeDate);
|
|
|
Integer month = ComputeDateUtils.getComputeMonth(computeDate);
|
|
Integer month = ComputeDateUtils.getComputeMonth(computeDate);
|
|
|
|
|
|
|
@@ -554,7 +554,7 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
BigDecimal visitParamValue = getParamValue(shareParamValueList, visitsBedDaysParamCode[NumberConstant.ZERO]);
|
|
BigDecimal visitParamValue = getParamValue(shareParamValueList, visitsBedDaysParamCode[NumberConstant.ZERO]);
|
|
|
|
|
|
|
|
// 处理 allocationQueryList 数据
|
|
// 处理 allocationQueryList 数据
|
|
|
- Map<String, DeptFullDirectCostVO> deptVisitCostMap = new HashMap<>();
|
|
|
|
|
|
|
+ Map<String, HospitalVisitCostCompositionVO> deptVisitCostMap = new HashMap<>();
|
|
|
|
|
|
|
|
for (AllocationQuery allocationQuery : allocationQueryList) {
|
|
for (AllocationQuery allocationQuery : allocationQueryList) {
|
|
|
String responsibilityCode = allocationQuery.getTargetResponsibilityCode();
|
|
String responsibilityCode = allocationQuery.getTargetResponsibilityCode();
|
|
@@ -572,7 +572,7 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- DeptFullDirectCostVO vo = new DeptFullDirectCostVO();
|
|
|
|
|
|
|
+ HospitalVisitCostCompositionVO vo = new HospitalVisitCostCompositionVO();
|
|
|
if (deptVisitCostMap.containsKey(responsibilityCode)) {
|
|
if (deptVisitCostMap.containsKey(responsibilityCode)) {
|
|
|
vo = deptVisitCostMap.get(responsibilityCode);
|
|
vo = deptVisitCostMap.get(responsibilityCode);
|
|
|
} else {
|
|
} else {
|
|
@@ -586,39 +586,213 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
DictDataVo costType = standCostDictMaps.getCostTypeMap().get(account.getCostType());
|
|
DictDataVo costType = standCostDictMaps.getCostTypeMap().get(account.getCostType());
|
|
|
// 医疗成本
|
|
// 医疗成本
|
|
|
if ("1".equals(costType.getExpandOne())) {
|
|
if ("1".equals(costType.getExpandOne())) {
|
|
|
- vo.setMedicalCostTotal(vo.getMedicalCostTotal().add(allocationQuery.getAmount()));
|
|
|
|
|
|
|
+ vo.setMedicalCost(vo.getMedicalCost().add(allocationQuery.getAmount()));
|
|
|
}
|
|
}
|
|
|
// 医疗全成本
|
|
// 医疗全成本
|
|
|
if (!"3".equals(costType.getExpandOne())) {
|
|
if (!"3".equals(costType.getExpandOne())) {
|
|
|
- vo.setMedicalTotalCost(vo.getMedicalTotalCost().add(allocationQuery.getAmount()));
|
|
|
|
|
|
|
+ vo.setMedicalFullCost(vo.getMedicalFullCost().add(allocationQuery.getAmount()));
|
|
|
}
|
|
}
|
|
|
// 医院全成本
|
|
// 医院全成本
|
|
|
- vo.setHospitalTotalCost(vo.getHospitalTotalCost().add(allocationQuery.getAmount()));
|
|
|
|
|
|
|
+ vo.setHospitalFullCost(vo.getHospitalFullCost().add(allocationQuery.getAmount()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 转成List便于处理
|
|
// 转成List便于处理
|
|
|
- List<DeptFullDirectCostVO> reportList = new ArrayList<>(deptVisitCostMap.values());
|
|
|
|
|
|
|
+ List<HospitalVisitCostCompositionVO> reportList = new ArrayList<>(deptVisitCostMap.values());
|
|
|
// 创建总计对象
|
|
// 创建总计对象
|
|
|
- DeptFullDirectCostVO grandTotal = createSubtotalVo(reportList.get(NumberConstant.ZERO), "总计", DeptFullDirectCostVO.class);
|
|
|
|
|
|
|
+ HospitalVisitCostCompositionVO grandTotal = createSubtotalVo(reportList.get(NumberConstant.ZERO), "总计", HospitalVisitCostCompositionVO.class);
|
|
|
// 计算每诊次成本
|
|
// 计算每诊次成本
|
|
|
- for (DeptFullDirectCostVO vo : reportList) {
|
|
|
|
|
- // 计算每诊次医疗成本
|
|
|
|
|
- vo.setMedicalCostTotal(getPercent(vo.getMedicalCostTotal(), visitParamValue));
|
|
|
|
|
- // 计算每诊次医疗全成本
|
|
|
|
|
- vo.setMedicalTotalCost(getPercent(vo.getMedicalTotalCost(), visitParamValue));
|
|
|
|
|
- // 计算每诊次医院全成本
|
|
|
|
|
- vo.setHospitalTotalCost(getPercent(vo.getHospitalTotalCost(), visitParamValue));
|
|
|
|
|
|
|
+ for (HospitalVisitCostCompositionVO item : reportList) {
|
|
|
|
|
+ //计算每诊次的医疗全成本
|
|
|
|
|
+ item.setHospitalFullCost(getPercent(visitParamValue,item.getHospitalFullCost()));
|
|
|
|
|
+ //计算每诊次的医疗成本
|
|
|
|
|
+ item.setMedicalCost(getPercent(visitParamValue,item.getMedicalCost()));
|
|
|
|
|
+ //计算每诊次的医院全成本
|
|
|
|
|
+ item.setHospitalFullCost(getPercent(visitParamValue,item.getMedicalFullCost()));
|
|
|
// 将各科室金额累加到总计对象
|
|
// 将各科室金额累加到总计对象
|
|
|
- reportList.forEach(item -> addBigDecimalFields(item, grandTotal));
|
|
|
|
|
|
|
+ addBigDecimalFields(item, grandTotal);
|
|
|
}
|
|
}
|
|
|
// 按responsibilitySort正序排序
|
|
// 按responsibilitySort正序排序
|
|
|
- reportList.sort(Comparator.comparing(DeptFullDirectCostVO::getResponsibilitySort,
|
|
|
|
|
|
|
+ reportList.sort(Comparator.comparing(HospitalVisitCostCompositionVO::getResponsibilitySort,
|
|
|
Comparator.nullsLast(Comparator.naturalOrder())));
|
|
Comparator.nullsLast(Comparator.naturalOrder())));
|
|
|
// 添加总计行
|
|
// 添加总计行
|
|
|
reportList.add(NumberConstant.ZERO,grandTotal);
|
|
reportList.add(NumberConstant.ZERO,grandTotal);
|
|
|
return reportList;
|
|
return reportList;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取医院床日成本构成表数据
|
|
|
|
|
+ * @param computeDate 核算年月
|
|
|
|
|
+ * @return 报表数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<HospitalVisitCostCompositionVO> getHospitalBedDayCostComposition(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 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(bedDaysParamValue,totalVo.getHospitalFullCost()));
|
|
|
|
|
+ //计算每诊次的医疗成本
|
|
|
|
|
+ item.setMedicalCost(getPercent(bedDaysParamValue,totalVo.getMedicalCost()));
|
|
|
|
|
+ //计算每诊次的医院全成本
|
|
|
|
|
+ item.setHospitalFullCost(getPercent(bedDaysParamValue,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<HospitalVisitCostCompositionVO> getHospitalDeptBedDayCost(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("未获取医院本月分摊参数数据");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 处理 allocationQueryList 数据
|
|
|
|
|
+ Map<String, HospitalVisitCostCompositionVO> 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;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ HospitalVisitCostCompositionVO vo = new HospitalVisitCostCompositionVO();
|
|
|
|
|
+ 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.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()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 转成List便于处理
|
|
|
|
|
+ List<HospitalVisitCostCompositionVO> reportList = new ArrayList<>(deptVisitCostMap.values());
|
|
|
|
|
+ // 获取诊次床日分摊参数代码
|
|
|
|
|
+ String[] visitsBedDaysParamCode = getVisitsBedDaysParamCode();
|
|
|
|
|
+ BigDecimal bedDaysParamValue = getParamValue(shareParamValueList, visitsBedDaysParamCode[NumberConstant.ONE]);
|
|
|
|
|
+ // 创建总计对象
|
|
|
|
|
+ HospitalVisitCostCompositionVO grandTotal = createSubtotalVo(reportList.get(NumberConstant.ZERO), "总计", HospitalVisitCostCompositionVO.class);
|
|
|
|
|
+ // 计算每诊次成本
|
|
|
|
|
+ for (HospitalVisitCostCompositionVO item : reportList) {
|
|
|
|
|
+ //计算每诊次的医疗全成本
|
|
|
|
|
+ item.setHospitalFullCost(getPercent(bedDaysParamValue,item.getHospitalFullCost()));
|
|
|
|
|
+ //计算每诊次的医疗成本
|
|
|
|
|
+ item.setMedicalCost(getPercent(bedDaysParamValue,item.getMedicalCost()));
|
|
|
|
|
+ //计算每诊次的医院全成本
|
|
|
|
|
+ item.setHospitalFullCost(getPercent(bedDaysParamValue,item.getMedicalFullCost()));
|
|
|
|
|
+ // 将各科室金额累加到总计对象
|
|
|
|
|
+ addBigDecimalFields(item, grandTotal);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 按responsibilitySort正序排序
|
|
|
|
|
+ reportList.sort(Comparator.comparing(HospitalVisitCostCompositionVO::getResponsibilitySort,
|
|
|
|
|
+ Comparator.nullsLast(Comparator.naturalOrder())));
|
|
|
|
|
+ // 添加总计行
|
|
|
|
|
+ reportList.add(NumberConstant.ZERO,grandTotal);
|
|
|
|
|
+ return reportList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取可是指定项目的金额
|
|
* 获取可是指定项目的金额
|
|
|
* @param dept
|
|
* @param dept
|