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

This commit is contained in:
2025-09-30 11:07:48 +03:00
parent 4be216375c
commit 5d84ea567d
3 changed files with 46 additions and 6 deletions

View File

@ -124,6 +124,16 @@ async def get_hosps():
)
@router.get('/getHospRecommendations')
async def get_hosp_recommendations():
"""
Get list of recommended hospitals.
"""
return await c.vitacore_api.getHospRecommendations(
'b708e782-4f83-4f3b-8639-512c0c9637bf'
)
@router.post('/measurement', status_code=status.HTTP_202_ACCEPTED)
async def measurement(
user: Annotated[str, Depends(login)],
@ -203,11 +213,6 @@ async def get_pat_flg(user: Annotated[str, Depends(login)]):
return mock.patFLG[0]
@router.get('/getHospRecommendations')
async def get_hosp_recommendations(user: Annotated[str, Depends(login)]):
return mock.hospRecommendations
@router.get('/getHospRoutes')
async def get_hosp_routes(user: Annotated[str, Depends(login)]):
return mock.hospRoutes

View File

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

View File

@ -443,7 +443,7 @@ class HospitalizationModel(BaseModel):
title='Идентификатор случая госпитализации',
examples=['ddfa23ea-b0de-4d88-8abe-7d6a7a241df1'],
)
CreationDateTime: str = Field(
CreationDateTime: datetime = Field(
title='Дата и время регистрации', examples=['2025-07-10 17:29']
)
ReceptionDiagnosis: str = Field(
@ -477,3 +477,26 @@ class HospitalizationsModel(BaseModel):
Hospitalizations: list[HospitalizationModel] = Field(
title='Список госпитализаций'
)
class RecommendationModel(BaseModel):
Type: str = Field(title='Тип осмотра', examples=['Осмотр', 'Эпикриз'])
DateTime: datetime = Field(
title='Дата и время создания', examples=['18.07.2025 8:30:43']
)
Recommendation: str = Field(
title='Текст рекомендации', examples=['рекомендации тест']
)
class HospRecommendationsModel(BaseModel):
EventID: str = Field(
title='Идентификатор случая госпитализации',
examples=['ddfa23ea-b0de-4d88-8abe-7d6a7a241df1'],
)
EventDate: datetime = Field(
title='Дата обращения', examples=['2025-07-10']
)
Recommendations: list[RecommendationModel] = Field(
title='Список рекомендаций'
)