Добавлен эндпоинт getHospRoutes

This commit is contained in:
2025-09-30 11:10:59 +03:00
parent 5d84ea567d
commit 355ea5c921
3 changed files with 36 additions and 5 deletions

View File

@ -134,6 +134,16 @@ async def get_hosp_recommendations():
)
@router.get('/getHospRoutes')
async def get_hosp_routes():
"""
Get list of recommended hospitals.
"""
return await c.vitacore_api.getHospRoutes(
'3092e1c5-e08b-4654-a027-82be90fe8a49'
)
@router.post('/measurement', status_code=status.HTTP_202_ACCEPTED)
async def measurement(
user: Annotated[str, Depends(login)],
@ -211,8 +221,3 @@ async def get_diagnostic_results(user: Annotated[str, Depends(login)]):
@router.get('/getPatFLG')
async def get_pat_flg(user: Annotated[str, Depends(login)]):
return mock.patFLG[0]
@router.get('/getHospRoutes')
async def get_hosp_routes(user: Annotated[str, Depends(login)]):
return mock.hospRoutes

View File

@ -145,3 +145,13 @@ class VITACORE_API(AsyncClient):
case _:
self.logger.error(req.json())
raise e.UnknownException
async def getHospRoutes(self, patId: str):
req = await self.get('/getHospRoutes', params={'patId': patId})
match req.status_code:
case st.HTTP_200_OK:
return s.HospRoutesModel.model_validate(req.json())
case _:
self.logger.error(req.json())
raise e.UnknownException

View File

@ -500,3 +500,19 @@ class HospRecommendationsModel(BaseModel):
Recommendations: list[RecommendationModel] = Field(
title='Список рекомендаций'
)
class HospRoutesModel(BaseModel):
EventID: str = Field(
title='Идентификатор случая госпитализации',
examples=['b8227793-0f40-40f0-b8aa-9fc00cc13b96'],
)
EventDate: datetime = Field(
title='Дата обращения', examples=['2025-07-21']
)
RoutesToDoctor: list[RouteToDoctorModel] = Field(
title='Направления ко врачу'
)
RoutesToDiagnostic: list[RouteToDiagnosticModel] = Field(
title='Направления на услугу'
)