Enjaz
systems / نظام-ادارة-مستشفيات-hms
serviceمُنشَر

نظام إدارة مستشفيات (HMS)

نظام Flask كامل لإدارة المستشفيات بنمط Blueprints حديث: قسم الاستقبال، الصفحة الرئيسية، نماذج المرضى، migrations عبر Alembic. مبني على Application Factory pattern.

PythonFlaskSQLAlchemyAlembicBlueprintsBootstrap

abstract

نظام إدارة Production-grade لمستشفى متوسط الحجم، مبني بأحدث ممارسات Flask.

🎯 المشكلة: أنظمة المستشفيات المتاحة إما غالية جداً أو معقدة الاستخدام. الأطباء والممرضين يحتاجون شيء أبسط.

✨ النظام: • Flask Application Factory pattern (create_app) • SQLAlchemy ORM مع نموذج Patient/Reception/... • Flask-Migrate (Alembic) لـ DB versioning • Blueprints منفصلة: - main_bp: الصفحة الرئيسية ولوحة التحكم - reception_bp: إدارة الاستقبال والمواعيد • Templates مع Jinja2 + Bootstrap • Config classes (Dev/Prod) • Auto-start browser عند التشغيل (UX سريع) • SQLite للسهولة، قابل للترقية لـ Postgres

architecture

  ┌──────────────┐      ┌────────────┐      ┌─────────────┐
  │  client      │─────▶│   nginx    │─────▶│  next.js    │
  │  (browser)   │      │  (proxy)   │      │  (ssr)      │
  └──────────────┘      └─────┬──────┘      └──────┬──────┘
                              │                    │
                              ▼                    ▼
                        ┌───────────┐        ┌──────────┐
                        │ fastapi   │◀──────▶│ postgres │
                        │ (asyncio) │        │ (asyncpg)│
                        └───────────┘        └──────────┘

Stateless API behind a reverse proxy. SSR delivers HTML in under a second on warm cache. Connection pool keeps Postgres hot. JWT in HttpOnly cookie for the admin panel.

notes

  • SSR-first to keep TTFB < 1s on cold visits.
  • Type-checked end-to-end via Pydantic schemas mirrored to TS.
  • Migrations versioned via Alembic; zero-downtime restarts.