0
0

4 کامیت‌ها 234cc301bc ... de37ee13fc

نویسنده SHA1 پیام تاریخ
  JammeyJiang de37ee13fc 临床服务类科室全成本构成分析表d的收入及诊次/床日成本计算不正确的问题修复 2 هفته پیش
  JammeyJiang 7d927bda78 医院科室直接成本表只显示人员经费的问题处理 2 هفته پیش
  JammeyJiang eb0e12e76f 病种报表的三个分页接口添加检索字段 3 هفته پیش
  JammeyJiang 4b1067f490 病种报表的三个分页接口添加检索字段 3 هفته پیش

+ 33 - 0
src/main/java/com/kcim/common/util/PageUtils.java

@@ -205,5 +205,38 @@ public class PageUtils implements Serializable {
 		return list.subList(fromIndex,toIndex);
 	}
 
+	public static <T> List<T> getPageList(List<T> list,int current,int pageSize){
+		if(list ==null){
+			return new ArrayList<>();
+		}
+		if(list.size() == 0){
+			return  list;
+		}
+		if(current ==0){
+			current = 1;
+		}
+		//记录总数
+		int count = list.size();
+		//页数
+		int pageCount = 0;
+		if(count % pageSize==0){
+			pageCount = count / pageSize;
+		}else {
+			pageCount = count / pageSize + 1;
+		}
+		int fromIndex = 0;
+		int toIndex = 0;
+		if(current>pageCount){
+			return new ArrayList<>();
+		}
+		if(current != pageCount){
+			fromIndex = (current - 1)*pageSize;
+			toIndex = fromIndex + pageSize;
+		}else {
+			fromIndex = (current - 1)*pageSize;
+			toIndex = count;
+		}
+		return list.subList(fromIndex,toIndex);
+	}
 
 }

+ 6 - 3
src/main/java/com/kcim/dao/mapper/ComputePatientCostAccountMapper.java

@@ -22,25 +22,28 @@ public interface ComputePatientCostAccountMapper extends BaseMapper<ComputePatie
      * 获取疾病成本明细
      * @param computeDate
      * @param hospId
+     * @param diseaseFilter
      * @return
      */
-    List<DiseaseCostDetailVO> getDiseaseCostDetailList(@Param("computeDate") String computeDate, @Param("hospId") Long hospId);
+    List<DiseaseCostDetailVO> getDiseaseCostDetailList(@Param("computeDate") String computeDate, @Param("hospId") Long hospId, String diseaseFilter);
 
     /**
      * 获取疾病成本构成明细
      * @param computeDate
      * @param hospId
+     * @param diseaseFilter
      * @return
      */
-    List<DiseaseCostDetailVO> getDiseaseCostCompositionDetail(@Param("computeDate") String computeDate, @Param("hospId") Long hospId);
+    List<DiseaseCostDetailVO> getDiseaseCostCompositionDetail(@Param("computeDate") String computeDate, @Param("hospId") Long hospId, String diseaseFilter);
 
     /**
      * 获取服务单元疾病成本构成明细
      * @param computeDate
      * @param hospId
+     * @param diseaseFilter
      * @return
      */
-    List<DiseaseCostDetailVO> getDeptDiseaseCostCompositionDetail(@Param("computeDate") String computeDate, @Param("hospId") Long hospId);
+    List<DiseaseCostDetailVO> getDeptDiseaseCostCompositionDetail(@Param("computeDate") String computeDate, @Param("hospId") Long hospId, String diseaseFilter);
 
     /**
      * 获取DRG成本明细

+ 6 - 6
src/main/java/com/kcim/dao/repository/ComputePatientCostAccountRepository.java

@@ -25,16 +25,16 @@ public class ComputePatientCostAccountRepository extends ServiceImpl<ComputePati
         return this.list(queryWrapper);
     }
 
-    public List<DiseaseCostDetailVO> getDiseaseCostDetailList(String computeDate) {
-        return this.baseMapper.getDiseaseCostDetailList(computeDate, UserContext.getHospId());
+    public List<DiseaseCostDetailVO> getDiseaseCostDetailList(String computeDate, String diseaseFilter) {
+        return this.baseMapper.getDiseaseCostDetailList(computeDate, UserContext.getHospId(), diseaseFilter);
     }
 
-    public List<DiseaseCostDetailVO> getDiseaseCostCompositionDetail(String computeDate) {
-        return this.baseMapper.getDiseaseCostCompositionDetail(computeDate, UserContext.getHospId());
+    public List<DiseaseCostDetailVO> getDiseaseCostCompositionDetail(String computeDate, String diseaseFilter) {
+        return this.baseMapper.getDiseaseCostCompositionDetail(computeDate, UserContext.getHospId(), diseaseFilter);
     }
 
-    public List<DiseaseCostDetailVO> getDeptDiseaseCostCompositionDetail(String computeDate) {
-        return this.baseMapper.getDeptDiseaseCostCompositionDetail(computeDate, UserContext.getHospId());
+    public List<DiseaseCostDetailVO> getDeptDiseaseCostCompositionDetail(String computeDate, String diseaseFilter) {
+        return this.baseMapper.getDeptDiseaseCostCompositionDetail(computeDate, UserContext.getHospId(), diseaseFilter);
     }
 
     public List<DiseaseCostDetailVO> getDrgCostDetailList(String computeDate) {

+ 6 - 3
src/main/java/com/kcim/service/StandardReportService.java

@@ -99,9 +99,10 @@ public interface StandardReportService {
      * @param current 当前页码
      * @param pageSize 每页大小
      * @param computeDate 核算年月
+     * @param diseaseFilter 病种筛选条件(编码或名称)
      * @return 分页数据
      */
-    Object getDiseaseCostDetailByPage(Integer current, Integer pageSize, String computeDate);
+    Object getDiseaseCostDetailByPage(Integer current, Integer pageSize, String computeDate, String diseaseFilter);
 
     /**
      * 获取病种成本构成明细表数据
@@ -115,9 +116,10 @@ public interface StandardReportService {
      * @param current 当前页码
      * @param pageSize 每页大小
      * @param computeDate 核算年月
+     * @param diseaseFilter 病种筛选条件(编码或名称)
      * @return 分页数据
      */
-    Object getDiseaseCostCompositionDetailByPage(Integer current, Integer pageSize, String computeDate);
+    Object getDiseaseCostCompositionDetailByPage(Integer current, Integer pageSize, String computeDate, String diseaseFilter);
 
     /**
      * 获取服务单元病种成本构成明细表数据
@@ -131,9 +133,10 @@ public interface StandardReportService {
      * @param current 当前页码
      * @param pageSize 每页大小
      * @param computeDate 核算年月
+     * @param diseaseFilter 病种筛选条件(编码或名称)
      * @return 分页数据
      */
-    Object getDeptDiseaseCostCompositionDetailByPage(Integer current, Integer pageSize, String computeDate);
+    Object getDeptDiseaseCostCompositionDetailByPage(Integer current, Integer pageSize, String computeDate, String diseaseFilter);
 
     /**
      * 获取DRG成本明细表数据

+ 91 - 37
src/main/java/com/kcim/service/impl/StandardReportServiceImpl.java

@@ -969,18 +969,15 @@ public class StandardReportServiceImpl implements StandardReportService {
         return medServiceCostDetailList;
     }
 
-
-    /**
-     * 获取医院病种成本明细表数据
-     *
-     * @return 病种成本明细列表
-     */
-    @Override
-    public List<DiseaseCostDetailVO> getDiseaseCostDetail(String computeDate) {
-        List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDiseaseCostDetailList(computeDate);
-        if(CollectionUtils.isEmpty(projectCostAccountList)){
-            throw new CostException("请先计算患者成本");
+    public List<DiseaseCostDetailVO> getDiseaseCostDetail(String computeDate, String diseaseFilter) {
+        List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDiseaseCostDetailList(computeDate,diseaseFilter);
+        if (CollectionUtils.isEmpty(projectCostAccountList)) {
+            throw new CostException("找不到满足条件的数据");
         }
+        return getDiseaseCostDetail( computeDate,projectCostAccountList);
+    }
+
+    public List<DiseaseCostDetailVO> getDiseaseCostDetail(String computeDate, List<DiseaseCostDetailVO> projectCostAccountList){
         // 获取所有的标准字典数据
         StandCostDictMapVO standCostDictMaps = getStandCostDictMaps();
         // 记录项目类别对象
@@ -1034,17 +1031,29 @@ public class StandardReportServiceImpl implements StandardReportService {
 
 
     /**
-     * 获取病种成本构成明细表数据
+     * 获取医院病种成本明细表数据
      *
-     * @return 病种成本明细列表,包含各病种的成本明细及总计行
+     * @return 病种成本明细列表
      */
     @Override
-    public List<DiseaseCostDetailVO> getDiseaseCostCompositionDetail(String computeDate) {
-
-        List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDiseaseCostCompositionDetail(computeDate);
+    public List<DiseaseCostDetailVO> getDiseaseCostDetail(String computeDate) {
+        List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDiseaseCostDetailList(computeDate,null);
         if(CollectionUtils.isEmpty(projectCostAccountList)){
             throw new CostException("请先计算患者成本");
         }
+        return getDiseaseCostDetail( computeDate,projectCostAccountList);
+    }
+
+    public List<DiseaseCostDetailVO> getDiseaseCostCompositionDetail(String computeDate, String diseaseFilter) {
+
+        List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDiseaseCostCompositionDetail(computeDate, diseaseFilter);
+        if (CollectionUtils.isEmpty(projectCostAccountList)) {
+            throw new CostException("找不到满足条件的数据");
+        }
+        return getDiseaseCostCompositionDetail(computeDate,projectCostAccountList);
+    }
+
+    public List<DiseaseCostDetailVO> getDiseaseCostCompositionDetail(String computeDate, List<DiseaseCostDetailVO> projectCostAccountList) {
         // 记录项目类别对象
         Map<String, DiseaseCostDetailVO> diseaseCostMap = new HashMap<>();
         for (DiseaseCostDetailVO projectCostAccount : projectCostAccountList) {
@@ -1070,20 +1079,35 @@ public class StandardReportServiceImpl implements StandardReportService {
         List<DiseaseCostDetailVO> diseaseCostDetailList =new ArrayList<>(diseaseCostMap.values());
         //按会计科目类型计算占比
         diseaseCostDetailList.forEach(vo -> setAccountTypeExpenseRatio(vo));
+        diseaseCostDetailList.sort(Comparator.comparing(DiseaseCostDetailVO::getItemCode));
         return diseaseCostDetailList;
     }
 
+
     /**
-     * 获取服务单元病种成本构成明细表数据
-     * @param computeDate
-     * @return
+     * 获取病种成本构成明细表数据
+     *
+     * @return 病种成本明细列表,包含各病种的成本明细及总计行
      */
     @Override
-    public StandardDeptCostCollectResponse getDeptDiseaseCostCompositionDetail(String computeDate) {
-        List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDeptDiseaseCostCompositionDetail(computeDate);
+    public List<DiseaseCostDetailVO> getDiseaseCostCompositionDetail(String computeDate) {
+
+        List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDiseaseCostCompositionDetail(computeDate,null);
         if(CollectionUtils.isEmpty(projectCostAccountList)){
             throw new CostException("请先计算患者成本");
         }
+       return getDiseaseCostCompositionDetail(computeDate,projectCostAccountList);
+    }
+
+    public StandardDeptCostCollectResponse getDeptDiseaseCostCompositionDetail(String computeDate, String diseaseFilter) {
+        List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDeptDiseaseCostCompositionDetail(computeDate,diseaseFilter);
+        if(CollectionUtils.isEmpty(projectCostAccountList)){
+            throw new CostException("找不到满足条件的数据");
+        }
+        return getDeptDiseaseCostCompositionDetail( computeDate,projectCostAccountList);
+    }
+
+    public StandardDeptCostCollectResponse getDeptDiseaseCostCompositionDetail(String computeDate,List<DiseaseCostDetailVO> projectCostAccountList) {
         //科室责任中心对照数据
         List<ResponsibilityDepartIdVO> responsibilityDepartment = responsibilityDepartmentRepository.getResponsibility(UserContext.getHospId());
         Map<String, List<ResponsibilityDepartIdVO>> deptRespMap = responsibilityDepartment.stream()
@@ -1183,6 +1207,20 @@ public class StandardReportServiceImpl implements StandardReportService {
         return response;
     }
 
+    /**
+     * 获取服务单元病种成本构成明细表数据
+     * @param computeDate
+     * @return
+     */
+    @Override
+    public StandardDeptCostCollectResponse getDeptDiseaseCostCompositionDetail(String computeDate) {
+        List<DiseaseCostDetailVO> projectCostAccountList = computePatientCostAccountRepository.getDeptDiseaseCostCompositionDetail(computeDate,null);
+        if(CollectionUtils.isEmpty(projectCostAccountList)){
+            throw new CostException("请先计算患者成本");
+        }
+        return getDeptDiseaseCostCompositionDetail( computeDate,projectCostAccountList);
+    }
+
     /**
      * 获取医院DRG成本明细表数据
      *
@@ -1623,7 +1661,7 @@ public class StandardReportServiceImpl implements StandardReportService {
             item.setProfit(item.getIncome().subtract(item.getTotal()));
         }else{
             item.setIncome(BigDecimal.ZERO);
-            item.setProfit(BigDecimal.ZERO);
+            item.setProfit(item.getIncome().subtract(item.getTotal()));
         }
         //计算科室的床日成本及诊次成本
         if(responsibilityParamValueMap.containsKey(item.getResponsibilityCode())){
@@ -2033,20 +2071,20 @@ public class StandardReportServiceImpl implements StandardReportService {
         if (accountType == null) {
             return; // 添加 null 检查
         }
+        DictDataVo costType = standCostDictMaps.getCostTypeMap().get(String.valueOf(account.getCostType()));
         //只处理医疗成本
-        if(!NumberConstant.ONE_S.equals(accountType.getExpandOne()) ){
+        if(!NumberConstant.ONE_S.equals(costType.getExpandOne()) ){
             return;
         }
-        DictDataVo costType = standCostDictMaps.getCostTypeMap().get(String.valueOf(account.getCostType()));
         DictDataVo standardShareLevel = standCostDictMaps.getStandardShareLevelMap().get(responsibility.getStandardShareLevel());
         DeptDirectMedicalCostVO deptDirectMedicalCostVO= new DeptDirectMedicalCostVO();
-        if(deptDirectMedicalCostMap.containsKey(allocationQuery.getResponsibilityCode())){
-            deptDirectMedicalCostVO=deptDirectMedicalCostMap.get(allocationQuery.getResponsibilityCode());
+        if(deptDirectMedicalCostMap.containsKey(responsibility.getResponsibilityCode())){
+            deptDirectMedicalCostVO=deptDirectMedicalCostMap.get(responsibility.getResponsibilityCode());
         }else{
             initDeptCostReport(deptDirectMedicalCostVO, responsibility,accountType, costType,standardShareLevel);
             // 初始化所有费用字段为0
             BeanUtil.initBigDecimalFieldsToZero(deptDirectMedicalCostVO);
-            deptDirectMedicalCostMap.put(allocationQuery.getResponsibilityCode(),deptDirectMedicalCostVO);
+            deptDirectMedicalCostMap.put(responsibility.getResponsibilityCode(),deptDirectMedicalCostVO);
         }
         // 根据费用类型累加到对应字段
         switch (accountType.getExpandOne()) {
@@ -2358,9 +2396,14 @@ public class StandardReportServiceImpl implements StandardReportService {
     }
 
     @Override
-    public Object getDiseaseCostDetailByPage(Integer current, Integer pageSize, String computeDate) {
+    public Object getDiseaseCostDetailByPage(Integer current, Integer pageSize, String computeDate, String diseaseFilter) {
         // 获取完整数据列表
-        List<DiseaseCostDetailVO> fullList = getDiseaseCostDetail(computeDate);
+        List<DiseaseCostDetailVO> fullList;
+        if (StringUtils.isEmpty(diseaseFilter)) {
+            fullList = getDiseaseCostDetail(computeDate);
+        } else {
+            fullList = getDiseaseCostDetail(computeDate, diseaseFilter);
+        }
         
         // 手动分页
         int total = fullList.size();
@@ -2377,10 +2420,14 @@ public class StandardReportServiceImpl implements StandardReportService {
     }
 
     @Override
-    public Object getDiseaseCostCompositionDetailByPage(Integer current, Integer pageSize, String computeDate) {
+    public Object getDiseaseCostCompositionDetailByPage(Integer current, Integer pageSize, String computeDate, String diseaseFilter) {
         // 获取完整数据列表
-        List<DiseaseCostDetailVO> fullList = getDiseaseCostCompositionDetail(computeDate);
-        
+        List<DiseaseCostDetailVO> fullList ;
+        if (StringUtils.isEmpty(diseaseFilter)) {
+            fullList = getDiseaseCostCompositionDetail(computeDate);
+        } else {
+            fullList = getDiseaseCostCompositionDetail(computeDate,diseaseFilter);
+        }
         // 手动分页
         int total = fullList.size();
         int startIndex = (current - 1) * pageSize;
@@ -2396,10 +2443,14 @@ public class StandardReportServiceImpl implements StandardReportService {
     }
 
     @Override
-    public Object getDeptDiseaseCostCompositionDetailByPage(Integer current, Integer pageSize, String computeDate) {
+    public Object getDeptDiseaseCostCompositionDetailByPage(Integer current, Integer pageSize, String computeDate, String diseaseFilter) {
         // 获取完整数据
-        StandardDeptCostCollectResponse fullData = getDeptDiseaseCostCompositionDetail(computeDate);
-        
+        StandardDeptCostCollectResponse fullData ;
+        if (StringUtils.isEmpty(diseaseFilter)) {
+            fullData = getDeptDiseaseCostCompositionDetail(computeDate);
+        } else {
+            fullData = getDeptDiseaseCostCompositionDetail(computeDate,diseaseFilter);
+        }
         // 对数据进行分页
         List<StandardReportFormCustomVo> fullList = fullData.getData();
         int total = fullList.size();
@@ -2416,8 +2467,11 @@ public class StandardReportServiceImpl implements StandardReportService {
         StandardDeptCostCollectResponse pageData = new StandardDeptCostCollectResponse();
         pageData.setTitle(fullData.getTitle());
         pageData.setData(pageList);
-        
-        return new PageUtils(pageList, total, pageSize, current);
+        pageData.setCurrent(current);
+        pageData.setPageSize(pageSize);
+        pageData.setTotalCount( total);
+        pageData.setTotalPage((int)Math.ceil((double)total/pageSize));
+        return pageData;
     }
 
 

+ 9 - 6
src/main/java/com/kcim/web/StandardReportController.java

@@ -105,8 +105,9 @@ public class StandardReportController extends AbstractController {
     @GetMapping("/getDiseaseCostDetailByPage")
     public Result getDiseaseCostDetailByPage(@RequestParam(defaultValue = "1") Integer current,
                                              @RequestParam(defaultValue = "10") Integer pageSize,
-                                             @RequestParam String computeDate) {
-        return Result.ok(standardReportService.getDiseaseCostDetailByPage(current, pageSize, computeDate));
+                                             @RequestParam String computeDate,
+                                             @RequestParam(required = false) String diseaseFilter) {
+        return Result.ok(standardReportService.getDiseaseCostDetailByPage(current, pageSize, computeDate, diseaseFilter));
     }
 
     @ApiOperation("医院病种成本构成明细表")
@@ -119,8 +120,9 @@ public class StandardReportController extends AbstractController {
     @GetMapping("/getDiseaseCostCompositionDetailByPage")
     public Result getDiseaseCostCompositionDetailByPage(@RequestParam(defaultValue = "1") Integer current,
                                                         @RequestParam(defaultValue = "10") Integer pageSize,
-                                                        @RequestParam String computeDate) {
-        return Result.ok(standardReportService.getDiseaseCostCompositionDetailByPage(current, pageSize, computeDate));
+                                                        @RequestParam String computeDate,
+                                                        @RequestParam(required = false) String diseaseFilter) {
+        return Result.ok(standardReportService.getDiseaseCostCompositionDetailByPage(current, pageSize, computeDate, diseaseFilter));
     }
 
     @ApiOperation("医院服务单元病种成本构成明细表")
@@ -133,8 +135,9 @@ public class StandardReportController extends AbstractController {
     @GetMapping("/getDeptDiseaseCostCompositionDetailByPage")
     public Result getDeptDiseaseCostCompositionDetailByPage(@RequestParam(defaultValue = "1") Integer current,
                                                             @RequestParam(defaultValue = "10") Integer pageSize,
-                                                            @RequestParam String computeDate) {
-        return Result.ok(standardReportService.getDeptDiseaseCostCompositionDetailByPage(current, pageSize, computeDate));
+                                                            @RequestParam String computeDate,
+                                                            @RequestParam(required = false) String diseaseFilter) {
+        return Result.ok(standardReportService.getDeptDiseaseCostCompositionDetailByPage(current, pageSize, computeDate, diseaseFilter));
     }
 
     @ApiOperation("医院DRG成本明细表")

+ 8 - 0
src/main/java/com/kcim/web/reponse/StandardDeptCostCollectResponse.java

@@ -18,4 +18,12 @@ public class StandardDeptCostCollectResponse {
     private List<CommonResponsibilityReportVo> title;
 
     private List<StandardReportFormCustomVo> data;
+
+    private int totalCount;
+
+    private int current;
+
+    private int pageSize;
+
+    private int totalPage;
 }

+ 12 - 0
src/main/resources/mapper/ComputePatientCostAccountMapper.xml

@@ -43,6 +43,10 @@
             a.del_flag = 0
           AND a.hosp_id = #{hospId,jdbcType=BIGINT}
           AND a.compute_date = #{computeDate,jdbcType=VARCHAR}
+          <if test="diseaseFilter != null and diseaseFilter != ''">
+            AND (c.`primary_diag_code` LIKE CONCAT('%', #{diseaseFilter,jdbcType=VARCHAR}, '%') 
+                 OR c.`primary_diag_name` LIKE CONCAT('%', #{diseaseFilter,jdbcType=VARCHAR}, '%'))
+          </if>
         GROUP BY
 --             c.`primary_diag_code`,
             SUBSTR(c.`primary_diag_code`,1,3),
@@ -69,6 +73,10 @@
             a.del_flag = 0
           AND a.hosp_id = #{hospId,jdbcType=BIGINT}
           AND a.compute_date = #{computeDate,jdbcType=VARCHAR}
+          <if test="diseaseFilter != null and diseaseFilter != ''">
+            AND (c.`primary_diag_code` LIKE CONCAT('%', #{diseaseFilter,jdbcType=VARCHAR}, '%') 
+                 OR c.`primary_diag_name` LIKE CONCAT('%', #{diseaseFilter,jdbcType=VARCHAR}, '%'))
+          </if>
         GROUP BY
 --             c.`primary_diag_code`,
             SUBSTR(c.`primary_diag_code`,1,3),
@@ -96,6 +104,10 @@
             a.del_flag = 0
           AND a.hosp_id = #{hospId,jdbcType=BIGINT}
           AND a.compute_date = #{computeDate,jdbcType=VARCHAR}
+          <if test="diseaseFilter != null and diseaseFilter != ''">
+            AND (c.`primary_diag_code` LIKE CONCAT('%', #{diseaseFilter,jdbcType=VARCHAR}, '%') 
+                 OR c.`primary_diag_name` LIKE CONCAT('%', #{diseaseFilter,jdbcType=VARCHAR}, '%'))
+          </if>
         GROUP BY
 --             c.`primary_diag_code`,
             SUBSTR(c.`primary_diag_code`,1,3),