ЕСОЗ - публічна документація

RC_Sign Medication Request Request (modified - EN)

Specification

Apiary

Purpose

This WS is designed to sign Request for Medication request (patch). If successful signed - automatically create Medication request.

Input parameters (filters)

  • id 

Authorize

  1. Verify the validity of access token

  2. Check user scope (scope = 'medication_request_request:sign') in order to perform this action

    1. 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)

  1. Validate request using JSON schema 

    1. In case validation fails - generate 422 error

Validate request status

Purpose validation: Valid ability transition.

  1. For info - status charts: Medication request Request Status Chart

  2. Get Medication request Request status by $.id

  3. Check status == NEW

    1. 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.

  1.  

    Get data 

    SELECT data FROM medication_request_requestsWHERE id = $.id
  2. 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

  1. Get url for medication request upload.

Parameter

Source

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

  1.  Create new record in medication_requests with status ACTIVE

    1. if there is existing record in the medication_requests table with the same id and medication_request_request_id, return ok to IL

  2. Mapping (where <rd>medication_request_request.data )

Destination

Source

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

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:

  1. Get authentication_method of MPI

  2. If authentication_method == OTP -  send SMS:

    1. Generate text SMS (call Man method- templates rendering service with template "TEMPLATE_SMS_FOR_SIGN_MEDICATION_REQUEST".

    2. Sending SMS for MPI

  3. If authentication_method == OFFLINE (or medication_request_notification_disabled = true) -  set medication_request_request.verification_code to MEDICATION_REQUEST_TEMPLATE

ЕСОЗ - публічна документація