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

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

Version 1 Current »

Apiary

Private. Get Medication request by ID

Purpose

This WS is designed to return Medication request detail for NHS_ADMIN. In the response of these endpoint person_id is return in hashed form. 
Search Medication Request is possible in 2 options: by `medication_request.id` OR `medication_request.request_number`.

According to requirements user of NHS_ADMIN can see all Medication request (without limitations) 

Input parameters (filters)

  • id 

Validate request

Search Medication Request

  1. Search record by `$.id` in column `medication_request.id

    1. If not found -  Search record by `$.id` in column `medication_request.request_number`

      1. If not found - Return  404 in case "Not found record in DB with this ID!"

Validate FK

  1.  Read data from `ops_db.medication_requests` by `id`

  2. Validate legal_entity_id - legal_entity_id exists

    • Return 422 in case validation fails (422 EView)

  3. Validate employee_id - employee_id exists

    • Return 422 in case validation fails (422 EView)

  4. Validate division_id - division_id exists

    • Return 422 in case validation fails (422 EView)

  5. Validate medical_program_id - medical_program_id exists

    • Return 422 in case validation fails (422 EView)

  6. Validate all medication_id - medication_id exists

    • Return 422 in case validation fails (422 EView)

  7. Validate patient_id - mpi_id exists

    • Return 422 in case validation fails (422 EView)

Logic WS

  1. Verify the validity of access token

    1. Return 401 in case validation fails

  2. Check user scopes in order to perform this action (scope = 'medication_request_admin:details')

    1. Return 403 in case invalid scope(s)

  3. Get `client_type` from `mithril.clients

  4. Search Medication request by $.id: 

    SELECT * FROM medication_requests MR
    WHERE (MR.id = $.id OR MR.request_number = $.id) 
    	AND MR.is_active = TRUE
       
    

Response (output)

  1. Return object with responce structure from WS Sign Medication Request.

  • No labels