Table of Contents | ||||
---|---|---|---|---|
|
...
ADULT_AGE
DECLARATION_TERM
no_self_auth_ag
Request structure
Example:
...
Content-Type:application/json
Authorization:Bearer {{c2778f3064753ea70de870a53795f5c9}}
api-key: {{uXhEczJ56adsfh3Ri9SUkc4en}}
Validate request
Expand | ||
---|---|---|
| ||
|
...
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
Validate parent declaration
check that parent declaration exists and in status ‘active’
in case of error - return 404 (‘Active parent declaration was not found’)
check that the parent declaration belongs to a person (person_id of parent declaration and person_id from request are the same)
in case of error - return 422 (‘Parent declaration does not belong to this person’)
check that the legal entity of parent declaration and the current legal entity are in reorganization process with types ACCESSION, MERGING, DIVIDING, SEPARATING (request: select * from related_legal_entities where is_active=true and merged_from_id=parent_declaration_id.legal_entity_id and merged_to_id=employee_id.legal_entity_id and type in (‘ACCESSION’, ‘MERGING’, ‘DIVIDING’, ‘SEPARATING’); returns at least one record)
in case of error - return 422 (‘Legal entities of parent declaration and current are not in reorganization process’)
check that party_id of employee from parent declaration and party_id of current employee are the same
in case of error - return 422 (‘Employee of parent declaration and current employee are not the same’)
This field is optional and set in il.declaration_reques.parent_declaration_id.
If parent_declaration_id is passed in request, authorize_with validation and processing must be skipped, created declaration request will be processed without patients involvement.
Calculate patient age
Calculate patient age
...
Each link is generated for one one-page document in jpeg format. Document should be no more than 10MB.
Set auth_method_current
Get parent_declaration_id from il.declaration_requests.parent_declaration_id.
If parent_declaration_id is null, set default auth method of person on IL.auth_method_request.auth_method_current - use function in mpi, that return default auth method.
If auth_method_current = NA - return Error "person authentication method is undefined"
.
If parent_declaration_id is not null, set auth_method_current = NA (request is processed without patients involvement).
Generate verification code
...