Versions Compared

Key

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

Purpose

This method intended to get all Device dispenses by legal entity from token.

Specification

Page Properties
idAPI_Specification

...

або Swagger

Resource

/api/device_dispenses

Посилання на ресурс, наприклад: /api/persons/create

Scope

device_dispense:read

Scope для доступу

Components

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

Microservices

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

Protocol type

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

Request type

GET

Тип запиту API, наприклад: GET, POST, PATCH…

Sync/Async

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

Public/Private/Internal

Потрібно зазначити тип методу за ступенем доступності

Logic

Service returns specified Device dispenses related to the legal entity from token:

  • Get Device dispenses from device_dispenses (MongoDB)

  • Filter list above by submitted search parameters

  • Render a response according to specification.

Filters

Filter

Values

Type

Description

Example

based_on

String

9075e0e2-6b57-47fd-aff7-324806efa7e6

performer_legal_entity

String

9075e0e2-6b57-47fd-aff7-324806efa7e6

location

String

9075e0e2-6b57-47fd-aff7-324806efa7e6

performer

String

9075e0e2-6b57-47fd-aff7-324806efa7e6

status

String

completed

when_handed_over_from

String

date of dispense

2023-08-02T10:45:16.000Z

when_handed_over_to

String

date of dispense

2023-08-02T10:45:16.000Z

page

Number

Page number

2

page_size

Number

A limit on the number of objects to be returned, between 1 and 300. Default: 50

50

Request structure

API paragraph not found

Authorize

  • Verify the validity of access token

    • Return (401, 'Invalid access token') in case of validation fails

  • Verify that token is not expired

    • in case of error - return (401, 'Invalid access token')

  • Check user scopes in order to perform this action (scope = 'device_dispense:read')

    • Return (403, 'Your scope does not allow to access this resource. Missing allowances: device_dispense:read') in case of invalid scope(s)

...

Headers

  • Content-Type:application/json

  • Authorization:Bearer mF_9.B5f-4.1JqM

  • api-key:aFBLVTZ6Z2dON1V

Request data validation

Validate User

  • Extract client_id (performer_legal_entity) from token.

    • Return empty array in case employee has no access to medication dispense.

Service logic

Service returns specified Device dispenses related to the legal entity from token:

...

Get Device dispenses from device_dispenses (MongoDB)

...

Filter list above by submitted search parameters

...

Processing

API paragraph not found

Response structure

See on Apiary

Expand
titleResponse example
Code Block
{
  "meta": {
    "code": 200,
    "url": "http://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "data": [
    {
      "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
      "based_on": {
        "identifier": {
          "type": {
            "coding": [
              {
                "system": "eHealth/resources",
                "code": "device_request"
              }
            ]
          },
          "value": "b4a6d991-0bf7-476f-b3cf-bec83f044b1b"
        },
        "display_value": "null"
      },
      "status": "completed",
      "subject": {
        "identifier": {
          "type": {
            "coding": [
              {
                "system": "eHealth/resources",
                "code": "patient"
              }
            ]
          },
          "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
        },
        "display_value": "null"
      },
      "performer": {
        "identifier": {
          "type": {
            "coding": [
              {
                "system": "eHealth/resources",
                "code": "employee"
              }
            ]
          },
          "value": "b4a6d991-0bf7-476f-b3cf-bec83f044b1b"
        },
        "display_value": "Мельник Микола Микитович"
      },
      "location": {
        "identifier": {
          "type": {
            "coding": [
              {
                "system": "eHealth/resources",
                "code": "division"
              }
            ]
          },
          "value": "b4a6d991-0bf7-476f-b3cf-bec83f044b1b"
        },
        "display_value": "Перше відділення"
      },
      "when_handed_over": "2018-08-02T10:45:16.000Z",
      "note": "Some notes",
      "performer_legal_entity": {
        "identifier": {
          "type": {
            "coding": [
              {
                "system": "eHealth/resources",
                "code": "legal_entity"
              }
            ]
          },
          "value": "c5a6d991-0bf7-476f-b3cf-bec83f044b2a"
        },
        "display_value": "Комунальне підприємство Медлаб"
      },
      "program": {
        "identifier": {
          "type": {
            "coding": [
              {
                "system": "eHealth/resources",
                "code": "medical_program"
              }
            ]
          },
          "value": "c5a6d991-0bf7-476f-b3cf-bec83f044b2a"
        },
        "display_value": "Доступні медичні вироби"
      },
      "details": [
        {
          "device": {
            "identifier": {
              "type": {
                "coding": [
                  {
                    "system": "eHealth/resources",
                    "code": "device_definition"
                  }
                ]
              },
              "value": "b4a6d991-0bf7-476f-b3cf-bec83f044b1b"
            },
            "display_value": "null"
          },
          "program_device": {
            "identifier": {
              "type": {
                "coding": [
                  {
                    "system": "eHealth/resources",
                    "code": "program_device"
                  }
                ]
              },
              "value": "b4a6d991-0bf7-476f-b3cf-bec83f044b1b"
            },
            "display_value": "null"
          },
          "quantity": {
            "value": 10,
            "system": "device_unit",
            "code": "piece",
            "unit": "шт"
          },
          "sell_price": 18.65,
          "discount_amount": 150,
          "reimbursement_amount": 450
        }
      ],
      "payment_id": "1239804",
      "payment_amount": 50,
      "inserted_at": "2017-04-20T19:14:13Z",
      "inserted_by": "e1453f4c-1077-4e85-8c98-c13ffca0063e",
      "updated_at": "2017-04-20T19:14:13Z",
      "updated_by": "2922a240-63db-404e-b730-09222bfeb2dd"
    }
  ],
  "paging": {
    "page": 2,
    "page_size": 50,
    "total_entries": 1000,
    "total_pages": 20
  }
}

Post-processing processes

API paragraph not found

HTTP status codes

Page Properties
idAPI_HTTP status codes

HTTP status code

Message

What caused the error

200