Skip to content

Commit

Permalink
Support for CPOE, labs, and messaging contributed by Thomas Wong
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymiller committed Mar 24, 2010
1 parent 4b0be92 commit 17fedad
Show file tree
Hide file tree
Showing 17 changed files with 1,194 additions and 111 deletions.
16 changes: 9 additions & 7 deletions acl_setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,20 @@

// Create ACOs for patients.
//
$gacl->add_object('patients', 'Appointments (write optional)' , 'appt' , 10, 0, 'ACO');
$gacl->add_object('patients', 'Appointments (write optional)' , 'appt' , 10, 0, 'ACO');
// xl('Appointments (write optional)')
$gacl->add_object('patients', 'Demographics (write,addonly optional)' , 'demo' , 10, 0, 'ACO');
$gacl->add_object('patients', 'Demographics (write,addonly optional)' , 'demo' , 10, 0, 'ACO');
// xl('Demographics (write,addonly optional)')
$gacl->add_object('patients', 'Medical/History (write,addonly optional)', 'med' , 10, 0, 'ACO');
$gacl->add_object('patients', 'Medical/History (write,addonly optional)' , 'med' , 10, 0, 'ACO');
// xl('Medical/History (write,addonly optional)')
$gacl->add_object('patients', 'Transactions (write optional)' , 'trans', 10, 0, 'ACO');
$gacl->add_object('patients', 'Transactions (write optional)' , 'trans', 10, 0, 'ACO');
// xl('Transactions (write optional)')
$gacl->add_object('patients', 'Documents (write,addonly optional)' , 'docs' , 10, 0, 'ACO');
$gacl->add_object('patients', 'Documents (write,addonly optional)' , 'docs' , 10, 0, 'ACO');
// xl('Documents (write,addonly optional)')
$gacl->add_object('patients', 'Patient Notes (write,addonly optional)' , 'notes', 10, 0, 'ACO');
$gacl->add_object('patients', 'Patient Notes (write,addonly optional)' , 'notes', 10, 0, 'ACO');
// xl('Patient Notes (write,addonly optional)')
$gacl->add_object('patients', 'Sign Lab Results (write,addonly optional)', 'sign' , 10, 0, 'ACO');
// xl('Sign Lab Results (write,addonly optional)')

// Create ACOs for sensitivities.
//
Expand Down Expand Up @@ -220,7 +222,7 @@
'acct'=>array('disc', 'rep'),
'admin'=>array('drugs'),
'encounters'=>array('auth_a', 'coding_a', 'notes_a', 'date_a'),
'patients'=>array('appt', 'demo', 'med', 'trans', 'docs', 'notes'),
'patients'=>array('appt', 'demo', 'med', 'trans', 'docs', 'notes', 'sign'),
'sensitivities'=>array('normal', 'high')
),
NULL, array($doc), NULL, NULL,
Expand Down
8 changes: 8 additions & 0 deletions acl_upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
// ADD ethrace Ethnicity-Race List (write,addonly optional) (Administrators)
// ADD Section "placeholder" (Placeholder):
// ADD filler Placeholder (Maintains empty ACLs)
// 3.3.0
// Section "patients" (Patients):
// ADD sign Sign Lab Results (Physicians)

//Ensure that phpGACL has been installed
include_once('library/acl.inc');
Expand Down Expand Up @@ -94,6 +97,8 @@
addObjectAcl('lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)');
//Add 'Placeholder (Maintains empty ACLs)' object (added in 3.0.2)
addObjectAcl('placeholder', 'Placeholder', 'filler', 'Placeholder (Maintains empty ACLs)');
//Add 'Sign Lab Results (write,addonly optional)' object (added in 3.3.0)
addObjectAcl('patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)');

//Update already existing Objects
echo "<BR/><B>Upgrading objects</B><BR/>";
Expand Down Expand Up @@ -217,6 +222,9 @@
updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
//Insert the 'normal' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
//Insert the 'sign' object from the 'patients' section into the Physicians group write ACL (added in 3.3.0)
updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');


//Function will return an array that contains the ACL ID number.
//It will also check to ensure the ACL exist and is not duplicated.
Expand Down
Binary file added images/sortdown.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/sortup.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions interface/globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,19 @@
$SMTP_USER = "";
$SMTP_PASS = "";

// The following credentials are provided by OpenEMR Support LLC for testing.
// When you sign up with their Lab Exchange service, they will provide you with your own credentials.

/* use this for testing
$siteId = "3";
$token = "12345";
$endpoint = "https://openemrsupport.com:29443/len/api";
*/

$siteId = "";
$token = "";
$endpoint = "";

//settings for cronjob of the sms/email module
// SEND SMS NOTIFICATION BEFORE HH HOUR
$SMS_NOTIFICATION_HOUR = 50;
Expand Down
75 changes: 6 additions & 69 deletions interface/main/authorizations/authorizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
include_once("$srcdir/patient.inc");
include_once("$srcdir/options.inc.php");

//the number of authorizations to display in the quick view:
// The number of authorizations to display in the quick view:
// MAR 20041008 the full authorizations screen sucks... no links to the patient charts
// increase to a high number to make the mini frame more useful.
$N = 50;
Expand Down Expand Up @@ -66,15 +66,8 @@
<img src="<?php echo $GLOBALS['webroot']; ?>/images/min.gif">
</div>

<?php
$_GET['show_all']=='yes' ? $lnkvar="'authorizations.php?show_all=no' name='Just Mine'> (".xl('Just Mine').") " : $lnkvar="'authorizations.php?show_all=yes' name='See All'>(".xl('See All').")";
?>

<span class='title'><?php xl('Patient Notes','e')?> </span>
<a class='more' href=<?php echo $lnkvar; ?></a>

<?php if ($imauthorized) { ?>
<span class='title'><?php xl('and ','e')?>
<span class='title'>
<?php if ($GLOBALS['concurrent_layout']) { ?>
<a href='authorizations_full.php'>
<?php } else { ?>
Expand All @@ -92,62 +85,6 @@
</span>
<?php } ?>

<div id="pnotes">
<?php
// Retrieve all active notes addressed to me (or to anybody)
$_GET['show_all']=='yes' ? $usrvar='_%' : $usrvar=$_SESSION['authUser'] ;
if ($result=getPnotesByDate("", 1, "id,date,body,pid,user,title,assigned_to", '%', "all", 0, $usrvar))
{
echo "<table border='0'>\n";
echo " <tr>\n";
echo " <td class='bold' nowrap>".xl('Patient')." &nbsp;</td>\n";
echo " <td class='bold' nowrap>".xl('Note Type')." &nbsp;</td>\n";
echo " <td class='bold' nowrap>".xl('Timestamp and Text')."</td>\n";
echo " </tr>\n";

foreach ($result as $iter) {
$body = $iter['body'];
if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
$body = nl2br($body);
} else {
$body = date('Y-m-d H:i', strtotime($iter['date'])) .
' (' . $iter['user'] . ') ' . nl2br($body);
}

echo " <tr class='noterow' id='".$iter['pid']."~".$iter['id']."'>\n";
echo " <td valign='top' class='text'>\n";
echo getPatientName($iter['pid']) . "\n";
echo " </td>\n";
echo " <td valign='top'>\n";

if ($GLOBALS['concurrent_layout']) {
// Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
echo " <a href='../../patient_file/summary/pnotes_full.php" .
"?set_pid=" . $iter['pid'] . "&noteid=" . $iter['id'] .
"&active=1' class='link_submit'>" .
generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']) .
"</a>\n";
} else {
// Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
echo " <a href='../../patient_file/patient_file.php" .
"?set_pid=" . $iter['pid'] . "&noteid=" . $iter['id'] .
"' target='_top' class='link_submit'>" .
generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']) .
"</a>\n";
}

echo " </td>\n";
echo " <td valign='top' class='text'>\n";
echo " $body\n";
echo " </td>\n";
echo " </tr>\n";
}

echo "</table>\n";
}
?>
</div> <!-- end of pnotes -->

<?php
if ($imauthorized && $see_auth > 1) {

Expand Down Expand Up @@ -204,7 +141,7 @@
stripslashes(strterm($iter{"body"},25)) . " " .
date("n/j/Y",strtotime($iter{"date"})) . "</span><br>\n";
}
//$authorize[$iter{"pid"}]{"pnotes"} = substr($authorize[$iter{"pid"}]{"pnotes"},0,strlen($authorize[$iter{"pid"}]{"pnotes"}));
// $authorize[$iter{"pid"}]{"pnotes"} = substr($authorize[$iter{"pid"}]{"pnotes"},0,strlen($authorize[$iter{"pid"}]{"pnotes"}));
}
}
}
Expand All @@ -221,7 +158,7 @@
$iter{"form_name"} . " " . date("n/j/Y",strtotime($iter{"date"})) .
"</span><br>\n";
}
//$authorize[$iter{"pid"}]{"forms"} = substr($authorize[$iter{"pid"}]{"forms"},0,strlen($authorize[$iter{"pid"}]{"forms"}));
// $authorize[$iter{"pid"}]{"forms"} = substr($authorize[$iter{"pid"}]{"forms"},0,strlen($authorize[$iter{"pid"}]{"forms"}));
}
}
// echo "HERE"; // what the heck was this for?
Expand Down Expand Up @@ -257,8 +194,8 @@
// as demographics.php takes care of loading the bottom frame.

echo "<a href='$rootdir/patient_file/summary/demographics.php?set_pid=$ppid' " .
"target='RTop'>";
"target='RTop'>";

} else {
echo "<a href='$rootdir/patient_file/patient_file.php?set_pid=$ppid' " .
"target='_top'>";
Expand Down
14 changes: 9 additions & 5 deletions interface/main/left_nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
$primary_docs = array(
'ros' => array(xl('Roster') , 0, 'reports/players_report.php?embed=1'),
'cal' => array(xl('Calendar') , 0, 'main/main_info.php'),
'msg' => array(xl('Messages') , 0, 'main/messages/messages.php'),
'pwd' => array(xl('Password') , 0, 'usergroup/user_info.php'),
'adm' => array(xl('Admin') , 0, 'usergroup/admin_frameset.php'),
'rep' => array(xl('Reports') , 0, 'reports/index.php'),
Expand All @@ -112,7 +113,7 @@
'imp' => array(xl('Import') , 0, '../custom/import.php'),
'bil' => array(xl('Billing') , 0, 'billing/billing_report.php'),
'sup' => array(xl('Superbill') , 0, 'patient_file/encounter/superbill_custom_full.php'),
'aun' => array(xl('Auth/notes'), 0, 'main/authorizations/authorizations.php'),
'aun' => array(xl('Authorizations'), 0, 'main/authorizations/authorizations.php'),
'new' => array(xl('New Pt') , 0, 'new/new.php'),
'dem' => array(xl('Patient') , 1, "patient_file/summary/demographics.php"),
'his' => array(xl('History') , 1, 'patient_file/history/history.php'),
Expand All @@ -122,6 +123,7 @@
'iss' => array(xl('Issues') , 1, 'patient_file/summary/stats_full.php?active=all'),
'imm' => array(xl('Immunize') , 1, 'patient_file/summary/immunizations.php'),
'doc' => array(xl('Documents') , 1, '../controller.php?document&list&patient_id={PID}'),
'orp' => array(xl('Proc Pending Rev'), 1, 'orders/orders_results.php?review=1'),
'orr' => array(xl('Proc Res') , 1, 'orders/orders_results.php'),
'prp' => array(xl('Pt Report') , 1, 'patient_file/report/patient_report.php'),
'pno' => array(xl('Pt Notes') , 1, 'patient_file/summary/pnotes.php'),
Expand Down Expand Up @@ -771,7 +773,7 @@ function selpopup(selobj) {
<?php genTreeLink('RTop','doc',xl('Document/Imaging Store'),true); ?>
<?php genTreeLink('RTop','prp',xl('Patient Printed Report')); ?>
<?php genDualLink('dem','pno',xl('Additional Notes')); // with dem on top ?>
<li><a href='' onclick="return repPopup('../patient_file/letter.php')" id='prp1'>Letter</a></li>
<li><a href='' onClick="return repPopup('../patient_file/letter.php')" id='prp1'>Letter</a></li>
<?php genPopLink('Address Book','../usergroup/addrbook_list.php?popup=1'); ?>
</ul>
</li>
Expand Down Expand Up @@ -841,7 +843,7 @@ function selpopup(selobj) {
</li>
<li><span><?php xl('Miscellaneous','e') ?></span>
<ul>
<?php genTreeLink('RBot','aun',xl('Pt Notes/Auth')); ?>
<?php genTreeLink('RBot','aun',xl('Authorizations')); ?>
<?php genTreeLink('RTop','fax',xl('Fax/Scan')); ?>
<?php genTreeLink('RTop','adb',xl('Addr Book')); ?>
<?php genTreeLink('RTop','ono',xl('Ofc Notes')); ?>
Expand All @@ -854,6 +856,7 @@ function selpopup(selobj) {

<ul id="navigation">
<?php if (!$GLOBALS['disable_calendar'] && !$GLOBALS['ippf_specific']) genTreeLink('RTop','cal',xl('Calendar')); ?>
<?php genTreeLink('RTop','msg',xl('Messages')); ?>
<li class="open"><span><?php xl('Patient/Client','e') ?></span>
<ul>
<li><span><?php xl('Management','e') ?></span>
Expand Down Expand Up @@ -925,6 +928,7 @@ function selpopup(selobj) {
<li><span><?php xl('Procedures','e') ?></span>
<ul>
<?php genTreeLink('RTop','ort',xl('Configuration')); ?>
<?php genTreeLink('RTop','orp',xl('Pending Review')); ?>
<?php genTreeLink('RTop','orr',xl('Patient Results')); ?>
<?php genTreeLink('RTop','orb',xl('Batch Results')); ?>
</ul>
Expand Down Expand Up @@ -1045,7 +1049,7 @@ function selpopup(selobj) {
</li>
<li><span><?php xl('Miscellaneous','e') ?></span>
<ul>
<?php genTreeLink('RBot','aun',xl('Pt Notes/Auth')); ?>
<?php genTreeLink('RBot','aun',xl('Authorizations')); ?>
<?php genTreeLink('RTop','fax',xl('Fax/Scan')); ?>
<?php genTreeLink('RTop','adb',xl('Addr Book')); ?>
<?php genTreeLink('RTop','ort',xl('Order Catalog')); ?>
Expand Down Expand Up @@ -1165,7 +1169,7 @@ function selpopup(selobj) {

<hr />
<?php if (!empty($GLOBALS['online_support_link'])) { ?>
<a href='<?php echo $GLOBALS["online_support_link"]; ?>' target="_blank" id="support_link" class='css_button' onclick="top.restoreSession()"><span><?php xl('Online Support','e'); ?></span></a>
<a href='<?php echo $GLOBALS["online_support_link"]; ?>' target="_blank" id="support_link" class='css_button' onClick="top.restoreSession()"><span><?php xl('Online Support','e'); ?></span></a>
<?php } ?>

<input type='hidden' name='findBy' value='Last' />
Expand Down
55 changes: 55 additions & 0 deletions interface/main/messages/lab_results_messages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
// Copyright (C) 2010 OpenEMR Support LLC
// 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.

require_once("$include_root/globals.php");
require_once("$srcdir/pnotes.inc");
require_once("$srcdir/patient.inc");
require_once("$srcdir/auth.inc");
include_once("$srcdir/formdata.inc.php");

function lab_results_messages($set_pid, $rid, $provider_id="") {
if ($provider_id != "") {
$where = "AND id = '".$provider_id."'";
}
// Get all active users.
$rez = sqlStatement("select id, username from users where username != '' AND active = '1' $where");
for ($iter = 0; $row = sqlFetchArray($rez); $iter++) {
$result[$iter] = $row;
}

if (!empty($result)) {
foreach ($result as $user_detail) {
unset($thisauth); // Make sure it is empty.
// Check user authorization. Only send the panding review message to authorised user.
// $thisauth = acl_check('patients', 'sign', $user_detail['username']);

// if not given prrovider, send messages to admin (super user)
if ($provider_id == "") {
$thisauth = acl_check('admin', 'super', $user_detail['username']);
}
else {
$thisauth = true;
}

if ($thisauth) {
// Send messages to selected users when there is a new lab report.
$userauthorized = formData("userauthorized");
$pname = getPatientName($set_pid);
$link = "<a href='../../orders/orders_results.php?review=1&set_pid=$set_pid'" .
" onclick='return top.restoreSession()'>here</a>";
$note = "Patient $pname's lab results have arrived. Please click $link to review them.<br/>";
$note_type = "Lab Results";
$messsage_status = "New";
// Add pnote.
$noteid = addPnote($set_pid, $note, $userauthorized, '1', $note_type, $user_detail['username']);
sqlQ("update pnotes set message_status='".$messsage_status."' where id = '$noteid'");
}
}
}
}

?>
Loading

0 comments on commit 17fedad

Please sign in to comment.