Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New erx 6 #1017

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,3 +1,4 @@
/vendor/**/.git
/logs
.env
.env
/.idea/*
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -73,7 +73,8 @@
"OpenEMR\\Menu\\": "library/menu/src",
"OpenEMR\\Calendar\\": "library/calendar/src",
"OpenEMR\\Sample\\": "library/sample/src",
"OpenEMR\\Reminder\\": "library/reminder/src"
"OpenEMR\\Reminder\\": "library/reminder/src",
"OpenEMR\\Rx\\Weno\\": "library/weno/src"
}
},
"config": {
Expand Down
38,083 changes: 38,083 additions & 0 deletions contrib/weno/drugspaidinsert.sql

Large diffs are not rendered by default.

570 changes: 570 additions & 0 deletions contrib/weno/narc.sql

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions contrib/weno/pharmacyList.csv

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions interface/main/tabs/menu/menus/standard.json
Expand Up @@ -1046,6 +1046,18 @@
"super"
]
},
{
"label":"Weno Management",
"menu_id":"adm0",
"target":"adm",
"url":"/interface/weno/admin.php",
"children":[],
"requirement":0,
"acl_req": [
"admin",
"super"
]
},
{
"label": "Audit Log Tamper",
"menu_id": "adm0",
Expand Down
4 changes: 2 additions & 2 deletions interface/patient_file/summary/demographics.php
Expand Up @@ -293,8 +293,8 @@ function toggleIndicator(target,div) {
$(".rx_modal").fancybox( {
'overlayOpacity' : 0.0,
'showCloseButton' : true,
'frameHeight' : 500,
'frameWidth' : 800,
'frameHeight' : 600,
'frameWidth' : 1200,
'centerOnScroll' : false,
'callbackOnClose' : function() {
refreshme();
Expand Down
3 changes: 3 additions & 0 deletions interface/usergroup/user_admin.php
Expand Up @@ -375,6 +375,9 @@ function authorized_clicked() {
<?php echo generate_select_list("erxrole", "newcrop_erx_role", $iter['newcrop_user_role'], '', xl('Select Role'), '', '', '', array('style'=>'width:150px')); ?>
</td>
</tr>
<tr>
<td><span class="text"><?php echo xlt('Weno Provider ID'); ?>: </span></td><td><input type="text" name="erxprid" style="width:150px;" value="<?php echo attr($iter["weno_prov_id"]); ?>"></td>
</tr>

<tr>
<td><span class="text"><?php xl('Provider Type', 'e'); ?>: </span></td>
Expand Down
6 changes: 6 additions & 0 deletions interface/usergroup/usergroup_admin.php
Expand Up @@ -191,6 +191,11 @@
sqlStatement("update `users` set `main_menu_role` = ? where `id` = ? ", array($mainMenuRole, $_POST["id"]));
}

if ($_POST["erxprid"]) {
$erxprid = formData('erxprid', 'P');
sqlStatement("update users set weno_prov_id = '$erxprid' where id = ? ", array($_POST["id"]));
}

if (isset($phpgacl_location) && acl_check('admin', 'acl')) {
// Set the access control group of user
$user_data = sqlFetchArray(sqlStatement("select username from users where id= ?", array($_POST["id"])));
Expand Down Expand Up @@ -245,6 +250,7 @@
"', newcrop_user_role = '" . trim(formData('erxrole')) .
"', physician_type = '" . trim(formData('physician_type')) .
"', main_menu_role = '" . trim(formData('main_menu_role')) .
"', weno_prov_id = '" . trim(formData('erxprid')) .
"', authorized = '" . trim(formData('authorized')) .
"', info = '" . trim(formData('info')) .
"', federaldrugid = '" . trim(formData('federaldrugid')) .
Expand Down
4 changes: 3 additions & 1 deletion interface/usergroup/usergroup_admin_add.php
Expand Up @@ -300,7 +300,9 @@ function authorized_clicked() {
<?php echo generate_select_list("erxrole", "newcrop_erx_role", '', '', '--Select Role--', '', '', '', array('style'=>'width:120px')); ?>
</td>
</tr>

<tr>
<td><span class="text"><?php echo xlt('Weno Provider ID'); ?>: </span></td><td><input type="text" name="erxprid" style="width:120px;" value="<?php echo attr($iter["weno_prov_id"]); ?>"></td>
</tr>
<?php if ($GLOBALS['inhouse_pharmacy']) { ?>
<tr>
<td class="text"><?php xl('Default Warehouse', 'e'); ?>: </td>
Expand Down
48 changes: 48 additions & 0 deletions interface/weno/RxLog.php
@@ -0,0 +1,48 @@
<?php
/**
* weno rxlog.
*
* @package OpenEMR
* @link http://www.open-emr.org
* @author Sherwin Gaddis <sherwingaddis@gmail.com>
* @copyright Copyright (c) 2016-2017 Sherwin Gaddis <sherwingaddis@gmail.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/


require_once("../globals.php");
use OpenEMR\Core\Header;

?>

<html>
<head>
<title><?php echo xlt("Rx Log"); ?></title>
<?php Header::setupHeader(); ?>

</head>
<body class="body_top">
<h1><?php print xlt("Rx Log"); ?></h1>
<?php

$log = sqlStatement("SELECT * FROM erx_rx_log ORDER BY id DESC");

print "<table width='100%'>";
print "<tr align='left'>

<th>". xlt("Rx ID") ."</th>
<th>". xlt("Date") ."</th>
<th>". xlt("Time") ."</th>
<th>". xlt("Code") ."</th>
<th>". xlt("Status") ."</th>
<th>". xlt("Message") ."</th>
</tr>";
while ($row = sqlFetchArray($log)) {
print "<tr><td>" .text($row['prescription_id'])."</td><td>".oeFormatShortDate($row['date']).
"</td><td>".text($row['time'])."</td><td>".text($row['code'])."</td><td>".text($row['status']).
"</td><td>".text($row['message_id'])."</td></tr>";
}
print "</table>";
?>
</body>
</html>
75 changes: 75 additions & 0 deletions interface/weno/admin.php
@@ -0,0 +1,75 @@
<?php
/**
* weno admin.
*
* @package OpenEMR
* @link http://www.open-emr.org
* @author Sherwin Gaddis <sherwingaddis@gmail.com>
* @copyright Copyright (c) 2016-2017 Sherwin Gaddis <sherwingaddis@gmail.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

require_once('../globals.php');
require_once("$srcdir/options.inc.php");
use OpenEMR\Core\Header;
use OpenEMR\Rx\Weno\AdminProperties;

$tables = new AdminProperties();

?>
<html>
<head>
<title><?php print xlt("Weno Admin"); ?></title>
<?php Header::setupHeader(); ?>

</head>
<body class="body_top">
<div class="container">
<?php

// check to make sure only administrators access this page.
if (!acl_check('admin', 'super')) {
die(xlt("You are not authorized!"));
}

if ($GLOBALS['weno_rx_enable'] != 1) {
print xlt("You must activate Weno first! Go to Admnistration, Globals, Connectors");
exit;
} else {
print xlt("Weno Service is Enabled")."<br><br>";
}



$drugData = $tables->drugTableInfo();
if (!$drugData['ndc']) {
echo "<a href='drugPaidInsert.php' class='btn btn-default'>".xlt("Import Formularies")."</a> <br>".xlt("Be patient this may take a while");
} else {
print xlt("Formularies inserted into table")."<br>";
}

?>

<h3><?php echo xlt("Select State to Import for Pharmacy"); ?></h3>

<form method="post" action="import_pharmacies.php" >
<div class="col-lg-2">
<?php echo generate_form_field(array('data_type'=>$GLOBALS['state_data_type'],'list_id'=>$GLOBALS['state_list'], 'field_id'=>'state'), ''); ?>
</div>


<button type="submit" class="btn btn-default btn-save" value= ><?php echo xlt("Import Pharmacies"); ?></button>

<br>
<p><?php echo xlt("Be patient, this can take a while."); ?></p>
</form>
<br><br>

<?php if (!empty($finish)) {
echo $finish . xlt("with import");
} ?>


</div>
</body>
</html>
131 changes: 131 additions & 0 deletions interface/weno/ajax_sample_code.php
@@ -0,0 +1,131 @@
<?php
/**
* weno rx ajax sample code
*
* @package OpenEMR
* @link http://www.open-emr.org
* @author Sherwin Gaddis <sherwingaddis@gmail.com>
* @copyright Copyright (c) 2016-2017 Sherwin Gaddis <sherwingaddis@gmail.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

require_once('../globals.php');
use OpenEMR\Core\Header;

?>
<!DOCTYPE html>
<html>
<head>
<title><?php print xlt("Weno Sample Code") ?></title>
<?php Header::setupHeader(['jquery-ui', 'jquery-ui-sunny']); ?>

</head>

<body>

<h3><?php print xlt("Convert a JavaScript object into a JSON string, and send it to the server.") ?></h3>

<div id="confirm">
<br><br>
<input type='submit' id='confirm_btn' value='<?php print xla("Confirm") ?>' >
</div>
<div id="transmit">
<input type='submit' id='order' value='<?php print xla("Transmit Order") ?>' >
</div>
<div id="success"></div>

<script>

$(document).ready(function(){


$("#transmit").hide();
$("#confirm_btn").click(function(){
//
//build a process that will create the code below for transmit.
//each drug transmitted has to be separate
//
$("#transmit").show();

});

$('#order').click(function(){
$('#success').html("<i class="fa fa-refresh fa-spin fa-3x fa-fw"></i>");
var patient = { "patient": {
"lname" : "Ike",
"fname" : "Turner",
"street" : "123 Franklin Blvd",
"city" : "Chesapeake",
"postal" : 23323,
"DOB" : "1951-01-03",
"Sex" : "M"
}};

var provider = {"provider": {
"provlname" : "Mark",
"provfname" : "East",
"provnpi" : 1033137377,
"facilityphone" : 7573331212,
"facilityfax" : 7574441212,
"facilityname" : "East Cardiology",
"facilitystreet" : "127 Albert Dr.",
"facilitycity" : "Chesapeake",
"facilitystate" : "VA",
"facilityzip" : 23320,
"qualifier" : "D91539:C29729",
"wenoAccountId" : "111",
"wenoAccountPass" : "A80B97AB1A80B92084CB86DE61A1F82A6979990B",
"wenoClinicId" : "D91539:C29729"
}};
var pharmacy = {"pharmacy": {
"storename":"Test Direct Pharmacy",
"storenpi":321,
"pharmacy":1234567,
"pharmacyPhone":2109128143,
"pharmacyFax":5128525926
}};

var script = {"script": {
"drugName" : "tylonal ES TABS",
"drug_NDC" : 405012301,
"dateAdded" : "2017-02-02",
"quantity" : 50,
"refills" : 3,
"dateModified" : "2017-02-15",
"note" : "add not to pharmacy",
"take" : "once a day"
}};


var sendPatient = JSON.stringify(patient);
var sendProvider = JSON.stringify(provider);
var sendPharmacy = JSON.stringify(pharmacy);
var sendScript = JSON.stringify(script);
var send = '['+sendPatient+','+sendProvider+','+sendPharmacy+','+sendScript+']';

$.ajax({
type: 'POST',
dataType: 'JSON',
url: 'https://apa.openmedpractice.com/apa/interface/weno/receivingrx.php?',
data: {"scripts": send},

success: function(response){
console.log(response);

$('#success').html('<p>'+response+'</p>');
},
error: function(xhr, status, error){
console.log(xhr);
console.log(status);
console.log(error);
console.warn(xhr.responseText);
}
});

});

});
</script>

</body>
</html>