Module: Cgmh_lingko

Defined in:
lib/module/cgmh_lingko.rb

Overview

長庚醫療財團法人林口長庚紀念醫院

Class Method Summary collapse

Class Method Details

.crawlObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/module/cgmh_lingko.rb', line 3

def Cgmh_lingko.crawl
    hash = {}
    url = "https://www.cgmh.org.tw/bed/erd/index.asp?loc=3"
    begin
        page = Nokogiri::HTML(open(url))

        hash[:hospital] = "cgmh_lingko"
        hash[:to_119]        = page.css("table:nth-child(1) tr:nth-child(5) td table  tr:nth-child(3) td:nth-child(2) font").text.strip
        hash[:wait_see]      = page.css("table:nth-child(1) tr:nth-child(5) td table  tr:nth-child(4) td:nth-child(2) font").text.strip
        hash[:wait_push_bed] = page.css("table:nth-child(1) tr:nth-child(5) td table  tr:nth-child(5) td:nth-child(2) font").text.strip
        hash[:wait_bed]      = page.css("table:nth-child(1) tr:nth-child(5) td table  tr:nth-child(6) td:nth-child(2) font").text.strip
        hash[:wait_cure_bed] = page.css("table:nth-child(1) tr:nth-child(5) td table  tr:nth-child(7) td:nth-child(2) font").text.strip
    rescue Exception => e
        p e.message
        return nil
    end
    return hash
end