Skip to content

Latest commit

ย 

History

History
553 lines (428 loc) ยท 16 KB

File metadata and controls

553 lines (428 loc) ยท 16 KB

Hospital Management System

Java MySQL Swing

A comprehensive desktop application for managing hospital operations including patient records, doctor appointments, diagnoses, and prescriptions built with Java Swing and MySQL.

Hospital Management System


๐Ÿ“‹ Table of Contents


๐ŸŽฏ Overview

The Hospital Management System is a desktop application designed to streamline hospital operations and improve healthcare service delivery. Built using Java Swing for the GUI and MySQL for database management, this system provides a complete solution for managing patients, doctors, appointments, and medical records.

Key Highlights

  • ๐Ÿฅ Comprehensive Management: Handles patients, doctors, appointments, and medical records
  • ๐Ÿ‘ฅ Multi-User Support: Different access levels for doctors, receptionists, and patients
  • ๐Ÿ” Secure Authentication: User login system with role-based access control
  • ๐Ÿ’พ Persistent Storage: MySQL database for reliable data management
  • ๐Ÿ–ฅ๏ธ User-Friendly Interface: Intuitive GUI built with Java Swing

โœจ Features

1. User Management

  • โœ… User registration and authentication
  • โœ… Role-based access (Doctor, Receptionist, Patient)
  • โœ… Secure password handling
  • โœ… User profile management

2. Patient Management

  • โœ… Add new patient records
  • โœ… Edit existing patient information
  • โœ… Remove patient records
  • โœ… Search and filter patients
  • โœ… View patient medical history
  • โœ… Store diagnosis and prescription information

3. Doctor Management

  • โœ… Add doctor profiles
  • โœ… Update doctor information
  • โœ… Assign doctors to rooms
  • โœ… Manage doctor contact information
  • โœ… View doctor schedules

4. Appointment Management

  • โœ… Schedule appointments
  • โœ… Assign patients to doctors
  • โœ… Room allocation
  • โœ… Appointment tracking
  • โœ… Edit and cancel appointments
  • โœ… Search appointments by patient name

5. Diagnosis & Prescription

  • โœ… Record patient diagnoses
  • โœ… Create prescriptions
  • โœ… Update medical records
  • โœ… Track treatment history

6. Reporting

  • โœ… Generate patient reports
  • โœ… View appointment history
  • โœ… Track doctor-patient relationships

๐Ÿ“ธ Screenshots

Login Screen

Login Screen

Main Dashboard

Main Dashboard

Patient Management

Patient Management

Appointment Scheduling

Appointment System

Diagnosis & Prescription

Diagnosis Form


๐Ÿ› ๏ธ Technologies Used

Frontend

  • Java Swing: GUI framework for desktop application
  • NetBeans Form Designer: Visual form designer for UI components

Backend

  • Java SE: Core Java for application logic
  • JDBC: Database connectivity
  • MySQL Connector/J: MySQL driver for Java

Database

  • MySQL: Relational database management system

Tools

  • Apache NetBeans: Integrated Development Environment (IDE)
  • MySQL Workbench: Database design and management

๐Ÿ—๏ธ System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Presentation Layer              โ”‚
โ”‚  (Java Swing GUI Forms)                 โ”‚
โ”‚  - Login Form                           โ”‚
โ”‚  - Main Form                            โ”‚
โ”‚  - Patient Management Forms             โ”‚
โ”‚  - Appointment Forms                    โ”‚
โ”‚  - Diagnosis Forms                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Business Logic Layer            โ”‚
โ”‚  (Java Classes)                         โ”‚
โ”‚  - Patients.java                        โ”‚
โ”‚  - Doctors.java                         โ”‚
โ”‚  - Appointments.java                    โ”‚
โ”‚  - create_user.java                     โ”‚
โ”‚  - DiagANDpres.java                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Data Access Layer               โ”‚
โ”‚  - MyConnection.java (JDBC)             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Database Layer                  โ”‚
โ”‚  (MySQL Database)                       โ”‚
โ”‚  - Tables: patient, doctor,             โ”‚
โ”‚    appointment, create_user, etc.       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ—„๏ธ Database Schema

Main Tables

1. patient Table

CREATE TABLE patient (
    ID INT PRIMARY KEY AUTO_INCREMENT,
    `Full Name` VARCHAR(100),
    `Phone.no` VARCHAR(20),
    `E-mail` VARCHAR(100),
    Complain TEXT,
    Diagnosis TEXT,
    Prescription TEXT
);

2. specification (Doctors) Table

CREATE TABLE specification (
    ID INT PRIMARY KEY AUTO_INCREMENT,
    `Doctor Name` VARCHAR(100),
    `Phone Number` VARCHAR(20),
    `Room Number` VARCHAR(10)
);

3. appointment Table

CREATE TABLE appointment (
    `Appointment no.` INT PRIMARY KEY AUTO_INCREMENT,
    `Doctor Name` VARCHAR(100),
    `Patient Name` VARCHAR(100),
    `Room no.` INT,
    FOREIGN KEY (`Doctor Name`) REFERENCES specification(ID) ON DELETE CASCADE,
    FOREIGN KEY (`Patient Name`) REFERENCES patient(ID) ON DELETE CASCADE
);

4. create_user Table

CREATE TABLE create_user (
    ID INT PRIMARY KEY AUTO_INCREMENT,
    `Full Name` VARCHAR(100),
    Username VARCHAR(50) UNIQUE,
    Password VARCHAR(100),
    Type ENUM('Doctor', 'Receptionist', 'Patient')
);

๐Ÿš€ Installation

Prerequisites

Before you begin, ensure you have the following installed:

Step 1: Clone the Repository

git clone https://github.com/YOUR_USERNAME/hospital-management-system.git
cd hospital-management-system

Step 2: Set Up MySQL Database

  1. Start MySQL Server

    # On Windows
    net start MySQL80
    
    # On macOS/Linux
    sudo service mysql start
  2. Create Database

    mysql -u root -p
  3. Run the following SQL commands:

    CREATE DATABASE hospital_db;
    USE hospital_db;
    
    -- Run the SQL script provided in database/schema.sql
    SOURCE database/schema.sql;

    Or manually create tables using the schema in Database Schema

Step 3: Configure Database Connection

  1. Locate MyConnection.java in the src/hospitalmanagement/ folder

  2. Update the database credentials:

    public class MyConnection {
        private String url = "jdbc:mysql://localhost:3306/hospital_db";
        private String username = "root";  // Change to your MySQL username
        private String password = "your_password";  // Change to your MySQL password
        
        // Rest of the code...
    }

Step 4: Add MySQL Connector to Project

Using NetBeans:

  1. Right-click on Libraries in the project tree
  2. Select Add JAR/Folder
  3. Navigate to where you downloaded mysql-connector-j-x.x.x.jar
  4. Select and add it

Using Command Line:

# Place mysql-connector-j.jar in lib/ folder
cp path/to/mysql-connector-j-x.x.x.jar lib/

Step 5: Build and Run

Using NetBeans:

  1. Open the project in NetBeans
  2. Right-click on the project
  3. Select Clean and Build
  4. Right-click again and select Run

Using Command Line:

# Compile
javac -cp "lib/*" -d build/classes src/hospitalmanagement/*.java

# Run
java -cp "build/classes:lib/*" hospitalmanagement.Hospital_Front_Form

๐Ÿ’ป Usage

First Time Setup

  1. Launch the application

    • Run Hospital_Front_Form.java
  2. Create a user account

    • Click "Signup"
    • Enter your details
    • Select user type (Doctor/Receptionist/Patient)
    • Create username and password
  3. Login

    • Click "Login"
    • Enter your credentials
    • Select your user type
    • Click "Enter"

Using the System

For Receptionists:

  1. Add New Patients

    • Navigate to Patient Management
    • Click "Add Patient"
    • Fill in patient details
    • Save
  2. Schedule Appointments

    • Go to Appointment Management
    • Select patient and doctor
    • Assign room
    • Schedule appointment

For Doctors:

  1. View Patient Information

    • Access patient records
    • Review medical history
  2. Add Diagnosis and Prescription

    • Open patient record
    • Enter diagnosis
    • Write prescription
    • Save changes

For Patients:

  1. View Appointments

    • Check scheduled appointments
    • View assigned doctor
    • See room number
  2. Update Personal Information

    • Edit contact details
    • Update complaints

๐Ÿ‘ฅ User Roles

1. Receptionist

  • Manage patient registration
  • Schedule appointments
  • View all appointments
  • Manage doctor information

2. Doctor

  • View assigned patients
  • Add diagnoses and prescriptions
  • Review patient medical history
  • Manage appointment schedule

3. Patient

  • View personal information
  • Check appointments
  • View diagnoses and prescriptions
  • Update contact information

๐Ÿ“ฆ Project Structure

hospital-management-system/
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ hospitalmanagement/
โ”‚       โ”œโ”€โ”€ Appointments.java              # Appointment management
โ”‚       โ”œโ”€โ”€ Appoinyment_Table.java         # Appointment viewing
โ”‚       โ”œโ”€โ”€ create_user.java               # User registration
โ”‚       โ”œโ”€โ”€ DiagANDpres.java               # Diagnosis & prescription logic
โ”‚       โ”œโ”€โ”€ Diagnosis_prescription.java    # Diagnosis form UI
โ”‚       โ”œโ”€โ”€ Doctors.java                   # Doctor management
โ”‚       โ”œโ”€โ”€ Fllin.java                     # Patient form filling
โ”‚       โ”œโ”€โ”€ Hospital_Front_Form.java       # Landing page
โ”‚       โ”œโ”€โ”€ HospitalManagement.java        # Main application entry
โ”‚       โ”œโ”€โ”€ Login.java                     # Login form
โ”‚       โ”œโ”€โ”€ MainForm.java                  # Main dashboard
โ”‚       โ”œโ”€โ”€ ManageAppointments.java        # Appointment management UI
โ”‚       โ”œโ”€โ”€ MyConnection.java              # Database connection (YOU NEED TO CREATE THIS)
โ”‚       โ”œโ”€โ”€ Patients.java                  # Patient management (YOU NEED TO CREATE THIS)
โ”‚       โ”œโ”€โ”€ User_Creation.java             # User creation form (YOU NEED TO CREATE THIS)
โ”‚       โ”‚
โ”‚       โ””โ”€โ”€ *.form                         # NetBeans form files
โ”‚
โ”œโ”€โ”€ lib/
โ”‚   โ””โ”€โ”€ mysql-connector-j-x.x.x.jar        # MySQL JDBC driver
โ”‚
โ”œโ”€โ”€ database/
โ”‚   โ””โ”€โ”€ schema.sql                         # Database schema
โ”‚
โ”œโ”€โ”€ images/
โ”‚   โ”œโ”€โ”€ banner.png
โ”‚   โ””โ”€โ”€ logo.png
โ”‚
โ”œโ”€โ”€ screenshots/
โ”‚   โ”œโ”€โ”€ login.png
โ”‚   โ”œโ”€โ”€ dashboard.png
โ”‚   โ””โ”€โ”€ ...
โ”‚
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ .gitignore

๐Ÿ”ฎ Future Enhancements

  • Advanced Search: Implement full-text search for patients and appointments
  • Analytics Dashboard: Add statistics and charts for hospital metrics
  • Email Notifications: Send appointment reminders to patients
  • PDF Reports: Generate printable patient reports and prescriptions
  • Multi-Language Support: Add internationalization
  • Backup & Restore: Automated database backup functionality
  • Billing System: Integrate patient billing and payment tracking
  • Medical History Timeline: Visual timeline of patient treatments
  • Web Interface: Develop a web-based version using Spring Boot
  • Mobile App: Create Android/iOS companion apps
  • Cloud Integration: Deploy on cloud with AWS/Azure
  • Role Permissions: Granular permission system
  • Audit Logging: Track all system changes for compliance

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

How to Contribute

  1. Fork the repository

    # Click the "Fork" button on GitHub
  2. Clone your fork

    git clone https://github.com/YOUR_USERNAME/hospital-management-system.git
  3. Create a feature branch

    git checkout -b feature/AmazingFeature
  4. Make your changes and commit

    git commit -m "Add some AmazingFeature"
  5. Push to your fork

    git push origin feature/AmazingFeature
  6. Open a Pull Request

Contribution Guidelines

  • Follow Java naming conventions
  • Add comments to your code
  • Update README if adding new features
  • Test your changes thoroughly
  • Follow the existing code style

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ‘ค Contact

Aya Abdel Moniem


๐Ÿ™ Acknowledgments

  • NetBeans IDE for the powerful development environment
  • MySQL for reliable database management
  • Java Swing for GUI components
  • The British University in Egypt for academic support

๐Ÿ“Š Project Status

GitHub last commit GitHub issues GitHub stars GitHub forks


โš ๏ธ Disclaimer

This is an educational project developed for learning purposes. While it demonstrates key concepts of hospital management systems, it should not be used in production medical environments without proper security audits, compliance checks, and professional validation.

For Medical Use: Consult with healthcare IT professionals and ensure compliance with HIPAA, GDPR, or other relevant healthcare data regulations in your region.


Made with โค๏ธ by Aya Abdel Moniem

A comprehensive hospital management solution for modern healthcare