Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Lookup for concept


  • patient: the patient object you're entering the form for
  • user: the current authenticated user (added in HFE 1.9)
  • locale: the authenticated user's locale
  • patientIdentifiers: Map<String, List<String>> of -> all identifiers of that type
  • personAttributes: Map<String, Object> of -> the (hydrated) current attribute value
    • since HTML Form Entry 1.7 the name has any single quotes removed, so "Mother's Name" will become "Mothers Name"
  • relationshipList: List<Relationship> of all relationships that the subject of the form belongs to
  • relationshipMap: Map<String, List<Person>> of either RelationshipType.aIsToB or RelationshipType.bIsToA -> all persons with that relationship to the subject
  • form: the HtmlForm currently in use
  • encounter: the Encounter currently being viewed/edited. (only set in view/edit mode)
  • concept: the Concept object of given concept ID passed as parameter

Additionally (since 1.7.0) there are some functions available to you that allow you to access existing patient data:


  • fn.latestEncounter()
    • returns the patient's latest encounter
    • since 1.7.4
    • Example

      Code Block
      Latest MDR-TB Encounter: <lookup expression="fn.latestEncounter(2)"/>
  • fn.latestEncounter(EncounterType type)
    • returns the patient's latest encounter for the given encounter type id
    • since 1.7.4
    • Example

      Code Block
      First MDR-TB Encounter: <lookup expression="fn.latestEncounter(2)"/>
  • fn.patientAgeInDays()
    • returns the patient's age in days, that is the number of days between patient's birthdate and current date (not the encounter date)
    • since 1.10.0
    • Example

      Code Block
      Patient's Age in Days: <lookup expression="fn.patientAgeInDays()"/>
  • fn.patientAgeInMonths()
    • returns the patient's age in months, that is the number of months between patient's birth month and current date (not the encounter date)
    • since 1.10.0
    • Example

      Code Block
      Patient's Age in Months: <lookup expression="fn.patientAgeInMonths()"/>
  • fn.getConcept(String conceptId)
    • returns the concept object for given concept ID, the ID should be passed as a string, i.e. in quotes
    • since 2.2.0
    • Example

      Code Block
      Concept: <lookup expression="fn.getConcept('110')"/>


  • complexExpression
    • Example: <lookup complexExpression="#foreach( $addr in $patient.addresses ) $!addr.cityVillage <br/> #end"/>
    • Value: Valid complex velocity expression
    • Default: None
  • class
    • Example: <lookup class="value" ... />
    • Value: Valid velocity class
    • Default: None
  • expression
    • Example: <lookup expression="patient.personName"/>
    • Value: Valid velocity expression
    • Default: None


Code Block
<lookup expression="patient.personName"/> this will translate to the velocity expression $\!{patient.personName}
<lookup expression="patient.personName.givenName"/>
<lookup expression="patient.personName.familyName"/>
<lookup expression="patient.getPatientIdentifier(5)"/> this will get the patient's first identifier with Identifier Type Id of 5
<lookup expression="patient.birthdate"/>
<lookup expression="patient.age"/>
<lookup expression="patient.gender" codePrefix="gender_"/>
<lookup complexExpression="#foreach( $addr in $patient.addresses ) $\!addr.cityVillage <br/> #end"/>
<lookup class="value" .../>   this will produce <span>result of expression</span>
<lookup expression="personAttributes.get('Tribe')"/> this will get the patient's 'Tribe' person attribute
<lookup expression="patient.personAddress.address1"/> this will get the address1 field of the patient's preferred address
<lookup expression="patient.personAddress.cityVillage"/> this will get the city field of the patient's preferred address
<lookup expression="fn.getConcept('110').description"/> returns description of concept ID 21. Ticket # 478
<lookup complexExpression="#foreach ( $relationship in $relationshipList )
    #if( $relationship.relationshipType.bIsToA == 'Parent' )
          #if( !($relationship.personB.patientId == $patient.patientId ))
             #if( $relationship.personB.gender == 'F' )
#end "/> this will get the patient's mother's name
<lookup complexExpression="
&#60;img src=&#34;${patient.getPatientIdentifier(1)}&#34;/&#62;
" /> this loads a dynamic image (This requires the us of ASCII character codes because the quote and less-than symbols are illegal.)
<lookup complexExpression="$fn.latestObs(6527)"/> this shows the concept name of the latest coded value for concept # 6527.


Define macros at the top of the file (e.g. for things like colors).