Validate request
- Validate request using JSON schema
Authorize
- Verify the validity of access token
- Check user scope declaration_request:create in order to perform this action
Validate doctor
Get employee details
Invoke Get employee details
Validate Response $.data.employee_type == DOCTOR
Calculate patient age
Calculate patient age
age = MONTHS_BETWEEN (now(), $.declaration_request.person.birth_date) / 12
Check that doctor speciality meets the patient age requirements
Age requirements for doctor specialty
Doctor speciality | Age |
---|---|
FAMILY DOCTOR | All ages |
THERAPIST | Greater or equal to GLOBAL_PARAMETER('ADULT_AGE') |
PEDIATRICIAN | Less than GLOBAL_PARAMETER('ADULT_AGE') |
Check phone number
Validate phone number.
Invoke Check phone number WS in order to check phone number exists in DB
curl -k -L 'http://ehealth.nebo15.com/api/otp_verifications/phone_number/+380508887700'
Search pending declaration requests
Search pending declarations in IL_DB.declaration_requests using patient's tax_id and filtered by employee_id to prevent requests duplication
WHERE IL_DB.declaration_requests.data.declaration_request.person.tax_id = :($.declaration_request.person.tax_id) AND IL_DB.declaration_requests.data.declaration_request.employee_id = :($.declaration_request.employee_id) AND IL_DB.declaration_requests.data.declaration_request.legal_entity_id = :($.declaration_request.legal_entity_id) AND IL_DB.declaration_requests.status IN ('NEW', 'APPROVED')
Cancel pending declaration requests
Change status of all found pending declarations to {CANCELED}. See available transitions
SET IL_DB.declaration_requests.status = 'CANCELED' WHERE IL_DB.declaration_requests.id IN (:LIST)
Save declaration request
Check and calculate declaration end date
If $.declaration_request.end_date is empty
end_date = $.declaration_request.start_date + GLOBAL_PARAMETER('TERM')
Insert entity to IL_DB.declaration_request in {status} = NEW
Search MPI
Search patient in MPI using personal information
Query param | Source |
---|---|
first_name | $.declaration_request.person.first_name |
last_name | $.declaration_request.person.last_name |
second_name | $.declaration_request.person.second_name |
birth_date | $.declaration_request.person.birth_date |
tax_id | $.declaration_request.person.tax_id |
curl -k -L 'http://ehealth.nebo15.com/api/persons?first_name=Олена&last_name=Пчілка&birth_date=1991-08-19&tax_id=3126509816&phone_number=%2B380508887700'
Determine default auth method for new MPI
In case MPI not found
Invoke Gandalf API to determine Default auth method
Service description
Determine preferable auth method for existing MPI
In case MPI found
Get auth method, channel from Search MPI response
Save auth method to request
Update request object in IL_DB.declaration_request with auth method in order to resend sms if needed in future
SET IL_DB.declaration_request.authentication_method_current = Search MPI Response $.data.authentication_method WHERE IL_DB.declaration_request.id = :id
Generate printout form
Invoke Man Template Rendering Service to obtain printout form. Service description
Request parameters
Parameter | Source |
---|---|
id | DECLARATION REQUEST |
Save printout to IL_DB.declaration_request
SET IL_DB.declaration_request.printout_content = Man Response $.data WHERE IL_DB.declaration_request.id = :id
Generate upload URL
Get environment parameter DECLARATION_REQUEST_OFFLINE_DOCUMENTS
Generate FILE_NAME for each document in DECLARATION_REQUEST_OFFLINE_DOCUMENTS
Invoke Media Content Storage to generate upload URL for each document in DECLARATION_REQUEST_OFFLINE_DOCUMENTS
Save all DECLARATION_REQUEST_OFFLINE_DOCUMENTS to declaration request
SET IL_DB.declaration_request.documents = :documents WHERE IL_DB.declaration_request.id = :id
Documents structure
{ "documents":[ { "type":"PASSPORT" } ] }
Generate verification code
Invoke Initialize OTP Verification