ソースを参照

Merge branch 'master' into 'master'

报表配置优化

See merge request lighter/web-server!27
huangshuhua 2 年 前
コミット
ee7d3dcffb
1 ファイル変更6 行追加4 行削除
  1. 6 4
      src/main/java/thyyxxk/webserver/utils/ReportUtil.java

+ 6 - 4
src/main/java/thyyxxk/webserver/utils/ReportUtil.java

@@ -71,7 +71,9 @@ public class ReportUtil {
     public static String callSqlFormatByGroup(HighReportDto dto, ReportBaseInfo report, TableGroupInfo info, boolean isPatient) {
         // 获取分组查询条件
         String groupColumn = info.getFstGroup();
+        String gatherMainSql = report.getGatherSql();
         StringBuilder dropSql = new StringBuilder();
+        StringBuilder gatherSql = new StringBuilder();
         if (StringUtil.notBlank(info.getFthGroup()) && StringUtil.notBlank(dto.getTrdName())) {
             groupColumn = info.getFthGroup();
             if(OTHER_PARAM.equals(dto.getFstName())){
@@ -113,11 +115,11 @@ public class ReportUtil {
         }
         if(isPatient){
             // 查询病人不需要分组sql,也不需要聚合函数,需要查询显示所有列并带上钻取条件即可
-            String gatherSql = " t.* ";
-            return callSqlFormat(dto, report.getBaseSql(), gatherSql, null, dropSql.toString());
+            gatherSql.append(" t.* ");
+            return callSqlFormat(dto, report.getBaseSql(), gatherSql.toString(), null, dropSql.toString());
         } else {
-            String gatherSql = "isnull(rtrim(" + groupColumn + "), '其他') as x, count(*) as y ";
-            return callSqlFormat(dto, report.getBaseSql(), gatherSql, groupColumn, dropSql.toString());
+            gatherSql.append("isnull(rtrim(").append(groupColumn).append("), '").append(OTHER_PARAM).append("') as x, ").append(gatherMainSql).append(" as y ");
+            return callSqlFormat(dto, report.getBaseSql(), gatherSql.toString(), groupColumn, dropSql.toString());
         }
     }