Патч
All checks were successful
Build And Push / publish (push) Successful in 5m5s

This commit is contained in:
2025-11-11 12:58:58 +03:00
parent b602b75234
commit cf1324633d
9 changed files with 82 additions and 45 deletions

View File

@ -3,6 +3,7 @@ from json import dumps
from logging import getLogger
from urllib.parse import quote, urlencode
from fastapi import UploadFile
from fastapi import status as st
from httpx import AsyncClient
@ -130,11 +131,11 @@ class TDN_API(AsyncClient):
seriesUid: str,
obsrvMtMetricUid: str,
*,
nvalue: str | None = None,
fvalue: str | None = None,
nvalue: int | None = None,
fvalue: float | None = None,
svalue: str | None = None,
):
data = {
data: dict[str, str | int | float] = {
'seriesUid': seriesUid,
'obsrvMtMetricUid': obsrvMtMetricUid,
}
@ -160,3 +161,27 @@ class TDN_API(AsyncClient):
case _:
self.logger.error(res.json())
raise e.UnknownException
async def ekg(
self,
access_token: str,
patientUid: str,
serial_number: str,
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={
'patientUid': patientUid,
'serialNumber': serial_number,
},
)
match req.status_code:
case st.HTTP_200_OK:
return s.EkgModel.model_validate(req.json())
case _:
self.logger.error(req.json())
raise e.UnknownException

View File

@ -108,3 +108,8 @@ class SeriesValueModel(BaseModel):
filepath: str | None
mobileId: str | None
tisId: str | None
class EkgModel(BaseModel):
success: bool
# result: ...

View File

@ -199,7 +199,7 @@ class VITACORE_API(AsyncClient):
self.logger.error(req.json())
raise e.UnknownException
async def getHospExaminations(self, patId: str, examId: str):
async def getHospExaminations(self, patId: str, examId: str | None = None):
patId = 'b66a85f1-4aaa-4db8-942a-2de44341824e'
token = await self.get_token()
req = await self.get(