Versions Compared

Key

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

  • Specification

  • Logic

  • Input parameters

  • Request structure

  • Authorize

  • Headers

  • Request data validation

  • Processing

  • Response structure

  • Post-processing processes

  • HTTP status codes

...

Request to process the request using a token in the headers

 

Headers

Наприклад:

  • Content-Type:application/json

  • Authorization:Bearer mF_9.B5f-4.1JqM

  • api-key:aFBLVTZ6Z2dON1V

...

  1. Get token metadata

    1. Extract user_idclient_idclient_type

  2. Ensure that employee belongs to client

    1. $.used_by_employee.identifier.type.coding[*].system == "eHealth/resources"

    2. $.used_by_employee.identifier.type.coding[*].code == "employee"

    3. $.used_by_employee.identifier.value must belong to client_id (prm.employees.legal_entity_id == :client_id)

      1. in case of error return 422 "You can assign service request only to employee within your legal entity"

  3. Check employee_type:

    1. in $.used_by_employee field validate employee_type == DOCTOR, SPECIALIST, ASSISTANT OR LABORANT :

      1. if service_request.category="laboratory_procedure", "diagnostic_procedure" OR "procedure" check employee_type == DOCTOR, SPECIALIST, ASSISTANT OR LABORANT

      2. else  employee_type == DOCTOR OR SPECIALIST

        1. in case of error, return 422 "Invalid employee type"

  4. Validate used_by_legal_entity is a current legal_entity

    1. $.used_by_legal_entity.identifier.value==token.client_id

      1. in case of error return 409 "You can assign service request only to your legal entity"

  5. Validate used_by_division

    1. if SR.category = hospitalization

      1. validate used_by_division is sent, in case error return 422, "Division is mandatory for $category category"

      2. validate used_by_division.legal_entity_id = used_by_legal_entity_id

    2.  Is SR.category = transfer_of_care

      1. validate used_by_division is sent, in case error return 422, "Division is mandatory for $category category"

      2. Validate $division.legal_entity_id = SR.Performer, in case error return 422, "Patient is transferred to another legal entity"

...