This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "HospitalAssistantBackend"
|
name = "HospitalAssistantBackend"
|
||||||
version = "1.5.0"
|
version = "1.5.1"
|
||||||
description = "Backend for Hospital Assistant"
|
description = "Backend for Hospital Assistant"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13,<3.14"
|
requires-python = ">=3.13,<3.14"
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
from base64 import b64decode
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
||||||
from fastapi import APIRouter, Response
|
from fastapi import APIRouter, Response
|
||||||
@ -23,9 +24,10 @@ async def download_file(token: str):
|
|||||||
raise e.NotFoundException
|
raise e.NotFoundException
|
||||||
|
|
||||||
data = loads(file_data)
|
data = loads(file_data)
|
||||||
|
file_bytes = b64decode(data['data'])
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
content=data['data'],
|
content=file_bytes,
|
||||||
media_type=data['content_type'],
|
media_type=data['content_type'],
|
||||||
headers={
|
headers={
|
||||||
'Content-Disposition': f'attachment; filename="{data["filename"]}"'
|
'Content-Disposition': f'attachment; filename="{data["filename"]}"'
|
||||||
|
|||||||
@ -126,7 +126,7 @@ async def get_vaccs_report_download(
|
|||||||
{
|
{
|
||||||
'filename': filename,
|
'filename': filename,
|
||||||
'content_type': 'application/msword',
|
'content_type': 'application/msword',
|
||||||
'data': file_bytes,
|
'data': base64.b64encode(file_bytes).decode('utf-8'),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
ex=600,
|
ex=600,
|
||||||
@ -312,7 +312,7 @@ async def get_aemd_file_download(
|
|||||||
{
|
{
|
||||||
'filename': filename,
|
'filename': filename,
|
||||||
'content_type': 'application/pdf',
|
'content_type': 'application/pdf',
|
||||||
'data': pdf_bytes,
|
'data': base64.b64encode(pdf_bytes).decode('utf-8'),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
ex=600,
|
ex=600,
|
||||||
|
|||||||
@ -634,10 +634,16 @@ class ProlongationModel(BaseModel):
|
|||||||
title='Дата продления до', examples=['2020-10-25']
|
title='Дата продления до', examples=['2020-10-25']
|
||||||
)
|
)
|
||||||
Post: str = Field(
|
Post: str = Field(
|
||||||
|
default='Неизвестный врач',
|
||||||
title='Врач',
|
title='Врач',
|
||||||
examples=['Ахсанова Р.М. (Врач общей практики (семейный врач))'],
|
examples=['Ахсанова Р.М. (Врач общей практики (семейный врач))'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@field_validator('Post', mode='before')
|
||||||
|
@classmethod
|
||||||
|
def set_default_post(cls, v: str | None) -> str:
|
||||||
|
return v or 'Неизвестный врач'
|
||||||
|
|
||||||
|
|
||||||
class PatientELNModel(BaseModel):
|
class PatientELNModel(BaseModel):
|
||||||
PatientSNILS: str | None = Field(
|
PatientSNILS: str | None = Field(
|
||||||
|
|||||||
Reference in New Issue
Block a user