소스 검색

Merge branch 'master' of huangrui/CostAccount into dev

lijiaxi 4 년 전
부모
커밋
c25dcc83e5

+ 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);
+
 }

+ 3 - 2
src/main/java/com/imed/costaccount/service/CostIncomeFileService.java

@@ -34,11 +34,12 @@ public interface CostIncomeFileService extends IService<CostIncomeFile> {
      * 分页查询查询记录数据
      * @param current
      * @param pageSize
-     * @param name
+     * @param fileName
+     * @param dateTime
      * @param hospId
      * @return
      */
-    PageUtils queryList(Integer current, Integer pageSize, String name, Long hospId);
+    PageUtils queryList(Integer current, Integer pageSize, String fileName, String dateTime, 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);
 }
 

+ 1 - 1
src/main/java/com/imed/costaccount/service/impl/CostCostingGroupServiceImpl.java

@@ -156,8 +156,8 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
         // 先检验当前年月是否存在数据
         int year = 0;
         int month = 0;
-        Date date = DateUtils.StringToDate(dateTime, DateStyleEnum.YYYY_MM);
         if (StrUtil.isNotBlank(dateTime)) {
+            Date date = DateUtils.StringToDate(dateTime, DateStyleEnum.YYYY_MM);
             year = DateUtil.year(date);
             month = DateUtil.month(date) + 1;
         }

+ 18 - 3
src/main/java/com/imed/costaccount/service/impl/CostIncomeFileServiceImpl.java

@@ -8,9 +8,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.imed.costaccount.common.exception.CostException;
 import com.imed.costaccount.common.util.BeanUtil;
+import com.imed.costaccount.common.util.DateUtils;
 import com.imed.costaccount.common.util.JacksonUtil;
 import com.imed.costaccount.common.util.PageUtils;
 import com.imed.costaccount.constants.NumberConstant;
+import com.imed.costaccount.enums.DateStyleEnum;
 import com.imed.costaccount.mapper.CostCostingGroupMapper;
 import com.imed.costaccount.mapper.CostIncomeFileMapper;
 import com.imed.costaccount.mapper.CostIncomeGroupMapper;
@@ -25,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -96,15 +99,27 @@ public class CostIncomeFileServiceImpl extends ServiceImpl<CostIncomeFileMapper,
      *
      * @param current
      * @param pageSize
-     * @param name
+     * @param fileName
+     * @param dateTime
      * @param hospId
      * @return
      */
     @Override
-    public PageUtils queryList(Integer current, Integer pageSize, String name, Long hospId) {
+    public PageUtils queryList(Integer current, Integer pageSize, String fileName, String dateTime, Long hospId) {
+        int year = 0;
+        int month = 0;
+        if (StrUtil.isNotBlank(dateTime)) {
+            Date date = DateUtils.StringToDate(dateTime, DateStyleEnum.YYYY_MM);
+            year = DateUtil.year(date);
+            month = DateUtil.month(date) + 1;
+        }
         Page<CostIncomeFile> costIncomeFilePage = new Page<>(current, pageSize);
         Page<CostIncomeFile> page = this.page(costIncomeFilePage, new QueryWrapper<CostIncomeFile>().lambda()
-                .eq(CostIncomeFile::getHospId, hospId).like(StrUtil.isNotBlank(name), CostIncomeFile::getFileName, name).orderByDesc(CostIncomeFile::getCreateTime));
+                .eq(CostIncomeFile::getHospId, hospId)
+                .like(StrUtil.isNotBlank(fileName), CostIncomeFile::getFileName, fileName)
+                .eq(StrUtil.isNotBlank(dateTime),CostIncomeFile::getDateYear,year)
+                .eq(StrUtil.isNotBlank(dateTime),CostIncomeFile::getDateMonth,month)
+                .orderByDesc(CostIncomeFile::getCreateTime));
         List<CostIncomeFile> records = page.getRecords();
         List<CostIncomeFileVO> costIncomeFileVOList = BeanUtil.convertList(records, CostIncomeFileVO.class);
         costIncomeFileVOList.forEach(i -> {

+ 7 - 12
src/main/java/com/imed/costaccount/service/impl/CostIncomeGroupServiceImpl.java

@@ -320,13 +320,16 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
             List<Object> data = list.get(i);
             log.info("用户输入的数据是{}", data);
             // 成本项目的代码和名称
+            if (Objects.isNull(data.get(0)) || Objects.isNull(data.get(1))){
+                continue;
+            }
             String productCode = data.get(0).toString().trim();
             String productName = data.get(1).toString().trim();
             // 开单科室 执行科室的代码和名称
-            String openDepartmentName = data.get(2).toString().trim();
-            String openDepartmentCode = data.get(3).toString().trim();
-            String startDepartmentName = data.get(4).toString().trim();
-            String startDepartmentCode = data.get(5).toString().trim();
+            String openDepartmentName = data.get(2).toString();
+            String openDepartmentCode = data.get(3).toString();
+            String startDepartmentName = data.get(4).toString();
+            String startDepartmentCode = data.get(5).toString();
             if (StrUtil.isBlank(openDepartmentCode) && StrUtil.isBlank(openDepartmentName) && StrUtil.isBlank(startDepartmentCode) && StrUtil.isBlank(startDepartmentName)) {
                 continue;
             }
@@ -510,14 +513,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 - 2
src/main/java/com/imed/costaccount/service/impl/CostShareParamServiceImpl.java

@@ -178,8 +178,8 @@ public class CostShareParamServiceImpl extends ServiceImpl<CostShareParamMapper,
         String accountingId = byId.getAccountingId();
         if (!StringUtils.isEmpty(accountingId)){
             String[] split = accountingId.split(StrUtil.COMMA);
-            List<Long> collect = Arrays.stream(split).map(Long::valueOf).collect(Collectors.toList());
-            return collect;
+            List<Long> accountingIdList = Arrays.stream(split).map(Long::valueOf).collect(Collectors.toList());
+            return accountingIdList;
         }else {
             return Collections.emptyList();
         }

+ 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);
+    }
+
     /**
      * 编辑相关关系
      *

+ 3 - 2
src/main/java/com/imed/costaccount/web/CostIncomeFileController.java

@@ -36,9 +36,10 @@ public class CostIncomeFileController {
     @ApiOperation("分页查询记录数据")
     public Result list(@RequestParam(value = "current", defaultValue = "1") Integer current,
                        @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
-                       @RequestParam(value = "fileName",required = false) String fileName){
+                       @RequestParam(value = "fileName",required = false) String fileName,
+                       @RequestParam(value = "dateTime",required = false) String dateTime){
         Long hospId = UserContext.getHospId();
-        PageUtils pageUtils = costIncomeFileService.queryList(current,pageSize,fileName,hospId);
+        PageUtils pageUtils = costIncomeFileService.queryList(current,pageSize,fileName,dateTime,hospId);
         return Result.ok(pageUtils);
     }
 

+ 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>