Browse Source

代码修改

LAPTOP-KB9HII50\70708 3 years ago
parent
commit
29de512ee3

+ 25 - 15
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -1697,23 +1697,33 @@ public class MonitorPlatformService {
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(hospital)) {
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(hospital)) {
            allCountSql += " and grant_org_code =" + hospital + "  ";
            allCountSql += " and grant_org_code =" + hospital + "  ";
        }
        }
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType) && (deviceType.contains("1") || deviceType.contains("2"))) {
            Integer allCount = jdbcTemplate.queryForObject(allCountSql, Integer.class);//单体征总数
            totalAll += allCount;
            StringBuffer sql = new StringBuffer("SELECT COUNT(*) from wlyy.wlyy_patient_device d,wlyy.wlyy_sign_family f  WHERE 1=1 and f.`status`>0 and d.del=0 and f.patient = d.`user` ");
            if (org.apache.commons.lang3.StringUtils.isNoneBlank(area)) {
                sql.append(" and f.hospital in (SELECT dh.code from wlyy.dm_hospital dh where dh.town ='" + area + "' and dh.del =1 )  ");
            }
            if (org.apache.commons.lang3.StringUtils.isNoneBlank(hospital)) {
                sql.append(" and d.hospital =" + hospital + "  ");
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType)) {
            String deviceTypes[] = deviceType.split(",");
            boolean flag = false;
            for(String type : deviceTypes){
                if("1".equals(type)||"2".equals(type)){
                    flag = true;
                    break;
                }
            }
            }
            if (org.apache.commons.lang3.StringUtils.isNoneBlank(startTime) && org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)) {
                sql.append(" and d.czrq <='" + endTime + " 23:59:59'  ");
            if(flag){
                Integer allCount = jdbcTemplate.queryForObject(allCountSql, Integer.class);//单体征总数
                totalAll += allCount;
                StringBuffer sql = new StringBuffer("SELECT COUNT(*) from wlyy.wlyy_patient_device d,wlyy.wlyy_sign_family f  WHERE 1=1 and f.`status`>0 and d.del=0 and f.patient = d.`user` ");
                if (org.apache.commons.lang3.StringUtils.isNoneBlank(area)) {
                    sql.append(" and f.hospital in (SELECT dh.code from wlyy.dm_hospital dh where dh.town ='" + area + "' and dh.del =1 )  ");
                }
                if (org.apache.commons.lang3.StringUtils.isNoneBlank(hospital)) {
                    sql.append(" and d.hospital =" + hospital + "  ");
                }
                if (org.apache.commons.lang3.StringUtils.isNoneBlank(startTime) && org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)) {
                    sql.append(" and d.czrq <='" + endTime + " 23:59:59'  ");
                }
                sql.append("and d.category_code in ('").append(deviceType.replace(",", "','")).append("') ");
                Integer count = jdbcTemplate.queryForObject(sql.toString(), Integer.class);//发放总数
                grant += count;
            }
            }
            sql.append("and d.category_code in ('").append(deviceType.replace(",", "','")).append("') ");
            Integer count = jdbcTemplate.queryForObject(sql.toString(), Integer.class);//发放总数
            grant += count;
        }
        }