Versions Compared

Key

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

...

Ensure the person exists

  1. Validate person_mpi_id UUID

    1. In case of error - return 422

  2. Find person by id in mpi.persons

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

  3. Check person status is active

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

...

Ensure the preperson exists

  1. Validate preperson_mpi_id UUID

    1. In case of error - return 422

  2. Check preperson_mpi_id doesn't exist in mpi.persons, but exists in medical_data.patients as patient_id. It means that preperson_mpi_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

...

Parameter

Source

Description

id

uuid

Autogenerated

type

string

Set PREPERSON_MERGE_REQUEST for this type of requests. Required

data

jsonb

Data from the request in json format. Required

person_mpi_id

Request: person_mpi_id

Person identifier in MPI (mpi.persons.id). Required

preperson_mpi_id

Request: preperson_mpi_id

Preperson identifier that corresponds to MPI (returned on create preperson). Required

status

varchar(50)

Status of the request, required. Set NEW

merged_pair_id

uuid

Reference to mpi.merged_pairs table when person becomes merged with preperson (on sign). By default is null.

printout_form

text

Printout form of preperson merge request in html format. By default is null at this step

inserted_by

uuid

Extract user from token

inserted_at

timestamp

Get current date-time

updated_by

uuid

Extract user from token

updated_at

timestamp

Get current date-time

...