Skip to content

Repository files navigation

🏥 Patient Management System

A desktop-based Patient Management System built using Java (JavaFX) and MySQL, designed to manage patient records efficiently with proper validation and database constraints.


🚀 Features

  • 🔐 Login System

    • Fixed admin authentication
    • Required field validation
  • Add Patient

    • All fields mandatory
    • Age validation (1–120)
    • Gender selection (Male/Female/Other)
    • Phone number must be exactly 10 digits
    • Data stored in MySQL database
  • Delete Patient

    • Delete patient using ID
    • Handles non-existing IDs properly
  • 📋 Database Constraints

    • NOT NULL for required fields
    • CHECK constraints for age and phone
    • ENUM for gender
    • UNIQUE constraint for phone number
    • PRIMARY KEY for patient ID

🛠️ Tech Stack

  • Frontend: JavaFX
  • Backend: Java (JDBC)
  • Database: MySQL
  • IDE: IntelliJ IDEA

🗄️ Database Schema

CREATE TABLE patients (
    patient_id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    age INT NOT NULL CHECK (age > 0 AND age <= 120),
    gender ENUM('Male','Female','Other') NOT NULL,
    diagnosis TEXT NOT NULL,
    contact_no VARCHAR(10) NOT NULL UNIQUE,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    CHECK (contact_no REGEXP '^[0-9]{10}$')
);

⚙️ Setup Instructions

  1. Clone the repository:
git clone <your-repo-link>
  1. Open the project in IntelliJ IDEA

  2. Configure MySQL:

    • Create a database named hospital
    • Run the schema SQL above
  3. Update database credentials in:

DBConnection.java
  1. Run the project

🔑 Login Credentials

Username: admin
Password: admin123

📌 Key Concepts Implemented

  • MVC Architecture (Model-View-Controller)
  • JDBC for database connectivity
  • Input validation (frontend + backend)
  • SQL constraints for data integrity
  • Exception handling
  • PreparedStatement (SQL injection safe)

📸 Screenshots

  • Login Screen
  • Add Patient Form
  • Success/Error Alerts

(Add your screenshots here if needed)


🎯 Future Enhancements

  • View Patients in table format
  • Update patient details
  • Search functionality
  • User authentication via database

👨‍💻 Author

Krrish Khera


📄 License

This project is for educational purposes.

About

CRUD operations using java and javafx lib

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages