8000 修改totalFee获取方式 by lann-zh · Pull Request #110 · iBreaker/bjguahao · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

修改totalFee获取方式 #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions bjguahao.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def __init__(self, config_path="config.yaml"):
self.query_hospital_url = "http://www.114yygh.com/web/queryHospitalById"
self.calendar = "http://www.114yygh.com/web/product/list"
self.order_patient_list = "http://www.114yygh.com/web/patient/orderPatientList"
self.appoint_info_url = "http://www.114yygh.com/web/order/getAppointInfo"

self.config = Config(config_path) # config对象
if self.config.useIMessage == 'true':
Expand Down Expand Up @@ -381,7 +382,35 @@ def print_doctor(self):
print(x.get_string())
pass

def get_it(self, doctor, sms_code):
def get_fee(self,doctor):
"""
获取真实挂号费显示数值
"""
hospital_id = self.config.hospital_id
department_id = self.config.department_id
doctor_id = str(doctor['doctorId'])
duty_source_id = str(doctor['dutySourceId'])

payload = {
'hospitalId': hospital_id,
'departmentId': department_id,
'doctorId': doctor_id,
'dutySourceId': duty_source_id
}
response = self.browser.post(self.appoint_info_url, data=payload)
logging.debug("response data:" + response.text)
try:
datas = json.loads(response.text)
if datas["resCode"] == 0:
data = datas["data"]
total_fee = str(data['totalFee'])
logging.debug("真实挂号费显示值:" + total_fee)
return total_fee
except Exception as e:
logging.error(e)
sys.exit()

def get_it(self, doctor, sms_code, total_fee):
"""
挂号
"""
Expand Down Expand Up @@ -427,7 +456,8 @@ def get_it(self, doctor, sms_code):
"patientId": patient_id,
"dutyDate": doctor['dutyDate'],
"dutyCode": doctor['dutyCode'],
"totalFee":doctor['totalFee'],
"totalFee": total_fee,
"fcode":"",
"period":"",
"mapDepartmentId":"",
"mapDoctorId":"",
Expand All @@ -439,8 +469,7 @@ def get_it(self, doctor, sms_code):
"smsCode": sms_code,
"mobileNo": self.config.mobile_no,
"feeColor":"",
"fcode":"",
"dutyImgType":"",
"dutyImgType":""
}
#save order
response = self.browser.post(self.confirm_url, data=payload)
Expand Down Expand Up @@ -593,11 +622,12 @@ def run(self):
logging.info("好像还没放号?重试中")
time.sleep(1)
else:
total_fee = self.get_fee(doctor) # 获取挂号费,需在获取验证码之前
sms_code = self.get_sms_verify_code('ORDER_CODE') # 获取验证码
print('sms_code:',sms_code)
if sms_code is None:
time.sleep(1)
result = self.get_it(doctor, sms_code) # 4.挂号
result = self.get_it(doctor, sms_code, total_fee) # 4.挂号
if result:
break # 挂号成功

Expand Down
0