From 6c86c39833d918ea82b458fe0afad24b6b1c4eea Mon Sep 17 00:00:00 2001 From: vinish Date: Wed, 12 Oct 2011 11:29:50 +0530 Subject: [PATCH] erx fix 4 Signed-off-by: vinish --- interface/eRx.php | 43 +++++++++++-- interface/eRx_xml.php | 72 ++++++++++++++++------ interface/patient_file/summary/add_edit_issue.php | 3 +- interface/patient_file/summary/stats.php | 9 ++- interface/patient_file/summary/stats_full.php | 13 ++-- interface/soap_functions/soap_allergy.php | 51 +++++++++++++-- .../soap_functions/soap_patientfullmedication.php | 18 ++++-- templates/prescription/general_list.html | 10 ++- 8 files changed, 174 insertions(+), 45 deletions(-) diff --git a/interface/eRx.php b/interface/eRx.php index e5ddf5848..b40b538a4 100644 --- a/interface/eRx.php +++ b/interface/eRx.php @@ -36,6 +36,8 @@ require('eRx_xml.php'); $userRole=sqlQuery("select * from users where username=?",array($_SESSION['authUser'])); $userRole['newcrop_user_role'] = preg_replace('/erx/','',$userRole['newcrop_user_role']); $msg=''; +$warning_msg=''; +$dem_check=''; $doc = new DOMDocument(); $doc->formatOutput = true; $GLOBALS['total_count']=60; @@ -73,7 +75,7 @@ if($userRole['newcrop_user_role']=='midlevelPrescriber') $prescIds=''; if($pid) { - Patient($doc,$r,$pid); + $allergy=Patient($doc,$r,$pid); $active = ''; if($GLOBALS['erx_upload_active']==1) $active = 'and active=1'; @@ -102,19 +104,40 @@ if($pid) OutsidePrescription($doc,$r,$pid,0); } if($res_presc<$GLOBALS['total_count']) - PatientMedication($doc,$r,$pid,$med_limit); + $uploaded_med_arr =PatientMedication($doc,$r,$pid,$med_limit); } $xml = $doc->saveXML(); $xml = preg_replace('/"/',"'",$xml); //echo $xml."

"; -$xml = stripStrings($xml,array(' '=>'','\t'=>'','\r'=>'','\n'=>'')); +$xml = stripStrings($xml,array(' '=>'','\t'=>'')); +//$xml = stripStrings($xml,array(' '=>'','\t'=>'','\r'=>'','\n'=>'')); +if($dem_check){ + echo "".htmlspecialchars( xl("Warning:"), ENT_NOQUOTES)."

"; + echo $dem_check."
"; + echo htmlspecialchars( xl("The page will be redirected to Demographics. You can edit the country field and clickthrough to NewCrop again."), ENT_NOQUOTES); + ob_end_flush(); + ?> + + "; - echo $msg; + echo $msg; die; } +if($warning_msg) +{ + echo "".htmlspecialchars( xl("Warning : "), ENT_NOQUOTES)."
".$warning_msg; + echo "
".htmlspecialchars( xl('This will not prevent you from going to the e-Prescriptions site.'), ENT_NOQUOTES).""; + sleep(2); +} //################################################ //XML GENERATED BY OPENEMR //################################################ @@ -136,11 +159,21 @@ if($error==0) elseif($page=='medentry'){ sqlQuery("update patient_data set soap_import_status=3 where pid=?",array($pid)); } + foreach($allergy as $allId) + { + sqlQuery("update lists set erx_uploaded='1' where type='allergy' and pid=? and id=?",array($pid,$allId)); + } $prescArr=explode(':',$prescIds); foreach($prescArr as $prescid) { - sqlQuery("update prescriptions set erx_uploaded='1', active='0' where patient_id=? and id=?",array($pid,$prescid)); + sqlQuery("update prescriptions set erx_uploaded='1' ,active='0' where patient_id=? and id=?",array($pid,$prescid)); } + foreach($uploaded_med_arr as $value) + { + sqlQuery("update lists set erx_uploaded='1' where id=?",array($value)); + //sqlQuery("update lists set enddate=".date('Y-m-d')." where + //(enddate is null or enddate = '' ) and id=? ",array($value)); + } ?>