Versions Compared

Key

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

...

  1. Validate preperson_id UUID

    1. In case of error - return 422

  2. Check preperson_id doesn't exist in mpi.persons, but exists in medical_data.patients as patient_id. It means that preperson_id relates to preperson, but not to person.

    1. In case of error - return 422 (Such preperson doesn't exist)

  3. Check preperson status is active in medical_data.patients

    1. In case of error - return 409 (Preperson is not active)

  4. Check if exists another preperson merge requests with status NEW or APPROVED for this preperson

    1. if exists - update status to REJECTED

  5. Check if preperson has at least one episode

    1. if no episodes - return 422 (Preperson has no episodes)

Validate employee

  1. Extract user_id and legal_entity_id from token and find corresponding employee_id

  2. Check employee status is APPROVED

    1. In case of error - return 422 error (Only active employee can create preperson merge request)

  3. If employee has division - validate it has status ACTIVE

    1. In case of error - return 422 error (Only employee of active divisions can create preperson merge request)

...