[R8] Deactivate patient method in service class
This commit is contained in:
parent
7c37127366
commit
d8704c1fcf
@ -140,4 +140,26 @@ public class PatientServiceImpl implements PatientService {
|
||||
return patient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivates an existing patient record by provided id
|
||||
*
|
||||
* @param id Long that represents the patient's unique identifier
|
||||
*
|
||||
* @return The deactivated patient if successful, or throws an
|
||||
* EntityNotFoundException if it is non-existent.
|
||||
* @throws EntityNotFoundException When patient with id provided is non-existent
|
||||
*/
|
||||
@Override
|
||||
public Patient deactivatePatient(Long id) throws EntityNotFoundException {
|
||||
Patient patient = findPatientById.execute(id);
|
||||
|
||||
if (patient == null) {
|
||||
throw new EntityNotFoundException();
|
||||
}
|
||||
|
||||
patient.setActive(false);
|
||||
|
||||
return savePatient.execute(patient);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -49,4 +49,12 @@ public interface PatientService {
|
||||
* @return The updated patient if successful, or null if there is an error.
|
||||
*/
|
||||
public Patient updatePatient(PatientUpdatedDataDTO patientUpdatedDataDTO);
|
||||
|
||||
/**
|
||||
* Deactivates an existing patient record by provided id
|
||||
* @param id Long that represents the patient's unique identifier
|
||||
*
|
||||
* @return The deactivated patient if successful, or null if there is an error.
|
||||
*/
|
||||
public Patient deactivatePatient(Long id);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user