A Python-based simulation of a hospital patient management system that prioritizes emergency cases over normal cases using Stack and Queue data structures.
In real hospitals, patients are treated based on urgency.
This system simulates that logic:
- ⚡ Emergency Patients → handled using Stack (LIFO)
- 🧾 Normal Patients → handled using Queue (FIFO)
The system ensures emergency cases are always treated first.
- Object-Oriented Programming (OOP)
- Inheritance
- Polymorphism
- Data Structures
- Stack
- Queue
- System Design Basics
-
Patients are added to the system:
- Emergency patients → go to Stack
- Normal patients → go to Queue
-
Treatment order:
- Emergency patients are treated first
- Then normal patients are treated
- Patient → Base class (name, age)
- EmergencyPatient → High priority patient
- NormalPatient → Regular patient
- Stack → Handles emergency patients (LIFO)
- Queue → Handles normal patients (FIFO)
- Hospital → Controls overall workflow
Pushed Alice onto stack. Enqueued Charlie to queue. Pushed Bob onto stack. Enqueued David to queue.
=== Treating patients === Treating emergency patient: Bob Treating emergency patient: Alice Treating normal patient: Charlie Treating normal patient: David
✔ Priority-based patient handling
✔ Real-world hospital simulation
✔ Clean OOP design
✔ Easy to extend
- Replace Stack with Priority Queue
- Add GUI (Tkinter / Web interface)
- Store patient data in database
- Add scheduling system based on time/condition
python main.py
Author
Developed by [Ezz]