Table of Contents | ||||
---|---|---|---|---|
|
Required parameters are marked with "*"
Якщо інформації по відповідному параметру немає, потрібно зазначити: “APIparagraph not found”.
Purpose*
This method is used to create Declaration Request (as part of Declaration creation process) via new api. This method allows you to create a declaration only for an existing person.
Specification*
Link | |
Resource | /api/v3/declaration_requests |
Scope | declaration_request:write |
Components | Необхідно зазначити перелік компонентів, які використовують цей метод, наприклад: ePrescription |
Using Dictionaries | Потрібно вказати словники, які використовує метод API |
Using Microservices | Вкажіть перелік мікросервісів, які використовує метод API. Наприклад: Auth, ABAC |
Protocol type | Вкажіть тип протоколу, який використовується запитом, наприклад: SOAP | REST | JSON |
Request type | POST |
Sync/Async | Метод є синхронним чи асинхронним? |
Logic*
To create declaration request based on active declaration in reorganized legal entity, parent_declaration_id
must be passed in request.
Global and configuration parameters
Invoke Global parameters to get following parameters:
Variable | Values | Description |
---|---|---|
|
Filters
А точно ли это фильтры, а не Input Parameters ?
Filter | Values | Type | Description | Example |
---|---|---|---|---|
person_id | String | Person ID | нет слова Example. может это столбец Value? и в Request используются именно эти значения 4d0d790c-cbf1-44f5-ab21-ba8db67da161 | |
employee_id | String | Employee ID with | 1a8b10ea-ba09-40f2-8f9e-55608e9208c6 | |
division_id | String | Registered Medical Service Provider Division identifier. | d290f1ee-6c54-4b01-90e6-d701748f0851 | |
authorize_with | String | identifier of person's auth method | cc949559-5dfe-420f-ac05-065e443b2cc6 | |
parent_declaration_id | String | identifier of parent declaration in reorganized legal entity | 8c7753fc-a647-435f-8e43-4ff4546431f6 |
Request structure*
See on Apiary
Expand | ||
---|---|---|
| ||
|
Authorize*
Verify the validity of access token
in case error return 401
Check users scopes (declaration_request:write) to perform this action
in case error return 403 - forbidden
Request to process the request using a token in the headers
Headers*
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
api-key:uXhEczJ56adsfh3Ri9SUkc4en
Validate request
...
(JSON schema)*
Expand | ||
---|---|---|
|
Validation data request*
Validate Legal Entity Type
Validate legal entity from token: legal_entities.type should be in DECLARATION_REQUEST_LEGAL_ENTITY_TYPES("MSP,PRIMARY_CARE,MSP_PHARMACY") and legal_entities.status =='active'
Validate doctor
...
Get employee details
Invoke Get employee details
...
Take the doctor_id and the division_id from the token
Validate person
validate person_id UUID
in case error return 422
search person by person_id in MPI
in case error return 404, "Such person doesn't exist"
validate person.auth_method != NA
in case error return 422, "Person must have authentication method"
validate person.status = ‘active’ and is_active =true
in case error return 404, "Such person doesn't exist"
Validate person verification status
validate patient's verification_status is not equal to NOT_VERIFIED.
in case of error return 409, "Patient is not verified"
Validate authorize_with
The person can pass the id of his auth_method which he wants to confirm the create declaration request. The necessary auth method can be found by making Get person's auth methods
...
If person request doesn't have this field, then choose that method which is returned from mpi as person's default method
Get global parameters
Invoke Global parameters to get following parameters:
...
ADULT_AGE
...
DECLARATION_TERM
...
Calculate patient age
Calculate patient age
...
in case error return 422 - msg "Confidant person is mandatory for children"
Processing*
Search pending declaration requests
...
generate declaration_number
Search declaration_number in declaration_requests.declaration_number
if exists = go to 'generate declaration_number'
else save declaration_number to declaration_request
Response structure*
See on Apiary
Code 201
Expand | ||
---|---|---|
| ||
|
Code 422
Expand | ||
---|---|---|
| ||
|
Post-processing processes*
Що має відбутися в ЦБД після опрацювання та відправлення відповіді, тощо
HTTP status codes
HTTP status code | Message | What caused the error |
---|---|---|
201 |
|
|
422 |
|
|
Backward compatibility
Сумісність з попередніми версіями методу