@Transactional public interface EncounterService extends OpenmrsService
| Modifier and Type | Method and Description | 
|---|---|
void | 
checkIfEncounterTypesAreLocked()
Check if the encounter types are locked, and if so, throw exception during manipulation of encounter type 
 | 
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) | 
EncounterVisitHandler | 
getActiveEncounterVisitHandler()
Gets the active handler for assigning visits to encounters. 
 | 
java.util.List<EncounterRole> | 
getAllEncounterRoles(boolean includeRetired)
Get all encounter roles based on includeRetired flag 
 | 
java.util.Map<java.lang.Integer,java.util.List<Encounter>> | 
getAllEncounters(Cohort patients)
Get all encounters for a cohort of patients 
 | 
java.util.List<EncounterType> | 
getAllEncounterTypes()
Get all encounter types (including retired) 
 | 
java.util.List<EncounterType> | 
getAllEncounterTypes(boolean includeRetired)
Get all encounter types. 
 | 
java.lang.Integer | 
getCountOfEncounters(java.lang.String query,
                    boolean includeVoided)
Return the number of encounters matching a patient name or patient identifier 
 | 
Encounter | 
getEncounter(java.lang.Integer encounterId)
Get encounter by internal identifier 
 | 
Encounter | 
getEncounterByUuid(java.lang.String uuid)
Get Encounter by its UUID 
 | 
EncounterRole | 
getEncounterRole(java.lang.Integer encounterRoleId)
Gets an encounter role when and internal encounter role id is provided. 
 | 
EncounterRole | 
getEncounterRoleByUuid(java.lang.String uuid)
Get EncounterRole by its UUID 
 | 
java.util.Collection<Encounter> | 
getEncounters(java.util.Date fromDate,
             java.util.Date toDate)
 | 
java.util.Collection<Encounter> | 
getEncounters(Location loc,
             java.util.Date fromDate,
             java.util.Date toDate)
 | 
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)
 | 
java.util.List<Encounter> | 
getEncounters(Patient who,
             Location where)
 | 
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. 
 
 | 
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<Provider> providers,
             java.util.Collection<VisitType> visitTypes,
             java.util.Collection<Visit> visits,
             boolean includeVoided)
Get all encounters that match a variety of (nullable) criteria. 
 | 
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)
 | 
java.util.List<Encounter> | 
getEncounters(java.lang.String query,
             java.lang.Integer start,
             java.lang.Integer length,
             boolean includeVoided)
Search for encounters by patient name or patient identifier and returns a specific number of
 them from the specified starting position. 
 | 
java.util.List<Encounter> | 
getEncounters(java.lang.String query,
             java.lang.Integer patientId,
             java.lang.Integer start,
             java.lang.Integer length,
             boolean includeVoided)
Searches for encounters by patient id, provider identifier, location, encounter type,
 provider, form or provider name. 
 | 
java.util.List<Encounter> | 
getEncountersByPatient(Patient patient)
Get all encounters (not voided) for a patient, sorted by encounterDatetime ascending. 
 | 
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) | 
java.util.List<Encounter> | 
getEncountersByVisit(Visit visit,
                    boolean includeVoided)
Gets all encounters grouped within a given visit. 
 | 
java.util.List<Encounter> | 
getEncountersByVisitsAndPatient(Patient patient,
                               boolean includeVoided,
                               java.lang.String query,
                               java.lang.Integer start,
                               java.lang.Integer length)
Gets encounters for the given patient. 
 | 
java.lang.Integer | 
getEncountersByVisitsAndPatientCount(Patient patient,
                                    boolean includeVoided,
                                    java.lang.String query)
Returns result count for
  
getEncountersByVisitsAndPatient(Patient, boolean, String, Integer, Integer). | 
java.util.List<Encounter> | 
getEncountersNotAssignedToAnyVisit(Patient patient)
Gets the unvoided encounters for the specified patient that are not assigned to any visit. 
 | 
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() | 
java.util.List<EncounterVisitHandler> | 
getEncounterVisitHandlers()  | 
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 | 
purgeEncounterRole(EncounterRole encounterRole)
Completely remove an encounter role from database. 
 | 
void | 
purgeEncounterType(EncounterType encounterType)
Completely remove an encounter type from database. 
 | 
EncounterRole | 
retireEncounterRole(EncounterRole encounterRole,
                   java.lang.String reason)
Retire an EncounterRole. 
 | 
EncounterType | 
retireEncounterType(EncounterType encounterType,
                   java.lang.String reason)
Retire an EncounterType. 
 | 
Encounter | 
saveEncounter(Encounter encounter)
Saves a new encounter or updates an existing encounter. 
 | 
EncounterRole | 
saveEncounterRole(EncounterRole encounterRole)
Saves a new encounter role or updates an existing encounter role. 
 | 
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. | 
EncounterRole | 
unretireEncounterRole(EncounterRole encounterType)
Unretire an EncounterRole. 
 | 
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 
 | 
onShutdown, onStartupvoid setEncounterDAO(EncounterDAO dao)
dao on this encounter service. The dao will act as the conduit
 through with all encounter calls get to the databasedao - @Authorized(value={"Add Encounters","Edit Encounters"}) Encounter saveEncounter(Encounter encounter) throws APIException
encounter - to be savedAPIException@Transactional(readOnly=true) @Authorized(value="View Encounters") Encounter getEncounter(java.lang.Integer encounterId) throws APIException
encounterId - encounter idAPIException@Transactional(readOnly=true) @Authorized(value="View Encounters") Encounter getEncounterByUuid(java.lang.String uuid) throws APIException
uuid - APIException@Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncountersByPatient(Patient patient)
patient - @Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncountersByPatientId(java.lang.Integer patientId) throws APIException
patientId - APIException@Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncountersByPatientIdentifier(java.lang.String identifier) throws APIException
identifier - APIException@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)
getEncounters(Patient, Location, Date, Date, Collection, Collection, Collection, boolean)@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, java.util.Collection<User> providers, boolean includeVoided)
getEncounters(Patient, Location, Date, Date, Collection, Collection, Collection, Collection, Collection, boolean)who - the patient the encounter is forloc - the location this encounter took placefromDate - the minimum date (inclusive) this encounter took placetoDate - the maximum date (exclusive) this encounter took placeenteredViaForms - the form that entered this encounter must be in this listencounterTypes - the type of encounter must be in this listproviders - the provider of this encounter must be in this listincludeVoided - true/false to include the voided encounters or not@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<Provider> providers, java.util.Collection<VisitType> visitTypes, java.util.Collection<Visit> visits, boolean includeVoided)
who - the patient the encounter is forloc - the location this encounter took placefromDate - the minimum date (inclusive) this encounter took placetoDate - the maximum date (exclusive) this encounter took placeenteredViaForms - the form that entered this encounter must be in this listencounterTypes - the type of encounter must be in this listproviders - the provider of this encounter must be in this listvisitTypes - the visit types of this encounter must be in this listvisits - the visits of this encounter must be in this listincludeVoided - true/false to include the voided encounters or not@Authorized(value="Edit Encounters") Encounter voidEncounter(Encounter encounter, java.lang.String reason)
encounter - Encounter object to voidreason - String reason that it's being voided@Authorized(value="Edit Encounters") Encounter unvoidEncounter(Encounter encounter) throws APIException
encounter - Encounter to be revivedAPIException@Authorized(value="Purge Encounters") void purgeEncounter(Encounter encounter) throws APIException
voidEncounter(org.openmrs.Encounter)encounter - encounter object to be purgedAPIException@Authorized(value="Purge Encounters") void purgeEncounter(Encounter encounter, boolean cascade) throws APIException
voidEncounter(org.openmrs.Encounter)encounter - encounter object to be purgedcascade - Purge any related observations as well?APIException@Authorized(value="Manage Encounter Types") EncounterType saveEncounterType(EncounterType encounterType) throws APIException
encounterType - APIException@Transactional(readOnly=true) @Authorized(value="View Encounter Types") EncounterType getEncounterType(java.lang.Integer encounterTypeId) throws APIException
encounterTypeId - IntegerAPIException@Transactional(readOnly=true) @Authorized(value="View Encounter Types") EncounterType getEncounterTypeByUuid(java.lang.String uuid) throws APIException
uuid - APIException@Transactional(readOnly=true) @Authorized(value="View Encounter Types") EncounterType getEncounterType(java.lang.String name) throws APIException
name - string to match to an Encounter.nameAPIException@Transactional(readOnly=true) @Authorized(value="View Encounter Types") java.util.List<EncounterType> getAllEncounterTypes() throws APIException
APIException@Transactional(readOnly=true) @Authorized(value="View Encounter Types") java.util.List<EncounterType> getAllEncounterTypes(boolean includeRetired) throws APIException
includeRetired - APIException@Transactional(readOnly=true) @Authorized(value="View Encounter Types") java.util.List<EncounterType> findEncounterTypes(java.lang.String name) throws APIException
name - of the encounter type to findAPIException@Authorized(value="Manage Encounter Types") EncounterType retireEncounterType(EncounterType encounterType, java.lang.String reason) throws APIException
encounterType - the encounter type to retirereason - required non-null purpose for retiring this encounter typeAPIException@Authorized(value="Manage Encounter Types") EncounterType unretireEncounterType(EncounterType encounterType) throws APIException
encounterType - the encounter type to unretireAPIException@Authorized(value="Purge Encounter Types") void purgeEncounterType(EncounterType encounterType) throws APIException
encounterType - APIException@Deprecated @Authorized(value="Add Encounters") void createEncounter(Encounter encounter) throws APIException
saveEncounter(Encounter)encounter - to be createdAPIException@Deprecated @Authorized(value="Edit Encounters") void updateEncounter(Encounter encounter) throws APIException
saveEncounter(Encounter)encounter - APIException@Deprecated @Authorized(value="Delete Encounters") void deleteEncounter(Encounter encounter) throws APIException
purgeEncounter(Encounter)voidEncounter(org.openmrs.Encounter)encounter - encounter object to be deletedAPIException@Deprecated @Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncountersByPatientId(java.lang.Integer patientId, boolean includeVoided) throws APIException
getEncountersByPatientId(Integer)getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)patientId - includeVoided - No longer supportedAPIException@Deprecated @Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncountersByPatientIdentifier(java.lang.String identifier, boolean includeVoided) throws APIException
getEncountersByPatientIdentifier(String)getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)identifier - includeVoided - No longer supported.APIException@Deprecated @Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncounters(Patient who)
getEncountersByPatient(Patient)who - @Deprecated @Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncounters(Patient who, boolean includeVoided)
getEncountersByPatient(Patient)getEncounters(Patient, Location, Date, Date, Collection, Collection, boolean)who - includeVoided - No longer supported.@Deprecated @Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncounters(Patient who, Location where)
who - where - @Deprecated @Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncounters(Patient who, java.util.Date fromDate, java.util.Date toDate)
who - fromDate - toDate - @Deprecated @Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.Collection<Encounter> getEncounters(java.util.Date fromDate, java.util.Date toDate)
fromDate - toDate - @Deprecated @Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.Collection<Encounter> getEncounters(Location loc, java.util.Date fromDate, java.util.Date toDate)
loc - LocationfromDate - toDate - @Deprecated @Transactional(readOnly=true) @Authorized(value="View Encounter Types") java.util.List<EncounterType> getEncounterTypes() throws APIException
getAllEncounterTypes()APIException@Deprecated @Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<Location> getLocations() throws APIException
LocationService.getAllLocations()APIException@Deprecated @Transactional(readOnly=true) @Authorized(value="View Locations") Location getLocation(java.lang.Integer locationId) throws APIException
LocationService.getLocation(Integer)locationId - APIException@Deprecated @Transactional(readOnly=true) @Authorized(value="View Locations") Location getLocationByName(java.lang.String name) throws APIException
LocationService.getLocation(String)name - location's nameAPIException@Deprecated @Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<Location> findLocations(java.lang.String name) throws APIException
LocationService.getLocations(String)name - location's nameAPIException@Authorized(value="View Encounters") java.util.List<Encounter> getEncountersByPatient(java.lang.String query) throws APIException
query - patient name or identifierAPIExceptionEncounterService}{@link #getEncountersByPatient(String, boolean)}@Authorized(value="View Encounters") java.util.List<Encounter> getEncountersByPatient(java.lang.String query, boolean includeVoided) throws APIException
query - patient name or identifierincludeVoided - Specifies whether voided encounters should be includedAPIException@Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncounters(java.lang.String query, java.lang.Integer start, java.lang.Integer length, boolean includeVoided) throws APIException
query - patient name or identifierstart - beginning index for the batchlength - number of encounters to return in the batchincludeVoided - Specifies whether voided encounters should be includedAPIException@Authorized(value="View Encounters") java.util.List<Encounter> getEncounters(java.lang.String query, java.lang.Integer patientId, java.lang.Integer start, java.lang.Integer length, boolean includeVoided) throws APIException
query - provider identifier, location, encounter type, provider, form or provider namepatientId - the patient idstart - beginning index for the batchlength - number of encounters to return in the batchincludeVoided - Specifies whether voided encounters should be includedAPIException@Transactional(readOnly=true) java.util.Map<java.lang.Integer,java.util.List<Encounter>> getAllEncounters(Cohort patients)
patients - Cohort of patients to search@Transactional(readOnly=true) @Authorized(value="View Encounters") java.lang.Integer getCountOfEncounters(java.lang.String query, boolean includeVoided)
query - patient name or identifierincludeVoided - Specifies whether voided encounters should be included@Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncountersByVisit(Visit visit, boolean includeVoided)
visit - the visit.includeVoided - whether voided encounters should be returned@Transactional(readOnly=true) java.util.List<EncounterVisitHandler> getEncounterVisitHandlers()
EncounterVisitHandler@Transactional(readOnly=true) EncounterVisitHandler getActiveEncounterVisitHandler() throws APIException
APIException - thrown if something goes wrong during the retrieval of the handler.EncounterVisitHandler@Authorized(value="Manage Encounter Roles") EncounterRole saveEncounterRole(EncounterRole encounterRole) throws APIException
encounterRole - to be savedAPIException@Transactional(readOnly=true) @Authorized(value="View Encounter Roles") EncounterRole getEncounterRole(java.lang.Integer encounterRoleId) throws APIException
encounterRoleId - to be retrievedAPIException@Authorized(value="Purge Encounter Roles") void purgeEncounterRole(EncounterRole encounterRole) throws APIException
retireEncounterRole(org.openmrs.Encounter, java.lang.String)encounterRole - encounter role object to be purgedAPIException@Transactional(readOnly=true) @Authorized(value="Manage Encounter Roles") java.util.List<EncounterRole> getAllEncounterRoles(boolean includeRetired)
includeRetired - @Transactional(readOnly=true) @Authorized(value="Manage Encounter Roles") EncounterRole getEncounterRoleByUuid(java.lang.String uuid) throws APIException
uuid - APIException@Authorized(value="Manage Encounter Roles") EncounterRole retireEncounterRole(EncounterRole encounterRole, java.lang.String reason) throws APIException
encounterRole - the encounter role to retirereason - required non-null purpose for retiring this encounter roleAPIException@Authorized(value="Manage Encounter Roles") EncounterRole unretireEncounterRole(EncounterRole encounterType) throws APIException
encounterRole - the encounter role to unretireAPIException@Transactional(readOnly=true) @Authorized(value="View Encounters") java.util.List<Encounter> getEncountersNotAssignedToAnyVisit(Patient patient) throws APIException
patient - the patient to match againstEncountersAPIException@Transactional(readOnly=true) @Authorized(value="View Visits") java.util.List<Encounter> getEncountersByVisitsAndPatient(Patient patient, boolean includeVoided, java.lang.String query, java.lang.Integer start, java.lang.Integer length) throws APIException
The empty encounters have only visit set.
patient - the patient to matchincludeVoided - if voided encounters or visits should be includedquery - filters results (defaults to return all results if null)start - index to start with (defaults to 0 if null)length - number of results to return (default to return all results if null)APIException@Transactional(readOnly=true) @Authorized(value="View Visits") java.lang.Integer getEncountersByVisitsAndPatientCount(Patient patient, boolean includeVoided, java.lang.String query) throws APIException
getEncountersByVisitsAndPatient(Patient, boolean, String, Integer, Integer).patient - includeVoided - query - APIExceptionvoid checkIfEncounterTypesAreLocked()
                             throws EncounterTypeLockedException
EncounterTypeLockedExceptionCopyright © 2018 OpenMRS Inc.. All Rights Reserved.