Specification
Apiary | |
JSON Schema request | |
JSON Schema response |
Purpose
This WS is designed to sign Request fo Medication request (patch). If successefull 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.
See service specification
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_requests WHERE 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. Use Request a Secret WS (need check actuality !!!)
ParameterSourceaction 'GET' bucket 'medication-request-requests' resource_id : MEDICATION_REQUEST_ID resource_name : MEDICATION_REQUEST_NAME - 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 | NULL |
recall_reason | NULL |
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: medication_request_form.docx
Update Medication request Request status
Update Medication request Request:
UPDATE medication_request_requests SET status = 'SIGNED' WHERE id = {:id}
Send SMS for person
- Get authentication_method of MPI
- If authentication_method == OTP - send SMS:
- Generate text SMS (call Manmethod- templates rendering service with template "TEMPLATE_SMS_FOR_SIGN_MEDICATION_REQUEST" (!!! TBD).
- Sending SMS for MPI via service .... (!!! TBD)