Improved State machinery

Background

We created the program_workflow machinery as a simple state machine to track patients through states in studies & treatment programs.  A general state machine would be more widely useful by OpenMRS. If done, this would be an opportunity to improve

Design

TBD