|
@@ -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());
|
|
|
}
|
|
|
}
|
|
|
|