Bläddra i källkod

Merge branch 'master_cloud' of http://47.97.198.219:3000/wangyongsheng/kcim-cost into jiangyongmin

 Conflicts:
	src/main/java/com/kcim/service/impl/CostDepartmentProfitServiceImpl.java
	src/main/java/com/kcim/service/impl/HospProfitAndLossServiceImpl.java
JammeyJiang 8 månader sedan
förälder
incheckning
a4d8fb3161

+ 13 - 0
src/main/java/com/kcim/common/enums/CustomSqlTypeEnum.java

@@ -35,6 +35,19 @@ public enum CustomSqlTypeEnum {
      * 科室门住损益计算
      */
     INTEGRATIVE_PROFIT_CALC("INTEGRATIVE_PROFIT_CALC","科室门住损益计算"),
+
+    /**
+     * 成本分摊处理
+     */
+    COST_ALLOCATION_CALC("COST_ALLOCATION_CALC","成本分摊处理"),
+    /**
+     * 科室损益计算处理
+     */
+    DEPT_PROFIT_CALC("DEPT_PROFIT_CALC","科室损益计算处理"),
+    /**
+     * 全院损益计算处理
+     */
+    HOSP_PROFIT_CALC("HOSP_PROFIT_CALC","全院损益计算处理"),
     ;
     private final String code;
     private final String description;

+ 17 - 6
src/main/java/com/kcim/service/impl/AllocationServiceImpl.java

@@ -9,6 +9,8 @@ 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.kcim.common.constants.NumberConstant;
+import com.kcim.common.constants.SQLParameter;
+import com.kcim.common.enums.CustomSqlTypeEnum;
 import com.kcim.common.exception.CostException;
 import com.kcim.common.util.BeanUtil;
 import com.kcim.common.util.JacksonUtil;
@@ -51,20 +53,19 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
     private final ResponsibilityRepository responsibilityRepository;
     private final CenterService centerService;
 
-    public AllocationServiceImpl(CostCostingGroupService costCostingGroupService,
-                                 CostShareLevelService shareLevelService,
-                                 ResponsibilityService responsibilityService,
-                                 CostAccountShareService accountShareService,
-                                 ShareParamValueService shareParamValueService, CostShareParamService shareParamService, AllocationQueryService allocationQueryService, AllocationQueryService allocationQueryService1, ResponsibilityRepository responsibilityRepository, CenterService centerService) {
+    private final SqlService sqlService;
+
+    public AllocationServiceImpl(CostCostingGroupService costCostingGroupService, CostShareLevelService shareLevelService, ResponsibilityService responsibilityService, CostAccountShareService accountShareService, ShareParamValueService shareParamValueService, CostShareParamService shareParamService, AllocationQueryService allocationQueryService, ResponsibilityRepository responsibilityRepository, CenterService centerService, SqlService sqlService) {
         this.costCostingGroupService = costCostingGroupService;
         this.shareLevelService = shareLevelService;
         this.responsibilityService = responsibilityService;
         this.accountShareService = accountShareService;
         this.shareParamValueService = shareParamValueService;
         this.shareParamService = shareParamService;
-        this.allocationQueryService = allocationQueryService1;
+        this.allocationQueryService = allocationQueryService;
         this.responsibilityRepository = responsibilityRepository;
         this.centerService = centerService;
+        this.sqlService = sqlService;
     }
 
     /**
@@ -242,6 +243,16 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
 
         // 入cost_allocation_query 表 便于后续操作
         this.saveAllocationQuery(list, hospId, startDTO.getYear(), startDTO.getMonth(),shareLevelVOs,accountShareList);
+
+        Map<String,String> sqlParameter = new HashMap<>();
+        if(startDTO.getMonth()<10){
+            sqlParameter.put(SQLParameter.COMPUTE_DATE_CODE,startDTO.getYear()+"-0"+startDTO.getMonth());
+
+        }else{
+            sqlParameter.put(SQLParameter.COMPUTE_DATE_CODE,startDTO.getYear()+"-"+startDTO.getMonth());
+
+        }
+        sqlService.autoExecuteSql(CustomSqlTypeEnum.COST_ALLOCATION_CALC.getCode(),sqlParameter);
     }
 
     private void removeData(StartDTO startDTO, Long hospId) {

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

@@ -15,6 +15,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.ImmutableMap;
 import com.kcim.common.constants.NumberConstant;
+import com.kcim.common.constants.SQLParameter;
+import com.kcim.common.enums.CustomSqlTypeEnum;
 import com.kcim.common.enums.DateStyleEnum;
 import com.kcim.common.enums.ErrorCodeEnum;
 import com.kcim.common.exception.CostException;
@@ -112,6 +114,8 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
 
     private final UserResponsibilityRightService userResponsibilityRightService ;
 
+
+    private final SqlService sqlService;
     private final String AMOUNT = "金额";
 
     private final String PERCENT = "占比";
@@ -120,7 +124,7 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
 
     private final String PERCENT_FIELD = "percent";
 
-    public CostDepartmentProfitServiceImpl(ReportFormService reportFormService, IncomeCollectionService incomeCollectionService, CostShareLevelService costShareLevelService, ResponsibilityService responsibilityService, ReportRelationService reportRelationService, AllocationService allocationService, AllocationQueryService allocationQueryService, FileRecordService fileRecordService, MinioConfig minioConfig, MinioFileUtil minioFileUtil, CenterService centerService, CostDepartmentProfitRepository costDepartmentProfitRepository, ComputeLastProfitDateRepository computeLastProfitDateRepository, AccountingService accountingService, CostAccountShareService costAccountShareService,UserResponsibilityRightService userResponsibilityRightService) {
+    public CostDepartmentProfitServiceImpl(ReportFormService reportFormService, IncomeCollectionService incomeCollectionService, CostShareLevelService costShareLevelService, ResponsibilityService responsibilityService, ReportRelationService reportRelationService, AllocationService allocationService, AllocationQueryService allocationQueryService, FileRecordService fileRecordService, MinioConfig minioConfig, MinioFileUtil minioFileUtil, CenterService centerService, CostDepartmentProfitRepository costDepartmentProfitRepository, ComputeLastProfitDateRepository computeLastProfitDateRepository, AccountingService accountingService, CostAccountShareService costAccountShareService, SqlService sqlService,UserResponsibilityRightService userResponsibilityRightService) {
         this.reportFormService = reportFormService;
         this.incomeCollectionService = incomeCollectionService;
         this.costShareLevelService = costShareLevelService;
@@ -136,6 +140,7 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
         this.computeLastProfitDateRepository = computeLastProfitDateRepository;
         this.accountingService = accountingService;
         this.costAccountShareService = costAccountShareService;
+        this.sqlService = sqlService;
         this.userResponsibilityRightService=userResponsibilityRightService;
     }
 
@@ -1197,6 +1202,11 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
         this.saveBatch(costDepartmentProfits);
         //记录最后一次 损益计算日期
         computeLastProfitDateRepository.saveLastComputeDate(hospId, computeDate);
+
+        Map<String,String> sqlParameter = new HashMap<>();
+        sqlParameter.put(SQLParameter.COMPUTE_DATE_CODE,computeDate);
+        sqlParameter.put(SQLParameter.REPORT_TYPE_CODE,reportType);
+        sqlService.autoExecuteSql(CustomSqlTypeEnum.DEPT_PROFIT_CALC.getCode(),sqlParameter);
     }
 
     private DictDataVo getDictDataVo(String reportType) {
@@ -1226,6 +1236,7 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
      */
     @Override
     public Object computeProfitReport(String computeDate, Long hospId, String reportType) {
+
         Integer year = ComputeDateUtils.getComputeYear(computeDate);
         Integer month = ComputeDateUtils.getComputeMonth(computeDate);
         Integer integerReportType = Integer.valueOf(reportType);