org.openmrs.api
Interface EncounterService

All Superinterfaces:
OpenmrsService
All Known Implementing Classes:
EncounterServiceImpl

@Transactional
public interface EncounterService
extends OpenmrsService

Services for Encounters and Encounter Types

Version:
1.0

Method Summary
 void createEncounter(Encounter encounter)
          Deprecated. replaced by saveEncounter(Encounter)
 void deleteEncounter(Encounter encounter)
          Deprecated. replaced by purgeEncounter(Encounter)
 java.util.List<EncounterType> findEncounterTypes(java.lang.String name)
          Find Encounter Types with name matching the beginning of the search string.
 java.util.List<Location> findLocations(java.lang.String name)
          Deprecated. replaced by LocationService.getLocations(String)
 java.util.List<EncounterType> getAllEncounterTypes()
          Get all encounter types (not retired)
 java.util.List<EncounterType> getAllEncounterTypes(boolean includeRetired)
          Get all encounter types.
 Encounter getEncounter(java.lang.Integer encounterId)
          Get encounter by internal identifier
 Encounter getEncounterByUuid(java.lang.String uuid)
          Get Encounter by its UUID
 java.util.Collection<Encounter> getEncounters(java.util.Date fromDate, java.util.Date toDate)
          Deprecated. use getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)
 java.util.Collection<Encounter> getEncounters(Location loc, java.util.Date fromDate, java.util.Date toDate)
          Deprecated. use getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)
 java.util.List<Encounter> getEncounters(Patient who)
          Deprecated. replaced by getEncountersByPatient(Patient)
 java.util.List<Encounter> getEncounters(Patient who, boolean includeVoided)
          Deprecated. replaced by getEncountersByPatient(Patient)
 java.util.List<Encounter> getEncounters(Patient who, java.util.Date fromDate, java.util.Date toDate)
          Deprecated. use getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)
 java.util.List<Encounter> getEncounters(Patient who, Location where)
          Deprecated. use getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)
 java.util.List<Encounter> getEncounters(Patient who, Location loc, java.util.Date fromDate, java.util.Date toDate, java.util.Collection<Form> enteredViaForms, java.util.Collection<EncounterType> encounterTypes, boolean includeVoided)
          Deprecated. replaced by getEncounters(Patient, Location, Date, Date, Collection, Collection, Collection, boolean)
 java.util.List<Encounter> getEncounters(Patient who, Location loc, java.util.Date fromDate, java.util.Date toDate, java.util.Collection<Form> enteredViaForms, java.util.Collection<EncounterType> encounterTypes, java.util.Collection<User> providers, boolean includeVoided)
          Get all encounters that match a variety of (nullable) criteria.
 java.util.List<Encounter> getEncountersByPatient(Patient patient)
          Get all encounters (not voided) for a patient.
 java.util.List<Encounter> getEncountersByPatient(java.lang.String query)
          Search for encounters by patient name or patient identifier.
 java.util.List<Encounter> getEncountersByPatient(java.lang.String query, boolean includeVoided)
          Search for encounters by patient name or patient identifier.
 java.util.List<Encounter> getEncountersByPatientId(java.lang.Integer patientId)
          Get encounters for a patientId
 java.util.List<Encounter> getEncountersByPatientId(java.lang.Integer patientId, boolean includeVoided)
          Deprecated. replaced by getEncountersByPatientId(Integer)
 java.util.List<Encounter> getEncountersByPatientIdentifier(java.lang.String identifier)
          Get encounters (not voided) for a patient identifier
 java.util.List<Encounter> getEncountersByPatientIdentifier(java.lang.String identifier, boolean includeVoided)
          Deprecated. replaced by getEncountersByPatientIdentifier(String)
 EncounterType getEncounterType(java.lang.Integer encounterTypeId)
          Get encounterType by internal identifier
 EncounterType getEncounterType(java.lang.String name)
          Get encounterType by exact name
 EncounterType getEncounterTypeByUuid(java.lang.String uuid)
          Get EncounterType by its UUID
 java.util.List<EncounterType> getEncounterTypes()
          Deprecated. replaced by getAllEncounterTypes()
 Location getLocation(java.lang.Integer locationId)
          Deprecated. replaced by LocationService.getLocation(Integer)
 Location getLocationByName(java.lang.String name)
          Deprecated. replaced by LocationService.getLocation(String)
 java.util.List<Location> getLocations()
          Deprecated. replaced by LocationService.getAllLocations()
 void purgeEncounter(Encounter encounter)
          Completely remove an encounter from database.
 void purgeEncounter(Encounter encounter, boolean cascade)
          Completely remove an encounter from database.
 void purgeEncounterType(EncounterType encounterType)
          Completely remove an encounter type from database.
 EncounterType retireEncounterType(EncounterType encounterType, java.lang.String reason)
          Retire an EncounterType.
 Encounter saveEncounter(Encounter encounter)
          Saves a new encounter or updates an existing encounter.
 EncounterType saveEncounterType(EncounterType encounterType)
          Save a new Encounter Type or update an existing Encounter Type.
 void setEncounterDAO(EncounterDAO dao)
          Set the given dao on this encounter service.
 EncounterType unretireEncounterType(EncounterType encounterType)
          Unretire an EncounterType.
 Encounter unvoidEncounter(Encounter encounter)
          Unvoid encounter record
 void updateEncounter(Encounter encounter)
          Deprecated. replaced by saveEncounter(Encounter)
 Encounter voidEncounter(Encounter encounter, java.lang.String reason)
          Voiding a encounter essentially removes it from circulation
 
Methods inherited from interface org.openmrs.api.OpenmrsService
onShutdown, onStartup
 

Method Detail

setEncounterDAO

void setEncounterDAO(EncounterDAO dao)
Set the given dao on this encounter service. The dao will act as the conduit through with all encounter calls get to the database

Parameters:
dao -

saveEncounter

@Authorized(value={"Add Encounters","Edit Encounters"})
Encounter saveEncounter(Encounter encounter)
                        throws APIException
Saves a new encounter or updates an existing encounter. If an existing encounter, this method will automatically apply encounter.patient to all encounter.obs.patient

Parameters:
encounter - to be saved
Throws:
APIException
Expected behavior:
save encounter with basic details, update encounter successfully, cascade save to contained obs, cascade patient to orders in the encounter, cascade save to contained obs when encounter already exists, cascade encounter datetime to obs, only cascade the obsdatetimes to obs with different initial obsdatetimes, not overwrite creator if non null, not overwrite dateCreated if non null, not overwrite obs and orders creator or dateCreated, cascade creator and dateCreated to orders

getEncounter

@Transactional(readOnly=true)
@Authorized(value="View Encounters")
Encounter getEncounter(java.lang.Integer encounterId)
                       throws APIException
Get encounter by internal identifier

Parameters:
encounterId - encounter id
Returns:
encounter with given internal identifier
Throws:
APIException
Expected behavior:
throw error if given null parameter

getEncounterByUuid

@Transactional(readOnly=true)
@Authorized(value="View Encounters")
Encounter getEncounterByUuid(java.lang.String uuid)
                             throws APIException
Get Encounter by its UUID

Parameters:
uuid -
Returns:
Throws:
APIException
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

getEncountersByPatient

@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.List<Encounter> getEncountersByPatient(Patient patient)
Get all encounters (not voided) for a patient.

Parameters:
patient -
Returns:
List encounters (not voided) for a patient.
Expected behavior:
not get voided encounters, throw error when given null parameter

getEncountersByPatientId

@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.List<Encounter> getEncountersByPatientId(java.lang.Integer patientId)
                                                   throws APIException
Get encounters for a patientId

Parameters:
patientId -
Returns:
all encounters (not voided) for the given patient identifier
Throws:
APIException
Expected behavior:
not get voided encounters, throw error if given a null parameter

getEncountersByPatientIdentifier

@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.List<Encounter> getEncountersByPatientIdentifier(java.lang.String identifier)
                                                           throws APIException
Get encounters (not voided) for a patient identifier

Parameters:
identifier -
Returns:
all encounters (not retired) for the given patient identifer
Throws:
APIException
Expected behavior:
not get voided encounters, throw error if given null parameter

getEncounters

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.List<Encounter> getEncounters(Patient who,
                                                                                 Location loc,
                                                                                 java.util.Date fromDate,
                                                                                 java.util.Date toDate,
                                                                                 java.util.Collection<Form> enteredViaForms,
                                                                                 java.util.Collection<EncounterType> encounterTypes,
                                                                                 boolean includeVoided)
Deprecated. replaced by getEncounters(Patient, Location, Date, Date, Collection, Collection, Collection, boolean)


getEncounters

@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.List<Encounter> getEncounters(Patient who,
                                                                      Location loc,
                                                                      java.util.Date fromDate,
                                                                      java.util.Date toDate,
                                                                      java.util.Collection<Form> enteredViaForms,
                                                                      java.util.Collection<EncounterType> encounterTypes,
                                                                      java.util.Collection<User> providers,
                                                                      boolean includeVoided)
Get all encounters that match a variety of (nullable) criteria. Each extra value for a parameter that is provided acts as an "and" and will reduce the number of results returned

Parameters:
who - the patient the encounter is for
loc - the location this encounter took place
fromDate - the minimum date (inclusive) this encounter took place
toDate - the maximum date (exclusive) this encounter took place
enteredViaForms - the form that entered this encounter must be in this list
encounterTypes - the type of encounter must be in this list
providers - the provider of this encounter must be in this list
includeVoided - true/false to include the voided encounters or not
Returns:
a list of encounters ordered by increasing encounterDatetime
Since:
1.5
Expected behavior:
get encounters by location, get encounters on or after date, get encounters on or up to a date, get encounters by form, get encounters by type, get encounters by provider, exclude voided encounters, include voided encounters

voidEncounter

@Authorized(value="Edit Encounters")
Encounter voidEncounter(Encounter encounter,
                                        java.lang.String reason)
Voiding a encounter essentially removes it from circulation

Parameters:
encounter - Encounter object to void
reason - String reason that it's being voided
Expected behavior:
void encounter and set attributes, cascade to obs, cascade to orders, throw error with null reason parameter

unvoidEncounter

@Authorized(value="Edit Encounters")
Encounter unvoidEncounter(Encounter encounter)
                          throws APIException
Unvoid encounter record

Parameters:
encounter - Encounter to be revived
Throws:
APIException
Expected behavior:
cascade unvoid to obs, cascade unvoid to orders, unvoid and unmark all attributes

purgeEncounter

@Authorized(value="Purge Encounters")
void purgeEncounter(Encounter encounter)
                    throws APIException
Completely remove an encounter from database. For super users only. If dereferencing encounters, use voidEncounter(org.openmrs.Encounter)

Parameters:
encounter - encounter object to be purged
Throws:
APIException
Expected behavior:
purgeEncounter

purgeEncounter

@Authorized(value="Purge Encounters")
void purgeEncounter(Encounter encounter,
                                    boolean cascade)
                    throws APIException
Completely remove an encounter from database. For super users only. If dereferencing encounters, use voidEncounter(org.openmrs.Encounter)

Parameters:
encounter - encounter object to be purged
cascade - Purge any related observations as well?
Throws:
APIException
Expected behavior:
cascade purge to obs and orders

saveEncounterType

@Authorized(value="Manage Encounter Types")
EncounterType saveEncounterType(EncounterType encounterType)
Save a new Encounter Type or update an existing Encounter Type.

Parameters:
encounterType -
Expected behavior:
save encounter type, not overwrite creator, not overwrite creator or date created, not overwrite date created, update an existing encounter type name

getEncounterType

@Transactional(readOnly=true)
@Authorized(value="View Encounter Types")
EncounterType getEncounterType(java.lang.Integer encounterTypeId)
                               throws APIException
Get encounterType by internal identifier

Parameters:
encounterTypeId - Integer
Returns:
encounterType with given internal identifier
Throws:
APIException
Expected behavior:
throw error if given null parameter

getEncounterTypeByUuid

@Transactional(readOnly=true)
@Authorized(value="View Encounter Types")
EncounterType getEncounterTypeByUuid(java.lang.String uuid)
                                     throws APIException
Get EncounterType by its UUID

Parameters:
uuid -
Returns:
Throws:
APIException
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

getEncounterType

@Transactional(readOnly=true)
@Authorized(value="View Encounter Types")
EncounterType getEncounterType(java.lang.String name)
                               throws APIException
Get encounterType by exact name

Parameters:
name - string to match to an Encounter.name
Returns:
EncounterType that is not retired
Throws:
APIException
Expected behavior:
not get retired types, return null if only retired type found, not get by inexact name, return null with null name parameter

getAllEncounterTypes

@Transactional(readOnly=true)
@Authorized(value="View Encounter Types")
java.util.List<EncounterType> getAllEncounterTypes()
                                                   throws APIException
Get all encounter types (not retired)

Returns:
encounter types list
Throws:
APIException
Expected behavior:
not return retired types

getAllEncounterTypes

@Transactional(readOnly=true)
@Authorized(value="View Encounter Types")
java.util.List<EncounterType> getAllEncounterTypes(boolean includeRetired)
                                                   throws APIException
Get all encounter types. If includeRetired is true, also get retired encounter types.

Parameters:
includeRetired -
Returns:
encounter types list
Throws:
APIException
Expected behavior:
not return retired types, include retired types with true includeRetired parameter

findEncounterTypes

@Transactional(readOnly=true)
@Authorized(value="View Encounter Types")
java.util.List<EncounterType> findEncounterTypes(java.lang.String name)
                                                 throws APIException
Find Encounter Types with name matching the beginning of the search string. Search strings are case insensitive so that "NaMe".equals("name") is true. Includes retired EncounterTypes.

Parameters:
name - of the encounter type to find
Returns:
List matching encounters
Throws:
APIException
Expected behavior:
return types by partial name match, return types by partial case insensitive match, include retired types in the results, not partial match name on internal substrings, return types ordered on name and nonretired first

retireEncounterType

@Authorized(value="Manage Encounter Types")
EncounterType retireEncounterType(EncounterType encounterType,
                                                  java.lang.String reason)
                                  throws APIException
Retire an EncounterType. This essentially marks the given encounter type as a non-current type that shouldn't be used anymore.

Parameters:
encounterType - the encounter type to retire
reason - required non-null purpose for retiring this encounter type
Throws:
APIException
Expected behavior:
retire type and set attributes, throw error if given null reason parameter

unretireEncounterType

@Authorized(value="Manage Encounter Types")
EncounterType unretireEncounterType(EncounterType encounterType)
                                    throws APIException
Unretire an EncounterType. This brings back the given encounter type and says that it can be used again

Parameters:
encounterType - the encounter type to unretire
Throws:
APIException
Expected behavior:
unretire type and unmark attributes

purgeEncounterType

@Authorized(value="Purge Encounter Types")
void purgeEncounterType(EncounterType encounterType)
                        throws APIException
Completely remove an encounter type from database.

Parameters:
encounterType -
Throws:
APIException
Expected behavior:
purge type

createEncounter

@Deprecated
@Authorized(value="Add Encounters")
void createEncounter(Encounter encounter)
                     throws APIException
Deprecated. replaced by saveEncounter(Encounter)

Creates a new encounter

Parameters:
encounter - to be created
Throws:
APIException

updateEncounter

@Deprecated
@Authorized(value="Edit Encounters")
void updateEncounter(Encounter encounter)
                     throws APIException
Deprecated. replaced by saveEncounter(Encounter)

Save changes to encounter. Automatically applys encounter.patient to all encounter.obs.patient

Parameters:
encounter -
Throws:
APIException

deleteEncounter

@Deprecated
@Authorized(value="Delete Encounters")
void deleteEncounter(Encounter encounter)
                     throws APIException
Deprecated. replaced by purgeEncounter(Encounter)

Delete encounter from database. For super users only. If dereferencing encounters, use voidEncounter(org.openmrs.Encounter)

Parameters:
encounter - encounter object to be deleted
Throws:
APIException

getEncountersByPatientId

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.List<Encounter> getEncountersByPatientId(java.lang.Integer patientId,
                                                                                            boolean includeVoided)
                                                   throws APIException
Deprecated. replaced by getEncountersByPatientId(Integer)

Get encounters for a patientId (not voided). To include voided Encounters use getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)

Parameters:
patientId -
includeVoided - No longer supported
Returns:
all encounters for the given patient identifer
Throws:
APIException

getEncountersByPatientIdentifier

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.List<Encounter> getEncountersByPatientIdentifier(java.lang.String identifier,
                                                                                                    boolean includeVoided)
                                                           throws APIException
Deprecated. replaced by getEncountersByPatientIdentifier(String)

Get encounters (not voided) for a patient identifier. To include voided encounters use getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)

Parameters:
identifier -
includeVoided - No longer supported.
Returns:
all encounters for the given patient identifer
Throws:
APIException

getEncounters

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.List<Encounter> getEncounters(Patient who)
Deprecated. replaced by getEncountersByPatient(Patient)

Get all encounters (not voided) for a patient

Parameters:
who -
Returns:
List encounters (not voided) for a patient

getEncounters

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.List<Encounter> getEncounters(Patient who,
                                                                                 boolean includeVoided)
Deprecated. replaced by getEncountersByPatient(Patient)

Get all encounters (not voided) for a patient. To include voided encounters, use getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)

Parameters:
who -
includeVoided - No longer supported.
Returns:
List object of non-voided Encounters

getEncounters

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.List<Encounter> getEncounters(Patient who,
                                                                                 Location where)
Deprecated. use getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)

Get all encounters for a patient that took place at a specific location

Parameters:
who -
where -
Returns:
List object of all encounters with this patient in specified location

getEncounters

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.List<Encounter> getEncounters(Patient who,
                                                                                 java.util.Date fromDate,
                                                                                 java.util.Date toDate)
Deprecated. use getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)

Get all encounters for a patient that took place between fromDate and toDate (both nullable and inclusive)

Parameters:
who -
fromDate -
toDate -
Returns:
List object of all encounters with this patient in specified date range

getEncounters

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.Collection<Encounter> getEncounters(java.util.Date fromDate,
                                                                                       java.util.Date toDate)
Deprecated. use getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)

Get all encounters that took place between fromDate and toDate (both nullable and inclusive)

Parameters:
fromDate -
toDate -
Returns:
Encounters from specified date range

getEncounters

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Encounters")
java.util.Collection<Encounter> getEncounters(Location loc,
                                                                                       java.util.Date fromDate,
                                                                                       java.util.Date toDate)
Deprecated. use getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)

Get all encounters that took place between fromDate and toDate (both nullable and inclusive) at the given location

Parameters:
loc - Location
fromDate -
toDate -
Returns:
Encounters from specified location and date range

getEncounterTypes

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Encounter Types")
java.util.List<EncounterType> getEncounterTypes()
                                                throws APIException
Deprecated. replaced by getAllEncounterTypes()

Get all encounter types (not retired)

Returns:
A List object of all non-retired EncounterTypes
Throws:
APIException

getLocations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Locations")
java.util.List<Location> getLocations()
                                      throws APIException
Deprecated. replaced by LocationService.getAllLocations()

Get all locations

Returns:
location list
Throws:
APIException

getLocation

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Locations")
Location getLocation(java.lang.Integer locationId)
                     throws APIException
Deprecated. replaced by LocationService.getLocation(Integer)

Get location by internal identifier

Parameters:
locationId -
Returns:
location with given internal identifier
Throws:
APIException

getLocationByName

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Locations")
Location getLocationByName(java.lang.String name)
                           throws APIException
Deprecated. replaced by LocationService.getLocation(String)

Get location by name

Parameters:
name - location's name
Returns:
location with given name
Throws:
APIException

findLocations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Locations")
java.util.List<Location> findLocations(java.lang.String name)
                                       throws APIException
Deprecated. replaced by LocationService.getLocations(String)

Search for locations by name. Matches returned match the given string at the beginning of the name

Parameters:
name - location's name
Returns:
list of locations with similar name
Throws:
APIException

getEncountersByPatient

@Authorized(value="View Encounters")
java.util.List<Encounter> getEncountersByPatient(java.lang.String query)
                                                 throws APIException
Search for encounters by patient name or patient identifier.

Parameters:
query - patient name or identifier
Returns:
list of encounters for the given patient
Throws:
APIException
Since:
1.7
See Also:
EncounterService}{@link #getEncountersByPatient(String, boolean)}

getEncountersByPatient

@Authorized(value="View Encounters")
java.util.List<Encounter> getEncountersByPatient(java.lang.String query,
                                                                 boolean includeVoided)
                                                 throws APIException
Search for encounters by patient name or patient identifier.

Parameters:
query - patient name or identifier
includeVoided - Specifies whether voided encounters should be included
Returns:
list of encounters for the given patient
Throws:
APIException
Since:
1.7
Expected behavior:
get all unvoided encounters for the given patient name, get all unvoided encounters for the given patient identifier, throw error if given null parameter, include voided encounters in the returned list if includedVoided is true

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change