diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8631955 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +compose.yml +apiKey.csv +Dockerfile +.gitignore +.DS_Store +.env \ No newline at end of file diff --git a/.gitignore b/.gitignore index c9cb45f..66c91af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ # ---> Python + +/attachments +.DS_Store + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..537c549 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim + +WORKDIR /app + +# Install all WeasyPrint dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + python3-dev \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + python3-cffi \ + libcairo2 \ + libpango-1.0-0 \ + libpangocairo-1.0-0 \ + libgdk-pixbuf-2.0-0 \ + libffi-dev \ + shared-mime-info \ + libpangoft2-1.0-0 \ + libharfbuzz0b \ + libthai0 \ + fonts-dejavu \ + fonts-liberation \ + fonts-freefont-ttf \ + && rm -rf /var/lib/apt/lists/* + +COPY . . + +RUN uv sync --frozen + +RUN chmod +x /app/start.sh + +CMD ["/app/start.sh"] \ No newline at end of file diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..8785d95 --- /dev/null +++ b/compose.yml @@ -0,0 +1,47 @@ +# compose.yml + +services: + postgresql: + container_name: postgresql + environment: + POSTGRES_DB: dolgolet + POSTGRES_PASSWORD: dolgolet + POSTGRES_USER: dolgolet + TZ: Europe/Moscow + healthcheck: + test: ["CMD-SHELL", "pg_isready -U dolgolet -d dolgolet"] + timeout: 10s + interval: 15s + retries: 7 + start_period: 12s + image: postgres:18 + networks: + - my-net + restart: always + volumes: + - /mnt/dbdata/postgres:/var/lib/postgresql + + medodston3health: + depends_on: + postgresql: + condition: service_healthy + image: medodston3health:latest + container_name: medodston3health + volumes: + - /mnt/dbdata/attachments:/app/src/attachments + restart: unless-stopped + ports: + - "80:80" + networks: + - my-net + environment: + TZ: Europe/Moscow + DB_HOST: postgresql + DB_PORT: 5432 + DB_USER: dolgolet + DB_PASSWORD: dolgolet + DB_NAME: dolgolet + +networks: + my-net: + external: true \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 5d1fe11..4e1644a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ dependencies = [ "colorlog>=6.10.1", "fastapi>=0.128.0", "greenlet>=3.3.1", + "gunicorn>=25.1.0", "jinja2>=3.1.6", "lxml>=6.0.2", "pydantic>=2.12.5", @@ -20,5 +21,6 @@ dependencies = [ "python-dotenv>=1.2.1", "python-multipart>=0.0.21", "sqlalchemy>=2.0.46", - "uvicorn>=0.40.0", + "uvicorn>=0.41.0", + "weasyprint>=68.1", ] diff --git a/src/.DS_Store b/src/.DS_Store index eee7823..8104d60 100644 Binary files a/src/.DS_Store and b/src/.DS_Store differ diff --git a/src/api/n3health.py b/src/api/n3health.py index 7e1562c..0a38d68 100644 --- a/src/api/n3health.py +++ b/src/api/n3health.py @@ -196,7 +196,7 @@ async def getTrackingIDSigning(trackingID: str, singingId: int): if not content: continue - ATTACHMENTS_DIR = Path("src/attachments/import") + ATTACHMENTS_DIR = Path("attachments/import").resolve() result = detect_and_save_attachment( b64_content=content, output_dir=ATTACHMENTS_DIR / str(singingId), diff --git a/src/app/routers/api.py b/src/app/routers/api.py index 8225738..fbba2bf 100644 --- a/src/app/routers/api.py +++ b/src/app/routers/api.py @@ -524,8 +524,8 @@ async def search_recipients_post( settings = await Settings.getSettings(False) if not settings.success: - logger.error(settings.error) - return {"status": "error", "message": settings.error} + logger.error(settings.message) + return {"status": "error", "message": settings.message} settings = settings.data try: patientsDB = await findPatientByPhone( diff --git a/src/app/routers/settings.py b/src/app/routers/settings.py index 24600a5..6665f39 100644 --- a/src/app/routers/settings.py +++ b/src/app/routers/settings.py @@ -17,7 +17,6 @@ async def settingsPage(request: Request): @router.get("/get", name="getSettings", summary="Получить настройки") async def getSettings(): settings = await Settings.getSettings() - # logger.info(settings.data) return settings.data diff --git a/src/app/static/js/staff.js b/src/app/static/js/staff.js index 006c497..75f07d4 100644 --- a/src/app/static/js/staff.js +++ b/src/app/static/js/staff.js @@ -364,7 +364,12 @@ function updateStaffTable() { // Определяем тип подписи let signatureTypeHtml; if (practitioner.esiaAuth) { - signatureTypeHtml = 'УКЭП'; + const snils = (practitioner.snils || '').replace(/"/g, '"').replace(/'/g, '''); + const snilsIcon = ``; + signatureTypeHtml = `УКЭПСНИЛС${snilsIcon}`; } else { // Экранируем специальные символы в attorney const attorney = (practitioner.attorney || '').replace(/"/g, '"').replace(/'/g, '''); @@ -914,7 +919,7 @@ document.addEventListener('DOMContentLoaded', function () { const userIdLpu = document.getElementById('ukepPractitionerId').value; const ukepFile = document.getElementById('ukepFile').files[0]; const expiryDate = document.getElementById('ukepExpiryDate').value; - const snils = document.getElementById('mchdSnilsNumber').value.replace(/\D/g, ''); + const snils = document.getElementById('ukepSnilsNumber').value.replace(/\D/g, ''); if (!expiryDate) { showAlert('Заполните дату окончания действия', 'warning'); diff --git a/src/app/templates/_index.html b/src/app/templates/_index.html deleted file mode 100644 index 378f1a1..0000000 --- a/src/app/templates/_index.html +++ /dev/null @@ -1,21 +0,0 @@ -{% extends "base.html" %} - - -{% block title %} - -{% endblock %} - - -{% block head %} - -{% endblock %} - - -{% block body %} - -{% endblock %} - - -{% block scripts %} - -{% endblock %} \ No newline at end of file diff --git a/src/app/templates/staff/index.html b/src/app/templates/staff/index.html index d42b5f5..bf34e15 100644 --- a/src/app/templates/staff/index.html +++ b/src/app/templates/staff/index.html @@ -236,7 +236,7 @@