Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏥 HospitalManagement

A JavaFX desktop application for room & booking management, built with Java 23, JavaFX 17, and a MySQL backend.

HospitalManagement is a JavaFX-based desktop client that lets staff log in and manage rooms and bookings through a graphical dashboard. The app uses FXML for its UI layouts, ControlsFX for enhanced JavaFX controls, and connects to a MySQL database through JDBC for persistence.

ℹ️ Note on naming: the repository is named HospitalManagement, while the internal Maven artifact is ProjectLabExam and the domain modeled in code is room/booking management (entities Room and Booking, with a hoteldashboard screen). The README below describes what the code actually does. Rename or retitle if you refactor the domain later.


✨ Features

  • 🔐 Login screen — credentials checked against the database before granting access
  • 🗂️ Main dashboard (hoteldashboard.fxml) — overview and management of rooms
  • 👤 Staff dashboard (staffdashboard.fxml) — staff-facing view with role-specific actions
  • 🛏️ Room management — add / view / manage rooms (Room model)
  • 📅 Booking management — create and track bookings (Booking model)
  • 🎨 Styled UI — custom JavaFX styling via style.css
  • 💾 MySQL persistence — JDBC connectivity handled by DatabaseUtil

🧱 Tech Stack

Layer Technology
Language Java 23
UI Framework JavaFX 17 (FXML + CSS)
UI Extras ControlsFX 11.2.1
Database MySQL (via mysql-connector-java 8.0.28 / JDBC)
Build Tool Maven (with Maven Wrapper)
Testing JUnit 5 (Jupiter)

📁 Project Structure

HospitalManagement/
├── src/main/
│   ├── java/com/example/projectlabexam/
│   │   ├── App.java                       # JavaFX application entry point
│   │   ├── LoginController.java           # Login screen logic
│   │   ├── DashboardController.java       # Main (hotel) dashboard logic
│   │   ├── StaffDashboardController.java  # Staff dashboard logic
│   │   ├── Room.java                      # Room model/entity
│   │   ├── Booking.java                   # Booking model/entity
│   │   └── DatabaseUtil.java              # MySQL connection & queries (JDBC)
│   └── resources/com/example/projectlabexam/
│       ├── login.fxml                     # Login layout
│       ├── hoteldashboard.fxml            # Main dashboard layout
│       ├── staffdashboard.fxml            # Staff dashboard layout
│       └── style.css                       # JavaFX styling
├── pom.xml                                # Maven build & dependencies
├── mvnw / mvnw.cmd                         # Maven wrapper
└── .mvn/wrapper/                           # Maven wrapper config

🚀 Getting Started

Prerequisites

  • JDK 23 (or compatible — the POM targets Java 23)
  • Maven (or use the included mvnw wrapper — no local Maven install required)
  • MySQL server running locally (or a reachable remote instance)

1. Clone the repository

git clone https://github.com/Gaston202/HospitalManagement.git
cd HospitalManagement

2. Set up the MySQL database

Create a database and the required tables for rooms, bookings, and users/staff. Example:

CREATE DATABASE hospital_management;
USE hospital_management;

-- Tables should match the fields used in Room.java, Booking.java,
-- and the login query in DatabaseUtil.java.
-- (Add your CREATE TABLE statements here based on the model classes.)

📌 The exact schema depends on the columns referenced in Room.java, Booking.java, and the login query in DatabaseUtil.java. Inspect those files to match table and column names.

3. Configure the database connection

Open src/main/java/com/example/projectlabexam/DatabaseUtil.java and set your MySQL credentials:

private static final String URL      = "jdbc:mysql://localhost:3306/hospital_management";
private static final String USER     = "your_mysql_user";
private static final String PASSWORD = "your_mysql_password";

⚠️ Security: avoid committing real credentials. Consider moving these values into a config file or environment variables and excluding them from version control.

4. Run the application

Using the Maven wrapper:

./mvnw clean javafx:run        # macOS / Linux
mvnw.cmd clean javafx:run       # Windows

Or, if Maven is installed globally:

mvn clean javafx:run

The JavaFX login window will launch.


📜 Available Maven Commands

Command Description
mvn clean javafx:run Build and launch the JavaFX desktop app
mvn clean package Compile and package the app into a JAR
mvn test Run JUnit 5 tests
mvn clean Remove the target/ build directory

🧩 How It Works

  1. App.java starts the JavaFX application and loads login.fxml.
  2. LoginController validates credentials against MySQL via DatabaseUtil.
  3. On success, the app routes to either the main dashboard (hoteldashboard.fxml / DashboardController) or the staff dashboard (staffdashboard.fxml / StaffDashboardController).
  4. From the dashboards, staff can manage Rooms and Bookings, with all data persisted to MySQL through DatabaseUtil.

🗺️ Roadmap

  • Externalize DB credentials into a config file / environment variables
  • Add password hashing for staff login
  • CRUD UI for rooms and bookings (add / edit / delete forms)
  • Search & filter bookings by date or status
  • Input validation and user-friendly error dialogs (ControlsFX)
  • Unit tests for DatabaseUtil, Room, and Booking

🤝 Contributing

This is a personal/learning project, but contributions are welcome.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is open-source and available under the MIT License.


👤 Author

GastonGitHub @Gaston202

Built as a lab/exam project to practice Java, JavaFX, JDBC, and MySQL.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages