Browse Source

08 19 02 报表项目计算类型如果为责任中心,新增对应处理

hr 4 years ago
parent
commit
be5b28f894

+ 9 - 0
src/main/java/com/imed/costaccount/mapper/ReportRelationMapper.java

@@ -33,4 +33,13 @@ public interface ReportRelationMapper extends BaseMapper<ReportRelation> {
      * @return {@link RelationVO}
      */
     List<RelationVO> getShareParam(@Param("reportId") Long reportId, @Param("hospId") Long hospId);
+
+    /**
+     * 报表项目关联的责任中心对象
+     * @param reportId 报表项目id
+     * @param hospId 医院id
+     * @return {@link RelationVO}
+     */
+    List<RelationVO> getResponsibilities(@Param("reportId") Long reportId, @Param("hospId") Long hospId);
+
 }

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

@@ -50,5 +50,13 @@ public interface ReportRelationService extends IService<ReportRelation> {
     void saveReportRelation(ReportRelationDTO reportRelationDTO, Long hospId);
 
 
+    /**
+     * 报表项目关联的分摊层级对象
+     *
+     * @param reportId 报表项目id
+     * @param hospId   医院id
+     * @return {@link RelationVO}
+     */
+    List<RelationVO> getResponsibilities(Long reportId, Long hospId);
 }
 

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

@@ -510,14 +510,6 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
      * @param costIncomeGroupAllAmountVOList
      */
     private void setCodeName(List<CostIncomeGroupAllAmountVO> costIncomeGroupAllAmountVOList) {
-//        List<Responsibility> responsibilityList = responsibilityService.list(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, hospId));
-//        Map<String, String> responsibilityMap = responsibilityList.stream().collect(Collectors.toMap(Responsibility::getResponsibilityCode, Responsibility::getResponsibilityName));
-//        List<Department> departmentList = departmentService.list(new QueryWrapper<Department>().lambda().eq(Department::getHospId, hospId));
-//        Map<String, String> departmentMap = departmentList.stream().collect(Collectors.toMap(Department::getDepartmentCode, Department::getDepartmentName));
-//        List<Product> productList = productService.list(new QueryWrapper<Product>().lambda().eq(Product::getHospId, hospId));
-//        Map<String, String> productMap = productList.stream().collect(Collectors.toMap(Product::getProductCode, Product::getProductName));
-//        List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId));
-//        Map<String, String> accountMap = accountingList.stream().collect(Collectors.toMap(Accounting::getAccountingCode, Accounting::getAccountingName));
         costIncomeGroupAllAmountVOList.forEach(i -> {
             // 以为这里的数据导入的  在导入的时候进行数据校验
             // 设置开单科室名称 执行科室名称  开单责任中心名称  执行责任中心名称 成本项目的名称 会计科目名称

+ 2 - 0
src/main/java/com/imed/costaccount/service/impl/ReportFormServiceImpl.java

@@ -66,6 +66,8 @@ public class ReportFormServiceImpl extends ServiceImpl<ReportFormMapper, ReportF
                 reportFormVO.setShowAddRelation(1);
             } else if (i.getCalcType() == 2) {
                 reportFormVO.setShowAddRelation(2);
+            } else if (i.getCalcType() == 3) {
+                reportFormVO.setShowAddRelation(3);
             }
             return reportFormVO;
         }).collect(Collectors.toList());

+ 13 - 39
src/main/java/com/imed/costaccount/service/impl/ReportRelationServiceImpl.java

@@ -70,51 +70,25 @@ public class ReportRelationServiceImpl extends ServiceImpl<ReportRelationMapper,
         List<RelationVO> list = new ArrayList<>();
         if (relation == 1) {
             list = this.getAccountRelation(reportId, hospId);
-//            List<Accounting> accounts = accountingService.list(new LambdaQueryWrapper<Accounting>().select(Accounting::getAccountingCode, Accounting::getAccountingName).eq(Accounting::getHospId, hospId));
-//            if (accounts.isEmpty()) {
-//                return list;
-//            }
-//            list = accounts.stream().map(i -> {
-//                RelationVO relationVO = new RelationVO();
-//                relationVO.setIsSelect(false);
-//                relationVO.setRelation(1);
-//                relationVO.setCode(i.getAccountingCode());
-//                relationVO.setName(i.getAccountingName());
-//                return relationVO;
-//            }).collect(Collectors.toList());
-//            for (RelationVO relationVO : accountRelation) {
-//                for (RelationVO vo : list) {
-//                    if (vo.getCode().equals(relationVO.getCode())) {
-//                        vo.setIsSelect(true);
-//                    }
-//                }
-//            }
-
         } else if (relation == 2) {
             list = this.getShareLevel(reportId, hospId);
-//            List<CostShareParam> accounts = shareParamService.list(new LambdaQueryWrapper<CostShareParam>().select(CostShareParam::getShareParamCode, CostShareParam::getShareParamName).eq(CostShareParam::getHospId, hospId));
-//            if (accounts.isEmpty()) {
-//                return list;
-//            }
-//            list = accounts.stream().map(i -> {
-//                RelationVO relationVO = new RelationVO();
-//                relationVO.setIsSelect(false);
-//                relationVO.setRelation(1);
-//                relationVO.setCode(i.getShareParamCode());
-//                relationVO.setName(i.getShareParamName());
-//                return relationVO;
-//            }).collect(Collectors.toList());
-//            for (RelationVO relationVO : accountRelation) {
-//                for (RelationVO vo : list) {
-//                    if (vo.getCode().equals(relationVO.getCode())) {
-//                        vo.setIsSelect(true);
-//                    }
-//                }
-//            }
+        } else if (relation == 3) {
+            list = getResponsibilities(reportId, hospId);
         }
         return list;
     }
 
+    /**
+     * 报表项目关联的分摊层级对象
+     *
+     * @param reportId 报表项目id
+     * @param hospId   医院id
+     * @return {@link RelationVO}
+     */
+    public List<RelationVO> getResponsibilities(Long reportId, Long hospId) {
+        return baseMapper.getResponsibilities(reportId, hospId);
+    }
+
     /**
      * 编辑相关关系
      *

+ 5 - 2
src/main/java/com/imed/costaccount/web/ReportFormController.java

@@ -94,7 +94,7 @@ public class ReportFormController extends AbstractController {
     @GetMapping("/getRelations")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "reportId", value = "报表项目id"),
-            @ApiImplicitParam(name = "relation", value = "1.对应会计科目设置,2.对应分摊参数设置,根据列表中showAddRelation字段是否存在判断")
+            @ApiImplicitParam(name = "relation", value = "1.对应会计科目设置,2.对应分摊参数设置,3.对应责任中心 根据列表中showAddRelation字段是否存在判断")
     })
     public Result getRelations(@RequestParam Long reportId, @RequestParam Integer relation) {
         List<RelationVO> list = new ArrayList<>();
@@ -105,6 +105,9 @@ public class ReportFormController extends AbstractController {
         if (relation == 2) {
             list = reportRelationService.getShareLevel(reportId, hospId);
         }
+        if (relation == 3) {
+            list = reportRelationService.getResponsibilities(reportId, hospId);
+        }
         return Result.ok(list);
     }
 
@@ -120,7 +123,7 @@ public class ReportFormController extends AbstractController {
     @GetMapping("/getRelationList")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "reportId", value = "报表项目id"),
-            @ApiImplicitParam(name = "relation", value = "1.对应会计科目设置,2.对应分摊参数设置,根据列表中showAddRelation字段是否存在判断")
+            @ApiImplicitParam(name = "relation", value = "1.对应会计科目设置,2.对应分摊参数设置,3.对应责任中心 根据列表中showAddRelation字段是否存在判断")
     })
     public Result getRelationList(@RequestParam Long reportId, @RequestParam Integer relation) {
         List<RelationVO> list = reportRelationService.getRelationList(reportId, relation, getHospId());

+ 11 - 0
src/main/resources/mapper/ReportRelationMapper.xml

@@ -36,6 +36,17 @@
           and crr.relation = 2
 
     </select>
+    <select id="getResponsibilities" resultType="com.imed.costaccount.model.vo.RelationVO">
+        select cr.responsibility_code as code, cr.responsibility_name as name, 3 as relation
+        from cost_report_relation crr
+                 left join cost_responsibility cr
+                           on crr.relation_code = cr.responsibility_code and crr.hosp_id = cr.hosp_id
+        where crr.delete_time = 0
+          and crr.hosp_id = #{hospId}
+          and cr.delete_time = 0
+          and crr.report_id = #{reportId}
+          and crr.relation = 3
+    </select>
 
 
 </mapper>