{ "$schema": "http://json-schema.org/draft-04/schema#", "definitions": { "phone": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "MOBILE", "LANDLINE" ] }, "number": { "type": "string", "pattern": "^\\+38[0-9]{10}$" } }, "required": [ "type", "number" ], "additionalProperties": false }, "address": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "RESIDENCE", "REGISTRATION" ] }, "country": { "type": "string" }, "area": { "type": "string" }, "region": { "type": "string" }, "settlement": { "type": "string" }, "settlement_type": { "type": "string" }, "settlement_id": { "type": "string" }, "street_type": { "type": "string", "enum": [ "BOULEVARD", "STREET", "AVENUE", "SQUARE" ] }, "street": { "type": "string" }, "building": { "type": "string", "pattern": "^[0-9]{1,3}(([ \\-]{1})?(?![ЫЪЭЁыъэё])[А-ЯҐЇЄа-яґїє]{1})?((\\s)?(\\|/)(\\s)?[0-9]{1,3}(([ \\-]{1})?(?![ЫЪЭЁыъэё])[А-ЯҐЇЄа-яґїє]{1})?)?$" }, "apartment": { "type": "string" }, "zip": { "type": "string", "pattern": "^[0-9]{5}$" } }, "required": [ "country", "settlement_id", "building" ], "additionalProperties": false }, "document": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "PASSPORT", "NATIONAL_ID", "BIRTH_CERTIFICATE", "TEMPORARY_CERTIFICATE" ] }, "number": { "type": "string" } }, "required": [ "type", "number" ], "additionalProperties": false }, "authentication_method": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "SMS", "SMS_TRUSTEE", "OFFLINE" ] }, "phone_number": { "type": "string", "pattern": "^\\+38[0-9]{10}$" } }, "required": [ "type", "phone_number" ], "additionalProperties": false } }, "type": "object", "properties": { "declaration_request": { "type": "object", "properties": { "start_date": { "type": "string", "format": "date-time", "description": "Should be defined on the client side." }, "end_date": { "type": "string", "format": "date-time", "description": "Will be defined on eHealth side if it's not set." }, "person": { "type": "object", "properties": { "first_name": { "type": "string" }, "last_name": { "type": "string" }, "second_name": { "type": "string" }, "birth_date": { "type": "string", "format": "date-time" }, "birth_place": { "type": "string" }, "gender": { "type": "string", "enum": [ "MALE", "FEMALE" ] }, "email": { "type": "string", "format": "email" }, "tax_id": { "type": "string", "pattern": "^[1-9]([0-9]{7}|[0-9]{9})$" }, "secret": { "type": "string" }, "documents": { "type": "array", "items": { "$ref": "#/definitions/document" } }, "addresses": { "type": "array", "items": { "$ref": "#/definitions/address" } }, "phones": { "type": "array", "items": { "$ref": "#/definitions/phone" } }, "authentication_methods": { "type": "array", "items": { "$ref": "#/definitions/authentication_method" } }, "emergency_contact": { "type": "object", "properties": { "first_name": { "type": "string" }, "last_name": { "type": "string" }, "second_name": { "type": "string" }, "phones": { "type": "array", "items": { "$ref": "#/definitions/phone" } } }, "required": [ "first_name", "last_name", "phones" ] }, "confidant_person": { "type": "object", "properties": { "relation_type": { "type": "string", "enum": [ "TRUSTEE" ] }, "first_name": { "type": "string" }, "last_name": { "type": "string" }, "second_name": { "type": "string" }, "birth_date": { "type": "string", "format": "date-time" }, "birth_place": { "type": "string" }, "gender": { "type": "string", "enum": [ "MALE", "FEMALE" ] }, "tax_id": { "type": "string", "pattern": "^[1-9]([0-9]{7}|[0-9]{9})$" }, "documents": { "type": "array", "items": { "$ref": "#/definitions/document" } }, "phones": { "type": "array", "items": { "$ref": "#/definitions/phone" } } }, "required": [ "first_name", "last_name", "birth_date", "birth_place", "gender" ], "description": "Should be set if this Person is disabled, underage, etc." }, "renewal_consent": { "type": "boolean" }, "patient_signed": { "type": "boolean" }, "disclosure_consent": { "type": "boolean" }, "process_data_consent": { "type": "boolean" } }, "required": [ "first_name", "last_name", "birth_date", "birth_place", "gender", "secret" ], "description": "Object that described a Patient. Confidant person should be set for disabled persons, underage persons, etc." }, "employee_id": { "type": "string", "description": "Employee ID with `type=DOCTOR` selected from available Employees as a third contract party." }, "division_id": { "type": "string", "description": "Registered Medical Service Provider Division identifier." }, "legal_entity_id": { "type": "string", "description": "Registered Medical Service Provider Division identifier." }, "scope": { "type": "string", "enum": [ "FAMILY DOCTOR" ] } }, "required": [ "start_date", "person", "employee_id", "division_id", "legal_entity_id", "scope" ] } } } |
Invoke Get employee details
Validate Response $.data.employee_type == DOCTOR
Calculate patient age
age = MONTHS_BETWEEN (now(), $.declaration_request.person.birth_date) / 12 |
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') |
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 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') |
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) |
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 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 |
phone_number | $.declaration_request.person.phones[?(@.type='MOBILE')].number |
curl -k -L 'http://ehealth.nebo15.com/api/persons?first_name=Олена&last_name=Пчілка&birth_date=1991-08-19&tax_id=3126509816&phone_number=%2B380508887700' |
In case MPI not found
Invoke Gandalf API to determine Default auth method
In case MPI found
Get auth method, channel from Search MPI response
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 = Search MPI Response $.data.authentication_method WHERE IL_DB.declaration_request.id = :id |
Invoke Man Template Rendering Service to obtain printout form
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 |
Get configuration parameter DECLARATION_REQUEST_OFFLINE_DOCUMENTS
Generate FILE_NAME for each document in DECLARATION_REQUEST_OFFLINE_DOCUMENTS
Invoke Media Content Storage to get upload URL for each document in DECLARATION_REQUEST_OFFLINE_DOCUMENTS
Save all URLs to declaration request
SET IL_DB.declaration_request.documents = :documents WHERE IL_DB.declaration_request.id = :id |
Documents structure
{ "documents":[ { "type":"PASSPORT", "url":"url" } ] } |
Invoke Initialize OTP Verification