瀏覽代碼

药柜修改

wushilong 3 年之前
父節點
當前提交
c0d0fc4d76
共有 1 個文件被更改,包括 32 次插入15 次删除
  1. 32 15
      svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

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

@ -1363,7 +1363,7 @@ public class MonitorPlatformService {
                    tmp.put("Subdivision", true);
                    tmp.put("using", count + ygusing);
                    tmp.put("total", count + ygtotal);
                    tmp.put("type", "5");
                    tmp.put("type", "5,22");
                    tmp.put("stock", 0 + ygstock);
                    result.getJSONArray("deviceInfo").add(tmp);
                    tmp.put("showLevel", Integer.parseInt(showLevel));
@ -1371,7 +1371,7 @@ public class MonitorPlatformService {
                    /*string用,分割*/
                    String[] arrays = deviceType.split(",");
                    for (String string : arrays) {
                        if ("5".equals(string)){
                        if ("5".equals(string)) {
                            /*健康小屋*/
                            tmp.put("device_name", "健康小屋");
                            tmp.put("Subdivision", false);
@ -1382,7 +1382,7 @@ public class MonitorPlatformService {
                            tmp.put("showLevel", Integer.parseInt(showLevel));
                            result.getJSONArray("deviceInfo").add(tmp);
                        }
                        if ("22".equals(string)){
                        if ("22".equals(string)) {
                            //智慧药房
                            medicinecabinetCount.put("Subdivision", false);
                            medicinecabinetCount.put("showLevel", Integer.parseInt(showLevel));
@ -1562,7 +1562,7 @@ public class MonitorPlatformService {
            if ((org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType) && deviceType.contains("5")) || org.apache.commons.lang3.StringUtils.isBlank(deviceType)) {
                sql.append(" UNION select case device_name when '自助体检一体机' then '健康小屋'  else device_name  end AS device_name from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name");
            }
            if((org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType) && deviceType.contains("22")) || org.apache.commons.lang3.StringUtils.isBlank(deviceType)) {
            if ((org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType) && deviceType.contains("22")) || org.apache.commons.lang3.StringUtils.isBlank(deviceType)) {
                sql.append(" UNION select case device_name when '自助体检一体机' then '智慧药房'  else device_name  end AS device_name from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name");
            }
@ -1664,25 +1664,33 @@ public class MonitorPlatformService {
                sql.append("and belong_are_code='" + area + "' ");
            }
            Integer tmp = jdbcTemplate.queryForObject(sql.toString(), Integer.class);
            totalAll += tmp;
            grant += tmp;
        }
        if (deviceType.contains("22")) {
            Map<String, Object> medicinecabinetCount = getMedicinecabinetCount();
            Integer total = Integer.parseInt(medicinecabinetCount.get("total").toString());
            Integer using = Integer.parseInt(medicinecabinetCount.get("using").toString());
            deviceType = deviceType.replaceAll("22", " ");
            totalAll += total;
            grant += using;
        }
        String allCountSql = "SELECT COUNT(*) FROM device.wlyy_devices d where 1=1 ";
        int i = 0;
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType) && deviceType.contains("1")) {
            allCountSql += "   ";
            allCountSql += " ";
            i = 1;
        }
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType) && deviceType.contains("2")) {
            if (i == 1) {
                allCountSql += " or device_name like '%血压计%'";
            } else {
                allCountSql += " and ( device_name like '%血压计%' ";
                allCountSql += " and ( device_name like '%血压计%' )";
            }
        }
        allCountSql += " ) ";
       // allCountSql += "  ";
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(area)) {
            allCountSql += " and grant_org_code in (SELECT dh.code from wlyy.dm_hospital dh where dh.town ='" + area + "' and dh.del =1 )";
        }
@ -1816,7 +1824,7 @@ public class MonitorPlatformService {
        return heartDo;
    }
    /*获取药柜所有设备信息  地址  编号  名字*/
    /*获取智慧药房所有设备信息  地址  编号  名字*/
    public List<Map<String, String>> getMedicinecabinet() {
        JSONArray resultArr = new JSONArray();
        List<Map<String, String>> list = new ArrayList<>();
@ -1853,7 +1861,7 @@ public class MonitorPlatformService {
        }
    }
    /*药柜总数*/
    /*智慧药房总数*/
    public Map<String, Object> getMedicinecabinetCount() {
        Map resultMap = new HashMap<>();
@ -1872,7 +1880,7 @@ public class MonitorPlatformService {
        return resultMap;
    }
    /*获取药柜详细信息*/
    /*获取智慧药房详细信息*/
    public Map<String, List<Map>> getadddd(String deviceId, String day) throws Exception {
        //返回参数
        Map<String, List<Map>> resoultMap = new HashMap<>();
@ -1932,7 +1940,7 @@ public class MonitorPlatformService {
        return resoultMap;
    }
    /*获取药柜曲线图信息*/
    /*获取智慧药房曲线图信息*/
    public Map<String, List<Map>> getCabinetCurve(String deviceId, String day) throws Exception {
        if ("".equals(day) || day == null) {
            day = "365";
@ -1964,7 +1972,7 @@ public class MonitorPlatformService {
        return resoultMap;
    }
    /*药柜地标*/
    /*智慧药房地标*/
    public List<Map<String, Object>> getLongitudeAndLatitude() {
        JSONArray resultArr = new JSONArray();
        List<Map<String, Object>> list = new ArrayList<>();
@ -1992,13 +2000,22 @@ public class MonitorPlatformService {
        }
    }
    /*智慧药房库存检测
     * 药房有6层,每层40个货道
     * 商品状态:未设商品、已有商品
     * 货道状态:货道故障、货道关闭、货道正常
     * */
    public void ygStockDetection(){
    }
    /*请求接口*/
    public JSONObject getUrl(String url, String parame) {
        JSONObject resultObj = new JSONObject();
        List<Map<String, String>> list = new ArrayList<>();
        try {
            //药柜请求地址
            //智慧药房请求地址
            String ygurl = "SELECT isd.dict_name,isd.`code` from iot_system_dict isd WHERE dict_name = 'HLW_YGBASEURL'";
            Map<String, Object> baseUrll = jdbcTemplate.queryForMap(ygurl);
            String urlResult = httpClientUtil.getBodyRawForm(baseUrll.get("code") + url, parame);