A comprehensive Java Swing-based Hospital Management System with file-based data storage, designed for efficient management of hospital operations including patient records, doctor schedules, pharmacy inventory, appointments, and billing.
Developed by:
- Zain Aftab FA24-BSE-155
- Musfirah Qadeer FA24-BSE-101
- Zuhaa Wasim FA24-BSE-119
- Features
- System Architecture
- Technologies Used
- Prerequisites
- Installation
- Usage
- Project Structure
- Screenshots
- API Documentation
- Contributing
- License
- Contact
- Multi-role Authentication: Admin, Doctor, Nurse, Receptionist, Pharmacist
- Secure Login System: Username/password authentication
- User Profile Management: Add, edit, delete users
- Role-based Access Control: Different permissions for different roles
- Patient Registration: Complete patient information management
- Medical History: Track patient medical records
- Search & Filter: Quick patient lookup functionality
- Patient Reports: Generate comprehensive patient reports
- Doctor Profiles: Manage doctor information and specializations
- Schedule Management: Track doctor availability
- Consultation Fees: Manage pricing information
- Specialization Tracking: Organize doctors by medical specialties
- Appointment Booking: Schedule patient-doctor appointments
- Time Slot Management: Prevent double booking
- Status Tracking: Monitor appointment status (Scheduled, Completed, Cancelled)
- Appointment History: View past and upcoming appointments
- Medicine Inventory: Track medicine stock levels
- Category Management: Organize medicines by categories
- Prescription Dispensing: Manage medicine distribution
- Low Stock Alerts: Monitor inventory levels
- Price Management: Track medicine pricing
- Invoice Generation: Create detailed bills for services
- Payment Tracking: Monitor payment status
- Multiple Bill Items: Support for various services and medicines
- Discount & Tax Calculation: Flexible pricing options
- PDF Bill Generation: Professional invoice printing
- Patient Reports: Comprehensive patient information
- Billing Reports: Financial transaction summaries
- Inventory Reports: Medicine stock status
- PDF Export: Professional report generation
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Presentation Layer โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ Login Frame โ โ Dashboard โ โ Management โ โ
โ โ โ โ Frame โ โ Panels โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Service Layer โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ Patient โ โ Doctor โ โ Medicine โ โ
โ โ Service โ โ Service โ โ Service โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Data Access Layer โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ Patient โ โ Doctor โ โ Medicine โ โ
โ โ DAO โ โ DAO โ โ DAO โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Data Storage Layer โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ Text Files โ โ PDF Reports โ โ
โ โ (.txt) โ โ (.pdf) โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Java 8+: Core programming language
- Swing: GUI framework for desktop application
- File I/O: Text file-based data persistence
- iText PDF: PDF generation for reports and bills
- Maven: Dependency management (optional)
Before running this application, make sure you have:
- Java Development Kit (JDK) 8 or higher
- IDE (IntelliJ IDEA, Eclipse, or NetBeans)
- iText PDF Library (included in project)
# Clone the repository
git clone https://github.com/yourusername/hospital-management-system.git
# Navigate to project directory
cd hospital-management-system
# Compile the project
javac -cp ".:lib/*" src/hms/Main.java
# Run the application
java -cp ".:lib/*:src" hms.Main
- Download the project ZIP file
- Extract to your desired location
- Open in your preferred Java IDE
- Add iText PDF library to classpath
- Run
Main.java
-
IntelliJ IDEA:
-
File โ Open โ Select project folder
-
Add iText library to dependencies
-
Run Main class
-
Eclipse:
-
File โ Import โ Existing Projects into Workspace
-
Add iText JAR to Build Path
-
Run Main class
Username: admin
Password: admin
Role: Administrator
- Launch Application: Run
Main.java - Login: Use default credentials or create new users
- Navigate Dashboard: Access different modules from the main menu
- Manage Data: Add, edit, delete records as needed
- Generate Reports: Create PDF reports for various entities
- Navigate to Patient Management
- Click Add Patient
- Fill in patient details
- Click Save
- Patient is added to the system
- Go to Appointment Management
- Click Book Appointment
- Select patient and doctor
- Choose date and time
- Confirm booking
- Access Pharmacy Management
- Click Dispense Medicine
- Select patient and medicines
- Set dosage and instructions
- Complete dispensing
- Open Billing Management
- Click Generate Bill
- Select patient and add services
- Apply discounts/taxes if needed
- Generate PDF invoice
HMSOOPProject/
โโโ src/
โ โโโ hms/
โ โโโ dao/ # Data Access Objects
โ โ โโโ FileBasedDAO.java
โ โ โโโ PatientDAO.java
โ โ โโโ DoctorDAO.java
โ โ โโโ MedicineDAO.java
โ โ โโโ UserDAO.java
โ โโโ service/ # Business Logic Layer
โ โ โโโ PatientService.java
โ โ โโโ DoctorService.java
โ โ โโโ MedicineService.java
โ โ โโโ UserService.java
โ โโโ model/ # Data Models
โ โ โโโ Patient.java
โ โ โโโ Doctor.java
โ โ โโโ Medicine.java
โ โ โโโ Appointment.java
โ โ โโโ Billing.java
โ โ โโโ User.java
โ โโโ ui/ # User Interface
โ โ โโโ LoginFrame.java
โ โ โโโ DashboardFrame.java
โ โ โโโ PatientManagementPanel.java
โ โ โโโ DoctorManagementPanel.java
โ โ โโโ PharmacyManagementPanel.java
โ โ โโโ AppointmentManagementPanel.java
โ โ โโโ BillingManagementPanel.java
โ โ โโโ ReportsPanel.java
โ โโโ util/ # Utility Classes
โ โ โโโ ValidationUtils.java
โ โ โโโ PDFGenerator.java
โ โ โโโ PasswordUtils.java
โ โโโ interfaces/ # Interface Definitions
โ โ โโโ DataAccessObject.java
โ โ โโโ ManagementService.java
โ โ โโโ ReportGenerator.java
โ โโโ exception/ # Custom Exceptions
โ โ โโโ AuthenticationException.java
โ โ โโโ DataAccessException.java
โ โ โโโ ValidationException.java
โ โโโ Main.java # Application Entry Point
โโโ data/ # Data Storage
โ โโโ patients.txt
โ โโโ doctors.txt
โ โโโ medicines.txt
โ โโโ users.txt
โโโ reports/ # Generated Reports
โโโ lib/ # External Libraries
โ โโโ itextpdf-5.5.13.jar
โโโ logo.png # Application Logo
โโโ README.md
public class Patient extends Person {
private String bloodGroup;
private String allergies;
private String disease;
private Date registrationDate;
private List<MedicalRecord> medicalRecords;
}public class Medicine {
private String medicineId;
private String name;
private String manufacturer;
private String category;
private double price;
private int quantity;
}// PatientService
public boolean add(Patient patient)
public Patient getById(String id)
public List<Patient> getAll()
public boolean update(Patient patient)
public boolean delete(String id)
public List<Patient> search(String query)All DAO classes implement the DataAccessObject<T, ID> interface:
public interface DataAccessObject<T, ID> {
boolean save(T entity);
T findById(ID id);
List<T> findAll();
List<T> findByProperty(String propertyName, Object value);
boolean update(T entity);
boolean delete(ID id);
boolean exists(ID id);
long count();
}We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/AmazingFeature
- Commit your changes
git commit -m 'Add some AmazingFeature'
- Push to the branch
git push origin feature/AmazingFeature
- Open a Pull Request
- Follow Java naming conventions
- Add comments for complex logic
- Include unit tests for new features
- Update documentation as needed
- Ensure code compiles without warnings
- File locking may occur with concurrent access
- Large datasets may impact performance
- PDF generation requires proper font installation
- Database integration (MySQL/PostgreSQL)
- Web-based interface
- Mobile application
- Cloud deployment support
- Advanced reporting with charts
- Integration with external systems
- Multi-language support
- Backup and restore functionality
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 Hospital Management System
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Project Maintainer: Zain Aftab
- Email: zainaftab589@gmail.com
- GitHub: @ZainAftab-dev
Project Link: https://github.com/ZainAftab-dev/hospital-management-system
- Thanks to the Java Swing community for excellent documentation
- iText team for the PDF generation library
- All contributors who helped improve this project
- Healthcare professionals who provided domain expertise
If this project helped you, please give it a โญ on GitHub!
Made with โค๏ธ for the healthcare community