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

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

Required parameters are marked with "*"

Якщо інформації по відповідному параметру немає, потрібно зазначити: “API paragraph not found”.

Purpose*

This web service is designed to close an episode.

Specification*

Link

https://ehealthmedicaleventsapi.docs.apiary.io/#reference/medical-events/episode-of-care/close-episode

Resource

/api/patients/{{patient_id}}/episodes/{{episode_id}}/actions/close

Scope

episode:write

Components

API paragraph not found

Microservices

API paragraph not found

Protocol type

REST

Request type

PATCH

Sync/Async

Async

Logic*

API paragraph not found

Input parameters

Input parameter

Values

Type

Description

Example

patient_id

String

Patient identifier

70a9e15b-b71b-4caf-8f2e-ff247e8a5677

episode_id

String

Episode identifier

a10aeafb-0df2-4091-bc83-f07e92a100ae

Request structure*

See on Apiary

Example:

 Request example
{
  "period": {
    "end": "2018-08-02T10:45:16.000Z"
  },
  "closing_summary": "Носові шляхи вільні, горло рожеве, температура в нормі",
  "status_reason": {
    "coding": [
      {
        "system": "eHealth/episode_closing_reasons",
        "code": "cured"
      }
    ],
    "text": ""
  }
}

Authorize*

Request to process the request using a token in the headers

Headers*

Наприклад:

  • Content-Type:application/json

  • Authorization:Bearer mF_9.B5f-4.1JqM

Request data validation*

Validate token

  • Verify the validity of access token

    • Return 401 in case validation fails

  • Verify token is not expired

    • in case of error return 401 

  • check value of ALLOW_OTHER_LE_EMPLOYEES_TO_MANAGE_EPISODE variable in charts configuration

    • if its value is equal to false, verify that user’s employees from care_manager belongs to one of the user_id from token

      • in case of error - return 422 ('User is not allowed to perform this action')

    • otherwise, verify that user’s employees from care_manager belongs to the same Legal Entity as author of the episode

      • in case of error - return 422 ('User is not allowed to perfom this action')

Validate scopes

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

    1. Return 403 in case invalid scope(s)

Validate legal entity

  1. Validate episode belongs to the legal entity where the current user works

    • ME.episode.managing_organization==token.client_id

      • in case of error return 422 "Managing_organization does not correspond to user`s legal_entity"

Validate request

  1. Validate episode.status!= "entered_in_error" or "closed"

    1. in case of error "Episode in {episode_status} can not be closed"

  2. Validate that "closing_reason" is a valid value from the corresponding dictionary 

    1. $.closing_reason.coding[*].system == "eHealth/episode_cancellation_reasons"

  3. Validate period as Period (consider period.start_date from the episode)

Processing*

  1. Set the status of the episode in "closed"

  2. Set closing_reason in status_reason

  3. Set closing_summary

  4. Set period.end

  5. Create a record in episode.status_history

Response structure*

See on Apiary

Example:

 Response example
{
  "data": {
    "status": "pending",
    "eta": "2018-08-02T10:45:16.000Z",
    "links": [
      {
        "entity": "job",
        "href": "/Jobs/NBXk9EyErUZv1RhXgyvgg"
      }
    ]
  },
  "meta": {
    "code": 202,
    "url": "http://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  }
}

 Response example
{
  "meta": {
    "code": 404,
    "url": "http://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "error": {
    "type": "NOT_FOUND",
    "message": "Patient not found"
  }
}

Post-processing processes*

API paragraph not found

HTTP status codes*

HTTP status code

Message

What caused the error

 202

 

 

 404

 

 

  • No labels