Versions Compared

Key

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

Purpose

...

  • User can see all Medication Requests of which he is an author

  • User of MSP, PRIMARY_CARE, OUTPATIENT (DOCTOR, SPECIALIST, etc) can see all Medication requests from the user's legal entity

  • User of MSP, PRIMARY_CARE (DOCTOR, etc) can see all the Medication requests of the patients whom he has an active declaration with by yourself a doctor (employee_id)

  • User of PHARMACY or NHS_ADMIN (PHARMACIST, etc) can see all Medication requests (without limitations)

  • User of MSP, PRIMARY_CARE, OUTPATIENT (DOCTOR, SPECIALIST, etc) can see all Medication requests based on the approval of the care plan that is contained in the Medication request

Specification

Page Properties

Project Name

Електронний рецепт

COVID-certificate

Project abreviation

ePrescription

SVC

Developer

API paragraph not found

Розробник методу API. Наприклад, Edenlab

Project Manager

API paragraph not found

Mykhailo Zhushman (Unlicensed)

Tech Lead

API paragraph not found

Product Owner

API paragraph not found

Yevhen Batura NHSU

Вusiness analyst

API paragraph not found

Taras Khometa (Unlicensed)

Status

Status
colourGreen
titleAPPROVED

Status
colourGreen
titleAPPROVED

Version

API paragraph not found

1.0

Date of release

API paragraph not found

Link

https://uaehealthapi.docs.apiary.io/#reference/public.-reimbursement/medication-request/get-medication-request-by-id

Посилання на Apiary або Swagger

Resource

/api/medication_requests/{{id}}

Наприклад: /api/persons/create

Scope

medication_request:details

Зазначається потрібний scope

Components

ePrescription, Reimbursement

Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription

Microservices

API paragraph not found

Перелік мікросервісів, які використовує метод API. Наприклад: Auth, ABAC

Protocol type

REST

Тип протоколу, який використовується запитом, наприклад: SOAP | REST

Request type

GET

Тип HTTP методу, який використовується запитом, наприклад: POST | GET…

Sync/Async

Sync

Метод є синхронним чи асинхронним?

Logic

  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:details')

    1. Return 403 in case invalid scope(s)

  3. Get `client_type` from `mithril.clients

...

  1. Get `my_party_id`  from `$.context.user_id`

    1. Return 500 in case ("Not found party for this user!")  

  2. Get list from `prm.employees` for this `party_id`  & `$.context.legal_entity_id`

  3. Search Medication requests by filters: 

    Code Block
    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 OR MR.request_number = $.id) 
    	AND MR.employee_id == E.id
    	AND MR.is_active = TRUE
       
    

Logic WS for medication requests based on care plan

  1. Get party_id  from $.context.user_id

  2. Get list from $.prm.employees for this party_id

  3. Get care_plan_id from $.medication_requests.based_on_care_plan_id

  4. Check $.approvals for user's employees (granted_to) on care_plan_id (granted_resources) and $.medication_requests.person_id (granted_by)

  5. Search Medication requests by filters: based_on_care_plan_id, person_id.

    Code Block
    SELECT * FROM medication_request MR
    WHERE (MR.id = $.id OR MR.request_number = $.id) 
        AND MR.based_on_care_plan_id = $.id
        AND MR.person_id = $.id
        AND MR.is_active = TRUE
    

...

HTTP status code

Message

What caused the error

200

Response

 

401

Invalid access token

 

403

Invalid scope

404

Not found medication request record in DB with this ID!

422

Error

500

Not found party for this user!

...