ЕСОЗ - публічна документація
RC_Sign Medication Request Request (modified - EN)
- 1 Specification
- 2 Input parameters (filters)
- 3 Authorize
- 4 Digital signature
- 5 Validate request (JSON schema)
- 6 Validate request status
- 7 Check signed content
- 8 Save signed medication request to media storage
- 9 Create medication request
- 10 Generate printout form
- 11 Update Medication request Request status
- 12 Send SMS for person
Specification
Purpose
This WS is designed to sign Request for Medication request (patch). If successful signed - automatically create Medication request.
Input parameters (filters)
id
Authorize
Verify the validity of access token
Check user scope (scope = 'medication_request_request:sign') in order to perform this action
In case error - generate 401 response
Digital signature
Decode content that is encrypted in an electronic digital signature.
Use Digital signature WS. Method checks digital signature and returns result.
Validate request (JSON schema)
Validate request using JSON schema
In case validation fails - generate 422 error
Validate request status
Purpose validation: Valid ability transition.
For info - status charts: Medication request Request Status Chart
Get Medication request Request status by $.id
Check status == NEW
if invalid - return 409 error (message: "Invalid status Medication request Request for sign transition!")'
Check signed content
Purpose validation: Check equality decoded signed content with previously created on IL.db.
Get data
SELECT data FROM medication_request_requestsWHERE id = $.id
If they are not equal with decoded signed content - generate 422 error (message: "Signed content does not match the previously created content!")
Save signed medication request to media storage
Get url for medication request upload.
Parameter | Source |
---|---|
action | 'GET' |
bucket | 'medication-request-requests' |
resource_id | : MEDICATION_REQUEST_ID |
resource_name | : MEDICATION_REQUEST_NAME |
2. Upload signed medication request request to media storage
Create medication request
Create new record in medication_requests with status ACTIVE
if there is existing record in the medication_requests table with the same id and medication_request_request_id, return ok to IL
Mapping (where <rd> = medication_request_request.data )
Destination | Source |
---|---|
id |
|
request_number | <rd>.request_number |
verification_code | <rd>.verification_code |
created_at | <rd>.created_at |
started_at | <rd>.started_at |
ended_at | <rd>.ended_at |
dispense_valid_from | <rd>.dispense_valid_from |
dispense_valid_to | <rd>.dispense_valid_to |
person_id | <rd>.person_id |
employee_id | <rd>.employee_id |
division_id | <rd>.division_id |
medication_id | <rd>.medication_id |
medication_qty | <rd>.medication_qty |
medical_program_id | <rd>.medical_program_id |
status | ACTIVE |
is_active | true |
recall_at | NULL |
recalled_by |
|
recall_reason |
|
request_for_medication_request_id | $.id |
inserted_at | :timestamp |
inserted_by | user_id |
updated_at | :timestamp |
updated_by | user_id |
intent | <rd>.intent |
category | <rd>.category |
context | <rd>.context |
dosage_instructions | <rd>.dosage_instructions |
Generate printout form
Invoke ael.api in order to render MEDICATION_REQUEST_TEMPLATE
Template parameters
Parameter | Source |
---|---|
request_number |
|
created_at |
|
dispense_valid_to |
|
program_name |
|
person_short_name |
|
person_age |
|
medication_name |
|
medication_qty |
|
started_at |
|
ended_at |
|
dosage_instructions_text |
|
employee_short_name |
|
employee_phone_number |
|
legal_entity_name |
|
division_name |
|
legal_entity_address |
|
legal_entity_edrpou |
|
legal_entity_license_number |
|
legal_entity_license_what_licensed |
|
legal_entity_license_issued_date |
|
legal_entity_license_issued_by |
|
legal_entity_license_active_from_date |
|
legal_entity_license_expiry_date |
|
legal_entity_license_order_no |
|
person_authentication_method |
|
Medication request form example:
Update Medication request Request status
Update Medication request Request:
UPDATE medication_request_requests SET status = 'SIGNED' WHERE id = {:id}
Send SMS for person
If MR has program with medical program setting medication_request_notification_disabled = true, then don't send SMS.
Else:
Get authentication_method of MPI
If authentication_method == OTP - send SMS:
Generate text SMS (call Man method- templates rendering service with template "TEMPLATE_SMS_FOR_SIGN_MEDICATION_REQUEST".
Sending SMS for MPI
If authentication_method == OFFLINE (or medication_request_notification_disabled = true) - set medication_request_request.verification_code to MEDICATION_REQUEST_TEMPLATE
ЕСОЗ - публічна документація