AJP Project Report
AJP Project Report
Mini project On
Submitted by
N.MOUNISH
21CSR115
DESCRIPTION
The Hospital Management System (HMS) is a
comprehensive web-based application designed to
streamline and automate various aspects of hospital
operations. With its user-friendly interface, the system
enables efficient management of patient records,
doctor schedules, appointments, and medical services.
Patients can easily register, update their information,
and schedule appointments with doctors, reducing
waiting times and enhancing their overall experience.
Doctors benefit from the system's ability to manage
their schedules, view patient records, and provide
timely care.
TECHNOLOGY STACK
FRONT-END:
• HTML
• CSS
BACK-END
• Springboot
• Mysql
SOURCE CODE:
DemoApplication.java
package com;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication
{
public static void main(String[] args)
{
SpringApplication.run(DemoApplication.class, args);
}
}
DiseaseController.java
package com.springRest.Controller;
import com.springRest.enitity.Disease;
import com.springRest.enitity.Doctor;
import com.springRest.service.DiseaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.Transactional;
@Controller
@RequestMapping("/diseases")
public class DiseaseController {
private DiseaseService diseaseService;
public DiseaseController(DiseaseService diseaseService) {
this.diseaseService = diseaseService;
}
@GetMapping("/list")
public String listDoctors(Model theModel) {
theModel.addAttribute("diseaseList", diseaseService.getAllDiseases());
return "disease/list-disease";
}
@GetMapping("/addDisease")
public String getDoctorForm(Model model) {
Disease disease = new Disease();
model.addAttribute("disease", disease);
return "disease/addDisease";
}
@PostMapping("/save")
public String saveDoctor(@ModelAttribute("disease") Disease theDoctor) {
diseaseService.save(theDoctor);
return "redirect:/diseases/list";
}
@GetMapping("/showFormForUpdate")
public String showUpdateForm(@RequestParam("diseaseId") int theID, Model model) {
model.addAttribute("disease", diseaseService.findById(theID));
return "disease/addDisease";
}
@Autowired
@PersistenceContext
private EntityManager em;
@GetMapping("/delete")
@Transactional
public String deleteDoctor(@RequestParam("diseaseId") int theID) {
Disease a = em.find(Disease.class, theID);
for (Doctor b : a.getDoctors()) {
if (b.getDisease() != null) {
em.remove(a);
}
}
em.remove(a);
return "redirect:/diseases/list";
}
}
DoctorController.java
package com.springRest.Controller;
import com.springRest.enitity.Doctor;
import com.springRest.service.DiseaseService;
import com.springRest.service.DoctorService;
import com.springRest.service.PatientService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Controller
@RequestMapping("/doctors")
public class DoctorController
{
private DoctorService doctorService;
private DiseaseService diseaseService;
private List<Doctor> theDoctors;
public DoctorController(DoctorService doctorService, PatientService patientService,
DiseaseService diseaseService)
{
this.doctorService = doctorService;
this.diseaseService = diseaseService;
}
@GetMapping("/list")
public String listDoctors(Model theModel)
{
theDoctors = doctorService.getAllDoctors();
theModel.addAttribute("doctors", theDoctors);
//theModel.addAttribute("diseaseList",diseaseService.getAllDiseases());
return "doctors/list-doctors";
}
@GetMapping("/addDoctor")
public String getDoctorForm(Model model)
{
Doctor Doctor = new Doctor();
model.addAttribute("diseaseList",diseaseService.getAllDiseases());
model.addAttribute("doctor",Doctor);
return "doctors/addDoctor";
}
@PostMapping("/save")
public String saveDoctor(@ModelAttribute("doctor") Doctor theDoctor)
{
doctorService.save(theDoctor);
return "redirect:/doctors/list"; }
@GetMapping("/showFormForUpdate")
public String showUpdateForm(@RequestParam("doctorId") int theID,Model model)
{
Doctor doctor = doctorService.findById(theID);
model.addAttribute("diseaseList",diseaseService.getAllDiseases());
model.addAttribute("doctor",doctor);
return "doctors/addDoctor";
}
@GetMapping("/delete")
public String deleteDoctor(@RequestParam("doctorId") int theID)
{
doctorService.deleteById(theID);
return "redirect:/doctors/list";
}
}
HomeController.java
package com.springRest.Controller;
import com.springRest.enitity.Contact;
import com.springRest.enitity.User;
import com.springRest.service.ContactService;
import com.springRest.service.RoleService;
import com.springRest.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("Home")
public class HomeController
{
private ContactService contactService;
private UserService userService;
private RoleService roleService;
public HomeController(RoleService roleService, ContactService contactService,UserService
userService)
{
this.contactService = contactService;
this.userService = userService;
this.roleService = roleService;
}
@GetMapping("/")
public String getHomePage(Model model)
{
return "Home/home";
}
@GetMapping("/home-page")
public String sayHello(Model model)
{
model.addAttribute("date",new java.util.Date());
return "Home/home";
}
@GetMapping("/login")
public String login()
{
return "Login/Login";
@GetMapping("/signUP")
public String signUP(Model model)
{
User user = new User();
model.addAttribute("user",user);
model.addAttribute("roleList",roleService.getRoles());
return "Register/sign-up";
}
@PostMapping("/register-user")
public String registerNewUser(@ModelAttribute("user") User user)
{
userService.save(user);
return "redirect:/Home/home-page";
}
@GetMapping("/contact-US")
public String getContactPage(Model model)
{
Contact contact = new Contact();
model.addAttribute("contact", contact);
return "contact-US/contact-US";
}
@PostMapping("/save-contact")
public String reciveContact(@ModelAttribute("contact") Contact contact)
{
try
{
contactService.save(contact);
return "redirect:/Home/home-page";
}catch (Exception e)
{
e.printStackTrace();
}
return "redirect:/Home/home-page";
}
}
HomeController.java
package com.springRest.Controller;
import com.springRest.enitity.Contact;
import com.springRest.enitity.User;
import com.springRest.service.ContactService;
import com.springRest.service.RoleService;
import com.springRest.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("Home")
public class HomeController
{
private ContactService contactService;
private UserService userService;
private RoleService roleService;
public HomeController(RoleService roleService, ContactService contactService,
UserService userService)
{
this.contactService = contactService;
this.userService = userService;
this.roleService = roleService;
}
@GetMapping("/")
public String getHomePage(Model model)
{
return "Home/home";
}
@GetMapping("/home-page")
public String sayHello(Model model)
{
model.addAttribute("date",new java.util.Date());
return "Home/home";
}
@GetMapping("/login")
public String login()
{
return "Login/Login";
}
@GetMapping("/signUP")
public String signUP(Model model)
{
User user = new User();
model.addAttribute("user",user);
model.addAttribute("roleList",roleService.getRoles());
return "Register/sign-up";
}
@PostMapping("/register-user")
public String registerNewUser(@ModelAttribute("user") User user)
{
userService.save(user);
return "redirect:/Home/home-page";
}
@GetMapping("/contact-US")
public String getContactPage(Model model)
{
Contact contact = new Contact();
model.addAttribute("contact", contact);
return "contact-US/contact-US";
}
@PostMapping("/save-contact")
public String reciveContact(@ModelAttribute("contact") Contact contact)
{
try
{
contactService.save(contact);
return "redirect:/Home/home-page";
}catch (Exception e)
{
e.printStackTrace();
}
return "redirect:/Home/home-page";
}
}
MedicineController.java
package com.springRest.Controller;
//import com.springRest.DAO.MedicineRepository;
import com.springRest.enitity.Medicine;
import com.springRest.enitity.Patient;
import com.springRest.service.MedicineService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.domain.PageRequest;
//import org.springframework.data.domain.Sort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
//import javax.servlet.http.HttpServletRequest;
import javax.persistence.EntityManager;
import java.util.List;
@Controller
@RequestMapping("/medicines")
public class MedicineController
{
private MedicineService medicineService;
private List<Medicine> themedicines;
@Autowired
private EntityManager em;
public MedicineController(MedicineService medicineService)
{
//this.medicineRepository = medicineRepository;
this.medicineService = medicineService;
}
@GetMapping("/list")
public String listmedicines(Model theModel)
{
//HttpServletRequest request,
// int page = 0; //default page number is 0 (yes it is weird)
// int size = 10; //default page size is 10
//
// if (request.getParameter("page") != null && !request.getParameter("page").isEmpty())
{
// page = Integer.parseInt(request.getParameter("page")) - 1;
// }
//
// if (request.getParameter("size") != null && !request.getParameter("size").isEmpty()) {
// size = Integer.parseInt(request.getParameter("size"));
// }
themedicines = medicineService.getAllmedicines();
//medicineRepository.findAll(PageRequest.of(page, size))
theModel.addAttribute("medicines", themedicines);
return "medicine/list-medicines";
}
@GetMapping("/addMedicine")
public String getmedicineForm(Model model)
{
Medicine themedicine = new Medicine();
model.addAttribute("medicine",themedicine);
return "medicine/addMedicine";
}
@PostMapping("/save")
public String savemedicine(@ModelAttribute("medicine") Medicine themedicine)
{
medicineService.save(themedicine);
return "redirect:/medicines/list";
}
@GetMapping("/showFormForUpdate")
public String showUpdateForm(@RequestParam("medicineId") int theID,Model model)
{
Medicine medicine = medicineService.findById(theID);
model.addAttribute("medicine",medicine);
return "medicine/addMedicine";
}
@GetMapping("/delete")
public String deletemedicine(@RequestParam("medicineId") int theID)
{
Medicine a = em.find(Medicine.class, theID);
for (Patient b : a.getPatientList()) {
if (b.getMedicineList().size() == 1) {
em.remove(b);
} else {
b.getMedicineList().remove(a);
}
}
em.remove(a);
medicineService.deleteById(theID);
return "redirect:/medicines/list";
}}
PatientController.java
package com.springRest.Controller;
import java.util.List;
import com.springRest.enitity.Patient;
import com.springRest.service.DiseaseService;
import com.springRest.service.DoctorService;
import com.springRest.service.PatientService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping("/patients")
public class PatientController
{
private PatientService patientService;
private DoctorService doctorService;
private List<Patient> thePatients;
public PatientController(PatientService patientService, DoctorService doctorService,
DiseaseService diseaseService)
{
this.patientService = patientService;
this.doctorService = doctorService;
}
@GetMapping("/list")
public String listEmployees(Model theModel)
{
thePatients = patientService.getAllPatients();
theModel.addAttribute("patients", thePatients);
return "patients/list-patients";
}
@GetMapping("/addPatient")
public String getPatientForm(Model model)
{
Patient patient = new Patient();
model.addAttribute("doctorList",doctorService.getAllDoctors());
model.addAttribute("patient",patient);
return "patients/addPatient";
}
@PostMapping("/save")
public String savePatient(@ModelAttribute("patient") Patient thePatient)
{
patientService.save(thePatient);
return "redirect:/patients/list";
}
@GetMapping("/showFormForUpdate")
public String showUpdateForm(@RequestParam("patientId") int theID,Model model)
{
Patient patient = patientService.findById(theID);
model.addAttribute("doctorList",doctorService.getAllDoctors());
model.addAttribute("patient",patient);
return "patients/addPatient";
}
@GetMapping("/delete")
public String deletePatient(@RequestParam("patientId") int theID)
{
patientService.deleteById(theID);
return "redirect:/patients/list";
}
}
PatientRepository.java
package com.springRest.DAO;
import com.springRest.enitity.Patient;
import org.springframework.data.jpa.repository.JpaRepository;
public interface PatientRepository extends JpaRepository<Patient, Integer>
{
}
DoctorRepository.java
package com.springRest.DAO;
import com.springRest.enitity.Doctor;
import org.springframework.data.jpa.repository.JpaRepository;
public interface DoctorRepository extends JpaRepository<Doctor, Integer>
{
}
MedicineRepository.java
package com.springRest.DAO;
import com.springRest.enitity.Medicine;
import org.springframework.data.jpa.repository.JpaRepository;
public interface MedicineRepository extends JpaRepository<Medicine, Integer>
{
}
EmployeeRepository.java
package com.springRest.DAO;
import com.springRest.enitity.Employee;
import org.springframework.data.jpa.repository.JpaRepository;
public interface EmployeeRepository extends JpaRepository<Employee, Integer>
{
}
Doctor.java
package com.springRest.enitity;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Entity
@Table(name = "doctor")
public class Doctor
{
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
@Column(name="id")
private int id;
@Column(name="doctor_name")
private String Name;
@Column(name="father_name")
private String fatherName;
@Column(name="gender")
private String Gender;
@Column(name="cnic")
private String cnic;
@Column(name="email")
private String email;
@Column(name="date_of_birth")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date dateOfBirth;
@ManyToOne(cascade =
{CascadeType.DETACH, CascadeType.MERGE,
CascadeType.PERSIST, CascadeType.REFRESH})
@JoinColumn(name = "disease_id")
private Disease disease;
@OneToMany(fetch = FetchType.LAZY,
mappedBy = "doctor",
cascade = {CascadeType.DETACH, CascadeType.MERGE,
CascadeType.PERSIST, CascadeType.REFRESH})
public List<Patient> patients;
public Doctor()
{
}
public Doctor(String name, String fatherName, String gender, String CNIC, String email,
Date dateOfBirth) {
Name = name;
this.fatherName = fatherName;
Gender = gender;
this.cnic = CNIC;
this.email = email;
this.dateOfBirth = dateOfBirth; // This line causes the warning
}
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public String getName()
{
return Name;
}
public void setName(String name)
{
Name = name;
}
public String getFatherName()
{
return fatherName;
}
public void setFatherName(String fatherName)
{
this.fatherName = fatherName;
}
public String getGender()
{
return Gender;
}
public void setGender(String gender)
{
Gender = gender;
}
public String getCnic()
{
return cnic;
}
public void setCnic(String cnic)
{
this.cnic = cnic;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
public Date getDateOfBirth()
{
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth)
{
this.dateOfBirth = dateOfBirth;
}
public List<Patient> getPatients()
{
return patients;
}
public void setPatients(List<Patient> patients)
{
this.patients = patients;
}
public Disease getDisease()
{
return disease;
}
public void setDisease(Disease disease)
{
this.disease = disease;
}
public void addPatient(Patient patient)
{
if(patients==null)
{
patients = new ArrayList<>();
}
patients.add(patient);
patient.setDoctor(this);
}
@Override
public String toString()
{
return "Doctor{" +
"id=" + id +
", Name='" + Name + '\'' +
", FatherName='" + fatherName + '\'' +
", Gender='" + Gender + '\'' +
", CNIC='" + cnic + '\'' +
", email='" + email + '\'' +
'}';
}
}
Doctor.java
package com.springRest.enitity;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Entity
@Table(name = "doctor")
public class Doctor
{
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
@Column(name="id")
private int id;
@Column(name="doctor_name")
private String Name;
@Column(name="father_name")
private String fatherName;
@Column(name="gender")
private String Gender;
@Column(name="cnic")
private String cnic;
@Column(name="email")
private String email;
@Column(name="date_of_birth")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date dateOfBirth;
@ManyToOne(cascade =
{CascadeType.DETACH, CascadeType.MERGE,
CascadeType.PERSIST, CascadeType.REFRESH})
@JoinColumn(name = "disease_id")
private Disease disease;
@OneToMany(fetch = FetchType.LAZY,
mappedBy = "doctor",
cascade = {CascadeType.DETACH, CascadeType.MERGE,
CascadeType.PERSIST, CascadeType.REFRESH})
public List<Patient> patients;
public Doctor()
{
}
public Doctor(String name, String fatherName, String gender, String CNIC, String email,
Date dateOfBirth) {
Name = name;
this.fatherName = fatherName;
Gender = gender;
this.cnic = CNIC;
this.email = email;
this.dateOfBirth = dateOfBirth; // This line causes the warning
}
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public String getName()
{
return Name;
}
public void setName(String name)
{
Name = name;
}
public String getFatherName()
{
return fatherName;
}
public void setFatherName(String fatherName)
{
this.fatherName = fatherName;
}
public String getGender()
{
return Gender;
}
void setGender(String gender)
{
Gender = gender;
}
public String getCnic()
{
return cnic;
}
public void setCnic(String cnic)
{
this.cnic = cnic;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
public Date getDateOfBirth()
{
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth)
{
this.dateOfBirth = dateOfBirth;
}
public List<Patient> getPatients()
{
return patients;
}
public void setPatients(List<Patient> patients)
{
this.patients = patients;
}
public Disease getDisease()
{
return disease;
}
public void setDisease(Disease disease)
{
this.disease = disease;
}
public void addPatient(Patient patient)
{
if(patients==null)
{
patients = new ArrayList<>();
}
patients.add(patient);
patient.setDoctor(this);
}
@Override
public String toString()
{
return "Doctor{" +
"id=" + id +
", Name='" + Name + '\'' +
", FatherName='" + fatherName + '\'' +
", Gender='" + Gender + '\'' +
", CNIC='" + cnic + '\'' +
", email='" + email + '\'' +
'}'; }}
Diseases.java
package com.springRest.enitity;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Entity
@Table(name = "disease")
public class Disease
{
@javax.persistence.Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
@Column(name="id")
private int Id;
@Column(name="disease_name")
private String diseaseName;
@Column(name="description")
private String description;
@OneToMany(fetch = FetchType.LAZY,
mappedBy = "disease",
cascade = {CascadeType.DETACH, CascadeType.MERGE,
CascadeType.PERSIST, CascadeType.REFRESH})
public List<Doctor> doctors;
@ManyToMany(fetch = FetchType.LAZY,
cascade = {CascadeType.DETACH, CascadeType.MERGE,
CascadeType.PERSIST, CascadeType.REFRESH})
@JoinTable(name = "patient_disease",
joinColumns = @JoinColumn(name = "disease_id"),
inverseJoinColumns = @JoinColumn(name = "patient_id"))
private List<Patient> patientList;
public Disease()
{
}
public Disease(String name, String discription)
{
this.diseaseName = name;
this.description = discription;
}
public List<Doctor> getDoctors()
{
return doctors;
}
public void setDoctors(List<Doctor> doctors)
{
this.doctors = doctors;
}
public void addDoctor(Doctor doctor)
{
if(doctors == null)
{
doctors = new ArrayList<>();
}
doctors.add(doctor);
}
public void addPatient(Patient patient)
{
if(patientList == null)
{
patientList = new ArrayList<>();
}
patientList.add(patient);
}
public Disease(int id, String name, String discription)
{
this.Id = id;
this.diseaseName = name;
this.description = discription;
}
PatientService.java
package com.springRest.service;
import com.springRest.DAO.PatientRepository;
import com.springRest.enitity.Patient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class PatientService {
private final PatientRepository patientRepository;
@Autowired
public PatientService(PatientRepository patientRepository) {
this.patientRepository = patientRepository;
}
public List<Patient> getAllPatients() {
return patientRepository.findAll();
}
public Patient save(Patient patient) {
return patientRepository.save(patient);
}
public Patient findById(int id) {
Optional<Patient> patientOptional = patientRepository.findById(id);
return patientOptional.orElse(null);
}
public void deleteById(int id) {
patientRepository.deleteById(id);
}
}
DoctorService.java
package com.springRest.service;
import com.springRest.DAO.DoctorRepository;
import com.springRest.enitity.Doctor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class DoctorService
{
private DoctorRepository doctorRepository;
DiseasesService.java
package com.springRest.service;
import com.springRest.DAO.PatientRepository;
import com.springRest.enitity.Patient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class PatientService {
private final PatientRepository patientRepository;
@Autowired
public PatientService(PatientRepository patientRepository) {
this.patientRepository = patientRepository;
}
public List<Patient> getAllPatients() {
return patientRepository.findAll();
}
public Patient save(Patient patient) {
return patientRepository.save(patient);
}
public Patient findById(int id) {
Optional<Patient> patientOptional = patientRepository.findById(id);
return patientOptional.orElse(null);
}
public void deleteById(int id) {
patientRepository.deleteById(id);
}}
MedicinesService.java
package com.springRest.service;
import com.springRest.DAO.MedicineRepository;
import com.springRest.enitity.Medicine;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class MedicineService
{
private MedicineRepository medicineRepository;
public MedicineService(MedicineRepository medicineRepository)
{
this.medicineRepository = medicineRepository;
}
public List<Medicine> getAllmedicines()
{
List<Medicine> medicineList = medicineRepository.findAll();
return medicineList;
}
public void save(Medicine medicine)
{
medicineRepository.save(medicine);
}
public Medicine findById(int id)
{
Medicine newmedicine =null;
Optional<Medicine> medicine = medicineRepository.findById(id);
if(medicine.isPresent())
{
newmedicine = medicine.get();
}
return newmedicine;
}
public void deleteById(int id)
{
medicineRepository.deleteById(id);
}
}
Homepage.html
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,
shrink-to-fit=no">
<title>Untitled</title>
<link rel="stylesheet" href="/Footer/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/Footer/fonts/ionicons.min.css">
<link rel="stylesheet" href="/Footer/css/Article-List.css">
<link rel="stylesheet" href="/Footer/css/Footer-Dark.css">
<link rel="stylesheet" href="/Footer/css/styles.css">
<link rel="stylesheet" href="/nav-bar/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/nav-bar/css/Contact-Form-Clean.css">
<link rel="stylesheet" href="/nav-bar/css/Login-Form-Dark.css">
<link rel="stylesheet" href="/nav-bar/css/Navigation-with-Button.css">
<link rel="stylesheet" href="/nav-bar/css/Registration-Form-with-
Photo.css">
<link rel="stylesheet" href="/nav-bar/css/styles.css">
<link rel="stylesheet" href="/nav-bar/css/Team-Boxed.css">
<link rel="stylesheet" href="/Home/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/Home/fonts/font-awesome.min.css">
<link rel="stylesheet" href="/Home/css/Article-List.css">
<link rel="stylesheet" href="/Home/css/styles.css">
</head>
<body>
<div th:replace="fragments/nav-bar/nav-bar :: nav"></div>
<div class="article-list">
<div class="container">
<div class="intro">
<h2 class="text-center">Kongu Hospital </h2>
<p class="text-center">Currently, hospitals are largely staffed
by professional physicians, surgeons,
nurses, and allied health practitioners, whereas in the
past, this work was usually performed by the
members of founding religious orders or by volunteers</p>
</div>
<div class="row articles">
<div class="col-sm-6 col-md-4 item"><a href="#"><img
class="img-fluid" src="/Home/img/1.jpg"></a>
<h3 class="name">Doctor</h3>
<p class="description">Doctors make people healthier. When
people get sick, doctors figure out why. They
give people medicine and other kinds of treatment. They
also give advice about diet, exercise, and
sleep.</p><a class="action" href="#"><i class="fa fa-
arrow-circle-right"></i></a></div>
<div
class="col-sm-6 col-md-4 item"><a href="#"><img
class="img-fluid" src="/Home/img/2.jpg"></a>
<h3 class="name">Hospital</h3>
<p class="description">A hospital is a health care
institution providing patient treatment with
specialized medical and nursing staff and medical
equipment.</p><a class="action" href="#"><i
class="fa fa-arrow-circle-right"></i></a></div>
<div
class="col-sm-6 col-md-4 item"><a href="#"><img
class="img-fluid" src="/Home/img/3.jpg"></a>
<h3 class="name">Medicines</h3>
<p class="description">Pharmacy is the science and
technique of preparing, dispensing, and reviewing
drugs and providing additional clinical services. It is
a health profession that links health
sciences with pharmaceutical sciences and aims to
ensure the safe, effective, and affordable use of
drugs.</p><a class="action" href="#"><i class="fa fa-
arrow-circle-right"></i></a></div>
</div>
</div>
</div>
<script src="/Home/js/jquery.min.js"></script>
<script src="/Home/bootstrap/js/bootstrap.min.js"></script>
<div th:replace="fragments/Footer/Footer :: footer"></div>
</body>
</html>
Patients.html
<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,
shrink-to-fit=no">
<body>
<div th:replace="fragments/nav-bar/nav-bar :: nav"></div>
<div class="form-row">
<div class="form-group col-md-3"></div>
<div class="form-group col-md-6">
<div class="container">
<h3>Patient Directory</h3>
<br>
<select th:field="*{gender}"
class="form-control mb-4 col-10"
placeholder="Gender">
<option th:value="'Male'" th:text="Male"></option>
<option th:value="'Female'" th:text="Female"></option>
</select>
<input type="text" th:field="*{CNIC}"
class="form-control mb-4 col-10" placeholder="CNIC">
<select th:field="*{doctor}"
class="form-control mb-4 col-10"
placeholder="Select Doctor">
<option th:each="tempDoctor : ${doctorList}"
th:value="${tempDoctor.id}" th:text="${tempDoctor.name}"></option>
</select>
<!--<select
class="form-control mb-4 col-4" placeholder="Select
Doctor">
<option th:each="tempDoctor : ${doctorList}"
th:value="${tempDoctor}" th:text="${tempDoctor}"></option>
</select>-->
<button type="submit" class="btn btn-info col-
4">Save</button>
</form>
<br>
<a th:href="@{/patients/list}">Back to Patient List</a>
</div>
</div>
<div class="form-group col-md-3"></div>
</div>
<div th:replace="fragments/Footer/Footer :: footer"></div>
</body>
</html>
Doctor.html
<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,
shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.
css" integrity="sha384-
GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
crossorigin="anonymous">
<link rel="stylesheet" href="/Footer/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/Footer/fonts/ionicons.min.css">
<link rel="stylesheet" href="/Footer/css/Article-List.css">
<link rel="stylesheet" href="/Footer/css/Footer-Dark.css">
<link rel="stylesheet" href="/Footer/css/styles.css">
<link rel="stylesheet" href="/nav-bar/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/nav-bar/css/Contact-Form-Clean.css">
<link rel="stylesheet" href="/nav-bar/css/Login-Form-Dark.css">
<link rel="stylesheet" href="/nav-bar/css/Navigation-with-Button.css">
<link rel="stylesheet" href="/nav-bar/css/Registration-Form-with-
Photo.css">
<link rel="stylesheet" href="/nav-bar/css/styles.css">
<link rel="stylesheet" href="/nav-bar/css/Team-Boxed.css">
<title>Save doctor</title>
</head>
<body>
<div th:replace="fragments/nav-bar/nav-bar :: nav"></div>
<div class="form-row">
<div class="form-group col-md-3"></div>
<div class="form-group col-md-6">
<div class="container">
<h3>Doctor Directory</h3>
<br>
<p class="h4 mb-10">Save doctor</p>
<select th:field="*{gender}"
class="form-control mb-4 col-10"
placeholder="Gender">
<option th:value="'Male'" th:text="Male"></option>
<option th:value="'Female'" th:text="Female"></option>
</select>
<input type="text" th:field="*{cnic}"
class="form-control mb-4 col-10" placeholder="CNIC">
<select th:field="*{disease}"
class="form-control mb-4 col-10"
placeholder="Select Doctor">
<option th:each = "tempDisease : ${diseaseList}"
th:value="${tempDisease.id}" th:text="${tempDisease.diseaseName} + '
spacialist'"></option>
</select>
</form>
<br>
<a th:href="@{/doctors/list}">Back to Doctors List</a>
</div>
</div>
<div class="form-group col-md-3"></div>
</div>
<div th:replace="fragments/Footer/Footer :: footer"></div>
</body>
</html>
Disease.html
<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,
shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.
css" integrity="sha384-
GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
crossorigin="anonymous">
<link rel="stylesheet" href="/Footer/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/Footer/fonts/ionicons.min.css">
<link rel="stylesheet" href="/Footer/css/Article-List.css">
<link rel="stylesheet" href="/Footer/css/Footer-Dark.css">
<link rel="stylesheet" href="/Footer/css/styles.css">
<link rel="stylesheet" href="/nav-bar/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/nav-bar/css/Contact-Form-Clean.css">
<link rel="stylesheet" href="/nav-bar/css/Login-Form-Dark.css">
<link rel="stylesheet" href="/nav-bar/css/Navigation-with-Button.css">
<link rel="stylesheet" href="/nav-bar/css/Registration-Form-with-
Photo.css">
<link rel="stylesheet" href="/nav-bar/css/styles.css">
<link rel="stylesheet" href="/nav-bar/css/Team-Boxed.css">
<title>Save disease</title>
</head>
<body>
<div class="form-row">
<div class="form-group col-md-3">
</div>
<div class="form-group col-md-6">
<div class="container">
<h3>disease Directory</h3>
<br>
<p class="h4 mb-12">Save disease</p>
<form action="#" th:action="@{/diseases/save}"
th:object="${disease}" method="POST">
<!-- Add hidden form field to handle update -->
<input type="hidden" th:field="*{id}" />
<input type="text" th:field="*{diseaseName}"
class="form-control mb-4 col-10"
placeholder="Disease Name">
<input type="text" th:field="*{discription}"
class="form-control mb-4 col-10"
placeholder="Discription">
<button type="submit" class="btn btn-info col-
4">Save</button>
</form>
<br>
<a th:href="@{/diseases/list}">Back to Disease List</a>
</div>
</div>
<div class="form-group col-md-3">
</div>
</div>
</body>
</html>
Medicines.html
<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,
shrink-to-fit=no">
<link rel="stylesheet" href="/Footer/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/Footer/fonts/ionicons.min.css">
<link rel="stylesheet" href="/Footer/css/Article-List.css">
<link rel="stylesheet" href="/Footer/css/Footer-Dark.css">
<link rel="stylesheet" href="/Footer/css/styles.css">
<link rel="stylesheet" href="/nav-bar/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/nav-bar/css/Contact-Form-Clean.css">
<link rel="stylesheet" href="/nav-bar/css/Login-Form-Dark.css">
<link rel="stylesheet" href="/nav-bar/css/Navigation-with-Button.css">
<link rel="stylesheet" href="/nav-bar/css/Registration-Form-with-
Photo.css">
<link rel="stylesheet" href="/nav-bar/css/styles.css">
<link rel="stylesheet" href="/nav-bar/css/Team-Boxed.css">
<title>Save medicine</title>
</head>
<body>
<div th:replace="fragments/nav-bar/nav-bar :: nav"></div>
<div class="form-row">
<div class="form-group col-md-3"></div>
<div class="form-group col-md-6">
<div class="container">
<h3>medicine Directory</h3>
<br>
<p class="h4 mb-10">Save medicine</p>
<form action="#" th:action="@{/medicines/save}"
th:object="${medicine}" method="POST">
<!-- Add hidden form field to handle update -->
<input type="hidden" th:field="*{id}" />
<input type="text" th:field="*{name}"
class="form-control mb-4 col-10"
placeholder="Medicine name">
<input type="text" th:field="*{companyName}"
class="form-control mb-4 col-10"
placeholder="Company name">
<input type="date" th:field="${medicine.manufactureDate}"
class="form-control mb-4 col-10"
placeholder="Manufacture Date">
<input type="date" th:field="${medicine.expiryDate}"
class="form-control mb-4 col-10" placeholder="Expiry
Date">
<input type="text" th:field="*{type}"
class="form-control mb-4 col-10"
placeholder="Tablet, Capsole , ani-biotik">
<button type="submit" class="btn btn-info col-
4">Save</button>
</form>
<br>
<a th:href="@{/medicines/list}">Back to Medicines List</a>
</div>
</div>
<div class="form-group col-md-3"></div>
</div>
<div th:replace="fragments/Footer/Footer :: footer"></div>
</body>
</html>
Application.properties:
spring.h2.console.enabled=true
server.port=8000
spring.datasource.url=jdbc:mysql://localhost:3306/app?allowPublicKeyRetrieval=true&useS
SL=false&serverTimezone=UTC
spring.datasource.password=Mylaptop1234
spring.datasource.username=root
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
Output:
Result:
The Project will deliver a visually appealing hospital management webpage with
user-friendly booking form,integrating Mysql for data storage.It will feature a responsive
design and a robust spring Boot backend, ensuring efficient handling of booking and a
seemless user experience