Hospital Management API built in Spring Boot
- Spring Boot 3.2.1
- JDK 17
- Maven 4.0.0
git clone https://github.com/MirnaGama/hospital-management-api/
cd hospital-management-api
mvn clean install
It will build the jar file in the target foldermvn spring-boot:run
It will compile and run the application on default port (8080)
-
mvn test
It will executes all the tests. -
mvn -Dtest=packageName.className test
It will execute only one test class -
mvn -Dtest=packageName.className#methodName test
It will run only one test method from one test class
- R1 - Doctor Registration
- R2 - List of Doctors
- R3 - Doctor Update
- R4 - Doctor Exclusion
- R5 - Patient Registration
- R6 - List of Patients
- R7 - Patient Update
- R8 - Patient Exclusion
- R9 - Consultation Scheduling
- R10 - Consultation Cancellation
- Body:
{
"login" (string, required),
"password" (string, required),
}
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
400 |
Validation Error |
- Body:
{
"login" (string, required),
"password" (string, required),
}
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
400 |
Validation Error |
403 |
Incorrect credentials |
- Body:
{
"name" (string, required),
"email" (string, required),
"crm" (string, required),
"telephone" (string, required),
"specialty" (string, required),
"address": {
"street" (string, required),
"neighborhood" (string, required),
"zipCode" (string, required),
"city" (string, required),
"state" (string, required),
"additionalDetails" (string, optional),
"houseNumber" (string, optional)
}
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Responses:
Code | Description |
---|---|
201 |
Successfully created |
400 |
Validation Error |
403 |
Unauthorized / Invalid token |
- Response Body Example:
{
"id": 1,
"name": "DOCTOR TEST",
"email": "[email protected]",
"crm": "12456",
"telephone": "(81) 99999999",
"specialty": "ORTHOPEDICS",
"active": true,
"address": {
"street": "TEST STR.",
"neighborhood": "TEST NEIGHBORHOOD",
"zipCode": "12345678",
"city": "TEST CITY",
"state": "ST",
"additionalDetails": null,
"houseNumber": null
}
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Request Parameters:
Key | Description |
---|---|
id |
Unique identifier of the doctor who will be fetched |
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
404 |
Entity not found |
403 |
Unauthorized / Invalid token |
- Response Body Example:
{
"content": [
{
"name": "Test1",
"email": "[email protected]",
"crm": "123456",
"specialty": "ORTHOPEDICS"
},
{
"name": "Test2",
"email": "[email protected]",
"crm": "789101",
"specialty": "ORTHOPEDICS"
},
{
"name": "Test3",
"email": "[email protected]",
"crm": "112131",
"specialty": "ORTHOPEDICS"
},
],
"pageable": {
"pageNumber": 0,
"pageSize": 10,
"sort": {
"sorted": true,
"unsorted": false,
"empty": false
},
"offset": 0,
"paged": true,
"unpaged": false
},
"totalPages": 1,
"totalElements": 3,
"last": true,
"sort": {
"sorted": true,
"unsorted": false,
"empty": false
},
"number": 0,
"size": 10,
"first": true,
"numberOfElements": 3,
"empty": false
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Request Parameters:
Key | Description |
---|---|
size |
Number of records that should be returned |
sort |
Sort by object attribute in descending order |
page |
Page number |
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
403 |
Unauthorized / Invalid token |
- Body:
{
"id" (number, required),
"name" (string, optional),
"telephone" (string, optional),
"address": {
"street" (string, optional),
"neighborhood" (string, optional),
"zipcode" (string, optional),
"city" (string, optional),
"state" (string, optional),
"additionalDetails" (string, optional),
"houseNumber" (string, optional),
}
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
400 |
Validation Error |
403 |
Unauthorized / Invalid token |
- Response Body Example:
{
"id": 2,
"name": "DEACTIVATED DOCTOR TEST",
"email": "[email protected]",
"crm": "12456",
"telephone": "(81) 99999999",
"specialty": "ORTHOPEDICS",
"active": false,
"address": {
"street": "TEST STR.",
"neighborhood": "TEST NEIGHBORHOOD",
"zipCode": "12345678",
"city": "TEST CITY",
"state": "ST",
"additionalDetails": null,
"houseNumber": null
}
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Request Parameters:
Key | Description |
---|---|
id |
Unique identifier of the doctor who will be deactivated |
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
400 |
Validation Error |
404 |
Entity not found |
403 |
Unauthorized / Invalid token |
- Body:
{
"name" (string, required),
"email" (string, required),
"cpf" (string, required),
"telephone" (string, required),
"address": {
"street" (string, required),
"neighborhood" (string, required),
"zipCode" (string, required),
"city" (string, required),
"state" (string, required),
"additionalDetails" (string, optional),
"houseNumber" (string, optional)
}
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Responses:
Code | Description |
---|---|
201 |
Successfully created |
400 |
Validation Error |
403 |
Unauthorized / Invalid token |
- Response Body Example:
{
"id": 1,
"name": "PATIENT TEST",
"email": "[email protected]",
"cpf": "11111111111",
"telephone": "(81) 99999999",
"active": true,
"address": {
"street": "TEST STR.",
"neighborhood": "TEST NEIGHBORHOOD",
"zipCode": "12345678",
"city": "TEST CITY",
"state": "ST",
"additionalDetails": null,
"houseNumber": null
}
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Request Parameters:
Key | Description |
---|---|
id |
Unique identifier of the patient who will be fetched |
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
404 |
Entity not found |
403 |
Unauthorized / Invalid token |
- Response Body Example:
{
"content": [
{
"name": "Test1",
"email": "[email protected]",
"cpf": "123456"
},
{
"name": "Test2",
"email": "[email protected]",
"cpf": "789101"
},
{
"name": "Test3",
"email": "[email protected]",
"cpf": "112131"
},
],
"pageable": {
"pageNumber": 0,
"pageSize": 10,
"sort": {
"sorted": true,
"unsorted": false,
"empty": false
},
"offset": 0,
"paged": true,
"unpaged": false
},
"totalPages": 1,
"totalElements": 3,
"last": true,
"sort": {
"sorted": true,
"unsorted": false,
"empty": false
},
"number": 0,
"size": 10,
"first": true,
"numberOfElements": 3,
"empty": false
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Request Parameters:
Key | Description |
---|---|
size |
Number of records that should be returned |
sort |
Sort by object attribute in descending order |
page |
Page number |
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
403 |
Unauthorized / Invalid token |
- Body:
{
"id" (number, required),
"name" (string, optional),
"telephone" (string, optional),
"address": {
"street" (string, optional),
"neighborhood" (string, optional),
"zipcode" (string, optional),
"city" (string, optional),
"state" (string, optional),
"additionalDetails" (string, optional),
"houseNumber" (string, optional),
}
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
400 |
Validation Error |
403 |
Unauthorized / Invalid token |
- Response Body Example:
{
"id": 1,
"name": "DEACTIVATED PATIENT TEST",
"email": "[email protected]",
"cpf": "11111111111",
"telephone": "(81) 99999999",
"active": false,
"address": {
"street": "TEST STR.",
"neighborhood": "TEST NEIGHBORHOOD",
"zipCode": "12345678",
"city": "TEST CITY",
"state": "ST",
"additionalDetails": null,
"houseNumber": null
}
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Request Parameters:
Key | Description |
---|---|
id |
Unique identifier of the patient who will be deactivated |
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
400 |
Validation Error |
404 |
Entity not found |
403 |
Unauthorized / Invalid token |
- Body:
{
"patientId" (number, required),
"consultationDate" (string, required),
"doctorId" (number, required if _specialty_ field is not filled),
"specialty" (string, required if _doctorId_ field is not filled)
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Responses:
Code | Description |
---|---|
201 |
Successfully created |
400 |
Validation Error |
403 |
Unauthorized / Invalid token |
404 |
Entity not found |
- Response Body Example:
{
"id": 1,
"consultationDate": "22/04/2024 10:34",
"patient": {...},
"doctor": {...},
"canceled": false,
"reasonCancellation: ""
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Request Parameters:
Key | Description |
---|---|
id |
Unique identifier of the consultation that will be fetched |
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
404 |
Entity not found |
403 |
Unauthorized / Invalid token |
- Body:
{
"consultationId" (number, required),
"reasonCancellation" (string, required),
}
- Request Headers:
Key | Description |
---|---|
Authorization |
Authorization token |
- Responses:
Code | Description |
---|---|
200 |
Successful operation |
403 |
Unauthorized / Invalid token |
404 |
Entity not found |