REST API method / Метод REST API (настанова) (remove the link block before publishing the document)
Properties of a REST API method document
Purpose
This method is designed to obtain all Employees of the legal entity.
Logic
Search in the legal_entity by :legal_entity_id (legal_entity_id from Context)
return error if not found
Search in the employee by :employee_id and is_active = true
return error if not found
Check employee.employee_type
employee_type in (DOCTOR, PHARMACIST)
employee_type in (HR, ACCOUNTANT, OWNER, PHARMACY_OWNER)
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.
Configuration parameters
Description of the configuration parameters that are used when processing a request in the system
Dictionaries
+DIVISION_TYPE
LEGAL_FORM
OWNER_PROPERTY_TYPE
EMPLOYEE_TYPE
+DOCUMENT_TYPE
PHONE_TYPE
EDUCATION_DEGREE
COUNTRY
QUALIFICATION_TYPE
SPECIALITY_TYPE
SPECIALITY_LEVEL
SPEC_QUALIFICATION_TYPE
SCIENCE_DEGREE
LEGAL_ENTITY_TYPE_V2
Input parameters
Description of input parameters
Input parameter | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 | employee_id |
| String | Required | d290f1ee-6c54-4b01-90e6-d701748f0851 |
2 |
Request structure
See on API-specification (посилання на сторінку з API-специфікацією)
Description of the REST API request structure, example
Headers
Key | Value | Mandatory | Description | Example | |
---|---|---|---|---|---|
1 | Content-Type | application/json | M | Тип контенту | Content-Type:application/json |
2 | Authorization | Bearer c2778f3064753ea70de870a53795f5c9 | M | Перевірка користувача | Authorization:Bearer c2778f3064753ea70de870a53795f5c9 |
3 |
Request data validation
Describe the process of checking the input data transmitted in the request for compliance with the given rules and restrictions set in the API
Processing
A list of processes related to receiving, changing or transmitting data according to the logic defined in the REST API
Response structure examples
Additional info with educations, qualifications, science degree and specialities are stored in prm.parties, however speciality.speciality_officio=true is also saved to prm.employees.
get employees.speciality
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.
form array of specialities as in example below
DOCTOR, SPECIALIST, ASSISTANT, PHARMACIST, MED_ADMIN, LABORANT or MED_COORDINATOR
HR, ACCOUNTANT, OWNER, PHARMACY_OWNER
See on API-specification (посилання на сторінку з API-специфікацією)
Description of the REST API response structure, example
HTTP status codes
Response code | HTTP Status code | Message | Internal name | Description | |
---|---|---|---|---|---|
1 | Базові | ||||
2 | 200 | Response |
| ||
3 | 401 | Invalid access token |
| ||
4 | 401 | Unauthorized | Помилка підтвердження | ||
5 | 403 | Access denied | |||
6 | 403 | Your scope does not allow to access this resource. Missing allowances: employee:details |
| ||
7 | 1000 | 404 | Composition not found | COMPOSITION_NOT_FOUND_404 | Не знайдено медичний висновок |
8 | Специфічні | ||||
9 | 422 | Only for active MPI record can be created medication request! |
Post-processing processes
Description of actions performed on data after processing
Technical modules where the method is used
List of pages describing technical modules where the method is used