From 43694fd3a580bf4425624737a54454a1e7923dd0 Mon Sep 17 00:00:00 2001 From: Sherwin Gaddis Date: Mon, 3 Oct 2016 00:57:40 -0400 Subject: [PATCH] Feature to add drug-drug interaction checking for the some integration work by bradymiller --- interface/patient_file/summary/rx_left.php | 77 +++++++++++++++++-------- interface/weno/drug-drug.php | 92 ++++++++++++++++++++++++++++++ library/globals.inc.php | 6 ++ version.php | 2 +- 4 files changed, 152 insertions(+), 25 deletions(-) rewrite interface/patient_file/summary/rx_left.php (69%) create mode 100644 interface/weno/drug-drug.php diff --git a/interface/patient_file/summary/rx_left.php b/interface/patient_file/summary/rx_left.php dissimilarity index 69% index 4e863cde7..51bd4dc53 100644 --- a/interface/patient_file/summary/rx_left.php +++ b/interface/patient_file/summary/rx_left.php @@ -1,24 +1,53 @@ - - - - - - - - - - - - - -
- - - - -
- - - + + * + * LICENSE: This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see ;. + * + * @package OpenEMR + * @author Sherwin Gaddis + * @link http://www.open-emr.org + */ + +$fake_register_globals=false; +$sanitize_all_escapes=true; +require_once("../../globals.php"); +?> + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + diff --git a/interface/weno/drug-drug.php b/interface/weno/drug-drug.php new file mode 100644 index 000000000..d763b9c04 --- /dev/null +++ b/interface/weno/drug-drug.php @@ -0,0 +1,92 @@ + + * + * LICENSE: This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see ;. + * + * @package OpenEMR + * @author Sherwin Gaddis + * @link http://www.open-emr.org + */ + +$fake_register_globals=false; +$sanitize_all_escapes=true; +require_once("../globals.php"); + +/* +* check to see if RxNorm installed +*/ +$rxn = sqlQuery("SELECT table_name FROM information_schema.tables WHERE table_name = 'RXNCONSO' OR table_name = 'rxnconso'"); +if($rxn == false){ + die(xlt("Could not find RxNorm Table! Please install.")); +} +/* +* Grab medication list from prescriptions list +* load into array +*/ +$medList = sqlStatement("SELECT drug FROM prescriptions WHERE active = 1 AND patient_id = ?", array($pid)); +$nameList = array(); +while($name = sqlFetchArray($medList)){ + $drug = explode(" ", $name['drug']); + $rXn = sqlQuery("SELECT `rxcui` FROM `" . mitigateSqlTableUpperCase('RXNCONSO') . "` WHERE `str` LIKE ?", array("%" . $drug[0] . "%")); + $nameList[] = $rXn['rxcui']; +} +/* +* make sure there are drugs to compare +*/ +if (count($nameList) < 2) { + echo xlt("Need more than one drug."); + exit; +} + +/* +* If there are drugs to compare, collect the data +* +*/ +$rxcui_list = implode("+",$nameList); +$data = file_get_contents("https://rxnav.nlm.nih.gov/REST/interaction/list.json?rxcuis=".$rxcui_list); + +/* +* Content from NLM returned +* +*/ +$json = json_decode($data, true); + +?> + + + + + + + +

+ "; + print xlt('Drug1 Name{{Drug1 Interaction}}').":".text($item['minConcept'][0]['name'])."
"; + print xlt('Drug2 Name{{Drug2 Interaction}}').":".text($item['minConcept'][1]['name'])."
"; + print xlt('Severity').":". text($item['interactionPair'][0]['severity'])."
"; + print xlt('Description').":". text($item['interactionPair'][0]['description'])."

"; + } + } else { + echo xlt('No interactions found'); + } + ?> + + \ No newline at end of file diff --git a/library/globals.inc.php b/library/globals.inc.php index e9a3f7a5e..ecc682792 100644 --- a/library/globals.inc.php +++ b/library/globals.inc.php @@ -2457,6 +2457,12 @@ $GLOBALS_METADATA = array( '0', xl('Rx Show State Lic. #') ), + 'rx_show_drug-drug' => array( + xl('Rx NLM Drug-Drug'), + 'bool', // data type + '0', + xl('Rx NLM Drug-Drug') + ), 'rx_paper_size' => array( xl('Rx Paper Size'), // descriptive name array( diff --git a/version.php b/version.php index 59d1278a3..ec1c3976c 100644 --- a/version.php +++ b/version.php @@ -17,7 +17,7 @@ $v_realpatch = '0'; // is a database change in the course of development. It is used // internally to determine when a database upgrade is needed. // -$v_database = 197; +$v_database = 198; // Access control version identifier, this is to be incremented whenever there // is a access control change in the course of development. It is used -- 2.11.4.GIT