This commit is contained in:
@ -40,20 +40,28 @@ class TDN_API(AsyncClient):
|
||||
raise e.UnknownException
|
||||
|
||||
async def patient_search(self, access_token: str, vitaId: str):
|
||||
data = quote(dumps({'vitaId': vitaId}))
|
||||
query = (
|
||||
quote(dumps({'where': {'vitaId': vitaId}}))
|
||||
.replace('%7B', '{')
|
||||
.replace('%7D', '}')
|
||||
)
|
||||
|
||||
_ = await self.get(
|
||||
'/ddn/patient/search',
|
||||
params={'query': data},
|
||||
req = await self.get(
|
||||
f'/ddn/patients/search?query={query}',
|
||||
headers={'Authorization': f'Bearer {access_token}'},
|
||||
)
|
||||
|
||||
return req.json()
|
||||
|
||||
async def observations_search(self, access_token: str, patientUid: str):
|
||||
data = quote(dumps({'where': {'patientUid': patientUid}}))
|
||||
query = (
|
||||
quote(dumps({'where': {'patientUid': patientUid}}))
|
||||
.replace('%7B', '{')
|
||||
.replace('%7D', '}')
|
||||
)
|
||||
|
||||
res = await self.get(
|
||||
'/ddn/observations/search',
|
||||
params={'query': data},
|
||||
f'/ddn/observations/search?query={query}',
|
||||
headers={'Authorization': f'Bearer {access_token}'},
|
||||
)
|
||||
|
||||
@ -167,16 +175,25 @@ class TDN_API(AsyncClient):
|
||||
access_token: str,
|
||||
patientUid: str,
|
||||
serial_number: str,
|
||||
file: UploadFile,
|
||||
ecg_file: UploadFile,
|
||||
):
|
||||
req = await self.post(
|
||||
'/ddn/observation/series-values/ecg/krb02',
|
||||
headers={'Authorization': f'Bearer {access_token}'},
|
||||
files={'ekg': (file.filename, file.file, file.content_type)},
|
||||
json={
|
||||
headers={
|
||||
'Authorization': f'Bearer {access_token}',
|
||||
'Content-Type': 'multipart/form-data; boundary=+++',
|
||||
},
|
||||
data={
|
||||
'patientUid': patientUid,
|
||||
'serialNumber': serial_number,
|
||||
},
|
||||
files={
|
||||
'ecg': (
|
||||
ecg_file.filename,
|
||||
ecg_file.file,
|
||||
ecg_file.content_type or 'application/octet-stream',
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
match req.status_code:
|
||||
|
||||
Reference in New Issue
Block a user