Skip to content

A comprehensive Java Swing-based Hospital Management System with patient records, appointments, billing, and pharmacy management

License

Notifications You must be signed in to change notification settings

ZainAftab-dev/hospital-management-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

19 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฅ Hospital Management System

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

๐Ÿ“‹ Table of Contents

โœจ Features

๐Ÿ” User Management

  • 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 Management

  • 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 Management

  • 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 System

  • 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

๐Ÿ’Š Pharmacy Management

  • 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

๐Ÿ’ฐ Billing System

  • 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

๐Ÿ“Š Reporting System

  • Patient Reports: Comprehensive patient information
  • Billing Reports: Financial transaction summaries
  • Inventory Reports: Medicine stock status
  • PDF Export: Professional report generation

๐Ÿ—๏ธ System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    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)      โ”‚                  โ”‚
โ”‚           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ Technologies Used

  • 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)

๐Ÿ“‹ Prerequisites

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)

๐Ÿš€ Installation

Option 1: Clone Repository

# 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

Option 2: Download ZIP

  1. Download the project ZIP file
  2. Extract to your desired location
  3. Open in your preferred Java IDE
  4. Add iText PDF library to classpath
  5. Run Main.java

Option 3: IDE Setup

  1. IntelliJ IDEA:

  2. File โ†’ Open โ†’ Select project folder

  3. Add iText library to dependencies

  4. Run Main class

  5. Eclipse:

  6. File โ†’ Import โ†’ Existing Projects into Workspace

  7. Add iText JAR to Build Path

  8. Run Main class

๐Ÿ’ป Usage

Default Login Credentials

Username: admin
Password: admin
Role: Administrator

Getting Started

  1. Launch Application: Run Main.java
  2. Login: Use default credentials or create new users
  3. Navigate Dashboard: Access different modules from the main menu
  4. Manage Data: Add, edit, delete records as needed
  5. Generate Reports: Create PDF reports for various entities

Key Workflows

Adding a New Patient

  1. Navigate to Patient Management
  2. Click Add Patient
  3. Fill in patient details
  4. Click Save
  5. Patient is added to the system

Booking an Appointment

  1. Go to Appointment Management
  2. Click Book Appointment
  3. Select patient and doctor
  4. Choose date and time
  5. Confirm booking

Dispensing Medicine

  1. Access Pharmacy Management
  2. Click Dispense Medicine
  3. Select patient and medicines
  4. Set dosage and instructions
  5. Complete dispensing

Generating Bills

  1. Open Billing Management
  2. Click Generate Bill
  3. Select patient and add services
  4. Apply discounts/taxes if needed
  5. Generate PDF invoice

๐Ÿ“ Project Structure

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

๐Ÿ“š API Documentation

Core Classes

Patient Model

public class Patient extends Person {
    private String bloodGroup;
    private String allergies;
    private String disease;
    private Date registrationDate;
    private List<MedicalRecord> medicalRecords;
}

Medicine Model

public class Medicine {
    private String medicineId;
    private String name;
    private String manufacturer;
    private String category;
    private double price;
    private int quantity;
}

Service Layer Methods

// 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)

Data Access Layer

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();
}

๐Ÿค Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch
git checkout -b feature/AmazingFeature
  1. Commit your changes
git commit -m 'Add some AmazingFeature'
  1. Push to the branch
git push origin feature/AmazingFeature
  1. Open a Pull Request

Contribution Guidelines

  • Follow Java naming conventions
  • Add comments for complex logic
  • Include unit tests for new features
  • Update documentation as needed
  • Ensure code compiles without warnings

๐Ÿ› Known Issues

  • File locking may occur with concurrent access
  • Large datasets may impact performance
  • PDF generation requires proper font installation

๐Ÿ”ฎ Future Enhancements

  • 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

๐Ÿ“„ License

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.

๐Ÿ“ž Contact

Project Maintainer: Zain Aftab

Project Link: https://github.com/ZainAftab-dev/hospital-management-system


๐Ÿ™ Acknowledgments

  • 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

โญ Show Your Support

If this project helped you, please give it a โญ on GitHub!


Made with โค๏ธ for the healthcare community

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages