Versions Compared

Key

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

Required parameters are marked with "*"

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

Purpose*

This web service is designed to cancel episode in case it was entered in error

...

Specification*

Page Properties

Link

https://ehealthmedicaleventsapimedicaleventsmisapi.docs.apiary.io/#reference/medical-events/episode-of-care/cancel-episode

Resource

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

Scope

episode:write

Components

Episode of Care

Microservices

API paragraph not found

Protocol type

REST

Request type

PATCH

Sync/Async

Async

Public/Private/Internal

Public

...

Request to process the request using a token in the headers

Headers*

Наприклад:

  • Content-Type:application/json

  • Authorization:Bearer mF_9.B5f-4.1JqM

...

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

    1. Return 403 in case invalid scope(s)

Validate legal entity

  • 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 is not already canceled

    1. ME.patients{patient_id}.episodes{episode_id}.status!="entered_in_error"

      1. in case of error "Episode in <status> can not be canceled"  

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

    1. $.cancellation_reason.coding[*].system == "eHealth/cancellation_reasons"

  3. Validate that all encounters created on episode are already canceled

    1.   ME.patients{patient_id}.episodes{episode_id}.encounters{*}.status != `entered_in_error`

      1. in case of error - "Episode can not be canceled while it has not canceled encounters"

Processing*

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

  2. Set $.cancellation_reason to ME.patients.episodes.status_reason

  3. Set explanatory_letter

  4. Create a record in ME.episode.status_history

Response structure*

See on Apiary

...