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.
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.
- 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
- 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
- Java: 23
- JavaFX: 21.0.6 (UI Framework)
- PostgreSQL: Database Management System
- JDBC: Database connectivity
- Maven: Build and dependency management
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
- Java Development Kit (JDK): Version 23 or higher
- PostgreSQL: Version 12 or higher
- Maven: Version 3.6 or higher
- IDE: IntelliJ IDEA, Eclipse, or VS Code with Java extensions
Ensure PostgreSQL is installed and running on your system.
CREATE DATABASE healthcare_db;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 passwordExecute the SQL scripts in order:
-
Create Schema:
psql -U postgres -d healthcare_db -f database/schema.sql
-
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.
-
Build the project:
mvn clean compile
-
Run the application:
mvn javafx:run
- Import the project into your IDE (IntelliJ IDEA, Eclipse, etc.)
- Build the project using Maven
- Run
HealthcareApplication.javaas the main class
-
Compile:
javac --module-path <path-to-javafx> --add-modules javafx.controls,javafx.fxml <source-files>
-
Run:
java --module-path <path-to-javafx> --add-modules javafx.controls,javafx.fxml org.example.healthcaremanagementsystem.HealthcareApplication
- Click "Patient Management" from the main menu
- Create: Fill in patient details and click "Create"
- Search: Enter patient name in search field and click "Search"
- Update: Select a patient from the table, modify details, and click "Update"
- Delete: Select a patient and click "Delete" (with confirmation)
- Click "Doctor Management" from the main menu
- Similar CRUD operations as Patient Management
- Click "Appointment Management" from the main menu
- Schedule appointments by selecting patient and doctor
- View appointment history and status
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.
- Indexes on frequently searched columns (patient name, doctor name, appointment date)
- Composite indexes for common query patterns
- Foreign key indexes for join operations
- In-memory caching using HashMap for frequently accessed data
- Cache invalidation on data updates
- Time-to-live (TTL) for cache entries
- Parameterized queries for SQL injection prevention
- Efficient join operations
- Proper use of database indexes
-
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
The application includes sample data for testing. You can:
- Test CRUD operations for all entities
- Test search functionality with various criteria
- Test caching performance
- Verify database constraints and referential integrity
- Verify PostgreSQL is running:
pg_isready - Check database credentials in
DatabaseConfig.java - Ensure database
healthcare_dbexists
- Ensure Java 23 is installed:
java -version - Verify Maven is configured:
mvn -version - Clean and rebuild:
mvn clean install
- Check JavaFX module path configuration
- Verify all dependencies are downloaded
- Check console for error messages
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
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
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
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
- MongoDB integration for patient notes (design documented)
- Advanced reporting and analytics
- User authentication and authorization
- Email notifications for appointments
- Export functionality (PDF, Excel)
This is an educational project demonstrating database design, JavaFX application development, and software architecture principles.
This project is for educational purposes.
Healthcare Management System Team
- 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.