Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added another example

...

  • fn.logic(String logicExpression)
    • evaluates a logic expression, and returns an org.openmrs.logic.Result
    • since 1.7.0
    • Example

      Code Block
      Latest BMI: <lookup expression="fn.logic('BMI')"/> <!-- requires that you have a BMI rule registered -->
      
  • fn.allObs(String conceptIdOrUuidOrMapping)
    • returns all the patient's observations for the given concept, as a List<Obs>
    • since 1.7.0
    • Example

      Code Block
      Past CD4 results: <lookup complexExpression="#foreach($cd4 in $fn.allObs(5497)) $cd4.valueNumeric #end"/>
      
  • fn.latestObs(String conceptIdOrUuidOrMapping)
    • returns the patient's most recent observation for the given concept (most recent ever and not in relation to this encounter's date)
    • since 1.7.0
    • Example

      Code Block
      Last Weight: <lookup expression="fn.latestObs('CIEL:5089').valueNumeric"/>
      Date of Last Weight: <lookup expression="fn.latestObs('CIEL:5089').obsDatetime"/>
      
      Last BMI: <lookup complexExpression="#set( $wt = $fn.latestObs('5089') ) #set( $ht = $fn.latestObs('5090') ) #set( $bmi = $wt / ($ht * $ht) ) $!{bmi}"/>
      
  • fn.earliestObs(String conceptIdOrUuidOrMapping)
    • returns the patient's earliest observation for the given concept
    • since 1.7.0
    • Example

      Code Block
      First Weight: <lookup expression="fn.earliestObs(5089)"/>
      
  • fn.allEncounters(EncounterType type)
    • returns all the patient's encounters for the given encounter type ( or all the patient's encounters if given a null parameter), as a List<Encounter>
    • EncounterType type is the UUID of the desired encounter type
    • since 1.7.4
    • Example

      Code Block
      Past Encounter Dates: <lookup complexExpression="#foreach($encounter in $fn.allEncounters(null)) $encounter.encounterDatetime #end"/>
      
      Encounter ID's for Type ee95dbbf-5aec-4eaf-85e3-87cfad31bfa6: <lookup complexExpression="#foreach($encounter in $fn.allEncounters(ee95dbbf-5aec-4eaf-85e3-87cfad31bfa6)) $encounter.encounterId #end"/>

...