module Cmuh

中國醫藥大學附設醫院

Public Class Methods

crawl() click to toggle source
# File lib/module/cmuh.rb, line 4
def Cmuh.crawl
    hash = {}
    url = "http://61.66.117.8/EmrCount/Default.aspx"
    begin
        page = Nokogiri::HTML(open(url))
        hash[:hospital] = "cmuh"
        hash[:to_119]        = page.css("#GridView1 tr:nth-child(2) td:nth-child(2)").text.strip
        hash[:wait_see]      = page.css("#GridView1 tr:nth-child(3) td:nth-child(2)").text.strip
        hash[:wait_push_bed] = page.css("#GridView1 tr:nth-child(4) td:nth-child(2)").text.strip
        hash[:wait_bed]      = page.css("#GridView1 tr:nth-child(5) td:nth-child(2)").text.strip
        hash[:wait_cure_bed] = page.css("#GridView1 tr:nth-child(6) td:nth-child(2)").text.strip
    rescue Exception => e
        p e.message
        return nil
    end
    return hash
end