|  | @ -56,8 +56,6 @@ public class MonitorPlatformService {
 | 
	
		
			
				|  |  |     private String wxId;
 | 
	
		
			
				|  |  |     @Value("${wechat.flag}")
 | 
	
		
			
				|  |  |     private boolean flag;
 | 
	
		
			
				|  |  |     @Value("${hlw.baseUrl}")
 | 
	
		
			
				|  |  |     private String baseUrl;
 | 
	
		
			
				|  |  |     public static Map<String, String> tokenMap = new HashMap<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
	
		
			
				|  | @ -1350,35 +1348,50 @@ public class MonitorPlatformService {
 | 
	
		
			
				|  |  |             ) {
 | 
	
		
			
				|  |  |                 String sql = "select COUNT(*) from xmiot.iot_equipmet_detail";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 /*取到智慧药柜*/
 | 
	
		
			
				|  |  |                 /*取到智慧药房*/
 | 
	
		
			
				|  |  |                 Map<String, Object> medicinecabinetCount = getMedicinecabinetCount();
 | 
	
		
			
				|  |  |                 //智慧药柜
 | 
	
		
			
				|  |  |                 //智慧药房
 | 
	
		
			
				|  |  |                 int ygtotal = Integer.parseInt(medicinecabinetCount.get("total").toString());
 | 
	
		
			
				|  |  |                 int ygusing = Integer.parseInt(medicinecabinetCount.get("using").toString());
 | 
	
		
			
				|  |  |                 int ygstock = Integer.parseInt(medicinecabinetCount.get("stock").toString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 Integer count = jdbcTemplate.queryForObject(sql, Integer.class);
 | 
	
		
			
				|  |  |                 JSONObject tmp = new JSONObject();
 | 
	
		
			
				|  |  |                 tmp.put("using", count + ygusing);
 | 
	
		
			
				|  |  |                 tmp.put("total", count + ygtotal);
 | 
	
		
			
				|  |  |                 tmp.put("type", "5");
 | 
	
		
			
				|  |  |                 tmp.put("stock", 0 + ygstock);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 if ("0".equals(showLevel)) {
 | 
	
		
			
				|  |  |                     tmp.put("device_name", "组合一体机");
 | 
	
		
			
				|  |  |                     tmp.put("Subdivision", true);
 | 
	
		
			
				|  |  |                     tmp.put("using", count + ygusing);
 | 
	
		
			
				|  |  |                     tmp.put("total", count + ygtotal);
 | 
	
		
			
				|  |  |                     tmp.put("type", "5,22");
 | 
	
		
			
				|  |  |                     tmp.put("stock", 0 + ygstock);
 | 
	
		
			
				|  |  |                     result.getJSONArray("deviceInfo").add(tmp);
 | 
	
		
			
				|  |  |                     tmp.put("showLevel", Integer.parseInt(showLevel));
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     tmp.put("device_name", "健康小屋");
 | 
	
		
			
				|  |  |                     tmp.put("Subdivision", false);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     //智慧药柜
 | 
	
		
			
				|  |  |                     medicinecabinetCount.put("Subdivision", false);
 | 
	
		
			
				|  |  |                     medicinecabinetCount.put("showLevel", 1);
 | 
	
		
			
				|  |  |                     result.getJSONArray("deviceInfo").add(medicinecabinetCount);
 | 
	
		
			
				|  |  |                     result.put("grantCount", result.getInteger("grantCount") + count);
 | 
	
		
			
				|  |  |                     /*string用,分割*/
 | 
	
		
			
				|  |  |                     String[] arrays = deviceType.split(",");
 | 
	
		
			
				|  |  |                     for (String string : arrays) {
 | 
	
		
			
				|  |  |                         if ("5".equals(string)) {
 | 
	
		
			
				|  |  |                             /*健康小屋*/
 | 
	
		
			
				|  |  |                             tmp.put("device_name", "健康小屋");
 | 
	
		
			
				|  |  |                             tmp.put("Subdivision", false);
 | 
	
		
			
				|  |  |                             tmp.put("total", count);
 | 
	
		
			
				|  |  |                             tmp.put("using", count);
 | 
	
		
			
				|  |  |                             tmp.put("stock", 0);
 | 
	
		
			
				|  |  |                             tmp.put("type", 5);
 | 
	
		
			
				|  |  |                             tmp.put("showLevel", Integer.parseInt(showLevel));
 | 
	
		
			
				|  |  |                             result.getJSONArray("deviceInfo").add(tmp);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         if ("22".equals(string)) {
 | 
	
		
			
				|  |  |                             //智慧药房
 | 
	
		
			
				|  |  |                             medicinecabinetCount.put("Subdivision", false);
 | 
	
		
			
				|  |  |                             medicinecabinetCount.put("showLevel", Integer.parseInt(showLevel));
 | 
	
		
			
				|  |  |                             medicinecabinetCount.put("type", 22);
 | 
	
		
			
				|  |  |                             result.getJSONArray("deviceInfo").add(medicinecabinetCount);
 | 
	
		
			
				|  |  |                             result.put("grantCount", result.getInteger("grantCount") + count);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 tmp.put("showLevel", Integer.parseInt(showLevel));
 | 
	
		
			
				|  |  |                 result.getJSONArray("deviceInfo").add(tmp);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //统计健康小屋数据/ 小屋全部统计为正常使用
 | 
	
	
		
			
				|  | @ -1547,8 +1560,12 @@ public class MonitorPlatformService {
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             sql.append("GROUP BY wd.manufacturer_code,pd.device_name ");
 | 
	
		
			
				|  |  |             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");
 | 
	
		
			
				|  |  |                 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)) {
 | 
	
		
			
				|  |  |                 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");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             sql.append(")A");
 | 
	
		
			
				|  |  |             List<String> list = jdbcTemplate.queryForList(sql.toString(), String.class);
 | 
	
		
			
				|  |  |             List<String> reList = new ArrayList<>();
 | 
	
	
		
			
				|  | @ -1647,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 )";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -1799,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<>();
 | 
	
	
		
			
				|  | @ -1836,7 +1861,7 @@ public class MonitorPlatformService {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /*药柜总数*/
 | 
	
		
			
				|  |  |     /*智慧药房总数*/
 | 
	
		
			
				|  |  |     public Map<String, Object> getMedicinecabinetCount() {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Map resultMap = new HashMap<>();
 | 
	
	
		
			
				|  | @ -1851,11 +1876,11 @@ public class MonitorPlatformService {
 | 
	
		
			
				|  |  |         resultMap.put("total", total);
 | 
	
		
			
				|  |  |         resultMap.put("stock", notUsedTotal);
 | 
	
		
			
				|  |  |         resultMap.put("using", usedTotal);
 | 
	
		
			
				|  |  |         resultMap.put("device_name", "智慧药柜");
 | 
	
		
			
				|  |  |         resultMap.put("device_name", "智慧药房");
 | 
	
		
			
				|  |  |         return resultMap;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /*获取药柜详细信息*/
 | 
	
		
			
				|  |  |     /*获取智慧药房详细信息*/
 | 
	
		
			
				|  |  |     public Map<String, List<Map>> getadddd(String deviceId, String day) throws Exception {
 | 
	
		
			
				|  |  |         //返回参数
 | 
	
		
			
				|  |  |         Map<String, List<Map>> resoultMap = new HashMap<>();
 | 
	
	
		
			
				|  | @ -1915,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";
 | 
	
	
		
			
				|  | @ -1947,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<>();
 | 
	
	
		
			
				|  | @ -1975,14 +2000,25 @@ 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 urlResult = httpClientUtil.getBodyRawForm(baseUrl + url, parame);
 | 
	
		
			
				|  |  |             //智慧药房请求地址
 | 
	
		
			
				|  |  |             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);
 | 
	
		
			
				|  |  |             JSONObject resultObject = JSONObject.parseObject(urlResult);
 | 
	
		
			
				|  |  |             if (resultObject.get("status").equals("200")) {
 | 
	
		
			
				|  |  |                 JSONObject jsonObjectData = JSONObject.parseObject(AesEncryptUtils.agDecrypt(resultObject.get("data").toString()));
 |