Exemplo n.º 1
0
 function get_list($query)
 {
     $page = RxList::getPage($query);
     $tokens = RxList::parse2tokens($page);
     $hash = RxList::tokens2hash($tokens);
     foreach ($hash as $index => $data) {
         unset($my_data);
         foreach ($data as $k => $v) {
             $my_data[$k] = $v;
         }
         $list[trim($my_data[brand_name]) . " (" . trim($my_data[generic_name]) . ")"] = trim($my_data[brand_name]);
     }
     return $list;
 }
 function do_lookup()
 {
     if ($_POST['process'] != "true") {
         // don't do a lookup
         $this->assign("drug", $_GET['drug']);
         return;
     }
     // process the lookup
     $this->assign("drug", $_POST['drug']);
     $list = array();
     if (!empty($_POST['drug'])) {
         $list = @RxList::get_list($_POST['drug']);
     }
     if (is_array($list)) {
         $list = array_flip($list);
         $this->assign("drug_options", $list);
         $this->assign("drug_values", array_keys($list));
     } else {
         $this->assign("NO_RESULTS", "No results found for: " . $_POST['drug'] . "<br />");
     }
     //print_r($_POST);
     //$this->assign("PROCESS","");
     $_POST['process'] = "";
 }
Exemplo n.º 3
0
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://opensource.org/licenses/gpl-3.0.html>;.
 *
 * @package OpenEMR
 * @author  Karl Englund <*****@*****.**>
 * @link    http://www.open-emr.org
 */
header("Content-Type:text/xml");
$ignoreAuth = true;
require_once 'classes.php';
require_once "{$srcdir}/classes/RXList.class.php";
$xml_string = "";
$xml_string = "<list>";
$token = $_POST['token'];
$query = $_POST['name'];
$drugList = new RxList();
$result = $drugList->get_list($query);
if ($userId = validateToken($token)) {
    $user = getUsername($userId);
    $acl_allow = acl_check('admin', 'super', $user);
    if ($acl_allow) {
        if (!empty($result)) {
            $xml_string .= "<status>0</status>\n";
            $xml_string .= "<reason>Success processing drugs list records</reason>\n";
            foreach ($result as $rows) {
                $xml_string .= "<drug>" . $rows . "</drug>";
            }
        } else {
            $xml_string .= "<status>-1</status>";
            $xml_string .= "<reason>Could not find results</reason>";
        }