@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
Concept s 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
Concept s 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 Concept s 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, onStartup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onShutdown, onStartup
public void setConceptDAO(ConceptDAO dao)
ConceptService
setConceptDAO
in interface ConceptService
dao
- The data access object to useConceptService.setConceptDAO(org.openmrs.api.db.ConceptDAO)
@CacheEvict(value="conceptIdsByMapping", allEntries=true) public Concept saveConcept(Concept concept) throws APIException
ConceptService
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
saveConcept
in interface ConceptService
concept
- The Concept
or ConceptNumeric
to save or updateConcept
or ConceptNumeric
that was saved or updatedAPIException
ConceptsLockedException
ConceptInUseException
- 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 exist
public Drug saveDrug(Drug drug) throws APIException
ConceptService
Drug
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 ConceptService
drug
- 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
ConceptService
Concept
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 ConceptService
concept
- 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
ConceptService
retireConcept
in interface ConceptService
concept
- The Concept
or ConceptNumeric
to
retirereason
- The retire reasonConcept
or ConceptNumeric
APIException
- 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
ConceptService
retireDrug
in interface ConceptService
drug
- The Drug to retirereason
- The retire reasonAPIException
ConceptService.retireDrug(org.openmrs.Drug, java.lang.String)
public Drug unretireDrug(Drug drug) throws APIException
ConceptService
unretireDrug
in interface ConceptService
drug
- 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
ConceptService
purgeDrug
in interface ConceptService
drug
- The Drug to remove from the systemAPIException
ConceptService.purgeDrug(org.openmrs.Drug)
@Transactional(readOnly=true) public Concept getConcept(Integer conceptId) throws APIException
ConceptService
getConcept
in interface ConceptService
APIException
ConceptService.getConcept(java.lang.Integer)
@Transactional(readOnly=true) public Concept getConceptByReference(String conceptRef)
ConceptService
getConceptByReference
in interface ConceptService
conceptRef
- the concept string identifierConceptService.getConceptByReference(String conceptRef)
@Transactional(readOnly=true) public ConceptName getConceptName(Integer conceptNameId) throws APIException
ConceptService
getConceptName
in interface ConceptService
APIException
ConceptService.getConceptName(java.lang.Integer)
@Transactional(readOnly=true) public ConceptAnswer getConceptAnswer(Integer conceptAnswerId) throws APIException
ConceptService
getConceptAnswer
in interface ConceptService
APIException
ConceptService.getConceptAnswer(java.lang.Integer)
@Transactional(readOnly=true) public Drug getDrug(Integer drugId) throws APIException
ConceptService
getDrug
in interface ConceptService
APIException
ConceptService.getDrug(java.lang.Integer)
@Transactional(readOnly=true) public ConceptNumeric getConceptNumeric(Integer conceptId) throws APIException
ConceptService
getConceptNumeric
in interface ConceptService
conceptId
- The ConceptNumeric idAPIException
ConceptService.getConceptNumeric(java.lang.Integer)
@Transactional(readOnly=true) public ConceptComplex getConceptComplex(Integer conceptId)
ConceptService
getConceptComplex
in interface ConceptService
conceptId
- of the ComplexConceptConceptService.getConceptComplex(java.lang.Integer)
@Transactional(readOnly=true) public List<Concept> getAllConcepts() throws APIException
ConceptService
getAllConcepts
in interface ConceptService
APIException
ConceptService.getAllConcepts()
@Transactional(readOnly=true) public List<Concept> getAllConcepts(String sortBy, boolean asc, boolean includeRetired) throws APIException
ConceptService
getAllConcepts
in interface ConceptService
sortBy
- 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
ConceptService
getConceptsByName
in interface ConceptService
name
- The search stringAPIException
ConceptService.getConceptsByName(java.lang.String)
@Transactional(readOnly=true) public Concept getConceptByName(String name)
ConceptService
getConceptByName
in interface ConceptService
name
- The search stringConceptService.getConceptByName(java.lang.String)
@Transactional(readOnly=true) public Concept getConcept(String conceptIdOrName)
ConceptService
getConcept
in interface ConceptService
ConceptService.getConcept(java.lang.String)
@Transactional(readOnly=true) public Drug getDrug(String drugNameOrId)
ConceptService
getDrug
in interface ConceptService
drugNameOrId
- String name or drugId to match exactly onConceptService.getDrug(java.lang.String)
@Transactional(readOnly=true) public List<Drug> getAllDrugs()
ConceptService
getAllDrugs
in interface ConceptService
ConceptService.getAllDrugs()
@Transactional(readOnly=true) public List<Drug> getAllDrugs(boolean includeRetired)
ConceptService
getAllDrugs
in interface ConceptService
includeRetired
- If true
then the search will include voided DrugsConceptService.getAllDrugs(boolean)
@Transactional(readOnly=true) public List<Drug> getDrugsByConcept(Concept concept)
ConceptService
getDrugsByConcept
in interface ConceptService
ConceptService.getDrugsByConcept(org.openmrs.Concept)
@Transactional(readOnly=true) public List<Drug> getDrugs(String phrase)
ConceptService
getDrugs
in interface ConceptService
phrase
- Search phraseConceptService.getDrugs(java.lang.String)
@Transactional(readOnly=true) public List<Concept> getConceptsByClass(ConceptClass cc)
getConceptsByClass
in interface ConceptService
cc
- ConceptClassConceptService.getConceptsByClass(org.openmrs.ConceptClass)
@Transactional(readOnly=true) public List<ConceptClass> getAllConceptClasses(boolean includeRetired)
ConceptService
getAllConceptClasses
in interface ConceptService
includeRetired
- include retired concept classes in the search results?ConceptService.getAllConceptClasses(boolean)
@Transactional(readOnly=true) public ConceptClass getConceptClass(Integer i)
ConceptService
getConceptClass
in interface ConceptService
i
- the concept class identifierConceptService.getConceptClass(java.lang.Integer)
@Transactional(readOnly=true) public ConceptClass getConceptClassByName(String name)
ConceptService
getConceptClassByName
in interface ConceptService
ConceptService.getConceptClassByName(java.lang.String)
@Transactional(readOnly=true) public List<ConceptClass> getAllConceptClasses() throws APIException
ConceptService
getAllConceptClasses
in interface ConceptService
APIException
ConceptService.getAllConceptClasses(boolean)
public ConceptClass saveConceptClass(ConceptClass cc) throws APIException
ConceptService
saveConceptClass
in interface ConceptService
cc
- ConceptClass to create or updateAPIException
- Should save the the given ConceptClassConceptService.saveConceptClass(org.openmrs.ConceptClass)
public void purgeConceptClass(ConceptClass cc)
ConceptService
purgeConceptClass
in interface ConceptService
cc
- ConceptClass to deleteConceptService.purgeConceptClass(org.openmrs.ConceptClass)
public void purgeConceptNameTag(ConceptNameTag cnt)
ConceptService
purgeConceptNameTag
in interface ConceptService
cnt
- ConceptNameTag to deleteConceptService.purgeConceptNameTag(org.openmrs.ConceptNameTag)
@Transactional(readOnly=true) public List<ConceptDatatype> getAllConceptDatatypes()
ConceptService
getAllConceptDatatypes
in interface ConceptService
ConceptService.getAllConceptDatatypes()
@Transactional(readOnly=true) public List<ConceptDatatype> getAllConceptDatatypes(boolean includeRetired) throws APIException
ConceptService
getAllConceptDatatypes
in interface ConceptService
includeRetired
- boolean - include the retired datatypes?APIException
ConceptService.getAllConceptDatatypes(boolean)
@Transactional(readOnly=true) public ConceptDatatype getConceptDatatype(Integer i)
ConceptService
getConceptDatatype
in interface ConceptService
i
- Integer for the requested ConceptDatatypeConceptService.getConceptDatatype(java.lang.Integer)
@Transactional(readOnly=true) public ConceptDatatype getConceptDatatypeByName(String name)
ConceptService
getConceptDatatypeByName
in interface ConceptService
ConceptService.getConceptDatatypeByName(java.lang.String)
@Transactional(readOnly=true) public List<ConceptSet> getConceptSetsByConcept(Concept concept) throws APIException
ConceptService
For 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 ConceptService
concept
- The concept representing the concept setAPIException
ConceptService.getConceptSetsByConcept(org.openmrs.Concept)
@Transactional(readOnly=true) public List<Concept> getConceptsByConceptSet(Concept c)
ConceptService
getConceptsByConceptSet
in interface ConceptService
c
- The concept representing the concept setConceptService.getConceptsByConceptSet(Concept)
@Transactional(readOnly=true) public List<ConceptSet> getSetsContainingConcept(Concept concept)
ConceptService
getSetsContainingConcept
in interface ConceptService
ConceptService.getSetsContainingConcept(org.openmrs.Concept)
@Transactional(readOnly=true) public ConceptProposal getConceptProposal(Integer conceptProposalId)
ConceptService
getConceptProposal
in interface ConceptService
conceptProposalId
- the Integer concept proposal IdConceptService.getConceptProposal(java.lang.Integer)
@Transactional(readOnly=true) public List<ConceptProposal> getAllConceptProposals(boolean includeCompleted)
ConceptService
getAllConceptProposals
in interface ConceptService
includeCompleted
- boolean - include completed proposals as well?ConceptService.getAllConceptProposals(boolean)
@Transactional(readOnly=true) public List<ConceptProposal> getConceptProposals(String cp)
ConceptService
getConceptProposals
in interface ConceptService
ConceptService.getConceptProposals(java.lang.String)
@Transactional(readOnly=true) public List<Concept> getProposedConcepts(String text)
ConceptService
getProposedConcepts
in interface ConceptService
ConceptService.getProposedConcepts(java.lang.String)
public ConceptProposal saveConceptProposal(ConceptProposal conceptProposal) throws APIException
ConceptService
saveConceptProposal
in interface ConceptService
conceptProposal
- The ConceptProposal to saveAPIException
ConceptService.saveConceptProposal(org.openmrs.ConceptProposal)
public void purgeConceptProposal(ConceptProposal cp) throws APIException
ConceptService
purgeConceptProposal
in interface ConceptService
APIException
- Should purge the given concept proposalConceptService.purgeConceptProposal(org.openmrs.ConceptProposal)
public Concept mapConceptProposalToConcept(ConceptProposal cp, Concept mappedConcept, Locale locale) throws APIException
ConceptService
mapConceptProposalToConcept
in interface ConceptService
locale
- 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
ConceptService
mapConceptProposalToConcept
in interface ConceptService
APIException
- 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
ConceptService
getConceptsByAnswer
in interface ConceptService
APIException
- Should return an empty list if concept id is nullConceptService.getConceptsByAnswer(org.openmrs.Concept)
@Transactional(readOnly=true) public Concept getPrevConcept(Concept c)
ConceptService
getPrevConcept
in interface ConceptService
c
- the offset ConceptConceptService.getPrevConcept(org.openmrs.Concept)
@Transactional(readOnly=true) public Concept getNextConcept(Concept c)
ConceptService
getNextConcept
in interface ConceptService
c
- the offset ConceptConceptService.getNextConcept(org.openmrs.Concept)
@Transactional(readOnly=true) public void checkIfLocked() throws ConceptsLockedException
ConceptService
checkIfLocked
in interface ConceptService
ConceptsLockedException
ConceptService.checkIfLocked()
@Transactional(readOnly=true) public List<Concept> getConceptsWithDrugsInFormulary()
ConceptService
getConceptsWithDrugsInFormulary
in interface ConceptService
ConceptService.getConceptsWithDrugsInFormulary()
@Transactional(readOnly=true) public Integer getMaxConceptId()
ConceptService
getMaxConceptId
in interface ConceptService
ConceptService.getMaxConceptId()
@Transactional(readOnly=true) public ConceptNameTag getConceptNameTagByName(String tagName)
ConceptService
getConceptNameTagByName
in interface ConceptService
tagName
- String name of ConceptNameTagConceptService.getConceptNameTagByName(java.lang.String)
@Transactional(readOnly=true) public Set<Locale> getLocalesOfConceptNames()
ConceptService
getLocalesOfConceptNames
in interface ConceptService
ConceptService.getLocalesOfConceptNames()
@Transactional(readOnly=true) public ConceptSource getConceptSource(Integer conceptSourceId)
ConceptService
getConceptSource
in interface ConceptService
conceptSourceId
- Integer conceptSourceIdConceptService.getConceptSource(java.lang.Integer)
@Transactional(readOnly=true) public List<ConceptSource> getAllConceptSources(boolean includeRetired)
ConceptService
getAllConceptSources
in interface ConceptService
includeRetired
- whether or not to include retired sourcesConceptService.getAllConceptSources(boolean)
@CacheEvict(value="conceptIdsByMapping", allEntries=true) public ConceptSource purgeConceptSource(ConceptSource cs) throws APIException
ConceptService
purgeConceptSource
in interface ConceptService
cs
- ConceptSource object deleteAPIException
- Should purge the given concept sourceConceptService.purgeConceptSource(org.openmrs.ConceptSource)
public ConceptSource retireConceptSource(ConceptSource cs, String reason) throws APIException
ConceptService
retireConceptSource
in interface ConceptService
cs
- 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
ConceptService
saveConceptSource
in interface ConceptService
conceptSource
- 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)
ConceptService
saveConceptNameTag
in interface ConceptService
nameTag
- the concept name tag to be savedConceptService.saveConceptNameTag(org.openmrs.ConceptNameTag)
@Transactional(readOnly=true) public Iterator<Concept> conceptIterator()
ConceptService
conceptIterator
in interface ConceptService
ConceptService.conceptIterator()
@Transactional(readOnly=true) public Concept getConceptByUuid(String uuid)
ConceptService
getConceptByUuid
in interface ConceptService
ConceptService.getConceptByUuid(java.lang.String)
@Transactional(readOnly=true) public ConceptClass getConceptClassByUuid(String uuid)
ConceptService
getConceptClassByUuid
in interface ConceptService
ConceptService.getConceptClassByUuid(java.lang.String)
@Transactional(readOnly=true) public ConceptAnswer getConceptAnswerByUuid(String uuid)
ConceptService
getConceptAnswerByUuid
in interface ConceptService
@Transactional(readOnly=true) public ConceptName getConceptNameByUuid(String uuid)
ConceptService
getConceptNameByUuid
in interface ConceptService
public ConceptSet getConceptSetByUuid(String uuid)
ConceptService
getConceptSetByUuid
in interface ConceptService
@Transactional(readOnly=true) public ConceptSource getConceptSourceByUuid(String uuid)
ConceptService
getConceptSourceByUuid
in interface ConceptService
@Transactional(readOnly=true) public ConceptDatatype getConceptDatatypeByUuid(String uuid)
ConceptService
getConceptDatatypeByUuid
in interface ConceptService
ConceptService.getConceptDatatypeByUuid(java.lang.String)
@Transactional(readOnly=true) public ConceptNumeric getConceptNumericByUuid(String uuid)
ConceptService
getConceptNumericByUuid
in interface ConceptService
ConceptService.getConceptNumericByUuid(java.lang.String)
@Transactional(readOnly=true) public ConceptProposal getConceptProposalByUuid(String uuid)
ConceptService
getConceptProposalByUuid
in interface ConceptService
ConceptService.getConceptProposalByUuid(java.lang.String)
@Transactional(readOnly=true) public Drug getDrugByUuid(String uuid)
ConceptService
getDrugByUuid
in interface ConceptService
ConceptService.getDrugByUuid(java.lang.String)
@Transactional(readOnly=true) public DrugIngredient getDrugIngredientByUuid(String uuid)
ConceptService
getDrugIngredientByUuid
in interface ConceptService
uuid
- the uuid for the drug ingredient to getConceptService.getDrugIngredientByUuid(java.lang.String)
@Transactional(readOnly=true) public ConceptDescription getConceptDescriptionByUuid(String uuid)
ConceptService
getConceptDescriptionByUuid
in interface ConceptService
ConceptService.getConceptDescriptionByUuid(java.lang.String)
@Transactional(readOnly=true) public ConceptNameTag getConceptNameTagByUuid(String uuid)
ConceptService
getConceptNameTagByUuid
in interface ConceptService
ConceptService.getConceptNameTagByUuid(java.lang.String)
@Transactional(readOnly=true) public List<ConceptNameTag> getAllConceptNameTags()
ConceptService
getAllConceptNameTags
in interface ConceptService
ConceptService.getAllConceptNameTags()
@Transactional(readOnly=true) public ConceptNameTag getConceptNameTag(Integer id)
ConceptService
ConceptNameTag
with the given database primary keygetConceptNameTag
in interface ConceptService
id
- 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
ConceptService
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
. Delegates to
getConceptByMapping(code,sourceName,includeRetired) with includeRetired=truegetConceptByMapping
in interface ConceptService
code
- the code associated with a concept within a given ConceptSource
sourceName
- 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
ConceptService
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
. 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 ConceptService
code
- the code associated with a concept within a given ConceptSource
sourceName
- 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
ConceptService
ConceptMap
This will return the list of concepts
Concept
s 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
getConceptsByMapping
in interface ConceptService
code
- the code associated with a concept within a given ConceptSource
sourceName
- the name or hl7Code of the ConceptSource
to checkConcept
s 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
ConceptService
ConceptMap
This will return the list of Concept
s 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 ConceptService
code
- the code associated with a concept within a given ConceptSource
sourceName
- the name or hl7Code of the ConceptSource
to checkincludeRetired
- whether or not to include retired conceptsConcept
s 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
ConceptService
ConceptMap
This will return the list of ids for all
Concept
s 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
getConceptIdsByMapping
in interface ConceptService
code
- the code associated with a concept within a given ConceptSource
sourceName
- the name or hl7Code of the ConceptSource
to checkincludeRetired
- whether or not to include retired conceptsConcept
s 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()
ConceptService
getFalseConcept
in interface ConceptService
ConceptService.getFalseConcept()
@Transactional(readOnly=true) public Concept getTrueConcept()
ConceptService
getTrueConcept
in interface ConceptService
ConceptService.getTrueConcept()
@Transactional(readOnly=true) public Concept getUnknownConcept()
ConceptService
getUnknownConcept
in interface ConceptService
ConceptService.getUnknownConcept()
@Transactional(readOnly=true) public ConceptSource getConceptSourceByName(String conceptSourceName) throws APIException
ConceptService
getConceptSourceByName
in interface ConceptService
APIException
- 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
ConceptService
getConceptSourceByUniqueId
in interface ConceptService
uniqueId
- 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
ConceptService
getConceptSourceByHL7Code
in interface ConceptService
hl7Code
- 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)
ConceptService
hasAnyObservation
in interface ConceptService
concept
- which used or not used by an observationConceptService.hasAnyObservation(org.openmrs.Concept)
public void convertBooleanConceptToCoded(Concept conceptToChange) throws APIException
ConceptService
convertBooleanConceptToCoded
in interface ConceptService
conceptToChange
- 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
ConceptService
hasAnyObservation
in interface ConceptService
conceptName
- which is used or not used by an observationAPIException
ConceptService.hasAnyObservation(org.openmrs.ConceptName)
@Transactional(readOnly=true) public List<ConceptSearchResult> findConceptAnswers(String phrase, Locale locale, Concept concept) throws APIException
ConceptService
findConceptAnswers
in interface ConceptService
concept
- 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)
ConceptService
ConceptStopWord
for given localegetConceptStopWords
in interface ConceptService
locale
- The locale in which to search for the ConceptStopWord
ConceptStopWord
if Locale is nullConceptService.getConceptStopWords(java.util.Locale)
public ConceptStopWord saveConceptStopWord(ConceptStopWord conceptStopWord) throws APIException
ConceptService
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
saveConceptStopWord
in interface ConceptService
conceptStopWord
- 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
ConceptService
ConceptStopWord
in the databasedeleteConceptStopWord
in interface ConceptService
conceptStopWordId
- The ConceptStopWord
to deleteAPIException
- Should delete the given concept stop word from the databaseConceptService.deleteConceptStopWord(Integer)
@Transactional(readOnly=true) public List<ConceptStopWord> getAllConceptStopWords()
ConceptService
getAllConceptStopWords
in interface ConceptService
ConceptStopWord
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
ConceptService
getConcepts
in interface ConceptService
phrase
- 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
ConceptService
ConceptService.updateConceptIndexes()
if you wish to update the entire concept index.updateConceptIndex
in interface ConceptService
concept
- the concept whose index is to be updatedAPIException
ConceptService.updateConceptIndex(Concept)
@CacheEvict(value="conceptIdsByMapping", allEntries=true) public void updateConceptIndexes() throws APIException
ConceptService
updateConceptIndexes
in interface ConceptService
APIException
ConceptService.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)
ConceptService
getCountOfConcepts
in interface ConceptService
phrase
- 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
ConceptService
getCountOfDrugs
in interface ConceptService
drugName
- 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
ConceptService
getDrugs
in interface ConceptService
drugName
- 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 batchAPIException
ConceptService.getDrugs(String, Concept, boolean, boolean, boolean, Integer, Integer)
@Transactional(readOnly=true) public List<ConceptSearchResult> getConcepts(String phrase, Locale locale, boolean includeRetired) throws APIException
ConceptService
getConcepts
in interface ConceptService
phrase
- 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
ConceptService
getDrugsByIngredient
in interface ConceptService
APIException
ConceptService.getDrugsByIngredient(org.openmrs.Concept)
@Transactional(readOnly=true) public List<ConceptMap> getConceptMappingsToSource(ConceptSource conceptSource) throws APIException
ConceptService
getConceptMappingsToSource
in interface ConceptService
APIException
- Should return a List of ConceptMaps from the given sourceConceptService.getConceptMappingsToSource(ConceptSource)
@Transactional(readOnly=true) public List<ConceptMapType> getActiveConceptMapTypes() throws APIException
ConceptService
getActiveConceptMapTypes
in interface ConceptService
APIException
- Should return all the concept map types excluding hidden onesConceptService.getActiveConceptMapTypes()
@Transactional(readOnly=true) public List<ConceptMapType> getConceptMapTypes(boolean includeRetired, boolean includeHidden) throws APIException
ConceptService
getConceptMapTypes
in interface ConceptService
includeRetired
- 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
ConceptService
getConceptMapType
in interface ConceptService
conceptMapTypeId
- Integer concept map type idAPIException
ConceptService.getConceptMapType(Integer)
@Transactional(readOnly=true) public ConceptMapType getConceptMapTypeByUuid(String uuid) throws APIException
ConceptService
getConceptMapTypeByUuid
in interface ConceptService
uuid
- 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
ConceptService
getConceptMapTypeByName
in interface ConceptService
name
- 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
ConceptService
saveConceptMapType
in interface ConceptService
conceptMapType
- 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
ConceptService
retireConceptMapType
in interface ConceptService
conceptMapType
- 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
ConceptService
unretireConceptMapType
in interface ConceptService
conceptMapType
- 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
ConceptService
purgeConceptMapType
in interface ConceptService
conceptMapType
- 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
ConceptService
getAllConceptReferenceTerms
in interface ConceptService
APIException
- Should return all concept reference terms in the databaseConceptService.getAllConceptReferenceTerms()
@Transactional(readOnly=true) public List<ConceptReferenceTerm> getConceptReferenceTerms(boolean includeRetired) throws APIException
ConceptService
getConceptReferenceTerms
in interface ConceptService
includeRetired
- 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
ConceptService
getConceptReferenceTerm
in interface ConceptService
conceptReferenceTermId
- the concept reference term id to search againstAPIException
ConceptService.getConceptReferenceTerm(java.lang.Integer)
@Transactional(readOnly=true) public ConceptReferenceTerm getConceptReferenceTermByUuid(String uuid) throws APIException
ConceptService
getConceptReferenceTermByUuid
in interface ConceptService
uuid
- 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
ConceptService
getConceptReferenceTermByName
in interface ConceptService
name
- 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
ConceptService
getConceptReferenceTermByCode
in interface ConceptService
code
- 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
ConceptService
getConceptReferenceTermByCode
in interface ConceptService
code
- 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
ConceptService
saveConceptReferenceTerm
in interface ConceptService
conceptReferenceTerm
- 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
ConceptService
retireConceptReferenceTerm
in interface ConceptService
conceptReferenceTerm
- 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
ConceptService
unretireConceptReferenceTerm
in interface ConceptService
conceptReferenceTerm
- 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
ConceptService
purgeConceptReferenceTerm
in interface ConceptService
conceptReferenceTerm
- 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
ConceptService
getConceptReferenceTerms
in interface ConceptService
query
- 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 includedConceptReferenceTerm
sAPIException
- 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)
ConceptService
getCountOfConceptReferenceTerms
in interface ConceptService
query
- 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
ConceptService
ConceptReferenceTermMap
where the specified reference term is the
termB i.e mappings added to other terms pointing to itgetReferenceTermMappingsTo
in interface ConceptService
term
- the term to match againstConceptReferenceTermMap
sAPIException
- 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
ConceptService
This 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 ConceptService
locale
- null
= all localesexactLocale
- false
if search for both global and country specific,
true
if null
APIException
ConceptService.getConceptsByName(java.lang.String, java.util.Locale,
java.lang.Boolean)
@Transactional(readOnly=true) public ConceptMapType getDefaultConceptMapType() throws APIException
ConceptService
concept.defaultConceptMapType
global property.getDefaultConceptMapType
in interface ConceptService
ConceptMapType
APIException
- Should return same as by default
Should return type as set in gpConceptService.getDefaultConceptMapType()
public boolean isConceptNameDuplicate(ConceptName name)
ConceptService
Concept 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 ConceptService
ConceptService.isConceptNameDuplicate(org.openmrs.ConceptName)
@Transactional(readOnly=true) public List<Drug> getDrugs(String searchPhrase, Locale locale, boolean exactLocale, boolean includeRetired) throws APIException
ConceptService
getDrugs
in interface ConceptService
searchPhrase
- 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 notAPIException
ConceptService.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
ConceptService
getDrugsByMapping
in interface ConceptService
code
- 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 notDrug
APIException
- 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
ConceptService
getDrugByMapping
in interface ConceptService
code
- the code the reference term code to match onconceptSource
- the concept source to match onwithAnyOfTheseTypesOrOrderOfPreference
- the ConceptMapTypes to match onDrug
APIException
- 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)
ConceptService
getOrderableConcepts
in interface ConceptService
phrase
- 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 ConceptService
ConceptAttributeType
sConceptService.getAllConceptAttributeTypes()
public ConceptAttributeType saveConceptAttributeType(ConceptAttributeType conceptAttributeType)
ConceptService
saveConceptAttributeType
in interface ConceptService
ConceptService.saveConceptAttributeType(ConceptAttributeType)
@Transactional(readOnly=true) public ConceptAttributeType getConceptAttributeType(Integer id)
getConceptAttributeType
in interface ConceptService
ConceptAttributeType
with the given internal idConceptService.getConceptAttributeType(Integer)
@Transactional(readOnly=true) public ConceptAttributeType getConceptAttributeTypeByUuid(String uuid)
getConceptAttributeTypeByUuid
in interface ConceptService
ConceptAttributeType
with the given uuidConceptService.getConceptAttributeTypeByUuid(String)
public void purgeConceptAttributeType(ConceptAttributeType conceptAttributeType)
ConceptService
purgeConceptAttributeType
in interface ConceptService
ConceptService.purgeConceptAttributeType(ConceptAttributeType)
@Transactional(readOnly=true) public List<ConceptAttributeType> getConceptAttributeTypes(String name) throws APIException
ConceptService
getConceptAttributeTypes
in interface ConceptService
name
- (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)
ConceptService
getConceptAttributeTypeByName
in interface ConceptService
ConceptAttributeType
with the specified nameConceptService.getConceptAttributeTypeByName(String)
public ConceptAttributeType retireConceptAttributeType(ConceptAttributeType conceptAttributeType, String reason)
ConceptService
retireConceptAttributeType
in interface ConceptService
conceptAttributeType
- the concept attribute type to be retiredreason
- for retiring the concept attribute typeConceptService.retireConceptAttributeType(ConceptAttributeType, String)
public ConceptAttributeType unretireConceptAttributeType(ConceptAttributeType conceptAttributeType)
ConceptService
unretireConceptAttributeType
in interface ConceptService
conceptAttributeType
- the concept type attribute to unretireConceptService.unretireConceptAttributeType(ConceptAttributeType)
@Transactional(readOnly=true) public ConceptAttribute getConceptAttributeByUuid(String uuid)
getConceptAttributeByUuid
in interface ConceptService
ConceptAttribute
with the given uuidConceptService.getConceptAttributeByUuid(String)
@Transactional(readOnly=true) public boolean hasAnyConceptAttribute(ConceptAttributeType conceptAttributeType)
hasAnyConceptAttribute
in interface ConceptService
ConceptService.hasAnyConceptAttribute(ConceptAttributeType)
public static boolean isValidUuidFormat(String uuid)
Copyright © 2024 OpenMRS Inc.. All rights reserved.