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

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 6 Next »

Specification 

Apiary
JSON Schema response
SPECS

Purpose

This WS is designed to return Medication request detail.

Input parameters (filters)

  • id 

Validate request

Validate FK

  1. Validate id - medication_request_id exists
    1. Return  404 in case not found record in DB with this ID

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:detail')
    1. Return 403 in case invalid scope(s)
  3. Get `my_party_id`  from `$.context.user_id`
    1. Return 500 in case ("Not found party for this user!")  
  4. Get list of employees for this `party_id`  & `$.context.legal_entity_id` (if not NULL) 
  5. Search Medication requests by filters: 

  6. SELECT * FROM medication_request MR
        INNER JOIN employees E
            ON E.party_id = my_party_id
                AND (E.id = $.employee_id OR $.employee_id IS NULL)
                AND (E.legal_entity_id == $.context.legal_entity_id OR $.context.legal_entity_id IS NULL)
        LEFT JOIN declarations D
            ON D.Employee_id = E.id 
                AND E.status = ACTIVE
                AND D.status = ACTIVE
                AND MR.person_id = D.person_id
    WHERE MR.id = $.id
    	AND MR.employee_id == E.id
    	AND MR.is_active = TRUE
       

Response (output)

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