| 
					
				 | 
			
			
				@ -206,7 +206,19 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        list = hibenateUtils.createSQLQuery(sql,page,size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> stringObjectMap : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!StringUtils.isEmpty(stringObjectMap.get("status"))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("1".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "在线"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "离线"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("-1".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String countSql = " select " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "     COUNT(DISTINCT (t.id)) as count " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   from " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -307,7 +319,19 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        list = hibenateUtils.createSQLQuery(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> stringObjectMap : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!StringUtils.isEmpty(stringObjectMap.get("status"))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("1".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "在线"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "离线"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("-1".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String countSql = " select " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "     COUNT(DISTINCT (t.id)) as count " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   from " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -387,7 +411,69 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        list = hibenateUtils.createSQLQuery(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> map:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> stringObjectMap : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!StringUtils.isEmpty(stringObjectMap.get("status"))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("1".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "在线"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "离线"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("-1".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 根据设备id,查询与之绑定的补货员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param deviceId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getUsers(String deviceId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isEmpty(deviceId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("msg","parameter deviceId is null "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("response",ConstantUtils.FAIL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.id AS id,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.account AS account,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.belong_community AS belongCommunity,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.bir_date AS birDate,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.confirm_password AS confirmPassword,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.contact_info AS contactInfo,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.`name` AS `name`,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.`password` AS `password`,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.res_med_cabinet AS resMedCabinet,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.res_pon_area AS resPonArea,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.role AS role,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.sex AS sex,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.create_time AS createTime,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.create_user AS createUser,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.create_user_name AS createUserName,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.update_time AS updateTime,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.update_user AS updateUser,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.update_user_name AS updateUserName\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t_mediicine_user AS t where\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String conditionSql = " t.id in (select du.user_id from t_mediicine_device_user du where del = 1 and du.device_id = " + deviceId + ")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql = sql + conditionSql; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        list = hibenateUtils.createSQLQuery(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> stringObjectMap : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list)); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -592,12 +678,32 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        list = hibenateUtils.createSQLQuery(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> stringObjectMap : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!StringUtils.isEmpty(stringObjectMap.get("status"))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("1".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "在线"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("0".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "离线"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("-1".equals(stringObjectMap.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    stringObjectMap.put("statusName", "异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("response", ConstantUtils.SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("msg",list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取所属id的缺货信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param ids 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getDetialOutOfStock(String ids) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -638,7 +744,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.ratio AS ratio,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t.cargo_capacity AS cargoCapacity\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t_mediicine_device AS t WHERE id in(" + ids + ",'')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t_mediicine_device AS t WHERE  t.id in (" + ids + ")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sencordSql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\ttmi.layer_no AS layerNo,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\ttmi.wayer_no AS wayerNo,\n" + 
			 |