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.

...

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')

  • Check author’s employee type:

    • 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”)

...

Validate value in the field $.period, required.

  • Check that $.period.start >= encounter.date (OR encounter.period.start)

    • in case of error - return 422 ('Start date must be in the future')

  • Check that $.period.end >= $.period.start

    • in case of error - return 422 ('End date must be greater than or equal the start date')

...

  • 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.

...