From 82827045d23fa3d5ec04a1cbfa954bcdce2e435d Mon Sep 17 00:00:00 2001 From: vinish Date: Wed, 19 Dec 2012 00:28:56 +0530 Subject: [PATCH] eRx captured and displayed in AMC report, Some changes by brady: -Change token from 'prescription' to 'prescription_erx' -Added some comments Signed-off-by: vinish --- interface/soap_functions/soap_patientfullmedication.php | 2 ++ library/classes/rulesets/Amc/reports/AMC_302d/Numerator.php | 9 ++++++--- library/lists.inc | 10 ++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/interface/soap_functions/soap_patientfullmedication.php b/interface/soap_functions/soap_patientfullmedication.php index fc6f9704c..c99ac99e7 100644 --- a/interface/soap_functions/soap_patientfullmedication.php +++ b/interface/soap_functions/soap_patientfullmedication.php @@ -35,6 +35,7 @@ require_once('../globals.php'); require_once('../eRx_xml.php'); require_once('../../library/xmltoarray_parser_htmlfix.php'); require_once($GLOBALS['fileroot'] . "/library/amc.php"); +require_once("{$GLOBALS['srcdir']}/lists.inc"); set_time_limit(0); function number($str) @@ -155,6 +156,7 @@ for($i=0;$iid,'medication',$endDate) ); - $secondCheck = sqlQuery("SELECT * FROM `lists` WHERE `activity`='1' AND `pid`=? AND `type`=? AND `date`<=?", array($patient->id,'medication',$endDate) ); + // (true if an entry in lists_touch(medication token) or an active entry in lists preceding the date-end) + // (In the lists_touch, theres is also a special case entry to support the NewCropRx module + // since that module also manages medications. These special case entries use the prescription_erx + // token.) + $firstCheck = sqlQuery("SELECT * FROM `lists_touch` WHERE `pid`=? AND (`type`=? OR type=?) AND `date`<=?", array($patient->id,'medication','prescription_erx',$endDate) ); + $secondCheck = sqlQuery("SELECT * FROM `lists` WHERE `activity`='1' AND `pid`=? AND `type`=? AND `date`<=?", array($patient->id,'medication',$endDate) ); if ( !(empty($firstCheck)) || !(empty($secondCheck)) ) { return true; } diff --git a/library/lists.inc b/library/lists.inc index 9a5806bd9..8170a7ea5 100644 --- a/library/lists.inc +++ b/library/lists.inc @@ -1,4 +1,14 @@