소스 검색

1、损益报表添加字体颜色设置及显示 2、收入归集计算页面添加分摊层级的筛选

JammeyJiang 1 개월 전
부모
커밋
b6d56008e5

+ 2 - 0
src/main/java/com/kcim/dao/mapper/IncomeCollectionMapper.java

@@ -42,6 +42,8 @@ public interface IncomeCollectionMapper extends BaseMapper<IncomeCollection> {
      */
     BigDecimal getTotalAmount(@Param("collectDTO") CollectDTO collectDTO);
 
+    BigDecimal getShareLevelTotalAmount(@Param("collectDTO") CollectDTO collectDTO);
+
     BigDecimal getResponsibilityTotalAmount(@Param("collectDTO") CollectDTO collectDTO);
 
     /**

+ 5 - 0
src/main/java/com/kcim/dao/model/ReportForm.java

@@ -125,4 +125,9 @@ public class ReportForm implements Serializable {
      */
     private Integer permil;
 
+    /**
+     * 字体颜色
+     */
+    private String fontColor;
+
 }

+ 2 - 0
src/main/java/com/kcim/dao/model/dto/CollectDTO.java

@@ -23,4 +23,6 @@ public class CollectDTO {
     private String accountFilter;
 
     private Long hospId;
+
+    private Integer shareId;
 }

+ 5 - 0
src/main/java/com/kcim/dao/model/dto/ReportFormEditDTO.java

@@ -71,4 +71,9 @@ public class ReportFormEditDTO {
      * 是否有千分号 0否 1是
      */
     private Integer permil;
+
+    /**
+     * 字体颜色
+     */
+    private String fontColor;
 }

+ 5 - 0
src/main/java/com/kcim/dao/model/dto/ReportFormSaveDTO.java

@@ -67,4 +67,9 @@ public class ReportFormSaveDTO {
      * 是否有千分号
      */
     private Integer permil;
+
+    /**
+     * 字体颜色
+     */
+    private String fontColor;
 }

+ 2 - 0
src/main/java/com/kcim/service/ResponsibilityService.java

@@ -110,5 +110,7 @@ public interface ResponsibilityService extends IService<Responsibility> {
     Object getStandardShareLevel();
 
     Object getResponsibilityType();
+
+    List<CostResponsibilityVO> getSharelevelRespList(Integer shareId, String filter);
 }
 

+ 1 - 0
src/main/java/com/kcim/service/impl/ComputeMedicalDepartmentProfitServiceImpl.java

@@ -173,6 +173,7 @@ public class ComputeMedicalDepartmentProfitServiceImpl implements ComputeMedical
                 vo.setDataType(profitReportFormList.get(NumberConstant.ZERO).getDataType());
                 vo.setDecimalPlace(profitReportFormList.get(NumberConstant.ZERO).getDecimalPlace());
                 vo.setPermil(profitReportFormList.get(NumberConstant.ZERO).getPermil());
+                vo.setFontColor(profitReportFormList.get(NumberConstant.ZERO).getFontColor());
             }else {
                 vo.setDataType(NumberConstant.ONE);
                 vo.setDecimalPlace(NumberConstant.TWO);

+ 5 - 1
src/main/java/com/kcim/service/impl/CostDepartmentProfitServiceImpl.java

@@ -350,7 +350,7 @@ public class CostDepartmentProfitServiceImpl extends BaseBatchServiceImpl<CostDe
                 i.setAmount(setSubtotal(i, costShareLevelList, listMap, list, incomeList, allocationQueryReportVOList, reportRelationMap, allocationList, allList));
             } else if (NumberConstant.FOUR.equals(calcType)) {
                 // TODO 按照计算公式进行计算
-                i.setAmount(setCalculation(i, list, costShareLevelList, listMap, incomeList, allocationQueryReportVOList, reportRelationMap, allocationList, allList));
+//                i.setAmount(setCalculation(i, list, costShareLevelList, listMap, incomeList, allocationQueryReportVOList, reportRelationMap, allocationList, allList));
             } else if (NumberConstant.FIVE.equals(calcType)) {
                 // TODO  按照责任中心进行计算
                 i.setAmount(setResponsibilityCode(i, reportRelationMap, allocationList, allList));
@@ -1497,6 +1497,7 @@ public class CostDepartmentProfitServiceImpl extends BaseBatchServiceImpl<CostDe
             commonTitleReportVo.setDataType(reportForm.getDataType());
             commonTitleReportVo.setDecimalPlace(reportForm.getDecimalPlace());
             commonTitleReportVo.setPermil(reportForm.getPermil());
+            commonTitleReportVo.setFontColor(reportForm.getFontColor());
             return commonTitleReportVo;
         }).collect(Collectors.toList());
 //        List<CommonTitleReportVo> commonTitleReportVos = BeanUtil.convertList(reportFormList,CommonTitleReportVo.class);
@@ -2063,6 +2064,7 @@ public class CostDepartmentProfitServiceImpl extends BaseBatchServiceImpl<CostDe
                     profitVo.setDataType(profitReportFormList.get(NumberConstant.ZERO).getDataType());
                     profitVo.setDecimalPlace(profitReportFormList.get(NumberConstant.ZERO).getDecimalPlace());
                     profitVo.setPermil(profitReportFormList.get(NumberConstant.ZERO).getPermil());
+                    profitVo.setFontColor(profitReportFormList.get(NumberConstant.ZERO).getFontColor());
                 } else {
                     profitVo.setDataType(NumberConstant.ONE);
                     profitVo.setDecimalPlace(NumberConstant.TWO);
@@ -2137,6 +2139,7 @@ public class CostDepartmentProfitServiceImpl extends BaseBatchServiceImpl<CostDe
                             profitVo.setDataType(profitReportFormList.get(NumberConstant.ZERO).getDataType());
                             profitVo.setDecimalPlace(profitReportFormList.get(NumberConstant.ZERO).getDecimalPlace());
                             profitVo.setPermil(profitReportFormList.get(NumberConstant.ZERO).getPermil());
+                            profitVo.setFontColor(profitReportFormList.get(NumberConstant.ZERO).getFontColor());
                         } else {
                             profitVo.setDataType(NumberConstant.ONE);
                             profitVo.setDecimalPlace(NumberConstant.TWO);
@@ -3632,6 +3635,7 @@ public class CostDepartmentProfitServiceImpl extends BaseBatchServiceImpl<CostDe
                     vo.setPermil(reportForm.getPermil());
                     vo.setDataType(reportForm.getDataType());
                     vo.setDecimalPlace(reportForm.getDecimalPlace());
+                    vo.setFontColor(reportForm.getFontColor());
                 }
             }
 

+ 1 - 0
src/main/java/com/kcim/service/impl/HospProfitAndLossServiceImpl.java

@@ -1807,6 +1807,7 @@ public class HospProfitAndLossServiceImpl extends ServiceImpl<HospProfitAndLossM
         profitVo.setDataType(reportForm.getDataType());
         profitVo.setDecimalPlace(reportForm.getDecimalPlace());
         profitVo.setPermil(reportForm.getPermil());
+        profitVo.setFontColor(reportForm.getFontColor());
         return profitVo;
     }
 

+ 1 - 1
src/main/java/com/kcim/service/impl/IncomeCollectionServiceImpl.java

@@ -320,7 +320,7 @@ public class IncomeCollectionServiceImpl
         // 查询需要的数据 DB
         List<CollectedVO> list = baseMapper.getCollectList(collectDTO);
         int count = baseMapper.getCollectListCount(collectDTO);
-        BigDecimal totalAmount = baseMapper.getTotalAmount(collectDTO);
+        BigDecimal totalAmount = baseMapper.getShareLevelTotalAmount(collectDTO);
         BigDecimal responsibilityTotalAmount = baseMapper.getResponsibilityTotalAmount(collectDTO);
 
         return new PageUtils(list, count, pageSize, current + 1, totalAmount,responsibilityTotalAmount);

+ 88 - 1
src/main/java/com/kcim/service/impl/ResponsibilityServiceImpl.java

@@ -53,7 +53,7 @@ public class ResponsibilityServiceImpl extends ServiceImpl<ResponsibilityMapper,
      * @return
      */
     @Override
-    public List<CostResponsibilityVO> getList( ) {
+    public List<CostResponsibilityVO> getList() {
         // 1. 获取所有的列表然后组装
         List<CostResponsibilityVO> costResponsibilityVOS = this.getCostResponsibilityVO();
         // 拷贝组合
@@ -89,6 +89,76 @@ public class ResponsibilityServiceImpl extends ServiceImpl<ResponsibilityMapper,
 //        }
 //        return all;
     }
+
+    @Override
+    public List<CostResponsibilityVO> getSharelevelRespList(Integer shareId, String filter) {
+        // 1. 获取指定层级和过滤条件的责任中心
+        List<CostResponsibilityVO> shareLevelResponsibilityVOS = this.getShareLevelResponsibilityVO(shareId, filter);
+        if (CollectionUtils.isEmpty(shareLevelResponsibilityVOS)) {
+            return new ArrayList<>();
+        }
+
+        // 2. 获取所有的责任中心用于构建完整树结构
+        List<CostResponsibilityVO> allResponsibilityVOS = this.getCostResponsibilityVO();
+
+        // 3. 构建ID映射,用于快速查找
+        Map<Long, CostResponsibilityVO> idMap = allResponsibilityVOS.stream()
+                .collect(Collectors.toMap(CostResponsibilityVO::getId, i -> i, (existing, replacement) -> existing));
+
+        // 4. 收集需要返回的所有责任中心ID(包括父级)
+        Set<Long> needReturnIds = new HashSet<>();
+
+        // 将满足条件的责任中心及其所有父级加入集合
+        for (CostResponsibilityVO vo : shareLevelResponsibilityVOS) {
+            // 添加自身
+            needReturnIds.add(vo.getId());
+            // 添加所有父级
+            Long parentId = vo.getParentId();
+            while (parentId != null && parentId != 0) {
+                needReturnIds.add(parentId);
+                CostResponsibilityVO parent = idMap.get(parentId);
+                if (parent != null) {
+                    parentId = parent.getParentId();
+                } else {
+                    break;
+                }
+            }
+        }
+
+        // 5. 筛选出需要返回的责任中心
+        List<CostResponsibilityVO> needReturnList = allResponsibilityVOS.stream()
+                .filter(vo -> needReturnIds.contains(vo.getId()))
+                .collect(Collectors.toList());
+
+        // 6. 添加字典数据
+        List<DictDataVo> responsibilityType = getResponsibilityType();
+        Map<String, String> dictMap = responsibilityType.stream()
+                .collect(Collectors.toMap(DictDataVo::getCode, DictDataVo::getName, (a, b) -> b));
+
+        List<DictDataVo> standardShareLevel = getStandardShareLevel();
+        Map<String, String> standardDictMap = standardShareLevel.stream()
+                .collect(Collectors.toMap(DictDataVo::getCode, DictDataVo::getName, (a, b) -> b));
+
+        for (CostResponsibilityVO responsibility : needReturnList) {
+            if (!StringUtils.isEmpty(responsibility.getType())) {
+                responsibility.setTypeName(dictMap.get(responsibility.getType()));
+            }
+            if (!StringUtils.isEmpty(responsibility.getStandardShareLevel())) {
+                responsibility.setStandardShareLevelName(standardDictMap.get(responsibility.getStandardShareLevel()));
+            }
+        }
+
+        // 7. 构建多层级树结构
+        List<CostResponsibilityVO> result = needReturnList.stream()
+                .filter(i -> i.getParentId() == 0)  // 只取顶级节点
+                .peek(i -> i.setChild(this.getResponsibilityChildren(i, needReturnList)))
+                .collect(Collectors.toList());
+
+        // 8. 排序
+        responsibilitySort(result);
+        return result;
+    }
+
     private void responsibilitySort(List<CostResponsibilityVO> responsibilityList){
         for (CostResponsibilityVO responsibility :responsibilityList){
             if(!CollectionUtils.isEmpty(responsibility.getChild())){
@@ -111,6 +181,23 @@ public class ResponsibilityServiceImpl extends ServiceImpl<ResponsibilityMapper,
         return BeanUtil.convertList(list, CostResponsibilityVO.class);
     }
 
+    private List<CostResponsibilityVO> getShareLevelResponsibilityVO(Integer shareId, String filter ) {
+        LambdaQueryWrapper<Responsibility> queryWrapper = new LambdaQueryWrapper<Responsibility>()
+                .eq(Responsibility::getHospId, UserContext.getHospId())
+                .orderByDesc(Responsibility::getCreateTime);
+        if(shareId != null){
+            queryWrapper.eq(Responsibility::getShareId,shareId);
+        }
+        if(!StringUtils.isEmpty(filter)){
+            queryWrapper.like(Responsibility::getResponsibilityName,filter);
+        }
+        List<Responsibility> list = this.list(queryWrapper);
+        if (CollUtil.isEmpty(list)) {
+            return Collections.emptyList();
+        }
+        return BeanUtil.convertList(list, CostResponsibilityVO.class);
+    }
+
     /**
      * 获取子层级
      *

+ 5 - 0
src/main/java/com/kcim/vo/CommonTitleReportVo.java

@@ -35,6 +35,11 @@ public class CommonTitleReportVo {
      */
     private Integer permil;
 
+    /**
+     * 字体颜色
+     */
+    private String fontColor;
+
     private List<CommonTitleReportVo> childTitle;
 
     public CommonTitleReportVo(Long reportId, Long parentReportId, String reportName, Integer sort) {

+ 5 - 0
src/main/java/com/kcim/vo/CostProfitVo.java

@@ -119,6 +119,11 @@ public class CostProfitVo implements Serializable {
 	 */
 	private Integer permil;
 
+	/**
+	 * 字体颜色
+	 */
+	private String fontColor;
+
 	/**
 	 * 预算金额
 	 */

+ 5 - 0
src/main/java/com/kcim/vo/HospProfitVO.java

@@ -106,4 +106,9 @@ public class HospProfitVO {
      * 是否有千分号
      */
     private Integer permil;
+
+    /**
+     * 字体颜色
+     */
+    private String fontColor;
 }

+ 5 - 0
src/main/java/com/kcim/vo/ReportFormVO.java

@@ -75,6 +75,11 @@ public class ReportFormVO {
      */
     private Integer permil;
 
+    /**
+     * 字体颜色
+     */
+    private String fontColor;
+
     /**
      * 报表与诊次床日关联的状态
      */

+ 15 - 0
src/main/java/com/kcim/web/ResponsibilityController.java

@@ -37,6 +37,21 @@ public class ResponsibilityController extends AbstractController{
         return Result.ok(pageUtils);
     }
 
+    /**
+     * 获取指定分摊层级的责任中心列表
+     * @param shareId 分摊层级ID列表
+     * @param filter 责任中心的过滤条件
+     * @return
+     */
+    @ApiOperation("获取指定分摊层级的责任中心列表")
+    @GetMapping("/getSharelevelRespList")
+    public Result getSharelevelRespList(@RequestParam(required = false) Integer shareId,
+                                        @RequestParam(required = false) String filter) {
+        List<CostResponsibilityVO> list = responsibilityService.getSharelevelRespList( shareId,filter);
+        PageUtils pageUtils = new PageUtils(list,0,0,0);
+        return Result.ok(pageUtils);
+    }
+
     @ApiOperation("收入归集设置需要的责任中心列表")
     @GetMapping("/responsibilityList")
     public Result responsibilityList() {

+ 18 - 0
src/main/resources/mapper/IncomeCollectionMapper.xml

@@ -64,6 +64,24 @@
         </if>
 
     </select>
+
+    <select id="getShareLevelTotalAmount" resultType="java.math.BigDecimal">
+        SELECT
+        IFNULL(sum(amount), 0) AS totalAmount
+        FROM
+        cost_income_collection a
+        INNER JOIN cost_responsibility b ON a.responsibility_code = b.responsibility_code
+        AND b.delete_time = 0
+        AND b.hosp_id = #{collectDTO.hospId}
+        WHERE
+        a.delete_time = 0 and a.hosp_id = #{collectDTO.hospId}
+        <if test="collectDTO.date != null and collectDTO.date != ''">
+            and a.`year` = YEAR(concat(#{collectDTO.date},'01')) and a.`month` = MONTH(concat(#{collectDTO.date},'01'))
+        </if>
+        <if test="collectDTO.shareId != null">
+            and b.`share_id` = #{collectDTO.shareId}
+        </if>
+    </select>
     <select id="getResponsibilityTotalAmount" resultType="java.math.BigDecimal">
         select IFNULL(sum(amount),0) as totalAmount from cost_income_collection
         where delete_time = 0 and hosp_id = #{collectDTO.hospId}