@Transactional public class ConceptServiceImpl extends BaseOpenmrsService implements ConceptService
to access these methods| Constructor and Description |
|---|
ConceptServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkIfLocked()
Check if the concepts are locked and if so, throw exception during manipulation of concept
|
Iterator<Concept> |
conceptIterator()
Returns an iterator for all concepts, including retired and expired.
|
void |
convertBooleanConceptToCoded(Concept conceptToChange)
Changes the datatype of a concept from boolean to coded when it has observations it is
associated to.
|
void |
deleteConceptStopWord(Integer conceptStopWordId)
Delete the given
ConceptStopWord in the database |
List<ConceptSearchResult> |
findConceptAnswers(String phrase,
Locale locale,
Concept concept)
Finds concepts that are possible value coded answers to concept parameter
|
List<ConceptMapType> |
getActiveConceptMapTypes()
Returns a list of concept map types currently in the database excluding hidden ones
|
List<ConceptAttributeType> |
getAllConceptAttributeTypes() |
List<ConceptClass> |
getAllConceptClasses()
Return a list of concept classes currently in the database
|
List<ConceptClass> |
getAllConceptClasses(boolean includeRetired)
Return a list of concept classes currently in the database
|
List<ConceptDatatype> |
getAllConceptDatatypes()
Return a list of all concept datatypes currently in the database
|
List<ConceptDatatype> |
getAllConceptDatatypes(boolean includeRetired)
Return a list of concept datatypes currently in the database
|
List<ConceptNameTag> |
getAllConceptNameTags()
Get all the concept name tags defined in the database, included voided ones
|
List<ConceptProposal> |
getAllConceptProposals(boolean includeCompleted)
Get a List of all concept proposals
|
List<ConceptReferenceTerm> |
getAllConceptReferenceTerms()
Gets a list of all concept reference terms saved in the database
|
List<Concept> |
getAllConcepts()
Return a list of unretired concepts sorted by concept id ascending and
|
List<Concept> |
getAllConcepts(String sortBy,
boolean asc,
boolean includeRetired)
Return a list of concepts sorted on sortBy in dir direction (asc/desc)
|
List<ConceptSource> |
getAllConceptSources(boolean includeRetired)
Return a list of concept sources currently in the database Whether or not to return retired
concept sources is decided by the boolean includeRetired param
|
List<ConceptStopWord> |
getAllConceptStopWords()
Get all the concept stop words
|
List<Drug> |
getAllDrugs()
Return a list of drugs currently in the database that are not retired
|
List<Drug> |
getAllDrugs(boolean includeRetired)
Get drugs by concept.
|
Concept |
getConcept(Integer conceptId)
Gets the concept with the given id
|
Concept |
getConcept(String conceptIdOrName)
Get Concept by id or name convenience method
|
ConceptAnswer |
getConceptAnswer(Integer conceptAnswerId)
Gets the ConceptAnswer with the given id
|
ConceptAnswer |
getConceptAnswerByUuid(String uuid)
Get ConceptAnswer by its UUID
|
ConceptAttribute |
getConceptAttributeByUuid(String uuid) |
ConceptAttributeType |
getConceptAttributeType(Integer id) |
ConceptAttributeType |
getConceptAttributeTypeByName(String exactName)
Retrieves a ConceptAttributeType object based on the name provided
|
ConceptAttributeType |
getConceptAttributeTypeByUuid(String uuid) |
List<ConceptAttributeType> |
getConceptAttributeTypes(String name)
Find concept attribute types matching the given parameters.
|
Concept |
getConceptByMapping(String code,
String sourceName)
Looks up a concept via
ConceptMap This will return the Concept which contains
a ConceptMap entry whose sourceCode is equal to the passed
conceptCode and whose ConceptSource has either a name or
hl7Code that is equal to the passed mappingCode. |
Concept |
getConceptByMapping(String code,
String sourceName,
Boolean includeRetired)
Looks up a concept via
ConceptMap This will return the Concept which contains
a ConceptMap entry whose sourceCode is equal to the passed
conceptCode and whose ConceptSource has either a name or
hl7Code that is equal to the passed mappingCode . |
Concept |
getConceptByName(String name)
Return a Concept that matches the name exactly
|
Concept |
getConceptByReference(String conceptRef)
Get the concept by conceptRef where the conceptRef can either be: 1) an integer id like 5090
2) a mapping type id like "XYZ:HT" 3) a uuid like "a3e12268-74bf-11df-9768-17cfc9833272" 4) a
name like "PLATELETS" 5) the fully qualified name of a Java constant which contains one of the above
|
Concept |
getConceptByUuid(String uuid)
Get Concept by its UUID
|
ConceptClass |
getConceptClass(Integer i)
Return a Concept class matching the given identifier
|
ConceptClass |
getConceptClassByName(String name)
Return a Concept class matching the given name
|
ConceptClass |
getConceptClassByUuid(String uuid)
Get ConceptClass by its UUID
|
ConceptComplex |
getConceptComplex(Integer conceptId)
Get a ComplexConcept with the given conceptId
|
ConceptDatatype |
getConceptDatatype(Integer i)
Return a ConceptDatatype matching the given identifier
|
ConceptDatatype |
getConceptDatatypeByName(String name)
Return a Concept datatype matching the given name
|
ConceptDatatype |
getConceptDatatypeByUuid(String uuid)
Get ConceptDatatype by its UUID
|
ConceptDescription |
getConceptDescriptionByUuid(String uuid)
Get ConceptDescription by its UUID
|
List<Integer> |
getConceptIdsByMapping(String code,
String sourceName,
boolean includeRetired)
Looks up concepts via
ConceptMap This will return the list of ids for all
Concepts which contain a ConceptMap entry whose sourceCode is
equal to the passed conceptCode and whose ConceptSource has either a
name or hl7Code that is equal to the passed
mappingCode |
List<ConceptMap> |
getConceptMappingsToSource(ConceptSource conceptSource)
Returns a list of mappings from concepts to terms in the given reference terminology
|
ConceptMapType |
getConceptMapType(Integer conceptMapTypeId)
Return a concept map type matching the given concept map type id
|
ConceptMapType |
getConceptMapTypeByName(String name)
Return a concept map type matching the given name
|
ConceptMapType |
getConceptMapTypeByUuid(String uuid)
Return a concept map type matching the given uuid
|
List<ConceptMapType> |
getConceptMapTypes(boolean includeRetired,
boolean includeHidden)
Returns a list of concept map types currently in the database including or excluding retired
and hidden ones as specified by the includeRetired and includeHidden arguments
|
ConceptName |
getConceptName(Integer conceptNameId)
Gets the concept-name with the given id
|
ConceptName |
getConceptNameByUuid(String uuid)
Get ConceptName by its UUID
|
ConceptNameTag |
getConceptNameTag(Integer id)
Gets the
ConceptNameTag with the given database primary key |
ConceptNameTag |
getConceptNameTagByName(String tagName)
Search for a ConceptNameTag by name
|
ConceptNameTag |
getConceptNameTagByUuid(String uuid)
Get ConceptNameTag by its UUID
|
ConceptNumeric |
getConceptNumeric(Integer conceptId)
Get the ConceptNumeric with the given id
|
ConceptNumeric |
getConceptNumericByUuid(String uuid)
Get ConceptNumeric by its UUID
|
ConceptProposal |
getConceptProposal(Integer conceptProposalId)
Get a ConceptProposal by conceptProposalId
|
ConceptProposal |
getConceptProposalByUuid(String uuid)
Get ConceptProposal by its UUID
|
List<ConceptProposal> |
getConceptProposals(String cp)
Find matching concept proposals
|
ConceptReferenceTerm |
getConceptReferenceTerm(Integer conceptReferenceTermId)
Gets the concept reference term with the specified concept reference term id
|
ConceptReferenceTerm |
getConceptReferenceTermByCode(String code,
ConceptSource conceptSource)
Gets a concept reference term with the specified code from the specified concept source
|
List<ConceptReferenceTerm> |
getConceptReferenceTermByCode(String code,
ConceptSource conceptSource,
boolean includeRetired)
Gets a list of concept reference terms with the specified code from the specified concept source
|
ConceptReferenceTerm |
getConceptReferenceTermByName(String name,
ConceptSource conceptSource)
Gets a concept reference term with the specified name from the specified concept source
ignoring all retired ones
|
ConceptReferenceTerm |
getConceptReferenceTermByUuid(String uuid)
Gets the concept reference term with the specified uuid
|
List<ConceptReferenceTerm> |
getConceptReferenceTerms(boolean includeRetired)
Gets a list of concept reference terms saved in the database
|
List<ConceptReferenceTerm> |
getConceptReferenceTerms(String query,
ConceptSource conceptSource,
Integer start,
Integer length,
boolean includeRetired)
Finds the concept reference term in the database that have a code or name that contains the
specified search phrase.
|
List<ConceptSearchResult> |
getConcepts(String phrase,
List<Locale> locales,
boolean includeRetired,
List<ConceptClass> requireClasses,
List<ConceptClass> excludeClasses,
List<ConceptDatatype> requireDatatypes,
List<ConceptDatatype> excludeDatatypes,
Concept answersToConcept,
Integer start,
Integer size)
Searches for concepts by the given parameters.
|
List<ConceptSearchResult> |
getConcepts(String phrase,
Locale locale,
boolean includeRetired)
Searches for concepts with the given parameters
|
List<Concept> |
getConceptsByAnswer(Concept concept)
Returns all possible Concepts to which this concept is a value-coded answer.
|
List<Concept> |
getConceptsByClass(ConceptClass cc) |
List<Concept> |
getConceptsByConceptSet(Concept c)
Return a List of all concepts within a concept set
|
List<Concept> |
getConceptsByMapping(String code,
String sourceName)
Looks up a concept via
ConceptMap This will return the list of concepts
Concepts which contain a ConceptMap entry whose sourceCode is
equal to the passed conceptCode and whose ConceptSource has either a
name or hl7Code that is equal to the passed
mappingCode |
List<Concept> |
getConceptsByMapping(String code,
String sourceName,
boolean includeRetired)
Looks up a concept via
ConceptMap This will return the list of Concepts which
contain a ConceptMap entry whose sourceCode is equal to the passed
conceptCode and whose ConceptSource has either a name or
hl7Code that is equal to the passed mappingCode. |
List<Concept> |
getConceptsByName(String name)
Returns a list of concepts matching any part of a concept name, this method is case
insensitive to the concept name string
|
List<Concept> |
getConceptsByName(String name,
Locale locale,
Boolean exactLocale)
Returns a list of concepts with the same name in the given locale.
|
ConceptSet |
getConceptSetByUuid(String uuid)
Get ConceptSet by its UUID
|
List<ConceptSet> |
getConceptSetsByConcept(Concept concept)
Return a list of the concept sets with concept_set matching concept
For example to find all concepts for ARVs, you would do
getConceptSets(getConcept("ANTIRETROVIRAL MEDICATIONS")) and then take the conceptIds from
the resulting list.
|
ConceptSource |
getConceptSource(Integer conceptSourceId)
Return a Concept source matching the given concept source id
|
ConceptSource |
getConceptSourceByHL7Code(String hl7Code)
Get a ConceptSource by its hl7Code.
|
ConceptSource |
getConceptSourceByName(String conceptSourceName)
Lookup a ConceptSource by its name property
|
ConceptSource |
getConceptSourceByUniqueId(String uniqueId)
Get a ConceptSource by its unique id.
|
ConceptSource |
getConceptSourceByUuid(String uuid)
Get ConceptSource by its UUID
|
List<String> |
getConceptStopWords(Locale locale)
Gets the list of
ConceptStopWord for given locale |
List<Concept> |
getConceptsWithDrugsInFormulary()
Convenience method for finding concepts associated with drugs in formulary.
|
Integer |
getCountOfConceptReferenceTerms(String query,
ConceptSource conceptSource,
boolean includeRetired)
Returns the count of concept reference terms that match the specified arguments
|
Integer |
getCountOfConcepts(String phrase,
List<Locale> locales,
boolean includeRetired,
List<ConceptClass> requireClasses,
List<ConceptClass> excludeClasses,
List<ConceptDatatype> requireDatatypes,
List<ConceptDatatype> excludeDatatypes,
Concept answersToConcept)
Return the number of concepts matching a search phrase and the specified arguments
|
Integer |
getCountOfDrugs(String drugName,
Concept concept,
boolean searchOnPhrase,
boolean searchDrugConceptNames,
boolean includeRetired)
Return the number of drugs with matching names or concept drug names
|
ConceptMapType |
getDefaultConceptMapType()
Gets the concept map type to be used as the default.
|
Drug |
getDrug(Integer drugId)
Get the Drug with the given id
|
Drug |
getDrug(String drugNameOrId)
Return the drug object corresponding to the given name or drugId
|
Drug |
getDrugByMapping(String code,
ConceptSource conceptSource,
Collection<ConceptMapType> withAnyOfTheseTypesOrOrderOfPreference)
Gets the "best" matching drug, i.e. matching the earliest ConceptMapType passed in e.g.
|
Drug |
getDrugByUuid(String uuid)
Get Drug by its UUID
|
DrugIngredient |
getDrugIngredientByUuid(String uuid)
Get Drug Ingredient by its UUID
|
List<Drug> |
getDrugs(String phrase)
Find drugs in the system.
|
List<Drug> |
getDrugs(String drugName,
Concept concept,
boolean searchOnPhrase,
boolean searchDrugConceptNames,
boolean includeRetired,
Integer start,
Integer length)
Returns a list of drugs with matching names or concept drug names and returns a specific
number of them from the specified starting position.
|
List<Drug> |
getDrugs(String searchPhrase,
Locale locale,
boolean exactLocale,
boolean includeRetired)
Fetches un retired drugs that match the specified search phrase.
|
List<Drug> |
getDrugsByConcept(Concept concept)
Return a list of drugs associated with the given concept
|
List<Drug> |
getDrugsByIngredient(Concept ingredient)
Gets drugs by the given ingredient, which can be either the drug itself or any ingredient.
|
List<Drug> |
getDrugsByMapping(String code,
ConceptSource conceptSource,
Collection<ConceptMapType> withAnyOfTheseTypes,
boolean includeRetired)
Fetches all drugs with reference mappings to the specified concept source that match the
specified code and concept map types
|
Concept |
getFalseConcept()
Returns the FALSE concept
|
Set<Locale> |
getLocalesOfConceptNames()
Gets the set of unique Locales used by existing concept names.
|
Integer |
getMaxConceptId()
Gets the highest concept-id used by a concept.
|
Concept |
getNextConcept(Concept c)
Finds the next concept in the dictionary that has the next largest concept id
|
List<ConceptSearchResult> |
getOrderableConcepts(String phrase,
List<Locale> locales,
boolean includeRetired,
Integer start,
Integer length)
An Orderable concept is one where its conceptClass has a mapping in the order_type_class_map
table.
|
Concept |
getPrevConcept(Concept c)
Finds the previous concept in the dictionary that has the next lowest concept id
|
List<Concept> |
getProposedConcepts(String text)
Find matching proposed concepts
|
List<ConceptReferenceTermMap> |
getReferenceTermMappingsTo(ConceptReferenceTerm term)
Fetches all the
ConceptReferenceTermMap where the specified reference term is the
termB i.e mappings added to other terms pointing to it |
List<ConceptSet> |
getSetsContainingConcept(Concept concept)
Find all sets that the given concept is a member of
|
Concept |
getTrueConcept()
Returns the TRUE concept
|
Concept |
getUnknownConcept()
Returns the UNKNOWN concept
|
boolean |
hasAnyConceptAttribute(ConceptAttributeType conceptAttributeType) |
boolean |
hasAnyObservation(Concept concept)
Checks if there are any observations (including voided observations) for a concept.
|
boolean |
hasAnyObservation(ConceptName conceptName)
Checks if there are any observations (including voided observations) using a conceptName.
|
boolean |
isConceptNameDuplicate(ConceptName name)
Determines if the given concept name is a duplicate.
|
static boolean |
isValidUuidFormat(String uuid)
Determines if the passed string is in valid uuid format By OpenMRS standards, a uuid must be 36
characters in length and not contain whitespace, but we do not enforce that a uuid be in the
"canonical" form, with alphanumerics seperated by dashes, since the MVP dictionary does not use
this format (We also are being slightly lenient and accepting uuids that are 37 or 38 characters
in length, since the uuid data field is 38 characters long)
|
Concept |
mapConceptProposalToConcept(ConceptProposal cp,
Concept mappedConcept)
Maps a concept proposal to a concept
|
Concept |
mapConceptProposalToConcept(ConceptProposal cp,
Concept mappedConcept,
Locale locale)
Maps a concept proposal to a concept
|
void |
purgeConcept(Concept concept)
Completely purge a
Concept or ConceptNumeric from the database. |
void |
purgeConceptAttributeType(ConceptAttributeType conceptAttributeType)
Completely removes a concept attribute type from the database
|
void |
purgeConceptClass(ConceptClass cc)
Purge a ConceptClass
|
void |
purgeConceptMapType(ConceptMapType conceptMapType)
Completely purges a concept map type from the database
|
void |
purgeConceptNameTag(ConceptNameTag cnt)
Purge a ConceptNameTag
|
void |
purgeConceptProposal(ConceptProposal cp)
Removes a concept proposal from the database entirely.
|
void |
purgeConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm)
Purges the specified concept reference term from the database
|
ConceptSource |
purgeConceptSource(ConceptSource cs)
Delete ConceptSource
|
void |
purgeDrug(Drug drug)
Completely purge a Drug from the database.
|
Concept |
retireConcept(Concept concept,
String reason)
Retiring a concept essentially removes it from circulation
|
ConceptAttributeType |
retireConceptAttributeType(ConceptAttributeType conceptAttributeType,
String reason)
Retire a concept attribute type
|
ConceptMapType |
retireConceptMapType(ConceptMapType conceptMapType,
String retireReason)
Retiring a concept map type essentially removes it from circulation
|
ConceptReferenceTerm |
retireConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm,
String retireReason)
Retiring a concept reference term essentially removes it from circulation
|
ConceptSource |
retireConceptSource(ConceptSource cs,
String reason)
This effectively removes a concept source from the database.
|
Drug |
retireDrug(Drug drug,
String reason)
Retiring a Drug essentially removes it from circulation
|
Concept |
saveConcept(Concept concept)
Save or update the given
Concept or ConceptNumeric in the database
If this is a new concept, the returned concept will have a new Concept.getConceptId()
inserted into it that was generated by the database |
ConceptAttributeType |
saveConceptAttributeType(ConceptAttributeType conceptAttributeType)
Creates or updates the given concept attribute type in the database
|
ConceptClass |
saveConceptClass(ConceptClass cc)
Creates or updates a concept class
|
ConceptMapType |
saveConceptMapType(ConceptMapType conceptMapType)
Saves or updates the specified concept map type in the database
|
ConceptNameTag |
saveConceptNameTag(ConceptNameTag nameTag)
Creates a new Concept name tag if none exists.
|
ConceptProposal |
saveConceptProposal(ConceptProposal conceptProposal)
Saves/updates/proposes a concept proposal
|
ConceptReferenceTerm |
saveConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm)
Stores the specified concept reference term to the database
|
ConceptSource |
saveConceptSource(ConceptSource conceptSource)
Create a new ConceptSource
|
ConceptStopWord |
saveConceptStopWord(ConceptStopWord conceptStopWord)
Save the given
ConceptStopWord in the database
If this is a new concept stop word, the returned concept stop word will have a new
ConceptStopWord.getConceptStopWordId() inserted into it that was
generated by the database
|
Drug |
saveDrug(Drug drug)
Save or update the given
Drug in the database. |
void |
setConceptDAO(ConceptDAO dao)
Sets the data access object for Concepts.
|
ConceptAttributeType |
unretireConceptAttributeType(ConceptAttributeType conceptAttributeType)
Un-Retire a concept attribute type
|
ConceptMapType |
unretireConceptMapType(ConceptMapType conceptMapType)
Marks a concept map type that is currently retired as not retired.
|
ConceptReferenceTerm |
unretireConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm)
Marks a concept reference term that is currently retired as not retired.
|
Drug |
unretireDrug(Drug drug)
Marks a drug that is currently retired as not retired.
|
void |
updateConceptIndex(Concept concept)
Iterates over the words in names and synonyms (for each locale) and updates the concept
index, note that this only updates the index of the specified concept.
|
void |
updateConceptIndexes()
Iterates over all concepts and calls updateConceptIndexes(Concept concept)
|
onShutdown, onStartupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonShutdown, onStartuppublic void setConceptDAO(ConceptDAO dao)
ConceptServicesetConceptDAO in interface ConceptServicedao - The data access object to useConceptService.setConceptDAO(org.openmrs.api.db.ConceptDAO)@CacheEvict(value="conceptIdsByMapping",
allEntries=true)
public Concept saveConcept(Concept concept)
throws APIException
ConceptServiceConcept or ConceptNumeric in the database
If this is a new concept, the returned concept will have a new Concept.getConceptId()
inserted into it that was generated by the database
saveConcept in interface ConceptServiceconcept - The Concept or ConceptNumeric to save or updateConcept or ConceptNumeric that was saved or updatedAPIExceptionConceptsLockedExceptionConceptInUseException - Should put generated concept id onto returned concept
Should create new concept in database
Should update concept already existing in database
Should generate id for new concept if none is specified
Should keep id for new concept if one is specified
Should save non ConceptNumeric object as conceptNumeric
Should save non ConceptComplex object as conceptComplex
Should save changes between concept numeric and complex
Should save a ConceptNumeric as a concept
Should save a new ConceptNumeric
Should void the conceptName if the text of the name has changed
Should create a new conceptName when the old name is changed
Should set a preferred name for each locale if none is marked
Should not fail when a duplicate name is edited to a unique value
Should create a reference term for a concept mapping on the fly when editing a concept
Should create a reference term for a concept mapping on the fly when creating a concept
Should add new concept name
Should not set audit info if the concept is not edited
Should set audit info if an item is removed from any of its child collections
Should set audit info if any item in the child collections is edited
Should set audit info if an item is added to any of its child collections
Should pass when saving a concept after removing a name
Should save a conceptNumeric with allowDecimal valueShould return the concept with new conceptID if creating new concept
Should return the concept with same conceptID if updating existing concept
Should leave preferred name preferred if set
Should set default preferred name to fully specified first
Should not set default preferred name to short or index terms
Should force set flag if set members existpublic Drug saveDrug(Drug drug) throws APIException
ConceptServiceDrug in the database. If this is a new drug, the
returned drug object will have a new Drug.getDrugId() inserted into it that was
generated by the databasesaveDrug in interface ConceptServicedrug - The Drug to save or updateAPIException - Should put generated drug id onto returned drug
Should create new drug in database
Should update drug already existing in databaseConceptService.saveDrug(org.openmrs.Drug)public void purgeConcept(Concept concept) throws APIException
ConceptServiceConcept or ConceptNumeric from the database.
This should not typically be used unless desperately needed. Most should just be retired. See
ConceptService.retireConcept(Concept, String)purgeConcept in interface ConceptServiceconcept - The Concept or ConceptNumeric to
remove from the systemAPIException - Should purge the concept if not being used by an obs
Should fail if any of the conceptNames of the concept is being used by an obsConceptService.purgeConcept(Concept)public Concept retireConcept(Concept concept, String reason) throws APIException
ConceptServiceretireConcept in interface ConceptServiceconcept - The Concept or ConceptNumeric to
retirereason - The retire reasonConcept or ConceptNumericAPIException - Should fail if no reason is given
Should retire the given conceptConceptService.retireConcept(org.openmrs.Concept, java.lang.String)public Drug retireDrug(Drug drug, String reason) throws APIException
ConceptServiceretireDrug in interface ConceptServicedrug - The Drug to retirereason - The retire reasonAPIExceptionConceptService.retireDrug(org.openmrs.Drug, java.lang.String)public Drug unretireDrug(Drug drug) throws APIException
ConceptServiceunretireDrug in interface ConceptServicedrug - that is current set as retiredAPIException - Should mark drug as not retired
Should not change attributes of drug that is already not retiredConceptService.unretireDrug(org.openmrs.Drug)public void purgeDrug(Drug drug) throws APIException
ConceptServicepurgeDrug in interface ConceptServicedrug - The Drug to remove from the systemAPIExceptionConceptService.purgeDrug(org.openmrs.Drug)@Transactional(readOnly=true) public Concept getConcept(Integer conceptId) throws APIException
ConceptServicegetConcept in interface ConceptServiceAPIExceptionConceptService.getConcept(java.lang.Integer)@Transactional(readOnly=true) public Concept getConceptByReference(String conceptRef)
ConceptServicegetConceptByReference in interface ConceptServiceconceptRef - the concept string identifierConceptService.getConceptByReference(String conceptRef)@Transactional(readOnly=true) public ConceptName getConceptName(Integer conceptNameId) throws APIException
ConceptServicegetConceptName in interface ConceptServiceAPIExceptionConceptService.getConceptName(java.lang.Integer)@Transactional(readOnly=true) public ConceptAnswer getConceptAnswer(Integer conceptAnswerId) throws APIException
ConceptServicegetConceptAnswer in interface ConceptServiceAPIExceptionConceptService.getConceptAnswer(java.lang.Integer)@Transactional(readOnly=true) public Drug getDrug(Integer drugId) throws APIException
ConceptServicegetDrug in interface ConceptServiceAPIExceptionConceptService.getDrug(java.lang.Integer)@Transactional(readOnly=true) public ConceptNumeric getConceptNumeric(Integer conceptId) throws APIException
ConceptServicegetConceptNumeric in interface ConceptServiceconceptId - The ConceptNumeric idAPIExceptionConceptService.getConceptNumeric(java.lang.Integer)@Transactional(readOnly=true) public ConceptComplex getConceptComplex(Integer conceptId)
ConceptServicegetConceptComplex in interface ConceptServiceconceptId - of the ComplexConceptConceptService.getConceptComplex(java.lang.Integer)@Transactional(readOnly=true) public List<Concept> getAllConcepts() throws APIException
ConceptServicegetAllConcepts in interface ConceptServiceAPIExceptionConceptService.getAllConcepts()@Transactional(readOnly=true) public List<Concept> getAllConcepts(String sortBy, boolean asc, boolean includeRetired) throws APIException
ConceptServicegetAllConcepts in interface ConceptServicesortBy - The property name to sort by; if null or invalid, concept_id is used.asc - true = sort ascending; false = sort descendingincludeRetired - If true, retired concepts will also be returnedAPIException - Should order by concept id and include retired when given no parameters
Should order by concept id descending when set asc parameter to false
Should exclude retired concepts when set includeRetired to false
Should order by a concept name field
Should order by a concept fieldConceptService.getAllConcepts(java.lang.String, boolean, boolean)@Transactional(readOnly=true) public List<Concept> getConceptsByName(String name) throws APIException
ConceptServicegetConceptsByName in interface ConceptServicename - The search stringAPIExceptionConceptService.getConceptsByName(java.lang.String)@Transactional(readOnly=true) public Concept getConceptByName(String name)
ConceptServicegetConceptByName in interface ConceptServicename - The search stringConceptService.getConceptByName(java.lang.String)@Transactional(readOnly=true) public Concept getConcept(String conceptIdOrName)
ConceptServicegetConcept in interface ConceptServiceConceptService.getConcept(java.lang.String)@Transactional(readOnly=true) public Drug getDrug(String drugNameOrId)
ConceptServicegetDrug in interface ConceptServicedrugNameOrId - String name or drugId to match exactly onConceptService.getDrug(java.lang.String)@Transactional(readOnly=true) public List<Drug> getAllDrugs()
ConceptServicegetAllDrugs in interface ConceptServiceConceptService.getAllDrugs()@Transactional(readOnly=true) public List<Drug> getAllDrugs(boolean includeRetired)
ConceptServicegetAllDrugs in interface ConceptServiceincludeRetired - If true then the search will include voided DrugsConceptService.getAllDrugs(boolean)@Transactional(readOnly=true) public List<Drug> getDrugsByConcept(Concept concept)
ConceptServicegetDrugsByConcept in interface ConceptServiceConceptService.getDrugsByConcept(org.openmrs.Concept)@Transactional(readOnly=true) public List<Drug> getDrugs(String phrase)
ConceptServicegetDrugs in interface ConceptServicephrase - Search phraseConceptService.getDrugs(java.lang.String)@Transactional(readOnly=true) public List<Concept> getConceptsByClass(ConceptClass cc)
getConceptsByClass in interface ConceptServicecc - ConceptClassConceptService.getConceptsByClass(org.openmrs.ConceptClass)@Transactional(readOnly=true) public List<ConceptClass> getAllConceptClasses(boolean includeRetired)
ConceptServicegetAllConceptClasses in interface ConceptServiceincludeRetired - include retired concept classes in the search results?ConceptService.getAllConceptClasses(boolean)@Transactional(readOnly=true) public ConceptClass getConceptClass(Integer i)
ConceptServicegetConceptClass in interface ConceptServicei - the concept class identifierConceptService.getConceptClass(java.lang.Integer)@Transactional(readOnly=true) public ConceptClass getConceptClassByName(String name)
ConceptServicegetConceptClassByName in interface ConceptServiceConceptService.getConceptClassByName(java.lang.String)@Transactional(readOnly=true) public List<ConceptClass> getAllConceptClasses() throws APIException
ConceptServicegetAllConceptClasses in interface ConceptServiceAPIExceptionConceptService.getAllConceptClasses(boolean)public ConceptClass saveConceptClass(ConceptClass cc) throws APIException
ConceptServicesaveConceptClass in interface ConceptServicecc - ConceptClass to create or updateAPIException - Should save the the given ConceptClassConceptService.saveConceptClass(org.openmrs.ConceptClass)public void purgeConceptClass(ConceptClass cc)
ConceptServicepurgeConceptClass in interface ConceptServicecc - ConceptClass to deleteConceptService.purgeConceptClass(org.openmrs.ConceptClass)public void purgeConceptNameTag(ConceptNameTag cnt)
ConceptServicepurgeConceptNameTag in interface ConceptServicecnt - ConceptNameTag to deleteConceptService.purgeConceptNameTag(org.openmrs.ConceptNameTag)@Transactional(readOnly=true) public List<ConceptDatatype> getAllConceptDatatypes()
ConceptServicegetAllConceptDatatypes in interface ConceptServiceConceptService.getAllConceptDatatypes()@Transactional(readOnly=true) public List<ConceptDatatype> getAllConceptDatatypes(boolean includeRetired) throws APIException
ConceptServicegetAllConceptDatatypes in interface ConceptServiceincludeRetired - boolean - include the retired datatypes?APIExceptionConceptService.getAllConceptDatatypes(boolean)@Transactional(readOnly=true) public ConceptDatatype getConceptDatatype(Integer i)
ConceptServicegetConceptDatatype in interface ConceptServicei - Integer for the requested ConceptDatatypeConceptService.getConceptDatatype(java.lang.Integer)@Transactional(readOnly=true) public ConceptDatatype getConceptDatatypeByName(String name)
ConceptServicegetConceptDatatypeByName in interface ConceptServiceConceptService.getConceptDatatypeByName(java.lang.String)@Transactional(readOnly=true) public List<ConceptSet> getConceptSetsByConcept(Concept concept) throws APIException
ConceptServiceFor example to find all concepts for ARVs, you would do getConceptSets(getConcept("ANTIRETROVIRAL MEDICATIONS")) and then take the conceptIds from the resulting list.
getConceptSetsByConcept in interface ConceptServiceconcept - The concept representing the concept setAPIExceptionConceptService.getConceptSetsByConcept(org.openmrs.Concept)@Transactional(readOnly=true) public List<Concept> getConceptsByConceptSet(Concept c)
ConceptServicegetConceptsByConceptSet in interface ConceptServicec - The concept representing the concept setConceptService.getConceptsByConceptSet(Concept)@Transactional(readOnly=true) public List<ConceptSet> getSetsContainingConcept(Concept concept)
ConceptServicegetSetsContainingConcept in interface ConceptServiceConceptService.getSetsContainingConcept(org.openmrs.Concept)@Transactional(readOnly=true) public ConceptProposal getConceptProposal(Integer conceptProposalId)
ConceptServicegetConceptProposal in interface ConceptServiceconceptProposalId - the Integer concept proposal IdConceptService.getConceptProposal(java.lang.Integer)@Transactional(readOnly=true) public List<ConceptProposal> getAllConceptProposals(boolean includeCompleted)
ConceptServicegetAllConceptProposals in interface ConceptServiceincludeCompleted - boolean - include completed proposals as well?ConceptService.getAllConceptProposals(boolean)@Transactional(readOnly=true) public List<ConceptProposal> getConceptProposals(String cp)
ConceptServicegetConceptProposals in interface ConceptServiceConceptService.getConceptProposals(java.lang.String)@Transactional(readOnly=true) public List<Concept> getProposedConcepts(String text)
ConceptServicegetProposedConcepts in interface ConceptServiceConceptService.getProposedConcepts(java.lang.String)public ConceptProposal saveConceptProposal(ConceptProposal conceptProposal) throws APIException
ConceptServicesaveConceptProposal in interface ConceptServiceconceptProposal - The ConceptProposal to saveAPIExceptionConceptService.saveConceptProposal(org.openmrs.ConceptProposal)public void purgeConceptProposal(ConceptProposal cp) throws APIException
ConceptServicepurgeConceptProposal in interface ConceptServiceAPIException - Should purge the given concept proposalConceptService.purgeConceptProposal(org.openmrs.ConceptProposal)public Concept mapConceptProposalToConcept(ConceptProposal cp, Concept mappedConcept, Locale locale) throws APIException
ConceptServicemapConceptProposalToConcept in interface ConceptServicelocale - of concept proposalAPIException - Should not require mapped concept on reject action
Should allow rejecting proposals
Should throw APIException when mapping to null concept
Should set value coded name when add synonym is selected
Should not set value coded name when add concept is selected
Should fail when adding a duplicate synonymConceptService.mapConceptProposalToConcept(ConceptProposal, Concept, Locale)public Concept mapConceptProposalToConcept(ConceptProposal cp, Concept mappedConcept) throws APIException
ConceptServicemapConceptProposalToConcept in interface ConceptServiceAPIException - Should not require mapped concept on reject action
Should allow rejecting proposals
Should throw APIException when mapping to null conceptConceptService.mapConceptProposalToConcept(org.openmrs.ConceptProposal,
org.openmrs.Concept)@Transactional(readOnly=true) public List<Concept> getConceptsByAnswer(Concept concept) throws APIException
ConceptServicegetConceptsByAnswer in interface ConceptServiceAPIException - Should return an empty list if concept id is nullConceptService.getConceptsByAnswer(org.openmrs.Concept)@Transactional(readOnly=true) public Concept getPrevConcept(Concept c)
ConceptServicegetPrevConcept in interface ConceptServicec - the offset ConceptConceptService.getPrevConcept(org.openmrs.Concept)@Transactional(readOnly=true) public Concept getNextConcept(Concept c)
ConceptServicegetNextConcept in interface ConceptServicec - the offset ConceptConceptService.getNextConcept(org.openmrs.Concept)@Transactional(readOnly=true)
public void checkIfLocked()
throws ConceptsLockedException
ConceptServicecheckIfLocked in interface ConceptServiceConceptsLockedExceptionConceptService.checkIfLocked()@Transactional(readOnly=true) public List<Concept> getConceptsWithDrugsInFormulary()
ConceptServicegetConceptsWithDrugsInFormulary in interface ConceptServiceConceptService.getConceptsWithDrugsInFormulary()@Transactional(readOnly=true) public Integer getMaxConceptId()
ConceptServicegetMaxConceptId in interface ConceptServiceConceptService.getMaxConceptId()@Transactional(readOnly=true) public ConceptNameTag getConceptNameTagByName(String tagName)
ConceptServicegetConceptNameTagByName in interface ConceptServicetagName - String name of ConceptNameTagConceptService.getConceptNameTagByName(java.lang.String)@Transactional(readOnly=true) public Set<Locale> getLocalesOfConceptNames()
ConceptServicegetLocalesOfConceptNames in interface ConceptServiceConceptService.getLocalesOfConceptNames()@Transactional(readOnly=true) public ConceptSource getConceptSource(Integer conceptSourceId)
ConceptServicegetConceptSource in interface ConceptServiceconceptSourceId - Integer conceptSourceIdConceptService.getConceptSource(java.lang.Integer)@Transactional(readOnly=true) public List<ConceptSource> getAllConceptSources(boolean includeRetired)
ConceptServicegetAllConceptSources in interface ConceptServiceincludeRetired - whether or not to include retired sourcesConceptService.getAllConceptSources(boolean)@CacheEvict(value="conceptIdsByMapping",
allEntries=true)
public ConceptSource purgeConceptSource(ConceptSource cs)
throws APIException
ConceptServicepurgeConceptSource in interface ConceptServicecs - ConceptSource object deleteAPIException - Should purge the given concept sourceConceptService.purgeConceptSource(org.openmrs.ConceptSource)public ConceptSource retireConceptSource(ConceptSource cs, String reason) throws APIException
ConceptServiceretireConceptSource in interface ConceptServicecs - the concept source to retirereason - why the concept source is to be retired, must not be empty of nullAPIException - Should retire concept sourceConceptService.retireConceptSource(org.openmrs.ConceptSource, String)@CacheEvict(value="conceptIdsByMapping",
allEntries=true)
public ConceptSource saveConceptSource(ConceptSource conceptSource)
throws APIException
ConceptServicesaveConceptSource in interface ConceptServiceconceptSource - ConceptSource to createAPIException - Should not set creator if one is supplied already
Should not set date created if one is supplied already
Should save a ConceptSource with a null hl7Code
Should not save a ConceptSource if voided is nullConceptService.saveConceptSource(org.openmrs.ConceptSource)public ConceptNameTag saveConceptNameTag(ConceptNameTag nameTag)
ConceptServicesaveConceptNameTag in interface ConceptServicenameTag - the concept name tag to be savedConceptService.saveConceptNameTag(org.openmrs.ConceptNameTag)@Transactional(readOnly=true) public Iterator<Concept> conceptIterator()
ConceptServiceconceptIterator in interface ConceptServiceConceptService.conceptIterator()@Transactional(readOnly=true) public Concept getConceptByUuid(String uuid)
ConceptServicegetConceptByUuid in interface ConceptServiceConceptService.getConceptByUuid(java.lang.String)@Transactional(readOnly=true) public ConceptClass getConceptClassByUuid(String uuid)
ConceptServicegetConceptClassByUuid in interface ConceptServiceConceptService.getConceptClassByUuid(java.lang.String)@Transactional(readOnly=true) public ConceptAnswer getConceptAnswerByUuid(String uuid)
ConceptServicegetConceptAnswerByUuid in interface ConceptService@Transactional(readOnly=true) public ConceptName getConceptNameByUuid(String uuid)
ConceptServicegetConceptNameByUuid in interface ConceptServicepublic ConceptSet getConceptSetByUuid(String uuid)
ConceptServicegetConceptSetByUuid in interface ConceptService@Transactional(readOnly=true) public ConceptSource getConceptSourceByUuid(String uuid)
ConceptServicegetConceptSourceByUuid in interface ConceptService@Transactional(readOnly=true) public ConceptDatatype getConceptDatatypeByUuid(String uuid)
ConceptServicegetConceptDatatypeByUuid in interface ConceptServiceConceptService.getConceptDatatypeByUuid(java.lang.String)@Transactional(readOnly=true) public ConceptNumeric getConceptNumericByUuid(String uuid)
ConceptServicegetConceptNumericByUuid in interface ConceptServiceConceptService.getConceptNumericByUuid(java.lang.String)@Transactional(readOnly=true) public ConceptProposal getConceptProposalByUuid(String uuid)
ConceptServicegetConceptProposalByUuid in interface ConceptServiceConceptService.getConceptProposalByUuid(java.lang.String)@Transactional(readOnly=true) public Drug getDrugByUuid(String uuid)
ConceptServicegetDrugByUuid in interface ConceptServiceConceptService.getDrugByUuid(java.lang.String)@Transactional(readOnly=true) public DrugIngredient getDrugIngredientByUuid(String uuid)
ConceptServicegetDrugIngredientByUuid in interface ConceptServiceuuid - the uuid for the drug ingredient to getConceptService.getDrugIngredientByUuid(java.lang.String)@Transactional(readOnly=true) public ConceptDescription getConceptDescriptionByUuid(String uuid)
ConceptServicegetConceptDescriptionByUuid in interface ConceptServiceConceptService.getConceptDescriptionByUuid(java.lang.String)@Transactional(readOnly=true) public ConceptNameTag getConceptNameTagByUuid(String uuid)
ConceptServicegetConceptNameTagByUuid in interface ConceptServiceConceptService.getConceptNameTagByUuid(java.lang.String)@Transactional(readOnly=true) public List<ConceptNameTag> getAllConceptNameTags()
ConceptServicegetAllConceptNameTags in interface ConceptServiceConceptService.getAllConceptNameTags()@Transactional(readOnly=true) public ConceptNameTag getConceptNameTag(Integer id)
ConceptServiceConceptNameTag with the given database primary keygetConceptNameTag in interface ConceptServiceid - the concept name tag id to findConceptNameTag or null if none foundConceptService.getConceptNameTag(java.lang.Integer)@Transactional(readOnly=true) public Concept getConceptByMapping(String code, String sourceName) throws APIException
ConceptServiceConceptMap This will return the Concept which contains
a ConceptMap entry whose sourceCode is equal to the passed
conceptCode and whose ConceptSource has either a name or
hl7Code that is equal to the passed mappingCode. Delegates to
getConceptByMapping(code,sourceName,includeRetired) with includeRetired=truegetConceptByMapping in interface ConceptServicecode - the code associated with a concept within a given ConceptSourcesourceName - the name or hl7Code of the ConceptSource to checkConcept that has the given mapping, or null if no Concept foundAPIException - Should get concept with given code and and source hl7 code
Should get concept with given code and source name
Should return null if source code does not exist
Should return null if mapping does not existConceptService.getConceptByMapping(java.lang.String, java.lang.String)@Transactional(readOnly=true) public Concept getConceptByMapping(String code, String sourceName, Boolean includeRetired) throws APIException
ConceptServiceConceptMap This will return the Concept which contains
a ConceptMap entry whose sourceCode is equal to the passed
conceptCode and whose ConceptSource has either a name or
hl7Code that is equal to the passed mappingCode . Operates under
the assumption that each mappingCode in a ConceptSource references one and only one
non-retired Concept: if the underlying dao method returns more than one non-retired
concept, this method will throw an exception; if the underlying dao method returns more than
one concept, but only one non-retired concept, this method will return the non-retired
concept; if the dao only returns retired concepts, this method will simply return the first
concept in the list returns by the dao method; retired concepts can be excluded by setting
the includeRetired parameter to false, but the above logic still appliesgetConceptByMapping in interface ConceptServicecode - the code associated with a concept within a given ConceptSourcesourceName - the name or hl7Code of the ConceptSource to checkincludeRetired - whether or not to include retired conceptsConcept that has the given mapping, or null if no Concept foundAPIException - Should get concept with given code and and source hl7 code
Should get concept with given code and source name
Should return null if source code does not exist
Should return null if mapping does not existConceptService.getConceptByMapping(java.lang.String, java.lang.String,
java.lang.Boolean)@Transactional(readOnly=true) public List<Concept> getConceptsByMapping(String code, String sourceName) throws APIException
ConceptServiceConceptMap This will return the list of concepts
Concepts which contain a ConceptMap entry whose sourceCode is
equal to the passed conceptCode and whose ConceptSource has either a
name or hl7Code that is equal to the passed
mappingCodegetConceptsByMapping in interface ConceptServicecode - the code associated with a concept within a given ConceptSourcesourceName - the name or hl7Code of the ConceptSource to checkConcepts that has the given mapping, or null if no
Concept foundAPIException - if the specified source+code maps to more than one concept
Should get concepts with given code and and source hl7 code
Should get concepts with given code and source name
Should return empty list if source code does not exist
Should return empty list if mapping does not exist
Should include retired conceptsConceptService.getConceptsByMapping(java.lang.String, java.lang.String)@Transactional(readOnly=true) public List<Concept> getConceptsByMapping(String code, String sourceName, boolean includeRetired) throws APIException
ConceptServiceConceptMap This will return the list of Concepts which
contain a ConceptMap entry whose sourceCode is equal to the passed
conceptCode and whose ConceptSource has either a name or
hl7Code that is equal to the passed mappingCode. Delegates to
getConceptsByMapping(code,sourceName,includeRetired) with includeRetired=truegetConceptsByMapping in interface ConceptServicecode - the code associated with a concept within a given ConceptSourcesourceName - the name or hl7Code of the ConceptSource to checkincludeRetired - whether or not to include retired conceptsConcepts that has the given mapping, or null if no
Concept foundAPIException - if the specified source+code maps to more than one concept
Should get concepts with given code and and source hl7 code
Should get concepts with given code and source name
Should return empty list if source code does not exist
Should return empty list if mapping does not existConceptService.getConceptsByMapping(java.lang.String, java.lang.String, boolean)@Transactional(readOnly=true) @Cacheable(value="conceptIdsByMapping") public List<Integer> getConceptIdsByMapping(String code, String sourceName, boolean includeRetired) throws APIException
ConceptServiceConceptMap This will return the list of ids for all
Concepts which contain a ConceptMap entry whose sourceCode is
equal to the passed conceptCode and whose ConceptSource has either a
name or hl7Code that is equal to the passed
mappingCodegetConceptIdsByMapping in interface ConceptServicecode - the code associated with a concept within a given ConceptSourcesourceName - the name or hl7Code of the ConceptSource to checkincludeRetired - whether or not to include retired conceptsConcepts that have the given mapping, or an empty List if none foundAPIException - if the specified source+code maps to more than one conceptConceptService.getConceptIdsByMapping(java.lang.String, java.lang.String, boolean)@Transactional(readOnly=true) public Concept getFalseConcept()
ConceptServicegetFalseConcept in interface ConceptServiceConceptService.getFalseConcept()@Transactional(readOnly=true) public Concept getTrueConcept()
ConceptServicegetTrueConcept in interface ConceptServiceConceptService.getTrueConcept()@Transactional(readOnly=true) public Concept getUnknownConcept()
ConceptServicegetUnknownConcept in interface ConceptServiceConceptService.getUnknownConcept()@Transactional(readOnly=true) public ConceptSource getConceptSourceByName(String conceptSourceName) throws APIException
ConceptServicegetConceptSourceByName in interface ConceptServiceAPIException - Should get ConceptSource with the given name
Should return null if no ConceptSource with that name is foundConceptService.getConceptSourceByName(java.lang.String)@Transactional(readOnly=true) public ConceptSource getConceptSourceByUniqueId(String uniqueId) throws APIException
ConceptServicegetConceptSourceByUniqueId in interface ConceptServiceuniqueId - the unique idAPIException - Should get concept source with the given unique id
Should return null if no concept source with given unique id is found
Should return null if given an empty string
Should fail if given nullConceptService.getConceptSourceByUniqueId(java.lang.String)@Transactional(readOnly=true) public ConceptSource getConceptSourceByHL7Code(String hl7Code) throws APIException
ConceptServicegetConceptSourceByHL7Code in interface ConceptServicehl7Code - the hl7CodeAPIException - Should get concept source with the given hl7Code
Should return null if no concept source with given hl7Code is found
Should return null if given an empty string
Should fail if given nullConceptService.getConceptSourceByHL7Code(java.lang.String)@Transactional(readOnly=true) public boolean hasAnyObservation(Concept concept)
ConceptServicehasAnyObservation in interface ConceptServiceconcept - which used or not used by an observationConceptService.hasAnyObservation(org.openmrs.Concept)public void convertBooleanConceptToCoded(Concept conceptToChange) throws APIException
ConceptServiceconvertBooleanConceptToCoded in interface ConceptServiceconceptToChange - the concept which to changeAPIException - Should convert the datatype of a boolean concept to coded
Should fail if the datatype of the concept is not boolean
Should explicitly add true concept as a value_Coded answer
Should explicitly add false concept as a value_Coded answerConceptService.convertBooleanConceptToCoded(org.openmrs.Concept)@Transactional(readOnly=true) public boolean hasAnyObservation(ConceptName conceptName) throws APIException
ConceptServicehasAnyObservation in interface ConceptServiceconceptName - which is used or not used by an observationAPIExceptionConceptService.hasAnyObservation(org.openmrs.ConceptName)@Transactional(readOnly=true) public List<ConceptSearchResult> findConceptAnswers(String phrase, Locale locale, Concept concept) throws APIException
ConceptServicefindConceptAnswers in interface ConceptServiceconcept - the answers to match onAPIException - Should return a list of all matching concept search resultsConceptService.findConceptAnswers(String, Locale, Concept)@Transactional(readOnly=true) public List<String> getConceptStopWords(Locale locale)
ConceptServiceConceptStopWord for given localegetConceptStopWords in interface ConceptServicelocale - The locale in which to search for the ConceptStopWordConceptStopWord if Locale is nullConceptService.getConceptStopWords(java.util.Locale)public ConceptStopWord saveConceptStopWord(ConceptStopWord conceptStopWord) throws APIException
ConceptServiceConceptStopWord in the database
If this is a new concept stop word, the returned concept stop word will have a new
ConceptStopWord.getConceptStopWordId() inserted into it that was
generated by the database
saveConceptStopWord in interface ConceptServiceconceptStopWord - The ConceptStopWord to save or updateConceptStopWord that was saved or updatedAPIException - Should generated concept stop word id onto returned concept stop word
Should save concept stop word into database
Should assign default Locale
Should save concept stop word in uppercase
Should fail if a duplicate conceptStopWord in a locale is addedConceptService.saveConceptStopWord(org.openmrs.ConceptStopWord)public void deleteConceptStopWord(Integer conceptStopWordId) throws APIException
ConceptServiceConceptStopWord in the databasedeleteConceptStopWord in interface ConceptServiceconceptStopWordId - The ConceptStopWord to deleteAPIException - Should delete the given concept stop word from the databaseConceptService.deleteConceptStopWord(Integer)@Transactional(readOnly=true) public List<ConceptStopWord> getAllConceptStopWords()
ConceptServicegetAllConceptStopWords in interface ConceptServiceConceptStopWord
Should return all the concept stop words
Should return empty list if nothing foundConceptService.getAllConceptStopWords()@Transactional(readOnly=true) public List<ConceptSearchResult> getConcepts(String phrase, List<Locale> locales, boolean includeRetired, List<ConceptClass> requireClasses, List<ConceptClass> excludeClasses, List<ConceptDatatype> requireDatatypes, List<ConceptDatatype> excludeDatatypes, Concept answersToConcept, Integer start, Integer size) throws APIException
ConceptServicegetConcepts in interface ConceptServicephrase - matched to the start of any word in any of the names of a concept (if
blank/null, matches all concepts)locales - List<Locale> to restrict toincludeRetired - boolean if false, will exclude retired conceptsrequireClasses - List<ConceptClass> to restrict toexcludeClasses - List<ConceptClass> to leave out of resultsrequireDatatypes - List<ConceptDatatype> to restrict toexcludeDatatypes - List<ConceptDatatype> to leave out of resultsanswersToConcept - all results will be a possible answer to this conceptstart - all results less than this number will be removedsize - if non zero, all results after start + size will be
removedAPIException - Should return concept search results that match unique concepts
Should return a search result whose concept name contains all word tokens as first
Should return a search result for phrase with stop words
Should not return concepts with matching names that are voided
Should return preferred names higher
Should find concept by full codeConceptService.getConcepts(String, List, boolean, List, List, List, List, Concept,
Integer, Integer)public void updateConceptIndex(Concept concept) throws APIException
ConceptServiceConceptService.updateConceptIndexes() if you wish to update the entire concept index.updateConceptIndex in interface ConceptServiceconcept - the concept whose index is to be updatedAPIExceptionConceptService.updateConceptIndex(Concept)@CacheEvict(value="conceptIdsByMapping",
allEntries=true)
public void updateConceptIndexes()
throws APIException
ConceptServiceupdateConceptIndexes in interface ConceptServiceAPIExceptionConceptService.updateConceptIndexes()@Transactional(readOnly=true) public Integer getCountOfConcepts(String phrase, List<Locale> locales, boolean includeRetired, List<ConceptClass> requireClasses, List<ConceptClass> excludeClasses, List<ConceptDatatype> requireDatatypes, List<ConceptDatatype> excludeDatatypes, Concept answersToConcept)
ConceptServicegetCountOfConcepts in interface ConceptServicephrase - matched to the start of any word in any of the names of a conceptlocales - List<Locale> to restrict toincludeRetired - Specifies whether to include retired conceptsrequireClasses - List<ConceptClass> to restrict toexcludeClasses - List<ConceptClass> to leave out of resultsrequireDatatypes - List<ConceptDatatype> to restrict toexcludeDatatypes - List<ConceptDatatype> to leave out of resultsanswersToConcept - all results will be a possible answer to this conceptConceptService.getCountOfConcepts(String, List, boolean, List, List, List, List,
Concept)@Transactional(readOnly=true) public Integer getCountOfDrugs(String drugName, Concept concept, boolean searchOnPhrase, boolean searchDrugConceptNames, boolean includeRetired) throws APIException
ConceptServicegetCountOfDrugs in interface ConceptServicedrugName - the name of the drugconcept - the drug conceptsearchOnPhrase - Specifies if the search should match names starting with or contain the
textsearchDrugConceptNames - Specifies whether a search on concept names for the drug's
concept should be done or notincludeRetired - specifies whether to include retired drugsAPIException - Should return the total number of matching drugsConceptService.getCountOfDrugs(String, Concept, boolean, boolean, boolean)@Transactional(readOnly=true) public List<Drug> getDrugs(String drugName, Concept concept, boolean searchOnPhrase, boolean searchDrugConceptNames, boolean includeRetired, Integer start, Integer length) throws APIException
ConceptServicegetDrugs in interface ConceptServicedrugName - the name of the drugconcept - the drug conceptsearchOnPhrase - (since 1.11) Specifies whether the search should match keywords or just
phrasesearchDrugConceptNames - Specifies whether a search on concept names for the drug's
concept should be done or notincludeRetired - specifies whether to include retired drugsstart - beginning index for the batchlength - number of drugs to return in the batchAPIExceptionConceptService.getDrugs(String, Concept, boolean, boolean, boolean, Integer, Integer)@Transactional(readOnly=true) public List<ConceptSearchResult> getConcepts(String phrase, Locale locale, boolean includeRetired) throws APIException
ConceptServicegetConcepts in interface ConceptServicephrase - the string to search against (if blank/null, matches all concepts)locale - the locale in which to search for the conceptsincludeRetired - Specifies whether to include retired conceptsAPIException - Should give a list of ConceptSearchResult for the matching ConceptsConceptService.getConcepts(String, Locale, boolean)@Transactional(readOnly=true) public List<Drug> getDrugsByIngredient(Concept ingredient) throws APIException
ConceptServicegetDrugsByIngredient in interface ConceptServiceAPIExceptionConceptService.getDrugsByIngredient(org.openmrs.Concept)@Transactional(readOnly=true) public List<ConceptMap> getConceptMappingsToSource(ConceptSource conceptSource) throws APIException
ConceptServicegetConceptMappingsToSource in interface ConceptServiceAPIException - Should return a List of ConceptMaps from the given sourceConceptService.getConceptMappingsToSource(ConceptSource)@Transactional(readOnly=true) public List<ConceptMapType> getActiveConceptMapTypes() throws APIException
ConceptServicegetActiveConceptMapTypes in interface ConceptServiceAPIException - Should return all the concept map types excluding hidden onesConceptService.getActiveConceptMapTypes()@Transactional(readOnly=true) public List<ConceptMapType> getConceptMapTypes(boolean includeRetired, boolean includeHidden) throws APIException
ConceptServicegetConceptMapTypes in interface ConceptServiceincludeRetired - specifies if retired concept map types should be includedAPIException - Should return all the concept map types if includeRetired and hidden are set to true
Should return only un retired concept map types if includeRetired is set to false
Should not include hidden concept map types if includeHidden is set to falseConceptService.getConceptMapTypes(boolean, boolean)@Transactional(readOnly=true) public ConceptMapType getConceptMapType(Integer conceptMapTypeId) throws APIException
ConceptServicegetConceptMapType in interface ConceptServiceconceptMapTypeId - Integer concept map type idAPIExceptionConceptService.getConceptMapType(Integer)@Transactional(readOnly=true) public ConceptMapType getConceptMapTypeByUuid(String uuid) throws APIException
ConceptServicegetConceptMapTypeByUuid in interface ConceptServiceuuid - the uuid to search againstAPIException - Should return a conceptMapType matching the specified uuidConceptService.getConceptMapTypeByUuid(String)@Transactional(readOnly=true) public ConceptMapType getConceptMapTypeByName(String name) throws APIException
ConceptServicegetConceptMapTypeByName in interface ConceptServicename - the name to search againstAPIException - Should return a conceptMapType matching the specified name
Should be case insensitiveConceptService.getConceptMapTypeByName(java.lang.String)public ConceptMapType saveConceptMapType(ConceptMapType conceptMapType) throws APIException
ConceptServicesaveConceptMapType in interface ConceptServiceconceptMapType - the concept map type to saveAPIException - Should add the specified concept map type to the database and assign to it an id
Should update an existing concept map typeConceptService.saveConceptMapType(org.openmrs.ConceptMapType)public ConceptMapType retireConceptMapType(ConceptMapType conceptMapType, String retireReason) throws APIException
ConceptServiceretireConceptMapType in interface ConceptServiceconceptMapType - the concept map type to retireretireReason - the reason why the concept map type is being retiredAPIException - Should retire the specified conceptMapType with the given retire reason
Should should set the default retire reason if none is givenConceptService.retireConceptMapType(org.openmrs.ConceptMapType,
java.lang.String)public ConceptMapType unretireConceptMapType(ConceptMapType conceptMapType) throws APIException
ConceptServiceunretireConceptMapType in interface ConceptServiceconceptMapType - the concept map type to unretireAPIException - Should unretire the specified concept map type and drop all retire related fieldsConceptService.unretireConceptMapType(org.openmrs.ConceptMapType)public void purgeConceptMapType(ConceptMapType conceptMapType) throws APIException
ConceptServicepurgeConceptMapType in interface ConceptServiceconceptMapType - the concept map type to purge from the databaseAPIException - Should delete the specified conceptMapType from the databaseConceptService.purgeConceptMapType(org.openmrs.ConceptMapType)@Transactional(readOnly=true) public List<ConceptReferenceTerm> getAllConceptReferenceTerms() throws APIException
ConceptServicegetAllConceptReferenceTerms in interface ConceptServiceAPIException - Should return all concept reference terms in the databaseConceptService.getAllConceptReferenceTerms()@Transactional(readOnly=true) public List<ConceptReferenceTerm> getConceptReferenceTerms(boolean includeRetired) throws APIException
ConceptServicegetConceptReferenceTerms in interface ConceptServiceincludeRetired - specifies if retired concept reference terms should be includedAPIException - Should return all the concept reference terms if includeRetired is set to true
Should return only un retired concept reference terms if includeRetired is set to falseConceptService.getConceptReferenceTerms(boolean)@Transactional(readOnly=true) public ConceptReferenceTerm getConceptReferenceTerm(Integer conceptReferenceTermId) throws APIException
ConceptServicegetConceptReferenceTerm in interface ConceptServiceconceptReferenceTermId - the concept reference term id to search againstAPIExceptionConceptService.getConceptReferenceTerm(java.lang.Integer)@Transactional(readOnly=true) public ConceptReferenceTerm getConceptReferenceTermByUuid(String uuid) throws APIException
ConceptServicegetConceptReferenceTermByUuid in interface ConceptServiceuuid - the uuid to search againstAPIException - Should return the concept reference term that matches the given uuidConceptService.getConceptReferenceTermByUuid(java.lang.String)@Transactional(readOnly=true) public ConceptReferenceTerm getConceptReferenceTermByName(String name, ConceptSource conceptSource) throws APIException
ConceptServicegetConceptReferenceTermByName in interface ConceptServicename - the name to match againstconceptSource - the concept source to match againstAPIException - Should return a concept reference term that matches the given name from the given source
Should be case insensitive
Should return null if no concept reference term is foundConceptService.getConceptReferenceTermByName(java.lang.String,
org.openmrs.ConceptSource)@Transactional(readOnly=true) public ConceptReferenceTerm getConceptReferenceTermByCode(String code, ConceptSource conceptSource) throws APIException
ConceptServicegetConceptReferenceTermByCode in interface ConceptServicecode - the code to match againstconceptSource - the concept source to match againstAPIException - Should return a concept reference term that matches the given code from the given sourceConceptService.getConceptReferenceTermByCode(java.lang.String,
org.openmrs.ConceptSource)@Transactional(readOnly=true) public List<ConceptReferenceTerm> getConceptReferenceTermByCode(String code, ConceptSource conceptSource, boolean includeRetired) throws APIException
ConceptServicegetConceptReferenceTermByCode in interface ConceptServicecode - the code to match againstconceptSource - the concept source to match againstincludeRetired - specifies if retired concept reference terms should be includedAPIException - Should return a list of concept reference terms that matches the given code from the given source@CacheEvict(value="conceptIdsByMapping",
allEntries=true)
public ConceptReferenceTerm saveConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm)
throws APIException
ConceptServicesaveConceptReferenceTerm in interface ConceptServiceconceptReferenceTerm - the concept reference term object to saveAPIException - Should add a concept reference term to the database and assign an id to it
Should update changes to the concept reference term in the databaseConceptService.saveConceptReferenceTerm(org.openmrs.ConceptReferenceTerm)public ConceptReferenceTerm retireConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm, String retireReason) throws APIException
ConceptServiceretireConceptReferenceTerm in interface ConceptServiceconceptReferenceTerm - the concept reference term object to retireretireReason - the reason why the concept reference term is being retiredAPIException - Should retire the specified concept reference term with the given retire reason
Should should set the default retire reason if none is givenConceptService.retireConceptReferenceTerm(ConceptReferenceTerm, String)public ConceptReferenceTerm unretireConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm) throws APIException
ConceptServiceunretireConceptReferenceTerm in interface ConceptServiceconceptReferenceTerm - the concept reference term to unretireAPIException - Should unretire the specified concept reference term and drop all retire related fieldsConceptService.unretireConceptReferenceTerm(org.openmrs.ConceptReferenceTerm)@CacheEvict(value="conceptIdsByMapping",
allEntries=true)
public void purgeConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm)
throws APIException
ConceptServicepurgeConceptReferenceTerm in interface ConceptServiceconceptReferenceTerm - the concept reference term object to purgeAPIException - Should purge the given concept reference term
Should fail if given concept reference term is in useConceptService.purgeConceptReferenceTerm(org.openmrs.ConceptReferenceTerm)@Transactional(readOnly=true) public List<ConceptReferenceTerm> getConceptReferenceTerms(String query, ConceptSource conceptSource, Integer start, Integer length, boolean includeRetired) throws APIException
ConceptServicegetConceptReferenceTerms in interface ConceptServicequery - the string to match against the reference term names or codesconceptSource - the concept source from which the terms should be looked upstart - beginning index for the batchlength - number of terms to return in the batchincludeRetired - specifies if the retired terms should be includedConceptReferenceTermsAPIException - Should return unique terms with a code or name containing the search phrase
Should return only the concept reference terms from the given concept sourceConceptService.getConceptReferenceTerms(java.lang.String,
org.openmrs.ConceptSource, java.lang.Integer, java.lang.Integer, boolean)@Transactional(readOnly=true) public Integer getCountOfConceptReferenceTerms(String query, ConceptSource conceptSource, boolean includeRetired)
ConceptServicegetCountOfConceptReferenceTerms in interface ConceptServicequery - the string to match against the reference term namesconceptSource - the concept source from which the terms should be looked upincludeRetired - specifies if retired concept reference terms should be includedConceptService.getCountOfConceptReferenceTerms(String, ConceptSource,
boolean)@Transactional(readOnly=true) public List<ConceptReferenceTermMap> getReferenceTermMappingsTo(ConceptReferenceTerm term) throws APIException
ConceptServiceConceptReferenceTermMap where the specified reference term is the
termB i.e mappings added to other terms pointing to itgetReferenceTermMappingsTo in interface ConceptServiceterm - the term to match againstConceptReferenceTermMapsAPIException - Should return all concept reference term maps where the specified term is the termBConceptService.getReferenceTermMappingsTo(ConceptReferenceTerm)@Transactional(readOnly=true) public List<Concept> getConceptsByName(String name, Locale locale, Boolean exactLocale) throws APIException
ConceptServiceThis method is case insensitive. It searches for exactly matching names and close matching locales (if exactLocale = false). It considers only non-voided names and all concepts.
getConceptsByName in interface ConceptServicelocale - null = all localesexactLocale - false if search for both global and country specific,
true if nullAPIExceptionConceptService.getConceptsByName(java.lang.String, java.util.Locale,
java.lang.Boolean)@Transactional(readOnly=true) public ConceptMapType getDefaultConceptMapType() throws APIException
ConceptServiceconcept.defaultConceptMapType global property.getDefaultConceptMapType in interface ConceptServiceConceptMapTypeAPIException - Should return same as by default
Should return type as set in gpConceptService.getDefaultConceptMapType()public boolean isConceptNameDuplicate(ConceptName name)
ConceptServiceConcept name is considered duplicate if it is a default non-retired name for a non-voided concept and there is another name, which is:
isConceptNameDuplicate in interface ConceptServiceConceptService.isConceptNameDuplicate(org.openmrs.ConceptName)@Transactional(readOnly=true) public List<Drug> getDrugs(String searchPhrase, Locale locale, boolean exactLocale, boolean includeRetired) throws APIException
ConceptServicegetDrugs in interface ConceptServicesearchPhrase - The string to match againstlocale - The locale to match against when searching in drug concept namesexactLocale - If false then concepts with names in a broader locale will be matched e.g
in case en_GB is passed in then en will be matchedincludeRetired - Specifies if retired drugs that match should be included or notAPIExceptionConceptService.getDrugs(String, java.util.Locale, boolean, boolean)@Transactional(readOnly=true) public List<Drug> getDrugsByMapping(String code, ConceptSource conceptSource, Collection<ConceptMapType> withAnyOfTheseTypes, boolean includeRetired) throws APIException
ConceptServicegetDrugsByMapping in interface ConceptServicecode - the code the reference term code to match onconceptSource - the concept source on which to match onwithAnyOfTheseTypes - the ConceptMapTypes to match onincludeRetired - specifies if retired drugs should be included or notDrugAPIException - Should get a list of all drugs that match on all the parameter values
Should return retired and non-retired drugs if includeRetired is set to true
Should return empty list if no matches are found
Should match on the code
Should match on the concept source
Should match on the map types
Should fail if no code and concept source and withAnyOfTheseTypes are provided
Should exclude duplicate matches
Should fail if source is nullConceptService.getDrugsByMapping(String, ConceptSource, Collection,
boolean)@Transactional(readOnly=true) public Drug getDrugByMapping(String code, ConceptSource conceptSource, Collection<ConceptMapType> withAnyOfTheseTypesOrOrderOfPreference) throws APIException
ConceptServicegetDrugByMapping in interface ConceptServicecode - the code the reference term code to match onconceptSource - the concept source to match onwithAnyOfTheseTypesOrOrderOfPreference - the ConceptMapTypes to match onDrugAPIException - Should return a drug that matches the code and source
Should return a drug that matches the code and source and the best map type
Should fail if multiple drugs are found matching the best map type
Should return null if no match found
Should fail if no code and concept source and withAnyOfTheseTypes are provided
Should fail if source is nullConceptService.getDrugByMapping(String, org.openmrs.ConceptSource, java.util.Collection)@Transactional(readOnly=true) public List<ConceptSearchResult> getOrderableConcepts(String phrase, List<Locale> locales, boolean includeRetired, Integer start, Integer length)
ConceptServicegetOrderableConcepts in interface ConceptServicephrase - the phrase to match onlocales - list of locales to match onincludeRetired - include retired concepts or notstart - start index of search resultslength - number of concept results to be returnedConceptService.getOrderableConcepts(String, java.util.List, boolean,
Integer, Integer)@Transactional(readOnly=true) public List<ConceptAttributeType> getAllConceptAttributeTypes()
getAllConceptAttributeTypes in interface ConceptServiceConceptAttributeTypesConceptService.getAllConceptAttributeTypes()public ConceptAttributeType saveConceptAttributeType(ConceptAttributeType conceptAttributeType)
ConceptServicesaveConceptAttributeType in interface ConceptServiceConceptService.saveConceptAttributeType(ConceptAttributeType)@Transactional(readOnly=true) public ConceptAttributeType getConceptAttributeType(Integer id)
getConceptAttributeType in interface ConceptServiceConceptAttributeType with the given internal idConceptService.getConceptAttributeType(Integer)@Transactional(readOnly=true) public ConceptAttributeType getConceptAttributeTypeByUuid(String uuid)
getConceptAttributeTypeByUuid in interface ConceptServiceConceptAttributeType with the given uuidConceptService.getConceptAttributeTypeByUuid(String)public void purgeConceptAttributeType(ConceptAttributeType conceptAttributeType)
ConceptServicepurgeConceptAttributeType in interface ConceptServiceConceptService.purgeConceptAttributeType(ConceptAttributeType)@Transactional(readOnly=true) public List<ConceptAttributeType> getConceptAttributeTypes(String name) throws APIException
ConceptServicegetConceptAttributeTypes in interface ConceptServicename - (optional) The name of typeAPIException - Should return concept attribute types performing fuzzy match on given name
Should return empty list when no concept attribute types match given nameConceptService.getConceptAttributeTypes(String)@Transactional(readOnly=true) public ConceptAttributeType getConceptAttributeTypeByName(String exactName)
ConceptServicegetConceptAttributeTypeByName in interface ConceptServiceConceptAttributeType with the specified nameConceptService.getConceptAttributeTypeByName(String)public ConceptAttributeType retireConceptAttributeType(ConceptAttributeType conceptAttributeType, String reason)
ConceptServiceretireConceptAttributeType in interface ConceptServiceconceptAttributeType - the concept attribute type to be retiredreason - for retiring the concept attribute typeConceptService.retireConceptAttributeType(ConceptAttributeType, String)public ConceptAttributeType unretireConceptAttributeType(ConceptAttributeType conceptAttributeType)
ConceptServiceunretireConceptAttributeType in interface ConceptServiceconceptAttributeType - the concept type attribute to unretireConceptService.unretireConceptAttributeType(ConceptAttributeType)@Transactional(readOnly=true) public ConceptAttribute getConceptAttributeByUuid(String uuid)
getConceptAttributeByUuid in interface ConceptServiceConceptAttribute with the given uuidConceptService.getConceptAttributeByUuid(String)@Transactional(readOnly=true) public boolean hasAnyConceptAttribute(ConceptAttributeType conceptAttributeType)
hasAnyConceptAttribute in interface ConceptServiceConceptService.hasAnyConceptAttribute(ConceptAttributeType)public static boolean isValidUuidFormat(String uuid)
Copyright © 2024 OpenMRS Inc.. All rights reserved.