Table of Contents |
---|
Purpose
This method is designed to obtain all Employees of the legal entity.
Specification
Authorization
Verify the validity of access token
Return (401, 'Invalid access token') in case of validation fails
Verify that token is not expired
in case of error - return (401, 'Invalid access token')
Check user scopes in order to perform this action (scope = 'employee:details')
Return (403, 'Your scope does not allow to access this resource. Missing allowances: employee:details') in case of invalid scope(s)
Service logic
Service returns specified Employee related to the legal entity from token:
Get Employee by ID from
prm.employees
Filter by medication_request_id and patient_id and status (optional)
Validate data consistency:
Ensure that requested Employee relates to the legal entity from token:
Return 403 ('Access denied') in case of error
Render a response according to specification with found Employee:
render a response structure depends on employee types
get parties.specialities, for each parties.specialities.speciality check condition if parties.specialities.speciality<>employee.speciality.speciality then set speciality_officio=false and add to employees.speciality else don't add to response.
Response structures for Employee types
DOCTOR, SPECIALIST, ASSISTANT, PHARMACIST, MED_ADMIN, LABORANT or MED_COORDINATOR
...