소스 검색

Merge branch 'master' of D:\IDEA\医管\CostAccount with conflicts.

ljx 4 년 전
부모
커밋
6704660be0
23개의 변경된 파일1443개의 추가작업 그리고 7개의 파일을 삭제
  1. 3 1
      src/main/java/com/imed/costaccount/mapper/AllocationMapper.java
  2. 28 0
      src/main/java/com/imed/costaccount/mapper/AllocationMapper.xml
  3. 11 2
      src/main/java/com/imed/costaccount/mapper/CostCostingCollectionMapper.java
  4. 16 0
      src/main/java/com/imed/costaccount/mapper/CostDepartmentProfitMapper.java
  5. 82 0
      src/main/java/com/imed/costaccount/model/CostDepartmentProfit.java
  6. 94 0
      src/main/java/com/imed/costaccount/model/vo/AllocationReportVO.java
  7. 2 1
      src/main/java/com/imed/costaccount/model/vo/CostCostingVO.java
  8. 56 0
      src/main/java/com/imed/costaccount/model/vo/CostDepartmentProfitVO.java
  9. 34 0
      src/main/java/com/imed/costaccount/model/vo/ResponsibilityAccountVO.java
  10. 28 0
      src/main/java/com/imed/costaccount/model/vo/SplitLevelVO.java
  11. 30 0
      src/main/java/com/imed/costaccount/model/vo/TargetShareParamValue.java
  12. 44 0
      src/main/java/com/imed/costaccount/model/vo/TargetSplitLevelVO.java
  13. 11 0
      src/main/java/com/imed/costaccount/service/AllocationService.java
  14. 10 1
      src/main/java/com/imed/costaccount/service/CostCostingCollectionService.java
  15. 33 0
      src/main/java/com/imed/costaccount/service/CostDepartmentProfitService.java
  16. 8 0
      src/main/java/com/imed/costaccount/service/impl/AllocationServiceImpl.java
  17. 526 0
      src/main/java/com/imed/costaccount/service/impl/CostCostingCollectionServiceImpl.java
  18. 225 0
      src/main/java/com/imed/costaccount/service/impl/CostDepartmentProfitServiceImpl.java
  19. 3 0
      src/main/java/com/imed/costaccount/web/CostCostingCollectionController.java
  20. 98 0
      src/main/java/com/imed/costaccount/web/CostDepartmentProfitController.java
  21. 72 2
      src/main/java/com/imed/costaccount/web/ExcelController.java
  22. 5 0
      src/main/resources/mapper/CostCostingCollectionMapper.xml
  23. 24 0
      src/main/resources/mapper/CostDepartmentProfitMapper.xml

+ 3 - 1
src/main/java/com/imed/costaccount/mapper/AllocationMapper.java

@@ -1,6 +1,8 @@
 package com.imed.costaccount.mapper;
 
+
 import com.imed.costaccount.model.Allocation;
+
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.imed.costaccount.model.vo.AfterAllocationVO;
 import org.apache.ibatis.annotations.Mapper;
@@ -13,7 +15,7 @@ import java.util.List;
  * 成本分摊后表
  * 
  * @author huangrui
- * @date 2021-08-24 16:05:16
+ * @date 2021-08-25 08:45:06
  */
 @Mapper
 public interface AllocationMapper extends BaseMapper<Allocation> {

+ 28 - 0
src/main/java/com/imed/costaccount/mapper/AllocationMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.imed.costaccount.mapper.AllocationMapper">
+
+	<!-- 可根据自己的需求,是否要使用 -->
+    <resultMap type="com.imed.costaccount.model.Allocation" id="allocationMap">
+        <result property="id" column="id"/>
+        <result property="dateYear" column="date_year"/>
+        <result property="dateMonth" column="date_month"/>
+        <result property="levelSort" column="level_sort"/>
+        <result property="levelName" column="level_name"/>
+        <result property="hospId" column="hosp_id"/>
+        <result property="responsibilityCode" column="responsibility_code"/>
+        <result property="responsibilityName" column="responsibility_name"/>
+        <result property="accountShareId" column="account_share_id"/>
+        <result property="isBaseCost" column="is_base_cost"/>
+        <result property="amount" column="amount"/>
+        <result property="targetResponsibilityCode" column="target_responsibility_code"/>
+        <result property="targetResponsibilityName" column="target_responsibility_name"/>
+        <result property="shareParamCode" column="share_param_code"/>
+        <result property="shareParamName" column="share_param_name"/>
+        <result property="createTime" column="create_time"/>
+        <result property="deleteTime" column="delete_time"/>
+    </resultMap>
+
+
+</mapper>

+ 11 - 2
src/main/java/com/imed/costaccount/mapper/CostCostingCollectionMapper.java

@@ -1,8 +1,12 @@
 package com.imed.costaccount.mapper;
 
-import com.imed.costaccount.model.CostCostingCollection;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.imed.costaccount.model.CostCostingCollection;
+import com.imed.costaccount.model.vo.CostDepartmentProfitVO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 成本数据归集后列表
@@ -12,5 +16,10 @@ import org.apache.ibatis.annotations.Mapper;
  */
 @Mapper
 public interface CostCostingCollectionMapper extends BaseMapper<CostCostingCollection> {
-	
+    /**
+     * 科室损益计算  按照会计科目计算方式  查询责任中心下的所有值
+     * @param hospId
+     * @return
+     */
+    List<CostDepartmentProfitVO> selectGroupBy(@Param("hospId") Long hospId);
 }

+ 16 - 0
src/main/java/com/imed/costaccount/mapper/CostDepartmentProfitMapper.java

@@ -0,0 +1,16 @@
+package com.imed.costaccount.mapper;
+
+import com.imed.costaccount.model.CostDepartmentProfit;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 科室损益计算
+ * 
+ * @author KCYG
+ * @date 2021-08-24 16:24:08
+ */
+@Mapper
+public interface CostDepartmentProfitMapper extends BaseMapper<CostDepartmentProfit> {
+	
+}

+ 82 - 0
src/main/java/com/imed/costaccount/model/CostDepartmentProfit.java

@@ -0,0 +1,82 @@
+package com.imed.costaccount.model;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 科室损益计算
+ * 
+ * @author KCYG
+ * @email KCYG@xinxicom
+ * @date 2021-08-24 16:24:08
+ */
+@Data
+@Accessors(chain = true)
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName("cost_department_profit")
+public class CostDepartmentProfit implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 主键
+	 */
+	@TableId
+	private Long id;
+	/**
+	 * 年份
+	 */
+	private Integer year;
+	/**
+	 * 月份
+	 */
+	private Integer month;
+	/**
+	 * 报表项目编号
+	 */
+	private String reportNum;
+	/**
+	 * 报表项目
+	 */
+	private String reportName;
+	/**
+	 * 责任中心代码
+	 */
+	private String responsibilityCode;
+	/**
+	 * 责任中心名称
+	 */
+	private String responsibilityName;
+	/**
+	 * 成本类型
+	 */
+	private Integer costType;
+	/**
+	 * 收入类型
+	 */
+	private Integer incomeType;
+	/**
+	 * 金额
+	 */
+	private BigDecimal amount;
+	/**
+	 * 医院id
+	 */
+	private Long hospId;
+	/**
+	 * 创建时间
+	 */
+	private Long createTime;
+	/**
+	 * 删除时间
+	 */
+	private Long deleteTime;
+
+}

+ 94 - 0
src/main/java/com/imed/costaccount/model/vo/AllocationReportVO.java

@@ -0,0 +1,94 @@
+package com.imed.costaccount.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @author 李加喜
+ * @Package com.imed.costaccount.model
+ * @date 2021-08-25 9:56
+ */
+@Data
+@ApiModel("成本分摊报表输出")
+public class AllocationReportVO {
+    /**
+     * 责任中心代码
+     */
+    private String responsibilityCode;
+    /**
+     * 责任中心名称
+     */
+    private String responsibilityName;
+    /**
+     * 分摊层级序号
+     */
+    private Integer levelSort;
+    /**
+     * 分摊设置对应的Id
+     */
+    private Long accountShareId;
+    // TODO 自己获取
+    /**
+     * 会计科目代码
+     */
+    private String accountCode;
+    /**
+     *  会计科目名称
+     */
+    private String accountName;
+    /**
+     * 别名
+     */
+    private String alias;
+    /**
+     * 成本金额
+     */
+    private BigDecimal totalAmount;
+    /**
+     * 成本金额字符串类型  Excel显示
+     */
+    private String totalAmounts;
+    /**
+     * 目标层级责任中心代码
+     */
+    private String targetResponsibilityCode;
+    /**
+     * 目标层级责任中心名称
+     */
+    private String targetResponsibilityName;
+    /**
+     * 目标层级责任中心第n次分摊金额
+     */
+    private List<String> targetShareMoneys;
+    /**
+     * 分摊参数
+     */
+    private String shareParamName;
+    /**
+     * 分摊数值
+     */
+    private BigDecimal shareParamValueNum;
+    /**
+     * 分摊数值字符串类型  Excel显示
+     */
+    private String shareParamValueNums;
+    /**
+     *  分摊比例
+     */
+    private BigDecimal shareParamRate;
+    /**
+     * 分摊比例字符串类型   Excel显示
+     */
+    private String shareParamRates;
+    /**
+     * 各参数分摊到的成本金额
+     */
+    private BigDecimal amount;
+    /**
+     * 各参数分摊到的成本金额字符串类型  amounts
+     */
+    private String amounts;
+}

+ 2 - 1
src/main/java/com/imed/costaccount/model/vo/CostCostingVO.java

@@ -21,6 +21,7 @@ public class CostCostingVO {
      * 责任中心名称
      */
     private String responsibilityName;
+    // TODO 自己获取
     /**
      * 会计科目代码
      */
@@ -36,7 +37,7 @@ public class CostCostingVO {
     /**
      * 成本金额
      */
-    private String accountMoney;
+    private String amount;
     /**
      * 目标层级责任中心代码
      */

+ 56 - 0
src/main/java/com/imed/costaccount/model/vo/CostDepartmentProfitVO.java

@@ -0,0 +1,56 @@
+package com.imed.costaccount.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author 李加喜
+ * @Package com.imed.costaccount.model.vo
+ * @date 2021-08-24 17:22
+ */
+@Data
+@ApiModel("科室损益计算返回类型")
+public class CostDepartmentProfitVO {
+
+    @ApiModelProperty(name = "id",value = "主键")
+    private Long id;
+
+    @ApiModelProperty(name = "year",value = "年")
+    private Integer year;
+
+    @ApiModelProperty(name = "month",value = "月")
+    private Integer month;
+
+    @ApiModelProperty(name = "reportParentId",value = "报表父级Id")
+    private Long reportParentId;
+
+    @ApiModelProperty(name = "levelSort",value = "分摊层级编号")
+    private Integer levelSort;
+
+    @ApiModelProperty(name = "reportNum",value = "报表项目编号")
+    private Integer reportNum;
+
+    @ApiModelProperty(name = "reportName",value = "报表项目名称")
+    private String reportName;
+
+    @ApiModelProperty(name = "responsibilityCode",value = "责任中心的代码")
+    private String responsibilityCode;
+
+    @ApiModelProperty(name = "responsibilityName",value = "责任中心名称")
+    private String responsibilityName;
+
+    @ApiModelProperty(name = "costType",value = "成本类型")
+    private Integer costType;
+
+    @ApiModelProperty(name = "incomeType",value = "收入类型")
+    private Integer incomeType;
+
+    @ApiModelProperty(name = "hospId",value = "医院类型")
+    private Long hospId;
+
+    @ApiModelProperty(name = "amount",value = "金额")
+    private BigDecimal amount;
+}

+ 34 - 0
src/main/java/com/imed/costaccount/model/vo/ResponsibilityAccountVO.java

@@ -0,0 +1,34 @@
+package com.imed.costaccount.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+ * @author 李加喜
+ * @Package com.imed.costaccount.model.vo
+ * @date 2021-08-23 11:24
+ */
+@Data
+@ApiModel("责任中心对应会计科目列表")
+public class ResponsibilityAccountVO {
+    /**
+     * 会计科目代码
+     */
+    private String accountingIds;
+    /**
+     * 会计科目的名称
+     */
+    private String accountingNames;
+    /**
+     * 会计科目的代码
+     */
+    private String accountingCodes;
+    /**
+     * 别名
+     */
+    private String alias;
+    /**
+     * 金额
+     */
+    private String money;
+}

+ 28 - 0
src/main/java/com/imed/costaccount/model/vo/SplitLevelVO.java

@@ -0,0 +1,28 @@
+package com.imed.costaccount.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author 李加喜
+ * @Package com.imed.costaccount.model.vo
+ * @date 2021-08-23 11:20
+ */
+@Data
+@ApiModel("分摊层级责任中心相关数据")
+public class SplitLevelVO {
+    /**
+     * 责任中心代码
+     */
+    private String responsibilityCode;
+    /**
+     * 责任中心名称
+     */
+    private String responsibilityName;
+    /**
+     * 当前责任中心下面所有的会计科目和别名信息
+     */
+    private List<ResponsibilityAccountVO> responsibilityAccountVOList;
+}

+ 30 - 0
src/main/java/com/imed/costaccount/model/vo/TargetShareParamValue.java

@@ -0,0 +1,30 @@
+package com.imed.costaccount.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+ * @author 李加喜
+ * @Package com.imed.costaccount.model.vo
+ * @date 2021-08-23 11:39
+ */
+@Data
+@ApiModel("报表目标责任中心数据的分摊参数数据")
+public class TargetShareParamValue {
+    /**
+     *  分摊参数代码
+     */
+    private String shareParamCode;
+    /**
+     *  分摊参数名称
+     */
+    private String shareParamName;
+    /**
+     *  分摊参数值
+     */
+    private String shareParamValue;
+    /**
+     * 参数比例
+     */
+    private String shareParamProportion;
+}

+ 44 - 0
src/main/java/com/imed/costaccount/model/vo/TargetSplitLevelVO.java

@@ -0,0 +1,44 @@
+package com.imed.costaccount.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author 李加喜
+ * @Package com.imed.costaccount.model.vo
+ * @date 2021-08-23 11:33
+ */
+@Data
+@ApiModel("目标责任中心对应的")
+public class TargetSplitLevelVO {
+    /**
+     * 当前责任中心的id
+     */
+    private Long responsibilityId;
+    /**
+     * 当前责任中心的代码
+     */
+    private String responsibilityCode;
+    /**
+     * 当前责任中心的名称
+     */
+    private String responsibilityName;
+    /**
+     * 第一次分摊的金额
+     */
+    private String oneShareMoney;
+    /**
+     * 第二次分摊金额
+     */
+    private String twoShareMoney;
+    /**
+     * 第三次分摊金额
+     */
+    private String threeShareMoney;
+    /**
+     * 分摊参数设置数据
+     */
+    private List<TargetShareParamValue> targetShareParamValueList;
+}

+ 11 - 0
src/main/java/com/imed/costaccount/service/AllocationService.java

@@ -33,5 +33,16 @@ public interface AllocationService extends IService<Allocation> {
      */
     PageUtils queryAfterAllocation(String year, String responsibilityCode, Integer current, Integer pageSize, Long hospId);
 
+
+    /**
+     *  分摊报表导出
+     * @param writer {@link ExcelWriter}
+     * @param levelSort 分摊层级  就是第几次分摊
+     * @param sheet 报表
+     * @param year 年
+     * @param month 月
+     * @return
+     */
+    ExcelWriter getShareReportTemplate(ExcelWriter writer, Integer levelSort, Sheet sheet, Integer year, Integer month);
 }
 

+ 10 - 1
src/main/java/com/imed/costaccount/service/CostCostingCollectionService.java

@@ -1,7 +1,9 @@
 package com.imed.costaccount.service;
 
+import cn.hutool.poi.excel.ExcelWriter;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.imed.costaccount.model.CostCostingCollection;
+import org.apache.poi.ss.usermodel.Sheet;
 
 /**
  * 成本数据归集后列表
@@ -11,6 +13,13 @@ import com.imed.costaccount.model.CostCostingCollection;
  * @date 2021-08-18 15:27:02
  */
 public interface CostCostingCollectionService extends IService<CostCostingCollection> {
-
+    /**
+     * 分摊后报表输出
+     * @param writer
+     * @param shareNumber
+     * @param sheet
+     * @return
+     */
+    ExcelWriter getShareReportTemplate(ExcelWriter writer, Integer shareNumber, Sheet sheet);
 }
 

+ 33 - 0
src/main/java/com/imed/costaccount/service/CostDepartmentProfitService.java

@@ -0,0 +1,33 @@
+package com.imed.costaccount.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.imed.costaccount.common.util.PageUtils;
+import com.imed.costaccount.model.CostDepartmentProfit;
+
+/**
+ * 科室损益计算
+ *
+ * @author KCYG
+ * @email KCYG@xinxicom
+ * @date 2021-08-24 16:24:08
+ */
+public interface CostDepartmentProfitService extends IService<CostDepartmentProfit> {
+    /**
+     * 查询科室损益数据
+     * @param current
+     * @param pageSize
+     * @param responsibilityCode
+     * @param date
+     * @param hospId
+     * @return
+     */
+    PageUtils queryList(Integer current, Integer pageSize, String responsibilityCode, String date, Long hospId);
+
+    /**
+     * 科室损益计算
+     * @param date
+     * @param hospId
+     */
+    void setDepartmentProfit(String date, Long hospId);
+}
+

+ 8 - 0
src/main/java/com/imed/costaccount/service/impl/AllocationServiceImpl.java

@@ -4,18 +4,26 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.poi.excel.ExcelWriter;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.imed.costaccount.common.constants.NumberConstant;
 import com.imed.costaccount.common.exception.CostException;
+import com.imed.costaccount.common.util.BeanUtil;
 import com.imed.costaccount.common.util.JacksonUtil;
+import com.imed.costaccount.common.util.UserContext;
 import com.imed.costaccount.common.util.PageUtils;
 import com.imed.costaccount.mapper.AllocationMapper;
 import com.imed.costaccount.model.*;
 import com.imed.costaccount.model.dto.StartDTO;
 import com.imed.costaccount.model.vo.AccountShareVO;
+import com.imed.costaccount.model.vo.AllocationReportVO;
 import com.imed.costaccount.model.vo.AfterAllocationVO;
 import com.imed.costaccount.model.vo.CostShareLevelVO;
 import com.imed.costaccount.service.*;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;

+ 526 - 0
src/main/java/com/imed/costaccount/service/impl/CostCostingCollectionServiceImpl.java

@@ -1,14 +1,540 @@
 package com.imed.costaccount.service.impl;
 
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.poi.excel.ExcelWriter;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.imed.costaccount.common.exception.CostException;
+import com.imed.costaccount.constants.NumberConstant;
 import com.imed.costaccount.mapper.CostCostingCollectionMapper;
 import com.imed.costaccount.model.CostCostingCollection;
+import com.imed.costaccount.model.vo.*;
 import com.imed.costaccount.service.CostCostingCollectionService;
+import com.imed.costaccount.service.CostShareLevelService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.usermodel.Sheet;
 import org.springframework.stereotype.Service;
 
+import java.util.*;
+import java.util.stream.Collectors;
 
+@Slf4j
 @Service("costCostingCollectionService")
 public class CostCostingCollectionServiceImpl extends ServiceImpl<CostCostingCollectionMapper, CostCostingCollection> implements CostCostingCollectionService {
 
+    private final CostShareLevelService costShareLevelService;
 
+    public CostCostingCollectionServiceImpl(CostShareLevelService costShareLevelService) {
+        this.costShareLevelService = costShareLevelService;
+    }
+
+    /**
+     * 分摊后报表输出
+     *
+     * @param writer
+     * @param shareNumber
+     * @param sheet
+     * @return
+     */
+    @Override
+    public ExcelWriter getShareReportTemplate(ExcelWriter writer, Integer shareNumber, Sheet sheet) {
+        // 需要封装两个  分摊层级责任中心集合  目标层级责任中心
+        // 分摊层级责任中心集合
+//        LinkedList<SplitLevelVO> splitLevelVOLinkedList = new LinkedList<>();
+//        // 目标层级责任中心集合
+//        LinkedList<TargetSplitLevelVO> targetSplitLevelVOLinkedList = new LinkedList<>();
+//        setMockData(splitLevelVOLinkedList, targetSplitLevelVOLinkedList);
+        List<CostCostingVO> costCostingVOS = setMockDa();
+        Map<String, List<CostCostingVO>> responsibilityMap = costCostingVOS.stream().collect(Collectors.groupingBy(CostCostingVO::getResponsibilityCode));
+//        Map<String, String> collect = costCostingVOS.stream().collect(Collectors.toMap(CostCostingVO::getResponsibilityCode, CostCostingVO::getAccountCode));
+        Map<String, List<CostCostingVO>> targetResponsibilityMap = costCostingVOS.stream().collect(Collectors.groupingBy(CostCostingVO::getTargetResponsibilityCode));
+        Map<String, CostCostingVO> allAccMap = costCostingVOS.stream().collect(Collectors.toMap(k -> k.getResponsibilityName()+k.getAccountName()+k.getTargetResponsibilityName()+k.getShareParamName(), synOne -> synOne));
+        Map<String, CostCostingVO> allAliMap = costCostingVOS.stream().collect(Collectors.toMap(k -> k.getResponsibilityName()+k.getAlias()+k.getTargetResponsibilityName()+k.getShareParamName(), synOne -> synOne));
+        // 当前责任中心下面有几个会计科目  后面进行合并使用
+        int numResponsibility;
+        // 从第几列开始编写数据
+        int column = shareNumber + 4;
+        // 总共有多少个单元格
+//        Integer shareLevelGrid = 0;
+        Set<String> keySet = responsibilityMap.keySet();
+        for (String key : keySet) {
+            List<CostCostingVO> costCostingVOS1 = responsibilityMap.get(key);
+            Map<String, CostCostingVO> linkedHashMap = new LinkedHashMap<>();
+            costCostingVOS1.forEach(i -> {
+                String s = i.getResponsibilityCode() + i.getAccountCode();
+                if (!linkedHashMap.containsKey(s)) {
+                    linkedHashMap.put(s, i);
+                }
+            });
+            numResponsibility = linkedHashMap.size();
+            if (numResponsibility >= NumberConstant.TWO) {
+                // 需要合并单元格
+//                writer.merge(0, 0, column, column + numResponsibility - 1, costCostingVOS1.get(0).getResponsibilityName(), false);
+                // 设置对应的会计科目或者别名
+                Set<String> strings = linkedHashMap.keySet();
+                for (String s : strings) {
+                    CostCostingVO costCostingVO = linkedHashMap.get(s);
+                    if (StrUtil.isBlank(costCostingVO.getAlias())) {
+                        writer.writeCellValue(column,0,costCostingVO.getResponsibilityName());
+                        // 别名不存在
+                        writer.writeCellValue(column, 1, costCostingVO.getAccountName());
+                    } else {
+                        // 不为空 设置别名
+                        writer.writeCellValue(column,0,costCostingVO.getResponsibilityName());
+                        writer.writeCellValue(column, 1, costCostingVO.getAlias());
+                    }
+                    writer.writeCellValue(column, 2, costCostingVO.getAmount());
+                    column++;
+                }
+//                for (int j=0;j<numResponsibility;j++){
+//                    CostCostingVO costCostingVO = costCostingVOS1.get(j);
+//                    if (StrUtil.isBlank(costCostingVO.getAlias())){
+//                        // 别名不存在
+//                        writer.writeCellValue(j+column,1,costCostingVO.getAccountName());
+//                    }else {
+//                        // 不为空 设置别名
+//                        writer.writeCellValue(j+column,1,costCostingVO.getAlias());
+//                    }
+//                    writer.writeCellValue(j+column,2,costCostingVO.getAmount());
+//                }
+//                column+=numResponsibility;
+            } else {
+                // 不需要合并单元格
+                writer.writeCellValue(column, 0, costCostingVOS1.get(0).getResponsibilityName());
+                writer.writeCellValue(column, 1, costCostingVOS1.get(0).getAccountName());
+                writer.writeCellValue(column, 2, costCostingVOS1.get(0).getAmount());
+                column++;
+            }
+        }
+//        for (int i=0; i< responsibilityMap.size();i++){
+        // 判断当前当成的责任中心对应的分摊参数的数量
+//            List<CostCostingVO> costCostingVOS1 = responsibilityMap.get(responsibilityCode);
+//            numResponsibility=costCostingVOS1.size();
+//            shareLevelGrid+=numResponsibility;
+//            if (numResponsibility>= NumberConstant.TWO){
+//                writer.merge(0,0,column,column+numResponsibility-1,costCostingVOS1.get(0).getResponsibilityName(),false);
+//                // 设置对应的会计科目或者金额
+//                for (int j=0;j<numResponsibility;j++){
+//                    CostCostingVO costCostingVO = costCostingVOS1.get(j);
+//                    if (StrUtil.isBlank(costCostingVO.getAlias())){
+//                        // 别名不存在的时候
+//                        writer.writeCellValue(j+column,1,costCostingVO.getAccountName());
+//                    }else {
+//                        // 为空的话设置别名
+//                        writer.writeCellValue(j+column,1,costCostingVO.getAlias());
+//                    }
+//                    writer.writeCellValue(j+column,2,costCostingVO.getAccountName());
+//                }
+//                column+=numResponsibility;
+//            }else {
+//                writer.writeCellValue(column,0,costCostingVOS1.get(0).getResponsibilityName());
+//                writer.writeCellValue(column,1,costCostingVOS1.get(0).getAccountName());
+//                writer.writeCellValue(column,2,costCostingVOS1.get(0).getMoney());
+//                column++;
+//            }
+//        }
+        // 设置单元格合并
+        for (int j = 1; j <= shareNumber; j++) {
+            writer.merge(0, 1, j, j, "第" + j + "次分摊", false);
+        }
+        // 目标责任集合
+        writer.passCurrentRow();
+        // 从第三行开始
+        int num = 3;
+        Set<String> targetSet = targetResponsibilityMap.keySet();
+        for (String target : targetSet) {
+            List<CostCostingVO> costCostingVOS1 = targetResponsibilityMap.get(target);
+            Map<String, CostCostingVO> linkedHashMap = new LinkedHashMap<>();
+            costCostingVOS1.forEach(i -> {
+                String s = i.getTargetResponsibilityCode() + i.getShareParamName();
+                if (!linkedHashMap.containsKey(s)) {
+                    linkedHashMap.put(s, i);
+                }
+            });
+            int shareParamSize = linkedHashMap.size();
+            if (shareParamSize >= NumberConstant.TWO) {
+                // 责任中心
+                CostCostingVO costCostingVO = costCostingVOS1.get(0);
+//                writer.merge(num, num + shareParamSize - 1, 0, 0, costCostingVO.getTargetResponsibilityName(), false);
+                // 设置第几次分摊的值
+                for (int k = 0; k < shareNumber; k++) {
+                    writer.merge(num, num + shareParamSize - 1, k + 1, k + 1, costCostingVO.getTargetShareMoneys().get(k), false);
+                }
+                // 设置对应的分摊参数值
+                Set<String> strings = linkedHashMap.keySet();
+                for (String s : strings) {
+                    CostCostingVO costCostingVO1 = linkedHashMap.get(s);
+                    writer.writeCellValue(0,num,costCostingVO1.getTargetResponsibilityName());
+                    writer.writeCellValue(shareNumber + 1, num, costCostingVO1.getShareParamName());
+                    writer.writeCellValue(shareNumber + 2, num, costCostingVO1.getShareValue());
+                    writer.writeCellValue(shareNumber + 3, num, costCostingVO1.getShareParamProportion());
+                    for (int m=shareNumber+4;m<column;m++){
+                        // x是m y是num
+                        // 获取当前这一列对应的责任中心 以及会计科目
+                        // 第一行责任中心
+                        String responsibilityName = sheet.getRow(0).getCell(m).getStringCellValue();
+                        // 第二行的会计科目或者
+                        String accountNameOrAlias = sheet.getRow(1).getCell(m).getStringCellValue();
+                        // 这一行的目标责任中心
+                        String otherResponsibilityName = sheet.getRow(num).getCell(0).getStringCellValue();
+                        // 分摊参数
+                        String shareName = sheet.getRow(num).getCell(shareNumber + 1).getStringCellValue();
+                        CostCostingVO costCostingVO2 = allAccMap.get(responsibilityName + accountNameOrAlias + otherResponsibilityName + shareName);
+                        CostCostingVO costCostingVO3 = allAliMap.get(responsibilityName + accountNameOrAlias + otherResponsibilityName + shareName);
+                        if (Objects.nonNull(costCostingVO2)){
+                            writer.writeCellValue(m,num,costCostingVO2.getMoney());
+                        }else if (Objects.nonNull(costCostingVO3)){
+                            writer.writeCellValue(m,num,costCostingVO3.getMoney());
+                        }else {
+                            throw new CostException(500,"数据异常");
+                        }
+                        // 第二行的会计科目/别名
+//                        System.out.println(responsibilityName+"--"+accountNameOrAlias+"--"+otherResponsibilityName+"--"+shareName);
+                    }
+                    num++;
+                }
+            }
+            if (shareParamSize < NumberConstant.TWO) {
+                writer.writeCellValue(0, num, costCostingVOS1.get(0).getTargetResponsibilityName());
+                for (int k = 0; k < shareNumber; k++) {
+                    writer.writeCellValue(k + 1, num, costCostingVOS1.get(0).getTargetShareMoneys().get(k));
+                }
+                writer.writeCellValue(shareNumber + 1, num, costCostingVOS1.get(0).getShareParamName());
+                writer.writeCellValue(shareNumber + 2, num, costCostingVOS1.get(0).getShareValue());
+                writer.writeCellValue(shareNumber + 3, num, costCostingVOS1.get(0).getShareParamProportion());
+                //TODO 金额没有写
+                for (int m=shareNumber+4;m<column;m++){
+                    // x是m y是num
+                    // 获取当前这一列对应的责任中心 以及会计科目
+                    // 第一行责任中心
+                    String responsibilityName = sheet.getRow(0).getCell(m).getStringCellValue();
+                    // 第二行的会计科目或者
+                    String accountNameOrAlias = sheet.getRow(1).getCell(m).getStringCellValue();
+                    // 这一行的目标责任中心
+                    String otherResponsibilityName = sheet.getRow(num).getCell(0).getStringCellValue();
+                    // 分摊参数
+                    String shareName = sheet.getRow(num).getCell(shareNumber + 1).getStringCellValue();
+                    CostCostingVO costCostingVO2 = allAccMap.get(responsibilityName + accountNameOrAlias + otherResponsibilityName + shareName);
+                    CostCostingVO costCostingVO3 = allAliMap.get(responsibilityName + accountNameOrAlias + otherResponsibilityName + shareName);
+                    if (Objects.nonNull(costCostingVO2)){
+                        writer.writeCellValue(m,num,costCostingVO2.getMoney());
+                    }else if (Objects.nonNull(costCostingVO3)){
+                        writer.writeCellValue(m,num,costCostingVO3.getMoney());
+                    }else {
+                        throw new CostException(500,"数据异常");
+                    }
+                    // 第二行的会计科目/别名
+                    System.out.println(responsibilityName+"--"+accountNameOrAlias+"--"+otherResponsibilityName+"--"+shareName);
+                }
+                num++;
+            }
+        }
+//        for (int j=0;j<targetResponsibilityList.size();j++){
+//            String targetResponsibilityCode = targetResponsibilityList.get(j);
+//            // 需要判断是否需要合并单元格
+//            List<CostCostingVO> costingVOList = targetResponsibilityMap.get(targetResponsibilityCode);
+//            // 当前责任中心下面有多少个分摊参数
+//            int shareParamSize=costingVOList.size();
+//            if (shareParamSize>=NumberConstant.TWO){
+//                //设置责任中心
+//                CostCostingVO costCostingVO = costingVOList.get(0);
+//                writer.merge(j+num,j+num+shareParamSize-1,0,0,costCostingVO.getResponsibilityName(),false);
+//                // 设置第一次分摊参数值
+//                for (int k=0;k<shareNumber;k++){
+//                    writer.merge(j+num,j+num+shareParamSize-1,k+1,k+1,costCostingVO.getTargetShareMoneys().get(k),false);
+//
+//                }
+//                // 设置对应的分摊参数值
+//                for (int i=0;i<shareParamSize;i++){
+//                    // 设置分摊参数
+//                    CostCostingVO costCostingVO1 = costingVOList.get(i);
+//                    int row=j+num+i;
+//                    writer.writeCellValue(shareNumber+1,row,costCostingVO1.getShareParamName());
+//                    writer.writeCellValue(shareNumber+2,row,costCostingVO1.getShareValue());
+//                    writer.writeCellValue(shareNumber+3,row,costCostingVO1.getShareParamProportion());
+//                    //TODO 金额没有写
+////                    for (int k=shareNumber+4;k<shareLevelGrid+6;k++){
+////                        writer.writeCellValue(k,row,"0.1111");
+////                    }
+//                }
+//
+//            }
+//            num+=shareParamSize-1;
+//            if (shareParamSize<NumberConstant.TWO){
+//                writer.writeCellValue(0, j + num, costingVOList.get(0).getResponsibilityName());
+//                for (int k=0;k<shareNumber;k++){
+//                    writer.merge(j+num,j+num+shareParamSize-1,k+1,k+1,costingVOList.get(0).getTargetShareMoneys().get(k),false);
+//                }
+//                writer.writeCellValue(shareNumber+1,j+num,costingVOList.get(0).getShareParamName());
+//                writer.writeCellValue(shareNumber+2,j+num,costingVOList.get(0).getShareValue());
+//                writer.writeCellValue(shareNumber+3,j+num,costingVOList.get(0).getShareParamProportion());
+//                // TODO 金额暂时不设置
+////                for (int k=shareNumber+4;k<shareLevelGrid+6;k++){
+////                    writer.writeCellValue(k,j+num,"0.3456");
+////                }
+//            }
+//
+//        }
+        // TODO 统一设置列宽  处理中文问题
+        for (int i = 0; i < 30; i++) {
+            // 调整每一列宽度
+            sheet.autoSizeColumn((short) i);
+            // 解决自动设置列宽中文失效的问题
+            sheet.setColumnWidth(i, sheet.getColumnWidth(i) * 13 / 10);
+        }
+        // todo 合并单元格
+        return writer;
+    }
+
+//    private void setMockData(LinkedList<SplitLevelVO> splitLevelVOLinkedList, LinkedList<TargetSplitLevelVO> targetSplitLevelVOLinkedList) {
+//        // 设置分摊层级责任中心数据
+//        SplitLevelVO splitLevelVO = new SplitLevelVO();
+//        splitLevelVO.setResponsibilityName("责任中心1");
+//        splitLevelVO.setResponsibilityCode("zr1");
+//        LinkedList<ResponsibilityAccountVO> responsibilityAccountVOS = new LinkedList<>();
+//
+//        ResponsibilityAccountVO responsibilityAccountVO = new ResponsibilityAccountVO();
+//        responsibilityAccountVO.setAccountingNames("其他费用,资产改良及摊销");
+//        responsibilityAccountVO.setAccountingCodes("1825,1824");
+//        responsibilityAccountVO.setAccountingIds("57,56");
+//        responsibilityAccountVO.setMoney("12.6666");
+//        responsibilityAccountVOS.add(responsibilityAccountVO);
+//
+//        ResponsibilityAccountVO responsibilityAccountVORequest = new ResponsibilityAccountVO();
+//        responsibilityAccountVORequest.setAccountingNames("低值易耗品");
+//        responsibilityAccountVORequest.setAccountingCodes("1822");
+//        responsibilityAccountVORequest.setAccountingIds("54");
+//        responsibilityAccountVORequest.setAlias("设置了别名");
+//        responsibilityAccountVORequest.setMoney("12.1111");
+//        responsibilityAccountVOS.add(responsibilityAccountVORequest);
+//        splitLevelVO.setResponsibilityAccountVOList(responsibilityAccountVOS);
+//        splitLevelVOLinkedList.add(splitLevelVO);
+//
+//        SplitLevelVO splitLevelVO1 = new SplitLevelVO();
+//        splitLevelVO1.setResponsibilityName("责任中心2");
+//        splitLevelVO1.setResponsibilityCode("zr2");
+//        LinkedList<ResponsibilityAccountVO> responsibilityAccountVOS1 = new LinkedList<>();
+//        ResponsibilityAccountVO responsibilityAccountVORequest1 = new ResponsibilityAccountVO();
+//        responsibilityAccountVORequest1.setAccountingNames("低值易耗品");
+//        responsibilityAccountVORequest1.setAccountingCodes("1822");
+//        responsibilityAccountVORequest1.setAccountingIds("54");
+//        responsibilityAccountVORequest1.setAlias("设置的别名");
+//        responsibilityAccountVORequest1.setMoney("12.1111");
+//        responsibilityAccountVOS1.add(responsibilityAccountVORequest1);
+//        splitLevelVO1.setResponsibilityAccountVOList(responsibilityAccountVOS1);
+//        splitLevelVOLinkedList.add(splitLevelVO1);
+//
+//        TargetSplitLevelVO targetSplitLevelVO = new TargetSplitLevelVO();
+//        targetSplitLevelVO.setResponsibilityCode("zr1");
+//        targetSplitLevelVO.setResponsibilityName("责任中心1");
+//        targetSplitLevelVO.setOneShareMoney("100.1111");
+//        targetSplitLevelVO.setTwoShareMoney("200.1111");
+//        targetSplitLevelVO.setThreeShareMoney("300.1111");
+//        LinkedList<TargetShareParamValue> targetShareParamValueLinkedList = new LinkedList<>();
+//        TargetShareParamValue targetShareParamValue = new TargetShareParamValue();
+//        targetShareParamValue.setShareParamName("员工费");
+//        targetShareParamValue.setShareParamCode("A11");
+//        targetShareParamValue.setShareParamValue("66");
+//        targetShareParamValue.setShareParamProportion("0.1111");
+//        targetShareParamValueLinkedList.add(targetShareParamValue);
+//        TargetShareParamValue targetShareParamValueRequest = new TargetShareParamValue();
+//        targetShareParamValueRequest.setShareParamName("医疗收入");
+//        targetShareParamValueRequest.setShareParamCode("A22");
+//        targetShareParamValueRequest.setShareParamValue("77");
+//        targetShareParamValueRequest.setShareParamProportion("0.4444");
+//        targetShareParamValueLinkedList.add(targetShareParamValueRequest);
+//        targetSplitLevelVO.setTargetShareParamValueList(targetShareParamValueLinkedList);
+//        targetSplitLevelVOLinkedList.add(targetSplitLevelVO);
+//
+//        TargetSplitLevelVO targetSplitLevelVORequest = new TargetSplitLevelVO();
+//        targetSplitLevelVORequest.setResponsibilityCode("zr2");
+//        targetSplitLevelVORequest.setResponsibilityName("责任中心2");
+//        targetSplitLevelVORequest.setOneShareMoney("102.1111");
+//        targetSplitLevelVORequest.setTwoShareMoney("202.1111");
+//        targetSplitLevelVORequest.setThreeShareMoney("300.1111");
+//        LinkedList<TargetShareParamValue> targetShareParamValueLinkedList1 = new LinkedList<>();
+//        TargetShareParamValue targetShareParamValue1 = new TargetShareParamValue();
+//        targetShareParamValue1.setShareParamName("水费");
+//        targetShareParamValue1.setShareParamCode("A66");
+//        targetShareParamValue1.setShareParamValue("777");
+//        targetShareParamValue1.setShareParamProportion("0.777");
+//        targetShareParamValueLinkedList1.add(targetShareParamValue1);
+//        targetSplitLevelVORequest.setTargetShareParamValueList(targetShareParamValueLinkedList1);
+//        targetSplitLevelVOLinkedList.add(targetSplitLevelVORequest);
+//
+//    }
+
+    private List<CostCostingVO> setMockDa() {
+        List<CostCostingVO> costCostingVOS = new LinkedList<>();
+        CostCostingVO costCostingVO = new CostCostingVO();
+        costCostingVO.setResponsibilityCode("zr1");
+        costCostingVO.setResponsibilityName("责任中心1");
+        costCostingVO.setAccountCode("A11");
+        costCostingVO.setAccountName("人事费用");
+        costCostingVO.setAmount("800");
+        costCostingVO.setTargetResponsibilityCode("tzr1");
+        costCostingVO.setTargetResponsibilityName("目标责任中心1");
+        List<String> strings = new ArrayList<>();
+        strings.add("1000");
+        strings.add("2000");
+        costCostingVO.setTargetShareMoneys(strings);
+        costCostingVO.setShareParamName("员工数");
+        costCostingVO.setShareValue("3");
+        costCostingVO.setShareParamProportion("0.3344");
+        costCostingVO.setMoney("5.28");
+        costCostingVOS.add(costCostingVO);
+
+        CostCostingVO costCostingVO1 = new CostCostingVO();
+        costCostingVO1.setResponsibilityCode("zr1");
+        costCostingVO1.setResponsibilityName("责任中心1");
+        // 会计科目可能为空
+        costCostingVO1.setAccountCode("A12");
+        costCostingVO1.setAccountName("其他费用");
+        costCostingVO1.setAmount("600");
+        costCostingVO1.setAlias("设置的别名");
+        costCostingVO1.setTargetResponsibilityCode("tzr1");
+        costCostingVO1.setTargetResponsibilityName("目标责任中心1");
+        List<String> strings1 = new ArrayList<>();
+        strings1.add("1000");
+        strings1.add("2000");
+        costCostingVO1.setTargetShareMoneys(strings);
+        costCostingVO1.setShareParamName("员工数");
+        costCostingVO1.setShareValue("3");
+        costCostingVO1.setShareParamProportion("0.3344");
+        costCostingVO1.setMoney("0.88");
+        costCostingVOS.add(costCostingVO1);
+
+        CostCostingVO costCostingVO2 = new CostCostingVO();
+        costCostingVO2.setResponsibilityCode("zr1");
+        costCostingVO2.setResponsibilityName("责任中心1");
+        // 会计科目可能为空
+        costCostingVO2.setAccountCode("A11");
+        costCostingVO2.setAccountName("人事费用");
+        costCostingVO2.setAmount("800");
+        costCostingVO2.setTargetResponsibilityCode("tzr1");
+        costCostingVO2.setTargetResponsibilityName("目标责任中心1");
+        List<String> strings2 = new ArrayList<>();
+        strings2.add("1000");
+        strings2.add("2000");
+        costCostingVO2.setTargetShareMoneys(strings);
+        costCostingVO2.setShareParamName("医疗收入");
+        costCostingVO2.setShareValue("95");
+        costCostingVO2.setShareParamProportion("0.19");
+        costCostingVO2.setMoney("0.55");
+        costCostingVOS.add(costCostingVO2);
+
+        CostCostingVO costCostingVO3 = new CostCostingVO();
+        costCostingVO3.setResponsibilityCode("zr1");
+        costCostingVO3.setResponsibilityName("责任中心1");
+        costCostingVO3.setAccountCode("A12");
+        costCostingVO3.setAccountName("其他费用");
+        costCostingVO3.setAmount("600");
+        costCostingVO3.setAlias("设置的别名");
+        costCostingVO3.setTargetResponsibilityCode("tzr1");
+        costCostingVO3.setTargetResponsibilityName("目标责任中心1");
+        List<String> strings3 = new ArrayList<>();
+        strings3.add("1000");
+        strings3.add("2000");
+        costCostingVO3.setTargetShareMoneys(strings);
+        costCostingVO3.setShareParamName("医疗收入");
+        costCostingVO3.setShareValue("95");
+        costCostingVO3.setShareParamProportion("0.19");
+        costCostingVO3.setMoney("0.44");
+        costCostingVOS.add(costCostingVO3);
+
+        CostCostingVO costCostingVO5 = new CostCostingVO();
+        costCostingVO5.setResponsibilityCode("zr2");
+        costCostingVO5.setResponsibilityName("责任中心2");
+        costCostingVO5.setAccountCode("A13");
+        costCostingVO5.setAccountName("责任费用");
+        costCostingVO5.setAmount("900");
+        costCostingVO5.setTargetResponsibilityCode("tzr2");
+        costCostingVO5.setTargetResponsibilityName("目标责任中心2");
+        List<String> strings5 = new ArrayList<>();
+        strings5.add("1000");
+        strings5.add("2000");
+        costCostingVO5.setTargetShareMoneys(strings5);
+        costCostingVO5.setShareParamName("麻醉科收入");
+        costCostingVO5.setShareValue("100");
+        costCostingVO5.setShareParamProportion("0.188");
+        costCostingVO5.setMoney("1.11");
+        costCostingVOS.add(costCostingVO5);
+
+        CostCostingVO costCostingVO6 = new CostCostingVO();
+        costCostingVO6.setResponsibilityCode("zr1");
+        costCostingVO6.setResponsibilityName("责任中心1");
+        // 会计科目可能为空
+        costCostingVO6.setAccountCode("A11");
+        costCostingVO6.setAccountName("人事费用");
+        costCostingVO6.setAmount("800");
+        costCostingVO6.setTargetResponsibilityCode("tzr2");
+        costCostingVO6.setTargetResponsibilityName("目标责任中心2");
+        List<String> strings6 = new ArrayList<>();
+        strings6.add("1000");
+        strings6.add("2000");
+        costCostingVO6.setTargetShareMoneys(strings6);
+        costCostingVO6.setShareParamName("麻醉科收入");
+        costCostingVO6.setShareValue("100");
+        costCostingVO6.setShareParamProportion("0.18");
+        costCostingVO6.setMoney("0.33");
+        costCostingVOS.add(costCostingVO6);
+
+        CostCostingVO costCostingVO7 = new CostCostingVO();
+        costCostingVO7.setResponsibilityCode("zr1");
+        costCostingVO7.setResponsibilityName("责任中心1");
+        costCostingVO7.setAccountCode("A12");
+        costCostingVO7.setAccountName("其他费用");
+        costCostingVO7.setAmount("600");
+        costCostingVO7.setAlias("设置的别名");
+        costCostingVO7.setTargetResponsibilityCode("tzr2");
+        costCostingVO7.setTargetResponsibilityName("目标责任中心2");
+        List<String> strings7 = new ArrayList<>();
+        strings7.add("1000");
+        strings7.add("2000");
+        costCostingVO7.setTargetShareMoneys(strings);
+        costCostingVO7.setShareParamName("麻醉科收入");
+        costCostingVO7.setShareValue("100");
+        costCostingVO7.setShareParamProportion("0.18");
+        costCostingVO7.setMoney("0.22");
+        costCostingVOS.add(costCostingVO7);
+
+        CostCostingVO costCostingVO8 = new CostCostingVO();
+        costCostingVO8.setResponsibilityCode("zr2");
+        costCostingVO8.setResponsibilityName("责任中心2");
+        costCostingVO8.setAccountCode("A13");
+        costCostingVO8.setAccountName("责任费用");
+        costCostingVO8.setAmount("900");
+        costCostingVO8.setTargetResponsibilityCode("tzr1");
+        costCostingVO8.setTargetResponsibilityName("目标责任中心1");
+        List<String> strings8 = new ArrayList<>();
+        strings8.add("1000");
+        strings8.add("2000");
+        costCostingVO8.setTargetShareMoneys(strings8);
+        costCostingVO8.setShareParamName("员工数");
+        costCostingVO8.setShareValue("3");
+        costCostingVO8.setShareParamProportion("0.3344");
+        costCostingVO8.setMoney("1.55");
+        costCostingVOS.add(costCostingVO8);
+
+        CostCostingVO costCostingVO9 = new CostCostingVO();
+        costCostingVO9.setResponsibilityCode("zr2");
+        costCostingVO9.setResponsibilityName("责任中心2");
+        costCostingVO9.setAccountCode("A13");
+        costCostingVO9.setAccountName("责任费用");
+        costCostingVO9.setAmount("900");
+        costCostingVO9.setTargetResponsibilityCode("tzr1");
+        costCostingVO9.setTargetResponsibilityName("目标责任中心1");
+        List<String> strings9 = new ArrayList<>();
+        strings9.add("1000");
+        strings9.add("2000");
+        costCostingVO9.setTargetShareMoneys(strings9);
+        costCostingVO9.setShareParamName("医疗收入");
+        costCostingVO9.setShareValue("95");
+        costCostingVO9.setShareParamProportion("0.19");
+        costCostingVO9.setMoney("2.66");
+        costCostingVOS.add(costCostingVO9);
+        return costCostingVOS;
+    }
+    /**
+     * 科室
+     */
 }

+ 225 - 0
src/main/java/com/imed/costaccount/service/impl/CostDepartmentProfitServiceImpl.java

@@ -0,0 +1,225 @@
+package com.imed.costaccount.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.imed.costaccount.common.util.BeanUtil;
+import com.imed.costaccount.common.util.DateUtils;
+import com.imed.costaccount.common.util.PageUtils;
+import com.imed.costaccount.constants.NumberConstant;
+import com.imed.costaccount.enums.DateStyleEnum;
+import com.imed.costaccount.mapper.CostDepartmentProfitMapper;
+import com.imed.costaccount.model.*;
+import com.imed.costaccount.model.vo.CostDepartmentProfitVO;
+import com.imed.costaccount.service.*;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+
+
+@Service("costDepartmentProfitService")
+public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentProfitMapper, CostDepartmentProfit> implements CostDepartmentProfitService {
+
+    private final ReportFormService reportFormService;
+
+    private final IncomeCollectionService incomeCollectionService;
+
+    private final CostShareLevelService costShareLevelService;
+
+    private final ResponsibilityService responsibilityService;
+
+    private final ReportRelationService reportRelationService;
+
+    private final AllocationService allocationService;
+
+
+    public CostDepartmentProfitServiceImpl(ReportFormService reportFormService, IncomeCollectionService incomeCollectionService, CostShareLevelService costShareLevelService, ResponsibilityService responsibilityService, ReportRelationService reportRelationService, AllocationService allocationService) {
+        this.reportFormService = reportFormService;
+        this.incomeCollectionService = incomeCollectionService;
+        this.costShareLevelService = costShareLevelService;
+        this.responsibilityService = responsibilityService;
+        this.reportRelationService = reportRelationService;
+        this.allocationService = allocationService;
+    }
+
+    /**
+     * 查询科室损益数据
+     *
+     * @param current
+     * @param pageSize
+     * @param responsibilityCode
+     * @param date
+     * @param hospId
+     * @return
+     */
+    @Override
+    public PageUtils queryList(Integer current, Integer pageSize, String responsibilityCode, String date, Long hospId) {
+        int year = 0;
+        int month = 0;
+        if (StrUtil.isNotBlank(date)) {
+            Date dateTime = DateUtils.StringToDate(date, DateStyleEnum.YYYY_MM_DD);
+            year = DateUtil.year(dateTime);
+            month = DateUtil.month(dateTime) + 1;
+        }
+        Page<CostDepartmentProfit> departmentProfitPage = new Page<>(current, pageSize);
+        Page<CostDepartmentProfit> pages = this.page(departmentProfitPage, new QueryWrapper<CostDepartmentProfit>().lambda()
+                .eq(CostDepartmentProfit::getHospId, hospId)
+                .eq(StrUtil.isNotBlank(responsibilityCode), CostDepartmentProfit::getResponsibilityCode, responsibilityCode)
+                .eq(StrUtil.isNotBlank(date), CostDepartmentProfit::getYear, year)
+                .eq(StrUtil.isNotBlank(date), CostDepartmentProfit::getMonth, month));
+        List<CostDepartmentProfit> records = pages.getRecords();
+        List<CostDepartmentProfitVO> costDepartmentProfitVOList = BeanUtil.convertList(records, CostDepartmentProfitVO.class);
+        PageUtils pageUtils = new PageUtils(pages);
+        pageUtils.setList(costDepartmentProfitVOList);
+        return pageUtils;
+    }
+
+    /**
+     * 科室损益计算
+     *
+     * @param date
+     * @param hospId
+     */
+    @Override
+    public void setDepartmentProfit(String date, Long hospId) {
+        int year = 0;
+        int month = 0;
+        if (StrUtil.isNotBlank(date)) {
+            Date dateTime = DateUtils.StringToDate(date, DateStyleEnum.YYYY_MM_DD);
+            year = DateUtil.year(dateTime);
+            month = DateUtil.month(dateTime) + 1;
+        }
+        // 先查询指定条件的报表数据
+        List<ReportForm> reportFormList = reportFormService.list(new QueryWrapper<ReportForm>().lambda()
+                .eq(ReportForm::getHospId, hospId)
+                .eq(ReportForm::getReportType, NumberConstant.ZERO).ne(ReportForm::getCalcType, NumberConstant.ZERO));
+        // 遍历报表数据根据报表数据计算方式进行计算
+        // 查询最后一个层级的责任中心
+        List<CostShareLevel> costShareLevelList = costShareLevelService.list(new QueryWrapper<CostShareLevel>().lambda()
+                .eq(CostShareLevel::getHospId, hospId).orderByDesc(CostShareLevel::getLeverSort));
+        Long id = costShareLevelList.get(0).getId();
+        // 查询责任中心里面是这个层级的所有的收益中心
+        List<Responsibility> responsibilityList = responsibilityService.list(new QueryWrapper<Responsibility>().lambda()
+                .eq(Responsibility::getHospId, hospId).eq(Responsibility::getResponsibilityType, NumberConstant.ONE));
+        // 归集前
+        List<IncomeCollection> incomeList = incomeCollectionService.list(new QueryWrapper<IncomeCollection>().lambda()
+                .eq(IncomeCollection::getHospId, hospId)
+                .eq(year > 0, IncomeCollection::getYear, year).eq(month > 0, IncomeCollection::getMonth, month));
+
+        Map<Long, List<ReportRelation>> reportRelationMap = reportRelationService.list(new QueryWrapper<ReportRelation>().lambda().eq(ReportRelation::getHospId, hospId)).stream().collect(Collectors.groupingBy(ReportRelation::getReportId));
+        // TODO 需要查询归集后的数据
+
+        // 查询分摊的报表数据
+        List<Allocation> allocationList = allocationService.list(new QueryWrapper<Allocation>().lambda().eq(Allocation::getHospId, hospId)
+                .eq(year > 0, Allocation::getDateYear, year).eq(month > 0, Allocation::getDateMonth, month));
+
+        // 查询所有指定类型的损益表
+        // 每个责任中心对应报表都要生成记录
+        // 封装需要设置的数据
+        List<CostDepartmentProfitVO> list = new ArrayList<>();
+        int finalYear = year;
+        int finalMonth = month;
+        responsibilityList.forEach(i->{
+            reportFormList.forEach(j->{
+                CostDepartmentProfitVO costDepartmentProfitVO = new CostDepartmentProfitVO();
+                costDepartmentProfitVO.setYear(finalYear);
+                costDepartmentProfitVO.setMonth(finalMonth);
+                costDepartmentProfitVO.setReportNum(j.getNum());
+                costDepartmentProfitVO.setCostType(j.getCalcType());
+                costDepartmentProfitVO.setReportName(j.getReportName());
+                costDepartmentProfitVO.setResponsibilityCode(i.getResponsibilityCode());
+                costDepartmentProfitVO.setResponsibilityName(i.getResponsibilityName());
+                costDepartmentProfitVO.setReportParentId(i.getParentId());
+                costDepartmentProfitVO.setCostType(NumberConstant.ONE);
+                costDepartmentProfitVO.setIncomeType(NumberConstant.ONE);
+                costDepartmentProfitVO.setHospId(hospId);
+                list.add(costDepartmentProfitVO);
+            });
+        });
+        list.forEach(i->{
+            Integer calcType = i.getCostType();
+            switch (calcType){
+                case 1:
+                    // TODO 按照会计科目进行计算
+                    setAccountReportData(i,incomeList,reportRelationMap);
+                    break;
+                case 2:
+                    // TODO 按照分摊层级进行计算
+                    break;
+                case 3:
+                   // TODO 按照小计进行计算
+                    break;
+                case 4:
+                    // TODO 按照计算公式进行计算
+                    break;
+                case 5:
+                    // TODO  按照责任中心进行计算
+                    break;
+                default:
+                    i.setAmount(new BigDecimal("0.0000"));
+                    break;
+            }
+
+        });
+    }
+
+    /**
+     * 按照会计科目进行计算
+     * @param i
+     */
+    private void setAccountReportData(CostDepartmentProfitVO i,List<IncomeCollection> list,Map<Long, List<ReportRelation>> reportRelationMap) {
+        // 在报表关联里面查询当前报表关联的
+        List<ReportRelation> reportRelationList = reportRelationMap.get(i.getId());
+        if (CollUtil.isNotEmpty(reportRelationList)){
+            // 获取对应的会计科目信息  筛选会计科目的Code
+            List<String> accountList = reportRelationList.stream().map(ReportRelation::getRelationCode).collect(Collectors.toList());
+            // 查找在归集数据里面当前责任中心对应的这些会计科目的金额
+            List<IncomeCollection> incomeCollectionList = list.stream().filter(income -> income.getResponsibilityCode().equals(i.getResponsibilityCode()) && accountList.contains(income.getAccountingCode())).collect(Collectors.toList());
+            AtomicReference<BigDecimal> sum= new AtomicReference<>(new BigDecimal("0.000"));
+            incomeCollectionList.forEach(m->{
+                sum.updateAndGet(v -> v.add(m.getAmount()));
+            });
+            // TODO 需要查询分摊后的表
+
+            i.setAmount(new BigDecimal(sum.toString()));
+        }else {
+            i.setAmount(new BigDecimal("0.0000"));
+        }
+
+    }
+    /**
+     * 按照分摊层级进行计算
+     */
+    private void setShareLevelReportData(CostDepartmentProfitVO i,Map<Long, List<ReportRelation>> reportRelationMap,List<Allocation> allocationList){
+        List<ReportRelation> reportRelationList = reportRelationMap.get(i.getId());
+        // 找到对应的分摊层级的Id
+        List<String> shareLevelIds = reportRelationList.stream().map(ReportRelation::getRelationCode).collect(Collectors.toList());
+        if (CollUtil.isNotEmpty(shareLevelIds)){
+            // 查询报表里面是当前分摊层级的数据
+            AtomicReference<BigDecimal> sum= new AtomicReference<>(new BigDecimal("0.000"));
+            List<Allocation> allocations = allocationList.stream().filter(m -> m.getLevelSort().equals(i.getLevelSort()) && m.getTargetResponsibilityCode().equals(i.getResponsibilityCode())).collect(Collectors.toList());
+            allocations.forEach(m->{
+                sum.updateAndGet(v -> v.add(m.getAmount()));
+            });
+            i.setAmount(new BigDecimal(sum.toString()));
+        }else {
+            i.setAmount(new BigDecimal("0.0000"));
+        }
+    }
+    /**
+     * 按照责任中心进行计算
+     * 原始责任中心是设置的责任中心   目标责任中心是报表的责任中心
+     */
+    public void setResponsibilityCode(){
+
+    }
+}

+ 3 - 0
src/main/java/com/imed/costaccount/web/CostCostingCollectionController.java

@@ -74,5 +74,8 @@ public class CostCostingCollectionController {
 		costCostingCollectionService.removeByIds(Arrays.asList(ids));
         return Result.ok();
     }
+    /**
+     * 科室计算
+     */
 
 }

+ 98 - 0
src/main/java/com/imed/costaccount/web/CostDepartmentProfitController.java

@@ -0,0 +1,98 @@
+package com.imed.costaccount.web;
+
+import com.imed.costaccount.common.util.PageUtils;
+import com.imed.costaccount.common.util.Result;
+import com.imed.costaccount.common.util.UserContext;
+import com.imed.costaccount.model.CostDepartmentProfit;
+import com.imed.costaccount.service.CostDepartmentProfitService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+
+
+/**
+ * 科室损益计算
+ *
+ * @author KCYG
+ * @date 2021-08-24 16:24:08
+ */
+@RestController
+@RequestMapping("/costAccount/costdepartmentprofit")
+@Api(tags = "科室损益计算")
+public class CostDepartmentProfitController {
+    @Autowired
+    private CostDepartmentProfitService costDepartmentProfitService;
+
+    /**
+     * 分页查询列表
+     * 查询的是
+     */
+    @GetMapping("/list")
+    @ApiOperation("科室损益计算查询")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "current", value = "当前页", required = true),
+            @ApiImplicitParam(name = "pageSize", value = "当前页大小", required = true),
+            @ApiImplicitParam(name = "responsibilityCode", value = "责任中心代码", required = false),
+            @ApiImplicitParam(name = "date", value = "年月yyyy-MM-dd")
+    })
+    public Result list(@RequestParam(value = "current", defaultValue = "1") Integer current,
+                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
+                       @RequestParam(value = "responsibilityCode") String responsibilityCode,
+                       @RequestParam(value = "date") String date){
+        Long hospId = UserContext.getHospId();
+        PageUtils pageUtils = costDepartmentProfitService.queryList(current,pageSize,responsibilityCode,date,hospId);
+        return Result.ok(pageUtils);
+    }
+
+    /**
+     * 科室损益计算
+     */
+    @PostMapping("/setDepartmentProfit")
+    @ApiOperation("进行科室损益计算")
+    public Result setDepartmentProfit(@RequestBody String date){
+        Long hospId = UserContext.getHospId();
+        costDepartmentProfitService.setDepartmentProfit(date,hospId);
+        return  Result.ok();
+    }
+
+    /**
+     * 信息
+     */
+    @RequestMapping("/info/{id}")
+    public Result info(@PathVariable("id") Long id){
+		CostDepartmentProfit costDepartmentProfit = costDepartmentProfitService.getById(id);
+        return Result.ok(costDepartmentProfit);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    public Result save(@RequestBody CostDepartmentProfit costDepartmentProfit){
+		costDepartmentProfitService.save(costDepartmentProfit);
+        return Result.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    public Result update(@RequestBody CostDepartmentProfit costDepartmentProfit){
+		costDepartmentProfitService.updateById(costDepartmentProfit);
+        return Result.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    public Result delete(@RequestBody Long[] ids){
+		costDepartmentProfitService.removeByIds(Arrays.asList(ids));
+        return Result.ok();
+    }
+}

+ 72 - 2
src/main/java/com/imed/costaccount/web/ExcelController.java

@@ -17,6 +17,8 @@ import com.imed.costaccount.service.*;
 import com.imed.costaccount.service.impl.DepartmentServiceImpl;
 import com.imed.costaccount.service.impl.ProductServiceImpl;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.ss.usermodel.Sheet;
@@ -63,12 +65,15 @@ public class ExcelController extends AbstractController{
 
     private final ShareParamValueService shareParamValueService;
 
+    private final CostCostingCollectionService costCostingCollectionService;
+
+    private final AllocationService allocationServicel;
 
     public ExcelController(UserService userService, DepartmentServiceImpl departmentService, ProductServiceImpl productService,
                            AccountingService accountingService, AccountingProductService accountingProductService,
                            ResponsibilityDepartmentService responsibilityDepartmentService,
                            CostShareParamService costShareParamService, CostIncomeGroupService costIncomeGroupService, JwtUtil jwtUtil,
-                           CostCostingGroupService costCostingGroupService, ShareParamValueService shareParamValueService) {
+                           CostCostingGroupService costCostingGroupService, ShareParamValueService shareParamValueService, CostCostingCollectionService costCostingCollectionService, AllocationService allocationServicel) {
         this.userService = userService;
         this.departmentService = departmentService;
         this.productService = productService;
@@ -80,6 +85,8 @@ public class ExcelController extends AbstractController{
         this.jwtUtil = jwtUtil;
         this.costCostingGroupService = costCostingGroupService;
         this.shareParamValueService = shareParamValueService;
+        this.costCostingCollectionService = costCostingCollectionService;
+        this.allocationServicel = allocationServicel;
     }
 
     @ApiOperation("用户导出模板设置")
@@ -306,7 +313,6 @@ public class ExcelController extends AbstractController{
         writer.close();
         IoUtil.close(out);
     }
-
     /**
      * 成本数据导出模板
      */
@@ -361,7 +367,59 @@ public class ExcelController extends AbstractController{
         writer.close();
         IoUtil.close(out);
     }
+    /**
+     * 测试模板数据导出
+     */
+    @ApiOperation("分摊报表输出")
+    @GetMapping("/getShareReportTemplateTwo")
+    public void getShareReportTemplateTwo(HttpServletResponse response,Integer shareNumber,String token) throws IOException {
+        int userId = jwtUtil.getUserId(token);
+        User user = userService.getById(userId);
+        if (Objects.isNull(user)){
+            throw new CostException(500,"用户不存在");
+        }
+        Long hospId = user.getHospId();
+        String uuid = UUID.randomUUID().toString();
+        String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
+        FileUtil.del(FileUtil.file(url));
+        ExcelWriter writer = new ExcelWriter(url);
+        Sheet sheet = writer.getSheet();
+        // 第几次分摊
+        writer= costCostingCollectionService.getShareReportTemplate(writer,shareNumber,sheet);
+        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
+        response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
+        ServletOutputStream out = null;
+        out = response.getOutputStream();
+        writer.flush(out, true);
+        writer.close();
+        IoUtil.close(out);
 
+    }
+    @ApiOperation("分摊报表输出2.0")
+    @GetMapping("/getShareReportTemplate")
+    public void getTemplate(HttpServletResponse response,Integer levelSort,String token,Integer year,Integer month) throws IOException {
+        int userId = jwtUtil.getUserId(token);
+        User user = userService.getById(userId);
+        if (Objects.isNull(user)){
+            throw new CostException(500,"用户不存在");
+        }
+        Long hospId = user.getHospId();
+        String uuid = UUID.randomUUID().toString();
+        String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
+        FileUtil.del(FileUtil.file(url));
+        ExcelWriter writer = new ExcelWriter(url);
+        Sheet sheet = writer.getSheet();
+        // 第几次分摊
+        writer= allocationServicel.getShareReportTemplate(writer,levelSort,sheet,year,month);
+        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
+        response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
+        ServletOutputStream out = null;
+        out = response.getOutputStream();
+        writer.flush(out, true);
+        writer.close();
+        IoUtil.close(out);
+
+    }
     /**
      * 获取执行类型的成本项目
      *
@@ -479,6 +537,10 @@ public class ExcelController extends AbstractController{
      */
     @PostMapping("/importDataByFileType")
     @ApiOperation("收入数据导入")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "fileType", value = "文件类型 1 成本分摊参数值 2收入 3成本数据"),
+            @ApiImplicitParam(name = "dateTime", value = "年月yyyy-MM")}
+    )
     public Result importProductAccount(@RequestParam("file") MultipartFile file ,Integer fileType,String dateTime) {
         if (Objects.isNull(file)) {
             throw new CostException(500, "请选择文件");
@@ -501,6 +563,10 @@ public class ExcelController extends AbstractController{
     }
     @PostMapping("/importCostingGroup")
     @ApiOperation("成本数据导入")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "fileType", value = "文件类型 1 成本分摊参数值 2收入 3成本数据"),
+            @ApiImplicitParam(name = "dateTime", value = "年月yyyy-MM")}
+    )
     public Result importCostingGroup(@RequestParam("file") MultipartFile file ,Integer fileType,String dateTime) {
         if (Objects.isNull(file)) {
             throw new CostException(500, "请选择文件");
@@ -523,6 +589,10 @@ public class ExcelController extends AbstractController{
     }
     @PostMapping("/importShareParamGroup")
     @ApiOperation("成本分摊参数值导入")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "fileType", value = "文件类型 1 成本分摊参数值 2收入 3成本数据"),
+            @ApiImplicitParam(name = "dateTime", value = "年月yyyy-MM")}
+    )
     public Result importShareParamGroup(@RequestParam("file") MultipartFile file ,Integer fileType,String dateTime){
         if (Objects.isNull(file)) {
             throw new CostException(500, "请选择文件");

+ 5 - 0
src/main/resources/mapper/CostCostingCollectionMapper.xml

@@ -26,6 +26,11 @@
 <!--        <result property="targetResponsibilityName" column="target_responsibility_name" />-->
         <result property="shareAmount" column="share_amount" />
     </resultMap>
+    <select id="selectGroupBy" resultType="com.imed.costaccount.model.vo.CostDepartmentProfitVO">
+        SELECT responsibility_code,responsibility_name, SUM(amount) as amount
+        from cost_costing_collection  where hosp_id=#{hospId}
+        GROUP BY responsibility_code
+    </select>
 
 
 </mapper>

+ 24 - 0
src/main/resources/mapper/CostDepartmentProfitMapper.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.imed.costaccount.mapper.CostDepartmentProfitMapper">
+
+	<!-- 可根据自己的需求,是否要使用 -->
+    <resultMap type="com.imed.costaccount.model.CostDepartmentProfit" id="costDepartmentProfitMap">
+        <result property="id" column="id"/>
+        <result property="year" column="year"/>
+        <result property="month" column="month"/>
+        <result property="reportNum" column="report_num"/>
+        <result property="reportName" column="report_name"/>
+        <result property="responsibilityCode" column="responsibility_code"/>
+        <result property="responsibilityName" column="responsibility_name"/>
+        <result property="costType" column="cost_type"/>
+        <result property="incomeType" column="income_type"/>
+        <result property="amount" column="amount"/>
+        <result property="hospId" column="hosp_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="deleteTime" column="delete_time"/>
+    </resultMap>
+
+
+</mapper>