| 
					
				 | 
			
			
				@ -1,13 +1,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.iot.controller.device; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.device.IotPatientDeviceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.label.FigureLabelSerachService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.iot.device.IotPatientDeviceDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.common.Envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.common.EnvelopRestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.iot.device.FigureLabelDataModelVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.iot.device.IotDeviceVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.iot.device.LocationDataVO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -207,36 +204,37 @@ public class IotPatientDeviceController extends EnvelopRestController{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                     @RequestParam(value = "jsonData",required = true) String jsonData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<LocationDataVO> list = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list.forEach(one->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                field("and","idcard","=",one.getIdCard(),jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                field("and","labelType","=","3",jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("filter",jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                boolean isTNB = false;//是否糖尿病 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                boolean isGXY = false;//是否高血压 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<FigureLabelDataModelVO> labelList = figureLabelSerachService.getFigureLabelByIdcard(json.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (FigureLabelDataModelVO vo:labelList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if("1".equals(vo.getLabelCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        isGXY = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if("2".equals(vo.getLabelCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        isTNB = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //0无,1高血压,2糖尿病,3高血压糖尿病都有 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(isTNB&&isGXY){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    one.setLabel("3"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else if(isTNB){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    one.setLabel("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else if(isGXY){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    one.setLabel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    one.setLabel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            figureLabelSerachService.getFigureLabelByList(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            list.forEach(one->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                field("and","idcard","=",one.getIdCard(),jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                field("and","labelType","=","3",jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                json.put("filter",jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                boolean isTNB = false;//是否糖尿病 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                boolean isGXY = false;//是否高血压 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                List<FigureLabelDataModelVO> labelList = figureLabelSerachService.getFigureLabelByIdcard(json.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                for (FigureLabelDataModelVO vo:labelList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    if("1".equals(vo.getLabelCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        isGXY = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    if("2".equals(vo.getLabelCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        isTNB = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                //0无,1高血压,2糖尿病,3高血压糖尿病都有 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                if(isTNB&&isGXY){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    one.setLabel("3"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                }else if(isTNB){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    one.setLabel("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                }else if(isGXY){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    one.setLabel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    one.setLabel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return Envelop.getSuccessList(IotRequestMapping.Device.message_success_create,list,iotPatientDeviceService.getESCount(jsonData)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -244,23 +242,6 @@ public class IotPatientDeviceController extends EnvelopRestController{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 添加条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 参数格式:[{"andOr":"and|or","condition":">|=|<|>=|<=|?","field":"<field>","value":"<value>"},<{...}>] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param andOr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param field 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param condition 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param value 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param jsonArray 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private void field(String andOr,String field,String condition,String value,JSONArray jsonArray){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("andOr",andOr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("field",field); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("condition",condition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("value",value); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonArray.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = IotRequestMapping.PatientDevice.findLocationBySn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "根据sn码查询设备地址", notes = "根据sn码查询设备地址") 
			 |