|
@@ -69,9 +69,9 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
// 转成List便于处理
|
|
// 转成List便于处理
|
|
|
List<DeptDirectMedicalCostVO> deptDirectMedicalCostList = deptDirectMedicalCostMap.values().stream().collect(Collectors.toList());
|
|
List<DeptDirectMedicalCostVO> deptDirectMedicalCostList = deptDirectMedicalCostMap.values().stream().collect(Collectors.toList());
|
|
|
//创建医疗业务成本合计
|
|
//创建医疗业务成本合计
|
|
|
- DeptDirectMedicalCostVO medicalBusinessTotal = createSubTotalVo(deptDirectMedicalCostList.get(NumberConstant.ZERO), "医疗业务成本合计");
|
|
|
|
|
|
|
+ DeptDirectMedicalCostVO medicalBusinessTotal = createSubtotalVo(deptDirectMedicalCostList.get(NumberConstant.ZERO), "医疗业务成本合计", DeptDirectMedicalCostVO.class);
|
|
|
//创建总计
|
|
//创建总计
|
|
|
- DeptDirectMedicalCostVO grandTotal = createSubTotalVo(deptDirectMedicalCostList.get(NumberConstant.ZERO), "总计");
|
|
|
|
|
|
|
+ DeptDirectMedicalCostVO grandTotal = createSubtotalVo(deptDirectMedicalCostList.get(NumberConstant.ZERO), "总计", DeptDirectMedicalCostVO.class);
|
|
|
//按responsibilitySort正序排序
|
|
//按responsibilitySort正序排序
|
|
|
deptDirectMedicalCostList.sort(Comparator.comparing(DeptDirectMedicalCostVO::getResponsibilitySort,
|
|
deptDirectMedicalCostList.sort(Comparator.comparing(DeptDirectMedicalCostVO::getResponsibilitySort,
|
|
|
Comparator.nullsLast(Comparator.naturalOrder())));
|
|
Comparator.nullsLast(Comparator.naturalOrder())));
|
|
@@ -90,7 +90,7 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
// 添加该分类下的所有记录
|
|
// 添加该分类下的所有记录
|
|
|
result.addAll(deptDirectMedicalCostVOS);
|
|
result.addAll(deptDirectMedicalCostVOS);
|
|
|
// 创建小计对象
|
|
// 创建小计对象
|
|
|
- DeptDirectMedicalCostVO subtotalVo = createSubTotalVo(deptDirectMedicalCostVOS.get(NumberConstant.ZERO),String.format("%s小计", shareLevel.getName()));
|
|
|
|
|
|
|
+ DeptDirectMedicalCostVO subtotalVo = createSubtotalVo(deptDirectMedicalCostVOS.get(NumberConstant.ZERO),String.format("%s小计", shareLevel.getName()), DeptDirectMedicalCostVO.class);
|
|
|
//将科室的金额加到小计对象中
|
|
//将科室的金额加到小计对象中
|
|
|
deptDirectMedicalCostVOS.forEach(item -> addBigDecimalFields(item, subtotalVo));
|
|
deptDirectMedicalCostVOS.forEach(item -> addBigDecimalFields(item, subtotalVo));
|
|
|
// 如果属于医疗业务成本的科室,则小计的金额加到医疗业务成本
|
|
// 如果属于医疗业务成本的科室,则小计的金额加到医疗业务成本
|
|
@@ -145,9 +145,9 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
List<DictDataVo> standardShareLevelList = standCostDictMaps.getStandardShareLevelDict();
|
|
List<DictDataVo> standardShareLevelList = standCostDictMaps.getStandardShareLevelDict();
|
|
|
standardShareLevelList.sort(Comparator.comparing(DictDataVo::getSort, Comparator.nullsLast(Comparator.reverseOrder())));
|
|
standardShareLevelList.sort(Comparator.comparing(DictDataVo::getSort, Comparator.nullsLast(Comparator.reverseOrder())));
|
|
|
//创建医疗业务成本合计
|
|
//创建医疗业务成本合计
|
|
|
- DeptFullDirectCostVO medicalBusinessTotal = createAllDirectCostSubTotalVo(reportList.get(NumberConstant.ZERO), "医疗业务成本合计");
|
|
|
|
|
|
|
+ DeptFullDirectCostVO medicalBusinessTotal = createSubtotalVo(reportList.get(NumberConstant.ZERO), "医疗业务成本合计", DeptFullDirectCostVO.class);
|
|
|
//创建总计
|
|
//创建总计
|
|
|
- DeptFullDirectCostVO grandTotal = createAllDirectCostSubTotalVo(reportList.get(NumberConstant.ZERO), "总计");
|
|
|
|
|
|
|
+ DeptFullDirectCostVO grandTotal = createSubtotalVo(reportList.get(NumberConstant.ZERO), "总计", DeptFullDirectCostVO.class);
|
|
|
// 创建各层级小计并按正确顺序插入
|
|
// 创建各层级小计并按正确顺序插入
|
|
|
List<DeptFullDirectCostVO> result = new ArrayList<>();
|
|
List<DeptFullDirectCostVO> result = new ArrayList<>();
|
|
|
for (DictDataVo shareLevel : standardShareLevelList) {
|
|
for (DictDataVo shareLevel : standardShareLevelList) {
|
|
@@ -158,7 +158,7 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
// 添加该分类下的所有记录
|
|
// 添加该分类下的所有记录
|
|
|
result.addAll(reportVOS);
|
|
result.addAll(reportVOS);
|
|
|
// 创建小计对象
|
|
// 创建小计对象
|
|
|
- DeptFullDirectCostVO subtotalVo = createAllDirectCostSubTotalVo(reportVOS.get(NumberConstant.ZERO),String.format("%s小计", shareLevel.getName()));
|
|
|
|
|
|
|
+ DeptFullDirectCostVO subtotalVo = createSubtotalVo(reportVOS.get(NumberConstant.ZERO),String.format("%s小计", shareLevel.getName()), DeptFullDirectCostVO.class);
|
|
|
//将科室的金额加到小计对象中
|
|
//将科室的金额加到小计对象中
|
|
|
reportVOS.forEach(item -> addBigDecimalFields(item, subtotalVo));
|
|
reportVOS.forEach(item -> addBigDecimalFields(item, subtotalVo));
|
|
|
// 如果属于医疗业务成本的科室,则小计的金额加到医疗业务成本
|
|
// 如果属于医疗业务成本的科室,则小计的金额加到医疗业务成本
|
|
@@ -202,7 +202,15 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
for (AllocationQuery allocationQuery : allocationQueryList) {
|
|
for (AllocationQuery allocationQuery : allocationQueryList) {
|
|
|
addDeptCostDetailVO(reportMap, allocationQuery, standCostDictMaps);
|
|
addDeptCostDetailVO(reportMap, allocationQuery, standCostDictMaps);
|
|
|
}
|
|
}
|
|
|
- return null;
|
|
|
|
|
|
|
+ // 转成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;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -311,6 +319,7 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
reportVO.setTotalCost(reportVO.getTotalCost().add(allocationQuery.getAmount()));
|
|
reportVO.setTotalCost(reportVO.getTotalCost().add(allocationQuery.getAmount()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 生成科室成本报表信息
|
|
* 生成科室成本报表信息
|
|
|
* @param reportVO
|
|
* @param reportVO
|
|
@@ -407,25 +416,7 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
dataMaps.setAccountingTypeMap(accountingTypeMap);
|
|
dataMaps.setAccountingTypeMap(accountingTypeMap);
|
|
|
return dataMaps;
|
|
return dataMaps;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 创建小计对象
|
|
|
|
|
- * @param directMedicalCostVO
|
|
|
|
|
- * @param totalName
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- public DeptDirectMedicalCostVO createSubTotalVo(DeptDirectMedicalCostVO directMedicalCostVO, String totalName ){
|
|
|
|
|
- if (directMedicalCostVO == null) {
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- DeptDirectMedicalCostVO deptDirectMedicalCostVO = BeanUtil.convertObj(directMedicalCostVO, DeptDirectMedicalCostVO.class);
|
|
|
|
|
- deptDirectMedicalCostVO.setResponsibilityCode(totalName);
|
|
|
|
|
- deptDirectMedicalCostVO.setResponsibilityName(totalName);
|
|
|
|
|
- // 初始化所有费用字段为0
|
|
|
|
|
- BeanUtil.initBigDecimalFieldsToZero(deptDirectMedicalCostVO);
|
|
|
|
|
- return deptDirectMedicalCostVO;
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 转换为DeptDirectMedicalCostVO(一个责任中心只一条记录)
|
|
* 转换为DeptDirectMedicalCostVO(一个责任中心只一条记录)
|
|
@@ -559,24 +550,6 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
// 医院全成本合计
|
|
// 医院全成本合计
|
|
|
reportVO.setHospitalTotalCost(reportVO.getHospitalTotalCost().add(allocationQuery.getAmount()));
|
|
reportVO.setHospitalTotalCost(reportVO.getHospitalTotalCost().add(allocationQuery.getAmount()));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 创建小计对象
|
|
|
|
|
- * @param directMedicalCostVO
|
|
|
|
|
- * @param totalName
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- public DeptFullDirectCostVO createAllDirectCostSubTotalVo(DeptFullDirectCostVO directMedicalCostVO, String totalName ){
|
|
|
|
|
- if (directMedicalCostVO == null) {
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- DeptFullDirectCostVO deptDirectMedicalCostVO = BeanUtil.convertObj(directMedicalCostVO, DeptFullDirectCostVO.class);
|
|
|
|
|
- deptDirectMedicalCostVO.setResponsibilityCode(totalName);
|
|
|
|
|
- deptDirectMedicalCostVO.setResponsibilityName(totalName);
|
|
|
|
|
- // 初始化所有费用字段为0
|
|
|
|
|
- BeanUtil.initBigDecimalFieldsToZero(deptDirectMedicalCostVO);
|
|
|
|
|
- return deptDirectMedicalCostVO;
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -610,5 +583,30 @@ public class StandardReportServiceImpl implements StandardReportService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通用创建小计对象方法
|
|
|
|
|
+ * @param source 源对象
|
|
|
|
|
+ * @param totalName 小计名称
|
|
|
|
|
+ * @param clazz 目标类类型
|
|
|
|
|
+ * @return 小计对象
|
|
|
|
|
+ */
|
|
|
|
|
+ public <T> T createSubtotalVo(T source, String totalName, Class<T> clazz) {
|
|
|
|
|
+ if (source == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ T target = BeanUtil.convertObj(source, clazz);
|
|
|
|
|
+ // 使用反射设置责任代码和名称
|
|
|
|
|
+ try {
|
|
|
|
|
+ clazz.getMethod("setResponsibilityCode", String.class).invoke(target, totalName);
|
|
|
|
|
+ clazz.getMethod("setResponsibilityName", String.class).invoke(target, totalName);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("设置责任代码和名称时发生错误", e);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 初始化所有费用字段为0
|
|
|
|
|
+ BeanUtil.initBigDecimalFieldsToZero(target);
|
|
|
|
|
+ return target;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|