Interim development of a clinical decision making engine.

Engine depends on rules, filters, targets, and actions. Basically,
if a patient fits in the filter, and the target(s) is false, then the
action(s) happens. The current scheme allows one filter
and multiple targets and actions per rule, is very flexible, and supports
internationalization. Engine is used for clinical decision support,
clinical quality measures (CQM) and patient reminders.

FUNCTIONALITY:
1) Clinical Decision Support widget can be found in the top right
   of the patient summary screen.
2) Clinical Reminder widget can be found in bottom left (above vitals
   widget) of the patient summary screen.
3) Clinical Reminder page can be found at Administration->Patient
   Reminders. The batch to send the messages can be run from this script
   by clicking the Send REminder Batch button.
4) CQM report can be found at Reports->Clinic->Quality Measures.

TODO:
1. Finish rules for the 10 CQM rules (will require algorithm adjustments
   to deal with the encounter types and frequencies that are used in the
   CQM rules).
2. Ensure NIST is accomplished for CQM and clinical decision support.
3. Get the email and voice patient reminder mechanisms to work (may ask
   Visolve to help with testing the modified mavix//voice email scripts).
4. Ensure NIST is accomplished for the patient reminders.
5. Add a admin gui to allow per patient customization (note the
   mechanism to do this already exist, so just need a simple gui for it)
6. Add mechanism to allow multiple filters per rule.
7. Add a admin gui to allow rule modification and creation of new rules.
8. Add a mechanism for plans.
Added functionality to check the lists (which contains medications,
  allergies, diagnoses, surgeries, etc.), which means NIST functionality
  is almost done for clinical reminders and clinical decisions (just need to
  add a laboratory check). Also need to do more testing of this feature.
Placed a medication filter (coumadin) and a procedure checking target in the procedure tables (INR).
 Done getting procedures checking algorithm in, however still need to test/debug (currently
   passes all procedure targets, so a mild error somewhere to work out)
 Will convert the database to same mechanism as procedure checking since it's much cleaner.
  (collect another comparison parameter)
The procedure mechanism for filters and targets is now in place and working.
  To demonstrate NIST, put a medication filter (coumadin) that then checks
  for a procedure target (INR lab) with an interval of every 3 weeks.
Clarified database filters/targets algorithm and data objects.
Incorporated a basic appointment reminder mechanism within rules engine.
To be useful will need some fine tuning, though.
Removed a debugging comment.
Added support for the Automatic Measure Calculation MU item.

Specifics:
1) Added support for the Automatic Measure Calculation MU item.
     -Added pertinent columns to the clinical_rules table.
     -Added mechanism to disallow patient specific customization
      in clinical_rules.php since these are standard rules. Also
      included the clinical quality measures in this mechanism.
     -Added a selector for this in the interface/reports/cqm.php
      report
2) Added some comments in sql/database.sql to clarify code.
3) Fixed some miscellaneous comment typos.
CDR module bug fix - user_settings label for patient_reminders_ps_expand fixed
Removed active column from clinical_rules table and:

1) Removed active column from clinical_rules table
    and algorithm in clinical_rules.php
2) To resolve_rules_sql function in clinical_rules.php added
    functionality to grab all per patient configurable
    (ie. not cmq or amc) rules for the admin gui.
Several addition to the rules internals:
1. Entered in skeleton rules for the Autmated Measure Calculations (AMC)
2. Commented the AMC and Clinical Quality Measures (QMC) rules in
    the database.sql files so others could follow the progress.
    (can be found in lines 3514-3635 of sql/database.sql file)
    (Note all teh QMC and AMC rules are just skeletons at this
     point and are NOT functional, but you can still look at the pretty
     report of them in Reports->Clinic->Quality Measures)
3. Plan to work on the QMC/AMC rules one by one and changing the rules
    internals as needed. This will not affect any of the stuff that
    others are working on (admin gui, per patient gui, messenging
    connectors, etc.)
The issue of error coming when magic quotes is on is dealt with.We have coded in such a way that it works, irrespective of the magic quotes settings.

Signed-off-by: Paul Simon <paul@zhservices.com>
Fixing HTML errors in demographics summary page.
Add access to chartable LBF forms from the demographics summary page, and remove that for Vitals if not registered.
Some further cleanup for chartable LBF forms.
Drop duplicated line.

Problem discovered through use of (php -l)
Avoid re-using class name "soapclient".

Issue detected by (php -l).

No uses of "soapclient" class outside of this file were fixed, since they almost certainly ended up using the other "soapclient" class.
Add icd9 and minor fixes to the following:
add_edit_event.php - spelling chg and add xl()
main_screen.php - correct placement of head tag
deleter.php - correct closing tag on cancel button
demographics.php - fix width of second column div background
add_transaction.php - fix location of close form tag
style_default.css - fix widths tabbed column divs and backgounds to percentages
gen_x12_837.inc.php - POS formatting to avoid stripping the leading zero
sql/icd9-codes-insert.sql - add to distro
sql/icd9-codes-replace.sql - add to distro

Signed-off-by: tmccormi <tony@mi-squared.com>
Projects number 2 and 3 (per patient gui) of CDR module:

1) Patient Summary Screen Edit button of Clinical Reminder Widget.
2) Patient Summary Screen Edit button of Patient Reminder Widget.
   (in the Rules tab on this screen)

Unable to use the planned mechanism of dropping patient specific
clinical_rules entries when set to default, because then this
would wipe out other per patient flags. So, instead create a
persistent entry for the patient in clinical_rules, and use
NULL in flags to signify that the default setting should be
used rather than a patient specific setting. This should have
no effects on the Major Admin GUI or other features.

You will note the PAtient Summary Screen Clinical Reminder
Widget Edit button goes to a screen with one tab on it (Rules).
This screen will be future place to hold following tabs:
Main - More details on active/inactive rules and most recent
       associated results.
Plans - A future feature that will hold plan information (for
        exmaple aggregating all DM disease rules and results).
Merge fix for Patch Tracker #3164999