|
@@ -922,11 +922,11 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
DictDataVo costType = standCostDictMaps.getCostTypeMap().get(projectCostAccount.getCostTypeCode());
|
|
DictDataVo costType = standCostDictMaps.getCostTypeMap().get(projectCostAccount.getCostTypeCode());
|
|
|
DiseaseCostDetailVO vo = new DiseaseCostDetailVO();
|
|
DiseaseCostDetailVO vo = new DiseaseCostDetailVO();
|
|
|
//已有的项目类别
|
|
//已有的项目类别
|
|
|
- if (diseaseCostMap.containsKey(projectCostAccount.getDiseaseCode())) {
|
|
|
|
|
- vo = diseaseCostMap.get(projectCostAccount.getDiseaseCode());
|
|
|
|
|
|
|
+ if (diseaseCostMap.containsKey(projectCostAccount.getItemCode())) {
|
|
|
|
|
+ vo = diseaseCostMap.get(projectCostAccount.getItemCode());
|
|
|
} else {
|
|
} else {
|
|
|
//新建一个项目类别对象
|
|
//新建一个项目类别对象
|
|
|
- diseaseCostMap.put(projectCostAccount.getDiseaseCode(), projectCostAccount);
|
|
|
|
|
|
|
+ diseaseCostMap.put(projectCostAccount.getItemCode(), projectCostAccount);
|
|
|
}
|
|
}
|
|
|
// 医疗成本
|
|
// 医疗成本
|
|
|
if ("1".equals(costType.getExpandOne())) {
|
|
if ("1".equals(costType.getExpandOne())) {
|
|
@@ -973,13 +973,13 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
DictDataVo accountType = standCostDictMaps.getAccountingTypeMap().get(projectCostAccount.getCostTypeCode());
|
|
DictDataVo accountType = standCostDictMaps.getAccountingTypeMap().get(projectCostAccount.getCostTypeCode());
|
|
|
DiseaseCostDetailVO vo = new DiseaseCostDetailVO();
|
|
DiseaseCostDetailVO vo = new DiseaseCostDetailVO();
|
|
|
//已有的项目类别
|
|
//已有的项目类别
|
|
|
- if (diseaseCostMap.containsKey(projectCostAccount.getDiseaseCode())) {
|
|
|
|
|
- vo = diseaseCostMap.get(projectCostAccount.getDiseaseCode());
|
|
|
|
|
|
|
+ if (diseaseCostMap.containsKey(projectCostAccount.getItemCode())) {
|
|
|
|
|
+ vo = diseaseCostMap.get(projectCostAccount.getItemCode());
|
|
|
} else {
|
|
} else {
|
|
|
- vo.setDiseaseCode(projectCostAccount.getDiseaseCode());
|
|
|
|
|
- vo.setDiseaseName(projectCostAccount.getDiseaseName());
|
|
|
|
|
|
|
+ vo.setItemCode(projectCostAccount.getItemCode());
|
|
|
|
|
+ vo.setItemName(projectCostAccount.getItemName());
|
|
|
//新建一个项目类别对象
|
|
//新建一个项目类别对象
|
|
|
- diseaseCostMap.put(projectCostAccount.getDiseaseCode(), vo);
|
|
|
|
|
|
|
+ diseaseCostMap.put(projectCostAccount.getItemCode(), vo);
|
|
|
}
|
|
}
|
|
|
//按会计科目类型累加费用
|
|
//按会计科目类型累加费用
|
|
|
addAccountTypeExpense(accountType.getExpandOne(), projectCostAccount.getHospitalFullCost(), vo);
|
|
addAccountTypeExpense(accountType.getExpandOne(), projectCostAccount.getHospitalFullCost(), vo);
|
|
@@ -1021,10 +1021,171 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
// 遍历每个项目生成科室金额
|
|
// 遍历每个项目生成科室金额
|
|
|
for (DiseaseCostDetailVO costItem : projectCostAccountList) {
|
|
for (DiseaseCostDetailVO costItem : projectCostAccountList) {
|
|
|
ReportFormCustomVo itemVo = new ReportFormCustomVo();
|
|
ReportFormCustomVo itemVo = new ReportFormCustomVo();
|
|
|
- if(diseaseCostMap.containsKey(costItem.getDiseaseCode())){
|
|
|
|
|
- itemVo=diseaseCostMap.get(costItem.getDiseaseCode());
|
|
|
|
|
|
|
+ if(diseaseCostMap.containsKey(costItem.getItemCode())){
|
|
|
|
|
+ itemVo=diseaseCostMap.get(costItem.getItemCode());
|
|
|
}else{
|
|
}else{
|
|
|
- itemVo.setReportName(costItem.getDiseaseName());
|
|
|
|
|
|
|
+ itemVo.setReportName(costItem.getItemName());
|
|
|
|
|
+ itemVo.setData(new ArrayList<>());
|
|
|
|
|
+ itemVo.setTotalValue(BigDecimal.ZERO);
|
|
|
|
|
+ }
|
|
|
|
|
+ //金额对象
|
|
|
|
|
+ ReportVo amountReportVo = new ReportVo();
|
|
|
|
|
+ amountReportVo.setCode(getResponsibilityAmountCode(costItem.getDepartmentCode()));
|
|
|
|
|
+ // 设置金额
|
|
|
|
|
+ amountReportVo.setValue(costItem.getHospitalFullCost());
|
|
|
|
|
+ // 添加金额
|
|
|
|
|
+ itemVo.getData().add(amountReportVo);
|
|
|
|
|
+ //计算总额
|
|
|
|
|
+ itemVo.setTotalValue(itemVo.getTotalValue().add(costItem.getHospitalFullCost()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<ReportFormCustomVo> diseaseCostDetailList =new ArrayList<>(diseaseCostMap.values());
|
|
|
|
|
+
|
|
|
|
|
+ // 遍历每个成本项目(列转行)
|
|
|
|
|
+ for (ReportFormCustomVo costItem : diseaseCostDetailList) {
|
|
|
|
|
+ if(CollectionUtils.isEmpty(costItem.getData())){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ for (ReportVo amountReportVo : costItem.getData()) {
|
|
|
|
|
+ //占比对象
|
|
|
|
|
+ ReportVo percentReportVo = new ReportVo();
|
|
|
|
|
+ percentReportVo.setCode(amountReportVo.getCode());
|
|
|
|
|
+ //计算百分比
|
|
|
|
|
+ BigDecimal percent = getPercent((BigDecimal)amountReportVo.getValue() , costItem.getTotalValue());
|
|
|
|
|
+ percentReportVo.setValue(percent);
|
|
|
|
|
+ // 添加百分比
|
|
|
|
|
+ costItem.getData().add(percentReportVo);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ComputeProfitCollectResponse response = new ComputeProfitCollectResponse();
|
|
|
|
|
+ response.setTitle(titleList);
|
|
|
|
|
+ response.setData(diseaseCostDetailList);
|
|
|
|
|
+
|
|
|
|
|
+ return response;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取医院DRG成本明细表数据
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param computeDate 核算年月
|
|
|
|
|
+ * @return DRG成本明细列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<DiseaseCostDetailVO> getDrgCostDetail(String computeDate) {
|
|
|
|
|
+ List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDrgCostDetailList(computeDate);
|
|
|
|
|
+ if(CollectionUtils.isEmpty(projectCostAccountList)){
|
|
|
|
|
+ throw new CostException("请先计算患者成本");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取所有的标准字典数据
|
|
|
|
|
+ StandCostDictMapVO standCostDictMaps = getStandCostDictMaps();
|
|
|
|
|
+ // 记录项目类别对象
|
|
|
|
|
+ Map<String, DiseaseCostDetailVO> drgeCostMap = new HashMap<>();
|
|
|
|
|
+ for (DiseaseCostDetailVO projectCostAccount : projectCostAccountList) {
|
|
|
|
|
+ //按项目类型累加数据
|
|
|
|
|
+ DictDataVo costType = standCostDictMaps.getCostTypeMap().get(projectCostAccount.getCostTypeCode());
|
|
|
|
|
+ DiseaseCostDetailVO vo = new DiseaseCostDetailVO();
|
|
|
|
|
+ //已有的项目类别
|
|
|
|
|
+ if (drgeCostMap.containsKey(projectCostAccount.getItemCode())) {
|
|
|
|
|
+ vo = drgeCostMap.get(projectCostAccount.getItemCode());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //新建一个项目类别对象
|
|
|
|
|
+ drgeCostMap.put(projectCostAccount.getItemCode(), projectCostAccount);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 医疗成本
|
|
|
|
|
+ if ("1".equals(costType.getExpandOne())) {
|
|
|
|
|
+ vo.setMedicalCost(vo.getMedicalCost().add(projectCostAccount.getHospitalFullCost()));
|
|
|
|
|
+ }
|
|
|
|
|
+ // 医疗全成本
|
|
|
|
|
+ if (!"3".equals(costType.getExpandOne())) {
|
|
|
|
|
+ vo.setMedicalFullCost(vo.getMedicalFullCost().add(projectCostAccount.getHospitalFullCost()));
|
|
|
|
|
+ }
|
|
|
|
|
+ // 医院全成本
|
|
|
|
|
+ vo.setHospitalFullCost(vo.getHospitalFullCost().add(projectCostAccount.getHospitalFullCost()));
|
|
|
|
|
+ // 服务量
|
|
|
|
|
+ vo.setServiceVolume(projectCostAccount.getServiceVolume());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<DiseaseCostDetailVO> drgeCostDetailList = new ArrayList<>(drgeCostMap.values());
|
|
|
|
|
+ //计算单个DRG的成本
|
|
|
|
|
+ drgeCostDetailList.forEach(vo -> {
|
|
|
|
|
+ vo.setMedicalCost(getPercent(vo.getServiceVolume(), vo.getMedicalCost()));
|
|
|
|
|
+ vo.setMedicalFullCost(getPercent(vo.getServiceVolume(), vo.getMedicalFullCost()));
|
|
|
|
|
+ vo.setHospitalFullCost(getPercent(vo.getServiceVolume(), vo.getHospitalFullCost()));
|
|
|
|
|
+ });
|
|
|
|
|
+ return drgeCostDetailList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取DRG成本构成明细表数据
|
|
|
|
|
+ * @param computeDate
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<DiseaseCostDetailVO> getDrgCostCompositionDetail(String computeDate) {
|
|
|
|
|
+ List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDrgCostCompositionDetail(computeDate);
|
|
|
|
|
+ if(CollectionUtils.isEmpty(projectCostAccountList)){
|
|
|
|
|
+ throw new CostException("请先计算患者成本");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取所有的标准字典数据
|
|
|
|
|
+ StandCostDictMapVO standCostDictMaps = getStandCostDictMaps();
|
|
|
|
|
+ // 记录项目类别对象
|
|
|
|
|
+ Map<String, DiseaseCostDetailVO> diseaseCostMap = new HashMap<>();
|
|
|
|
|
+ for (DiseaseCostDetailVO projectCostAccount : projectCostAccountList) {
|
|
|
|
|
+ //按项目类型累加数据
|
|
|
|
|
+ DictDataVo accountType = standCostDictMaps.getAccountingTypeMap().get(projectCostAccount.getCostTypeCode());
|
|
|
|
|
+ DiseaseCostDetailVO vo = new DiseaseCostDetailVO();
|
|
|
|
|
+ //已有的项目类别
|
|
|
|
|
+ if (diseaseCostMap.containsKey(projectCostAccount.getItemCode())) {
|
|
|
|
|
+ vo = diseaseCostMap.get(projectCostAccount.getItemCode());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ vo.setItemCode(projectCostAccount.getItemCode());
|
|
|
|
|
+ vo.setItemName(projectCostAccount.getItemName());
|
|
|
|
|
+ //新建一个项目类别对象
|
|
|
|
|
+ diseaseCostMap.put(projectCostAccount.getItemCode(), vo);
|
|
|
|
|
+ }
|
|
|
|
|
+ //按会计科目类型累加费用
|
|
|
|
|
+ addAccountTypeExpense(accountType.getExpandOne(), projectCostAccount.getHospitalFullCost(), vo);
|
|
|
|
|
+ //累加数量
|
|
|
|
|
+ vo.setServiceVolume(vo.getServiceVolume().add(projectCostAccount.getServiceVolume()));
|
|
|
|
|
+ }
|
|
|
|
|
+ List<DiseaseCostDetailVO> diseaseCostDetailList =new ArrayList<>(diseaseCostMap.values());
|
|
|
|
|
+ //按会计科目类型计算占比
|
|
|
|
|
+ diseaseCostDetailList.forEach(vo -> setAccountTypeExpenseRatio(vo));
|
|
|
|
|
+ return diseaseCostDetailList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取科室DRG成本构成明细表数据
|
|
|
|
|
+ * @param computeDate
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public ComputeProfitCollectResponse getDeptDrgCostCompositionDetail(String computeDate) {
|
|
|
|
|
+ List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDeptDrgCostCompositionDetail(computeDate);
|
|
|
|
|
+ if(CollectionUtils.isEmpty(projectCostAccountList)){
|
|
|
|
|
+ throw new CostException("请先计算患者成本");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取所有的标准字典数据
|
|
|
|
|
+ StandCostDictMapVO standCostDictMaps = getStandCostDictMaps();
|
|
|
|
|
+ List<CommonResponsibilityReportVo> titleList = new ArrayList<>();
|
|
|
|
|
+ // 提取科室名称作为列标题
|
|
|
|
|
+ for (Responsibility dept : standCostDictMaps.getResponsibilityDict()) {
|
|
|
|
|
+ CommonResponsibilityReportVo title = new CommonResponsibilityReportVo();
|
|
|
|
|
+ title.setResponsibilityName(dept.getResponsibilityName());
|
|
|
|
|
+ title.setResponsibilityCode(dept.getResponsibilityCode());
|
|
|
|
|
+ title.setSort(dept.getSort());
|
|
|
|
|
+ //添加子级标题
|
|
|
|
|
+ addCommonResponsibilityChild(title);
|
|
|
|
|
+ titleList.add(title);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 记录项目类别对象
|
|
|
|
|
+ Map<String, ReportFormCustomVo> diseaseCostMap = new HashMap<>();
|
|
|
|
|
+ // 遍历每个项目生成科室金额
|
|
|
|
|
+ for (DiseaseCostDetailVO costItem : projectCostAccountList) {
|
|
|
|
|
+ ReportFormCustomVo itemVo = new ReportFormCustomVo();
|
|
|
|
|
+ if(diseaseCostMap.containsKey(costItem.getItemCode())){
|
|
|
|
|
+ itemVo=diseaseCostMap.get(costItem.getItemCode());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ itemVo.setReportName(costItem.getItemName());
|
|
|
itemVo.setData(new ArrayList<>());
|
|
itemVo.setData(new ArrayList<>());
|
|
|
itemVo.setTotalValue(BigDecimal.ZERO);
|
|
itemVo.setTotalValue(BigDecimal.ZERO);
|
|
|
}
|
|
}
|