A RESTful Hospital Management System developed using Spring Boot, Spring Data JPA, Hibernate, and MySQL. The application provides APIs for managing hospitals, doctors, patients, and appointments while demonstrating CRUD operations, entity relationships, layered architecture, and centralized exception handling.
The Hospital Management System is designed to streamline hospital administration by managing hospitals, doctors, patients, and appointments through REST APIs.
This project follows a layered architecture consisting of:
- Controller Layer
- Service Layer
- Repository Layer
- Model Layer
It demonstrates backend development using Spring Boot and database integration using Spring Data JPA and MySQL.
- Create Hospital
- View All Hospitals
- Get Hospital by ID
- Search Hospital by Name
- Search Hospitals by Location
- Update Hospital
- Delete Hospital
- Add Doctor
- View All Doctors
- Search Doctor by ID
- Search Doctors by Hospital
- Search Doctors by Name
- Search Doctors by Specialization
- Update Doctor
- Delete Doctor
- Register Patient
- View All Patients
- Get Patient by ID
- Search Patient by Doctor
- Search Patient by Hospital
- Search Patient by Phone Number
- Update Patient
- Delete Patient
- Schedule Appointment
- View All Appointments
- Get Appointment by ID
- View Appointments by Doctor
- View Appointments by Patient
- View Appointments by Date
- View Appointments by Status
- Update Appointment
- Cancel Appointment
- RESTful API Development
- Layered Architecture
- Spring Data JPA
- Hibernate ORM
- MySQL Database Integration
- Global Exception Handling
- Custom Repository Query Methods
- Java
- Spring Boot
- Spring Data JPA
- Hibernate
- MySQL
- Maven
- Lombok
- Postman
- Eclipse IDE
src
βββ main
βββ java
β βββ com.vcube.hospitalmanagementapp
β βββ controller
β βββ service
β βββ serviceimpl
β βββ repo
β βββ model
β βββ exception
β βββ MedicoreApplication.java
β
βββ resources
βββ application.properties
hospital
- Hospital
- Doctor
- Patient
- Appointment
- One Hospital β Many Doctors
- One Doctor β Many Appointments
- One Patient β Many Appointments
| Method | Endpoint | Description |
|---|---|---|
| POST | /hospital/api/v1/savehospital |
Create Hospital |
| GET | /hospital/api/v1/getAllHospitals |
Get All Hospitals |
| GET | /hospital/api/v1/getHospitalById/{hospitalId} |
Get Hospital by ID |
| GET | /hospital/api/v1/getHospitalByName/{hospitalName} |
Search Hospital by Name |
| GET | /hospital/api/v1/getHospitalByLocation/{location} |
Search Hospital by Location |
| PUT | /hospital/api/v1/updateHospital/{hospitalId} |
Update Hospital |
| DELETE | /hospital/api/v1/deleteHospital/{hospitalId} |
Delete Hospital |
| Method | Endpoint | Description |
|---|---|---|
| POST | /doctor/api/v1/saveDoctor |
Add Doctor |
| GET | /doctor/api/v1/getAllDoctors |
Get All Doctors |
| GET | /doctor/api/v1/getDoctorById/{doctorId} |
Get Doctor by ID |
| GET | /doctor/api/v1/getDoctorsByHospital/{hospitalId} |
Get Doctors by Hospital |
| GET | /doctor/api/v1/getDoctorName/{doctorName} |
Search Doctor by Name |
| GET | /doctor/api/v1/getBySpecialization/{specialization} |
Search Doctor by Specialization |
| PUT | /doctor/api/v1/updateDoctor/{doctorId} |
Update Doctor |
| DELETE | /doctor/api/v1/deleteDoctor/{doctorId} |
Delete Doctor |
| Method | Endpoint | Description |
|---|---|---|
| POST | /patient/api/v1/savePatient |
Register Patient |
| GET | /patient/api/v1/getAllPatients |
Get All Patients |
| GET | /patient/api/v1/getPatientById/{patientId} |
Get Patient by ID |
| GET | /patient/api/v1/getPatientByDoctor/{doctorId} |
Get Patient by Doctor |
| GET | /patient/api/v1/getPatientByHospital/{hospitalId} |
Get Patient by Hospital |
| GET | /patient/api/v1/getPatientByPhone/{phone} |
Get Patient by Phone |
| PUT | /patient/api/v1/updatePatient/{patientId} |
Update Patient |
| DELETE | /patient/api/v1/deletePatient/{patientId} |
Delete Patient |
| Method | Endpoint | Description |
|---|---|---|
| POST | /appointment/api/v1/saveAppointment |
Create Appointment |
| GET | /appointment/api/v1/getAllAppointments |
Get All Appointments |
| GET | /appointment/api/v1/getAppointmentById/{appointmentId} |
Get Appointment by ID |
| GET | /appointment/api/v1/getAppointmentsByDoctor/{doctorId} |
Get Appointments by Doctor |
| GET | /appointment/api/v1/getAppointmentsByPatient/{patientId} |
Get Appointments by Patient |
| GET | /appointment/api/v1/getAppointmentsByDate/{appointmentDate} |
Get Appointments by Date |
| GET | /appointment/api/v1/getAppointmentsByStatus/{status} |
Get Appointments by Status |
| PUT | /appointment/api/v1/updateAppointment/{appointmentId} |
Update Appointment |
| DELETE | /appointment/api/v1/deleteAppointment/{appointmentId} |
Delete Appointment |
Configure your database in:
application.properties
Example:
spring.datasource.url=jdbc:mysql://localhost:3306/hospital
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=truegit clone https://github.com/venky4378/Medicore.gitImport the project into Eclipse or IntelliJ IDEA.
Create the MySQL database and update the credentials in application.properties.
Run the MedicoreApplication.java class.
Use Postman to test the REST APIs.
- Spring Boot
- REST API Development
- Spring Data JPA
- Hibernate ORM
- CRUD Operations
- Layered Architecture
- Dependency Injection
- Entity Relationships
- Repository Pattern
- Exception Handling
- Custom Query Methods
- Maven Project Structure
- Spring Security
- JWT Authentication
- Swagger/OpenAPI Documentation
- Request Validation
- Pagination & Sorting
- Logging (SLF4J)
- Unit Testing (JUnit & Mockito)
- Docker Support
- React Frontend
- Role-Based Access Control (Admin, Doctor, Patient)
Swamy Ch
GitHub
If you found this project useful, please consider giving this repository a β on GitHub.