Versions Compared

Key

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

...

Page Properties
idAPI_Specification

Link

https://ehealthmedicaleventsapi.docs.apiary.io/#reference/device-dispenses/create-device-dispense/create-device-dispense

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

Resource

/api/patients/{{patient_id}}/device_dispenses

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

Scope

device_dispense:write

Scope для доступу

Components

Devices

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

Microservices

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

Protocol type

REST

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

Request type

POST

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

Sync/Async

Async

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

Public/Private/Internal

Public

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

Logic

  • Fill in the following fields:

    • status = IN_PROGRESS

    • status_reason = null

    • subject. Set hashed patient_id from URL

    • performer_legal_entity. Set client_id from token

    • quantity.unit. Set description according to quantity code and system

    • inserted_at. Set current date and time

    • updated_at. Set current date and time

    • inserted_by. Set current user from token

    • updated_by. Set current user from token

  • Save data to device_dispenses collection in MongoDB according to /wiki/spaces/CSI/pages/17467572335

  • Send StatusChangeEvent to Event Manager

...

  • Check that device request exists

    • in case of error - return 422 ('Device request not found')

  • Check that intent specified in Device request is order

    • in case of error - return 409 error ('Only device request with intent = 'order' can be dispensed')

  • Сheck that Device request is in status 'ACTIVE'

    • in case of error - return 409 422 error ('Device request is not active')

  • Check that dispense_valid_to is greater or equal to current date

    • in case of error - return 409 ('Device request is expired for dispense')

...

  • Check that program in dispense is the same as program in device request (request.program.identifier.value = device_requests.program.identifier.value)

    • in case of error - return 409 422 ('"Program in dispense doesn't match the one in device from request 'params")

Qualify Device request

This validation must be done only if medical_program exists in request and medical_program is the same as in device request

...

  • Check that there is no other IN_PROGRESS device dispenses based on the same device request

    • Find all device dispenses related to the same device request ($.based_on)

    • Check that there are no records in status in-progress where inserted_at + config device_dispense_ttl >= current date-time()

      • in case of error - return 422 "Other active device dispense dispenses already exist."

Validate Dispense details

...