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

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

REST API method / Метод REST API (настанова) (remove the link block before publishing the document)

Properties of a REST API method document

Document type

Метод REST API

Document title

[Document status] REST API [Назва методу] [ID методу]

Guideline ID

GUI-0011

Author

@

Document version

1

Document status

DRAFT

Date of creation

ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD)

Date of update

ХХ.ХХ.ХХХХ (дата зміни версії)

Method API ID

API-001-001-001-0001

Microservices (namespace)

IL

Component

ePrescription

Component ID

COM-005-008

Link на API-специфікацію

https://ehealthmisapi1.docs.apiary.io/#reference/public.-reimbursement/medication-dispense/create-medication-dispense-by-pharmacy-user

Resource

{{host}}/api/pharmacy/medication_dispenses

Scope

medication_dispense:create

Protocol type

REST

Request type

POST

Sync/Async

Sync

Public/Private

Public

Purpose

This method is designed to create Medication dispense. The medication dispense is the result of a pharmacy system responding to a medication order.

Key points

  1. Only authenticated and authorized users of legal entity can create Medication dispense.

  2. Can be used both for creating and processing Medication dispense (depending on the requirements of the program).

    1. In order to process dispense payment_id (optional) and payment_amount should be added.

  3. Invoke Qualify Medication request by ID for receiving information about program participants.

  4. Dispense of medication is possible only under Medication request and during the period specified in Medication request.

  5. Several medications from different manufacturers with the same substance can be dispensed at a time.

    1. The total of medication_qty should be less or equal to the medication quantity specified in the Medication request.

Logic

  1. Get skip_medication_dispense_sign from medical program settings.

  2. If skip_medication_dispense_sign = false or absent:

          2.1. Check payment_id, payment_amount is absent in the request.

in case if present - return 422 with path: $.<field_name>  and message "schema does not allow additional properties"

          2.2. Add record to medication_dispenses table:

Parameter

Source

Description

id

UUID

Autogenerated

payment_id

NULL

NULL for new records

payment_amount

NULL

NULL for new records.

status

Const: NEW

NEW skip_medication_dispense_sign = false

See: Medication dispense status model

is_active

Const: TRUE

Alwayls TRUE for new records

inserted_at

Timestamp: now()

Get current date-time

inserted_by

Token: user_id

Extract user from token

updated_at

Timestamp: now()

Get current date-time

updated_by

Token: user_id

Extract user from token

          2.3. Add records to medication_dispense_details table:

Parameter

Source

Description

id

UUID

Autogenerated

medication_dispense_id

FK: medication_dispense

 

reimbursement_amount

Reimbursement

 

          2.4. Add records to medication_2d_codes table (for each 2d code object in array):

Parameter

Source

Description

id

UUID

Autogenerated

medication_dispense_id

FK: medication_dispense

 

medication_2d_code

Request: medication_2d_codes

 

inserted_at

Timestamp: now()

Get current date-time

  1. If skip_medication_dispense_sign =

true:

             3.1. Check if payment_amount in the request.

  • in case is absent - return 422 with path: $.payment_amount and message "required property payment_amount was not present"

             3.1. Call Process Medication Dispense by Pharmacy User process, but without validation of the previously created (NEW) medication dispense, digital sign and storage signed content to the bucket.

             3.2. Add records as described on steps 2.2-2.4, but with following differences: 

             medication_dispenses table

Parameter

Source

Description

payment_id

Request: payment_id

optional parameter

payment_amount

Request: payment_amount

optional parameter

status

Const: PROCESSED

PROCESSED skip_medication_dispense_sign = true
See: Medication dispense status model

Preconditions

  1. Medication Request should be Сreated by MSP

  2. Medication Request should be found and qualified by pharmacist

Configuration parameters

Description of the configuration parameters that are used when processing a request in the system

Dictionaries

Provides a list of links to dictionaries that are available in Confluence

Input parameters

Description of input parameters

Input parameter

Mandatory

Type

Description

Example

1

code

O

String

-

314

Request structure

See on API-specification

 Example
{
  "medication_dispense": {
    "medication_request_id": "f08ba3a3-157a-4adc-b65d-737f24f3a1f4",
    "dispensed_at": "2017-08-17",
    "dispensed_by": "Іванов Іван Іванович",
    "division_id": "2fc70f30-08dc-493c-8d08-925905d7b1e8",
    "medical_program_id": "6ee844fd-9f4d-4457-9eda-22aa506be4c4",
    "dispense_details": [
      {
        "program_medication_id": "64c06ebc-0266-4645-85f0-7a6900d7dfbe",
        "medication_id": "787b6ef1-1d3a-4129-849c-87716c9a2130",
        "medication_qty": 10.34,
        "sell_price": 18.65,
        "sell_amount": 186.5,
        "discount_amount": 150,
        "medication_2d_codes": [
          {
            "medication_2d_code": "0104820005161713171812001022431115 211XV82HPV"
          }
        ]
      }
    ],
    "payment_id": "1239804",
    "payment_amount": 50
  }
}

Headers

Key

Value

Mandatory

Description

Example

1

2

3

Request data validation

Validate schema

  1. Validate request according to JSON Schema

    • Check presence of extra parameters

      • In case of error - return 422 ('schema does not allow additional properties')

    • Check presence of required parameters

      • In case of error - return 422 ('required property %{property} was not present')

    • Check note length (optional, nullable) - it must be no longer than 1000 characters

      • In case of error - return 422 ('expected value to have a maximum length of 1000 but was {actual length}')

Authorize

  1. Verify the validity of access token

    • in case of error - return 401 (“Invalid access token”) in case of validation fails

  2. Verify that token is not expired

    • in case of error - return 401 (“Invalid access token”)

  3. Check user scopes in order to perform this action (scope = 'medication_dispense:write')

    • return 403 (“Your scope does not allow to access this resource. Missing allowances: medication_dispense:write”) in case of invalid scope(s)

  4. If BLOCK_UNVERIFIED_PARTY_USERS is true, then check party's data match following condition: verification_status != NOT_VERIFIED or (verification_status = NOT_VERIFIED and updated_at <= current_date - UNVERIFIED_PARTY_PERIOD_DAYS_ALLOWED):

    • in case not match - return 403 ("Access denied. Party is not verified")

Validate Legal entity

  • Extract client_id from token

  • Check legal entity status is ACTIVE

    • In case of error - return 422 ('Legal entity is not active')

  • Check legal entity type in MEDICATION_DISPENSE_LEGAL_ENTITY_TYPES config parameter

    • in case of error - return 409 ('Invalid legal entity type')

Validate Division

Division must have active pharmacy license in order to dispense medications

  1. Validate division is exist

    1. in case of error - return 409 ("Division not found")

  2. Validate division is active

    1. in case of error - return 409 ("Division is not active")

  3. Validate division belongs to user's legal entity

    1. in case of error - return 409 ("Division does not belong to user's legal entity")

  4. If chart parameter DISPENSE_DIVISION_DLS_VERIFY is on, then validate division is DLS verified

    1. check that division.dls_verified = true

      1. in case of error - return 409 ('Invalid division dls status')

  5. If chart parameter MEDICAL_PROGRAM_PROVISION_VERIFY, then check division provide each submitted program. For each Medical Program Provision validate following:

    1. If the medical program has no setting skip_contract_provision_verify or it is equal to false/null: 

      1. it is exist and active:

        1. in case of error - return status=INVALID for a program, rejection_reason= "Division does not provide the medical program"

      2. it relates to the actual reimbursement contract: contract.start_date <= current_date <= contract.end_date, is_active = true, status = VERIFIED.

        1. in case of error - return status=INVALID for a program, rejection_reason="Medical program provision is not related to any actual contract for the current date"

    2. else if skip_contract_provision_verify = true, then skip provision verification for the medical program

  6. Get license_types_allowed parameter from settings of medical program from request $.medical_program_id:

    1. if it is exists and not empty, get list of all license types from parameter.
      Check that division has active healthcare services with following parameters:

      1. legal_entity_id = client_id from access token

      2. division_id = division_id from request

      3. status = 'ACTIVE'

      4. licensed_healthcare_service.status = 'ACTIVE'

      5. healthcare_service.license_id is not null and licenses.type = value from license_types_allowed parameter

        1. in case of error - return 409 ('Division must have active licenses to dispense medication request')

Validate Medication request

  1. Check that medication_request_id is exist

    1. in case of error - return 422 ('Medication request not found')

  2. Check intent specified in Medication request equal to order

    1. in case of error - return 409 error ('Medication request with intent PLAN cannot be dispensed')

  3. Сheck that Medication request is_active = true and status == 'ACTIVE'

    1. in case of error - return 409 error ('Medication request is not active')

  4. Check that Medication request not blocked (medication_requests.is_blocked = false or NULL)

    1. medication_requests.is_blocked = false or NULL

    2. medication_requests.blocked_to <= now() (datetime) or NULL

      1. in case of error - return 409 error ('Medication request is blocked')

  5. Check that dispense date is in period specified in Medication request (dispense_valid_from >= current_date() and dispense_valid_to <= current_date())

    1. in case of error - return 409 error ('Invalid dispense period')

  6. Check if medication_request.based_on is present and not null AND medication_program is absent:

    1. Verify Care plan:

      1. It should be in active status

        1. in case of error - return 409 (message: "Invalid care plan status")

      2. Care plan's period.end (if exist) should be greater than current date or equal.

        1. in case of error - return 409 (message: “Care plan expired“)

    2. Verify care plan Activity:

      1. It has scheduled, in_progress status

        1. in case of error - return 409 (message: "Invalid activity status")

Qualify Medication request

  1. Check that medication request is valid and available for dispense

    1. Invoke Qualify method

    2. Get medical_program_id from request, check that medical_program_id from request equals to medication_requests.medical_program_id

      1. if true, use medication_requests.medical_program_id as program for qualify

      2. if false, use medical_program_id from request as program for qualify

    3. Check that program_medication_id is in Qualify response

      1. Medication request is prohibited for dispense in case $.data[?(@.program_id=medication_requests.medical_program_id)].status = 'INVALID' or program_medication_id is absent in qualify response

        1. In case of error - return 409 error ('Medication request can not be dispensed. Invoke qualify medication request API to get detailed info')

      2. Medication request is allowed for dispense in case $.data[?(@.program_id=medication_requests.medical_program_id)].status = 'VALID' and program_medication_id is present in qualify response

Validate Medical program

  1. Check that medical_program_id is exist

    1. in case of error - return 422 ('Medical program not found')

  2. Сheck that medical_program_id is_active = true and status == 'ACTIVE'

    1. in case of error - return 422 error ('Medication request is not active')

  3. Check if medical program has setting medical_program_change_on_dispense_allowed parameter from settings of medical program from medication request:

    1. if it is false (absent), medical program in dispense must be the same as medical program in medication request (request.medical_program_id = medication_requests.medical_program_id)

      1. in case of error - return 409 ('Medical program in dispense doesn't match the one in medication request')

  4. Check if medical program has setting skip_contract_provision_verify = true, than skip contract validation

    1. Else validate there is a contract in PRM.contracts that meets following requirements:

      1. contracts.type==reimbursement

      2. contracts.status==VERIFIED

      3. Contract dates: start_date <= current_date & end_date >= current_date

      4. contracts.contractor_legal_entity_id=token.client_id

      5. $division_id in contract_divisions

      6. contracts.medical_program_id==$.medical_program_id

      7. сontracts.is_suspended == false

    2. in case of error - return 409 ('Program cannot be used - no active contract exists')

Validate Code

  1. Check that code in request is equal to code in medication_request

    1. In case code exists in request - it should match with code in medication_request

      1. in case of error - return 403 (message: “Incorrect code“)

Validate Medication dispenses

  1. Check all connected medication dispenses:

    1. there isn't medictaion dispenses with the 'NEW' status

      1. in case of error - return 422 "Medication dispense in status NEW already exist."

Validate Dispense details

  1. Check that medical_program_id is exist and active

  2. Check that medication exists and is active

    1. medications.is_active = true

    2. medications.type is ‘BRAND' or ‘INNM_DOSAGE'

    3. if medications.type = 'BRAND'

      1. ingredients.medication_child_id = medication_request.medication_id and ingredients.is_primary = true

    4. if medications.type = 'INNM_DOSAGE'

      1. dispense_details.medication_id = medication_request.medication_id

    5. check dispensed_at

      1. if funding_source = "NHS" then dispensed_at = date.now()

        • in case of error - return 422 ('For Medical program with funding_source = "%{funding_source}" medication dispense dispensed_at must be equal to current date')

      2. else if funding_source != "NHS" then dispensed_at <= date.now()

        • in case of error - return 422 ('For Medical program with funding_source = "%{funding_source}" medication dispense dispensed_at must be equal to or less than current date')

Validate Medication quantity

  1. Get multi_medication_dispense_allowed parameter from medical program settings:

    1. if it is true - check that requested medication quantity less or equal to available medication quantity in Medication Request (the way how to calculate available medication quantity is following:
      available_qty = medication_request.medication_qty - used_qty,
      where used_qty is the sum of medication_qty from medication_dispenses with medication_request_id = $.medication_request_id)

      1. medication_qty <= available_qty

        1. in case of error - return 422 ('Dispensed medication quantity must be lower or equal to medication quantity in Medication Request. Available quantity is #{available_qty}')

    2. if it is false (absent) - check that requested medication quantity equal to medication quantity in Medication Request

      1. medication_qty = medication_request.medication_qty

        1. in case of error - return 422 ('Dispensed medication quantity must be equal to medication quantity in Medication Request')

Validate Program medication

In case medications are dispensed to patient under specific medical program, program medication id must be provided provided by client or calculated by the system

In case program medication id exists in request:

  1. Check that this program medication id relates to provided medical program and relates to provided medication

    1. in case of error - return 422 ('Invalid program medication id')

Calculate program medication id if it is absent in request:

  1. Get last program_medication_id related to medical program and medication

    1. in case of error - return 422 ('There are no active program medications for this program and medication')

Validate Medication multiplicity

This validation must be done only in case when medication dispensed to patient as brand. In case of extemporaneous medications this validation must be skipped

  1. Check that requested medication quantity in dispense for all medications is multiplier of package_min_qty for this medications.id

    1.  Mod($medication_qty, medications.package_min_qty) = 0

      1. in case of error (if at least one of medication don't pass verification) - return 422 error ('Requested medication brand quantity is not a multiplier of package minimal quantity')

Validate Medication discount amount

  1. Define reimbursement_type (get from program_medications by program_medication_id).

  2. Validate percentage discount price.
    Check if reimbursement_type == percentage and percentage_reimbursement_amount = 0
    (the way how to calculate percentage_reimbursement_amount is following:
    percentage_reimbursement_amount = sell_price (from request) * percentage_discount (from program_medications) /100)

    • In case if discount_amount != 0 - return 422 ('Requested discount price must be equal to 0')

    • Else (if discount_amount = 0)  - finish validation (do not validate 3, 4)

  3. Validate allowed reimbursement amount.
    Check that requested discount price is less or equal to allowed reimbursement amount for the requested medication quantity
    (the way how to calculate allowed reimbursement amount is below.
    for type == percentage use percentage_reimbursement_amount, for fixed = use reimbursement_amount from program_medications):
      There are two different formulas depending on medication type to be dispensed

    1. If medication.type = ‘BRAND’:

      1. discount_amount <= reimbursement_amount * (medication_qty/package_qty)

    2. If medication.type = ‘INNM_DOSAGE’:

      1. discount_amount <= reimbursement_amount * medication_qty

  4. Validate the ratio of discount price to reimbursement amount.
    Check that the ratio of requested discount price to allowed reimbursement amount is more or equal to allowed rule (including deviation) for the requested medication quantity
    (the way how to calculate allowed reimbursement amount is below.
    for type = percentage use percentage_reimbursement_amount, for fixed - use reimbursement_amount from program_medications):
          There are two different formulas depending on medication type to be dispensed

    1. If medication.type = ‘BRAND’:

      1. discount_amount/ (reimbursement_amount * (medication_qty/package_qty)) >= 1 - deviation

    2. If medication.type = ‘INNM_DOSAGE’:

      1. discount_amount/ (reimbursement_amount * medication_qty) >= 1 - deviation

  5. In case of error - return 422 ('The ratio of requested discount price to allowed reimbursement amount must be greater or equal to <1 - deviation>')

Validate 2d codes

  • Check that medication_2d_codes array contains at least one element (array is not empty)

    • in case of error - return 422 ('Expected a minimum of %{min} items but got %{actual}')

  • For all objects in array check that string 'medication_2d_code' is not null or empty

    • in case of error - return 422 ('Not allowed to save empty 2d code')

Processing

A list of processes related to receiving, changing or transmitting data according to the logic defined in the REST API

Response structure examples

See on API-specification

 Example
{
  "meta": {
    "code": 201,
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "data": {
    "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
    "medication_request": {
      "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
      "status": "ACTIVE",
      "request_number": "0000-243P-1X53-EH38",
      "created_at": "2017-08-17",
      "started_at": "2017-08-17",
      "ended_at": "2017-09-16",
      "dispense_valid_from": "2017-08-17",
      "dispense_valid_to": "2017-09-16",
      "person": {
        "short_name": "Петро І. І.",
        "age": 35
      },
      "medication_info": {
        "medication_id": "4a63b858-c138-4921-9341-ae9e384bcbd6",
        "medication_name": "Аміодарон 200мг таблетки",
        "form": "PILL",
        "dosage": {
          "numerator_unit": "MG",
          "numerator_value": 200,
          "denumerator_unit": "PILL",
          "denumerator_value": 1
        },
        "ingredients": [
          {
            "id": "1349a693-4db1-4a3f-9ac6-8c2f9e541982",
            "name": "Інсулін деглюдек",
            "name_original": "Insulin degludec",
            "sctid": "52574003",
            "dosage": {
              "numerator_unit": "MG",
              "numerator_value": 200,
              "denumerator_unit": "PILL",
              "denumerator_value": 1
            },
            "is_primary": true
          }
        ],
        "medication_qty": 10.34
      },
      "medical_program": {
        "id": "c7d52544-0bd4-4129-97b0-2d72633e0490",
        "name": "Доступні ліки",
        "medical_program_settings": {
          "care_plan_required": true,
          "employee_types_to_create_medication_request": [
            "SPECIALIST",
            "DOCTOR"
          ],
          "skip_mnn_in_treatment_period": true,
          "skip_employee_validation": true,
          "speciality_types_allowed": [
            "ENDOCRINOLOGY",
            "PEDIATRIC_NEUROLOGY"
          ],
          "conditions_icd10_am_allowed": [
            "A00.0",
            "A00.1"
          ],
          "conditions_icpc2_allowed": [
            "A01",
            "A02"
          ],
          "providing_conditions_allowed": [
            "INPATIENT",
            "OUTPATIENT"
          ],
          "medication_request_max_period_day": 90,
          "skip_medication_request_employee_declaration_verify": true,
          "skip_medication_request_legal_entity_declaration_verify": true,
          "multi_medication_dispense_allowed": true,
          "skip_medication_dispense_sign": true,
          "medication_request_notification_disabled": true,
          "skip_contract_provision_verify": true,
          "medication_dispense_period_day": 90
        },
        "medical_program_settings_text": "Some text",
        "is_active": true,
        "medication_dispense_allowed": true,
        "medication_dispense_allowed_text": "Some text",
        "medication_request_allowed": true,
        "medication_request_allowed_text": "Some text",
        "type": "MEDICATION",
        "funding_source": "NHS",
        "mr_blank_type": "F-1",
        "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"
      },
      "intent": "plan",
      "category": "community",
      "based_on": [
        {
          "identifier": {
            "type": {
              "coding": [
                {
                  "system": "eHealth/resources",
                  "code": "care_plan"
                }
              ]
            },
            "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
          }
        },
        {
          "identifier": {
            "type": {
              "coding": [
                {
                  "system": "eHealth/resources",
                  "code": "activity"
                }
              ]
            },
            "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
          }
        }
      ],
      "context": {
        "identifier": {
          "type": {
            "coding": [
              {
                "system": "eHealth/resources",
                "code": "encounter"
              }
            ]
          },
          "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
        }
      },
      "dosage_instruction": [
        {
          "sequence": 1,
          "text": "0.25mg PO every 6-12 hours as needed for menses from Jan 15-20, 2015.  Do not exceed more than 4mg per day",
          "additional_instruction": [
            {
              "coding": [
                {
                  "system": "eHealth/SNOMED/additional_dosage_instructions",
                  "code": "311504000"
                }
              ]
            }
          ],
          "patient_instruction": "0.25mg PO every 6-12 hours as needed for menses from Jan 15-20, 2015.  Do not exceed more than 4mg per day",
          "timing": {
            "event": [
              "2017-04-20T19:14:13Z"
            ],
            "repeat": {
              "bounds_duration": {
                "value": 10,
                "unit": "days",
                "system": "eHealth/ucum/units",
                "code": "d"
              },
              "count": 2,
              "count_max": 4,
              "duration": 4,
              "duration_max": 6,
              "duration_unit": "d",
              "frequency": 1,
              "frequency_max": 2,
              "period": 4,
              "period_max": 6,
              "period_unit": "d",
              "day_of_week": [
                "mon"
              ],
              "time_of_day": [
                "2017-04-20T19:14:13Z"
              ],
              "when": [
                "WAKE"
              ],
              "offset": 4
            },
            "code": {
              "coding": [
                {
                  "system": "TIMING_ABBREVIATIONS",
                  "code": "patient"
                }
              ]
            }
          },
          "as_needed_boolean": true,
          "site": {
            "coding": [
              {
                "system": "eHealth/SNOMED/anatomical_structure_administration_site_codes",
                "code": "344001"
              }
            ]
          },
          "route": {
            "coding": [
              {
                "system": "eHealth/SNOMED/route_codes",
                "code": "46713006"
              }
            ]
          },
          "method": {
            "coding": [
              {
                "system": "eHealth/SNOMED/administration_methods",
                "code": "419747000"
              }
            ]
          },
          "dose_and_rate": {
            "type": {
              "coding": [
                {
                  "system": "eHealth/dose_and_rate",
                  "code": "'ordered'"
                }
              ]
            },
            "dose_range": {
              "low": {
                "value": 0,
                "unit": "mg",
                "system": "eHealth/ucum/units",
                "code": "mg"
              },
              "high": {
                "value": 0,
                "unit": "mg",
                "system": "eHealth/ucum/units",
                "code": "mg"
              }
            },
            "rate_ratio": {
              "numerator": {
                "value": 0,
                "unit": "mg",
                "system": "eHealth/ucum/units",
                "code": "mg"
              },
              "denominator": {
                "value": 0,
                "unit": "mg",
                "system": "eHealth/ucum/units",
                "code": "mg"
              }
            }
          },
          "max_dose_per_period": {
            "numerator": {
              "value": 0,
              "unit": "mg",
              "system": "eHealth/ucum/units",
              "code": "mg"
            },
            "denominator": {
              "value": 0,
              "unit": "mg",
              "system": "eHealth/ucum/units",
              "code": "mg"
            }
          },
          "max_dose_per_administration": {
            "value": 0,
            "unit": "mg",
            "system": "eHealth/ucum/units",
            "code": "mg"
          },
          "max_dose_per_lifetime": {
            "value": 0,
            "unit": "mg",
            "system": "eHealth/ucum/units",
            "code": "mg"
          }
        }
      ],
      "reject_reason": "Incompatible drugs",
      "reject_reason_code": "PATIENT_REJECT",
      "is_blocked": false,
      "block_reason": "Підозра на фрод",
      "block_reason_code": "WRONG_QTY_DRUG",
      "priority": "routine",
      "prior_prescription": {
        "identifier": {
          "type": {
            "coding": [
              {
                "system": "eHealth/resources",
                "code": "medication_request"
              }
            ]
          },
          "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
        }
      },
      "container_dosage": {
        "system": "MEDICATION_UNIT",
        "code": "ML",
        "value": 4
      }
    },
    "dispensed_at": "2017-08-17",
    "dispensed_by": "Іванов Іван Іванович",
    "party": {
      "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
      "first_name": "Петро",
      "last_name": "Іванов",
      "second_name": "Миколайович"
    },
    "legal_entity": {
      "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
      "name": "Клініка Ноунейм",
      "short_name": "Ноунейм",
      "public_name": "Клініка Ноунейм",
      "type": "MSP",
      "edrpou": "5432345432",
      "status": "ACTIVE"
    },
    "division": {
      "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
      "name": "Бориспільське відділення Клініки Ноунейм",
      "legal_entity_id": "d290f1ee",
      "type": "CLINIC",
      "status": "ACTIVE",
      "mountain_group": false,
      "dls_id": "2872985",
      "dls_verified": true
    },
    "medical_program": {
      "id": "c7d52544-0bd4-4129-97b0-2d72633e0490",
      "name": "Доступні ліки",
      "medical_program_settings": {
        "care_plan_required": true,
        "employee_types_to_create_medication_request": [
          "SPECIALIST",
          "DOCTOR"
        ],
        "skip_mnn_in_treatment_period": true,
        "skip_employee_validation": true,
        "speciality_types_allowed": [
          "ENDOCRINOLOGY",
          "PEDIATRIC_NEUROLOGY"
        ],
        "conditions_icd10_am_allowed": [
          "A00.0",
          "A00.1"
        ],
        "conditions_icpc2_allowed": [
          "A01",
          "A02"
        ],
        "providing_conditions_allowed": [
          "INPATIENT",
          "OUTPATIENT"
        ],
        "medication_request_max_period_day": 90,
        "skip_medication_request_employee_declaration_verify": true,
        "skip_medication_request_legal_entity_declaration_verify": true,
        "multi_medication_dispense_allowed": true,
        "skip_medication_dispense_sign": true,
        "medication_request_notification_disabled": true,
        "skip_contract_provision_verify": true,
        "medication_dispense_period_day": 90
      },
      "medical_program_settings_text": "Some text",
      "is_active": true,
      "medication_dispense_allowed": true,
      "medication_dispense_allowed_text": "Some text",
      "medication_request_allowed": true,
      "medication_request_allowed_text": "Some text",
      "type": "MEDICATION",
      "funding_source": "NHS",
      "mr_blank_type": "F-1",
      "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"
    },
    "details": [
      {
        "medication": {
          "name": "Амідарон",
          "type": "MEDICATION",
          "manufacturer": {
            "name": "ПАТ \"Київський вітамінний завод\"",
            "country": "UA"
          },
          "form": "PILL",
          "container": {
            "numerator_unit": "PILL",
            "numerator_value": 1,
            "denumerator_unit": "PILL",
            "denumerator_value": 1
          },
          "form_pharm": "DISPERSIBLE_TABLET"
        },
        "program_medication_id": "64c06ebc-0266-4645-85f0-7a6900d7dfbe",
        "medication_qty": 0,
        "sell_price": 18.65,
        "sell_amount": 186.5,
        "discount_amount": 150,
        "reimbursement_amount": 450,
        "medication_2d_codes": [
          {
            "medication_2d_code": "0104820005161713171812001022431115 211XV82HPV"
          }
        ]
      }
    ],
    "payment_id": "1239804",
    "payment_amount": 50,
    "status": "NEW",
    "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"
  }
}

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

401

Invalid access token

Недійсний токен доступу

3

403

Your scope does not allow to access this resource. Missing allowances: medication_dispense:write

Для вашої ролі відсутній доступ до цього ресурсу. Необхідний доступ на створення запиту на відпуск рецепта

4

403

Access denied. Party is not verified

Доступ заборонено. Працівник не перевірений

5

403

Incorrect code

Некоректний код

6

409

Invalid legal entity type

Недопустимий тип юридичної особи

7

409

Division not found

Відділення юридичної особи не знайдено

8

409

Division is not active

Структурний підрозділ не активний

9

409

Division does not belong to user's legal entit

Структурний підрозділ не належить юридичній особі користувача

10

409

Invalid division dls status

Недійсний статус підрозділу у ліцензійному реєстрі ДержЛікСліжби

11

409

Division must have active licenses to dispense medication request

Підрозділ повинен мати активні ліцензії для погашення електронного рецепту

12

409

Medication request with intent PLAN cannot be dispensed

Рецепт з типом "План лікування" не може бути погашений

13

409

Medication request is not active

Рецепт не активний

14

409

Medication request is blocked

Рецепт заблоковано

15

409

Invalid dispense period

Недійсний період погашення рецепта

16

409

Invalid care plan status

Невірний статус плану лікування

17

409

Care plan expired

Закінчився термін дії плану лікування

18

409

Invalid activity status

Недопустимий статус призначення

19

409

Medication request can not be dispensed. Invoke qualify medication request API to get detailed info

Рецепт не може бути погашений. Перевірьте його відповідність програмі реімбурсації для отримання більшої інформації

20

409

Medical program in dispense doesn't match the one in medication request

Програма реімбурсації при погашенні рецепту не співпадає з програмою у виписаному рецепті

21

409

Program cannot be used - no active contract exists

Програма реімбурсації не може бути використана - немає активного договору з НСЗУ

22

Специфічні

23

422

schema does not allow additional properties

схема не допускає додаткових властивостей

24

422

required property %{property} was not present

Обов'язкові поля %{property} не вказані

25

422

expected value to have a maximum length of 1000 but was {actual length}

Максимальна кількість символів: 1000

26

422

Legal entity is not active

Юридична особа не активна

27

422

Medication request not found

Рецепт не знайдено

28

422

Medical program not found

Програма реімбурсації не знайдена

29

422

Medication request is not active

Рецепт не активний

30

422

Medication dispense in status NEW already exist

Заявка на погашення рецепта у статусі НОВИЙ вже існує

31

422

For Medical program with funding_source = "%{funding_source}" medication dispense dispensed_at must be equal to current date

Для медичної програми з джерелом фінансування = "%{funding_source}" dispensed_at погашення рецепта має бути рівною поточній даті

32

422

For Medical program with funding_source = "%{funding_source}" medication dispense dispensed_at must be equal to or less than current date

Для медичної програми з джерелом фінансування = "%{funding_source}" dispensed_at погашення рецепта має бути рівною або меншою поточної дати

33

422

Dispensed medication quantity must be lower or equal to medication quantity in Medication Request. Available quantity is #{available_qty}

Відпущена кількість лікарського засобу має бути меншою або дорівнювати кількості лікарського засобу, зазначеній в рецепті. Доступна кількість така: #{available_qty

34

422

Dispensed medication quantity must be equal to medication quantity in Medication Request

Вказана при погашенні кількість лікарського засобу повинна дорінювати кількості у рецепті

35

422

Invalid program medication id

Недійсний ідентифікатор учасника медичної програми

36

422

There are no active program medications for this program and medication

Для цієї програми та лікарського засобу немає активного учасника медичної програми

37

422

Requested medication brand quantity is not a multiplier of package minimal quantity

Запитувана кількість лікарського засобу даного торгового найменування не кратна мінімальній кількості лікарського засобу в первинній упаковці до продажу даного торгового найменування

38

422

Requested discount price must be equal to 0

Запитуваний Розмір знижки має дорівнювати 0

39

422

The ratio of requested discount price to allowed reimbursement amount must be greater or equal to <1 - deviation>

Співвідношення між запитуваною знижкою і дозволеною в реєстрі вартістю відшкодування повинна бути більше або дорівнювати <1 - DEVICE_DISPENSE_DEVIATION>

40

422

Expected a minimum of %{min} items but got %{actual

Очікується вказання мінімум %{min} обов'язкових параметрів, але отримано %{actual}

41

422

Not allowed to save empty 2d code

Заборонено зберігати порожній двовимірний код

Post-processing processes

No

Technical modules where the method is used

  • No labels