🏥 Hospital Management REST API
A Spring Boot-based backend application for managing patients, doctors, and appointment bookings in a hospital setup.
Patient Registration
Add, update, delete, and list patient records.
Doctor Listing
Get all doctors with optional filtering by specialization.
Available Appointment Slots
View available time slots for a doctor on a given date.
Book Appointment
Book a time slot with a specific doctor if available.
Java 8+
Spring Boot
Spring Data JPA
MySQL
Lombok
Maven
com.hospital
│
├── controller # REST Controllers
├── service # Business Logic
├── repository # Spring Data JPA Repositories
├── exception # Global Exception Handler
├── entity # JPA Entities
├── dto # Custom DTO classes
├── HospitalManagementApplication.java
└── application.properties
Method
Endpoint
Description
POST
/patient
Add new patient
PUT
/patient/{id}
Update patient
DELETE
/patient/{id}
Delete patient
GET
/patient
List all patients
Method
Endpoint
Description
GET
/doctor
List all doctors
GET
/doctor?specialization=Cardiology
Filter by specialization
Method
Endpoint
Description
GET
/appointments/slots?doctorId={id}&date=YYYY-MM-DD
Get available time slots
POST
/appointments/book
Book appointment with doctor
Sample Request Payload:
{
"patientId" : " 1" ,
"doctorId" : " 2" ,
"date" : " 2025-06-17" ,
"time" : " 11:00"
}
git clone https://github.com/yourusername/hospital-management-api.git
cd hospital-management-api
-Update src/main/resources/application.properties:
-spring.datasource.url =jdbc:mysql://localhost:3306/hospital
-spring.datasource.username =root
-spring.datasource.password =yourpassword
-spring.jpa.hibernate.ddl-auto =update
-spring.jpa.show-sql =true
-mvn clean install
-mvn spring-boot:run
Made with 💻 by Akrisht Yadav