网址是:    http://app1.sfda.gov.cn/datasearch/face3/base.jsp?tableId=25&tableName=TABLE25&title=国产药品&bcId=124356560303886909015737447882          ( 国家药品监督管理局的),他下面呢有个药品的批准文号的列表,我想把他导出为excel表格,本来可以用复制粘贴的办法,可是他有一万多页,工作量太大,无法整。据说这个列表是用java做的,可我不懂啊。
请各位大大帮我解决一下,先谢了哈。
下面是那个列表的内容:1.鲜竹沥 (国药准字Z36021817 江西药都樟树制药有限公司 86905379002726;86905379000432)
 
 
2.生三七散 (国药准字Z36021867 江西药都樟树制药有限公司 86905379002429;86905379002597)
 
 
3.杞菊地黄丸 (国药准字Z41020402 河南时珍制药有限公司 86903093000318)
 
 
4.知柏地黄丸 (国药准字Z41020414 江苏平光信谊(焦作)中药有限公司 86903119000056)
 
 
5.杞菊地黄丸 (国药准字Z41020162 河南省济源市济世药业有限公司 86903070000492)
 
 
6.补中益气丸 (国药准字Z41020476 郑州豫密药业股份有限公司 86903272000030)
 
 
7.六味地黄丸 (国药准字Z41020429 河南省新谊药业股份有限公司 86903085001415)
 
 
8.明目地黄丸 (国药准字Z41020156 河南省济源市济世药业有限公司 86903070000416)
 
 
9.六味地黄丸 (国药准字Z41020155 河南省济源市济世药业有限公司 86903070000164)
 
 
10.龙胆泻肝丸 (国药准字Z41020490 郑州豫密药业股份有限公司 86903272000092)
 
 
11.注射用盐酸川芎嗪 (国药准字H20041175 哈尔滨三联药业有限公司 86903662000961)
 
 
12.甲型H1N1流感病毒裂解疫苗 (国药准字S20090029 兰州生物制品研究所 86905897001539)
 
 
13.甲型H1N1流感病毒裂解疫苗 (国药准字S20090025 大连雅立峰生物制药有限公司 86901119000021)
 
 
14.甲型H1N1流感病毒裂解疫苗 (国药准字S20090026 大连雅立峰生物制药有限公司 86901119000038)
 
 
15.齐多夫定 (国药准字H20094076 浙江新华制药有限公司 86904739000143)
 

解决方案 »

  1.   

    没看到URL上有关页面的参数啊,有的话可以循环抓取网页 把那个table解析出来 存入excel如果在这个网站的基础上开发就太容易了 新开一个页面将header设置为xls格式的table部分的代码不变 下载下来就是excel
      

  2.   

    写了一个获取网页的代码,大家可以看看调用的时候直接
    String str=URLUtil.fetch("http://app1.sfda.gov.cn/datasearch/face3/base.jsp?tableId=25&%20tableName=TABLE25&title=%B9%FA%B2%FA%D2%A9%C6%B7&bcId=124356560303886909015737447882","http://app1.sfda.gov.cn/");
    就可以了package net.single.util;import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.URLConnection;
    /**
     * 网页下载工具类
     * @author Heart.X.Raid
     * @since JDK1.5
     */
    public class URLUtil
    {
    /**URL链接次数,值为{@value}*/
    private static final int max_tries = 10;
    /**URL链接停顿时间,值为{@value}*/
    private static final int try_interval = 20;
    /**URL链接超时时间,值为{@value}*/
    private static final int connect_timeout= 4000;
    /**URL读取超时时间,值为{@value}*/
    private static final int read_timeout= 20000;
    private static final String user_agent= "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
    /**URL默认读取字符编码,值为{@value}*/
    private static final String default_charset = "GBK";
    /**显示URL链接过程中的实时异常状态信息*/
    private static String errinfo=new String();
    /**
     * 获取URL内容
     * @param url URL链接
     * @param from URL地址
     * @return String
     */
        public static String fetch(String urlstr, String website)
    {
    URLConnection connection = null;
    try
    {
    URL url=new URL(urlstr);
    connection = url.openConnection();//打开连接
    connection.setRequestProperty("Referer", website); //设置Referer
                connection.setRequestProperty("User-Agent", user_agent);//设置User-Agent
    connection.setConnectTimeout(connect_timeout);//设置连接超时
    connection.setReadTimeout(read_timeout);  //设置读取超时
    connection=connect(connection); //尝试连接
    if(connection==null)
    {
    return null;
    }
                byte[] raw_content = fetchContent(connection);  //下载,获取内容
    if (null == raw_content)
    {
    return null;   
    }
        int code = ((HttpURLConnection)connection).getResponseCode();//检查从HTTP响应消息获取的状态码
        if (code < 200 || code >= 300)  // HTTP异常状态码
        {
         return null;  
        }
                //侦测编码类型
                String charset =connection.getContentEncoding();
    if (null == charset)
    {
    charset = CharsetUtil.getCharset(connection.getContentType());//得到content-type 头字段
    }
    if (null == charset)
    {
    charset = CharsetUtil.getCharset(new String(raw_content, 0, Math.min(1024, raw_content.length - 1)));
    }
    if (null == charset)
    {
    charset = default_charset;
    }
    return new String(raw_content, charset);
    }
    catch (Exception e)
    {
    e.printStackTrace(System.err);
    }
    return null;
    }
        /**
         * 获取URL内容
         * @param c URL链接
         * @return byte[]
         * @throws IOException I/O错误,抛出异常
         */
    private static byte[] fetchContent(URLConnection c) throws IOException
    {
    byte[] buf = new byte[2048];
    InputStream is = null;
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    int count = 0;
    try
    {
    is = c.getInputStream();
    while ((count = is.read(buf)) >= 0)
    {
    os.write(buf, 0, count);
    }
    }
    catch (Exception e)
    {
    if (os.size() == 0)
    {
    return null;
    }
    }
    finally
    {
    try{is.close(); } catch(Exception e){}
    } return os.toByteArray();
    }
    /**
     * 链接服务器
     * @param connection URL通信链接
     * @return URLConnection
     * @throws IOException 如果打开链接时发生 I/O 错误,抛出异常
     * @throws InterruptedException 如果任何线程中断了当前线程,抛出异常
     */
    private static URLConnection connect(URLConnection connection) throws IOException,InterruptedException
    {
    int i = 0;
    for (; i < max_tries; i ++)
    {
    try
    {
    connection.connect();
    System.out.println("┗ URL连接成功:" + connection.getURL());
    break;
    }
    catch (Exception ex)
    {
    try
    {
    Thread.sleep(try_interval);
    }
    catch (Exception e)
    {
    }
    System.out.println("┗ URL连接失败,尝试第" + (i + 1) + "次连接:" + connection.getURL().getHost());
    continue;
    }
    }
    if (i >= max_tries)
    {
    return null;
    }
    return connection;
    }
    }
      

  3.   

    package net.single.util;import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;;
    /**
     * 网页下载编码类
     * @author Heart.X.Raid
     * @since JDK1.5
     */
    public class CharsetUtil
    {
    /**网页中字符编码串的前端,值为{@value}*/
        public static final String[] charset_start_tags = {"charset=", "encoding="};
        /**网页中字符编码串的后端,值为{@value}*/
        public static final String[] charset_end_tags = {"\"", "'", ">", "<", " ", ";"};
        /**
         * 获取网页中的字符编码
         * @param content 网页内容
         * @return String
         */
        public static String getCharset (String content)
        {
            int index = -1;
            String ret;        ret = null;
            if (null != content)
            {
                for (int i = 0; i < charset_start_tags.length; i ++)
                {
                    if ((index = content.indexOf(charset_start_tags[i])) >= 0)
                    {
                        content = content.substring(index + charset_start_tags[i].length ()).trim();
                        break;
                    }
                }            if (index != -1)
                {
                    //去掉所有双引号
                    if (content.startsWith("\"") && (1 < content.length ()))
                        content = content.substring(1, content.length() - 1);
                    //去掉所有编码字符串中的单引号
                    if (content.startsWith ("'") && (1 < content.length ()))
                        content = content.substring(1, content.length() - 1);
                    // 获取编码的尾部信息
                    for (int i = 0; i < charset_end_tags.length; i ++)
                    {
                        if ((index = content.indexOf(charset_end_tags[i])) >= 0)
                        {
                            content = content.substring(0, index);
                        }
                    }                ret = findCharset (content, ret);            }
            }
            return (ret);
        }    public static String findCharset (String name, String _default)
        {
            String ret;        try
            {
                Class cls;
                Method method;
                Object object;            cls = Class.forName ("java.nio.charset.Charset");
                method = cls.getMethod ("forName", new Class[] { String.class });
                object = method.invoke (null, new Object[] { name });
                method = cls.getMethod ("name", new Class[] { });
                object = method.invoke (object, new Object[] { });
                ret = (String)object;
            }
            catch (ClassNotFoundException cnfe)
            {
                ret = name;
            }
            catch (NoSuchMethodException nsme)
            {
                ret = name;
            }
            catch (IllegalAccessException ia)
            {
                ret = name;
            }
            catch (InvocationTargetException ita)
            {
                ret = _default;
            }        return (ret);
        }
    }
      

  4.   

    楼上的程序可以
    当然这一般就是写个爬虫程序把网页抓下来,在写个parser解析下就可以了
      

  5.   

    如果要把列表里面的内容导出为excel呢,那个列表实际是超级链接,我不懂java,我只想要那样的结果,能否说详细一点啊。
    感谢各位GGJJ。