admission_discharge ()

admission_discharge ()

Function prototype

admission_discharge (session, admission, type, [date])

API Version

2.7.26 and higher

Supported interfaces

SOAP, REST

Description

Discharges an ADMISSION

Sets the admission in ‘discharged’ status. This involves the following actions:

  • If the ADMISSION was already discharged, then do nothing

  • Insert a new SYSTEM task with task code = "DISCHARGE"

  • Update all open TASKs and set its status to “CANCELLED”

Input parameters:

  • session: is the session token obtained in the session_init() call

  • admission: Reference of the ADMISSION that will be discharged

  • type: (optional) Indicate the cause of the discharge. Accepted values are:

    • “END”

    • “DROPOUT”

    • “EXITUS”

    • “MOVED”

    • “DISCONTNUED”

  • date: (optional) By default the date of “discharge” of the ADMISSION will considered to be the current date, but it is possible to indicate a specific date.

Output parameters:

  • result: a summary with the information of the ADMISSION after discharging it. The response format is the same than the returned by admission_get ()

  • ErrorMsg: If any error occurs, then this value contains a description of the error translated to the current language

  • ErrorCode: If any error occurs, then this value contains any of the standard ERROR CODES

Request sample:

api_function ( “LCAAAAAAAAAAAA”, "xxx", "yyy" );

Request example

admission_discharge ( “LCAAAAAAAAAAAA”, 32131, "DISCONTINUED")

Reponse

The response format is XML when the function has been invoked via the SOAP API, and JSON when it has been invoked via the REST API

Return Error codes

ERROR CODE



ERROR CODE



INVALID_TOKEN

The session token provided is not valid

INSUFFICIENT_PRIVILEGES

The session user does not have the necessary privileges to change the status of the ADMISSION

ADMISSION.NOT_FOUND

The requested ADMISSION was not found