Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

  • Validate request using JSON schema

    • in case of error - return 422 with appropriate validation error

  • Check that signed content contains all required fields and is equal to stored object

    • Decode signed content

    • Render requested medication request using Get Medication request by ID by Pharmacy User

    • Check that rendered and decoded data matches (except for reject_reason_code and reject_reason fields)

      • in case of error - return 422 ("Signed content does not match the previously created content")

...

For more information look at Medication request status model

Validate reject reason code

...

  1. Save signed content to media storage.

  2. Update Medication request in OPS DB:

    1. set status = 'REJECTED'

    2. set reject_reason_code = $.reject_reason_code

    3. set reject_reason = $.reject_reason

    4. set updated_by = user_id

    5. set updated_at = now()

    6. set rejected_by = user_id

    7. set rejected_at = now()

  3. Send SMS for person

    1. If Medication request has program with medical program setting medication_request_notification_disabled request_notification_disabled = true, then don't send SMS.

      Else:

      1. Get authentication_method of person from MPI

      2. If authentication_method == OTP, then send SMS to a person from Medication request:

        1. Generate SMS text

          1. get template from reject_template_sms parameter

          2. enrich template with data from Medication request

        2. Send SMS to a person

  4. Render response according to specification

  5. Add new record to Event manager

field

value

event_type

StatusChangeEvent

entity_type

MedicationRequest

entity_id

$.id

properties.status.new_value

$.status

event_time

$.update_at

changed_by

$.changed_by

  1. if the medication request is based on the activity with quantity:

    1. Recalculate and set remaining_quantity for the activity as described at Create Medication Request: Validate based_on (p. 2.d.1 )and do not include current MR but include all MD which related to current MR