The System Consists of the following Java Classes:
- HOSPITALMANAGENMENTSYSTEM: This is the main class that interacts with the user through the console. It provides options to add patients, view doctors, and book appointments.
- PATIENT: Manages operations related to patients such as adding a new patient and viewing existing patients.
- DOCTOR: Manage operations related to doctors such as viewing available doctors.
JDBC Connection
The System establishes a JDBC connection to MySQL database using the following parameters:
-> URL: jdbc:mysql://localhost:3306/hospital
-> Username: root
-> Password: root
Note: Ensure that the MySQL JDBC driver(mysql-connector-j) is available in your projects's classpath.
Usage:
- Adding a Patient:
- Choose option "1" from the main menu.
- Enter patient details when prompted(name, age, gender).
- Viewing Patient:
- Choose option "2" from the main menu.
- Displays a list of all patients stored in the database.
- Viewing Doctors:
- Choose option "3" from the main menu.
- Displays a list of all doctors and their specializations.
- Booking an Appointment:
- Choose option "4" from the main menu.
- Enter patient ID, doctor ID, and appointment date to book an appointment.
- Check if the doctor is available on the specified date before booking.
- Exist the system:
- Choose the option "5" to exit the system.
Error Handling:
-> Exceptions related to database connectivity, SQL, queries, and user input are handled using try-catch blocks.
-> Proper error messages are displayed to guide the user in case of failure.