A simple object-oriented hospital management system that supports inpatient and outpatient billing, doctor management, appointment booking, prescriptions, and JSON persistence.
- InPatient and OutPatient classes with insurance-aware billing
- Doctor and SpecialistDoctor classes with polymorphic display
- Appointment class for structured appointment data
- Prescription class for medication tracking
- Hospital class with automatic JSON load/save for patients, doctors, appointments, and prescriptions
- Text-based main menu for adding patients, doctors, booking appointments, and displaying bills
- Python 3.8 or newer
- No external Python packages required
classDiagram
Person <|-- Patient
Person <|-- Doctor
Patient <|-- InPatient
Patient <|-- OutPatient
Doctor <|-- SpecialistDoctor
Hospital --> Patient
Hospital --> Doctor
Hospital --> Appointment
Hospital --> Prescription
Patient --> Appointment
Patient --> Prescription
Doctor --> Appointment
Doctor --> Prescription
- Install Python 3.8+ if needed.
- (Optional) Create a virtual environment:
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
python main.pyUse the numbered menu to add inpatients, outpatients, doctors, book appointments, and view bills.
The application stores data in JSON files automatically:
patients.jsondoctors.jsonappointments.jsonprescriptions.json
These files are loaded on startup and saved on exit.
Run unit tests with:
python -m unittest discover -s . -p "test_*.py"