Last active
March 1, 2016 03:35
-
-
Save t0mst0ne/34f78aab87ad2d07e271 to your computer and use it in GitHub Desktop.
大林慈濟 ER
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ptyhon | |
#coding:UTF-8 | |
import requests, json, os, re | |
from datetime import datetime | |
os.environ['TZ'] = 'ROC' | |
html = requests.get('http://app.tzuchi.com.tw/tchw/ERInfo_DL/ERInformation.aspx') | |
query = re.findall('<td>(.+?)</td>',html.text) | |
er = re.findall('>(.+?119.+?)</', html.text)[0] | |
full_reported = False if u'未' in er else True | |
query_time = query[4].split(' ') | |
if query_time[1] in u'\u4e0a\u5348': | |
P = "AM" | |
else: | |
P = "PM" | |
report ={} | |
report['full_reported'] = full_reported | |
report['pending_doctor'] = int(query[0]) | |
report['pending_bed'] = int( query[1] ) | |
report['pending_ward'] = int( query[2] ) | |
report['pending_icu'] = int( query[3] ) | |
report['update_time'] = datetime.strptime(str(query_time[0] +P+query_time[2]),'%Y/%m/%d%p%I:%M:%S').strftime('%s') | |
report['Hosptial_sn'] = '1240030514' | |
print ( json.dumps(report, ensure_ascii=False) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment