Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ hospital-api

A Spring Boot REST API for managing hospital operations, developed as part of a university coursework project. The system handles users, doctors, appointments, and medical reports with full CRUD functionality and secure access.


πŸ“‚ Project Structure

hospital-api/
└── hospital-coursework/
β”œβ”€β”€ .gitignore
β”œβ”€β”€ mvnw / mvnw.cmd
β”œβ”€β”€ pom.xml
β”œβ”€β”€ .mvn/
β”‚ └── wrapper/
β”‚ β”œβ”€β”€ maven-wrapper.jar
β”‚ └── maven-wrapper.properties
└── src/
β”œβ”€β”€ main/
β”‚ β”œβ”€β”€ java/
β”‚ β”‚ └── com/
β”‚ β”‚ └── brovko/
β”‚ β”‚ └── hospitalcoursework/
β”‚ β”‚ β”œβ”€β”€ HospitalCourseworkApplication.java
β”‚ β”‚ β”œβ”€β”€ configuration/
β”‚ β”‚ β”‚ └── security/
β”‚ β”‚ β”‚ β”œβ”€β”€ AuthenticationFacade.java
β”‚ β”‚ β”‚ β”œβ”€β”€ IAuthenticationFacade.java
β”‚ β”‚ β”‚ β”œβ”€β”€ MyUserDetails.java
β”‚ β”‚ β”‚ └── SecurityConfig.java
β”‚ β”‚ β”œβ”€β”€ controller/
β”‚ β”‚ β”‚ β”œβ”€β”€ AppointmentController.java
β”‚ β”‚ β”‚ β”œβ”€β”€ DocInfoController.java
β”‚ β”‚ β”‚ β”œβ”€β”€ ExceptionHandlerController.java
β”‚ β”‚ β”‚ β”œβ”€β”€ MedicalReportController.java
β”‚ β”‚ β”‚ └── UserController.java
β”‚ β”‚ β”œβ”€β”€ exception/
β”‚ β”‚ β”‚ β”œβ”€β”€ LogNotFoundException.java
β”‚ β”‚ β”‚ └── RoleException.java
β”‚ β”‚ β”œβ”€β”€ model/
β”‚ β”‚ β”‚ β”œβ”€β”€ AppointmentPOJO.java
β”‚ β”‚ β”‚ β”œβ”€β”€ DocInfoPOJO.java
β”‚ β”‚ β”‚ β”œβ”€β”€ MedicalReportPOJO.java
β”‚ β”‚ β”‚ β”œβ”€β”€ RoleNamePOJO.java
β”‚ β”‚ β”‚ β”œβ”€β”€ UserPOJO.java
β”‚ β”‚ β”‚ β”œβ”€β”€ UserRolePOJO.java
β”‚ β”‚ β”‚ └── UserView.java
β”‚ β”‚ β”œβ”€β”€ repository/
β”‚ β”‚ β”‚ β”œβ”€β”€ AppointmentRepository.java
β”‚ β”‚ β”‚ β”œβ”€β”€ DocInfoRepository.java
β”‚ β”‚ β”‚ β”œβ”€β”€ MedicalReportRepository.java
β”‚ β”‚ β”‚ β”œβ”€β”€ RoleNameRepository.java
β”‚ β”‚ β”‚ β”œβ”€β”€ UserRepository.java
β”‚ β”‚ β”‚ └── UserRoleRepository.java
β”‚ β”‚ └── service/
β”‚ β”‚ β”œβ”€β”€ AppointmentService.java
β”‚ β”‚ β”œβ”€β”€ DocInfoService.java
β”‚ β”‚ β”œβ”€β”€ MedicalReportService.java
β”‚ β”‚ β”œβ”€β”€ UserDetailsServiceImpl.java
β”‚ β”‚ └── UserService.java
β”‚ └── resources/
β”‚ └── application.properties
└── test/
└── java/

πŸš€ Features

  • Modular clean architecture
  • Full REST API for users, doctors, appointments, and medical reports
  • Custom Spring Security configuration and user authentication
  • DTOs and POJOs for clean model-view separation
  • Exception handling and input validation

πŸ” Security

Custom Spring Security setup:

  • SecurityConfig β€” defines rules, encoders, access restrictions
  • MyUserDetails β€” bridges domain model with Spring Security
  • AuthenticationFacade β€” gets the current logged-in user
  • UserDetailsServiceImpl β€” loads credentials from the database

πŸ‘€ Users & Doctors

  • GET /users
  • GET /users/{id}
  • PUT /users/{id}
  • POST /users
  • DELETE /users/{id}
  • GET /users/doctors/details
  • GET /users/doctors/{id}/details
  • PUT /users/doctors/{id}/details
  • POST /users/doctors/{docId}/details

πŸ“… Appointments

  • GET /appointments
  • GET /appointments/{id}
  • PUT /appointments/{id}
  • POST /appointments
  • DELETE /appointments/{id}

🩺 Medical Reports

  • GET /medical-reports
  • GET /medical-reports/{id}
  • PUT /medical-reports/{id}
  • POST /medical-reports
  • DELETE /medical-reports/{id}

πŸ›  Tech Stack

  • Java 17+
  • Spring Boot
  • Spring Web
  • Spring Data JPA
  • Spring Security
  • Maven
  • Lombok
  • MySQL

βš™οΈ Setup & Run

git clone https://github.com/your-username/hospital-api.git
cd hospital-api/hospital-coursework
./mvnw clean install
./mvnw spring-boot:run

Access the API at: http://localhost:8080/

πŸ”§ Configuration

Edit:

src/main/resources/application.properties

To configure:

  • DB (MySQL)
  • Server port
  • Hibernate, logging, etc.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages