| 
					
				 | 
			
			
				@ -10,6 +10,7 @@ import com.yihu.iot.dao.statistics.IotStatisticsStockDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.analyzer.WlyyIotTzDict; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.analyzer.WlyyIotTzDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.common.MyJdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.common.PermissionService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.device.IotPatientDeviceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.equipment.IotEqtDetailService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.platform.IotInterfaceLogService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -94,6 +95,8 @@ public class MonitorPlatformService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private IotStatisticsCommonDao iotStatisticsCommonDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private JdbcTemplate jdbcTempalte; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${spring.profiles}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String springProfiles; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 新的物联网大屏地理搜索 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -106,7 +109,7 @@ public class MonitorPlatformService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param town 地理区划 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop<IotLocationDataVO> findLocationPage(String deviceCommon, Integer page, Integer size, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop<IotLocationDataVO> findLocationPage(String name,String deviceCommon, Integer page, Integer size, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   String use, String combinationMethod, String networkTransmission, String town) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String countSql = "select count(*) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select * "; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -128,6 +131,9 @@ public class MonitorPlatformService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            deviceCommon = deviceCommon.replace(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fileter += " and device_common in ('"+deviceCommon+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(!StringUtils.isEmpty(name)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fileter += " and (name like '%"+name+"%' or device_sn like '%"+name+"%')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String limit = " limit "+(page-1)*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long totalCount = jdbcTemplate.queryForObject(countSql+fileter, Long.class); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -138,6 +144,8 @@ public class MonitorPlatformService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject location = JSONObject.parseObject(map.get("location").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            GeoPoint geoPoint = new GeoPoint(Double.parseDouble(location.get("lat").toString()), Double.parseDouble(location.get("lon").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setId(map.get("id").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setName(map.get("name")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setDeviceName(map.get("device_name")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setIdCard(map.get("idcard")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setCategoryCode(map.get("category_code")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setDeviceSn(map.get("device_sn")+""); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -152,7 +160,7 @@ public class MonitorPlatformService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setCreateTime(map.get("create_time")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setPatient(map.get("patient")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setDeviceCommon(map.get("device_common")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setUseCode(map.get("useCode")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setUseCode(map.get("use_code")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setCombinationMethod(map.get("xombination_method")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setTown(map.get("town")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            locationDataVO.setNetworkTransmission(map.get("network_transmission")+""); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1353,7 +1361,12 @@ public class MonitorPlatformService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = "select sum(total) total,sum(useing) useing,SUM(stock) stock,SUM(iot_count) iot_count,SUM(lost_count) lost_count, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "SUM(intervene_count) intervene_count,SUM(issue_count) issue_count,SUM(binding_count) binding_count,SUM(disease_patient_count) disease_patient_count, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "SUM(disease_patient_device_count) disease_patient_device_count,SUM(disease_patient_use_count) disease_patient_use_count, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "SUM(fault_count) fault_count from iot_statistics_stock WHERE parent_type = '"+type+"' and town = '"+town+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "SUM(fault_count) fault_count from iot_statistics_stock WHERE town = '"+town+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("0".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " and parent_type = '0' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " and type = '"+type+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<IotStatisticsStockDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(IotStatisticsStockDO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                stockDO = list.get(0); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1912,29 +1925,18 @@ public class MonitorPlatformService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PermissionService permissionService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getSearchTags() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select id,`value` from xmiot.iot_system_dict where dict_name='DEVICE' and (value='终端一体机' or value ='体征监测设备') and del=1;"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT dict_code code,dict_value name from "+permissionService.getDbName()+".wlyy_hospital_sys_dict WHERE dict_name = 'Device_common_name' and hospital='1' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray result = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> map : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = "select `code`,`value` from xmiot.iot_system_dict where dict_name='DEVICE_TYPE' AND del=1 AND code!=10 AND code!=11  AND parent_code='" + map.get("id").toString() + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            StringBuffer buffer = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> reList = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String, Object> reMap : reList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject tmp = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp.put("name", reMap.get("value").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmp.put("code", reMap.get("code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                buffer.append("," + reMap.get("code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.add(tmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //组合一体机 单体征测量仪 数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            if (org.apache.commons.lang3.StringUtils.isNoneBlank(buffer.toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                buffer.deleteCharAt(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                JSONObject tmp = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                tmp.put("name", map.get("value").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                tmp.put("code", buffer.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                result.add(tmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject tmp = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("name", map.get("name").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("code", map.get("code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.add(tmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2062,7 +2064,7 @@ public class MonitorPlatformService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONObject location = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    location.put("lat", Double.valueOf(json.get("lat"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    location.put("lon", Double.valueOf(json.get("lng"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String insertSql = "INSERT INTO device.wlyy_patient_device_location(patient,idcard,disease_condition,device_sn,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String insertSql = "INSERT INTO wlyy_patient_device_location(patient,idcard,disease_condition,device_sn,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            "device_name,category_code,device_time,create_time,location)\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            "VALUES('" + map.get("code").toString() + "','" + map.get("idcard").toString() + "','" + map.get("disease_condition").toString() + "','" + map.get("device_sn").toString() + "','" + map.get("device_name") + "',\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            "'" + map.get("category_code").toString() + "','" + map.get("create_time") + "','" + map.get("create_time").toString() + "','" + location.toJSONString() + "')\n"; 
			 |