Table of Contents | ||||
---|---|---|---|---|
|
Required parameters are marked with "*"
...
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 | Apiaryhttps://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/declaration-requests/create-declaration-request-v3 |
Resource | /api/v3/declaration_requests |
Scope | declaration_request:write |
Components | Необхідно зазначити перелік компонентів, які використовують цей метод, наприклад: ePrescriptionDeclarations |
Using Dictionaries | Потрібно вказати словники, які використовує метод APIAPI paragraph not found |
Using Microservices | Вкажіть перелік мікросервісів, які використовує метод API. Наприклад: Auth, ABACAPI paragraph not found |
Protocol type | Вкажіть тип протоколу, який використовується запитом, наприклад: SOAP | REST | JSON |
Request type | POST |
Sync/Async | Метод є синхронним чи асинхронним?Sync |
Public/Private/Internal | Public |
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
...
...
Description
ADULT_AGE
DECLARATION_TERM
no_self_auth_ag
...
Request structure
...
See on ApiaryExample:
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
...
Expand | ||
---|---|---|
| ||
|
Validation data request
...
Validate Legal Entity Type
...
Get employee details
Invoke Get employee details
Validate Response $.data.employee_type == DOCTOR
...
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
validate auth_method.id is UUID
in case error return 422
search auth method in MPI.person_authentication_method
in case error return 422, "such authentication method doesn't exist"
search auth method of this person where MPI.person_authentication_method.person_id = $.person.id
in case error return 422, "such authentication method does not belong to this person"
validate that auth_method.type = NA
in case error return 422, "Сannot be confirmed by a method with type= NA. Use a different method."
validate that this method is active ( authentication_method.ended_at > now() and is_active = true)
This field is optional and set in il.declaration_reques.authentication_method_current.
...
Check that doctor speciality meets the patient age requirements
Get doctor's speciality_officio (speciality object where speciality_officio == true)
Check age requirements according to global parameters
Speciality officio | Age |
---|---|
FAMILY DOCTOR | All ages |
THERAPIST | Greater or equal to $.data.adult_age |
PEDIATRICIAN | Less than $.data.adult_age |
...
in case error return 422 - msg "Confidant person is mandatory for children"
Processing
...
Search pending declaration requests
...
If auth_method_requests.auth_method_current = OTP
Invoke Initialize OTP to generate one time password and send it where auth_method_requests.auth_method_current = OTP.
...
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
...
Code 201
Expand | ||
---|---|---|
| ||
|
Code 422
Expand | ||
---|---|---|
| ||
|
Post-processing processes
...
API paragraph not found
HTTP status codes
HTTP status code | Message | What caused the error | ||
---|---|---|---|---|
201 | 201 Response |
|
| 422 |
401 | Access token validation failed | |||
403 | Invalid scopes | |||
404 | Validation error | |||
409 | Validation error | |||
422 |
| Validation error |
Backward compatibility
Сумісність з попередніми версіями методуAPI paragraph not found