Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commit

Permalink
支持儿研所挂号,其他儿童号自测
Browse files Browse the repository at this point in the history
更新域名为114yygh.com
配置文件增加相关儿童挂号参数
  • Loading branch information
苑鑫磊 committed Apr 1, 2019
1 parent 313056d commit 36ab01d
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 24 deletions.
12 changes: 12 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## bjguahao 1.0.4
* realse date: 2019-04-01
* 支持儿研所挂号,其他儿童号自测
* 更新域名为114yygh.com
* 配置文件增加相关儿童挂号参数


## bjguahao 1.0.3
* realse date: 2018-11-05
* issue64修复


## bjguahao 1.0.2
* realse date: 2018-10-18
* 优化挂号逻辑
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,30 @@ patientName: "曹操"
# 填写后若这个医生没有号,会自动选其余号中最好的医生
doctorName: "华佗"

#挂号类型是否为儿童号
children: "false"

#患儿名字 如果儿童挂号必须填写
childrenName: ""

#患儿证件号 如果儿童挂号必须填写
childrenIdNo: ""

#患儿证件
#1:身份证
#2:其他
cidType: "1"

#如果证件选择其他以下为必填否则不填
#患儿性别
#1:男
#2:女
childrenGender: ""

#患儿生日
#例:2018-01-01
childrenBirthday: ""

# DebugLevel: 调试等级
# 支持的调试等级有 debug/info/warning/error/critical
DebugLevel: "info"
Expand Down
102 changes: 82 additions & 20 deletions bjguahao.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ def __init__(self, config_path):
self.medicare_card_id = data["medicareCardId"]
self.reimbursement_type = data["reimbursementType"]
self.doctorName = data["doctorName"]
self.children_name = data["childrenName"]
self.children_idno = data["childrenIdNo"]
self.cid_type = data["cidType"]
self.children_gender = data["childrenGender"]
self.children_birthday = data["childrenBirthday"]
self.children = data["children"]
self.patient_id = int()
try:
self.useIMessage = data["useIMessage"]
Expand All @@ -75,6 +81,10 @@ def __init__(self, config_path):
self.useQPython3 = data["useQPython3"]
except KeyError:
self.useQPython3 = "false"
try:
self.children = data["children"]
except KeyError:
self.children = "false"
#
logging.info("配置加载完成")
logging.debug("手机号:" + str(self.mobile_no))
Expand All @@ -84,6 +94,12 @@ def __init__(self, config_path):
logging.debug("上午/下午:" + str(self.duty_code))
logging.debug("就诊人姓名:" + str(self.patient_name))
logging.debug("所选医生:" + str(self.doctorName))
logging.debug("是否挂儿童号:" + str(self.children))
logging.debug("患儿姓名:" + str(self.children_name))
logging.debug("患儿证件号" + str(self.children_idno))
logging.debug("患儿证件类型:" + str(self.cid_type))
logging.debug("患儿性别:" + str(self.children_gender))
logging.debug("患儿生日:" + str(self.children_birthday))
logging.debug("使用mac电脑接收验证码:" + str(self.useIMessage))
logging.debug("是否使用 QPython3 运行本脚本:" + str(self.useQPython3))

Expand All @@ -106,12 +122,12 @@ def __init__(self, config_path="config.yaml"):
self.dutys = ""
self.refresh_time = ''

self.login_url = "http://www.bjguahao.gov.cn/quicklogin.htm"
self.send_code_url = "http://www.bjguahao.gov.cn/v/sendorder.htm"
self.get_doctor_url = "http://www.bjguahao.gov.cn/dpt/partduty.htm"
self.confirm_url = "http://www.bjguahao.gov.cn/order/confirmV1.htm"
self.patient_id_url = "http://www.bjguahao.gov.cn/order/confirm/"
self.department_url = "http://www.bjguahao.gov.cn/dpt/appoint/"
self.login_url = "http://www.114yygh.com/quicklogin.htm"
self.send_code_url = "http://www.114yygh.com/v/sendorder.htm"
self.get_doctor_url = "http://www.114yygh.com/dpt/partduty.htm"
self.confirm_url = "http://www.114yygh.com/order/confirmV1.htm"
self.patient_id_url = "http://www.114yygh.com/order/confirm/"
self.department_url = "http://www.114yygh.com/dpt/appoint/"

self.config = Config(config_path) # config对象
if self.config.useIMessage == 'true':
Expand Down Expand Up @@ -271,21 +287,67 @@ def get_it(self, doctor, sms_code):
medicare_card_id = self.config.medicare_card_id
reimbursement_type = self.config.reimbursement_type
doctor_id = str(doctor['doctorId'])

payload = {
'dutySourceId': duty_source_id,
'hospitalId': hospital_id,
'departmentId': department_id,
'doctorId': doctor_id,
'patientId': patient_id,
'hospitalCardId': hospital_card_id,
'medicareCardId': medicare_card_id,
"reimbursementType": reimbursement_type, # 报销类型
'smsVerifyCode': sms_code, # TODO 获取验证码
'childrenBirthday': "",
'isAjax': True
}
if self.config.children == 'true' and self.config.cid_type == "1":
cid_type = self.config.cid_type
children_name = self.config.children_name
children_idno = self.config.children_idno

payload = {
'dutySourceId': duty_source_id,
'hospitalId': hospital_id,
'departmentId': department_id,
'doctorId': doctor_id,
'patientId': patient_id,
'hospitalCardId': hospital_card_id,
'medicareCardId': medicare_card_id,
"reimbursementType": reimbursement_type, # 报销类型
'smsVerifyCode': sms_code, # TODO 获取验证码
'childrenName': children_name,
'childrenIdNo': children_idno,
'cidType': cid_type,
# 'childrenBirthday': "",
'isAjax': True
}
elif self.config.children == 'true' and self.config.cid_type == "2":
cid_type = self.config.cid_type
children_name = self.config.children_name
children_idno = self.config.children_idno
children_gender = self.config.children_gender
children_birthday = self.config.children_birthday

payload = {
'dutySourceId': duty_source_id,
'hospitalId': hospital_id,
'departmentId': department_id,
'doctorId': doctor_id,
'patientId': patient_id,
'hospitalCardId': hospital_card_id,
'medicareCardId': medicare_card_id,
"reimbursementType": reimbursement_type, # 报销类型
'smsVerifyCode': sms_code, # TODO 获取验证码
'childrenName': children_name,
'childrenIdNo': children_idno,
'cidType': cid_type,
'childrenGender': children_gender,
'childrenBirthday': children_birthday,
'isAjax': True
}
else:
payload = {
'dutySourceId': duty_source_id,
'hospitalId': hospital_id,
'departmentId': department_id,
'doctorId': doctor_id,
'patientId': patient_id,
'hospitalCardId': hospital_card_id,
'medicareCardId': medicare_card_id,
"reimbursementType": reimbursement_type, # 报销类型
'smsVerifyCode': sms_code, # TODO 获取验证码
'childrenBirthday': "",
'isAjax': True
}
response = self.browser.post(self.confirm_url, data=payload)
logging.debug("payload:" + json.dumps(payload))
logging.debug("response data:" + response.text)

try:
Expand Down
32 changes: 28 additions & 4 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ username: "13888888888"
# password: 密码
password: "*****"

# date: 挂号日期
# date: 挂号日期,如填写latest自动挂最新一天
date: "2018-01-01"


Expand All @@ -17,7 +17,7 @@ departmentId: "200002248"

# 关于如何获取 hospitalId 和 departmentId
# 1. 打开挂号页面
# 2. 假设地址栏中地址是 http://www.bjguahao.gov.cn/dpt/appoint/162-200002248.htm
# 2. 假设地址栏中地址是 http://www.114yygh.com/dpt/appoint/162-200002248.htm
# 3. 其中 162 是 hospitalId
# 4. 其中 200002248 是 departmentId

Expand All @@ -27,7 +27,7 @@ dutyCode: "1"

# patientName: 患者姓名
# 若是自己挂号可为空
patientName: "曹操"
patientName: ""

# 就诊卡号
hospitalCardId: ""
Expand All @@ -38,13 +38,37 @@ medicareCardId: ""
# 保险类型
# 1:医保
# 10:自费
reimbursementType: "10"
reimbursementType: "1"

# doctorName: 医生姓名
# 不填写的话默认选最好的医生
# 填写后若这个医生没有号,会自动选其余号中最好的医生
doctorName: "扁鹊"

#挂号类型是否为儿童号
children: "false"

#患儿名字 如果儿童挂号必须填写
childrenName: ""

#患儿证件号 如果儿童挂号必须填写
childrenIdNo: ""

#患儿证件
#1:身份证
#2:其他
cidType: "1"

#如果证件选择其他以下为必填否则不填
#患儿性别
#1:男
#2:女
childrenGender: ""

#患儿生日
#例:2018-01-01
childrenBirthday: ""

# DebugLevel: 调试等级
# 支持的调试等级有 debug/info/warning/error/critical
DebugLevel: "info"
Expand Down

0 comments on commit 36ab01d

Please sign in to comment.