Versions Compared

Key

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

Purpose

...

Page Properties

Link

https://ehealthmisapi1.docs.apiary.io/#reference/public.-reimbursement/medication-request-requests/create-medication-request-request

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

Resource

/api/medication_request_requests

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

Scope

medication_request_request:write

Scope для доступу

Components

ePrescription

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

Microservices

API paragraph not found

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

Protocol type

REST

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

Request type

POST

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

Sync/Async

Sync

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

Logic

Технічний опис бізнес-процесу виписування рецепту в ЕСОЗ (загальний процес для усіх рецептурних ЛЗ, в т.ч. і тих, які підлягають реімбурсації)

...

  1. Invoke employee_id from request

  2. Validate employee

    1. Validate that exists

      1. in case invalid return 422 error with msg ("Employee not found")

    2. Validate that $.employees.status == APPROVED

      1. in case invalid return 409 error with msg ("Employee is not active")

    3. Validate that $.employees.legal_entity_id == client_id from token

      1. in case invalid return 422 error with msg ("Employee does not belong to legal entity from token")

    4. If medical program has medical_program_settings.skip_employee_validation == false (or absent), then validate <employee_type>:

      1. validate if employee_type is present in medical_program_settings.employee_types_for_create_medication_request variable

        1. in case invalid return 422 error with msg ("Employee type can't create medication request with medical program from request") 

        2. in case employee_type = DOCTOR

          1. if variable skip_medication_request_employee_declaration_verify = false or null/absent

            1. then: get $.declarations by employee_id, person_id, status=ACTIVE

              1. if not found - return 422 error  "Only doctors with an active declaration with the patient can create medication request with medical program from request!"

            2. else skip declaration verification on employee level (if true)

          2. if variable skip_medication_request_legal_entity_declaration_verify = false or null/absent

            1. then: get $.declarations by employee's legal_entity_id, person_id, status=ACTIVE

              1. if not found - return 422 error "Only legal entity with an active declaration with the patient can create medication request with medical program from request!"

            2. else skip declaration verification on legal entity level (if true)

          3. else if both are true - skip declaration verification at all

        3. in case employee_type = SPECIALIST

          1. get $.employees.speciality.speciality(speciality_officio == true)

          2. validate that speciality present in $.medical_programs.medical_program_setting.speciality_types_allowed variable

            1. in case invalid return 422 error with msg ("Employee's specialty doesn't allow create medication request with medical program from request") 

        4. in case employee_type = MED_COORDINATOR

          1. skip validation that speciality present in $.medical_programs.medical_program_setting.speciality_types_allowed variable

    5. If medical program has medical_program_settings with medical_program_settings.skip_employee_validation == true any user who has a scope can create medication request

...

  1. Verify Care plan:

    1. It should belong to the same person as set in MRR

      1. in case of error return 422 with msg ("Care plan not found")

    2. It should be in active status

  2. Verify submitted Activity:

    1. It belongs to the Care plan.

      1. in case of error return 422 with msg ("Activity not found")

    2. It has activity.detail.kind=medication_request; activity.detail.product_reference=medication_id.

      1. in case of error return 422 with msg ("Invalid activity kind")

    3. It has scheduled, in_progress status.

      1. in case of error return 422 with msg ("Invalid activity status")

    4. If it has quantity then calculate remaining quantity:

      1. select all MRR in status NEW which based on current activity

      2. select all MR in statuses ACTIVE, COMPLETED based on current activity

      3. calculate reserved at the moment medication quantity as sum of medication_qty in the filtered MRR  and MR list, including medication_qty from current MRR

      4. calculate remaining quantity by subtracting reserved quantity from activity quantity

      5. Check remaining quantity is greater then or equal to zero

        1. in case of error return 409 "The total amount of the prescribed medication quantity exceeds quantity in care plan activity"

    5. check that medical_program_id equal to $.activity[].program

      1. in case of error return 422 with msg ("Medical program from activity should be equal to medical program from request")

  3. Validate started_at/ended_at of Medication request Request: 

    1. if care plan activity has detail.scheduled_timing.repeat.bounds_period - validate started_at/ended_at within bounds_period

    2. if care plan activity has detail.scheduled_period - validate started_at/ended_at within scheduled_period

    3. else - validate started_at/ended_at crossing within care_plan.period

      1. in the case of started_at/ended_at is not within care_plan.period return 422 with msg  ("Invalid care plan period")

...

Expand
titleResponse example
Code Block
{
  "meta": {
    "code": "422",
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "error": {
    "type": "unverified",
    "message": "Only active employee with type DOCTOR can create medication request!"
  }
}

...

API paragraph not found

HTTP status codes

HTTP status code

Message

What caused the error

201

Response

 

403

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

409

  • Employee is not active

  • Invalid legal entity type

  • Patient is not verified

  • Period length exceeds default maximum value

  • {$.data.context.identifier.type.coding[*].code} not found

  • Entity in status "entered-in-error" can not be referenced

  • Entity without related episode can not be referenced

  • Incorrect additional instruction

  • Incorrect site

  • Incorrect route

  • Incorrect method

  • Incorrect dose and rate type

  • The total amount of the prescribed medication quantity exceeds quantity in care plan activity

422

  • required property %{property} was not present

  • value is not allowed in enum

  • Prior prescription is not found

  • Employee not found

  • Employee does not belong to legal entity from token

  • Employee type can't create medication request with medical program from request

  • Only doctors with an active declaration with the patient can create medication request with medical program from request!

  • Only legal entity with an active declaration with the patient can create medication request with medical program from request!

  • Employee's specialty doesn't allow create medication request with medical program from request

  • Division not found

  • Only employee of active divisions can create medication request!

  • Legal entity not found

  • Only active legal entity can provide medication request

  • Person not found

  • Only for active MPI record can be created medication request!

  • expected \"%{actual}\" to be a valid ISO 8601 date

  • Ended date must be >= Started date!

  • Started date must be >= Created date!

  • Started date must be >= current date!

  • Create date must be >= Current date - MRR delay input!

  • Medication not found

  • Only medication with type `INNM_DOSAGE` can be use for created medication request!

  • Only active innm_dosage can be use for created medication request!

  • required property context was not present

  • Sequence must be unique

  • Care plan not found

  • Activity not found

  • Invalid activity kind

  • Medical program from activity should be equal to medical program from request

  • Invalid care plan period

  • required property medical_program_id was not present

  • Medical program not found

  • Care plan and activity with the same medical program should be present in request

  • Encounter in context has no primary diagnosis allowed for the medical program

  • Only doctors with an active declaration with the patient can create medication request!

  • Only legal entity with an active declaration with the patient can create medication request!

  • Employee's specialty doesn't allow create medication request with medical program from request

  • Division not found

  • Only employee of active divisions can create medication request!

  • Only active legal entity can provide medication request

  • Only for active MPI record can be created medication request!

  • Started date must be >= current date!

  • Create date must be >= Current date - MRR delay input!

  • Medication not found

  • Care plan not found

  • Medical program from activity should be equal to medical program from request

  • required property medical_program_id was not present

 

Backward compatibility

...