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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 39 Next »

Specification

Purpose

This WS is designed to sign Request fo Medication request (patch). If successefull 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.
See service specification

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_requests
    WHERE 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. Use Request a Secret WS (need check actuality !!!)

    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
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
statusACTIVE
is_activetrue
recall_atNULL
recalled_by
NULL
recall_reason
NULL
request_for_medication_request_id$.id
inserted_at:timestamp
inserted_byuser_id
updated_at:timestamp
updated_byuser_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

ParameterSource
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 

  1. Get authentication_method of MPI
  2. If authentication_method == OTP -  send SMS:
    1. Generate text SMS (call Manmethod- templates rendering service with template "TEMPLATE_SMS_FOR_SIGN_MEDICATION_REQUEST" (!!! TBD).
    2. Sending SMS for MPI via service .... (!!! TBD)
  • No labels