|  | @ -67,6 +67,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
 | 
	
		
			
				|  |  |     private UserAgent userAgent;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private IotCompanyDao iotCompanyDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private HibenateUtils hibenateUtils;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 新增
 | 
	
	
		
			
				|  | @ -259,6 +261,32 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
 | 
	
		
			
				|  |  |         JestResult esResult = elasticSearchHelper.search(ConstantUtils.deviceLocationIndex,ConstantUtils.deviceLocationType,queryStr.toString());
 | 
	
		
			
				|  |  |         return getESResultBeanList(esResult);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public JSONObject getNameAndCode(String idCard,String snCode){
 | 
	
		
			
				|  |  |         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |         String sql = "select t.code as \"code\",t.name as \"name\" from wlyy.wlyy_patient t where 1=1 ";
 | 
	
		
			
				|  |  |         String sqlEqt="select t.device_name as\"device_name\" from device.wlyy_devices t where 1=1";
 | 
	
		
			
				|  |  |         if (StringUtils.isNotEmpty(idCard)){
 | 
	
		
			
				|  |  |             sql = sql +" and t.idcard = '"+idCard+"'";
 | 
	
		
			
				|  |  |         }if (StringUtils.isNotEmpty(snCode)){
 | 
	
		
			
				|  |  |             sqlEqt = sqlEqt +" and t.device_code = '"+snCode+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         System.out.println("查询患者name和code开始");
 | 
	
		
			
				|  |  |         List<Map<String,Object>> nameList = hibenateUtils.createSQLQuery(sql);
 | 
	
		
			
				|  |  |         System.out.println("查询患者name和code结束:"+nameList);
 | 
	
		
			
				|  |  |         System.out.println("查询设备名称开始");
 | 
	
		
			
				|  |  |         List<Map<String,Object>> deviceList = hibenateUtils.createSQLQuery(sqlEqt);
 | 
	
		
			
				|  |  |         System.out.println("查询设备名称结束:"+deviceList);
 | 
	
		
			
				|  |  |         if(nameList.size()>0){
 | 
	
		
			
				|  |  |             String code = null==nameList.get(0).get("code")?"":nameList.get(0).get("code").toString();
 | 
	
		
			
				|  |  |             String name = null==nameList.get(0).get("name")?"":nameList.get(0).get("name").toString();
 | 
	
		
			
				|  |  |            jsonObject.put("nameList",nameList);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (deviceList.size()>0){
 | 
	
		
			
				|  |  |             String equipmentName = null==deviceList.get(0).get("device_name")?"":deviceList.get(0).get("device_name").toString();
 | 
	
		
			
				|  |  |             jsonObject.put("deviceList",deviceList);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonObject;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public List<LocationDataVO> addNameAndCodeToList(List<LocationDataVO> list){
 | 
	
		
			
				|  |  |         if(null!=list){
 | 
	
		
			
				|  |  |             for (LocationDataVO locationDataVO:list){
 | 
	
	
		
			
				|  | @ -266,17 +294,21 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
 | 
	
		
			
				|  |  |                 String sqlEqt="select t.device_name as\"device_name\" from device.wlyy_devices t where 1=1";
 | 
	
		
			
				|  |  |                 String idCard = locationDataVO.getIdCard();
 | 
	
		
			
				|  |  |                 String snCoed = locationDataVO.getDeviceSn();
 | 
	
		
			
				|  |  |                 List<Map<String,Object>> nameList = new ArrayList<>();
 | 
	
		
			
				|  |  |                 List<Map<String,Object>> deviceList = new ArrayList<>();
 | 
	
		
			
				|  |  |                 System.out.println("idCard:="+idCard);
 | 
	
		
			
				|  |  |                 System.out.println("snCode:="+snCoed);
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotEmpty(idCard)){
 | 
	
		
			
				|  |  |                     sql = sql +" and t.idcard = '"+idCard+"'";
 | 
	
		
			
				|  |  |                     System.out.println("查询患者name和code开始");
 | 
	
		
			
				|  |  |                     nameList = jdbcTempalte.queryForList(sql);
 | 
	
		
			
				|  |  |                     System.out.println("查询患者name和code结束:"+nameList);
 | 
	
		
			
				|  |  |                 }if (StringUtils.isNotEmpty(snCoed)){
 | 
	
		
			
				|  |  |                     sqlEqt = sqlEqt +" and t.device_code = '"+snCoed+"'";
 | 
	
		
			
				|  |  |                     System.out.println("查询设备名称开始");
 | 
	
		
			
				|  |  |                     deviceList = jdbcTempalte.queryForList(sqlEqt);
 | 
	
		
			
				|  |  |                     System.out.println("查询设备名称结束:"+deviceList);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 System.out.println("查询患者name和code开始");
 | 
	
		
			
				|  |  |                 List<Map<String,Object>> nameList = jdbcTempalte.queryForList(sql);
 | 
	
		
			
				|  |  |                 System.out.println("查询患者name和code结束:"+nameList);
 | 
	
		
			
				|  |  |                 System.out.println("查询设备名称开始");
 | 
	
		
			
				|  |  |                 List<Map<String,Object>> deviceList = jdbcTempalte.queryForList(sqlEqt);
 | 
	
		
			
				|  |  |                 System.out.println("查询设备名称结束:"+deviceList);
 | 
	
		
			
				|  |  |                 if(nameList.size()>0){
 | 
	
		
			
				|  |  |                     String code = null==nameList.get(0).get("code")?"":nameList.get(0).get("code").toString();
 | 
	
		
			
				|  |  |                     String name = null==nameList.get(0).get("name")?"":nameList.get(0).get("name").toString();
 |