Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

Table of Contents

Specification

TERMINATE contract

Purpose

This WS allows to terminate contract either by NHS or Legal Entity Owner.

Request

...

Table of Contents
minLevel1
maxLevel3

Purpose

This WS allows to terminate contract either by NHS or Legal Entity Side (if scope was allowed).

Specification

Page Properties

Link

https://ehealthmisapi1.docs.apiary.io/#reference/public.-contracts/contracts/private.-terminate-contract

Resource

api/contracts/{{id}}/actions/terminate

Scope

contract:terminate

Components

Contracts

Microservices

API paragraph not found

Protocol type

REST

Request type

PATCH

Sync/Async

Sync

Public/Private/Internal

Private

Logic

This WS is designed to terminate contract. Contract must be in status 'VERIFIED'

Input parameters

Input parameter

Values

Type

Description

Example

id

String

b075f148-7f93-4fc2-b2ec-2d81b19a9b7b

Request structure

See on Apiary

Example:

Expand
titleRequest example
Code Block
{
  "status_reason": "Неправильний період контракту"
}

Authorize

  1. Verify the validity of access token

    1. in case of error return 401 ('Access denied')

  2. Check user scope contract:

...

  1. terminate in order to perform this action

    1. in case of

...

    1. error generate 401 response ('Invalid scopes')

Request to process the request using a token in the headers

Headers

Наприклад:

  • Content-Type:application/json

  • Authorization:Bearer c2778f3064753ea70de870a53795f5c9

Request data validation

Validate User

...

  1. Extract legal_entity_id (client_id)

...

  1.  from token.

    1. Check client_id=contractor_legal_entity_

...

  1. in case of error return 403 "User is not allowed to perform this action"

...

    1. id  or client_id=

...

    1. nhs_

...

    1. legal_entity_id

...

      1. in case of error return 403 "User is not allowed to perform this action"

Validate contract request status

  • Check contract_request.status='VERIFIED'

    • in case error return

      422

      409 - "Incorrect status of contract_request to modify it"

Response

mapping

...

field

...

value

...

Processing

Auto termination

Fetch all contract with end_date<now(). Set status and status reason for such contract as below:

field

value

status

TERMINATED

status_reason

$.auto_expired

updated_at

now()

updated_by

$.user_id

Add status to event manager

After status was changed (status = TERMINATED) - add new status to event_manager

field

value

event_type

StatusChangeEvent

entity_type

Contract

entity_id

$.id

properties.status.new_value

$.status

event_time

$.update_at

changed_by

$.changed_by

Deactivate Medical Program Provision

Deactivate all active medical program provision for defined contract number and current legal entity (according to link):

  • set is_active = false

  • set deactivate_reason = AUTO_CONTRACT_TERMINATION 

  • set updated_at, updated by

Response structure

See on Apiary

Example:

Expand
titleResponse example
Code Block
{
  "meta": {
    "code": 201,
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "data": {
    "id": "09106b70-18b0-4726-b0ed-6bda1369fd52",
    "contract_type": "CAPITATION",
    "start_date": "2017-04-20",
    "contractor_legal_entity": {
      "id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
      "name": "Клініка Ноунейм",
      "edrpou": "32323454",
      "addresses": [
        {
          "type": "RESIDENCE",
          "country": "UA",
          "area": "Житомирська",
          "region": "Бердичівський",
          "settlement": "Київ",
          "settlement_type": "CITY",
          "settlement_id": "b075f148",
          "street_type": "STREET",
          "street": "вул. Ніжинська",
          "building": "15",
          "apartment": "23",
          "zip": "02090"
        }
      ]
    },
    "contractor_owner": {
      "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
      "party": {
        "first_name": "Петро",
        "last_name": "Іванов",
        "second_name": "Миколайович"
      }
    },
    "contractor_base": "на підставі закону про Медичне обслуговування населення",
    "contractor_payment_details": {
      "bank_name": "Банк номер 1",
      "MFO": "351005",
      "payer_account": "32009102701026"
    },
    "contractor_rmsp_amount": 50000,
    "contractor_divisions": [
      {
        "id": "2922a240-63db-404e-b730-09222bfeb2dd",
        "name": "Бориспільське відділення Клініки Ноунейм",
        "addresses": [
          {
            "type": "RESIDENCE",
            "country": "UA",
            "area": "Житомирська",
            "region": "Бердичівський",
            "settlement": "Київ",
            "settlement_type": "CITY",
            "settlement_id": "b075f148",
            "street_type": "STREET",
            "street": "вул. Ніжинська",
            "building": "15",
            "apartment": "23",
            "zip": "02090"
          }
        ],
        "phones": [
          {
            "type": "MOBILE",
            "number": "+380503410870"
          }
        ],
        "email": "email@example.com",
        "working_hours": {
          "mon": [
            [
              "08.00",
              "12.00"
            ],
            [
              "14.00",
              "18.00"
            ]
          ],
          "tue": [
            [
              "08.00",
              "12.00"
            ]
          ],
          "wed": [
            [
              "08.00",
              "12.00"
            ]
          ],
          "thu": [
            [
              "08.00",
              "12.00"
            ]
          ],
          "fri": [
            [
              "08.00",
              "12.00"
            ]
          ]
        },
        "mountain_group": false
      }
    ],
    "external_contractor_flag": true,
    "external_contractors": [
      {
        "legal_entity": {
          "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
          "name": "Клініка Ноунейм"
        },
        "contract": {
          "number": "1234567",
          "issued_at": "2018-01-01",
          "expires_at": "2019-01-01"
        },
        "divisions": [
          {
            "id": "2922a240-63db-404e-b730-09222bfeb2dd",
            "name": "Бориспільське відділення Клініки Ноунейм",
            "medical_service": "Послуга ПМД"
          }
        ]
      }
    ],
    "contractor_employee_divisions": [
      {
        "employee": {
          "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
          "party": {
            "first_name": "Петро",
            "last_name": "Іванов",
            "second_name": "Миколайович"
          },
          "speciality": {
            "speciality": "THERAPIST",
            "speciality_officio": true,
            "level": "FIRST",
            "qualification_type": "AWARDING",
            "attestation_name": "Академія Богомольця",
            "attestation_date": "2017-02-28",
            "valid_to_date": "2020-02-28",
            "certificate_number": "AB/21331"
          }
        },
        "staff_units": 0.5,
        "declaration_limit": 2000,
        "division_id": "2922a240-63db-404e-b730-09222bfeb2dd"
      }
    ],
    "nhs_signer_base": "на підставі наказу",
    "nhs_contract_price": 50000,
    "nhs_payment_method": "prepayment",
    "status": "VERIFIED",
    "reason": "не було виконано умов контракту",
    "status_reason": "default",
    "nhs_signer": {
      "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
      "party": {
        "first_name": "Петро",
        "last_name": "Іванов",
        "second_name": "Миколайович"
      }
    },
    "nhs_legal_entity": {
      "id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
      "name": "Клініка Ноунейм",
      "edrpou": "32323454",
      "addresses": [
        {
          "type": "RESIDENCE",
          "country": "UA",
          "area": "Житомирська",
          "region": "Бердичівський",
          "settlement": "Київ",
          "settlement_type": "CITY",
          "settlement_id": "b075f148",
          "street_type": "STREET",
          "street": "вул. Ніжинська",
          "building": "15",
          "apartment": "23",
          "zip": "02090"
        }
      ]
    },
    "issue_city": "Київ",
    "contract_number": "0000-9EAX-XT7X-3115",
    "contract_request_id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
    "is_suspended": false,
    "end_date": "2017-04-20",
    "id_form": "PMD",
    "parent_contract_id": "09106b70-18b0-4726-b0ed-6bda1369fd52"
  }
}

Response mapping

field

value

status

TERMINATED

status_reason

$.status_reason

updated_at

now()

updated_by

$.user_id

HTTP status codes

HTTP status code

Message

What caused the error

 200