public interface VisitService extends OpenmrsService
Modifier and Type | Method and Description |
---|---|
Visit |
endVisit(Visit visit,
Date stopDate)
Sets the stopDate of a given visit.
|
List<Visit> |
getActiveVisitsByPatient(Patient patient)
Convenience method that delegates to getVisitsByPatient(patient, false, false)
|
List<VisitAttributeType> |
getAllVisitAttributeTypes() |
List<Visit> |
getAllVisits()
Gets all unvoided visits in the database.
|
List<VisitType> |
getAllVisitTypes()
Gets all visit types.
|
List<VisitType> |
getAllVisitTypes(boolean includeRetired)
Get all visit types based on includeRetired flag
|
Visit |
getVisit(Integer visitId)
Gets a visit by its visit id.
|
VisitAttribute |
getVisitAttributeByUuid(String uuid) |
VisitAttributeType |
getVisitAttributeType(Integer id) |
VisitAttributeType |
getVisitAttributeTypeByUuid(String uuid) |
Visit |
getVisitByUuid(String uuid)
Gets a visit by its UUID.
|
List<Visit> |
getVisits(Collection<VisitType> visitTypes,
Collection<Patient> patients,
Collection<Location> locations,
Collection<Concept> indications,
Date minStartDatetime,
Date maxStartDatetime,
Date minEndDatetime,
Date maxEndDatetime,
Map<VisitAttributeType,Object> attributeValues,
boolean includeInactive,
boolean includeVoided)
Gets the visits matching the specified arguments
|
List<Visit> |
getVisits(VisitSearchCriteria visitSearchCriteria)
Gets the visits matching the specified search criteria
|
List<Visit> |
getVisitsByPatient(Patient patient)
Gets all unvoided visits for the specified patient
|
List<Visit> |
getVisitsByPatient(Patient patient,
boolean includeInactive,
boolean includeVoided)
Gets all visits for the specified patient
|
VisitType |
getVisitType(Integer visitTypeId)
Gets a visit type by its visit type id.
|
VisitType |
getVisitTypeByUuid(String uuid)
Gets a visit type by its UUID.
|
List<VisitType> |
getVisitTypes(String fuzzySearchPhrase)
Gets all visit types whose names are similar to or contain the given search phrase.
|
void |
purgeVisit(Visit visit)
Completely erases a visit from the database.
|
void |
purgeVisitAttributeType(VisitAttributeType visitAttributeType)
Completely removes a visit attribute type from the database
|
void |
purgeVisitType(VisitType visitType)
Completely removes a visit type from the database.
|
VisitAttributeType |
retireVisitAttributeType(VisitAttributeType visitAttributeType,
String reason)
Retires the given visit attribute type in the database
|
VisitType |
retireVisitType(VisitType visitType,
String reason)
Retires a given visit type.
|
Visit |
saveVisit(Visit visit)
Creates or updates the given visit in the database.
|
VisitAttributeType |
saveVisitAttributeType(VisitAttributeType visitAttributeType)
Creates or updates the given visit attribute type in the database
|
VisitType |
saveVisitType(VisitType visitType)
Creates or updates the given visit type in the database.
|
void |
stopVisits(Date maximumStartDate)
Stops all active visits started before or on the specified date which match any of the visit
types specified by the
OpenmrsConstants.GP_VISIT_TYPES_TO_AUTO_CLOSE global property. |
VisitAttributeType |
unretireVisitAttributeType(VisitAttributeType visitAttributeType)
Restores a visit attribute type that was previous retired in the database
|
VisitType |
unretireVisitType(VisitType visitType)
Unretires a visit type.
|
Visit |
unvoidVisit(Visit visit)
Unvoids the given visit.
|
Visit |
voidVisit(Visit visit,
String reason)
Voids the given visit.
|
onShutdown, onStartup
@Authorized(value="Get Visit Types") List<VisitType> getAllVisitTypes()
@Authorized(value="Manage Visit Types") List<VisitType> getAllVisitTypes(boolean includeRetired)
includeRetired
- @Authorized(value="Get Visit Types") VisitType getVisitType(Integer visitTypeId)
visitTypeId
- the visit type id.@Authorized(value="Get Visit Types") VisitType getVisitTypeByUuid(String uuid)
uuid
- the visit type UUID.@Authorized(value="Get Visit Types") List<VisitType> getVisitTypes(String fuzzySearchPhrase)
fuzzySearchPhrase
- the search phrase to use.@Authorized(value="Manage Visit Types") VisitType saveVisitType(VisitType visitType) throws APIException
visitType
- the visit type to create or update.APIException
@Authorized(value="Manage Visit Types") VisitType retireVisitType(VisitType visitType, String reason)
visitType
- the visit type to retire.reason
- the reason why the visit type is retired.@Authorized(value="Manage Visit Types") VisitType unretireVisitType(VisitType visitType)
visitType
- the visit type to unretire.@Authorized(value="Manage Visit Types") void purgeVisitType(VisitType visitType)
visitType
- the visit type to delete from the database.
Should delete given visit type@Authorized(value="Get Visits") List<Visit> getAllVisits() throws APIException
APIException
- Should return all unvoided visits@Authorized(value="Get Visits") Visit getVisit(Integer visitId) throws APIException
visitId
- the visit id.APIException
@Authorized(value="Get Visits") Visit getVisitByUuid(String uuid) throws APIException
uuid
- the visit UUID.APIException
- Should return a visit matching the specified uuid@Authorized(value={"Add Visits","Edit Visits"}) Visit saveVisit(Visit visit) throws APIException
visit
- the visit to create or update.APIException
- Should add a new visit to the database
Should update an existing visit in the database
Should fail if validation errors are found
Should pass if no validation errors are found
Should be able to add an attribute to a visit
Should void an attribute if max occurs is 1 and same attribute type already exists
Should save a visit though changedBy and dateCreated are not set for VisitAttribute
explicitly
Should should save new visit with encounters successfully@Authorized(value="Edit Visits") Visit endVisit(Visit visit, Date stopDate) throws APIException
visit
- the visit whose stopDate is to be setstopDate
- the date and time the visit is ending. if null, current date is usedAPIException
@Authorized(value="Delete Visits") Visit voidVisit(Visit visit, String reason) throws APIException
visit
- the visit to void.reason
- the reason why the visit is voidedAPIException
- Should void the visit and set the voidReason
Should void encounters with visit@Authorized(value="Delete Visits") Visit unvoidVisit(Visit visit) throws APIException
visit
- the visit to unvoidAPIException
- Should unvoid the visit and unset all the void related fields
Should unvoid encounters voided with visit@Authorized(value="Purge Visits") void purgeVisit(Visit visit) throws APIException
visit
- the visit to delete from the database.APIException
- Should erase the visit from the database
Should fail if the visit has encounters associated to it@Authorized(value="Get Visits") List<Visit> getVisits(Collection<VisitType> visitTypes, Collection<Patient> patients, Collection<Location> locations, Collection<Concept> indications, Date minStartDatetime, Date maxStartDatetime, Date minEndDatetime, Date maxEndDatetime, Map<VisitAttributeType,Object> attributeValues, boolean includeInactive, boolean includeVoided) throws APIException
visitTypes
- a list of visit types to match againstlocations
- a list of locations to match againstindications
- a list of indication concepts to match againstminStartDatetime
- the minimum visit start date to match againstmaxStartDatetime
- the maximum visit start date to match againstminEndDatetime
- the minimum visit end date to match againstmaxEndDatetime
- the maximum visit end date to match againstincludeInactive
- if false, the min/maxEndDatetime parameters are ignored and only open
visits are returnedincludeVoided
- specifies if voided visits should also be returnedAPIException
- Should get visits by visit type
Should get visits by patients
Should get visits by locations
Should get visits by indications
Should get visits started between the given start dates
Should get visits ended between the given end dates
Should get visits that are still open even if minStartDatetime is specified
Should return all visits if includeVoided is set to true
Should get all visits with given attribute values
Should not find any visits if none have given attribute valuesgetActiveVisitsByPatient(Patient)
@Authorized(value="Get Visits") List<Visit> getVisits(VisitSearchCriteria visitSearchCriteria) throws APIException
visitSearchCriteria
- APIException
@Authorized(value="Get Visits") List<Visit> getVisitsByPatient(Patient patient) throws APIException
patient
- the patient whose visits to getAPIException
- Should return all unvoided visits for the specified patient@Authorized(value="Get Visits") List<Visit> getActiveVisitsByPatient(Patient patient) throws APIException
patient
- the patient whose visits to getAPIException
@Authorized(value="Get Visits") List<Visit> getVisitsByPatient(Patient patient, boolean includeInactive, boolean includeVoided) throws APIException
patient
- the patient whose visits to getincludeInactive
- includeVoided
- APIException
- Should return all active unvoided visits for the specified patient
Should return all unvoided visits for the specified patient
Should return all active visits for the specified patient@Authorized(value="Get Visit Attribute Types") List<VisitAttributeType> getAllVisitAttributeTypes()
VisitAttributeType
s
Should return all visit attribute types including retired ones@Authorized(value="Get Visit Attribute Types") VisitAttributeType getVisitAttributeType(Integer id)
id
- VisitAttributeType
with the given internal id
Should return the visit attribute type with the given id
Should return null if no visit attribute type exists with the given id@Authorized(value="Get Visit Attribute Types") VisitAttributeType getVisitAttributeTypeByUuid(String uuid)
uuid
- VisitAttributeType
with the given uuid
Should return the visit attribute type with the given uuid
Should return null if no visit attribute type exists with the given uuid@Authorized(value="Manage Visit Attribute Types") VisitAttributeType saveVisitAttributeType(VisitAttributeType visitAttributeType)
visitAttributeType
- @Authorized(value="Manage Visit Attribute Types") VisitAttributeType retireVisitAttributeType(VisitAttributeType visitAttributeType, String reason)
visitAttributeType
- @Authorized(value="Manage Visit Attribute Types") VisitAttributeType unretireVisitAttributeType(VisitAttributeType visitAttributeType)
visitAttributeType
- @Authorized(value="Purge Visit Attribute Types") void purgeVisitAttributeType(VisitAttributeType visitAttributeType)
visitAttributeType
- Should completely remove a visit attribute type@Authorized(value="Get Visits") VisitAttribute getVisitAttributeByUuid(String uuid)
uuid
- VisitAttribute
with the given uuid
Should get the visit attribute with the given uuid
Should return null if no visit attribute has the given uuid@Authorized(value="Edit Visits") void stopVisits(Date maximumStartDate)
OpenmrsConstants.GP_VISIT_TYPES_TO_AUTO_CLOSE
global property.
If startDatetime is null, the default will be end of the current day.maximumStartDate
- Visits started on or before this date time value will get stopped
Should close all unvoided active visit matching the specified visit typesCopyright © 2024 OpenMRS Inc.. All rights reserved.