ЕСОЗ - публічна документація

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 6 Next »

Purpose

This WS gives the opportunity to update external identifier of unidentified person in eHealth.

Specification

Apiary

Service logic

  1. Only authenticated and authorized OWNER, SPECIALIST, ASSISTANT, RECEPTIONIST, ADMIN employees can update external_id of preperson.

  2. Preperson can be updated only in OUTPATIENT or EMERGENCY legal entity type, if MPI identifier of preperson is being known (returns after Create preperson).

  3. Only external_id field can be updated.

  4. Update allowed for prepersons with status = ACTIVE.

Authentication

  1. Verify the validity of access token

    1. Return 401 in case validation fails

  2. Check user scopes in order to perform this action (scope = 'preperson:update')

    1. Return 403 in case invalid scope(s)

Validate legal entity

Check that legal entity is active (status = ACTIVE, SUSPENDED) and belongs to the user

  1. Extract client_id from token (token.client_id == legal_entity_id)

  2. Check legal entity status (status = ACTIVE, SUSPENDED)

    1. In case of error - return 409 (Legal entity must be ACTIVE or SUSPENDED)

Validate person_id

Check person_id belongs to preperson

  1. Check there is no entry in MPI.persons with this person_id

    1. In case error - return 422 (Person_id doesn’t belong to unidentified person)

  2. Convert person_id into patient_id. Check patient_id exists in medical_data.patients collection

    1. In case error - 404

  3. Check preperson has status=active

    1. In case error - return 422 (Unidentified person is not active)

Validate external_id

  1. Check external_id is not empty.

    1. In case of error - return 422 (external_id should not be empty)

  2. Check external_id is unique ? (unique within le?)

    1. In case of error - return 422 (external_id already exists) ?

Update object in DB (mongo)

patients collection

Parameter

Source

Description

external_id

Request: external_id

Identifier from external system, required. Get from request body

updated_at

timestamp: now()

Get current date-time

updated_by

uuid

Extract user from token

  • No labels