tw_hospital 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fccdce498884b35c9c8486602e442fdbd7347ff
4
- data.tar.gz: 45ee949473eeb8178b004619608de1e1eab3e52e
3
+ metadata.gz: 3f6fa92c1a28c8b687b44ca06bb107d1cac6695b
4
+ data.tar.gz: aa04707b7b7c72ac87f45c6a035ea9256fb32f74
5
5
  SHA512:
6
- metadata.gz: 9d0ced029f8710485bb83f1cb8ad27fd1c5191ab2480cbeb407c2f7a08b8f56f2956df331629f4d593379411237abdf65cc275dc292068fdfb0ac10e9705084d
7
- data.tar.gz: f8c69c654eaedc8c127210f171267de624f86a5655c690979961c23d65ed19b0f491f53096494b5a0c939e3902513f93aa095abeafe672d4acc0e1402de42eb2
6
+ metadata.gz: 9cb93360b24b17f496b7ad2184b66213b9267b2c1560bb776372fcea4cee040625d4a6a785d387950673deaf03b425917d7587bba32f66a74375be139db2bf53
7
+ data.tar.gz: 27c78736d800d309c8db8802ac51e78bcfeb14fb7bfd50449979752f8204d7f500e81f07799494df4126340ce82abca4276d892aee11b90163911ad429ceb55b
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ *.gem
data/lib/module/cch.rb CHANGED
@@ -1,15 +1,20 @@
1
1
  # 彰化基督教醫療財團法人彰化基督教醫院
2
2
  module Cch
3
3
  def Cch.crawl
4
- hash = {}
5
- url = "http://www.cch.org.tw/news/er_news.aspx"
6
- page = Nokogiri::HTML(open(url))
7
- hash[:hospital] = "cch"
8
- hash[:to_119] = page.css("#Image2").map {|i| i['alt']}[0]
9
- hash[:wait_see] = page.css("#Txt_Label2").text.strip
10
- hash[:wait_push_bed] = page.css("#Txt_Label3").text.strip
11
- hash[:wait_bed] = page.css("#Txt_Label4").text.strip
12
- hash[:wait_cure_bed] = page.css("#Txt_Label5").text.strip
4
+ begin
5
+ hash = {}
6
+ url = "http://www.cch.org.tw/news/er_news.aspx"
7
+ page = Nokogiri::HTML(open(url))
8
+ hash[:hospital] = "cch"
9
+ hash[:to_119] = page.css("#Image2").map {|i| i['alt']}[0]
10
+ hash[:wait_see] = page.css("#Txt_Label2").text.strip
11
+ hash[:wait_push_bed] = page.css("#Txt_Label3").text.strip
12
+ hash[:wait_bed] = page.css("#Txt_Label4").text.strip
13
+ hash[:wait_cure_bed] = page.css("#Txt_Label5").text.strip
14
+ rescue Exception => e
15
+ p e.message
16
+ return nil
17
+ end
13
18
  return hash
14
19
  end
15
20
  end
data/lib/module/cgh.rb CHANGED
@@ -3,13 +3,18 @@ module Cgh
3
3
  def Cgh.crawl
4
4
  hash = {}
5
5
  url = "http://med.cgh.org.tw/unit/branch/Pharmacy/ebl/RealTimeInfoHQ.html"
6
- page = Nokogiri::HTML(open(url))
7
- hash[:hospital] = "cgh"
8
- hash[:to_119] = page.css("center table tr:nth-child(1) td:nth-child(3)").text.strip
9
- hash[:wait_see] = page.css("center table tr:nth-child(2) td:nth-child(3)").text.strip
10
- hash[:wait_push_bed] = page.css("center table tr:nth-child(3) td:nth-child(3)").text.strip
11
- hash[:wait_bed] = page.css("center table tr:nth-child(4) td:nth-child(3)").text.strip
12
- hash[:wait_cure_bed] = page.css("center table tr:nth-child(5) td:nth-child(3)").text.strip
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
8
+ hash[:hospital] = "cgh"
9
+ hash[:to_119] = page.css("center table tr:nth-child(1) td:nth-child(3)").text.strip
10
+ hash[:wait_see] = page.css("center table tr:nth-child(2) td:nth-child(3)").text.strip
11
+ hash[:wait_push_bed] = page.css("center table tr:nth-child(3) td:nth-child(3)").text.strip
12
+ hash[:wait_bed] = page.css("center table tr:nth-child(4) td:nth-child(3)").text.strip
13
+ hash[:wait_cure_bed] = page.css("center table tr:nth-child(5) td:nth-child(3)").text.strip
14
+ rescue Exception => e
15
+ p e.message
16
+ return nil
17
+ end
13
18
  return hash
14
19
  end
15
20
  end
@@ -3,13 +3,19 @@ module Cgmh_chayi
3
3
  def Cgmh_chayi.crawl
4
4
  hash = {}
5
5
  url = "https://www.cgmh.org.tw/bed/erd/index.asp?loc=6"
6
- page = Nokogiri::HTML(open(url))
7
- hash[:hospital] = "cgmh_chayi"
8
- 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
9
- 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
10
- 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
11
- 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
12
- 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
13
- hash
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
8
+ hash[:hospital] = "cgmh_chayi"
9
+ 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
10
+ 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
11
+ 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
12
+ 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
13
+ 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
14
+ hash
15
+ rescue Exception => e
16
+ p e.message
17
+ return nil
18
+ end
19
+ return hash
14
20
  end
15
21
  end
@@ -3,14 +3,19 @@ module Cgmh_kl
3
3
  def Cgmh_kl.crawl
4
4
  hash = {}
5
5
  url = "https://www.cgmh.org.tw/bed/erd/index.asp?loc=2"
6
- page = Nokogiri::HTML(open(url))
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
7
8
 
8
- hash[:hospital] = "cgmh_kl"
9
- 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
10
- 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
11
- 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
12
- 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
13
- 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
14
- hash
9
+ hash[:hospital] = "cgmh_kl"
10
+ 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
11
+ 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
12
+ 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
13
+ 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
14
+ 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
15
+ rescue Exception => e
16
+ p e.message
17
+ return nil
18
+ end
19
+ return hash
15
20
  end
16
21
  end
@@ -3,13 +3,18 @@ module Cgmh_ks
3
3
  def Cgmh_ks.crawl
4
4
  hash = {}
5
5
  url = "https://www.cgmh.org.tw/bed/erd/index.asp?loc=8"
6
- page = Nokogiri::HTML(open(url))
7
- hash[:hospital] = "cgmh_ks"
8
- 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
9
- 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
10
- 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
11
- 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
12
- 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
13
- hash
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
8
+ hash[:hospital] = "cgmh_ks"
9
+ 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
10
+ 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
11
+ 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
12
+ 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
13
+ 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
14
+ rescue Exception => e
15
+ p e.message
16
+ return nil
17
+ end
18
+ return hash
14
19
  end
15
20
  end
@@ -3,14 +3,19 @@ module Cgmh_lingko
3
3
  def Cgmh_lingko.crawl
4
4
  hash = {}
5
5
  url = "https://www.cgmh.org.tw/bed/erd/index.asp?loc=3"
6
- page = Nokogiri::HTML(open(url))
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
7
8
 
8
- hash[:hospital] = "cgmh_lingko"
9
- 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
10
- 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
11
- 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
12
- 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
13
- 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
14
- hash
9
+ hash[:hospital] = "cgmh_lingko"
10
+ 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
11
+ 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
12
+ 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
13
+ 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
14
+ 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
15
+ rescue Exception => e
16
+ p e.message
17
+ return nil
18
+ end
19
+ return hash
15
20
  end
16
21
  end
data/lib/module/chimei.rb CHANGED
@@ -3,17 +3,22 @@ module Chimei
3
3
  def Chimei.crawl
4
4
  hash = {}
5
5
  url = "http://www.chimei.org.tw/%E6%80%A5%E8%A8%BA%E5%8D%B3%E6%99%82%E8%A8%8A%E6%81%AF/main.aspx?ihosp=10"
6
- html = open(url).read
7
- html.encode!("big5")
8
- page = Nokogiri::HTML.parse html
9
- hash[:hospital] = "chimei"
10
- hash[:to_119] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(1)").text.strip
11
- hash[:wait_see] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(2)").text.strip
12
- hash[:emergency_number] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(3)").text.strip
13
- hash[:wait_paediatrics] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(4)").text.strip
14
- hash[:wait_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(5)").text.strip
15
- hash[:wait_cure_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(6)").text.strip
16
- hash[:wait_push_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(7)").text.strip
6
+ begin
7
+ html = open(url).read
8
+ html.encode!("big5")
9
+ page = Nokogiri::HTML.parse html
10
+ hash[:hospital] = "chimei"
11
+ hash[:to_119] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(1)").text.strip
12
+ hash[:wait_see] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(2)").text.strip
13
+ hash[:emergency_number] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(3)").text.strip
14
+ hash[:wait_paediatrics] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(4)").text.strip
15
+ hash[:wait_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(5)").text.strip
16
+ hash[:wait_cure_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(6)").text.strip
17
+ hash[:wait_push_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(3) table tr:nth-child(2) td:nth-child(7)").text.strip
18
+ rescue Exception => e
19
+ p e.message
20
+ return nil
21
+ end
17
22
  return hash
18
23
  end
19
24
  end
@@ -3,17 +3,22 @@ module Chimei_cl
3
3
  def Chimei_cl.crawl
4
4
  hash = {}
5
5
  url = "http://www.chimei.org.tw/%E6%80%A5%E8%A8%BA%E5%8D%B3%E6%99%82%E8%A8%8A%E6%81%AF/main.aspx?ihosp=10"
6
- html = open(url).read
7
- html.encode!("big5")
8
- page = Nokogiri::HTML.parse html
9
- hash[:hospital] = "chimei_cl"
10
- hash[:to_119] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(1)").text.strip
11
- hash[:wait_see] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(2)").text.strip
12
- hash[:emergency_number] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(3)").text.strip
13
- hash[:wait_paediatrics] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(4)").text.strip
14
- hash[:wait_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(5)").text.strip
15
- hash[:wait_cure_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(6)").text.strip
16
- hash[:wait_push_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(7)").text.strip
6
+ begin
7
+ html = open(url).read
8
+ html.encode!("big5")
9
+ page = Nokogiri::HTML.parse html
10
+ hash[:hospital] = "chimei_cl"
11
+ hash[:to_119] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(1)").text.strip
12
+ hash[:wait_see] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(2)").text.strip
13
+ hash[:emergency_number] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(3)").text.strip
14
+ hash[:wait_paediatrics] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(4)").text.strip
15
+ hash[:wait_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(5)").text.strip
16
+ hash[:wait_cure_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(6)").text.strip
17
+ hash[:wait_push_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(13) table tr:nth-child(2) td:nth-child(7)").text.strip
18
+ rescue Exception => e
19
+ p e.message
20
+ return nil
21
+ end
17
22
  return hash
18
23
  end
19
24
  end
@@ -3,17 +3,22 @@ module Chimei_ly
3
3
  def Chimei_ly.crawl
4
4
  hash = {}
5
5
  url = "http://www.chimei.org.tw/%E6%80%A5%E8%A8%BA%E5%8D%B3%E6%99%82%E8%A8%8A%E6%81%AF/main.aspx?ihosp=10"
6
- html = open(url).read
7
- html.encode!("big5")
8
- page = Nokogiri::HTML.parse html
9
- hash[:hospital] = "chimei_ly"
10
- hash[:to_119] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(1)").text.strip
11
- hash[:wait_see] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(2)").text.strip
12
- hash[:emergency_number] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(3)").text.strip
13
- hash[:wait_paediatrics] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(4)").text.strip
14
- hash[:wait_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(5)").text.strip
15
- hash[:wait_cure_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(6)").text.strip
16
- hash[:wait_push_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(7)").text.strip
6
+ begin
7
+ html = open(url).read
8
+ html.encode!("big5")
9
+ page = Nokogiri::HTML.parse html
10
+ hash[:hospital] = "chimei_ly"
11
+ hash[:to_119] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(1)").text.strip
12
+ hash[:wait_see] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(2)").text.strip
13
+ hash[:emergency_number] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(3)").text.strip
14
+ hash[:wait_paediatrics] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(4)").text.strip
15
+ hash[:wait_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(5)").text.strip
16
+ hash[:wait_cure_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(6)").text.strip
17
+ hash[:wait_push_bed] = page.css("#form1 div:nth-child(2) table tr:nth-child(4) td div:nth-child(8) table tr:nth-child(2) td:nth-child(7)").text.strip
18
+ rescue Exception => e
19
+ p e.message
20
+ return nil
21
+ end
17
22
  return hash
18
23
  end
19
24
  end
data/lib/module/cmuh.rb CHANGED
@@ -4,13 +4,18 @@ module Cmuh
4
4
  def Cmuh.crawl
5
5
  hash = {}
6
6
  url = "http://61.66.117.8/EmrCount/Default.aspx"
7
- page = Nokogiri::HTML(open(url))
8
- hash[:hospital] = "cmuh"
9
- hash[:to_119] = page.css("#GridView1 tr:nth-child(2) td:nth-child(2)").text.strip
10
- hash[:wait_see] = page.css("#GridView1 tr:nth-child(3) td:nth-child(2)").text.strip
11
- hash[:wait_push_bed] = page.css("#GridView1 tr:nth-child(4) td:nth-child(2)").text.strip
12
- hash[:wait_bed] = page.css("#GridView1 tr:nth-child(5) td:nth-child(2)").text.strip
13
- hash[:wait_cure_bed] = page.css("#GridView1 tr:nth-child(6) td:nth-child(2)").text.strip
7
+ begin
8
+ page = Nokogiri::HTML(open(url))
9
+ hash[:hospital] = "cmuh"
10
+ hash[:to_119] = page.css("#GridView1 tr:nth-child(2) td:nth-child(2)").text.strip
11
+ hash[:wait_see] = page.css("#GridView1 tr:nth-child(3) td:nth-child(2)").text.strip
12
+ hash[:wait_push_bed] = page.css("#GridView1 tr:nth-child(4) td:nth-child(2)").text.strip
13
+ hash[:wait_bed] = page.css("#GridView1 tr:nth-child(5) td:nth-child(2)").text.strip
14
+ hash[:wait_cure_bed] = page.css("#GridView1 tr:nth-child(6) td:nth-child(2)").text.strip
15
+ rescue Exception => e
16
+ p e.message
17
+ return nil
18
+ end
14
19
  return hash
15
20
  end
16
21
  end
data/lib/module/csh.rb CHANGED
@@ -3,20 +3,25 @@ module Csh
3
3
  def Csh.crawl
4
4
  hash = {}
5
5
  url = "http://www.csh.org.tw/ER/index.aspx"
6
- html = open(url).read
7
- html.encode!("big5")
8
- page = Nokogiri::HTML.parse html
9
- hash[:hospital] = "csh"
10
- hash[:wait_see] = page.css("#WaitVisitCount").text.strip
11
- hash[:wait_push_bed] = page.css("#WaitErBedCount").text.strip
12
- hash[:wait_bed] = page.css("#WaitInpBedCount").text.strip
13
- hash[:wait_cure_bed] = page.css("#WaitInpBedCount").text.strip
14
- hash[:wait_internal_medicine] = page.css("#WaitBedInME").text.strip
15
- hash[:wait_surgery] = page.css("#WaitBedInSE").text.strip
16
- hash[:wait_paediatrics] = page.css("#WaitBedInPE").text.strip
17
- hash[:wait_gynaecology] = page.css("#WaitBedInGE").text.strip
18
- hash[:wait_other] = page.css("#WaitBedOthers").text.strip
19
- hash[:to_119] = page.css("#ReportStatus").text.strip
6
+ begin
7
+ html = open(url).read
8
+ html.encode!("big5")
9
+ page = Nokogiri::HTML.parse html
10
+ hash[:hospital] = "csh"
11
+ hash[:wait_see] = page.css("#WaitVisitCount").text.strip
12
+ hash[:wait_push_bed] = page.css("#WaitErBedCount").text.strip
13
+ hash[:wait_bed] = page.css("#WaitInpBedCount").text.strip
14
+ hash[:wait_cure_bed] = page.css("#WaitInpBedCount").text.strip
15
+ hash[:wait_internal_medicine] = page.css("#WaitBedInME").text.strip
16
+ hash[:wait_surgery] = page.css("#WaitBedInSE").text.strip
17
+ hash[:wait_paediatrics] = page.css("#WaitBedInPE").text.strip
18
+ hash[:wait_gynaecology] = page.css("#WaitBedInGE").text.strip
19
+ hash[:wait_other] = page.css("#WaitBedOthers").text.strip
20
+ hash[:to_119] = page.css("#ReportStatus").text.strip
21
+ rescue Exception => e
22
+ p e.message
23
+ return nil
24
+ end
20
25
  return hash
21
26
  end
22
27
  end
data/lib/module/edah.rb CHANGED
@@ -3,15 +3,20 @@ module Edah
3
3
  def Edah.crawl
4
4
  hash = {}
5
5
  url = "http://www3.edah.org.tw/E-DA/WebRegister/ProcessEmeInf.jsp"
6
- html = open(url).read
7
- html.encode!("big5")
8
- page = Nokogiri::HTML.parse html
9
- hash[:hospital] = "edah"
10
- hash[:to_119] = self.split(page.css("body table tr:nth-child(1) td font").text.strip)
11
- hash[:wait_see] = self.split(page.css("body table tr:nth-child(2) td font").text.strip)
12
- hash[:wait_push_bed] = self.split(page.css("body table tr:nth-child(3) td font").text.strip)
13
- hash[:wait_bed] = self.split(page.css("body table tr:nth-child(4) td font").text.strip)
14
- hash[:wait_cure_bed] = self.split(page.css("body table tr:nth-child(5) td font").text.strip)
6
+ begin
7
+ html = open(url).read
8
+ html.encode!("big5")
9
+ page = Nokogiri::HTML.parse html
10
+ hash[:hospital] = "edah"
11
+ hash[:to_119] = self.split(page.css("body table tr:nth-child(1) td font").text.strip)
12
+ hash[:wait_see] = self.split(page.css("body table tr:nth-child(2) td font").text.strip)
13
+ hash[:wait_push_bed] = self.split(page.css("body table tr:nth-child(3) td font").text.strip)
14
+ hash[:wait_bed] = self.split(page.css("body table tr:nth-child(4) td font").text.strip)
15
+ hash[:wait_cure_bed] = self.split(page.css("body table tr:nth-child(5) td font").text.strip)
16
+ rescue Exception => e
17
+ p e.message
18
+ return nil
19
+ end
15
20
  return hash
16
21
  end
17
22
 
data/lib/module/kmuh.rb CHANGED
@@ -3,13 +3,18 @@ module Kmuh
3
3
  def Kmuh.crawl
4
4
  hash = {}
5
5
  url = "http://www.kmuh.org.tw/KMUHWeb/Pages/P04MedService/ERStatus.aspx"
6
- page = Nokogiri::HTML(open(url))
7
- hash[:hospital] = "kmuh"
8
- hash[:to_119] = page.css("#Label_A01").text.strip
9
- hash[:wait_see] = page.css("#Label_A02").text.strip
10
- hash[:wait_push_bed] = page.css("#Label_A03").text.strip
11
- hash[:wait_bed] = page.css("#Label_A04").text.strip
12
- hash[:wait_cure_bed] = page.css("#Label_A05").text.strip
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
8
+ hash[:hospital] = "kmuh"
9
+ hash[:to_119] = page.css("#Label_A01").text.strip
10
+ hash[:wait_see] = page.css("#Label_A02").text.strip
11
+ hash[:wait_push_bed] = page.css("#Label_A03").text.strip
12
+ hash[:wait_bed] = page.css("#Label_A04").text.strip
13
+ hash[:wait_cure_bed] = page.css("#Label_A05").text.strip
14
+ rescue Exception => e
15
+ p e.message
16
+ return nil
17
+ end
13
18
  return hash
14
19
  end
15
20
  end
@@ -3,15 +3,20 @@ module Ktgh_dajia
3
3
  def Ktgh_dajia.crawl
4
4
  hash = {}
5
5
  url = "http://www.ktgh.com.tw/BednoInfo_Show.asp?CatID=81&ModuleType=Y"
6
- html = open(url).read
7
- html.encode!("big5")
8
- page = Nokogiri::HTML.parse html
9
- hash[:hospital] = "ktgh_dajia"
10
- # hash[:to_119] = page.css("#off").text.strip
11
- hash[:wait_see] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(2)").text.strip
12
- hash[:wait_push_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(3)").text.strip
13
- hash[:wait_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(4)").text.strip
14
- hash[:wait_cure_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(5)").text.strip
6
+ begin
7
+ html = open(url).read
8
+ html.encode!("big5")
9
+ page = Nokogiri::HTML.parse html
10
+ hash[:hospital] = "ktgh_dajia"
11
+ # hash[:to_119] = page.css("#off").text.strip
12
+ hash[:wait_see] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(2)").text.strip
13
+ hash[:wait_push_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(3)").text.strip
14
+ hash[:wait_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(4)").text.strip
15
+ hash[:wait_cure_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(5)").text.strip
16
+ rescue Exception => e
17
+ p e.message
18
+ return nil
19
+ end
15
20
  return hash
16
21
  end
17
22
  end
@@ -3,15 +3,20 @@ module Ktgh_shalu
3
3
  def Ktgh_shalu.crawl
4
4
  hash = {}
5
5
  url = "http://www.ktgh.com.tw/BednoInfo_Show.asp?CatID=80&ModuleType=Y"
6
- html = open(url).read
7
- html.encode!("big5")
8
- page = Nokogiri::HTML.parse html
9
- hash[:hospital] = "ktgh_shalu"
10
- # hash[:to_119] = page.css("#off").text.strip
11
- hash[:wait_see] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(2)").text.strip
12
- hash[:wait_push_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(3)").text.strip
13
- hash[:wait_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(4)").text.strip
14
- hash[:wait_cure_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(5)").text.strip
6
+ begin
7
+ html = open(url).read
8
+ html.encode!("big5")
9
+ page = Nokogiri::HTML.parse html
10
+ hash[:hospital] = "ktgh_shalu"
11
+ # hash[:to_119] = page.css("#off").text.strip
12
+ hash[:wait_see] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(2)").text.strip
13
+ hash[:wait_push_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(3)").text.strip
14
+ hash[:wait_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(4)").text.strip
15
+ hash[:wait_cure_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(5)").text.strip
16
+ rescue Exception => e
17
+ p e.message
18
+ return nil
19
+ end
15
20
  return hash
16
21
  end
17
22
  end
data/lib/module/mmh.rb CHANGED
@@ -3,13 +3,18 @@ module Mmh
3
3
  def Mmh.crawl
4
4
  hash = {}
5
5
  url = "http://www.pohai.org.tw/pohai/bedqty_er/bedqty_er.php"
6
- page = Nokogiri::HTML(open(url))
7
- hash[:hospital] = "mmh"
8
- hash[:to_119] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(1)").text.strip
9
- hash[:wait_see] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip
10
- hash[:wait_push_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(3)").text.gsub("人", "").strip
11
- hash[:wait_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(4)").text.gsub("人", "").strip
12
- hash[:wait_cure_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(5)").text.gsub("人", "").strip
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
8
+ hash[:hospital] = "mmh"
9
+ hash[:to_119] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(1)").text.strip
10
+ hash[:wait_see] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip
11
+ hash[:wait_push_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(3)").text.gsub("人", "").strip
12
+ hash[:wait_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(4)").text.gsub("人", "").strip
13
+ hash[:wait_cure_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(5)").text.gsub("人", "").strip
14
+ rescue Exception => e
15
+ p e.message
16
+ return nil
17
+ end
13
18
  return hash
14
19
  end
15
20
  end
data/lib/module/ncku.rb CHANGED
@@ -3,15 +3,20 @@ module Ncku
3
3
  def Ncku.crawl
4
4
  hash = {}
5
5
  url = "http://www.hosp.ncku.edu.tw/nckm/ER/default.aspx"
6
- html = open(url).read
7
- html.encode!("big5")
8
- page = Nokogiri::HTML.parse html
9
- hash[:hospital] = "ncku"
10
- hash[:to_119] = page.css("#lbBulletin").text.strip
11
- hash[:wait_see] = page.css("#lbSee").text.strip
12
- hash[:wait_push_bed] = page.css("#lbBed").text.strip
13
- hash[:wait_bed] = page.css("#lbIn").text.strip
14
- hash[:wait_cure_bed] = page.css("#lbICU").text.strip
6
+ begin
7
+ html = open(url).read
8
+ html.encode!("big5")
9
+ page = Nokogiri::HTML.parse html
10
+ hash[:hospital] = "ncku"
11
+ hash[:to_119] = page.css("#lbBulletin").text.strip
12
+ hash[:wait_see] = page.css("#lbSee").text.strip
13
+ hash[:wait_push_bed] = page.css("#lbBed").text.strip
14
+ hash[:wait_bed] = page.css("#lbIn").text.strip
15
+ hash[:wait_cure_bed] = page.css("#lbICU").text.strip
16
+ rescue Exception => e
17
+ p e.message
18
+ return nil
19
+ end
15
20
  return hash
16
21
  end
17
22
  end
@@ -2,15 +2,20 @@ module Ndmctsgh
2
2
  def Ndmctsgh.crawl
3
3
  hash = {}
4
4
  url = "http://www1.ndmctsgh.edu.tw/ErOnlineNews/ErOnLineData.aspx"
5
- html = open(url).read
6
- html.encode!("big5")
7
- page = Nokogiri::HTML.parse html
8
- hash[:hospital] = "ndmctsgh"
9
- hash[:to_119] = page.css("#Label7").text.strip
10
- hash[:wait_see] = page.css("#Label8").text.strip
11
- hash[:wait_push_bed] = page.css("#Label9").text.strip
12
- hash[:wait_bed] = page.css("#Label10").text.strip
13
- hash[:wait_cure_bed] = page.css("#Label11").text.strip
5
+ begin
6
+ html = open(url).read
7
+ html.encode!("big5")
8
+ page = Nokogiri::HTML.parse html
9
+ hash[:hospital] = "ndmctsgh"
10
+ hash[:to_119] = page.css("#Label7").text.strip
11
+ hash[:wait_see] = page.css("#Label8").text.strip
12
+ hash[:wait_push_bed] = page.css("#Label9").text.strip
13
+ hash[:wait_bed] = page.css("#Label10").text.strip
14
+ hash[:wait_cure_bed] = page.css("#Label11").text.strip
15
+ rescue Exception => e
16
+ p e.message
17
+ return nil
18
+ end
14
19
  return hash
15
20
  end
16
21
  end
@@ -3,15 +3,20 @@ module Ntuh_taipei
3
3
  def Ntuh_taipei.crawl
4
4
  hash = {}
5
5
  url = "https://reg.ntuh.gov.tw/EmgInfoBoard/NTUHEmgInfo.aspx"
6
- html = open(url).read
7
- html.encode!("big5")
8
- page = Nokogiri::HTML.parse html
9
- hash[:hospital] = "ntuh_taipei"
10
- hash[:wait_register] = page.css("#form1 table tr:nth-child(1) td:nth-child(2)").text.gsub("人", "").strip
11
- hash[:wait_see] = page.css("#form1 table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip
12
- hash[:wait_bed] = page.css("#form1 table tr:nth-child(3) td:nth-child(2)").text.gsub("人", "").strip
13
- hash[:wait_icu ] = page.css("#form1 table tr:nth-child(4) td:nth-child(2)").text.gsub("人", "").strip
14
- hash[:wait_push_bed] = page.css("#form1 table tr:nth-child(5) td:nth-child(2)").text.gsub("人", "").strip
6
+ begin
7
+ html = open(url).read
8
+ html.encode!("big5")
9
+ page = Nokogiri::HTML.parse html
10
+ hash[:hospital] = "ntuh_taipei"
11
+ hash[:wait_register] = page.css("#form1 table tr:nth-child(1) td:nth-child(2)").text.gsub("人", "").strip
12
+ hash[:wait_see] = page.css("#form1 table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip
13
+ hash[:wait_bed] = page.css("#form1 table tr:nth-child(3) td:nth-child(2)").text.gsub("人", "").strip
14
+ hash[:wait_icu ] = page.css("#form1 table tr:nth-child(4) td:nth-child(2)").text.gsub("人", "").strip
15
+ hash[:wait_push_bed] = page.css("#form1 table tr:nth-child(5) td:nth-child(2)").text.gsub("人", "").strip
16
+ rescue Exception => e
17
+ p e.message
18
+ return nil
19
+ end
15
20
  return hash
16
21
  end
17
22
  end
@@ -2,15 +2,20 @@ module Ntuh_yunlin
2
2
  def Ntuh_yunlin.crawl
3
3
  hash = {}
4
4
  url = "http://reg.ntuh.gov.tw/EmgInfoBoard/Y0NTUHEmgInfo.aspx"
5
- html = open(url).read
6
- html.encode!("big5")
7
- page = Nokogiri::HTML.parse html
8
- hash[:hospital] = "ntuh_yunlin"
9
- hash[:wait_register] = page.css("#form1 table tr:nth-child(1) td:nth-child(2)").text.gsub("人", "").strip
10
- hash[:wait_see] = page.css("#form1 table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip
11
- hash[:wait_bed] = page.css("#form1 table tr:nth-child(3) td:nth-child(2)").text.gsub("人", "").strip
12
- hash[:wait_icu ] = page.css("#form1 table tr:nth-child(4) td:nth-child(2)").text.gsub("人", "").strip
13
- hash[:wait_push_bed] = page.css("#form1 table tr:nth-child(5) td:nth-child(2)").text.gsub("人", "").strip
5
+ begin
6
+ html = open(url).read
7
+ html.encode!("big5")
8
+ page = Nokogiri::HTML.parse html
9
+ hash[:hospital] = "ntuh_yunlin"
10
+ hash[:wait_register] = page.css("#form1 table tr:nth-child(1) td:nth-child(2)").text.gsub("人", "").strip
11
+ hash[:wait_see] = page.css("#form1 table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip
12
+ hash[:wait_bed] = page.css("#form1 table tr:nth-child(3) td:nth-child(2)").text.gsub("人", "").strip
13
+ hash[:wait_icu ] = page.css("#form1 table tr:nth-child(4) td:nth-child(2)").text.gsub("人", "").strip
14
+ hash[:wait_push_bed] = page.css("#form1 table tr:nth-child(5) td:nth-child(2)").text.gsub("人", "").strip
15
+ rescue Exception => e
16
+ p e.message
17
+ return nil
18
+ end
14
19
  return hash
15
20
  end
16
21
  end
data/lib/module/pohai.rb CHANGED
@@ -3,13 +3,18 @@ module Pohai
3
3
  def Pohai.crawl
4
4
  hash = {}
5
5
  url = "http://www.pohai.org.tw/pohai/bedqty_er/bedqty_er.php"
6
- page = Nokogiri::HTML(open(url))
7
- hash[:hospital] = "pohai"
8
- hash[:to_119] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(1)").text.strip
9
- hash[:wait_see] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip
10
- hash[:wait_push_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(3)").text.gsub("人", "").strip
11
- hash[:wait_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(4)").text.gsub("人", "").strip
12
- hash[:wait_cure_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(5)").text.gsub("人", "").strip
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
8
+ hash[:hospital] = "pohai"
9
+ hash[:to_119] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(1)").text.strip
10
+ hash[:wait_see] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip
11
+ hash[:wait_push_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(3)").text.gsub("人", "").strip
12
+ hash[:wait_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(4)").text.gsub("人", "").strip
13
+ hash[:wait_cure_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(5)").text.gsub("人", "").strip
14
+ rescue Exception => e
15
+ p e.message
16
+ return nil
17
+ end
13
18
  return hash
14
19
  end
15
20
  end
data/lib/module/scmh.rb CHANGED
@@ -3,15 +3,20 @@ module Scmh
3
3
  def Scmh.crawl
4
4
  hash = {}
5
5
  url = "http://www.scmh.org.tw/"
6
- html = open(url).read
7
- html.encode!("big5")
8
- page = Nokogiri::HTML.parse html
9
- hash[:hospital] = "scmh"
10
- # hash[:to_119] = page.css("").text.strip
11
- hash[:wait_see] = page.css("#aspnetForm table tr:nth-child(6) td table tr td.map table tr td:nth-child(1) table:nth-child(2) tr td div.TVtext table tr:nth-child(1) td:nth-child(2)").text.strip
12
- hash[:wait_push_bed] = page.css("#ctl00_ContentPlaceHolder1_ERTVView_min_LabelBN").text.strip
13
- hash[:wait_bed] = page.css("#ctl00_ContentPlaceHolder1_ERTVView_min_LabelHN").text.strip
14
- hash[:wait_cure_bed] = page.css("#ctl00_ContentPlaceHolder1_ERTVView_min_LabelICN").text.strip
6
+ begin
7
+ html = open(url).read
8
+ html.encode!("big5")
9
+ page = Nokogiri::HTML.parse html
10
+ hash[:hospital] = "scmh"
11
+ # hash[:to_119] = page.css("").text.strip
12
+ hash[:wait_see] = page.css("#aspnetForm table tr:nth-child(6) td table tr td.map table tr td:nth-child(1) table:nth-child(2) tr td div.TVtext table tr:nth-child(1) td:nth-child(2)").text.strip
13
+ hash[:wait_push_bed] = page.css("#ctl00_ContentPlaceHolder1_ERTVView_min_LabelBN").text.strip
14
+ hash[:wait_bed] = page.css("#ctl00_ContentPlaceHolder1_ERTVView_min_LabelHN").text.strip
15
+ hash[:wait_cure_bed] = page.css("#ctl00_ContentPlaceHolder1_ERTVView_min_LabelICN").text.strip
16
+ rescue Exception => e
17
+ p e.message
18
+ return nil
19
+ end
15
20
  return hash
16
21
  end
17
22
  end
data/lib/module/shh.rb CHANGED
@@ -3,15 +3,20 @@ module Shh
3
3
  def Shh.crawl
4
4
  hash = {}
5
5
  url = "http://eng.shh.org.tw/ER_WEB/ER_WEB/"
6
- html = open(url).read
7
- html.encode!("big5")
8
- page = Nokogiri::HTML.parse html
9
- hash[:hospital] = "shh"
10
- hash[:to_119] = page.css("#off").text.strip
11
- hash[:wait_see] = page.css("#Label1").text.strip
12
- hash[:wait_push_bed] = page.css("#Label2").text.strip
13
- hash[:wait_bed] = page.css("#Label3").text.strip
14
- hash[:wait_cure_bed] = page.css("#Label4").text.strip
6
+ begin
7
+ html = open(url).read
8
+ html.encode!("big5")
9
+ page = Nokogiri::HTML.parse html
10
+ hash[:hospital] = "shh"
11
+ hash[:to_119] = page.css("#off").text.strip
12
+ hash[:wait_see] = page.css("#Label1").text.strip
13
+ hash[:wait_push_bed] = page.css("#Label2").text.strip
14
+ hash[:wait_bed] = page.css("#Label3").text.strip
15
+ hash[:wait_cure_bed] = page.css("#Label4").text.strip
16
+ rescue Exception => e
17
+ p e.message
18
+ return nil
19
+ end
15
20
  return hash
16
21
  end
17
22
  end
data/lib/module/skh.rb CHANGED
@@ -3,14 +3,19 @@ module Skh
3
3
  def Skh.crawl
4
4
  hash = {}
5
5
  url = "https://regis.skh.org.tw/ERONLINE/INDEX.aspx"
6
- page = Nokogiri::HTML(open(url))
7
- hash[:hospital] = "skh"
8
- hash[:wait_internal_medicine] = page.css("#L_TOT2").text.strip
9
- hash[:wait_surgery] = page.css("#L_TOT1").text.strip
10
- hash[:wait_paediatrics] = page.css("#L_TOT3").text.strip
11
- hash[:wait_push_bed] = page.css("#L_TOT7").text.strip
12
- hash[:wait_bed] = page.css("#L_TOT5").text.strip
13
- hash[:wait_icu] = page.css("#L_TOT6").text.strip
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
8
+ hash[:hospital] = "skh"
9
+ hash[:wait_internal_medicine] = page.css("#L_TOT2").text.strip
10
+ hash[:wait_surgery] = page.css("#L_TOT1").text.strip
11
+ hash[:wait_paediatrics] = page.css("#L_TOT3").text.strip
12
+ hash[:wait_push_bed] = page.css("#L_TOT7").text.strip
13
+ hash[:wait_bed] = page.css("#L_TOT5").text.strip
14
+ hash[:wait_icu] = page.css("#L_TOT6").text.strip
15
+ rescue Exception => e
16
+ p e.message
17
+ return nil
18
+ end
14
19
  return hash
15
20
  end
16
21
  end
data/lib/module/sltung.rb CHANGED
@@ -8,14 +8,14 @@ end
8
8
  module Sltung
9
9
  def Sltung.crawl
10
10
  url = "http://www.sltung.com.tw/tw/BED/bed.html"
11
- page = Nokogiri::HTML(open(url))
12
- text = page.css("body div.wrapper div span").text
13
- hash = self.get_situation(text)
14
- # hash[:to_119] = page.css("#GridView1 tr:nth-child(2) td:nth-child(2)").text.strip
15
- # hash[:wait_see] = page.css("#GridView1 tr:nth-child(3) td:nth-child(2)").text.strip
16
- # hash[:wait_push_bed] = page.css("#GridView1 tr:nth-child(4) td:nth-child(2)").text.strip
17
- # hash[:wait_bed] = page.css("#GridView1 tr:nth-child(5) td:nth-child(2)").text.strip
18
- # hash[:wait_cure_bed] = page.css("#GridView1 tr:nth-child(6) td:nth-child(2)").text.strip
11
+ begin
12
+ page = Nokogiri::HTML(open(url))
13
+ text = page.css("body div.wrapper div span").text
14
+ hash = self.get_situation(text)
15
+ rescue Exception => e
16
+ p e.message
17
+ return nil
18
+ end
19
19
  return hash
20
20
  end
21
21
 
data/lib/module/tzuchi.rb CHANGED
@@ -3,13 +3,18 @@ module Tzuchi
3
3
  def Tzuchi.crawl
4
4
  hash = {}
5
5
  url = "http://www.pohai.org.tw/pohai/bedqty_er/bedqty_er.php"
6
- page = Nokogiri::HTML(open(url))
7
- hash[:hospital] = "tzuchi"
8
- hash[:to_119] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(1)").text.strip
9
- hash[:wait_see] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip
10
- hash[:wait_push_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(3)").text.gsub("人", "").strip
11
- hash[:wait_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(4)").text.gsub("人", "").strip
12
- hash[:wait_cure_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(5)").text.gsub("人", "").strip
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
8
+ hash[:hospital] = "tzuchi"
9
+ hash[:to_119] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(1)").text.strip
10
+ hash[:wait_see] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip
11
+ hash[:wait_push_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(3)").text.gsub("人", "").strip
12
+ hash[:wait_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(4)").text.gsub("人", "").strip
13
+ hash[:wait_cure_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(5)").text.gsub("人", "").strip
14
+ rescue Exception => e
15
+ p e.message
16
+ return nil
17
+ end
13
18
  return hash
14
19
  end
15
20
  end
@@ -4,13 +4,18 @@ module Tzuchi_hl
4
4
  def Tzuchi_hl.crawl
5
5
  hash = {}
6
6
  url = "http://hlm.tzuchi.com.tw/html/hlinfos.html"
7
- page = Nokogiri::HTML(open(url))
8
- hash[:hospital] = "tzuchi_hl"
9
- hash[:to_119] = page.css("body > table tr:nth-child(5) td:nth-child(2)").text.strip
10
- hash[:wait_see] = page.css("body > table tr:nth-child(6) td:nth-child(2)").text.strip
11
- hash[:wait_push_bed] = page.css("body > table tr:nth-child(7) td:nth-child(2)").text.strip
12
- hash[:wait_bed] = page.css("body > table tr:nth-child(8) td:nth-child(2)").text.strip
13
- hash[:wait_cure_bed] = page.css("body > table tr:nth-child(9) td:nth-child(2)").text.strip
7
+ begin
8
+ page = Nokogiri::HTML(open(url))
9
+ hash[:hospital] = "tzuchi_hl"
10
+ hash[:to_119] = page.css("body > table tr:nth-child(5) td:nth-child(2)").text.strip
11
+ hash[:wait_see] = page.css("body > table tr:nth-child(6) td:nth-child(2)").text.strip
12
+ hash[:wait_push_bed] = page.css("body > table tr:nth-child(7) td:nth-child(2)").text.strip
13
+ hash[:wait_bed] = page.css("body > table tr:nth-child(8) td:nth-child(2)").text.strip
14
+ hash[:wait_cure_bed] = page.css("body > table tr:nth-child(9) td:nth-child(2)").text.strip
15
+ rescue Exception => e
16
+ p e.message
17
+ return nil
18
+ end
14
19
  return hash
15
20
  end
16
21
  end
data/lib/module/vghtc.rb CHANGED
@@ -3,15 +3,20 @@ module Vghtc
3
3
  def Vghtc.crawl
4
4
  hash = {}
5
5
  url = "http://www.vghtc.gov.tw/GipOpenWeb/wSite/sp?xdUrl=/wSite/query/Doctor/GetEmgBedInform.jsp&ctNode=55658&mp=1&idPath=213_55658"
6
- page = Nokogiri::HTML(open(url))
7
- hash[:hospital] = "vghtc"
8
- hash[:to_119] = page.css("div.cp table tr:nth-child(2) td:nth-child(2) font b").text.strip
9
- hash[:wait_internal_medicine] = page.css("div.cp table tr:nth-child(4) td:nth-child(2) font b").text.gsub("人", "").strip
10
- hash[:wait_surgery] = page.css("div.cp table tr:nth-child(5) td:nth-child(2) font b").text.gsub("人", "").strip
11
- hash[:wait_paediatrics] = page.css("div.cp table tr:nth-child(6) td:nth-child(2) font b").text.gsub("人", "").strip
12
- hash[:wait_push_bed] = page.css("div.cp table tr:nth-child(8) td:nth-child(2) font b").text.gsub("人", "").strip
13
- hash[:wait_bed] = page.css("div.cp table tr:nth-child(10) td:nth-child(2) font b").text.gsub("人", "").strip
14
- hash[:wait_cure_bed] = page.css("div.cp table tr:nth-child(12) td:nth-child(2) font b").text.gsub("人", "").strip
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
8
+ hash[:hospital] = "vghtc"
9
+ hash[:to_119] = page.css("div.cp table tr:nth-child(2) td:nth-child(2) font b").text.strip
10
+ hash[:wait_internal_medicine] = page.css("div.cp table tr:nth-child(4) td:nth-child(2) font b").text.gsub("人", "").strip
11
+ hash[:wait_surgery] = page.css("div.cp table tr:nth-child(5) td:nth-child(2) font b").text.gsub("人", "").strip
12
+ hash[:wait_paediatrics] = page.css("div.cp table tr:nth-child(6) td:nth-child(2) font b").text.gsub("人", "").strip
13
+ hash[:wait_push_bed] = page.css("div.cp table tr:nth-child(8) td:nth-child(2) font b").text.gsub("人", "").strip
14
+ hash[:wait_bed] = page.css("div.cp table tr:nth-child(10) td:nth-child(2) font b").text.gsub("人", "").strip
15
+ hash[:wait_cure_bed] = page.css("div.cp table tr:nth-child(12) td:nth-child(2) font b").text.gsub("人", "").strip
16
+ rescue Exception => e
17
+ p e.message
18
+ return nil
19
+ end
15
20
  return hash
16
21
  end
17
22
  end
data/lib/module/vghtpe.rb CHANGED
@@ -3,13 +3,18 @@ module Vghtpe
3
3
  def Vghtpe.crawl
4
4
  hash = {}
5
5
  url = "https://www6.vghtpe.gov.tw/ERREALIFO/ERREALIFO.jsp"
6
- page = Nokogiri::HTML(open(url))
7
- hash[:hospital] = "vghtpe"
8
- hash[:to_119] = page.css("body table:nth-child(3) tr:nth-child(1) td:nth-child(2) font").text.strip
9
- hash[:wait_see] = page.css("body table:nth-child(3) tr:nth-child(2) td:nth-child(2) font").text.strip
10
- hash[:wait_push_bed] = page.css("body table:nth-child(3) tr:nth-child(3) td:nth-child(2) font").text.strip
11
- hash[:wait_bed] = page.css("body table:nth-child(3) tr:nth-child(4) td:nth-child(2) font").text.strip
12
- hash[:wait_cure_bed] = page.css("body table:nth-child(3) tr:nth-child(5) td:nth-child(2) font").text.strip
6
+ begin
7
+ page = Nokogiri::HTML(open(url))
8
+ hash[:hospital] = "vghtpe"
9
+ hash[:to_119] = page.css("body table:nth-child(3) tr:nth-child(1) td:nth-child(2) font").text.strip
10
+ hash[:wait_see] = page.css("body table:nth-child(3) tr:nth-child(2) td:nth-child(2) font").text.strip
11
+ hash[:wait_push_bed] = page.css("body table:nth-child(3) tr:nth-child(3) td:nth-child(2) font").text.strip
12
+ hash[:wait_bed] = page.css("body table:nth-child(3) tr:nth-child(4) td:nth-child(2) font").text.strip
13
+ hash[:wait_cure_bed] = page.css("body table:nth-child(3) tr:nth-child(5) td:nth-child(2) font").text.strip
14
+ rescue Exception => e
15
+ p e.message
16
+ return nil
17
+ end
13
18
  return hash
14
19
  end
15
20
  end
@@ -2,14 +2,19 @@ module Wanfang
2
2
  def Wanfang.crawl
3
3
  hash = {}
4
4
  url = "http://www.wanfang.gov.tw/W402008web_new/epd_query.asp"
5
- page = Nokogiri::HTML(open(url))
6
- hash[:hospital] = "wanfang"
7
- hash[:to_119] = page.css("body table:nth-child(1) tr:nth-child(9) td:nth-child(1) table tr td ul:nth-child(3) li:nth-child(1)").text.strip
8
- hash[:wait_see] = page.css("body table:nth-child(1) tr:nth-child(9) td:nth-child(1) table tr td ul:nth-child(3) li:nth-child(2)").text.gsub("人", "").strip
9
- hash[:wait_push_bed] = page.css("body table:nth-child(1) tr:nth-child(9) td:nth-child(1) table tr td ul:nth-child(3) li:nth-child(3)").text.gsub("人", "").strip
10
- hash[:wait_bed] = page.css("body table:nth-child(1) tr:nth-child(9) td:nth-child(1) table tr td ul:nth-child(3) li:nth-child(4)").text.gsub("人", "").strip
11
- hash[:wait_cure_bed] = page.css("body table:nth-child(1) tr:nth-child(9) td:nth-child(1) table tr td ul:nth-child(3) li:nth-child(5)").text.gsub("人", "").strip
12
- hash = self.split(hash)
5
+ begin
6
+ page = Nokogiri::HTML(open(url))
7
+ hash[:hospital] = "wanfang"
8
+ hash[:to_119] = page.css("body table:nth-child(1) tr:nth-child(9) td:nth-child(1) table tr td ul:nth-child(3) li:nth-child(1)").text.strip
9
+ hash[:wait_see] = page.css("body table:nth-child(1) tr:nth-child(9) td:nth-child(1) table tr td ul:nth-child(3) li:nth-child(2)").text.gsub("人", "").strip
10
+ hash[:wait_push_bed] = page.css("body table:nth-child(1) tr:nth-child(9) td:nth-child(1) table tr td ul:nth-child(3) li:nth-child(3)").text.gsub("人", "").strip
11
+ hash[:wait_bed] = page.css("body table:nth-child(1) tr:nth-child(9) td:nth-child(1) table tr td ul:nth-child(3) li:nth-child(4)").text.gsub("人", "").strip
12
+ hash[:wait_cure_bed] = page.css("body table:nth-child(1) tr:nth-child(9) td:nth-child(1) table tr td ul:nth-child(3) li:nth-child(5)").text.gsub("人", "").strip
13
+ hash = self.split(hash)
14
+ rescue Exception => e
15
+ p e.message
16
+ return nil
17
+ end
13
18
  return hash
14
19
  end
15
20
 
data/lib/tw_hospital.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "tw_hospital/version"
1
+ # require "tw_hospital/version"
2
2
  require 'nokogiri'
3
3
  require 'open-uri'
4
4
  require 'json'
@@ -35,7 +35,7 @@ require 'module/cgmh_ks'
35
35
  require 'module/tzuchi_hl'
36
36
 
37
37
  module TwHospital
38
- def TwHospital.fetch_all(filename=nil)
38
+ def TwHospital.fetch_all
39
39
  json = []
40
40
  json << Pohai.crawl
41
41
  json << Cgmh_kl.crawl
@@ -1,3 +1,3 @@
1
1
  module TwHospital
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tw_hospital
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - JackHou