فهرست منبع

添加参数控制哪些损益报表需要用脚本计算

JammeyJiang 1 ماه پیش
والد
کامیت
8fe0fc24e8

+ 2 - 2
src/main/java/com/kcim/common/constants/ParameterConstant.java

@@ -63,7 +63,7 @@ public interface ParameterConstant {
     Long DEPT_YM_CALC_TYPE =1943243153054240768L;
 
     /**
-     * 全院损益同环比计算方式 1代码计算 2脚本计算
+     * 需要用脚本计算的科室损益及全院损益报表类型
      */
-    Long HOSP_YM_CALC_TYPE =1945667397503553536L;
+    Long SQL_CALC_REPORT_TYPE =1945667397503553536L;
 }

+ 133 - 0
src/main/java/com/kcim/common/constants/SplitConstant.java

@@ -0,0 +1,133 @@
+package com.kcim.common.constants;
+
+/**
+* @program: performace
+* @description: 分隔符常量
+* @author: Wang.YS
+* @create: 2023-01-08 21:55
+**/
+
+public interface SplitConstant {
+    /**
+     * 分割符-分号(半角)
+     */
+     String SEPARATOR_SEMICOLON = ";";
+
+    /**
+     * 分割符-右箭头
+     */
+     String RIGHT_ARROWS = "→";
+
+    /**
+     * 分割符-分号(全角)
+     */
+     String SEPARATOR_SEMICOLON_C = ";";
+
+    /**
+     * 分割符-冒号
+     */
+     String SEPARATOR_NUMBER = ":";
+
+    /**
+     * 分割符-冒号
+     */
+     String SEPARATOR_NUMBER_C = ":";
+
+    /**
+     *  分割符-下划线
+     */
+     String SEPARATOR_UNDERLINE = "_";
+    /**
+     * 分割符-竖线
+     */
+     String SEPARATOR_VERTICALLINE="\\|";
+
+    /**
+     * 分割符-逗号
+     */
+     String SEPARATOR_COMMA = ",";
+
+    /**
+     * 分割符-逗号
+     */
+     String SEPARATOR_COMMA_C = ",";
+
+
+    /**
+     * 分割符-反斜杠
+     */
+     String SEPARATOR_BACKSLASH = "/";
+
+    /**
+     * 分割符-反斜杠
+     */
+     String SEPARATOR_BACKSLASH_C = "、";
+
+    /**
+     * 分割符-横杠
+     */
+     String SEPARATOR_WHIPPTREE = "-";
+
+
+    /**
+     * 分割符-波浪号
+     */
+     String SEPARATOR_WAVE = "~";
+
+    /**
+     * 分割符-分号
+     */
+     String SEPARATOR_POINT = ".";
+
+    /**
+     * 分割符-分号
+     */
+     String SEPARATOR_POINT_C = "。";
+
+    /**
+     * 分割符-空格
+     */
+     String SEPARATOR_BlankSpace = " ";
+
+
+    /**
+     * 常量A
+     */
+     String SEPARATOR_A = "A";
+    /**
+     * 左括号
+     */
+     String LEFT_PARENTHESES = "(";
+    /**
+     * 左括号
+     */
+     String LEFT_PARENTHESES_C = "(";
+    /**
+     * 右括号
+     */
+     String RIGHT_PARENTHESES = ")";
+
+    /**
+     * 右括号
+     */
+     String RIGHT_PARENTHESES_C = ")";
+    /**
+     * 导管表默认时间
+     */
+     String ZERO_POINT = "0001-01-01 00:00:00";
+
+    /**
+     * 分隔符 - 乘号
+     */
+     String MULTIPLICATION_SIGN = "×";
+
+
+    /**
+     * 分隔符 - 加号
+     */
+
+     String MULTIPLICATION_PLUS = "\\+";
+
+     String PERCENT = "%";
+
+}

+ 15 - 7
src/main/java/com/kcim/service/impl/CostDepartmentProfitServiceImpl.java

@@ -17,6 +17,7 @@ import com.google.common.collect.ImmutableMap;
 import com.kcim.common.constants.NumberConstant;
 import com.kcim.common.constants.ParameterConstant;
 import com.kcim.common.constants.SQLParameter;
+import com.kcim.common.constants.SplitConstant;
 import com.kcim.common.enums.CustomSqlTypeEnum;
 import com.kcim.common.enums.DateStyleEnum;
 import com.kcim.common.enums.ErrorCodeEnum;
@@ -1114,9 +1115,11 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
 
     @Override
     public void computeProfit(String computeDate, Long hospId, String reportType) {
-        computeProfitAction(computeDate, hospId, reportType);
-        //需要用代码计算同环比时
-        if(IsNeedCalcYM()){
+        //需要用代码计算时
+        if(IsNeedCalc(reportType)){
+            //计算科室损益
+            computeProfitAction(computeDate, hospId, reportType);
+            //计算同环比
             handleSpecificMonthsCalculation(hospId, computeDate, reportType);
         }
         execDeptProfitSql(computeDate, reportType);
@@ -2899,12 +2902,17 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
     }
 
     /**
-     * 是否需要计算同环比
+     * 是否需要代码计算
      * @return
      */
-    public boolean IsNeedCalcYM() {
-        String parameterValue = centerService.getParameterValue(ParameterConstant.DEPT_YM_CALC_TYPE);
-        return NumberConstant.ONE_S.equals(parameterValue);
+    public boolean IsNeedCalc(String reportType) {
+        String parameterValue = centerService.getParameterValue(ParameterConstant.SQL_CALC_REPORT_TYPE);
+        if(StringUtils.isEmpty(parameterValue)){
+            return true;
+        }
+        //不需计算的报表类型列表
+        List<String> nonCalcReportTypeList = Arrays.stream(parameterValue.split(SplitConstant.SEPARATOR_VERTICALLINE)).collect(Collectors.toList());
+        return !nonCalcReportTypeList.contains(reportType);
     }
 
     private List<CommonResponsibilityReportVo> getChildTitle(List<Responsibility> responsibilities, Map<Long, List<Responsibility>> responsibilityGroup) {

+ 19 - 14
src/main/java/com/kcim/service/impl/HospProfitAndLossServiceImpl.java

@@ -11,10 +11,7 @@ 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.google.common.collect.ImmutableMap;
-import com.kcim.common.constants.Constant;
-import com.kcim.common.constants.NumberConstant;
-import com.kcim.common.constants.ParameterConstant;
-import com.kcim.common.constants.SQLParameter;
+import com.kcim.common.constants.*;
 import com.kcim.common.enums.*;
 import com.kcim.common.exception.CostException;
 import com.kcim.common.file.MinioConfig;
@@ -39,6 +36,7 @@ import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
@@ -201,12 +199,14 @@ public class HospProfitAndLossServiceImpl extends ServiceImpl<HospProfitAndLossM
      */
     @Override
     public void calcHospProfit(String date, Long hospId, Integer reportType){
-        calcHospProfitAction(date,hospId,reportType);
-        //需要用代码计算同环比时
-        if(IsNeedCalcYM()){
+        //需要用代码计算全院损益时
+        if(IsNeedCalc(reportType)){
+            //计算全院损益
+            calcHospProfitAction(date,hospId,reportType);
+            //计算同环比
             handleSpecificMonthsCalculation(hospId, date, reportType);
         }
-        execHospProfitSql(date,date);
+        execHospProfitSql(date,reportType);
     }
     @Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED)
     public void calcHospProfitAction(String date, Long hospId, Integer reportType) {
@@ -425,12 +425,17 @@ public class HospProfitAndLossServiceImpl extends ServiceImpl<HospProfitAndLossM
     }
 
     /**
-     * 是否需要计算同环比
+     * 是否需要代码计算
      * @return
      */
-    public boolean IsNeedCalcYM() {
-        String parameterValue = centerService.getParameterValue(ParameterConstant.HOSP_YM_CALC_TYPE);
-        return NumberConstant.ONE_S.equals(parameterValue);
+    public boolean IsNeedCalc(Integer reportType) {
+        String parameterValue = centerService.getParameterValue(ParameterConstant.SQL_CALC_REPORT_TYPE);
+        if(StringUtils.isEmpty(parameterValue)){
+            return true;
+        }
+        //不需计算的报表类型列表
+        List<String> nonCalcReportTypeList = Arrays.stream(parameterValue.split(SplitConstant.SEPARATOR_VERTICALLINE)).collect(Collectors.toList());
+        return !nonCalcReportTypeList.contains(String.valueOf(reportType));
     }
 
     /**
@@ -651,10 +656,10 @@ public class HospProfitAndLossServiceImpl extends ServiceImpl<HospProfitAndLossM
      * @param date
      * @param reportType
      */
-    public void execHospProfitSql(String date,String reportType){
+    public void execHospProfitSql(String date,Integer reportType){
         Map<String,String> sqlParameter = new HashMap<>();
         sqlParameter.put(SQLParameter.COMPUTE_DATE_CODE, DateUtils.StringToString(date, DateStyleEnum.YYYY_MM));
-        sqlParameter.put(SQLParameter.REPORT_TYPE_CODE,reportType.toString());
+        sqlParameter.put(SQLParameter.REPORT_TYPE_CODE,String.valueOf(reportType));
         sqlService.autoExecuteSql(CustomSqlTypeEnum.HOSP_PROFIT_CALC.getCode(),sqlParameter);
 
     }