A small Java Spring Boot REST API for tracking patients and their current care status.
This project is intentionally focused on one healthcare backend workflow: add patients, view patients, find a patient by id, and update patient status.
- Java 17
- Spring Boot
- Spring Web
- Bean Validation
- Springdoc OpenAPI / Swagger UI
- JUnit 5
- Maven
- Add a patient
- List all patients
- Find a patient by id
- Update a patient's status
- Validate request bodies
- Return clean JSON error responses
- Test requests with IntelliJ HTTP Client, Postman, or Swagger UI
{
"id": 1,
"name": "Alex Carter",
"age": 34,
"status": "WAITING"
}Allowed statuses:
WAITINGIN_TREATMENTDISCHARGED
The API also accepts common treatment-status variants like IN-TREATMENT and IN TREATMENT.
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Health check |
GET |
/patients |
List all patients |
GET |
/patients/{id} |
Find a patient by id |
POST |
/patients |
Add a patient |
PATCH |
/patients/{id}/status |
Update patient status |
mvn clean installmvn spring-boot:runThe API will run locally at:
http://localhost:8080
Open Swagger UI:
http://localhost:8080/swagger-ui.html
POST /patients
Content-Type: application/json{
"id": 1,
"name": "Alex Carter",
"age": 34,
"status": "WAITING"
}GET /patientsGET /patients/1PATCH /patients/1/status
Content-Type: application/json{
"status": "IN_TREATMENT"
}IntelliJ users can run the prepared HTTP requests in:
docs/requests.http
Postman users can create requests using the endpoint table above and http://localhost:8080 as the base URL.
mvn testPatients are stored in memory with a ConcurrentHashMap. Data resets when the application restarts.
- Add SQL/PostgreSQL persistence
- Add repository and database layers
- Expand validation and error handling
- Add controller/integration tests
- Add Docker support
- Deploy to Azure