feat: implement doctor schedule module, add detail fields to doctor profile, and integrate new appointment API client
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
import json
|
||||
import ssl
|
||||
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
|
||||
# 1. Get token
|
||||
token_url = "https://dhs.sisvietnam.vn/connect/token"
|
||||
data = urllib.parse.urlencode({
|
||||
"grant_type": "client_credentials",
|
||||
"client_id": "DigitalHealthSolutions_LabConn",
|
||||
"client_secret": "AcEnBCaphERGOGYMaStATITEnaPETYpR",
|
||||
"scope": "LabConn"
|
||||
}).encode('utf-8')
|
||||
|
||||
req = urllib.request.Request(token_url, data=data)
|
||||
req.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||
req.add_header('Cookie', '.AspNetCore.Culture=c%3Den%7Cuic%3Den; __tenant=3a0f747c-57b6-753b-ba21-3987e8e93b9a')
|
||||
|
||||
with urllib.request.urlopen(req, context=ctx) as response:
|
||||
token_resp = json.loads(response.read().decode('utf-8'))
|
||||
access_token = token_resp['access_token']
|
||||
|
||||
# 2. Get 01509 schedule
|
||||
schedule_url = "https://dhs.sisvietnam.vn/api/app/his/doctors/01509/work-schedules"
|
||||
req2 = urllib.request.Request(schedule_url)
|
||||
req2.add_header('Authorization', 'Bearer ' + access_token)
|
||||
req2.add_header('__tenant', '3a0f747c-57b6-753b-ba21-3987e8e93b9a')
|
||||
|
||||
with urllib.request.urlopen(req2, context=ctx) as response:
|
||||
schedule_resp = json.loads(response.read().decode('utf-8'))
|
||||
print(json.dumps(schedule_resp, indent=2))
|
||||
Reference in New Issue
Block a user