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

RC_Rx_Reject Medication request request (modified - )

Purpose

This WS is designed to reject previously created Medication request request.

Key points

  1. Only authenticated and authorized user with appropriate scope can reject Medication request request.

  2. Medication request request can be rejected only from ‘NEW' status.

Specification

Apiary

Authorization

  1. Verify the validity of access token

    • in case of error - return 401 (“Invalid access token”) in case of validation fails

  2. Verify that token is not expired

    • in case of error - return 401 (“Invalid access token”)

  3. Check user scopes in order to perform this action (scope = 'medication_request_request:reject')

    • return 403 (“Your scope does not allow to access this resource. Missing allowances: medication_request_request:reject”) in case of invalid scope(s)

Validations

Validate user

Medication request request rejection is allowed for user if he has one of the following active and approved employee that:

  • is an author of the Medication request request (medication_request_request.employee_id)

  • has an approval on write Care plan if Medication request request based on the Care plan (medication_request_request.based_on)

  • is med_admin from legal entity where Medication request request is created

    • in case of error - return 409 ("Employee is not author of medication request request, doesn't have approval or required employee type")

Validate transition

  • Get status of Medication request request by $.id in IL DB. Check that Medication request request is in status 'NEW'

    • in case of error - return 409 ("Invalid status Request for Medication request for reject transition!")

For more information look at RC_Rx_Medication request status modelarchived .

Service logic

  1. Update Medication request request data in IL DB:

    1. set status  =  'REJECTED'

    2. updated_by = user_id

    3. updated_at = now()

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