| 
					
				 | 
			
			
				@ -18,6 +18,7 @@ import com.yihu.jw.restmodel.web.MixEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.http.HttpClientUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import iot.device.LocationDataVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import netscape.javascript.JSObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.http.Consts; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.http.client.utils.URLEncodedUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.http.message.BasicNameValuePair; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -79,10 +80,9 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param diseaseCondition 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<LocationDataVO, LocationDataVO> findDeviceLocations(Integer diseaseCondition, Integer page, Integer size, String type,String deviceType) throws IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<LocationDataVO, LocationDataVO> findDeviceLocations(Integer diseaseCondition, Integer page, Integer size, String type,String deviceType,String deviceName) throws IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        MixEnvelop<LocationDataVO, LocationDataVO> envelop = new MixEnvelop<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        MixEnvelop<LocationDataVO, LocationDataVO> envelopTmp = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(org.apache.commons.lang.StringUtils.isNotBlank(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String re = searchpatientdevicesn(type, page, size); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -115,49 +115,74 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<LocationDataVO> euipmentList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int totalEqCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int totalCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查找全部 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(diseaseCondition!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("andOr","and"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("field","diseaseCondition"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("condition","="); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("value",diseaseCondition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //小屋总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(deviceType.contains("5")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               totalEqCount = iotEqtDetailService.getEquipmentCount(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (org.apache.commons.lang3.StringUtils.isBlank(deviceName)||(org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName) &&"健康小屋".equals(deviceName))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    totalEqCount = iotEqtDetailService.getEquipmentCount(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] categoryCodes= deviceType.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(categoryCodes.length==1&&"5".equals(deviceType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                euipmentList = iotEqtDetailService.getEquipmentLocation(page,size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                envelop.getDetailModelList().addAll(euipmentList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (org.apache.commons.lang3.StringUtils.isBlank(deviceName)||(org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName) &&"健康小屋".equals(deviceName))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    euipmentList = iotEqtDetailService.getEquipmentLocation(page,size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    envelop.getDetailModelList().addAll(euipmentList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(deviceType.contains("5")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    euipmentList = iotEqtDetailService.getEquipmentLocation(page,size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    envelop.getDetailModelList().addAll(euipmentList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (org.apache.commons.lang3.StringUtils.isBlank(deviceName)||(org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName) &&"健康小屋".equals(deviceName))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        euipmentList = iotEqtDetailService.getEquipmentLocation(page,size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        envelop.getDetailModelList().addAll(euipmentList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (String categoryCode:categoryCodes){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(diseaseCondition!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        json.put("andOr","and"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        json.put("field","diseaseCondition"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        json.put("condition","="); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        json.put("value",diseaseCondition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if(!"5".equals(categoryCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         json.put("andOr","and"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         json.put("field","categoryCode"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         json.put("condition","="); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         json.put("value",Integer.parseInt(categoryCode)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             String sql="select DISTINCT device_code from device.wlyy_devices where device_name like '%"+deviceName+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             List<String> listTmp = jdbcTemplate.queryForList(sql,String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             if (listTmp.size()!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 StringBuffer tmp = new StringBuffer(listTmp.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 tmp =tmp.deleteCharAt(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 tmp = tmp.deleteCharAt(tmp.length()-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 json.put("andOr","and"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 json.put("field","deviceSn"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 json.put("condition","in"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 json.put("value",listTmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             json.put("andOr","and"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             json.put("field","categoryCode"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             json.put("condition","="); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             json.put("value",Integer.parseInt(categoryCode)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         jsonObject.put("filter",jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         jsonObject.put("page",page); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         jsonObject.put("size",size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         List<LocationDataVO> locationDataVOList = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonObject.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         List<LocationDataVO> list2 = iotPatientDeviceService.addNameAndCodeToList(locationDataVOList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         //figureLabelSerachService.getFigureLabelByList(locationDataVOList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         envelop.getDetailModelList().addAll(list2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         totalCount += iotPatientDeviceService.getESCount(jsonObject.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         jsonArray.remove(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (jsonArray.size()!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             List<LocationDataVO> locationDataVOList = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonObject.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             List<LocationDataVO> list2 = iotPatientDeviceService.addNameAndCodeToList(locationDataVOList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             //figureLabelSerachService.getFigureLabelByList(locationDataVOList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             envelop.getDetailModelList().addAll(list2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             totalCount += iotPatientDeviceService.getESCount(jsonObject.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)) break;//通过deviceName查询的不过滤categpry(即所有设备中查找符合) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            envelop.setTotalCount(totalCount>totalEqCount?totalCount:totalEqCount); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -798,6 +823,20 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getTotalRange(String startTime, String endTime, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                  String deviceType, String area, String hospital){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("grant",totalRange(startTime,endTime,deviceType,area,hospital,"85")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("binding",totalRange(startTime,endTime,deviceType,area,hospital,"86")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("guide",totalRange(startTime,endTime,deviceType,area,hospital,"88")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("malfunction",totalRange(startTime,endTime,deviceType,area,hospital,"0")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("diseaseUsing",diseaseUseRange(startTime,endTime,deviceType,area,hospital)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("diseaseCover",diseaseRange(startTime,endTime,deviceType,area,hospital)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 慢病患者设备使用率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startTime 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -890,7 +929,7 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray warningInformationAlarm_new(Integer page,Integer pageSize,String startTime,String endTime, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                 String deviceType,String area,String hospital){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                 String deviceType,String area,String hospital,String deviceName){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String url = "/wlyygc/iot_monitoring/warningInformationAlarm_new"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("page",page); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -900,6 +939,7 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("deviceType",deviceType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("area",area); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("hospital",hospital); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("deviceName",deviceName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String response = sendGet(url,params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject json = JSONObject.parseObject(response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(json.getInteger("status")==200){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -951,7 +991,6 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<jsonArray.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject data = jsonArray.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String deviceSn = data.getString("deviceSn"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray jsonArray1 = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json1 = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json1.put("andOr","and"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1118,7 +1157,7 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                StringBuffer sql = new StringBuffer("SELECT a.category_code type,a.device_name,a.c as 'using',b.c-a.c as 'stock',b.c as 'total' from ( "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                StringBuffer sqlCondition = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sqlCondition.append("and d.device_name='"+deviceName+"' "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sqlCondition.append("and d.device_name in ('").append(deviceName.replace(",","','")).append("') "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql.append("SELECT d.category_code,d.device_name, COUNT(*) c from wlyy.wlyy_patient_device d,wlyy.wlyy_sign_family f WHERE f.`status`>0 and f.patient = d.`user` "+sqlCondition+" "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(showLevel)){//组合一体机(5健康小屋,取自物联网),单体征测量仪(2血压计、1血糖仪) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1206,7 +1245,7 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put("lostContact",lostContact); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //deviceType包含小屋且设备名称为空||deviceType包含小屋且设备名称为健康小屋。 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          if ((deviceType.contains("5")&&org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType))||(deviceType.contains("5")&&org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)&&"健康小屋".equals(deviceName))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          if ((deviceType.contains("5")&&org.apache.commons.lang3.StringUtils.isBlank(deviceName))||(deviceType.contains("5")&&org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)&&deviceName.contains("健康小屋"))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sql = "select COUNT(*) from xmiot.iot_equipmet_detail"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer count = jdbcTemplate.queryForObject(sql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject tmp = new JSONObject(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1249,9 +1288,9 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getRange(int first, int second, int i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (second == 0 && first > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "100%"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "100"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (second == 0 && first == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "0.00%"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "0.00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        float size = (float) (first * 100) / second; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1316,9 +1355,10 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(sqlCondition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            total=jdbcTemplate.queryForObject(sql.toString(),Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer count =0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ((org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType)&&deviceType.contains("5"))||org.apache.commons.lang3.StringUtils.isBlank(deviceType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sqll = "select COUNT(*) from xmiot.iot_equipmet_detail"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer count = jdbcTemplate.queryForObject(sqll,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             count = jdbcTemplate.queryForObject(sqll,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("totalAll",grantCount+count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count =0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("1".equals(quotaCode)){//小屋物联率 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1339,6 +1379,9 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("total",total+count);//互联设备\失联设备数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("total",total+count);//互联设备\失联设备数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DecimalFormat df = new DecimalFormat("0.00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (result.getInteger("totalAll") > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("totalRange", df.format(result.getDouble("total") > 0.0 ? ((result.getDouble("total")) / (result.getInteger("totalAll") * 1.0000) * 100) : 0.0) ); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1377,7 +1420,6 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getDeviceData(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //血糖仪数量 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1413,4 +1455,46 @@ public class MonitorPlatformService  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("medicalAbnormalSignData",gg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getSearchTags(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select id,`value` from xmiot.iot_system_dict where dict_name='DEVICE' and (value='组合一体机' or value ='单体征测量仪') and del=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 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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getDeviceTotalCount(String startTime,String endTime,String deviceType,String area){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String url = "/wlyygc/iot_monitoring/getDeviceTotalCount"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("startTime",startTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("endTime",endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("deviceType",deviceType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("area",area); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String response = sendGet(url,params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject json = JSONObject.parseObject(response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(json.getInteger("status")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return json.getJSONObject("data"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |