Java Mini Project - Report (E - Health Care System)
Java Mini Project - Report (E - Health Care System)
Team Members:
Problem Statement:
The motivation for developing an e-Health Care Management System that integrates
various healthcare services into a single platform is driven by several factors:
Scope:
1. Appointment Booking: The system will allow patients to book appointments with
doctors based on their availability.
2. Hospital Locator: The system will provide a feature to locate nearby hospitals by
entering the district.
3. Ward Availability: The system will provide real-time information about the
availability of wards in hospitals.
4. Medicine Availability: The system will provide information about the availability
of medicines in pharmacies.
Limitations:
1. Data Accuracy: Data accuracy is a major concern where the data is not verified
and verifying data can be a tedious process.
2. Updating Data: Updating data needs to be done manually and requires physical
labor.
3. Appointment Status: Once the doctor confirms or rejects an appointment, he/she
can’t modify the appointment if necessary.
Design of the Solution:
Patient
-name:String
-dob:String
-age:int
-bloodGroup:String
-height:String
-weight:String
-contact:String
-aadhar:String
-password:String
+viewMyProfile():void
+bookAppointment():void
+viewDoctor():void
+searchHospital():void
+checkWardAvailability():void
+checkMedicineAvailability():void
Doctor
-name:String
-dob:String
-degree:String
-specialization:String
-experience:int
-hospital:String
-contact:String
-password:String
+viewMyProfile():void
+checkAppointments():void
+viewAppointments():void
Admin
-name:String
-password:String
+hospitalDetails():void
+wardDetails():void
+medicineDetails():void
Hospital
-name:String
-district:String
-generalWards:int
-maleWards:int
-femaleWards:int
-mixedWards:int
-paediatricWards:int
-maternityWards:int
-ICUs:int
-emergencyWards:int
-isolationWards:int
-psychiatricWards:int
+storeHospitalData():void
+updateHospitalData():void
+viewHospitalData():void
Pharmacy
-name:String
-district:String
-medicine:String
-availableStatus:String
+storeData():void
+updataData():void
+viewData():void
Appointment
-doctor:String
-patient:String
-date:String
-time:String
-note:String
+bookAppointment():void
+updateStatus():void
+viewStatus():void
Modules split-up:
1. User Registration and Authentication Module: This module will handle user
registration, login, and authentication. It will ensure that only registered users can
access the system.
2. Appointment Booking Module: This module will allow patients to book
appointments with doctors. It will display the available slots and confirm the
booking.
3. Hospital Locator Module: This module will help patients locate nearby hospitals.
The user can enter district name to locate the hospitals in the district.
4. Ward Availability Module: This module will provide information about the
availability of wards in different hospitals. It will require real-time data from the
hospitals.
5. Medicine Availability Module: This module will allow patients to check the
availability of medicines in different pharmacies. It will require real-time data
from the pharmacies.
6. Doctor Profile Module: Here, the patient can view the doctor’s details by just
entering his/her name.
7. Appointment Checking Module: The doctor can check and either confirm or
reject the booked appointment and can also view the appointment details in the
appointment status module within this module.
8. Hospital Details Module: The administrator can enter the details of the hospital
with ward details in this module. The administrator can also update the
information in this module.
9. Ward Details Module: The administrator can check the ward details of a
particular hospital in this module by entering the hospital name.
10. Medicine Details Module: The administrator can enter the pharmacy details with
the medicine availability status and can also update the status of medicine
availability in this module.
Implementation Specifics:
Frontend:
● Technology: JavaFX is used for the GUI. JavaFX is a set of graphics and media
packages that enables developers to design, create, test, debug, and deploy rich
client applications that operate consistently across diverse platforms.
● Design: The design is user-friendly and intuitive. JavaFX provides a powerful
framework for developing rich client applications.
Backend:
Database:
Testing:
● Unit tests should be written to test individual components of the system. JUnit is
a simple framework to write repeatable tests in Java and can be used for this
purpose.
Deployment:
Main.java
package com.example.healthcare;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
@Override
stage.setScene(scene);
stage.show();
launch();
MainController.java
package com.example.healthcare;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import java.io.IOException;
import javafx.event.ActionEvent;
@FXML
@FXML
@FXML
@FXML
try {
Parent root =
FXMLLoader.load(getClass().getResource("doctorLogin.fxml"));
stage.show();
System.err.println(ex);
}
@FXML
try {
Parent root =
FXMLLoader.load(getClass().getResource("patientLogin.fxml"));
stage.show();
System.err.println(ex);
@FXML
try {
Parent root =
FXMLLoader.load(getClass().getResource("adminLogin.fxml"));
stage.show();
System.err.println(ex);
}
Functions.java
package com.example.healthcare;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.stage.Stage;
Class.forName("com.mysql.cj.jdbc.Driver");
return
DriverManager.getConnection("jdbc:mysql://localhost:3306/hospitalrecord",
"admin","password");
PreparedStatement psCheckUserExists =
connection.prepareStatement("SELECT * FROM doctors_password_credentials WHERE
`User Name` = ?");
PreparedStatement psInsert = connection.prepareStatement("INSERT
INTO doctors_password_credentials (`User Name`, `Password`) VALUES (?,?)")) {
psCheckUserExists.setString(1, username);
if(resultSet.isBeforeFirst()){
alert.show();
else{
psInsert.setString(1,username);
psInsert.setString(2, password);
psInsert.executeUpdate();
FXMLLoader loader;
try {
loader = new
FXMLLoader(Functions.class.getResource(fxmlFile));
stage.setTitle("Welcome!");
stage.show();
} catch (Exception e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
PreparedStatement preparedStatement =
connection.prepareStatement("SELECT `Password` FROM
doctors_password_credentials WHERE `User Name` = ?")) {
preparedStatement.setString(1, username);
if(!resultSet.next()){
alert.show();
else{
do {
if(retrievedPassword.equals(password)){
FXMLLoader loader;
try {
loader = new
FXMLLoader(Functions.class.getResource(fxmlFile));
DoctorDashboardController controller =
loader.getController();
controller.setUsername(username);
stage.show();
} catch (Exception e) {
e.printStackTrace();
else{
alert.show();
} while(resultSet.next());
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
PatientSignupController.java
package com.example.healthcare;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.*;
@FXML
@FXML
@FXML
Class.forName("com.mysql.cj.jdbc.Driver");
return
DriverManager.getConnection("jdbc:mysql://localhost:3306/hospitalrecord",
"admin","password");
PreparedStatement psCheckUserExists =
connection.prepareStatement("SELECT * FROM patients_password_credentials WHERE
`User Name` = ?");
psCheckUserExists.setString(1, username);
if(resultSet.isBeforeFirst()){
alert.show();
else{
psInsert.setString(1,username);
psInsert.setString(2, password);
psInsert.executeUpdate();
FXMLLoader loader;
try {
loader = new
FXMLLoader(Functions.class.getResource(fxmlFile));
stage.setTitle("Welcome!");
stage.show();
} catch (Exception e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
@FXML
signup.setOnAction(event -> {
});
login.setOnAction(event -> {
try {
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
e.printStackTrace();
});
PatientProfileController.java
package com.example.healthcare;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.event.ActionEvent;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.io.IOException;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
private TextField aadhar;
@FXML
@FXML
save.setOnAction(event -> {
PreparedStatement preparedStatement =
connection.prepareStatement("INSERT INTO patients_details (Name, DOB, Age,
`Blood Group`, Height, Weight, Aadhar, Contact) VALUES (?,?,?,?,?,?,?,?)")) {
preparedStatement.setString(1, patientName);
preparedStatement.setString(2, patientDOB);
preparedStatement.setInt(3, patientAge);
preparedStatement.setString(4, patientBloodGroup);
preparedStatement.setString(5, patientHeight);
preparedStatement.setString(6, patientWeight);
preparedStatement.setString(7, patientAadhar);
preparedStatement.setString(8, patientContact);
preparedStatement.executeUpdate();
Parent patientDashboard =
FXMLLoader.load(getClass().getResource("patientDashboard.fxml"));
stage.setScene(scene);
stage.show();
e.printStackTrace();
});
PatientLoginController.java
package com.example.healthcare;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.*;
@FXML
@FXML
@FXML
@FXML
Class.forName("com.mysql.cj.jdbc.Driver");
return
DriverManager.getConnection("jdbc:mysql://localhost:3306/hospitalrecord",
"admin","password");
preparedStatement.setString(1, username);
if(!resultSet.next()){
alert.show();
else{
do {
if(retrievedPassword.equals(password)){
FXMLLoader loader;
try {
loader = new
FXMLLoader(Functions.class.getResource(fxmlFile));
PatientDashboardController controller =
loader.getController();
controller.setUsername(username);
stage.show();
} catch (Exception e) {
e.printStackTrace();
else{
alert.show();
} while(resultSet.next());
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
@FXML
login.setOnAction(event -> {
});
signup.setOnAction(event -> {
try {
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
e.printStackTrace();
});
PatientDashboardController.java
package com.example.healthcare;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
PatientDashboardController.username = username;
}
public static String getUsername() {
return username;
@FXML
try {
stage.setTitle("Patient Profile");
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
@FXML
try {
root = FXMLLoader.load(getClass().getResource("hospitals.fxml"));
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
@FXML
FXMLLoader loader;
try {
loader = new
FXMLLoader(Functions.class.getResource("appointmentBooking.fxml"));
stage.setTitle("Book Appointment");
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
@FXML
try {
root =
FXMLLoader.load(getClass().getResource("checkWardAvailability.fxml"));
stage.show();
} catch (IOException e) {
@FXML
try {
root =
FXMLLoader.load(getClass().getResource("medicineSuggest.fxml"));
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
@FXML
try {
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
PatientProfileDisplayController.java
package com.example.healthcare;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class PatientProfileDisplayController {
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
PreparedStatement preparedStatement =
connection.prepareStatement("SELECT * FROM patients_details WHERE Name = ?")) {
preparedStatement.setString(1, username);
if (resultSet.next()) {
name.setText(resultSet.getString("Name"));
dob.setText(resultSet.getString("DOB"));
age.setText(String.valueOf(resultSet.getInt("Age")));
bloodGroup.setText(resultSet.getString("Blood Group"));
height.setText(resultSet.getString("Height"));
weight.setText(resultSet.getString("Weight"));
aadhar.setText(resultSet.getString("Aadhar"));
contact.setText(resultSet.getString("Contact"));
e.printStackTrace();
@FXML
Parent patientDashboard =
FXMLLoader.load(getClass().getResource("patientDashboard.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
AppointmentBookingController.java
package com.example.healthcare;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
AppointmentBookingController.username = username;
return username;
@FXML
populateDoctorComboBox();
limitDatePicker();
createTimeSlotComboBox();
book.setOnAction(this::bookAppointment);
preparedStatement.setString(1, doctorName);
preparedStatement.setString(2, patient);
preparedStatement.setString(3, selectedDate);
preparedStatement.setString(4, selectedTime);
preparedStatement.setString(5, enteredNotes);
preparedStatement.executeUpdate();
PreparedStatement preparedStatement =
connection.prepareStatement("SELECT Name, Specialization FROM
doctors_details")) {
ObservableList<String> doctorList =
FXCollections.observableArrayList();
while (resultSet.next()) {
doctor.setItems(doctorList);
e.printStackTrace();
@Override
super.updateItem(item, empty);
setDisable(item.isAfter(nextWeek) || item.isBefore(today));
});
ObservableList<String> timeSlotList =
FXCollections.observableArrayList();
for (int hour = 8; hour <= 17; hour++) {
timeSlot.setItems(timeSlotList);
@FXML
try {
Parent patientDashboard =
FXMLLoader.load(getClass().getResource("bookedAppointment.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
@FXML
Parent patientDashboard =
FXMLLoader.load(getClass().getResource("patientDashboard.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
BookedAppointmentController.java
package com.example.healthcare;
import javafx.event.ActionEvent;
import javafx.fxml.*;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
titleLabel.setText("Booked Appointments");
idColumn.setCellValueFactory(new PropertyValueFactory<>("id"));
doctorColumn.setCellValueFactory(new PropertyValueFactory<>("doctor"));
patientColumn.setCellValueFactory(new
PropertyValueFactory<>("patient"));
dateColumn.setCellValueFactory(new PropertyValueFactory<>("date"));
timeColumn.setCellValueFactory(new PropertyValueFactory<>("time"));
notesColumn.setCellValueFactory(new PropertyValueFactory<>("notes"));
statusColumn.setCellValueFactory(new PropertyValueFactory<>("status"));
try (Connection connection = Functions.getConnection()) {
PreparedStatement preparedStatement =
connection.prepareStatement("SELECT * FROM appointments WHERE Patient = ?");
preparedStatement.setString(1, username);
while(resultSet.next()) {
int id = resultSet.getInt("ID");
appointmentTableView.getItems().add(appointment);
e.printStackTrace();
@FXML
public void goBack(ActionEvent event) {
try {
Parent patientDashboard =
FXMLLoader.load(getClass().getResource("appointmentBooking.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
CheckWardAvailabilityController.java
package com.example.healthcare;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@FXML
@FXML
@FXML
@FXML
statement.setString(1, hospitalName);
wardDetailsLabel.setText(resultText);
} else {
} catch (Exception e) {
e.printStackTrace();
}
@FXML
@FXML
try {
Parent patientDashboard =
FXMLLoader.load(getClass().getResource("patientDashboard.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
HospitalsController.java
package com.example.healthcare;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.stage.Stage;
import javafx.fxml.FXML;
import java.io.IOException;
import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
this.name = name;
this.district = district;
this.generalWards = generalWards;
this.maleWards = maleWards;
this.femaleWards = femaleWards;
this.mixedWards = mixedWards;
this.paediatricWards = paediatricWards;
this.maternityWards = maternityWards;
this.icus = icus;
this.emergencyWards = emergencyWards;
this.isolationWards = isolationWards;
this.psychiatricWards = psychiatricWards;
return name;
return district;
}
return generalWards;
return maleWards;
return femaleWards;
return mixedWards;
return paediatricWards;
return maternityWards;
return icus;
}
public int getEmergencyWards() {
return emergencyWards;
return isolationWards;
return psychiatricWards;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
private TableColumn<Hospital, Integer> maleWardsColumn = new
TableColumn<>("Male Wards");
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@Override
hospitalTable.getColumns().clear();
hospitalTable.getColumns().addAll(nameColumn, districtColumn,
generalWardsColumn, maleWardsColumn, femaleWardsColumn, mixedWardsColumn,
paediatricWardsColumn, maternityWardsColumn, icusColumn, emergencyWardsColumn,
isolationWardsColumn, psychiatricWardsColumn);
nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
districtColumn.setCellValueFactory(new
PropertyValueFactory<>("district"));
generalWardsColumn.setCellValueFactory(new
PropertyValueFactory<>("generalWards"));
maleWardsColumn.setCellValueFactory(new
PropertyValueFactory<>("maleWards"));
femaleWardsColumn.setCellValueFactory(new
PropertyValueFactory<>("femaleWards"));
mixedWardsColumn.setCellValueFactory(new
PropertyValueFactory<>("mixedWards"));
paediatricWardsColumn.setCellValueFactory(new
PropertyValueFactory<>("paediatricWards"));
maternityWardsColumn.setCellValueFactory(new
PropertyValueFactory<>("maternityWards"));
icusColumn.setCellValueFactory(new PropertyValueFactory<>("icus"));
emergencyWardsColumn.setCellValueFactory(new
PropertyValueFactory<>("emergencyWards"));
isolationWardsColumn.setCellValueFactory(new
PropertyValueFactory<>("isolationWards"));
psychiatricWardsColumn.setCellValueFactory(new
PropertyValueFactory<>("psychiatricWards"));
@FXML
statement.setString(1, district);
while (resultSet.next()) {
hospitals.add(hospital);
} catch (Exception e) {
e.printStackTrace();
ObservableList<Hospital> data =
FXCollections.observableArrayList(hospitals);
hospitalTable.setItems(data);
@FXML
@FXML
try {
Parent patientDashboard =
FXMLLoader.load(getClass().getResource("patientDashboard.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
MedicineSuggestController.java
package com.example.healthcare;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
this.pharmacy = pharmacy;
this.district = district;
this.medicine = medicine;
this.available = available;
}
public String getPharmacy() {
return pharmacy;
return district;
return medicine;
return available;
this.pharmacy = pharmacy;
this.district = district;
this.medicine = medicine;
}
public void setAvailable(String available) {
this.available = available;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
pharmacyColumn.setCellValueFactory(new
PropertyValueFactory<>("pharmacy"));
districtColumn.setCellValueFactory(new
PropertyValueFactory<>("district"));
medicineColumn.setCellValueFactory(new
PropertyValueFactory<>("medicine"));
availableColumn.setCellValueFactory(new
PropertyValueFactory<>("available"));
@FXML
searchResultsTable.setItems(medicines);
ObservableList<Medicine> medicines =
FXCollections.observableArrayList();
statement.setString(1, pharmacy);
statement.setString(2, medicine);
while (resultSet.next()) {
Medicine medicineRecord = new Medicine(
resultSet.getString("Pharmacy"),
resultSet.getString("District"),
resultSet.getString("Medicine"),
resultSet.getString("Available")
);
medicines.add(medicineRecord);
} catch (Exception e) {
e.printStackTrace();
return medicines;
@FXML
@FXML
try {
Parent patientDashboard =
FXMLLoader.load(getClass().getResource("patientDashboard.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
DoctorProfileViewController.java
package com.example.healthcare;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@FXML
@FXML
@FXML
@FXML
displayDoctorDetails(doctorName);
doctorDetails.setText(details);
pstmt.setString(1, doctorName);
ResultSet rs = pstmt.executeQuery();
if (rs.next()) {
}
} catch (SQLException e) {
System.out.println(e.getMessage());
return details;
DoctorSignupController.java
package com.example.healthcare;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
@FXML
@FXML
private PasswordField password;
@FXML
@FXML
@FXML
signup.setOnAction(event -> {
});
login.setOnAction(event -> {
try {
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
e.printStackTrace();
});
}
DoctorProfileController.java
package com.example.healthcare;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.event.ActionEvent;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.io.IOException;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
save.setOnAction(event -> {
preparedStatement.setString(1, doctorName);
preparedStatement.setString(2, doctorDOB);
preparedStatement.setString(3, doctorDegree);
preparedStatement.setString(4, doctorSpecialization);
preparedStatement.setString(5, doctorExperience);
preparedStatement.setString(6, doctorHospital);
preparedStatement.setString(7, doctorContact);
preparedStatement.executeUpdate();
Parent doctorDashboard =
FXMLLoader.load(getClass().getResource("doctorDashboard.fxml"));
stage.setScene(scene);
stage.show();
e.printStackTrace();
});
DoctorLoginController.java
package com.example.healthcare;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
@FXML
@FXML
@FXML
@FXML
@FXML
});
signup.setOnAction(event -> {
try {
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
e.printStackTrace();
});
DoctorDashboardController.java
package com.example.healthcare;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
DoctorDashboardController.username = username;
return username;
try {
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
FXMLLoader loader;
try {
loader = new
FXMLLoader(Functions.class.getResource("appointmentChecking.fxml"));
controller.setUsername(username);
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
e.printStackTrace();
DoctorProfileDisplayController.java
package com.example.healthcare;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
PreparedStatement preparedStatement =
connection.prepareStatement("SELECT * FROM doctors_details WHERE Name = ?")) {
preparedStatement.setString(1, username);
if (resultSet.next()) {
name.setText(resultSet.getString("Name"));
dob.setText(resultSet.getString("DOB"));
degree.setText(resultSet.getString("Degree"));
specialization.setText(resultSet.getString("Specialization"));
yearofexperience.setText(resultSet.getString("Experience"));
hospital.setText(resultSet.getString("Hospital"));
contact.setText(resultSet.getString("Contact"));
@FXML
try {
Parent doctorDashboard =
FXMLLoader.load(getClass().getResource("doctorDashboard.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
AppointmentCheckingController.java
package com.example.healthcare;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
private Button rejectAllButton;
@FXML
AppointmentCheckingController.username = username;
@FXML
setUsername(name);
PreparedStatement preparedStatement =
connection.prepareStatement("SELECT * FROM appointments WHERE Doctor = ?");
preparedStatement.setString(1, username);
while(resultSet.next()) {
if (status.equals("Pending")) {
data.add(details);
System.out.println(details);
appointmentList.setItems(data);
appointmentList.refresh();
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
@FXML
String appointmentDetails =
appointmentList.getSelectionModel().getSelectedItem();
updateStatus(patientName, "Confirmed");
@FXML
updateStatus(patientName, "Rejected");
@FXML
updateAllStatus("Confirmed");
@FXML
updateAllStatus("Rejected");
PreparedStatement preparedStatement =
connection.prepareStatement("UPDATE appointments SET Status = ? WHERE Doctor =
? AND Patient = ?")) {
preparedStatement.setString(1, status);
preparedStatement.setString(2, username);
preparedStatement.setString(3, patientName);
preparedStatement.executeUpdate();
e.printStackTrace();
PreparedStatement preparedStatement =
connection.prepareStatement("UPDATE appointments SET Status = ? WHERE Doctor =
?")) {
preparedStatement.setString(1, status);
preparedStatement.setString(2, username);
preparedStatement.executeUpdate();
e.printStackTrace();
@FXML
try {
Parent doctorDashboard =
FXMLLoader.load(getClass().getResource("doctorDashboard.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
@FXML
try {
loader.setLocation(getClass().getResource("appointmentStatus.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
Appointment.java
package com.example.healthcare;
import javafx.application.Application;
import javafx.stage.Stage;
this.id = id;
this.doctor = doctor;
this.patient = patient;
this.date = date;
this.time = time;
this.notes = notes;
this.status = status;
public Appointment() {
}
public int getId() {
return id;
this.id = id;
return doctor;
this.doctor = doctor;
return patient;
this.patient = patient;
return date;
return time;
this.time = time;
return notes;
this.notes = notes;
return status;
this.status = status;
}
AppointmentStatusController.java
package com.example.healthcare;
import javafx.fxml.FXML;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextArea;
import javafx.scene.control.cell.PropertyValueFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
AppointmentStatusController.username = username;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
doctorColumn.setCellValueFactory(new PropertyValueFactory<>("Doctor"));
patientColumn.setCellValueFactory(new
PropertyValueFactory<>("Patient"));
dateColumn.setCellValueFactory(new PropertyValueFactory<>("Date"));
timeColumn.setCellValueFactory(new PropertyValueFactory<>("Time"));
notesColumn.setCellValueFactory(new PropertyValueFactory<>("Notes"));
statusColumn.setCellValueFactory(new PropertyValueFactory<>("Status"));
appointmentTable.getItems().setAll(appointments);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
appointment.setId(rs.getInt("ID"));
appointment.setDoctor(rs.getString("Doctor"));
appointment.setPatient(rs.getString("Patient"));
appointment.setDate(rs.getString("Date"));
appointment.setTime(rs.getString("Time"));
appointment.setNotes(rs.getString("Notes"));
appointment.setStatus(rs.getString("Status"));
appointments.add(appointment);
} catch (SQLException e) {
System.out.println(e.getMessage());
return appointments;
AdminSignupController.java
package com.example.healthcare;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.*;
@FXML
@FXML
@FXML
@FXML
Class.forName("com.mysql.cj.jdbc.Driver");
return
DriverManager.getConnection("jdbc:mysql://localhost:3306/hospitalrecord",
"admin","password");
PreparedStatement psCheckUserExists =
connection.prepareStatement("SELECT * FROM admins_password_credentials WHERE
`User Name` = ?");
psCheckUserExists.setString(1, username);
if(resultSet.isBeforeFirst()){
alert.show();
else{
psInsert.setString(1,username);
psInsert.setString(2, password);
psInsert.executeUpdate();
FXMLLoader loader;
try {
loader = new
FXMLLoader(Functions.class.getResource(fxmlFile));
AdminDashboardController controller =
loader.getController();
controller.setUsername(username);
Stage stage = (Stage)((Node)
event.getSource()).getScene().getWindow();
stage.setTitle("Welcome!");
stage.show();
} catch (Exception e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
@FXML
signup.setOnAction(event -> {
});
login.setOnAction(event -> {
try {
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
e.printStackTrace();
});
AdminLoginController.java
package com.example.healthcare;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.*;
public class AdminLoginController{
@FXML
@FXML
@FXML
@FXML
Class.forName("com.mysql.cj.jdbc.Driver");
return
DriverManager.getConnection("jdbc:mysql://localhost:3306/hospitalrecord",
"admin","password");
PreparedStatement preparedStatement =
connection.prepareStatement("SELECT `Password` FROM admins_password_credentials
WHERE `User Name` = ?")) {
preparedStatement.setString(1, username);
if(!resultSet.next()){
alert.show();
else{
do {
if(retrievedPassword.equals(password)){
FXMLLoader loader;
try {
loader = new
FXMLLoader(Functions.class.getResource(fxmlFile));
AdminDashboardController controller =
loader.getController();
controller.setUsername(username);
stage.show();
} catch (Exception e) {
e.printStackTrace();
else{
alert.show();
} while(resultSet.next());
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
@FXML
login.setOnAction(event -> {
});
signup.setOnAction(event -> {
try {
stage.show();
} catch (IOException e) {
e.printStackTrace();
});
AdminDashboardController.java
package com.example.healthcare;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import java.io.IOException;
@FXML
@FXML
AdminDashboardController.username = username;
FXMLLoader loader;
try {
loader = new
FXMLLoader(Functions.class.getResource("hospitalDetails.fxml"));
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
e.printStackTrace();
FXMLLoader loader;
try {
loader = new
FXMLLoader(Functions.class.getResource("wardDetails.fxml"));
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
e.printStackTrace();
FXMLLoader loader;
try {
loader = new
FXMLLoader(Functions.class.getResource("medicineDetails.fxml"));
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
e.printStackTrace();
HospitalDetailsController.java
package com.example.healthcare;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.fxml.FXML;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
public HospitalDetailsController() {
this.name = name;
this.district = district;
this.generalWards = generalWards;
this.maleWards = maleWards;
this.femaleWards = femaleWards;
this.mixedWards = mixedWards;
this.paediatricWards = paediatricWards;
this.maternityWards = maternityWards;
this.icus = icus;
this.emergencyWards = emergencyWards;
this.isolationWards = isolationWards;
this.psychiatricWards = psychiatricWards;
return name;
return district;
return generalWards;
return maleWards;
}
return femaleWards;
return mixedWards;
return paediatricWards;
return maternityWards;
return icus;
return emergencyWards;
return isolationWards;
}
public int getPsychiatricWards() {
return psychiatricWards;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
int psychiatricWards =
Integer.parseInt(psychiatricWardsField.getText());
hospitals.add(hospital);
statement.setString(1, hospital.getName());
statement.setString(2, hospital.getDistrict());
statement.setInt(3, hospital.getGeneralWards());
statement.setInt(4, hospital.getMaleWards());
statement.setInt(5, hospital.getFemaleWards());
statement.setInt(6, hospital.getMixedWards());
statement.setInt(7, hospital.getPaediatricWards());
statement.setInt(8, hospital.getMaternityWards());
statement.setInt(9, hospital.getICUs());
statement.setInt(10, hospital.getEmergencyWards());
statement.setInt(11, hospital.getIsolationWards());
statement.setInt(12, hospital.getPsychiatricWards());
statement.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
public static Connection getConnection() throws SQLException,
ClassNotFoundException {
Class.forName("com.mysql.cj.jdbc.Driver");
return
DriverManager.getConnection("jdbc:mysql://localhost:3306/hospitalrecord",
"admin","password");
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
statement.setInt(1, generalWards);
statement.setInt(2, maleWards);
statement.setInt(3, femaleWards);
statement.setInt(4, mixedWards);
statement.setInt(5, paediatricWards);
statement.setInt(6, maternityWards);
statement.setInt(7, icus);
statement.setInt(8, emergencyWards);
statement.setInt(9, isolationWards);
statement.setInt(10, psychiatricWards);
statement.setString(11, hospitalName);
statement.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
@FXML
@FXML
try {
Parent patientDashboard =
FXMLLoader.load(getClass().getResource("adminDashboard.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
WardDetailsController.java
package com.example.healthcare;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class WardDetailsController{
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
statement.setString(1, hospitalName);
while (resultSet.next()) {
hospitalNameLabel.setText(resultSet.getString("Name"));
districtLabel.setText(resultSet.getString("District"));
generalWardsLabel.setText(String.valueOf(resultSet.getInt("General Wards")));
maleWardsLabel.setText(String.valueOf(resultSet.getInt("Male
Wards")));
femaleWardsLabel.setText(String.valueOf(resultSet.getInt("Female
Wards")));
mixedWardsLabel.setText(String.valueOf(resultSet.getInt("Mixed
Wards")));
paediatricWardsLabel.setText(String.valueOf(resultSet.getInt("Paediatric
Wards")));
maternityWardsLabel.setText(String.valueOf(resultSet.getInt("Maternity
Wards")));
icusLabel.setText(String.valueOf(resultSet.getInt("ICUs")));
emergencyWardsLabel.setText(String.valueOf(resultSet.getInt("Emergency
Wards")));
isolationWardsLabel.setText(String.valueOf(resultSet.getInt("Isolation
Wards")));
psychiatricWardsLabel.setText(String.valueOf(resultSet.getInt("Psychiatric
Wards")));
}
} catch (Exception e) {
e.printStackTrace();
@FXML
@FXML
try {
Parent patientDashboard =
FXMLLoader.load(getClass().getResource("adminDashboard.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
MedicineDetailsController.java
package com.example.healthcare;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
statement.setString(1, pharmacy);
statement.setString(2, district);
statement.setString(3, medicine);
statement.setString(4, available);
statement.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
Class.forName("com.mysql.cj.jdbc.Driver");
return
DriverManager.getConnection("jdbc:mysql://localhost:3306/hospitalrecord",
"admin", "password");
@FXML
@FXML
@FXML
private TextField updateMedicineTextField;
@FXML
@FXML
@FXML
statement.setString(1, available);
statement.setString(2, pharmacy);
statement.setString(3, district);
statement.setString(4, medicine);
statement.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
@FXML
@FXML
try {
Parent patientDashboard =
FXMLLoader.load(getClass().getResource("adminDashboard.fxml"));
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
Output Screenshots:
Main Screen:
Patient Login:
Patient Dashboard:
Patient Profile:
Appointment Booking Module:
Booked Appointments with Status:
Ward Availability Checking Module:
Find Nearby Hospital Module:
Search Medicine By Pharmacy:
Search Medicine by Name:
Doctor Dashboard:
Doctor Profile:
Check Appointments:
Admin Dashboard:
Hospital Table:
Storing data:
Updating the data:
Displaying ward details:
Medicine Details Module:
1. Classes and Objects: The system is modeled using classes such as Patient,
Doctor, Hospital, Pharmacy, and Appointment and
ControllerClasses for each fxml file. Each of these classes have objects
representing individual instances.
2. Encapsulation: Each class encapsulate (hide) its data (attributes) from the
outside world. For example, the Patient class can have private attributes like
patientID, name, address, and contactNumber.
3. Inheritance: If there are common attributes or methods among classes, you can
create a parent class and have other classes inherit from it. For example, both
Doctor and Patient classes could inherit from a User class that contains
common attributes like userID, name, address, and contactNumber.
4. Polymorphism: Polymorphism allows a child class to inherit the methods of its
parent class and to override them as needed. For example, if there is a User
class with a method displayDetails(), the Doctor and Patient classes
inheriting from User can override this method to display their specific details.
5. Abstraction: Abstraction can be used to hide complex implementations from the
user. For example, the process of booking an appointment can be abstracted
behind a method like bookAppointment().
Inference:
Upon completion, the e-Health Care Management System is expected to
significantly improve the healthcare experience for patients. By integrating various
healthcare services into a single platform, the system should make it easier and more
efficient for patients to manage their healthcare needs. This includes booking
appointments with doctors, locating nearby hospitals, checking ward availability, and
finding out about medicine availability in pharmacies.
In addition, the system should also provide benefits to healthcare providers by
automating administrative tasks, improving patient communication, and potentially
increasing patient engagement and satisfaction. The successful implementation of this
system could serve as a model for future digital healthcare solutions.
Future extension: