Table of Contents | ||||
---|---|---|---|---|
|
...
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
If BLOCK_UNVERIFIED_PARTY_USERS is true, then check party's data match following condition: verification_status != NOT_VERIFIED or (verification_status = NOT_VERIFIED and updated_at > current_date - UNVERIFIED_PARTY_PERIOD_DAYS_ALLOWED):
in case not match - return 403 ("Access denied. Party is not verified")
If BLOCK_DECEASED_PARTY_USERS is true, check that party is not deceased (party_verification record does not equal to: dracs_death_verification_status = VERIFIED and dracs_death_verification_reason = MANUAL_CONFIRMED):
in case of error - return 403 ("Access denied. Party is deceased")
Validate request using JSON schema
...
Calculate patient age
Calculate patient age
|
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 |
Validate confidant person
...
where IL.Declaration_request.mpi_id = :($.person.id) and status in ('NEW' or 'APPROVED)
Cancel declaration requests
Change status and status reason of all found declaration requests:
status: CANCELED
status_reason: request_cancelled
|
Calculate declaration end/start date
Declaration
Start date:
|
End date:
|
Save declaration request
Insert record to IL.declaration_request:
status 'NEW'
is_shareable: false
Generate upload URL
If auth_method_requests.auth_method_current = OFFLINE
...
Invoke Initialize OTP to generate one time password and send it where auth_method_requests.auth_method_current = OTP.
cURL example
|
Generate human readable declaration number
...