An intelligent, role-based hospital management platform that combines AI-powered patient triage, real-time queue management, EHR, appointments, billing, pharmacy, and automated resource allocation into a unified healthcare workflow system.
HQMS (Hospital Queue & Management System) is a full-stack hospital workflow platform designed to digitize and streamline day-to-day clinical and administrative operations.
The system connects patients, doctors, receptionists, pharmacists, and administrators through role-specific dashboards while using AI-assisted triage and real-time communication to improve patient prioritization and hospital workflow efficiency.
- AI-based symptom and severity analysis.
- Flask-based machine learning service.
scikit-learnmodel for severity prediction.- Automatic fallback severity logic if the ML service is unavailable.
- Helps prioritize emergency and high-severity patients.
- Token-based patient registration.
- Live queue updates using Socket.IO.
- Emergency/priority queue handling.
- Queue statistics and monitoring.
- Next-patient dispatch.
- Patient completion tracking.
- Automatic doctor assignment during patient registration.
- Automatic room allocation based on availability.
- Doctor weekly shift configuration.
- Reduces manual coordination and waiting time.
- Complete patient visit timeline.
- Medical history tracking.
- Visit records and clinical information.
- Manual/automatic audit provenance.
- EHR filtering.
- PDF report export.
- Medicine inventory management.
- Stock tracking.
- Automatic inventory reduction during billing.
- Symptom-based medicine recommendations.
- Pharmacist dashboard.
- Previous billing information.
- Draft billing workflow.
- Bill finalization.
- Automatic bill number generation.
- Unique bill number enforcement.
- Inventory stock reduction after billing.
- Billing history.
- Doctor availability management.
- Weekly doctor shift configuration.
- Automatic appointment slot generation.
- Conflict detection.
- Appointment status management.
- Facility management.
- Facility availability tracking.
- Symptom-based facility recommendations.
- Integration with patient workflow.
- JWT authentication.
- Access and refresh token system.
- HTTP-only cookies.
- Role-based authorization.
- Protected API routes.
- Role-aware frontend navigation.
| Role | Responsibilities |
|---|---|
| 👨💼 Admin | Manage users, doctors, medicines, facilities and hospital operations |
| 👨⚕️ Doctor | Manage patients, consultations, EHR and appointments |
| 🧑💼 Receptionist | Register patients, generate tokens, manage queues and appointments |
| 💊 Pharmacist | Manage medicines, inventory and billing information |
Patient Symptoms
│
▼
Patient Registration
│
▼
Node.js / Express Backend
│
▼
Flask ML Service
│
▼
Scikit-learn Model
│
▼
Severity Prediction
│
├── Emergency
├── High
├── Medium
└── Low
│
▼
Queue Prioritization
│
▼
Doctor Assignment
If the ML service is unavailable, HQMS uses a fallback severity classification mechanism to maintain system availability.
┌──────────────────────┐
│ React + Vite UI │
│ Tailwind Dashboard │
└──────────┬───────────┘
│
REST API / Socket.IO
│
▼
┌──────────────────────┐
│ Node.js + Express │
│ Backend API │
└──────┬─────────┬─────┘
│ │
┌──────────┘ └──────────┐
▼ ▼
┌──────────────┐ ┌──────────────┐
│ MongoDB │ │ Flask ML │
│ Database │ │ Service │
└──────────────┘ └──────┬───────┘
│
▼
Scikit-learn
Model
- React
- Vite
- Tailwind CSS
- Axios
- Recharts
- jsPDF
- Socket.IO Client
- Node.js
- Express.js
- Mongoose
- Socket.IO
- JWT
- Python
- Flask
- scikit-learn
- Joblib
- MongoDB
HQMS/
│
├── frontend/
│ ├── src/
│ ├── public/
│ ├── package.json
│ └── ...
│
├── backend/
│ ├── controllers/
│ ├── models/
│ ├── routes/
│ ├── middleware/
│ ├── services/
│ ├── Symptoms.txt
│ ├── package.json
│ └── ...
│
├── ml_service/
│ ├── app.py
│ ├── model/
│ ├── requirements.txt
│ └── ...
│
└── README.md
Make sure you have installed:
- Node.js
- npm
- Python 3.x
- MongoDB
- Git
git clone <YOUR_GITHUB_REPOSITORY_URL>
cd HQMScd backend
npm installCreate:
backend/.env
Add:
MONGO_URI=mongodb://localhost:27017/hqms
PORT=5000
ML_SERVICE_URL=http://localhost:5001
CLIENT_ORIGIN=http://localhost:5173
JWT_SECRET=change_this_dev_jwt_secret_64chars_minimum_recommended_1234567890
JWT_REFRESH_SECRET=change_this_dev_refresh_secret_64chars_minimum_recommended_0987654321Start backend:
npm run devOpen a new terminal:
cd ml_service
pip install -r requirements.txt
python app.pyML service:
http://localhost:5001
Open another terminal:
cd frontend
npm install
npm run devFrontend:
http://localhost:5173
| Role | Username | Password |
|---|---|---|
| Admin | admin |
password123 |
| Doctor | doctor |
password123 |
| Receptionist | receptionist |
password123 |
| Pharmacist | pharmacist |
password123 |
⚠️ These credentials are for local development only. Change them before production deployment.
POST /api/auth/login
POST /api/auth/refresh
POST /api/auth/logout
POST /api/auth/register
GET /api/patients
GET /api/patients/:id
GET /api/patients/:id/visits
GET /api/patients/token/:token
GET /api/queue
GET /api/queue/stats
GET /api/queue/next
GET /api/queue/complete/:id
GET /api/doctors
GET /api/doctors/:id/shifts
POST /api/bills/draft
POST /api/bills/finalize/:id
GET /api/bills/number/:billNumber
GET /api/bills
GET /api/appointments
GET /api/appointments/slots
GET /api/appointments/:id/status
GET /api/recommendations/symptoms
GET /api/facilities
GET /api/medicines
GET /api/stats/analytics
Most endpoints are protected using role-based authorization.
Patient Registration
│
▼
AI Triage & Severity Analysis
│
▼
Automatic Doctor / Room Assignment
│
▼
Token Generation
│
▼
Real-Time Queue
│
▼
Doctor Consultation
│
▼
EHR Visit Record
│
├───────────────┐
▼ ▼
Prescription Facility
│
▼
Pharmacy / Billing
│
▼
Inventory Update
│
▼
Final Bill & Patient History
HQMS uses Socket.IO to synchronize queue updates between hospital users in real time.
Receptionist
│
│ Patient Registration
▼
Backend Server
│
│ Socket.IO Event
▼
Doctor Dashboard
│
▼
Live Queue Update
This allows doctors and staff to see queue changes without manually refreshing the application.
HQMS uses MongoDB as its primary database.
The backend automatically initializes development seed data during startup, including:
- Users
- Doctors
- Facilities
- Medicines
Bill numbers are generated atomically and enforced as unique identifiers to prevent duplicate billing numbers.
HQMS includes:
- JWT authentication
- Access & refresh tokens
- HTTP-only cookies
- Role-based authorization
- Protected API endpoints
- Role-aware navigation
- Environment-based configuration
- Unique bill number enforcement
- EHR audit provenance
For production deployment, use HTTPS, secure cookies, strong secrets, rate limiting, input validation, monitoring, and managed secret storage.
- 📱 Patient & Doctor mobile applications
- 🔔 SMS / Email / Push notifications
- 🧠 Advanced AI-assisted diagnosis
- 📊 Predictive patient volume forecasting
- 🏥 Multi-hospital and multi-branch support
- 💳 Online payment integration
- 📄 Automated medical report generation
- 🗣️ Voice-assisted patient registration
- 📈 Advanced hospital analytics
- ☁️ Cloud-native deployment
- 🛡️ Advanced audit and security monitoring
This project is licensed under the MIT License.
AI-Powered Hospital Management System (HQMS)
Built with:
React · Node.js · Express.js · MongoDB · Python · Flask · scikit-learn · Socket.IO
HQMS — Connecting AI, clinical workflows, and hospital operations in one intelligent platform.