Versions Compared

Key

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

...

  1. Only authenticated and authorized DOCTOR or SPECIALIST with appropriate speciality pointed in 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.

...

  • Get patient_id from URL

  • Validate person\preperson status is active

    • in case of error - return 409 ('Person is not active')

  • Validate person'sverification_status is not equal to NOT_VERIFIED.

    • in case of error return 409, "Patient is not verified"

  • Hash patient_id and store into the field $.subject

...

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

    • if SPECIALIST:

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

...