Versions Compared

Key

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

...

  1. Only authenticated and authorized user with employee_type from the list ofCARE_PLAN_AUTHOR_EMPLOYEE_TYPES_ALLOWED
    config with appropriate speciality pointed inCARE_PLAN_<category>_SPECIALITIES_ALLOWED config can create a Care plan.

  2. Care plan can be created from MSP, PRIMARY_CARE or OUTPATIENT legal entity.

  3. Care plan can be created for persons and prepersons.

  4. Care plan should be signed with DS.

  5. Care plan creates in async way as all MEs.

  6. Activities are added to a Care plan using Create Care Plan activity method. Thus, Care plan is being initially created without activities.

...

PROVIDING_CONDITION

Request structure

See on Apiary

Example:

Expand
titleRequest example
Code Block
{
  "signed_data": "ew0KICAicGVyaW9kIjogew0KIC..."
}

...

Expand
titleRequest example
Code Block
languagejson
{
  "id": "90a9e15b-b71b-4caf-8f2e-ff247e8a5600",
  "based_on": {
    "identifier": {
      "type": {
        "coding": [
          {
            "system": "eHealth/resources",
            "code": "care_plan"
          }
        ]
      },
      "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
    }
  },
  "part_of": {
    "identifier": {
      "type": {
        "coding": [
          {
            "system": "eHealth/resources",
            "code": "care_plan"
          }
        ]
      },
      "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
    }
  },
  "category": {
    "coding": [
      {
        "system": "eHealth/care_plan_categories",
        "code": "diabetics"
      }
    ]
  },
  "title": "Diabetics health plan",
  "description": "Some description of the care plan",
  "period": {
    "start": "2018-08-02T10:45:16.000Z",
    "end": "2018-08-02T11:00:00.000Z"
  },
  "supporting_info": [
    {
      "identifier": {
        "type": {
          "coding": [
            {
              "system": "eHealth/resources",
              "code": "episode_of_care"
            }
          ]
        },
        "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
      }
    }
  ],
  "note": "Some notes",
  "intent": "order",
  "encounter": {
    "identifier": {
      "type": {
        "coding": [
          {
            "system": "eHealth/resources",
            "code": "encounter"
          }
        ]
      },
      "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
    }
  },
  "addresses": [
    {
      "coding": [
        {
          "system": "eHealth/ICD10_AM/condition_codes",
          "code": "E11.9"
        }
      ]
    }
  ],
  "author": {
    "identifier": {
      "type": {
        "coding": [
          {
            "system": "eHealth/resources",
            "code": "employee"
          }
        ]
      },
      "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
    }
  },
  "contributor": [
    {
      "identifier": {
        "type": {
          "coding": [
            {
              "system": "eHealth/resources",
              "code": "employee"
            }
          ]
        },
        "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
      }
    }
  ],
  "terms_of_service": {
    "coding": [
      {
        "system": "PROVIDING_CONDITION",
        "code": "INPATIENT"
      }
    ]
  },
  "inform_with": {
    "auth_method_id": "cc949559-5dfe-420f-ac05-065e443b2cc6"
  },
  "status": "new"
}

...

Request to process the request using a token in the headers

Headers

Наприклад:

Content-Type:application/json
Authorization:Bearer {{access_token}}
API-key:{{mis_client_secret}}

...

  • Extract user_id from token. Check that author belongs to one of the user’s employee.

    • in case of error - return 422 ('User is not allowed to create care plan for the employee')

  • Check that author is an active and approved employee and related to the legal entity (client_id from token).

    • in case of error - return 403 ('Access denied')

  • for employees with employee_type from CARE_PLAN_AUTHOR_ROLE_CHECK_EMPLOYEE_TYPESconfig:

    • Сheck it has at least one employee role that:

      • is active and has active status

      • refers to healthcare service with providing_conditions=$.terms_of_service value

        • in case of error - return 422 ('Employee does not have active role that correspond to the submitted terms of service')

  • If DOCTOR, then no additional validations needed

  • Check author’s speciality (speciality_officio == true) pointed in config for a corresponding care plan category.

    • in case of error - return 409 (“Invalid employee speciality”)

...

  • Check the value is valid reference on another Care plan resource

  • Validate referenced care plan:

    • Check it belongs to the same patient ($.subject)

      • Return 422 ('Care plan with such id is not found')

  • Validate status of referenced care plan:

    • Check it is one of COMPLETED OR ACTIVE OR TERMINATED:

      • in case of error return 422 ('Care plan in status "<care_plan.status>" can not be referenced')

9. Part of

Validate value in the field $.part_of, if submitted

...

  1. Save signed content to media storage

  2. Save data to care_plans collection in DB according to https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/17347479634/RC+REHAB+Care+plan+data+model

  3. Fill field managing_organization with data from token of the user (details.client_id)

  4. Save link from media storage to the $.signed_content_links field in care plans collection

  5. Create job and return it’s id.

...

Expand
titleResponse example
Code Block
languagejson
{
  "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"
  }
}

...