Skip to content

Samuel1796/Hospital_Management_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Healthcare Management System

A comprehensive database-driven hospital management system built with JavaFX, PostgreSQL, and JDBC. This application demonstrates professional software architecture following MVC, DAO, DTO patterns and SOLID principles.

Project Overview

This Healthcare Management System is designed to manage hospital operations including patient registration, doctor management, appointment scheduling, prescription management, and medical inventory tracking. The system implements advanced database concepts including normalization, indexing, caching, and performance optimization.

Features

Core Functionality

  • Patient Management: Complete CRUD operations for patient records
  • Doctor Management: Manage doctor information and department assignments
  • Appointment Scheduling: Schedule and manage patient-doctor appointments
  • Prescription Management: Create and manage prescriptions with medication items
  • Medical Inventory: Track medical supplies, medications, and equipment
  • Patient Feedback: Collect and manage patient feedback and ratings

Technical Features

  • Database Normalization: Schema normalized to Third Normal Form (3NF)
  • Indexing: Optimized indexes on frequently searched columns
  • Caching: In-memory caching using HashMap for fast data retrieval
  • Search Optimization: Case-insensitive search with database indexing
  • Sorting Algorithms: Implementation of QuickSort and MergeSort
  • Parameterized Queries: SQL injection prevention using JDBC PreparedStatements
  • MVC Architecture: Separation of concerns with Model-View-Controller pattern
  • DAO Pattern: Data Access Object pattern for database abstraction
  • DTO Pattern: Data Transfer Objects for clean data transfer between layers

Technology Stack

  • Java: 23
  • JavaFX: 21.0.6 (UI Framework)
  • PostgreSQL: Database Management System
  • JDBC: Database connectivity
  • Maven: Build and dependency management

Project Structure

Healthcare Management System/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”œβ”€β”€ java/
β”‚   β”‚   β”‚   └── org/example/healthcaremanagementsystem/
β”‚   β”‚   β”‚       β”œβ”€β”€ config/          # Database configuration
β”‚   β”‚   β”‚       β”œβ”€β”€ model/           # DTO classes (Patient, Doctor, etc.)
β”‚   β”‚   β”‚       β”œβ”€β”€ dao/              # Data Access Object interfaces and implementations
β”‚   β”‚   β”‚       β”œβ”€β”€ service/         # Business logic layer
β”‚   β”‚   β”‚       β”œβ”€β”€ controller/      # JavaFX controllers (MVC)
β”‚   β”‚   β”‚       β”œβ”€β”€ util/            # Utility classes (Caching, Sorting, Searching)
β”‚   β”‚   β”‚       └── HealthcareApplication.java
β”‚   β”‚   └── resources/
β”‚   β”‚       └── org/example/healthcaremanagementsystem/
β”‚   β”‚           └── *.fxml           # JavaFX UI definitions
β”‚   └── test/
β”œβ”€β”€ database/
β”‚   β”œβ”€β”€ schema.sql                   # Database schema with indexes
β”‚   β”œβ”€β”€ sample_data.sql              # Sample data for testing
β”‚   └── create_database.sql         # Database creation script
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ DIAGRAMS.md                 # Mermaid diagrams (ERDs, architecture, etc.)
β”‚   └── NOSQL_DESIGN.md             # NoSQL design for patient notes
β”œβ”€β”€ pom.xml                          # Maven configuration
└── README.md                        # This file

Prerequisites

  1. Java Development Kit (JDK): Version 23 or higher
  2. PostgreSQL: Version 12 or higher
  3. Maven: Version 3.6 or higher
  4. IDE: IntelliJ IDEA, Eclipse, or VS Code with Java extensions

Database Setup

Step 1: Install PostgreSQL

Ensure PostgreSQL is installed and running on your system.

Step 2: Create Database

CREATE DATABASE healthcare_db;

Step 3: Configure Database Connection

Update the database connection settings in src/main/java/org/example/healthcaremanagementsystem/config/DatabaseConfig.java:

private static final String DB_URL = "jdbc:postgresql://localhost:5432/healthcare_db";
private static final String DB_USER = "postgres";  // Your PostgreSQL username
private static final String DB_PASSWORD = "postgres";  // Your PostgreSQL password

Step 4: Run Database Scripts

Execute the SQL scripts in order:

  1. Create Schema:

    psql -U postgres -d healthcare_db -f database/schema.sql
  2. Insert Sample Data:

    psql -U postgres -d healthcare_db -f database/sample_data.sql

Alternatively, you can use a PostgreSQL client like pgAdmin or DBeaver to execute these scripts.

Building and Running the Application

Using Maven

  1. Build the project:

    mvn clean compile
  2. Run the application:

    mvn javafx:run

Using IDE

  1. Import the project into your IDE (IntelliJ IDEA, Eclipse, etc.)
  2. Build the project using Maven
  3. Run HealthcareApplication.java as the main class

Using Command Line

  1. Compile:

    javac --module-path <path-to-javafx> --add-modules javafx.controls,javafx.fxml <source-files>
  2. Run:

    java --module-path <path-to-javafx> --add-modules javafx.controls,javafx.fxml org.example.healthcaremanagementsystem.HealthcareApplication

Usage Guide

Patient Management

  1. Click "Patient Management" from the main menu
  2. Create: Fill in patient details and click "Create"
  3. Search: Enter patient name in search field and click "Search"
  4. Update: Select a patient from the table, modify details, and click "Update"
  5. Delete: Select a patient and click "Delete" (with confirmation)

Doctor Management

  1. Click "Doctor Management" from the main menu
  2. Similar CRUD operations as Patient Management

Appointment Management

  1. Click "Appointment Management" from the main menu
  2. Schedule appointments by selecting patient and doctor
  3. View appointment history and status

Database Schema

The database schema includes the following entities:

  • departments: Hospital departments
  • patients: Patient information
  • doctors: Doctor credentials and assignments
  • appointments: Patient-doctor appointments
  • prescriptions: Prescription records
  • prescription_items: Medications in prescriptions
  • patient_feedback: Patient feedback and ratings
  • medical_inventory: Medical supplies and equipment

All tables are normalized to 3NF with appropriate foreign key constraints and indexes for optimal performance.

Performance Optimization

Indexing

  • Indexes on frequently searched columns (patient name, doctor name, appointment date)
  • Composite indexes for common query patterns
  • Foreign key indexes for join operations

Caching

  • In-memory caching using HashMap for frequently accessed data
  • Cache invalidation on data updates
  • Time-to-live (TTL) for cache entries

Query Optimization

  • Parameterized queries for SQL injection prevention
  • Efficient join operations
  • Proper use of database indexes

SOLID Principles Implementation

  • Single Responsibility:

    • Each class has one clear purpose
    • Controllers are lightweight (~200-300 lines) and delegate to specialized handlers
    • Handlers are focused: FormHandler (form operations), ControllerHandler (CRUD/search), SetupHandler (UI setup)
  • Open/Closed:

    • Extensible through interfaces (DAO pattern)
    • Base handlers (BaseSetupHandler, BaseControllerHandler) allow extension without modification
  • Liskov Substitution:

    • Interface implementations are interchangeable
    • BaseControllerHandler can be extended by specific handlers (PatientControllerHandler, DoctorControllerHandler, etc.)
  • Interface Segregation:

    • Focused interfaces (PatientDAO, DoctorDAO, etc.)
    • Handlers have specific responsibilities (form, setup, operations)
  • Dependency Inversion:

    • Depend on abstractions (DAO interfaces), not concretions
    • Controllers depend on handler abstractions, not implementations

Testing

The application includes sample data for testing. You can:

  1. Test CRUD operations for all entities
  2. Test search functionality with various criteria
  3. Test caching performance
  4. Verify database constraints and referential integrity

Troubleshooting

Database Connection Issues

  • Verify PostgreSQL is running: pg_isready
  • Check database credentials in DatabaseConfig.java
  • Ensure database healthcare_db exists

Build Issues

  • Ensure Java 23 is installed: java -version
  • Verify Maven is configured: mvn -version
  • Clean and rebuild: mvn clean install

Runtime Issues

  • Check JavaFX module path configuration
  • Verify all dependencies are downloaded
  • Check console for error messages

Documentation

Database Diagrams

Comprehensive Mermaid diagrams are available in docs/DIAGRAMS.md, including:

  • Conceptual, Logical, and Physical ERDs
  • Database Schema Diagrams
  • System Architecture Diagrams
  • Data Flow Diagrams
  • Class Diagrams
  • Sequence Diagrams
  • Use Case Diagrams
  • Component Diagrams
  • Performance Optimization Flow Diagrams

NoSQL Design

A detailed NoSQL data model design for patient notes and medical logs is documented in docs/NOSQL_DESIGN.md. This document:

  • Explains why NoSQL is suitable for unstructured patient notes
  • Provides MongoDB document structure examples
  • Shows integration strategy with the relational database
  • Includes implementation examples and query patterns

Admin Panel

The Performance & Analytics Dashboard serves as the admin panel, accessible from the main menu. It provides:

  • System statistics (Total Patients, Appointments, Active Doctors, Cache Hit Rate)
  • Performance optimization metrics (before/after optimization comparisons)
  • Appointments by status visualization
  • Query performance analysis

Requirements Compliance

This project meets all specified requirements:

βœ… Database Design (3NF): All tables normalized to Third Normal Form
βœ… Entity Groups: Patients, Doctors, Departments, Appointments, Prescriptions, PrescriptionItems, PatientFeedback, MedicalInventory
βœ… Indexing: Comprehensive indexes on frequently searched columns
βœ… CRUD Operations: Full CRUD via JavaFX interface with validation
βœ… Search & Sort: Case-insensitive search with indexing and in-memory sorting
βœ… Caching: In-memory caching with HashMap for performance optimization
βœ… Performance Reporting: Before/after optimization metrics documented
βœ… NoSQL Consideration: Documented design for unstructured patient notes
βœ… Admin Panel: Performance monitoring and analytics dashboard
βœ… Documentation: Complete ERDs, architecture diagrams, and technical documentation

Future Enhancements

  • MongoDB integration for patient notes (design documented)
  • Advanced reporting and analytics
  • User authentication and authorization
  • Email notifications for appointments
  • Export functionality (PDF, Excel)

Contributing

This is an educational project demonstrating database design, JavaFX application development, and software architecture principles.

License

This project is for educational purposes.

Author

Healthcare Management System Team

Acknowledgments

  • PostgreSQL Community
  • JavaFX Team
  • Maven Community

Note: This application is designed for educational purposes to demonstrate database design, JavaFX development, and software engineering principles. For production use, additional security, error handling, and testing would be required.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published