Module: Cmuh

Defined in:
lib/module/cmuh.rb

Overview

中國醫藥大學附設醫院

Class Method Summary collapse

Class Method Details

.crawlObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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