A Java-based console application for managing hospital operations efficiently — built with a clean service-oriented architecture and file-based data persistence.
The Hospital Management System is a command-line Java application that streamlines core hospital operations. It allows hospital staff to manage patients, doctors, appointments, medical records, and billing — all from a simple, intuitive menu-driven interface. Data is automatically persisted to text files, ensuring records are retained across sessions.
| Module | Capabilities |
|---|---|
| 🧑⚕️ Patient Management | Add patients, view all records, search by Patient ID |
| 👨⚕️ Doctor Management | Register doctors with specializations, view all doctors |
| 📅 Appointment Booking | Schedule appointments between patients and doctors |
| 🗂️ Medical Records | Add and retrieve patient medical history |
| 💰 Billing System | Generate and view patient billing records |
| 💾 Data Persistence | All records auto-saved to .txt files |
Hospital-managment/
│
├── Main.java # Entry point — main menu & navigation
│
├── Models
│ ├── Patient.java # Patient entity (ID, Name, Age, Disease)
│ ├── Doctor.java # Doctor entity (ID, Name, Specialization)
│ ├── Appointment.java # Appointment entity (ID, PatientID, DoctorID, Date)
│ ├── Bill.java # Bill entity (ID, PatientID, Amount)
│ └── MedicalRecord.java # Medical Record entity
│
├── Services
│ ├── PatientService.java # Patient CRUD operations
│ ├── DoctorService.java # Doctor CRUD operations
│ ├── AppointmentService.java# Appointment booking & viewing
│ ├── BillingService.java # Bill generation & viewing
│ ├── MedicalRecordService.java # Medical record management
│ └── Utils.java # File I/O utility (read/write)
│
└── Data Files (auto-generated)
├── patients.txt
├── doctors.txt
├── appointments.txt
├── bills.txt
└── medical_records.txt
- Java JDK 8 or higher
- A terminal / command prompt
Navigate to the Hospital-managment/ directory and compile all .java files:
cd Hospital-managment
javac *.javajava MainUpon launching, you will see the main menu:
=== HOSPITAL MANAGEMENT SYSTEM ===
1. Patient Management
2. Doctor Management
3. Appointment Management
4. Medical Records
5. Billing
6. Exit
Enter choice:
Navigate by entering the corresponding number. Each sub-menu provides options to add or view records. For example:
- Patient Management → Add Patient: enter name, age, and diagnosis
- Appointment Management → Book Appointment: link a patient ID to a doctor ID with a date
- Billing → Generate Bill: enter the patient ID and the billing amount
All records are stored as comma-separated values (CSV) in plain text files in the running directory:
| File | Contents |
|---|---|
patients.txt |
id,name,age,disease |
doctors.txt |
id,name,specialization |
appointments.txt |
id,patientId,doctorId,date |
bills.txt |
id,patientId,amount |
medical_records.txt |
Medical history entries |
Data is loaded at startup and appended on every new entry — no database required.
The system follows a Service-Oriented Architecture (SOA) pattern:
Main.java (Controller / UI Layer)
│
├── PatientService ──► patients.txt
├── DoctorService ──► doctors.txt
├── AppointmentService ──► appointments.txt
├── BillingService ──► bills.txt
└── MedicalRecordService ──► medical_records.txt
│
└── Utils.java (File I/O Layer)
- Models hold data (plain Java objects).
- Services handle business logic and delegate I/O to
Utils. - Utils provides reusable
readAll()andwriteToFile()methods.
Pradyumn Krishna Arya
📦 GitHub: Code-ve/Pradyumn_Krishna_Arya
This project was developed as part of a Java programming submission demonstrating object-oriented programming principles, file handling, and service-oriented design.