init
This commit is contained in:
0
src/db/__init__.py
Normal file
0
src/db/__init__.py
Normal file
36
src/db/models.py
Normal file
36
src/db/models.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import uuid
|
||||
from typing import Any
|
||||
import datetime
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects.postgresql import UUID, ARRAY
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import relationship, DeclarativeBase
|
||||
from sqlalchemy.sql.schema import ForeignKey
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
pass
|
||||
|
||||
class BaseModel(Base):
|
||||
__abstract__ = True
|
||||
|
||||
id = sa.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, index=True)
|
||||
created_at = sa.Column(sa.TIMESTAMP, nullable=False, default=datetime.datetime.now())
|
||||
updated_at = sa.Column(sa.TIMESTAMP, nullable=False, default=datetime.datetime.now(), onupdate=datetime.datetime.now())
|
||||
|
||||
class MedicalCard(BaseModel):
|
||||
number = sa.Column(sa.String(100), nullable=False)
|
||||
checkups = relationship('Checkup', back_populates='medical_card')
|
||||
confidant_persons = sa.Column(ARRAY(UUID(as_uuid=True)))
|
||||
|
||||
|
||||
class Checkup(BaseModel):
|
||||
medical_card_id = sa.Column(UUID(as_uuid=True), sa.ForeignKey("medical_cards.id"), nullable=False)
|
||||
medical_card = relationship('MedicalCard', back_populates='medical_cards')
|
||||
medic_id = sa.Column(UUID(as_uuid=True))
|
||||
claims = sa.Column(ARRAY(String)) # жалобы
|
||||
allergies = sa.Column(ARRAY(String)) # аллергологический анамнез
|
||||
diseases = sa.Column(ARRAY(String)) # перенесенные и сопутствующие заболевания
|
||||
medicines = sa.Column(ARRAY(String)) # принимаемые лекарственные препараты
|
||||
disease_process = sa.Column(sa.Text) # Развитие настоящего заболевания
|
||||
visual_inspection = sa.Column(ARRAY(String)) # внешний осмотр
|
||||
0
src/medical_info/__init__.py
Normal file
0
src/medical_info/__init__.py
Normal file
19
src/medical_info/app.py
Normal file
19
src/medical_info/app.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
def create_app() -> FastAPI:
|
||||
app = FastAPI (
|
||||
title='medical_info',
|
||||
description='Medical Information Service',
|
||||
version='1.0'
|
||||
)
|
||||
|
||||
@app.get('/health')
|
||||
async def health() -> str:
|
||||
return 'ok'
|
||||
|
||||
|
||||
from medical_info.routers import medical_cards
|
||||
|
||||
app.include_router(medical_cards.router)
|
||||
|
||||
return app
|
||||
3
src/medical_info/main.py
Normal file
3
src/medical_info/main.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from medical_info.app import create_app
|
||||
|
||||
app = create_app()
|
||||
0
src/medical_info/routers/__init__.py
Normal file
0
src/medical_info/routers/__init__.py
Normal file
9
src/medical_info/routers/medical_cards.py
Normal file
9
src/medical_info/routers/medical_cards.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from fastapi import Depends
|
||||
from fastapi.routing import APIRouter
|
||||
|
||||
router = APIRouter(prefix='/medical_cards')
|
||||
|
||||
@router.get('/')
|
||||
def list_persons():
|
||||
return "ok"
|
||||
|
||||
Reference in New Issue
Block a user