A desktop-based Patient Management System built using Java (JavaFX) and MySQL, designed to manage patient records efficiently with proper validation and database constraints.
-
🔐 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 NULLfor required fieldsCHECKconstraints for age and phoneENUMfor genderUNIQUEconstraint for phone numberPRIMARY KEYfor patient ID
- Frontend: JavaFX
- Backend: Java (JDBC)
- Database: MySQL
- IDE: IntelliJ IDEA
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}$')
);- Clone the repository:
git clone <your-repo-link>-
Open the project in IntelliJ IDEA
-
Configure MySQL:
- Create a database named
hospital - Run the schema SQL above
- Create a database named
-
Update database credentials in:
DBConnection.java
- Run the project
Username: admin
Password: admin123
- MVC Architecture (Model-View-Controller)
- JDBC for database connectivity
- Input validation (frontend + backend)
- SQL constraints for data integrity
- Exception handling
- PreparedStatement (SQL injection safe)
- Login Screen
- Add Patient Form
- Success/Error Alerts
(Add your screenshots here if needed)
- View Patients in table format
- Update patient details
- Search functionality
- User authentication via database
Krrish Khera
This project is for educational purposes.