@Transactional public class PatientServiceImpl extends BaseOpenmrsService implements PatientService
Context.getPatientService()Context,
PatientService,
PersonService| Constructor and Description |
|---|
PatientServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkIfPatientIdentifierTypesAreLocked()
Check if patient identifier types are locked, and if they are, throws an exception during
manipulation of a patient identifier type
|
void |
checkPatientIdentifiers(Patient patient)
Convenience method to validate all identifiers for a given patient
|
void |
exitFromCare(Patient patient,
Date dateExited,
Concept reasonForExit)
This is the way to establish that a patient has left the care center.
|
Allergies |
getAllergies(Patient patient)
Gets allergies for a given patient
|
Allergy |
getAllergy(Integer allergyId)
Returns the Allergy identified by internal Ingerger Id
|
Allergy |
getAllergyByUuid(String uuid)
Returns the Allergy identified by uuid
|
Collection<IdentifierValidator> |
getAllIdentifierValidators() |
List<PatientIdentifierType> |
getAllPatientIdentifierTypes()
Get all patientIdentifier types
Ordered same as
PatientIdentifierTypeDefaultComparator. |
List<PatientIdentifierType> |
getAllPatientIdentifierTypes(boolean includeRetired)
Get all patientIdentifier types.
|
List<Patient> |
getAllPatients()
Returns all non voided patients in the system
|
List<Patient> |
getAllPatients(boolean includeVoided)
Returns patients in the system
|
Integer |
getCountOfPatients(String query)
Return the number of unvoided patients with names or patient identifiers or searchable person
attributes starting with or equal to the specified text
|
Integer |
getCountOfPatients(String query,
boolean includeVoided) |
IdentifierValidator |
getDefaultIdentifierValidator() |
List<Patient> |
getDuplicatePatientsByAttributes(List<String> attributes)
Search the database for patients that both share the given attributes.
|
IdentifierValidator |
getIdentifierValidator(Class<IdentifierValidator> identifierValidator)
Gets an identifier validator matching the given class.
|
IdentifierValidator |
getIdentifierValidator(String pivClassName)
Should return patient identifier validator given class name
Should treat empty strings like a null entry
|
Map<Class<? extends IdentifierValidator>,IdentifierValidator> |
getIdentifierValidators() |
Patient |
getPatient(Integer patientId)
Get patient by internal identifier
|
Patient |
getPatientByExample(Patient patientToMatch)
This default implementation simply looks at the OpenMRS internal id (patient_id).
|
Patient |
getPatientByUuid(String uuid)
Get patient by universally unique identifier.
|
PatientIdentifier |
getPatientIdentifier(Integer patientIdentifierId)
Returns a patient identifier that matches the given patientIndentifier id
|
PatientIdentifier |
getPatientIdentifierByUuid(String uuid)
Get patient identifier by universally unique identifier.
|
List<PatientIdentifier> |
getPatientIdentifiers(String identifier,
List<PatientIdentifierType> patientIdentifierTypes,
List<Location> locations,
List<Patient> patients,
Boolean isPreferred)
Get all patientIdentifiers that match all of the given criteria Voided identifiers are not
returned
|
List<PatientIdentifier> |
getPatientIdentifiersByPatientProgram(PatientProgram patientProgram)
Get all patientIdentifiers that are associated to the patient program
|
PatientIdentifierType |
getPatientIdentifierType(Integer patientIdentifierTypeId)
Get patientIdentifierType by internal identifier
|
PatientIdentifierType |
getPatientIdentifierTypeByName(String name)
Get patientIdentifierType by exact name
|
PatientIdentifierType |
getPatientIdentifierTypeByUuid(String uuid)
Get patient identifierType by universally unique identifier
|
List<PatientIdentifierType> |
getPatientIdentifierTypes(String name,
String format,
Boolean required,
Boolean hasCheckDigit)
Get all patientIdentifier types that match the given criteria
Ordered same as
PatientIdentifierTypeDefaultComparator. |
Patient |
getPatientOrPromotePerson(Integer patientOrPersonId)
Get patient by internal identifier.
|
List<Patient> |
getPatients(String query)
Generic search on patients based on the given string.
|
List<Patient> |
getPatients(String query,
boolean includeVoided,
Integer start,
Integer length) |
List<Patient> |
getPatients(String query,
Integer start,
Integer length)
Generic search on patients based on the given string and returns a specific number of them
from the specified starting position.
|
List<Patient> |
getPatients(String name,
String identifier,
List<PatientIdentifierType> identifierTypes,
boolean matchIdentifierExactly)
Get patients based on given criteria The identifier is matched with the regex
OpenmrsConstants.PATIENT_IDENTIFIER_REGEX All parameters are optional and
nullable. |
List<Patient> |
getPatients(String name,
String identifier,
List<PatientIdentifierType> identifierTypes,
boolean matchIdentifierExactly,
Integer start,
Integer length)
Get a limited size of patients from a given start index based on given criteria The
identifier is matched with the regex
OpenmrsConstants.PATIENT_IDENTIFIER_REGEX
All parameters are optional and nullable. |
boolean |
isIdentifierInUseByAnotherPatient(PatientIdentifier patientIdentifier)
Checks whether the given patient identifier is already assigned to a patient other than
patientIdentifier.patient
|
void |
mergePatients(Patient preferred,
List<Patient> notPreferred)
Convenience method to join multiple patients' information into one record.
|
void |
mergePatients(Patient preferred,
Patient notPreferred)
1) Moves object (encounters/obs) pointing to
nonPreferred to
preferred 2) Copies data (gender/birthdate/names/ids/etc) from
nonPreferred to preferred iff the data is missing or null in
preferred 3) notPreferred is marked as voided |
void |
onShutdown()
Clean up after this class.
|
void |
processDeath(Patient patient,
Date dateDied,
Concept causeOfDeath,
String otherReason)
This is the way to establish that a patient has died.
|
void |
purgePatient(Patient patient)
Delete patient from database.
|
void |
purgePatientIdentifier(PatientIdentifier patientIdentifier)
Purge PatientIdentifier (cannot be undone)
|
void |
purgePatientIdentifierType(PatientIdentifierType patientIdentifierType)
Purge PatientIdentifierType (cannot be undone)
|
void |
removeAllergy(Allergy allergy,
String reason)
Resolving the allergy, effectively removes the Allergy from the Patient's Active List by
setting the stop date to now, if null.
|
PatientIdentifierType |
retirePatientIdentifierType(PatientIdentifierType patientIdentifierType,
String reason)
Retire a type of patient identifier
|
void |
saveAllergy(Allergy allergy)
Creates an AllergyListItem to the Patient's Allergy Active List.
|
void |
saveCauseOfDeathObs(Patient patient,
Date deathDate,
Concept cause,
String otherReason)
Convenience method that saves the Obs that indicates when and why the patient died (including
any "other" reason there might be)
|
Patient |
savePatient(Patient patient)
Saved the given
patient to the database |
PatientIdentifier |
savePatientIdentifier(PatientIdentifier patientIdentifier)
Saved the given
patientIndentifier to the database |
PatientIdentifierType |
savePatientIdentifierType(PatientIdentifierType patientIdentifierType)
Create or update a PatientIdentifierType
|
Allergies |
setAllergies(Patient patient,
Allergies allergies)
Updates the patient's allergies
|
void |
setIdentifierValidators(Map<Class<? extends IdentifierValidator>,IdentifierValidator> identifierValidators)
ADDs identifierValidators, doesn't replace them
|
void |
setPatientDAO(PatientDAO dao)
Sets the DAO for this service.
|
PatientIdentifierType |
unretirePatientIdentifierType(PatientIdentifierType patientIdentifierType)
Unretire a type of patient identifier
|
Patient |
unvoidPatient(Patient patient)
Unvoid patient record.
|
void |
voidAllergy(Allergy allergy,
String reason)
Used only in cases where the Allergy was entered by error
|
Patient |
voidPatient(Patient patient,
String reason)
Void patient record (functionally delete patient from system).
|
PatientIdentifier |
voidPatientIdentifier(PatientIdentifier patientIdentifier,
String reason)
Void patient identifier (functionally delete patient identifier from system)
|
onStartupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonStartuppublic void setPatientDAO(PatientDAO dao)
PatientServicesetPatientDAO in interface PatientServicedao - DAO for this servicePatientService.setPatientDAO(org.openmrs.api.db.PatientDAO)public void onShutdown()
onShutdown in interface OpenmrsServiceonShutdown in class BaseOpenmrsServiceBaseOpenmrsService.onShutdown()public Patient savePatient(Patient patient) throws APIException
PatientServicepatient to the databasesavePatient in interface PatientServicepatient - patient to be created or updatedAPIException - Should create new patient from existing person plus user object
Should not throw a NonUniqueObjectException when called with a hand constructed patient
regression 1375
Should fail when patient does not have any patient identifiers
Should update an existing patient
Should fail when patient does not have required patient identifiers
Should update the date changed and changed by on update of the person address
Should set the preferred name address and identifier if none is specified
Should not set the preferred name address and identifier if they already exist
Should not set a voided name or address or identifier as preferredPatientService.savePatient(org.openmrs.Patient)@Transactional(readOnly=true) public Patient getPatient(Integer patientId) throws APIException
PatientServicegetPatient in interface PatientServicepatientId - internal patient identifierAPIException - Should return null object if patient id doesnt exist
Should fetch patient with given patient id
Should return null when patient with given patient id does not existPatientService.getPatient(java.lang.Integer)@Transactional(readOnly=true) public Patient getPatientOrPromotePerson(Integer patientOrPersonId)
PatientServicegetPatientOrPromotePerson in interface PatientService@Transactional(readOnly=true) public List<Patient> getAllPatients() throws APIException
PatientServicegetAllPatients in interface PatientServiceAPIException - Should fetch all non voided patientsPatientService.getAllPatients()@Transactional(readOnly=true) public List<Patient> getAllPatients(boolean includeVoided) throws APIException
PatientServicegetAllPatients in interface PatientServiceincludeVoided - if false, will limit the search to non-voided patientsAPIException - Should fetch voided patients when given include voided is true
Should fetch non voided patients when given include voided is falsePatientService.getAllPatients(boolean)@Transactional(readOnly=true) public List<Patient> getPatients(String name, String identifier, List<PatientIdentifierType> identifierTypes, boolean matchIdentifierExactly) throws APIException
PatientServiceOpenmrsConstants.PATIENT_IDENTIFIER_REGEX All parameters are optional and
nullable. If null, it is not included in the search. Will not return voided patientsgetPatients in interface PatientServicename - (optional) this is a slight break from the norm, patients with a partial match on
this name will be returnedidentifier - (optional) only patients with a matching identifier are returned. This
however applies only if name argument is null. Otherwise, its
ignored.identifierTypes - (optional) the PatientIdentifierTypes to restrict tomatchIdentifierExactly - (required) if true, then the given identifier must
equal the id in the database. if false, then the identifier is 'searched' for by
using a regular expressionAPIException - Should fetch all patients that partially match given name
Should fetch all patients that partially match given identifier if name argument
is null
Should fetch all patients that partially match given identifier when match identifier
exactly equals false and if name argument is null
Should fetch all patients that exactly match given identifier when match identifier exactly
equals true and if name argument is null
Should fetch all patients that match given identifier types
Should not return duplicates
Should not return voided patients
Should return empty list when no match is found
Should search familyName2 with name
Should support simple regex
Should support pattern using last digit as check digit
Should return empty list if name and identifier is emptyPatientService.getPatients(java.lang.String, java.lang.String,
java.util.List, boolean)@Transactional(readOnly=true) public void checkPatientIdentifiers(Patient patient) throws PatientIdentifierException
PatientServicecheckPatientIdentifiers in interface PatientServicepatient - patient for which to validate identifiersPatientIdentifierException - if one or more of the identifiers are invalid
Should validate when patient has all required and no duplicate and no blank patient
identifiers
Should ignore voided patient identifier
Should remove identifier and throw error when patient has blank patient identifier
Should throw error when patient has null patient identifiers
Should throw error when patient has empty patient identifiers
Should throw error when patient has identical identifiers
Should throw error when patient does not have one or more required identifiers
Should require one non voided patient identifierPatientService.checkPatientIdentifiers(org.openmrs.Patient)public Patient voidPatient(Patient patient, String reason) throws APIException
PatientServicevoidPatient in interface PatientServicepatient - patient to be voidedreason - reason for voiding patientAPIExceptionPatientService.voidPatient(org.openmrs.Patient, java.lang.String)public Patient unvoidPatient(Patient patient) throws APIException
PatientServiceunvoidPatient in interface PatientServicepatient - patient to be revivedAPIExceptionPatientService.unvoidPatient(org.openmrs.Patient)public void purgePatient(Patient patient) throws APIException
PatientServicepurgePatient in interface PatientServicepatient - patient to be deletedAPIExceptionPatientService.purgePatient(org.openmrs.Patient)@Transactional(readOnly=true) public List<PatientIdentifier> getPatientIdentifiers(String identifier, List<PatientIdentifierType> patientIdentifierTypes, List<Location> locations, List<Patient> patients, Boolean isPreferred) throws APIException
PatientServicegetPatientIdentifiers in interface PatientServiceidentifier - the full identifier to match onpatientIdentifierTypes - the type of identifiers to getlocations - the locations of the identifiers to matchpatients - the patients containing these identifiersisPreferred - if true, limits to only preferred identifiers if false, only non
preferred. if null, ignores preferred statusAPIException - Should fetch patient identifiers that exactly matches given identifier
Should not fetch patient identifiers that partially matches given identifier
Should fetch patient identifiers that match given patient identifier types
Should fetch patient identifiers that match given locations
Should fetch patient identifiers that match given patients
Should fetch preferred patient identifiers when given is preferred equals true
Should fetch non preferred patient identifiers when given is preferred equals false
Should fetch preferred and non preferred patient identifiers when given is preferred is nullPatientService.getPatientIdentifiers(java.lang.String, java.util.List,
java.util.List, java.util.List, java.lang.Boolean)public PatientIdentifierType savePatientIdentifierType(PatientIdentifierType patientIdentifierType) throws APIException
PatientServicesavePatientIdentifierType in interface PatientServicepatientIdentifierType - PatientIdentifierType to create or updateAPIException - Should create new patient identifier type
Should update existing patient identifier type
Should throw error when trying to save a patient identifier type while patient identifier
types are lockedPatientService.savePatientIdentifierType(org.openmrs.PatientIdentifierType)@Transactional(readOnly=true) public List<PatientIdentifierType> getAllPatientIdentifierTypes() throws APIException
PatientService
Ordered same as PatientIdentifierTypeDefaultComparator.
getAllPatientIdentifierTypes in interface PatientServiceAPIException - Should fetch all non retired patient identifier types
Should order as default comparatorPatientService.getAllPatientIdentifierTypes()@Transactional(readOnly=true) public List<PatientIdentifierType> getAllPatientIdentifierTypes(boolean includeRetired) throws APIException
PatientService
Ordered same as PatientIdentifierTypeDefaultComparator.
getAllPatientIdentifierTypes in interface PatientServiceincludeRetired - true/false whether retired types should be includedAPIException - Should fetch patient identifier types including retired when include retired is true
Should fetch patient identifier types excluding retired when include retired is false
Should order as default comparatorPatientService.getAllPatientIdentifierTypes(boolean)@Transactional(readOnly=true) public List<PatientIdentifierType> getPatientIdentifierTypes(String name, String format, Boolean required, Boolean hasCheckDigit) throws APIException
PatientService
Ordered same as PatientIdentifierTypeDefaultComparator.
getPatientIdentifierTypes in interface PatientServicename - name of the type to match onformat - the string format to match onrequired - if true, limits to only identifiers marked as required if false, only non
required. if null, ignores required bithasCheckDigit - if true, limits to only check digit'd identifiers if false, only non
checkdigit'd. if null, ignores checkDigitAPIException - Should fetch patient identifier types that match given name with given format
Should fetch required patient identifier types when given required is true
Should fetch non required patient identifier types when given required is false
Should fetch any patient identifier types when given required is null
Should fetch patient identifier types with check digit when given has check digit is true
Should fetch patient identifier types without check digit when given has check digit is
false
Should fetch any patient identifier types when given has check digit is null
Should order as default comparatorPatientService.getPatientIdentifierTypes(java.lang.String,
java.lang.String, java.lang.Boolean, java.lang.Boolean)@Transactional(readOnly=true) public PatientIdentifierType getPatientIdentifierType(Integer patientIdentifierTypeId) throws APIException
PatientServicegetPatientIdentifierType in interface PatientServiceAPIException - Should fetch patient identifier with given patient identifier type id
Should return null when patient identifier identifier does not existPatientService.getPatientIdentifierType(java.lang.Integer)@Transactional(readOnly=true) public PatientIdentifierType getPatientIdentifierTypeByName(String name) throws APIException
PatientServicegetPatientIdentifierTypeByName in interface PatientServiceAPIException - Should fetch patient identifier type that exactly matches given name
Should not return patient identifier type that partially matches given name
Should return null when patient identifier type with given name does not existPatientService.getPatientIdentifierTypeByName(java.lang.String)public PatientIdentifierType retirePatientIdentifierType(PatientIdentifierType patientIdentifierType, String reason) throws APIException
PatientServiceretirePatientIdentifierType in interface PatientServicepatientIdentifierType - type of patient identifier to be retiredreason - the reason to retire this identifier typeAPIException - Should retire patient identifier type with given reason
Should throw error when reason is empty
Should throw error when trying to retire a patient identifier type while patient identifier
types are lockedPatientService.retirePatientIdentifierType(org.openmrs.PatientIdentifierType,
String)public PatientIdentifierType unretirePatientIdentifierType(PatientIdentifierType patientIdentifierType) throws APIException
PatientServiceunretirePatientIdentifierType in interface PatientServicepatientIdentifierType - type of patient identifier to be unretiredAPIException - Should unretire patient identifier type
Should return unretired patient identifier type
Should throw error when trying to unretire a patient identifier type while patient
identifier types are lockedPatientService.unretirePatientIdentifierType(org.openmrs.PatientIdentifierType)public void purgePatientIdentifierType(PatientIdentifierType patientIdentifierType) throws APIException
PatientServicepurgePatientIdentifierType in interface PatientServicepatientIdentifierType - PatientIdentifierType to purge from the databaseAPIException - Should delete type from database
Should delete patient identifier type from database
Should throw error when trying to delete a patient identifier type while patient identifier
types are lockedPatientService.purgePatientIdentifierType(org.openmrs.PatientIdentifierType)@Transactional(readOnly=true) public List<Patient> getPatients(String query) throws APIException
PatientServicegetPatients in interface PatientServicequery - the string to search onAPIExceptionPatientService.getPatients(java.lang.String)@Transactional(readOnly=true) public Patient getPatientByExample(Patient patientToMatch) throws APIException
getPatientByExample in interface PatientServiceAPIExceptionPatientService.getPatientByExample(org.openmrs.Patient)@Transactional(readOnly=true) public List<Patient> getDuplicatePatientsByAttributes(List<String> attributes) throws APIException
PatientServicegetDuplicatePatientsByAttributes in interface PatientServiceattributes - attributes on a Person or Patient object. similar to: [gender, givenName,
middleName, familyName]APIException - Should fetch patients that exactly match on all given attributes
Should not return patients that exactly match on some but not all given attributesPatientService.getDuplicatePatientsByAttributes(java.util.List)public void mergePatients(Patient preferred, Patient notPreferred) throws APIException, SerializationException
nonPreferred to
preferred 2) Copies data (gender/birthdate/names/ids/etc) from
nonPreferred to preferred iff the data is missing or null in
preferred 3) notPreferred is marked as voidedmergePatients in interface PatientServicepreferred - notPreferred - APIExceptionSerializationExceptionPatientService.mergePatients(org.openmrs.Patient, org.openmrs.Patient)public void exitFromCare(Patient patient, Date dateExited, Concept reasonForExit) throws APIException
patient - - the patient who has exited caredateExited - - the declared date/time of the patient's exitreasonForExit - - the concept that corresponds with why the patient has been declared as
exitedAPIExceptionpublic void processDeath(Patient patient, Date dateDied, Concept causeOfDeath, String otherReason) throws APIException
processDeath in interface PatientServicepatient - - the patient who has dieddateDied - - the declared date/time of the patient's deathcauseOfDeath - - the concept that corresponds with the reason the patient diedotherReason - - in case the causeOfDeath is 'other', a place to store more infoAPIExceptionpublic void saveCauseOfDeathObs(Patient patient, Date deathDate, Concept cause, String otherReason) throws APIException
PatientServicesaveCauseOfDeathObs in interface PatientServicepatient - - the patient who has dieddeathDate - - the declared date/time of the patient's deathcause - - the concept that corresponds with the reason the patient diedotherReason - - if the concept representing the reason is OTHER NON-CODED, and a
string-based "other" reason is suppliedAPIException - Should throw error when given patient is null
Should throw error when given death date is null
Should throw error when given cause is null is null
Should throw error when cause of death global property is not specified
Should throw error when patient already has more than one cause of death observations
Should modify existing cause of death observation
Should set death attributes as long as patient is not already dead
Should be tested more thoroughlyPatientService.saveCauseOfDeathObs(org.openmrs.Patient, java.util.Date,
org.openmrs.Concept, java.lang.String)@Transactional(readOnly=true) public Patient getPatientByUuid(String uuid) throws APIException
PatientServicegetPatientByUuid in interface PatientServiceuuid - universally unique identifierAPIException - Should fetch patient with given uuid
Should return null if patient not found with given uuidPatientService.getPatientByUuid(java.lang.String)@Transactional(readOnly=true) public PatientIdentifier getPatientIdentifierByUuid(String uuid) throws APIException
PatientServicegetPatientIdentifierByUuid in interface PatientServiceuuid - universally unique identifierAPIException - Should fetch patient identifier with given uuid
Should return null if patient identifier not found with given uuid@Transactional(readOnly=true) public PatientIdentifierType getPatientIdentifierTypeByUuid(String uuid) throws APIException
PatientServicegetPatientIdentifierTypeByUuid in interface PatientServiceAPIException - Should fetch patient identifier type with given uuid
Should return null when patient identifier type with given uuid does not existPatientService.getPatientIdentifierTypeByUuid(java.lang.String)@Transactional(readOnly=true) public IdentifierValidator getDefaultIdentifierValidator()
getDefaultIdentifierValidator in interface PatientServicePatientService.getDefaultIdentifierValidator()public IdentifierValidator getIdentifierValidator(Class<IdentifierValidator> identifierValidator)
PatientServicegetIdentifierValidator in interface PatientServiceidentifierValidator - identifierValidator which validator to get.
Should return patient identifier validator given classPatientService.getIdentifierValidator(java.lang.String)public Map<Class<? extends IdentifierValidator>,IdentifierValidator> getIdentifierValidators()
public void setIdentifierValidators(Map<Class<? extends IdentifierValidator>,IdentifierValidator> identifierValidators)
identifierValidators - public Collection<IdentifierValidator> getAllIdentifierValidators()
getAllIdentifierValidators in interface PatientServicePatientService.getAllIdentifierValidators()@Transactional(readOnly=true) public IdentifierValidator getIdentifierValidator(String pivClassName)
PatientServicegetIdentifierValidator in interface PatientServicePatientService.getIdentifierValidator(java.lang.String)@Transactional(readOnly=true) public boolean isIdentifierInUseByAnotherPatient(PatientIdentifier patientIdentifier)
PatientServiceisIdentifierInUseByAnotherPatient in interface PatientServicepatientIdentifier - the patient identifier to look for in other patientsPatientService.isIdentifierInUseByAnotherPatient(org.openmrs.PatientIdentifier)@Transactional(readOnly=true) public PatientIdentifier getPatientIdentifier(Integer patientIdentifierId) throws APIException
PatientServicegetPatientIdentifier in interface PatientServicepatientIdentifierId - the patientIdentifier idAPIException - Should return the patientIdentifier with the given idPatientService.getPatientIdentifier(java.lang.Integer)public PatientIdentifier voidPatientIdentifier(PatientIdentifier patientIdentifier, String reason) throws APIException
PatientServicevoidPatientIdentifier in interface PatientServicepatientIdentifier - patientIdentifier to be voidedreason - reason for voiding patient identifierAPIException - Should void given patient identifier with given reaso
Should throw an APIException if the reason is null
Should throw an APIException if the reason is an empty string
Should throw an APIException if the reason is a white space characterPatientService.voidPatientIdentifier(org.openmrs.PatientIdentifier,
java.lang.String)public void mergePatients(Patient preferred, List<Patient> notPreferred) throws APIException, SerializationException
PatientServicemergePatients in interface PatientServiceAPIExceptionSerializationException - Should merge all non Preferred patients in the the notPreferred list to preferred patientPatientService.mergePatients(org.openmrs.Patient, java.util.List)public PatientIdentifier savePatientIdentifier(PatientIdentifier patientIdentifier) throws APIException
PatientServicepatientIndentifier to the databasesavePatientIdentifier in interface PatientServicepatientIdentifier - patientIndentifier to be created or updatedAPIException - Should create new patientIndentifier
Should update an existing patient identifier
Should throw an APIException when a null argument is passed
Should throw an APIException when one of the required fields is null
Should throw an APIException if the patientIdentifier string is a white space
Should throw an APIException if the patientIdentifier string is an empty stringPatientService.savePatientIdentifier(org.openmrs.PatientIdentifier)public void purgePatientIdentifier(PatientIdentifier patientIdentifier) throws APIException
PatientServicepurgePatientIdentifier in interface PatientServicepatientIdentifier - PatientIdentifier to purge from the databaseAPIException - Should delete patient identifier from databasePatientService.purgePatientIdentifier(org.openmrs.PatientIdentifier)@Transactional(readOnly=true) public Allergies getAllergies(Patient patient)
PatientServicegetAllergies in interface PatientServicepatient - the patientPatientService.getAllergies(org.openmrs.Patient)public Allergies setAllergies(Patient patient, Allergies allergies)
PatientServicesetAllergies in interface PatientServicepatient - the patientallergies - the allergiesPatientService.setAllergies(org.openmrs.Patient,
org.openmrs.Allergies)@Transactional(readOnly=true) public Allergy getAllergy(Integer allergyId) throws APIException
PatientServicegetAllergy in interface PatientServiceallergyId - identifies allergy by internal Ingerger IdAPIExceptionPatientService.getAllergy(java.lang.Integer)@Transactional(readOnly=true) public Allergy getAllergyByUuid(String uuid) throws APIException
PatientServicegetAllergyByUuid in interface PatientServiceuuid - identifies allergyAPIExceptionPatientService.getAllergyByUuid(java.lang.String)public void saveAllergy(Allergy allergy) throws APIException
PatientServicesaveAllergy in interface PatientServiceallergy - the AllergyAPIException - Should save the allergyPatientService.saveAllergy(org.openmrs.Allergy)public void removeAllergy(Allergy allergy, String reason) throws APIException
PatientServiceremoveAllergy in interface PatientServiceallergy - the Allergyreason - the reason of removeAPIException - Should set the end date for the allergyPatientService.removeAllergy(org.openmrs.Allergy,
java.lang.String)public void voidAllergy(Allergy allergy, String reason) throws APIException
PatientServicevoidAllergy in interface PatientServiceAPIExceptionPatientService.voidAllergy(org.openmrs.Allergy,
java.lang.String)@Transactional(readOnly=true) public Integer getCountOfPatients(String query)
PatientServicegetCountOfPatients in interface PatientServicequery - the string to search onPatientService.getCountOfPatients(String)@Transactional(readOnly=true) public Integer getCountOfPatients(String query, boolean includeVoided)
getCountOfPatients in interface PatientServicequery - the string to search onincludeVoided - true/false whether or not to included voided patientsPatientService.getCountOfPatients(String, boolean)@Transactional(readOnly=true) public List<Patient> getPatients(String query, Integer start, Integer length) throws APIException
PatientServicegetPatients in interface PatientServicequery - the string to search onstart - the starting indexlength - the number of patients to returnAPIExceptionPatientService.getPatients(String, Integer, Integer)@Transactional(readOnly=true) public List<Patient> getPatients(String query, boolean includeVoided, Integer start, Integer length) throws APIException
getPatients in interface PatientServicequery - the string to search onincludeVoided - true/false whether or not to included voided patientsstart - the starting indexlength - the number of patients to returnAPIExceptionPatientService.getPatients(String, boolean, Integer, Integer)@Transactional(readOnly=true) public List<Patient> getPatients(String name, String identifier, List<PatientIdentifierType> identifierTypes, boolean matchIdentifierExactly, Integer start, Integer length) throws APIException
PatientServiceOpenmrsConstants.PATIENT_IDENTIFIER_REGEX
All parameters are optional and nullable. If null, it is not included in the search. Will not
return voided patientsgetPatients in interface PatientServicename - (optional) this is a slight break from the norm, patients with a partial match on
this name will be returnedidentifier - (optional) only patients with a matching identifier are returnedidentifierTypes - (optional) the PatientIdentifierTypes to restrict tomatchIdentifierExactly - (required) if true, then the given identifier must
equal the id in the database. if false, then the identifier is 'searched' for by
using a regular expressionstart - the starting indexlength - the number of patients to returnAPIExceptionPatientService.getPatients(String, String, List, boolean, Integer, Integer)public void checkIfPatientIdentifierTypesAreLocked()
PatientServicecheckIfPatientIdentifierTypesAreLocked in interface PatientServicePatientService.checkIfPatientIdentifierTypesAreLocked()public List<PatientIdentifier> getPatientIdentifiersByPatientProgram(PatientProgram patientProgram)
PatientServicegetPatientIdentifiersByPatientProgram in interface PatientServicepatientProgram - the patientProgram to be used to fetch the associated identifiersPatientService.getPatientIdentifiersByPatientProgram(org.openmrs.PatientProgram)Copyright © 2024 OpenMRS Inc.. All rights reserved.