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.

...

Note: Due to the way the encounterDate tag works, it should always be placed BEFORE any workflowState tags on a form, to insure that the proper date is used when processing state changes

Note: This tag is intended to be used with encounter dates that have only a date component (not a date and time component).  The tag may not always work in a logical manner when using encounter dates with a time component.

Attributes

  • workflowId:
    • REQUIRED
    • Value: id or uuid of the workflow, or concept map reference to a concept associated with a workflow
  • type
    • Value: "radio", "dropdown", "checkbox", "hidden"
    • Defaults to dropdown. Tells how to render the widget to select a state.
    • In "radio" or "dropdown" mode the widget renders a list of the states in the workflow for selection by radio or dropdown respectively.
      • If the patient is not currently in a state for that workflow, only states flagged as "initial" will appear, otherwise all states will appear
      • (States that appear can be customized by the using the stateIds & stateLabels attributes)
      • If the patient is currently in a state for that workflow, that state will be selected on form load
      • Note that selecting a blank entry from a dropdown will do nothing--it will not take the patient out of his/her current state
    • In "checkbox" mode, upon form submittal, if the checkbox is checked, the patient is transitioned into the state specified by the by "stateId" parameter
      • If the patient is currently in the state specified by "stateId", the checkbox should appear checked
      • Note that unchecking a checkbox will do nothing--it will NOT take the patient out of the state
    • In "hidden" mode, the patient is automatically transitioned into the state specified by the "stateId" parameter (assuming they aren't already in that state)

...

Since programs, workflows, and states are not tied to encounters, and forms and still (generally) modeled around encounters, it is not always obvious exactly how this tag should modify an existing workflow, especially when editing a form.

When entering submitting a new form, the patient is transferred into the selected state on the encounter date associated with entered on the form. Also:

  • If the patient is not enrolled in the program associated with the state, she is enrolled in the program on the encounter date.
  • If the patient

...

  • is currently in another state

...

  • in the workflow on the encounter date, that state is ended on the encounter date.
  • If the patient has been set to be in another state in the workflow after the encounter date, the new state added is ended on the date that this existing state starts. 

When editing an existing form, the logic is more complex:

...