tw_hospital 0.0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +90 -0
- data/Rakefile +2 -0
- data/bin/tw_hospital +4 -0
- data/lib/module/cch.rb +15 -0
- data/lib/module/cgh.rb +15 -0
- data/lib/module/cgmh_chayi.rb +15 -0
- data/lib/module/cgmh_kl.rb +16 -0
- data/lib/module/cgmh_ks.rb +15 -0
- data/lib/module/cgmh_lingko.rb +16 -0
- data/lib/module/chimei.rb +21 -0
- data/lib/module/chimei_cl.rb +22 -0
- data/lib/module/chimei_ly.rb +21 -0
- data/lib/module/cmuh.rb +16 -0
- data/lib/module/csh.rb +22 -0
- data/lib/module/edah.rb +21 -0
- data/lib/module/kmuh.rb +15 -0
- data/lib/module/ktgh_dajia.rb +17 -0
- data/lib/module/ktgh_shalu.rb +17 -0
- data/lib/module/mmh.rb +15 -0
- data/lib/module/ncku.rb +17 -0
- data/lib/module/ndmctsgh.rb +16 -0
- data/lib/module/ntuh_taipei.rb +17 -0
- data/lib/module/ntuh_yunlin.rb +16 -0
- data/lib/module/pohai.rb +15 -0
- data/lib/module/scmh.rb +17 -0
- data/lib/module/shh.rb +17 -0
- data/lib/module/skh.rb +16 -0
- data/lib/module/sltung.rb +43 -0
- data/lib/module/tzuchi.rb +15 -0
- data/lib/module/tzuchi_hl.rb +16 -0
- data/lib/module/vghtc.rb +17 -0
- data/lib/module/vghtpe.rb +15 -0
- data/lib/module/wanfang.rb +22 -0
- data/lib/tw_hospital/version.rb +3 -0
- data/lib/tw_hospital.rb +77 -0
- data/tw_hospital.gemspec +26 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8f2eec1f48d064ba5ea1718bd4f799d5df29f3fe
|
4
|
+
data.tar.gz: ebe93466eefd29173338b5f3ad60344654f56767
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c37409c01757c8a7cfeec38b8b13c8bc0c9306c1647081fc750f8ea83a266bb41a76e0eaa45a8e4d76ee6732ea3b77a2c032997ed6294841ddc43593ff297e98
|
7
|
+
data.tar.gz: 7cca3139f6e453d267b2195a798fa0571b8ef964e82f275c39a9003d40e8737119b29fda67b473769951cf5fdb01942160b3241369582e1d3e6d63ba566ca7f9
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 JackHou
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# TwHospital
|
2
|
+
|
3
|
+
這個gem會抓取[全國重度級急救責任醫院急診即時訊息](http://www.mohw.gov.tw/CHT/DOMA/DM1_P.aspx?f_list_no=608&fod_list_no=4680&doc_no=43081)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'tw_hospital'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install tw_hospital
|
20
|
+
|
21
|
+
## Variable
|
22
|
+
|
23
|
+
`to_119`: 是否已向119通報滿床(載)
|
24
|
+
|
25
|
+
`wait_register` : 等待掛號
|
26
|
+
|
27
|
+
`wait_bed`: 等待住院
|
28
|
+
|
29
|
+
`emergency_number`: 急救區人數
|
30
|
+
|
31
|
+
`wait_internal_medicine`: 等待內科
|
32
|
+
|
33
|
+
`wait_surgery`: 等待外科
|
34
|
+
|
35
|
+
`wait_paediatrics`: 等待小兒科
|
36
|
+
|
37
|
+
`wait_gynaecology`: 等待婦科
|
38
|
+
|
39
|
+
`wait_other`: 等待其他科別
|
40
|
+
|
41
|
+
`wait_cure_bed`: 等待加護病床
|
42
|
+
|
43
|
+
|
44
|
+
## Hospital
|
45
|
+
|
46
|
+
| 代號 | 醫院名字 |
|
47
|
+
|-------------|------------------------------------------------------------|
|
48
|
+
| pohai | 財團法人羅許基金會羅東博愛醫院 |
|
49
|
+
| cch | 彰化基督教醫療財團法人彰化基督教醫院 |
|
50
|
+
| cgh | 國泰綜合醫院 |
|
51
|
+
| cgmh_chayi | 長庚醫療財團法人嘉義長庚紀念醫院 |
|
52
|
+
| cgmh_kl | 長庚醫療財團法人基隆長庚紀念醫院 |
|
53
|
+
| cgmh_ks | 長庚醫療財團法人高雄長庚紀念醫院 |
|
54
|
+
| cgmh_lingko | 長庚醫療財團法人林口長庚紀念醫院 |
|
55
|
+
| chimei | 奇美醫院 |
|
56
|
+
| chimei_cl | 佳里奇美醫院 |
|
57
|
+
| chimei_ly | 柳營奇美醫院 |
|
58
|
+
| cmuh | 中國醫藥大學附設醫院 |
|
59
|
+
| csh | 中山醫學大學附設醫院 |
|
60
|
+
| edah | 義大醫療財團法人義大醫院 |
|
61
|
+
| kmuh | 高雄醫學大學附設中和紀念醫院 |
|
62
|
+
| ktgh_dajia | 光田醫療社團法人光田綜合醫院(大甲院區) |
|
63
|
+
| ktgh_shalu | 光田醫療社團法人光田綜合醫院(沙鹿總院) |
|
64
|
+
| mmh | 財團法人臺灣基督長老教會馬偕紀念社會事業基金會馬偕紀念醫院 |
|
65
|
+
| ncku | 國立成功大學醫學院附設醫院 |
|
66
|
+
| ndmctsgh | 三軍總醫院附設民眾診療服務處 |
|
67
|
+
| ntuh_taipei | 國立臺灣大學醫學院附設醫院 |
|
68
|
+
| ntuh_yunlin | 國立臺灣大學醫學院附設醫院雲林分院 |
|
69
|
+
| scmh | 秀傳醫療社團法人秀傳紀念醫院 |
|
70
|
+
| shh | 衛生福利部雙和醫院 |
|
71
|
+
| skh | 新光醫療財團法人新光吳火獅紀念醫院 |
|
72
|
+
| sltung | 童綜合醫療社團法人童綜合醫院 |
|
73
|
+
| tzuchi | 佛教慈濟醫療財團法人台北慈濟醫院 |
|
74
|
+
| tzuchi_hl | 佛教慈濟醫療財團法人花蓮慈濟醫院 |
|
75
|
+
| vghtc | 臺中榮民總醫院 |
|
76
|
+
| vghtpe | 台北榮民總醫院 |
|
77
|
+
| wanfang | 台北市立萬芳醫院 |
|
78
|
+
## Output
|
79
|
+
|
80
|
+
## Issue
|
81
|
+
尚未抓完:
|
82
|
+
* 馬偕醫院Mmh
|
83
|
+
* 財團法人徐元智先生醫藥基金會附設亞東紀念醫院
|
84
|
+
* 佛教慈濟醫療財團法人台北慈濟醫院
|
85
|
+
* 秀傳醫療社團法人秀傳紀念醫院(scmh): 編碼有問
|
86
|
+
* 高雄榮民總醫院: 給的檔案是pdf
|
87
|
+
* 安泰醫療社團法人安泰醫院: 需要驗證馬
|
88
|
+
* 佛教慈濟醫療財團法人花蓮慈濟醫院: 可以抓到 但可能會有問題
|
89
|
+
|
90
|
+
光田醫療社團法人光田綜合醫院: 是否已向119通報滿床這格的表示方式要確認一下
|
data/Rakefile
ADDED
data/bin/tw_hospital
ADDED
data/lib/module/cch.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# 彰化基督教醫療財團法人彰化基督教醫院
|
2
|
+
module Cch
|
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
|
13
|
+
return hash
|
14
|
+
end
|
15
|
+
end
|
data/lib/module/cgh.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# 國泰綜合醫院
|
2
|
+
module Cgh
|
3
|
+
def Cgh.crawl
|
4
|
+
hash = {}
|
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
|
13
|
+
return hash
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# 長庚醫療財團法人嘉義長庚紀念醫院
|
2
|
+
module Cgmh_chayi
|
3
|
+
def Cgmh_chayi.crawl
|
4
|
+
hash = {}
|
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
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# 長庚醫療財團法人基隆長庚紀念醫院
|
2
|
+
module Cgmh_kl
|
3
|
+
def Cgmh_kl.crawl
|
4
|
+
hash = {}
|
5
|
+
url = "https://www.cgmh.org.tw/bed/erd/index.asp?loc=2"
|
6
|
+
page = Nokogiri::HTML(open(url))
|
7
|
+
|
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
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# 長庚醫療財團法人高雄長庚紀念醫院
|
2
|
+
module Cgmh_ks
|
3
|
+
def Cgmh_ks.crawl
|
4
|
+
hash = {}
|
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
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# 長庚醫療財團法人林口長庚紀念醫院
|
2
|
+
module Cgmh_lingko
|
3
|
+
def Cgmh_lingko.crawl
|
4
|
+
hash = {}
|
5
|
+
url = "https://www.cgmh.org.tw/bed/erd/index.asp?loc=3"
|
6
|
+
page = Nokogiri::HTML(open(url))
|
7
|
+
|
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
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# 奇美醫院
|
2
|
+
module Chimei
|
3
|
+
def Chimei.crawl
|
4
|
+
hash = {}
|
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
|
17
|
+
return hash
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# 佳里奇美醫院
|
2
|
+
module Chimei_cl
|
3
|
+
def Chimei_cl.crawl
|
4
|
+
hash = {}
|
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
|
17
|
+
return hash
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
#form1 > div:nth-child(2) > table > tbody > tr:nth-child(4) > td > div:nth-child(13)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# 柳營奇美醫院
|
2
|
+
module Chimei_ly
|
3
|
+
def Chimei_ly.crawl
|
4
|
+
hash = {}
|
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
|
17
|
+
return hash
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
data/lib/module/cmuh.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# 中國醫藥大學附設醫院
|
2
|
+
|
3
|
+
module Cmuh
|
4
|
+
def Cmuh.crawl
|
5
|
+
hash = {}
|
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
|
14
|
+
return hash
|
15
|
+
end
|
16
|
+
end
|
data/lib/module/csh.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# 中山醫學大學附設醫院
|
2
|
+
module Csh
|
3
|
+
def Csh.crawl
|
4
|
+
hash = {}
|
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
|
20
|
+
return hash
|
21
|
+
end
|
22
|
+
end
|
data/lib/module/edah.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# 義大醫療財團法人義大醫院
|
2
|
+
module Edah
|
3
|
+
def Edah.crawl
|
4
|
+
hash = {}
|
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)
|
15
|
+
return hash
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.split(text)
|
19
|
+
return text.split(":")[1]
|
20
|
+
end
|
21
|
+
end
|
data/lib/module/kmuh.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# 高雄醫學大學附設中和紀念醫院
|
2
|
+
module Kmuh
|
3
|
+
def Kmuh.crawl
|
4
|
+
hash = {}
|
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
|
13
|
+
return hash
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# 光田醫療社團法人光田綜合醫院(大甲院區)
|
2
|
+
module Ktgh_dajia
|
3
|
+
def Ktgh_dajia.crawl
|
4
|
+
hash = {}
|
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
|
15
|
+
return hash
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# 光田醫療社團法人光田綜合醫院(沙鹿總院)
|
2
|
+
module Ktgh_shalu
|
3
|
+
def Ktgh_shalu.crawl
|
4
|
+
hash = {}
|
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
|
15
|
+
return hash
|
16
|
+
end
|
17
|
+
end
|
data/lib/module/mmh.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# 財團法人臺灣基督長老教會馬偕紀念社會事業基金會馬偕紀念醫院
|
2
|
+
module Mmh
|
3
|
+
def Mmh.crawl
|
4
|
+
hash = {}
|
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
|
13
|
+
return hash
|
14
|
+
end
|
15
|
+
end
|
data/lib/module/ncku.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# 成大醫院
|
2
|
+
module Ncku
|
3
|
+
def Ncku.crawl
|
4
|
+
hash = {}
|
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
|
15
|
+
return hash
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Ndmctsgh
|
2
|
+
def Ndmctsgh.crawl
|
3
|
+
hash = {}
|
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
|
14
|
+
return hash
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# 國立臺灣大學醫學院附設醫院
|
2
|
+
module Ntuh_taipei
|
3
|
+
def Ntuh_taipei.crawl
|
4
|
+
hash = {}
|
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
|
15
|
+
return hash
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Ntuh_yunlin
|
2
|
+
def Ntuh_yunlin.crawl
|
3
|
+
hash = {}
|
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
|
14
|
+
return hash
|
15
|
+
end
|
16
|
+
end
|
data/lib/module/pohai.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# 財團法人羅許基金會羅東博愛醫院
|
2
|
+
module Pohai
|
3
|
+
def Pohai.crawl
|
4
|
+
hash = {}
|
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
|
13
|
+
return hash
|
14
|
+
end
|
15
|
+
end
|
data/lib/module/scmh.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# 秀傳醫療社團法人秀傳紀念醫院
|
2
|
+
module Scmh
|
3
|
+
def Scmh.crawl
|
4
|
+
hash = {}
|
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
|
15
|
+
return hash
|
16
|
+
end
|
17
|
+
end
|
data/lib/module/shh.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# 衛生福利部雙和醫院
|
2
|
+
module Shh
|
3
|
+
def Shh.crawl
|
4
|
+
hash = {}
|
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] = "ssh"
|
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
|
15
|
+
return hash
|
16
|
+
end
|
17
|
+
end
|
data/lib/module/skh.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# 新光醫療財團法人新光吳火獅紀念醫院
|
2
|
+
module Skh
|
3
|
+
def Skh.crawl
|
4
|
+
hash = {}
|
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
|
14
|
+
return hash
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# 童綜合醫療社團法人童綜合醫院
|
2
|
+
class String
|
3
|
+
def initial
|
4
|
+
self[0,1]
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
module Sltung
|
9
|
+
def Sltung.crawl
|
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[:hospital] = "sltung"
|
15
|
+
# hash[:to_119] = page.css("#GridView1 tr:nth-child(2) td:nth-child(2)").text.strip
|
16
|
+
# hash[:wait_see] = page.css("#GridView1 tr:nth-child(3) td:nth-child(2)").text.strip
|
17
|
+
# hash[:wait_push_bed] = page.css("#GridView1 tr:nth-child(4) td:nth-child(2)").text.strip
|
18
|
+
# hash[:wait_bed] = page.css("#GridView1 tr:nth-child(5) td:nth-child(2)").text.strip
|
19
|
+
# hash[:wait_cure_bed] = page.css("#GridView1 tr:nth-child(6) td:nth-child(2)").text.strip
|
20
|
+
return hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.get_situation(text)
|
24
|
+
hash = {}
|
25
|
+
text.split(":").each_with_index do |each_text, index|
|
26
|
+
next if index == 0
|
27
|
+
if index == 1
|
28
|
+
hash[:to_119] = each_text.initial
|
29
|
+
elsif index == 2
|
30
|
+
hash[:wait_see] = each_text.initial
|
31
|
+
elsif index == 3
|
32
|
+
hash[:wait_push_bed] = each_text.initial
|
33
|
+
elsif index == 4
|
34
|
+
hash[:wait_bed] = each_text.initial
|
35
|
+
elsif index == 5
|
36
|
+
hash[:wait_cure_bed] = each_text.initial
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
return hash
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# 佛教慈濟醫療財團法人台北慈濟醫院
|
2
|
+
module Tzuchi
|
3
|
+
def Tzuchi.crawl
|
4
|
+
hash = {}
|
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
|
13
|
+
return hash
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# 佛教慈濟醫療財團法人花蓮慈濟醫院
|
2
|
+
|
3
|
+
module Tzuchi_hl
|
4
|
+
def Tzuchi_hl.crawl
|
5
|
+
hash = {}
|
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
|
14
|
+
return hash
|
15
|
+
end
|
16
|
+
end
|
data/lib/module/vghtc.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# 臺中榮民總醫院
|
2
|
+
module Vghtc
|
3
|
+
def Vghtc.crawl
|
4
|
+
hash = {}
|
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
|
15
|
+
return hash
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# 台北榮民總醫院
|
2
|
+
module Vghtpe
|
3
|
+
def Vghtpe.crawl
|
4
|
+
hash = {}
|
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
|
13
|
+
return hash
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Wanfang
|
2
|
+
def Wanfang.crawl
|
3
|
+
hash = {}
|
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)
|
13
|
+
return hash
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.split(hash)
|
17
|
+
hash.each do |k, v|
|
18
|
+
hash[k] = v.split(":")[1]
|
19
|
+
end
|
20
|
+
hash
|
21
|
+
end
|
22
|
+
end
|
data/lib/tw_hospital.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require "tw_hospital/version"
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'json'
|
5
|
+
require 'time'
|
6
|
+
require 'module/pohai'
|
7
|
+
require 'module/cgmh_kl'
|
8
|
+
require 'module/cgh'
|
9
|
+
require 'module/mmh'
|
10
|
+
require 'module/wanfang'
|
11
|
+
require 'module/ndmctsgh'
|
12
|
+
require 'module/vghtpe'
|
13
|
+
require 'module/ntuh_taipei'
|
14
|
+
require 'module/skh'
|
15
|
+
require 'module/shh'
|
16
|
+
require 'module/tzuchi'
|
17
|
+
require 'module/cgmh_lingko'
|
18
|
+
require 'module/csh'
|
19
|
+
require 'module/vghtc'
|
20
|
+
require 'module/cmuh'
|
21
|
+
require 'module/sltung'
|
22
|
+
require 'module/ktgh_shalu'
|
23
|
+
require 'module/ktgh_dajia'
|
24
|
+
require 'module/cch'
|
25
|
+
require 'module/scmh'
|
26
|
+
require 'module/cgmh_chayi'
|
27
|
+
require 'module/ntuh_yunlin'
|
28
|
+
require 'module/chimei'
|
29
|
+
require 'module/chimei_cl'
|
30
|
+
require 'module/chimei_ly'
|
31
|
+
require 'module/ncku'
|
32
|
+
require 'module/kmuh'
|
33
|
+
require 'module/edah'
|
34
|
+
require 'module/cgmh_ks'
|
35
|
+
require 'module/tzuchi_hl'
|
36
|
+
|
37
|
+
module TwHospital
|
38
|
+
def TwHospital.fetch_all
|
39
|
+
json = []
|
40
|
+
json << Pohai.crawl
|
41
|
+
json << Cgmh_kl.crawl
|
42
|
+
json << Cgh.crawl
|
43
|
+
json << Wanfang.crawl
|
44
|
+
json << Ndmctsgh.crawl
|
45
|
+
json << Vghtpe.crawl
|
46
|
+
json << Ntuh_taipei.crawl
|
47
|
+
json << Skh.crawl
|
48
|
+
json << Shh.crawl
|
49
|
+
json << Tzuchi.crawl
|
50
|
+
json << Cgmh_lingko.crawl
|
51
|
+
json << Csh.crawl
|
52
|
+
json << Vghtc.crawl
|
53
|
+
json << Cmuh.crawl
|
54
|
+
json << Sltung.crawl
|
55
|
+
json << Ktgh_shalu.crawl
|
56
|
+
json << Ktgh_dajia.crawl
|
57
|
+
json << Cch.crawl
|
58
|
+
json << Cgmh_chayi.crawl
|
59
|
+
json << Ntuh_yunlin.crawl
|
60
|
+
json << Chimei.crawl
|
61
|
+
json << Chimei_cl.crawl
|
62
|
+
json << Chimei_ly.crawl
|
63
|
+
json << Ncku.crawl
|
64
|
+
json << Kmuh.crawl
|
65
|
+
json << Edah.crawl
|
66
|
+
json << Cgmh_ks.crawl
|
67
|
+
json << Tzuchi_hl.crawl
|
68
|
+
time = Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
69
|
+
File.open("#{time}.json", "w") do |f|
|
70
|
+
f.write(JSON.pretty_generate(json))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def TwHospital.schedule_fetch_all
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
data/tw_hospital.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tw_hospital/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "tw_hospital"
|
8
|
+
spec.version = TwHospital::VERSION
|
9
|
+
spec.authors = ["JackHou"]
|
10
|
+
spec.email = ["vjack070707@gmail.com"]
|
11
|
+
spec.summary = %q{This gem would fetch all tw hospital emergency data. }
|
12
|
+
spec.description = %q{This gem would fetch all tw hospital emergency data.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
spec.executables = ["tw_hospital"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_dependency 'nokogiri'
|
25
|
+
spec.add_dependency 'thor', '~> 0.18'
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tw_hospital
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.8
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- JackHou
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: thor
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.18'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.18'
|
69
|
+
description: This gem would fetch all tw hospital emergency data.
|
70
|
+
email:
|
71
|
+
- vjack070707@gmail.com
|
72
|
+
executables:
|
73
|
+
- tw_hospital
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/tw_hospital
|
83
|
+
- lib/module/cch.rb
|
84
|
+
- lib/module/cgh.rb
|
85
|
+
- lib/module/cgmh_chayi.rb
|
86
|
+
- lib/module/cgmh_kl.rb
|
87
|
+
- lib/module/cgmh_ks.rb
|
88
|
+
- lib/module/cgmh_lingko.rb
|
89
|
+
- lib/module/chimei.rb
|
90
|
+
- lib/module/chimei_cl.rb
|
91
|
+
- lib/module/chimei_ly.rb
|
92
|
+
- lib/module/cmuh.rb
|
93
|
+
- lib/module/csh.rb
|
94
|
+
- lib/module/edah.rb
|
95
|
+
- lib/module/kmuh.rb
|
96
|
+
- lib/module/ktgh_dajia.rb
|
97
|
+
- lib/module/ktgh_shalu.rb
|
98
|
+
- lib/module/mmh.rb
|
99
|
+
- lib/module/ncku.rb
|
100
|
+
- lib/module/ndmctsgh.rb
|
101
|
+
- lib/module/ntuh_taipei.rb
|
102
|
+
- lib/module/ntuh_yunlin.rb
|
103
|
+
- lib/module/pohai.rb
|
104
|
+
- lib/module/scmh.rb
|
105
|
+
- lib/module/shh.rb
|
106
|
+
- lib/module/skh.rb
|
107
|
+
- lib/module/sltung.rb
|
108
|
+
- lib/module/tzuchi.rb
|
109
|
+
- lib/module/tzuchi_hl.rb
|
110
|
+
- lib/module/vghtc.rb
|
111
|
+
- lib/module/vghtpe.rb
|
112
|
+
- lib/module/wanfang.rb
|
113
|
+
- lib/tw_hospital.rb
|
114
|
+
- lib/tw_hospital/version.rb
|
115
|
+
- tw_hospital.gemspec
|
116
|
+
homepage: ''
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
metadata: {}
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.4.3
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: This gem would fetch all tw hospital emergency data.
|
140
|
+
test_files: []
|