Class PatientController
java.lang.Object
com.mirna.hospitalmanagementapi.application.controllers.PatientController
A Spring REST controller for managing patients.
- Version:
- 1.0
- Author:
- Mirna Gama
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Object>deletePatient(Long id) Delete method to deactivate an existing patient record by provided IDorg.springframework.http.ResponseEntity<Object>getPatient(Long id) Get method to receive a Patient record by the provided IDorg.springframework.http.ResponseEntity<Object>getPatients(org.springframework.data.domain.Pageable pageable) Get method to receive a paginated sublist of objects containing data transfer objects with Patient public informationorg.springframework.http.ResponseEntity<Object>postPatient(@Valid PatientDTO patientDTO) Post method to create a new Patient object based on the provided DTO.org.springframework.http.ResponseEntity<Object>putPatient(@Valid PatientUpdatedDataDTO patientUpdatedDataDTO) Put method to update a existing patient record by provided ID
-
Constructor Details
-
PatientController
public PatientController()
-
-
Method Details
-
postPatient
@PostMapping public org.springframework.http.ResponseEntity<Object> postPatient(@RequestBody @Valid @Valid PatientDTO patientDTO) Post method to create a new Patient object based on the provided DTO.- Parameters:
patientDTO- The data transfer object containing data for Patient entity.- Returns:
- A response entity containing the saved patient and created status if successful, or a 400-level error if there is a validation error
-
getPatient
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<Object> getPatient(@PathVariable Long id) Get method to receive a Patient record by the provided ID- Parameters:
id- A long representing the patient's unique identifier- Returns:
- A response entity containing the saved patient if successful, or a 404 level error if it is non-existent
-
getPatients
@GetMapping public org.springframework.http.ResponseEntity<Object> getPatients(@PageableDefault(size=10,sort="name") org.springframework.data.domain.Pageable pageable) Get method to receive a paginated sublist of objects containing data transfer objects with Patient public information- Parameters:
pageable- Pagination information, such as size and page number- Returns:
- A response entity containing the paginated sublist of patients if successful
-
putPatient
@PutMapping public org.springframework.http.ResponseEntity<Object> putPatient(@RequestBody @Valid @Valid PatientUpdatedDataDTO patientUpdatedDataDTO) Put method to update a existing patient record by provided ID- Parameters:
patientUpdatedDataDTO- Data Transfer Object containing allowed data to be updated in Patient entity- Returns:
- A response entity containing the saved patient if successful, or a 400-level error if there is a validation error
-
deletePatient
@DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Object> deletePatient(@PathVariable Long id) Delete method to deactivate an existing patient record by provided ID- Parameters:
id- Path variable that represents the patient's unique identifier- Returns:
- A response entity containing the deactivated patient if successful
-