From 49749369166b516da41bc8a40110dec13cf5b778 Mon Sep 17 00:00:00 2001 From: Rod Roark Date: Wed, 7 May 2014 15:21:10 -0700 Subject: [PATCH] Support for the CMS Patient Portal. --- interface/cmsportal/history_form.php | 208 +++++++++++++ interface/cmsportal/insurance_form.php | 363 +++++++++++++++++++++++ interface/cmsportal/issue_form.php | 315 ++++++++++++++++++++ interface/cmsportal/lbf_form.php | 135 +++++++++ interface/cmsportal/list_requests.php | 314 ++++++++++++++++++++ interface/cmsportal/patient_form.php | 318 ++++++++++++++++++++ interface/cmsportal/patient_form_ajax.php | 39 +++ interface/cmsportal/patient_select.php | 224 ++++++++++++++ interface/cmsportal/portal.inc.php | 98 ++++++ interface/cmsportal/upload_form.php | 206 +++++++++++++ interface/cmsportal/upload_form_show.php | 54 ++++ interface/forms/LBF/new.php | 77 ++++- interface/main/left_nav.php | 9 + interface/orders/single_order_results.inc.php | 13 +- interface/orders/single_order_results.php | 31 +- interface/patient_file/report/custom_report.php | 29 +- interface/patient_file/report/patient_report.php | 22 +- interface/super/edit_layout.php | 1 + library/globals.inc.php | 32 ++ library/options.inc.php | 206 +++++++++++-- sql/4_1_2-to-4_1_3_upgrade.sql | 15 +- sql/database.sql | 8 + version.php | 2 +- 23 files changed, 2670 insertions(+), 49 deletions(-) create mode 100644 interface/cmsportal/history_form.php create mode 100644 interface/cmsportal/insurance_form.php create mode 100644 interface/cmsportal/issue_form.php create mode 100644 interface/cmsportal/lbf_form.php create mode 100644 interface/cmsportal/list_requests.php create mode 100644 interface/cmsportal/patient_form.php create mode 100644 interface/cmsportal/patient_form_ajax.php create mode 100644 interface/cmsportal/patient_select.php create mode 100644 interface/cmsportal/portal.inc.php create mode 100644 interface/cmsportal/upload_form.php create mode 100644 interface/cmsportal/upload_form_show.php diff --git a/interface/cmsportal/history_form.php b/interface/cmsportal/history_form.php new file mode 100644 index 000000000..30bb4011b --- /dev/null +++ b/interface/cmsportal/history_form.php @@ -0,0 +1,208 @@ + + * + * 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 Rod Roark + */ + +$sanitize_all_escapes = true; +$fake_register_globals = false; + +require_once("../globals.php"); +require_once("$srcdir/patient.inc"); +require_once("$srcdir/formdata.inc.php"); +require_once("$srcdir/options.inc.php"); +require_once("portal.inc.php"); + +$postid = intval($_REQUEST['postid']); +$ptid = intval($_REQUEST['ptid' ]); + +if ($_POST['bn_save']) { + $newdata = array(); + $fres = sqlStatement("SELECT * FROM layout_options WHERE " . + "form_id = 'HIS' AND field_id != '' AND uor > 0 " . + "ORDER BY group_name, seq"); + while ($frow = sqlFetchArray($fres)) { + $data_type = $frow['data_type']; + $field_id = $frow['field_id']; + if (isset($_POST["form_$field_id"])) { + $newdata[$field_id] = get_layout_form_value($frow); + } + } + updateHistoryData($ptid, $newdata); + // Finally, delete the request from the portal. + $result = cms_portal_call(array('action' => 'delpost', 'postid' => $postid)); + if ($result['errmsg']) { + die(text($result['errmsg'])); + } + echo "\n"; + exit(); +} + +// Get the portal request data. +if (!$postid) die(xlt('Request ID is missing!')); +$result = cms_portal_call(array('action' => 'getpost', 'postid' => $postid)); +if ($result['errmsg']) { + die(text($result['errmsg'])); +} + +// Look up the patient in OpenEMR. +$ptid = lookup_openemr_patient($result['post']['user']); + +// Get patient's current history data in OpenEMR. +$hyrow = getHistoryData($ptid, "*"); +?> + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + 0 ORDER BY group_name, seq", + array('HIS')); + +while ($lorow = sqlFetchArray($lores)) { + $data_type = $lorow['data_type']; + $field_id = $lorow['field_id']; + // Check for field name match in portal results, case insensitive. + $reskey = $field_id; + $gotfield = false; + foreach ($result['fields'] as $key => $dummy) { + // For Exam Results the field ID has a colon and list item ID appended. + if (($i = strpos($key, ':')) !== false) { + $key = substr($key, 0, $i); + } + if (strcasecmp($key, $field_id) == 0) { + $reskey = $key; + $gotfield = true; + } + } + // Generate form fields for items that are either from the WordPress form + // or are mandatory. + if ($gotfield || $lorow['uor'] > 1) { + $list_id = $lorow['list_id']; + $field_title = $lorow['title']; + if ($field_title === '') $field_title = '(' . $field_id . ')'; + + $currvalue = ''; + if (isset($hyrow[$field_id])) $currvalue = $hyrow[$field_id]; + + $newvalue = cms_field_to_lbf($data_type, $reskey, $result['fields']); + + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } +} + +echo "
" . text($field_title) . "" . generate_display_field($lorow, $currvalue) . ""; generate_form_field($lorow, $newvalue); echo "
\n"; +?> + +

+' /> +  +' + onclick="myRestoreSession();location='list_requests.php'" /> +

+ +
+ + + + + + +
+ + + diff --git a/interface/cmsportal/insurance_form.php b/interface/cmsportal/insurance_form.php new file mode 100644 index 000000000..11a8f955c --- /dev/null +++ b/interface/cmsportal/insurance_form.php @@ -0,0 +1,363 @@ +;. + * + * @package OpenEMR + * @author Rod Roark + */ + +$sanitize_all_escapes = true; +$fake_register_globals = false; + +require_once("../globals.php"); +require_once("$srcdir/patient.inc"); +require_once("$srcdir/formdata.inc.php"); +require_once("$srcdir/options.inc.php"); +require_once("portal.inc.php"); + +// Consider this a step towards converting the insurance form to layout-based. +// Faking it here makes things easier. +// Also note that some fields like SSN and most of the subscriber employer +// items have been omitted because they are not relevant for claims. +// +$insurance_layout = array( + array('field_id' => 'type', + 'title' => 'Type', + 'uor' => '2', + 'data_type' => '1', + 'list_id' => 'insurance_types', + 'edit_options' => '', + ), + array('field_id' => 'date', + 'title' => 'Effective Date', + 'uor' => '2', + 'data_type' => '4', // Text-date + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'provider', + 'title' => 'Provider', + 'uor' => '2', + 'data_type' => '16', // Insurance Providers + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'plan_name', + 'title' => 'Plan Name', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'policy_number', + 'title' => 'Policy Number', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'group_number', + 'title' => 'Group Number', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_employer', + 'title' => 'Group Name', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_lname', + 'title' => 'Subscriber Last Name', + 'uor' => '2', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_fname', + 'title' => 'Subscriber First Name', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_mname', + 'title' => 'Subscriber Middle Name', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_DOB', + 'title' => 'Subscriber DOB', + 'uor' => '2', + 'data_type' => '4', // Text-date + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_sex', + 'title' => 'Subscriber Sex', + 'uor' => '2', + 'data_type' => '1', // List + 'list_id' => 'sex', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_relationship', + 'title' => 'Subscriber Relationship', + 'uor' => '2', + 'data_type' => '1', // List + 'list_id' => 'sub_relation', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_street', + 'title' => 'Subscriber Street', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_city', + 'title' => 'Subscriber City', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_state', + 'title' => 'Subscriber State', + 'uor' => '1', + 'data_type' => '1', // List + 'list_id' => 'state', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_postal_code', + 'title' => 'Subscriber Zip', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'subscriber_phone', + 'title' => 'Subscriber Phone', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), +); + +$postid = intval($_REQUEST['postid']); + +if ($_POST['bn_save']) { + $newdata = array(); + $ptid = intval($_POST['ptid']); + foreach ($insurance_layout as $frow) { + $data_type = $frow['data_type']; + $field_id = $frow['field_id']; + // newInsuranceData() does not escape for mysql so we have to do it here. + $newdata[$field_id] = add_escape_custom(get_layout_form_value($frow)); + } + newInsuranceData( + $ptid, + $newdata['type'], + $newdata['provider'], + $newdata['policy_number'], + $newdata['group_number'], + $newdata['plan_name'], + $newdata['subscriber_lname'], + $newdata['subscriber_mname'], + $newdata['subscriber_fname'], + $newdata['subscriber_relationship'], + '', // subscriber_ss + fixDate($newdata['subscriber_DOB']), + $newdata['subscriber_street'], + $newdata['subscriber_postal_code'], + $newdata['subscriber_city'], + $newdata['subscriber_state'], + '', // subscriber_country + $newdata['subscriber_phone'], + $newdata['subscriber_employer'], + '', // subscriber_employer_street + '', // subscriber_employer_city + '', // subscriber_employer_postal_code + '', // subscriber_employer_state + '', // subscriber_employer_country + '', // copay + $newdata['subscriber_sex'], + fixDate($newdata['date']), + 'TRUE', // accept_assignment + '' // policy_type + ); + // Finally, delete the request from the portal. + $result = cms_portal_call(array('action' => 'delpost', 'postid' => $postid)); + if ($result['errmsg']) { + die(text($result['errmsg'])); + } + echo "\n"; + exit(); +} + +// Get the portal request data. +if (!$postid) die(xlt('Request ID is missing!')); +$result = cms_portal_call(array('action' => 'getpost', 'postid' => $postid)); +if ($result['errmsg']) { + die(text($result['errmsg'])); +} + +// Look up the patient in OpenEMR. +$ptid = lookup_openemr_patient($result['post']['user']); +?> + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + +\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; +} +?> + +
" . text($field_title) . ""; + echo generate_display_field($lorow, $currvalue); + echo ""; + generate_form_field($lorow, $newvalue); + echo "
+ +

+' /> +  +' onclick="window.back()" /> + +

+ +
+ + + + + + +
+ + + diff --git a/interface/cmsportal/issue_form.php b/interface/cmsportal/issue_form.php new file mode 100644 index 000000000..8b75eebaa --- /dev/null +++ b/interface/cmsportal/issue_form.php @@ -0,0 +1,315 @@ + + * + * 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 Rod Roark + */ + +$sanitize_all_escapes = true; +$fake_register_globals = false; + +require_once("../globals.php"); +require_once("$srcdir/formdata.inc.php"); +require_once("$srcdir/options.inc.php"); +require_once("$srcdir/patient.inc"); +require_once("$srcdir/lists.inc"); +require_once("portal.inc.php"); + +// Consider this a step towards converting issue forms to layout-based. +// Faking it here makes things easier. +// +$issue_layout = array( + array('field_id' => 'type', + 'title' => 'Type', + 'uor' => '2', + 'data_type' => '17', // Issue Types + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'title', + 'title' => 'Title', + 'uor' => '2', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'diagnosis', + 'title' => 'Diagnosis', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'begdate', + 'title' => 'Start Date', + 'uor' => '2', + 'data_type' => '4', // Text-date + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'enddate', + 'title' => 'End Date', + 'uor' => '1', + 'data_type' => '4', // Text-date + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'occurrence', + 'title' => 'Occurrence', + 'uor' => '1', + 'data_type' => '1', // List + 'list_id' => 'occurrence', + 'edit_options' => '', + ), + array('field_id' => 'reaction', + 'title' => 'Reaction', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'outcome', + 'title' => 'Outcome', + 'uor' => '1', + 'data_type' => '1', // List + 'list_id' => 'outcome', + 'edit_options' => '', + ), + array('field_id' => 'destination', + 'title' => 'Destination', + 'uor' => '1', + 'data_type' => '2', // Text + 'list_id' => '', + 'edit_options' => '', + ), + array('field_id' => 'comments', + 'title' => 'Comments', + 'uor' => '1', + 'data_type' => '3', // Textarea + 'list_id' => '', + 'fld_length' => '50', + 'fld_rows' => '3', + 'edit_options' => '', + ), +); + +$postid = intval($_REQUEST['postid']); +$issueid = empty($_REQUEST['issueid']) ? 0 : intval($_REQUEST['issueid']); +$form_type = empty($_REQUEST['form_type']) ? '' : $_REQUEST['form_type']; + +if ($_POST['bn_save']) { + $ptid = intval($_POST['ptid']); + $sets = "date = NOW()"; + foreach ($issue_layout as $frow) { + $key = $frow['field_id']; + $value = get_layout_form_value($frow); + if ($frow['data_type'] == 4) { + // Dates require some special handling. + $value = fixDate($value, ''); + if (empty($value)) { + $value = "NULL"; + } + else { + $value = "'$value'"; + } + } + else { + $value = "'" . add_escape_custom($value) . "'"; + } + $sets .= ", `$key` = $value"; + } + if (empty($issueid)) { + $sql = "INSERT INTO lists SET " . + "pid = '" . add_escape_custom($ptid) . "', activity = 1, " . + "user = '" . add_escape_custom($_SESSION['authUser']) . "', " . + "groupname = '" . add_escape_custom($_SESSION['authProvider']) . "', $sets"; + $issueid = sqlInsert($sql); + } + else { + $sql = "UPDATE lists SET $sets WHERE id = '" . add_escape_custom($issueid) . "'"; + sqlStatement($sql); + } + // Finally, delete the request from the portal. + $result = cms_portal_call(array('action' => 'delpost', 'postid' => $postid)); + if ($result['errmsg']) { + die(text($result['errmsg'])); + } + echo "\n"; + exit(); +} + +// Get the portal request data. +if (!$postid) die(xlt('Request ID is missing!')); +$result = cms_portal_call(array('action' => 'getpost', 'postid' => $postid)); +if ($result['errmsg']) { + die(text($result['errmsg'])); +} +// If user changed issue type, it will have submitted the form to override it. +if ($form_type) $result['fields']['type'] = $form_type; + +// Look up the patient in OpenEMR. +$ptid = lookup_openemr_patient($result['post']['user']); +?> + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +

+ +

+ + + + + + + + +\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; +} +?> + +
" . text($field_title) . ""; + echo generate_display_field($lorow, $currvalue); + echo ""; + generate_form_field($lorow, $newvalue); + echo "
+ +

+' /> +  +' + onclick="myRestoreSession();location='list_requests.php'" /> +

+ +
+ + + +
+ + + diff --git a/interface/cmsportal/lbf_form.php b/interface/cmsportal/lbf_form.php new file mode 100644 index 000000000..3a81308e0 --- /dev/null +++ b/interface/cmsportal/lbf_form.php @@ -0,0 +1,135 @@ +;. + * + * @package OpenEMR + * @author Rod Roark + */ + +$sanitize_all_escapes = true; +$fake_register_globals = false; + +require_once("../globals.php"); +require_once("$srcdir/patient.inc"); +require_once("$srcdir/formdata.inc.php"); +require_once("$srcdir/options.inc.php"); +require_once("portal.inc.php"); + +$postid = intval($_REQUEST['postid']); + +// Get the portal request data. +if (!$postid) die(xlt('Request ID is missing!')); +$result = cms_portal_call(array('action' => 'getpost', 'postid' => $postid)); +if ($result['errmsg']) { + die(text($result['errmsg'])); +} + +// Look up the patient in OpenEMR. +$ptid = lookup_openemr_patient($result['post']['user']); +?> + + + + + + + + + + + + + + + + + + + +\n"; // debugging ?> + +
+ +
+ + + + + + + + $newvalue) { + if (is_array($newvalue)) { + $tmp = ''; + foreach ($newvalue as $value) { + if ($tmp !== '') $tmp .= ', '; + $tmp .= $value; + } + $newvalue = $tmp; + } + $newvalue = trim($newvalue); + $field_title = $result['labels'][$field_id]; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; +} +?> + +
" . text($field_title) . ""; + echo text($newvalue); + echo "
+ +

+' onclick="openPatient()" /> +  +' onclick="myRestoreSession();location='list_requests.php'" /> +

+ +
+ + + +
+ + + diff --git a/interface/cmsportal/list_requests.php b/interface/cmsportal/list_requests.php new file mode 100644 index 000000000..66b4dcd0a --- /dev/null +++ b/interface/cmsportal/list_requests.php @@ -0,0 +1,314 @@ + +* +* 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 Rod Roark +*/ + +$sanitize_all_escapes = true; +$fake_register_globals = false; + +require_once("../globals.php"); +require_once("$srcdir/log.inc"); +require_once("$srcdir/acl.inc"); +require_once("$srcdir/formdata.inc.php"); +require_once("$srcdir/options.inc.php"); +require_once("$srcdir/formatting.inc.php"); +require_once("portal.inc.php"); + +/** + * Get a list item title, translating if required. + * + * @param string $listid List identifier. + * @param string $value List item identifier. + * @return string The item's title. + */ +function getListItem($listid, $value) { + $lrow = sqlQuery("SELECT title FROM list_options " . + "WHERE list_id = ? AND option_id = ?", + array($listid, $value)); + $tmp = xl_list_label($lrow['title']); + if (empty($tmp)) $tmp = "($report_status)"; + return $tmp; +} + +/** + * Adapt text to be suitable as the contents of a table cell. + * + * @param string $s Input text. + * @return string Output text. + */ +function myCellText($s) { + if ($s === '') return ' '; + return text($s); +} + +// Get patient name from OpenEMR, or empty if not there. +function patientNameFromLogin($login) { + $ptname = ''; + if ($login) { + $tmp = sqlQuery("SELECT fname, lname, mname, pid " . + "FROM patient_data WHERE cmsportal_login = ? ORDER BY id LIMIT 1", + array($login)); + if (!empty($tmp['pid'])) { + $ptname = $tmp['lname']; + if ($tmp['fname'] || $tmp['mname']) $ptname .= ','; + if ($tmp['fname']) $ptname .= ' ' . $tmp['fname']; + if ($tmp['mname']) $ptname .= ' ' . $tmp['mname']; + } + } + return $ptname; +} + +// Check authorization. +$thisauth = acl_check('patients', 'med'); +if (!$thisauth) die(xlt('Not authorized')); + +$errmsg = ''; + +// If Delete clicked, delete selected posts/messages from the portal. +if (!empty($_POST['bn_delete'])) { + if (is_array($_POST['form_req_cb'])) { + foreach ($_POST['form_req_cb'] as $postid) { + $result = cms_portal_call(array('action' => 'delpost', 'postid' => $postid)); + if ($result['errmsg']) { + die(text($result['errmsg'])); + } + } + } + if (is_array($_POST['form_msg_cb'])) { + foreach ($_POST['form_msg_cb'] as $messageid) { + $result = cms_portal_call(array('action' => 'delmessage', 'messageid' => $messageid)); + if ($result['errmsg']) { + die(text($result['errmsg'])); + } + } + } +} +?> + + + + + +<?php echo xlt('Portal Requests'); ?> + + + + + + + + + + + + + + + + +
+ + 'list', + 'date_from' => $form_from_date, + 'date_to' => $form_to_date, +)); + +if ($result['errmsg']) { + echo "" . text($result['errmsg']) . "
\n"; +} +?> +
+ + + + + +
+ : + ' + onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' /> + [?]' /> +   + : + ' + onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' /> + [?]' /> +   + > +
+ + + + + + + + + +\n"; + if (!$v2 || $v1 && $v1[1]['datetime'] < $v2[1]['datetime']) { + $postid = $v1[1]['postid']; + $ptname = patientNameFromLogin($v1[1]['user']); + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + $v1 = each($result['list']); + } + else { + $messageid = $v2[1]['messageid']; + $ptname = patientNameFromLogin($v2[1]['user']); + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + $v2 = each($result['messages']); + } + echo " \n"; +} +?> + +
+ +
+ + + + +
" . text($v1[1]['user']) . "" . text($ptname ) . "" . text($v1[1]['datetime']) . "" . text($v1[1]['type' ]) . "" . text($v2[1]['user']) . "" . text($ptname ) . "" . text($v2[1]['datetime']) . "" . text($v2[1]['user'] == $v2[1]['fromuser'] ? + xl('Message from patient') : xl('Message to patient')) . "
+ +

+' onclick="window.close();" /> +  +' /> +

+ +
+ + + +
+ + diff --git a/interface/cmsportal/patient_form.php b/interface/cmsportal/patient_form.php new file mode 100644 index 000000000..0d66c10fc --- /dev/null +++ b/interface/cmsportal/patient_form.php @@ -0,0 +1,318 @@ + + * + * 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 Rod Roark + */ + +$sanitize_all_escapes = true; +$fake_register_globals = false; + +require_once("../globals.php"); +require_once("$srcdir/patient.inc"); +require_once("$srcdir/formdata.inc.php"); +require_once("$srcdir/options.inc.php"); +require_once("portal.inc.php"); + +$postid = intval($_REQUEST['postid']); +$ptid = intval($_REQUEST['ptid' ]); + +if ($_POST['bn_save']) { + $newdata = array(); + $newdata['patient_data' ] = array(); + $newdata['employer_data'] = array(); + $ptid = intval($_POST['ptid']); + // Note we are careful to maintain cmsportal_login even if the layout has it + // configured as unused. + $fres = sqlStatement("SELECT * FROM layout_options WHERE " . + "form_id = 'DEM' AND field_id != '' AND (uor > 0 OR field_id = 'cmsportal_login') " . + "ORDER BY group_name, seq"); + while ($frow = sqlFetchArray($fres)) { + $data_type = $frow['data_type']; + $field_id = $frow['field_id']; + $table = 'patient_data'; + if (isset($_POST["form_$field_id"])) { + $newdata[$table][$field_id] = get_layout_form_value($frow); + } + } + if (empty($ptid)) { + $tmp = sqlQuery("SELECT MAX(pid)+1 AS pid FROM patient_data"); + $ptid = empty($tmp['pid']) ? 1 : intval($tmp['pid']); + updatePatientData ($ptid, $newdata['patient_data' ], true); + updateEmployerData($ptid, $newdata['employer_data'], true); + newHistoryData($ptid); + } + else { + $newdata['patient_data']['id'] = $_POST['db_id']; + updatePatientData($ptid, $newdata['patient_data']); + } + // Finally, delete the request from the portal. + $result = cms_portal_call(array('action' => 'delpost', 'postid' => $postid)); + if ($result['errmsg']) { + die(text($result['errmsg'])); + } + echo "\n"; + exit(); +} + +$db_id = 0; +if ($ptid) { + $ptrow = getPatientData($ptid, "*"); + $db_id = $ptrow['id']; +} + +if ($postid) { + $result = cms_portal_call(array('action' => 'getpost', 'postid' => $postid)); + if ($result['errmsg']) { + die(text($result['errmsg'])); + } +} +?> + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + 0 ORDER BY group_name, seq", + array('DEM')); + +// Will be used to indicate if this user does not yet have a portal login. +$portal_registration_needed = false; + +while ($lorow = sqlFetchArray($lores)) { + $data_type = $lorow['data_type']; + $field_id = $lorow['field_id']; + // We deal with this one at the end. + if ($field_id == 'cmsportal_login') continue; + // Flamingo translates field names to lower case so we have to match with those. + $reskey = $field_id; + foreach ($result['fields'] as $key => $dummy) { + if (strcasecmp($key, $field_id) == 0) $reskey = $key; + } + // Generate form fields for items that are either from the WordPress form + // or are mandatory for a new patient. + if (isset($result['fields'][$reskey]) || ($lorow['uor'] > 1 && $ptid == 0)) { + $list_id = $lorow['list_id']; + $field_title = $lorow['title']; + if ($field_title === '') $field_title = '(' . $field_id . ')'; + + $currvalue = ''; + if (isset($ptrow[$field_id])) $currvalue = $ptrow[$field_id]; + + /***************************************************************** + $newvalue = ''; + if (isset($result['fields'][$reskey])) $newvalue = $result['fields'][$reskey]; + //// Zero-length input means nothing will change. + // if ($newvalue === '') $newvalue = $currvalue; + // $newvalue = trim($newvalue); + $newvalue = cms_field_to_lbf($newvalue, $data_type, $field_id); + *****************************************************************/ + $newvalue = cms_field_to_lbf($data_type, $reskey, $result['fields']); + + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } +} + +$field_id = 'cmsportal_login'; +if (empty($ptrow[$field_id])) { + if ($result['post']['user'] !== '') { + // Registered in portal but still need to record that in openemr. + echo "
" . text($field_title) . "" . generate_display_field($lorow, $currvalue) . ""; + generate_form_field($lorow, $newvalue); + echo "
\n"; + echo "\n"; + } + else { + // Portal registration is needed. + $newvalue = isset($result['fields']['email']) ? trim($result['fields']['email']) : ''; + echo " \n"; + echo " " . xlt('New Portal Login') . "\n"; + echo "  \n"; + echo " "; + echo ""; + echo "  " . xlt('Password') . ": "; + echo ""; + echo ""; + echo "\n"; + echo " \n"; + echo "\n"; + } +} +else { + // Portal login name is already in openemr. + echo "\n"; +} +?> + +

+' /> +  +' onclick="window.back()" /> + +

+ +
+ + + + + + +
+ + + diff --git a/interface/cmsportal/patient_form_ajax.php b/interface/cmsportal/patient_form_ajax.php new file mode 100644 index 000000000..15b205f4d --- /dev/null +++ b/interface/cmsportal/patient_form_ajax.php @@ -0,0 +1,39 @@ + + * + * 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 Rod Roark + */ + +$sanitize_all_escapes = true; +$fake_register_globals = false; + +require_once("../globals.php"); +require_once("$srcdir/formdata.inc.php"); +require_once("portal.inc.php"); + +$result = cms_portal_call(array( + 'action' => 'adduser', + 'newlogin' => $_REQUEST['login'], + 'newpass' => $_REQUEST['pass'], + 'newemail' => $_REQUEST['email'], +)); + +if ($result['errmsg']) { + echo xl('Failed to add patient to portal') . ": " . $result['errmsg']; +} +?> diff --git a/interface/cmsportal/patient_select.php b/interface/cmsportal/patient_select.php new file mode 100644 index 000000000..972c4c1d4 --- /dev/null +++ b/interface/cmsportal/patient_select.php @@ -0,0 +1,224 @@ +;. + * + * @package OpenEMR + * @author Rod Roark + */ + +$sanitize_all_escapes = true; +$fake_register_globals = false; + +require_once("../globals.php"); +require_once("$srcdir/patient.inc"); +require_once("$srcdir/formdata.inc.php"); +require_once("$srcdir/options.inc.php"); +require_once("portal.inc.php"); + +$postid = intval($_REQUEST['postid']); + +if ($postid) { + $result = cms_portal_call(array('action' => 'getpost', 'postid' => $postid)); + if ($result['errmsg']) { + die(text($result['errmsg'])); + } +} +?> + + + + + + + + + + + +
+
+ + 3) { + $clsql .= " + ((ss IS NOT NULL AND ss LIKE ?) * 10)"; + $clarr[] = "%$ssn"; + } + // Zip code makes it unnecessary to match on city and state. + $zip = preg_replace('/[^0-9]/', '', $result['fields']['postal_code']); + $zip = substr($zip, 0, 5); + if (strlen($zip) == 5) { + $clsql .= " + ((postal_code IS NOT NULL AND postal_code LIKE ?) * 2)"; + $clarr[] = "$zip%"; + } + // This generates a REGEXP query that matches the first 2 words of the street address. + if (preg_match('/^\W*(\w+)\W+(\w+)/', $result['fields']['street'], $matches)) { + $clsql .= " + ((street IS NOT NULL AND street REGEXP '^[^[:alnum:]]*"; + $clsql .= $matches[1]; + $clsql .= "[^[:alnum:]]+"; + $clsql .= $matches[2]; + $clsql .= "[[:>:]]') * 2)"; + } + + $sql = "SELECT $clsql AS closeness, " . + "pid, cmsportal_login, fname, lname, mname, DOB, ss, postal_code, " . + "street, phone_biz, phone_home, phone_cell, phone_contact " . + "FROM patient_data " . + "ORDER BY closeness DESC, lname, fname LIMIT 10"; + $res = sqlStatement($sql, $clarr); + + // echo "\n"; // debugging + + $phone = $result['fields']['phone_biz']; + if (empty($phone)) $phone = $result['fields']['phone_home']; + if (empty($phone)) $phone = $result['fields']['phone_cell']; + if (empty($phone)) $phone = $result['fields']['phone_contact']; +?> + +
+ + + + + + + + + + + + + + + + + + +\n"; + echo " " . text($row['cmsportal_login']) . "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } +?> +
" . text($row['lname'] . ", " . $row['fname'] ) . "" . text($phone ) . "" . text($row['ss'] ) . "" . text($row['DOB'] ) . "" . text($row['street'] . ' ' . $row['postal_code']) . "
+
+ + +

+' onclick="openPatient(0)" /> +  +' onclick="myRestoreSession();location='list_requests.php'" /> +

+ +
+
+ + + diff --git a/interface/cmsportal/portal.inc.php b/interface/cmsportal/portal.inc.php new file mode 100644 index 000000000..a2240dea6 --- /dev/null +++ b/interface/cmsportal/portal.inc.php @@ -0,0 +1,98 @@ + + * + * 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 Rod Roark + */ + +// Note: In Ubuntu this requires the php5-curl package. +// http://www.php.net/manual/en/function.curl-setopt.php has many comments and examples. + +if (!$GLOBALS['gbl_portal_cms_enable']) die(xlt('CMS Portal not enabled!')); + +function cms_portal_call($args) { + $portal_url = $GLOBALS['gbl_portal_cms_address'] . "/wp-content/plugins/sunset-patient-portal/webserve.php"; + $args['login' ] = $GLOBALS['gbl_portal_cms_username']; + $args['password'] = $GLOBALS['gbl_portal_cms_password']; + + if (($phandle = curl_init($portal_url)) === FALSE) { + die(text(xl('Unable to access URL') . " '$portal_url'")); + } + curl_setopt($phandle, CURLOPT_POST , TRUE); + curl_setopt($phandle, CURLOPT_RETURNTRANSFER, TRUE); + curl_setopt($phandle, CURLOPT_POSTFIELDS , $args); + if (($presult = curl_exec($phandle)) === FALSE) { + die(text(xl('curl_exec failed') . ': ' . curl_error($phandle))); + } + curl_close($phandle); + // With JSON-over-HTTP we would use json_decode($presult,TRUE) here. + return unserialize($presult); +} + +// Look up the OpenEMR patient matching this request. More or less than 1 is an error. +function lookup_openemr_patient($wp_login) { + if (empty($wp_login)) die(xlt('The patient was not logged in when submitting this form')); + $ptres = sqlStatement("SELECT pid FROM patient_data WHERE cmsportal_login = ?", array($wp_login)); + if (sqlNumRows($ptres) < 1) die(xlt('There is no patient with portal login') . " '$wp_login'"); + if (sqlNumRows($ptres) > 1) die(xlt('There are multiple patients with portal login') . " '$wp_login'"); + $ptrow = sqlFetchArray($ptres); + return $ptrow['pid']; +} + +// This constructs a LBF field value string from form data provided by the portal. +// +function cms_field_to_lbf($data_type, $field_id, &$fldarr) { + $newvalue = ''; + if ($data_type == '23') { + // Type Exam Results is special, pieced together from multiple CMS fields. + // For example layout field "exams" might find CMS fields "exams:brs" = 1 + // and "exams:cec" = 2 and aggregate them into the value "brs:1|cec:2". + foreach ($fldarr as $key => $value) { + if (preg_match('/^' . $field_id . ':(\w+)/', $key, $matches)) { + if ($newvalue !== '') $newvalue .= '|'; + $newvalue .= $matches[1] . ":$value:"; + } + } + } + else { + if (isset($fldarr[$field_id])) $newvalue = $fldarr[$field_id]; + if ($newvalue !== '') { + // Lifestyle Status. + if ($data_type == '28') { + $newvalue = "|$newvalue$field_id|"; + } + // Smoking Status. + else if ($data_type == '32') { + // See the smoking_status list for these array values: + $ssarr = array('current' => 1, 'quit' => 3, 'never' => 4, 'not_applicable' => 9); + $ssindex = isset($ssarr[$newvalue]) ? $ssarr[$newvalue] : 0; + $newvalue = "|$newvalue$field_id||$ssindex"; + } + // Checkbox list. + else if (is_array($newvalue)) { + $tmp = ''; + foreach ($newvalue as $value) { + if ($tmp !== '') $tmp .= '|'; + $tmp .= $value; + } + $newvalue = $tmp; + } + } + } + return $newvalue; +} +?> diff --git a/interface/cmsportal/upload_form.php b/interface/cmsportal/upload_form.php new file mode 100644 index 000000000..4d8fd4904 --- /dev/null +++ b/interface/cmsportal/upload_form.php @@ -0,0 +1,206 @@ + + * + * 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 Rod Roark + */ + +$sanitize_all_escapes = true; +$fake_register_globals = false; + +require_once("../globals.php"); +require_once("$srcdir/formdata.inc.php"); +require_once("$srcdir/classes/Document.class.php"); +require_once("portal.inc.php"); + +// This function builds an array of document categories recursively. +// Borrowed from interface/fax/fax_dispatch.php. +// +function getKittens($catid, $catstring, &$categories) { + $cres = sqlStatement("SELECT id, name FROM categories " . + "WHERE parent = ? ORDER BY name", array($catid)); + $childcount = 0; + while ($crow = sqlFetchArray($cres)) { + ++$childcount; + getKittens($crow['id'], ($catstring ? "$catstring / " : "") . + ($catid ? $crow['name'] : ''), $categories); + } + // If no kitties, then this is a leaf node and should be listed. + if (!$childcount) $categories[$catid] = $catstring; +} + +$postid = empty($_REQUEST['postid' ]) ? 0 : intval($_REQUEST['postid' ]); +$messageid = empty($_REQUEST['messageid']) ? 0 : intval($_REQUEST['messageid']); + +if ($_POST['bn_save']) { + $ptid = intval($_POST['ptid']); + echo "\n"; + if (is_array($_POST['form_filename'])) { + foreach ($_POST['form_filename'] as $uploadid => $filename) { + $catid = $_POST['form_category'][$uploadid]; + if (!$catid) continue; + echo text(sprintf(xl('Fetching %s from portal...'), $filename)) . "
\n"; + flush(); + if ($messageid) { + $result = cms_portal_call(array('action' => 'getmsgup', 'uploadid' => $uploadid)); + } + else { + $result = cms_portal_call(array('action' => 'getupload', 'uploadid' => $uploadid)); + } + if ($result['errmsg']) die(text($result['errmsg'])); + $d = new Document(); + // With JSON-over-HTTP we would need to base64_decode the contents. + $rc = $d->createDocument($ptid, $catid, $filename, $result['mimetype'], + $result['contents']); + if ($rc) die(text(xl('Error saving document') . ": $rc")); + } + } + // Finally, delete the request or message from the portal. + if ($messageid) { + $result = cms_portal_call(array('action' => 'delmessage', 'messageid' => $messageid)); + } + else { + $result = cms_portal_call(array('action' => 'delpost', 'postid' => $postid)); + } + if ($result['errmsg']) { + die(text($result['errmsg'])); + } + echo "\n"; + exit(); +} + +// Get the document categories list. +$categories = array(); +getKittens(0, '', $categories); + +// Get the portal request data. +if (!$postid && !$messageid) die(xlt('Request ID is missing!')); +if ($messageid) { + $result = cms_portal_call(array('action' => 'getmessage', 'messageid' => $messageid)); +} +else { + $result = cms_portal_call(array('action' => 'getpost', 'postid' => $postid)); +} +if ($result['errmsg']) { + die(text($result['errmsg'])); +} + +// Look up the patient in OpenEMR. +$userlogin = $messageid ? $result['message']['user'] : $result['post']['user']; +$ptid = lookup_openemr_patient($userlogin); +?> + + + + + + + + + + + + + + + +
+ +
+ +" . xlt('Message Title') . ": "; + echo htmlspecialchars($result['message']['title']); + echo "

\n"; + echo "\n"; + echo "

"; + echo xlt('This message text is not saved automatically. Copy and save it as appropriate for the content.'); + echo "

\n"; +} +?> + + + + + + + + + + + +\n"; + // MIME type and view link + echo " \n"; + // Desired file name + echo " "; + // Desired document category with option to discard the file + echo " \n"; + // + echo " \n"; + } +} +?> +
" . + text($upload['mimetype']) . "
+ +

+' /> +  +' + onclick="myRestoreSession();location='list_requests.php'" /> +

+ +
+
+ + + diff --git a/interface/cmsportal/upload_form_show.php b/interface/cmsportal/upload_form_show.php new file mode 100644 index 000000000..93b88eb75 --- /dev/null +++ b/interface/cmsportal/upload_form_show.php @@ -0,0 +1,54 @@ + + * + * 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 Rod Roark + */ + +$sanitize_all_escapes = true; +$fake_register_globals = false; + +require_once("../globals.php"); +require_once("$srcdir/formdata.inc.php"); +require_once("portal.inc.php"); + +$uploadid = $_REQUEST['id']; + +if (!empty($_REQUEST['messageid'])) { + $result = cms_portal_call(array('action' => 'getmsgup', 'uploadid' => $uploadid)); +} +else { + $result = cms_portal_call(array('action' => 'getupload', 'uploadid' => $uploadid)); +} +if ($result['errmsg']) { + die(text($result['errmsg'])); +} + +$filesize = strlen($result['contents']); + +header('Content-Description: File Transfer'); +header('Content-Transfer-Encoding: binary'); +header('Expires: 0'); +header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); +header('Pragma: public'); +header("Content-Disposition: attachment; filename=\"{$result['filename']}\""); +header("Content-Type: {$result['mimetype']}"); +header("Content-Length: $filesize"); + +// With JSON-over-HTTP we would need to base64_decode the contents. +echo $result['contents']; + diff --git a/interface/forms/LBF/new.php b/interface/forms/LBF/new.php index e24aaca7d..9c8fd186d 100644 --- a/interface/forms/LBF/new.php +++ b/interface/forms/LBF/new.php @@ -1,5 +1,5 @@ +// Copyright (C) 2009-2014 Rod Roark // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -19,6 +19,9 @@ require_once("$srcdir/options.inc.php"); require_once("$srcdir/patient.inc"); require_once("$srcdir/formdata.inc.php"); require_once("$srcdir/formatting.inc.php"); +if ($GLOBALS['gbl_portal_cms_enable']) { + require_once("$include_root/cmsportal/portal.inc.php"); +} $CPR = 4; // cells per row @@ -74,7 +77,8 @@ function end_group() { } $formname = isset($_GET['formname']) ? $_GET['formname'] : ''; -$formid = 0 + (isset($_GET['id']) ? $_GET['id'] : ''); +$formid = isset($_GET['id'] ) ? intval($_GET['id']) : 0; +$portalid = isset($_GET['portalid']) ? intval($_GET['portalid']) : 0; // Get title and number of history columns for this form. $tmp = sqlQuery("SELECT title, option_value FROM list_options WHERE " . @@ -130,6 +134,14 @@ if ($_POST['bn_save']) { addForm($encounter, $formtitle, $newid, $formname, $pid, $userauthorized); } + if ($portalid) { + // Delete the request from the portal. + $result = cms_portal_call(array('action' => 'delpost', 'postid' => $portalid)); + if ($result['errmsg']) { + die(text($result['errmsg'])); + } + } + formHeader("Redirecting...."); formJump(); formFooter(); @@ -236,21 +248,34 @@ function sel_related() { topmargin="0" rightmargin="0" leftmargin="2" bottommargin="0" marginwidth="2" marginheight="0"> -
\n"; + + $cmsportal_login = ''; + $portalres = FALSE; if (empty($is_lbf)) { - $enrow = sqlQuery("SELECT p.fname, p.mname, p.lname, fe.date FROM " . + $enrow = sqlQuery("SELECT p.fname, p.mname, p.lname, p.cmsportal_login, " . + "fe.date FROM " . "form_encounter AS fe, forms AS f, patient_data AS p WHERE " . - "p.pid = ? AND f.pid = ? AND f.encounter = ? AND " . + "p.pid = ? AND f.pid = p.pid AND f.encounter = ? AND " . "f.formdir = 'newpatient' AND f.deleted = 0 AND " . - "fe.id = f.form_id LIMIT 1", array($pid, $pid, $encounter) ); + "fe.id = f.form_id LIMIT 1", array($pid, $encounter)); echo "

\n"; echo text($formtitle) . " " . xlt('for') . ' '; echo text($enrow['fname']) . ' ' . text($enrow['mname']) . ' ' . text($enrow['lname']); echo ' ' . xlt('on') . ' ' . text(substr($enrow['date'], 0, 10)); echo "

\n"; + $cmsportal_login = $enrow['cmsportal_login']; + } + // If loading data from portal, get the data. + if ($GLOBALS['gbl_portal_cms_enable'] && $portalid) { + $portalres = cms_portal_call(array('action' => 'getpost', 'postid' => $portalid)); + if ($portalres['errmsg']) { + die(text($portalres['errmsg'])); + } } ?> @@ -302,10 +327,23 @@ function sel_related() { if (!empty($pprow)) $currvalue = $pprow['field_value']; } else { - // New form, see if there is a custom default from a plugin. - $fname = $formname . '_default_' . $field_id; - if (function_exists($fname)) { - $currvalue = call_user_func($fname); + // This is a new form. + // Get data from the CMS portal if applicable. + /************************************************************* + if ($portalres && isset($portalres['fields'][$field_id])) { + $currvalue = $portalres['fields'][$field_id]; + $currvalue = cms_field_to_lbf($currvalue, $data_type, $field_id); + } + *************************************************************/ + if ($portalres) { + $currvalue = cms_field_to_lbf($data_type, $field_id, $portalres['fields']); + } + if ($currvalue === '') { + // Still no data. See if there is a custom default from a plugin. + $fname = $formname . '_default_' . $field_id; + if (function_exists($fname)) { + $currvalue = call_user_func($fname); + } } } } @@ -458,7 +496,24 @@ function sel_related() { if (function_exists($formname . '_javascript_onload')) { call_user_func($formname . '_javascript_onload'); } + // TBD: If $alertmsg, display it with a JavaScript alert(). + +// New form and this patient has a portal login and we have not loaded portal data. +// Check if there is portal data pending for this patient and form type. +if (!$formid && $GLOBALS['gbl_portal_cms_enable'] && $cmsportal_login && !$portalid) { + $portalres = cms_portal_call(array('action' => 'checkptform', 'form' => $formname, 'patient' => $cmsportal_login)); + if ($portalres['errmsg']) { + die(text($portalres['errmsg'])); // TBD: Change to alertmsg + } + $portalid = $portalres['postid']; + if ($portalid) { + echo "if (confirm('" . xls('The portal has data for this patient and form. Load it now?') . "')) {\n"; + echo " top.restoreSession();\n"; + echo " document.location.href = 'load_form.php?formname=$formname&portalid=$portalid';\n"; + echo "}\n"; + } +} ?> diff --git a/interface/main/left_nav.php b/interface/main/left_nav.php index 6cc100f13..999cc6569 100644 --- a/interface/main/left_nav.php +++ b/interface/main/left_nav.php @@ -117,6 +117,7 @@ use ESign\Api; 'orc' => array(xl('Proc Load') , 0, 'orders/load_compendium.php'), 'orb' => array(xl('Proc Bat') , 0, 'orders/orders_results.php?batch=1'), 'ore' => array(xl('E-Reports') , 0, 'orders/list_reports.php'), + 'ppo' => array(xl('CMS Portal'), 0, 'cmsportal/list_requests.php'), 'cht' => array(xl('Chart Trk') , 0, '../custom/chart_tracker.php'), 'imp' => array(xl('Import') , 0, '../custom/import.php'), 'bil' => array(xl('Billing') , 0, 'billing/billing_report.php'), @@ -997,6 +998,7 @@ $(document).ready(function(){ $("#navigation-slide > li > a#msg0").prepend(''); $("#navigation-slide > li > a#patimg").prepend(''); $("#navigation-slide > li > a#app0").prepend(''); + $("#navigation-slide > li > a#ppo0").prepend(''); $("#navigation-slide > li > a#repimg").prepend(''); $("#navigation-slide > li > a#feeimg").prepend(''); $("#navigation-slide > li > a#adm0").prepend(''); @@ -1248,6 +1250,13 @@ if ($GLOBALS['athletic_team']) { + +
    • diff --git a/interface/orders/single_order_results.inc.php b/interface/orders/single_order_results.inc.php index 4395653aa..dfc47a4cd 100644 --- a/interface/orders/single_order_results.inc.php +++ b/interface/orders/single_order_results.inc.php @@ -2,7 +2,7 @@ /** * Script to display results for a given procedure order. * -* Copyright (C) 2013 Rod Roark +* Copyright (C) 2013-2014 Rod Roark * * LICENSE: This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -62,7 +62,7 @@ function generate_order_report($orderid, $input_form=false) { $orow = sqlQuery("SELECT " . "po.procedure_order_id, po.date_ordered, " . "po.order_status, po.specimen_type, po.patient_id, " . - "pd.pubpid, pd.lname, pd.fname, pd.mname, " . + "pd.pubpid, pd.lname, pd.fname, pd.mname, pd.cmsportal_login, " . "fe.date, " . "pp.name AS labname, " . "u.lname AS ulname, u.fname AS ufname, u.mname AS umname " . @@ -411,6 +411,15 @@ function showpnotes(orderid) { ' title='' /> +\n"; + echo xlt('Send to portal'); + } +?> diff --git a/interface/orders/single_order_results.php b/interface/orders/single_order_results.php index ca74b2f64..7c9b77e98 100644 --- a/interface/orders/single_order_results.php +++ b/interface/orders/single_order_results.php @@ -2,7 +2,7 @@ /** * Script to display results for a given procedure order. * -* Copyright (C) 2013 Rod Roark +* Copyright (C) 2013-2014 Rod Roark * * LICENSE: This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -46,6 +46,35 @@ if (!empty($_POST['form_sign_list'])) { "procedure_report_id = ?", array($id)); } } + +// This mess generates a PDF report and sends it to the patient. +if (!empty($_POST['form_send_to_portal'])) { + // Borrowing the general strategy here from custom_report.php. + // See also: http://wiki.spipu.net/doku.php?id=html2pdf:en:v3:output + require_once("$srcdir/html2pdf/html2pdf.class.php"); + require_once($GLOBALS["include_root"] . "/cmsportal/portal.inc.php"); + $pdf = new HTML2PDF('P', 'Letter', 'en'); + ob_start(); + echo "\n"; + echo "\n"; + $GLOBALS['PATIENT_REPORT_ACTIVE'] = true; + generate_order_report($orderid, false); + $GLOBALS['PATIENT_REPORT_ACTIVE'] = false; + // echo ob_get_clean(); exit(); // debugging + $pdf->writeHTML(ob_get_clean(), false); + $contents = $pdf->Output('', true); + // Send message with PDF as attachment. + $result = cms_portal_call(array( + 'action' => 'putmessage', + 'user' => $_POST['form_send_to_portal'], + 'title' => xl('Your Lab Results'), + 'message' => xl('Please see the attached PDF.'), + 'filename' => 'results.pdf', + 'mimetype' => 'application/pdf', + 'contents' => base64_encode($contents), + )); + if ($result['errmsg']) die(text($result['errmsg'])); +} ?> diff --git a/interface/patient_file/report/custom_report.php b/interface/patient_file/report/custom_report.php index 846fb09a9..d058c585d 100644 --- a/interface/patient_file/report/custom_report.php +++ b/interface/patient_file/report/custom_report.php @@ -38,11 +38,14 @@ require_once("$srcdir/htmlspecialchars.inc.php"); require_once("$srcdir/formdata.inc.php"); require_once(dirname(__file__) . "/../../../custom/code_types.inc.php"); require_once $GLOBALS['srcdir'].'/ESign/Api.php'; +if ($GLOBALS['gbl_portal_cms_enable']) { + require_once($GLOBALS["include_root"] . "/cmsportal/portal.inc.php"); +} // For those who care that this is the patient report. $GLOBALS['PATIENT_REPORT_ACTIVE'] = true; -$PDF_OUTPUT = empty($_POST['pdf']) ? false : true; +$PDF_OUTPUT = empty($_POST['pdf']) ? 0 : intval($_POST['pdf']); if ($PDF_OUTPUT) { require_once("$srcdir/html2pdf/html2pdf.class.php"); @@ -1021,7 +1024,29 @@ if ($PDF_OUTPUT) { $content = getContent(); // $pdf->setDefaultFont('Arial'); $pdf->writeHTML($content, false); - $pdf->Output('report.pdf', $GLOBALS['pdf_output']); // D = Download, I = Inline + if ($PDF_OUTPUT == 1) { + $pdf->Output('report.pdf', $GLOBALS['pdf_output']); // D = Download, I = Inline + } + else { + // This is the case of writing the PDF as a message to the CMS portal. + $ptdata = getPatientData($pid, 'cmsportal_login'); + $contents = $pdf->Output('', true); + echo "\n"; + echo "\n"; + echo "\n"; + $result = cms_portal_call(array( + 'action' => 'putmessage', + 'user' => $ptdata['cmsportal_login'], + 'title' => xl('Your Clinical Report'), + 'message' => xl('Please see the attached PDF.'), + 'filename' => 'report.pdf', + 'mimetype' => 'application/pdf', + 'contents' => base64_encode($contents), + )); + if ($result['errmsg']) die(text($result['errmsg'])); + echo "

      " . xlt('Report has been sent to the patient.') . "

      \n"; + echo "\n"; + } } else { ?> diff --git a/interface/patient_file/report/patient_report.php b/interface/patient_file/report/patient_report.php index cf83c9329..8053e0fb8 100644 --- a/interface/patient_file/report/patient_report.php +++ b/interface/patient_file/report/patient_report.php @@ -4,6 +4,7 @@ include_once("../../globals.php"); include_once("$srcdir/lists.inc"); include_once("$srcdir/acl.inc"); include_once("$srcdir/forms.inc"); +include_once("$srcdir/patient.inc"); // get various authorization levels $auth_notes_a = acl_check('encounters', 'notes_a'); @@ -14,6 +15,11 @@ $auth_relaxed = acl_check('encounters', 'relaxed'); $auth_med = acl_check('patients' , 'med'); $auth_demo = acl_check('patients' , 'demo'); +$cmsportal = false; +if ($GLOBALS['gbl_portal_cms_enable']) { + $ptdata = getPatientData($pid, 'cmsportal_login'); + $cmsportal = $ptdata['cmsportal_login'] !== ''; +} ?> @@ -212,7 +218,10 @@ function show_date_fun(){
        - +  + + +
      @@ -387,7 +396,10 @@ foreach($registry_form_name as $var) {   - +  + + +
      @@ -416,7 +428,10 @@ while ($result && !$result->EOF) {   - +  + + + @@ -427,6 +442,7 @@ while ($result && !$result->EOF) { $(document).ready(function(){ $(".genreport").click(function() { top.restoreSession(); document.report_form.pdf.value = 0; $("#report_form").submit(); }); $(".genpdfrep").click(function() { top.restoreSession(); document.report_form.pdf.value = 1; $("#report_form").submit(); }); + $(".genportal").click(function() { top.restoreSession(); document.report_form.pdf.value = 2; $("#report_form").submit(); }); $("#genfullreport").click(function() { location.href=''; }); //$("#printform").click(function() { PrintForm(); }); $(".issuecheckbox").click(function() { issueClick(this); }); diff --git a/interface/super/edit_layout.php b/interface/super/edit_layout.php index b94bf5b6f..766939f3c 100644 --- a/interface/super/edit_layout.php +++ b/interface/super/edit_layout.php @@ -42,6 +42,7 @@ $datatypes = array( "13" => xl("Squads"), "14" => xl("Organizations"), "15" => xl("Billing codes"), + "16" => xl("Insurances"), "21" => xl("Checkbox list"), "22" => xl("Textbox list"), "23" => xl("Exam results"), diff --git a/library/globals.inc.php b/library/globals.inc.php index 27ab595a0..097cbf257 100644 --- a/library/globals.inc.php +++ b/library/globals.inc.php @@ -1513,6 +1513,7 @@ $GLOBALS_METADATA = array( 'https://ssh.mydocsportal.com/provider.php', xl('Offsite Https link for the Patient Portal.') ), + 'portal_offsite_address_patient_link' => array( xl('Offsite Patient Portal Site Address (Patient Link)'), 'text', // data type @@ -1520,6 +1521,37 @@ $GLOBALS_METADATA = array( xl('Offsite Https link for the Patient Portal.(Patient Link)') ), + // Currently the "CMS Portal" supports WordPress. Other Content Management + // Systems may be supported in the future. + + 'gbl_portal_cms_enable' => array( + xl('Enable CMS Portal'), + 'bool', // data type + '0', + xl('Enable support for the open source WordPress Portal by Sunset Systems') + ), + + 'gbl_portal_cms_address' => array( + xl('CMS Portal Site Address'), + 'text', // data type + 'https://your_cms_site.com/', + xl('URL for the WordPress site that supports the portal') + ), + + 'gbl_portal_cms_username' => array( + xl('CMS Portal Username'), + 'text', // data type + '', + xl('Login name of WordPress user for portal access') + ), + + 'gbl_portal_cms_password' => array( + xl('CMS Portal Password'), + 'text', // data type + '', + xl('Password for the above user') + ), + ), // Connectors Tab diff --git a/library/options.inc.php b/library/options.inc.php index 521c4856f..52f7e5201 100644 --- a/library/options.inc.php +++ b/library/options.inc.php @@ -34,6 +34,8 @@ require_once("formdata.inc.php"); require_once("formatting.inc.php"); require_once("user.inc"); +require_once("patient.inc"); +require_once("lists.inc"); $date_init = ""; @@ -169,7 +171,7 @@ function generate_select_list($tag_name, $list_id, $currvalue, $title, $empty_na // $currvalue is the current value, if any, of the associated item. // function generate_form_field($frow, $currvalue) { - global $rootdir, $date_init; + global $rootdir, $date_init, $ISSUE_TYPES; $currescaped = htmlspecialchars($currvalue, ENT_QUOTES); @@ -280,15 +282,26 @@ function generate_form_field($frow, $currvalue) { "AND authorized = 1 " . "ORDER BY lname, fname"); echo ""; + if (!$got_selected && strlen($currvalue) > 0) { + echo ""; + echo ""; + echo " " . xlt('Fix this') . "!"; + } + else { + echo ""; + } } // provider list, including address book entries with an NPI number @@ -298,15 +311,26 @@ function generate_form_field($frow, $currvalue) { "AND ( authorized = 1 OR ( username = '' AND npi != '' ) ) " . "ORDER BY lname, fname"); echo ""; + if (!$got_selected && strlen($currvalue) > 0) { + echo ""; + echo ""; + echo " " . xlt('Fix this') . "!"; + } + else { + echo ""; + } } // pharmacy list @@ -421,6 +445,57 @@ function generate_form_field($frow, $currvalue) { " />"; } + // insurance company list + else if ($data_type == 16) { + echo ""; + echo " " . xlt('Fix this') . "!"; + } + else { + echo ""; + } + } + + // issue types + else if ($data_type == 17) { + echo ""; + echo " " . xlt('Fix this') . "!"; + } + else { + echo ""; + } + } + // a set of labeled checkboxes else if ($data_type == 21) { // In this special case, fld_length is the number of columns generated. @@ -814,7 +889,7 @@ function generate_form_field($frow, $currvalue) { } function generate_print_field($frow, $currvalue) { - global $rootdir, $date_init; + global $rootdir, $date_init, $ISSUE_TYPES; $currescaped = htmlspecialchars($currvalue, ENT_QUOTES); @@ -1017,6 +1092,39 @@ function generate_print_field($frow, $currvalue) { echo $tmp; } + // insurance company list + else if ($data_type == 16) { + $tmp = ''; + if ($currvalue) { + $insprovs = getInsuranceProviders(); + foreach ($insprovs as $key => $ipname) { + if ($currvalue == $key) { + $tmp = $ipname; + } + } + if (empty($tmp)) $tmp = "($currvalue)"; + } + if ($tmp === '') $tmp = ' '; + else $tmp = htmlspecialchars($tmp, ENT_QUOTES); + echo $tmp; + } + + // issue types + else if ($data_type == 17) { + $tmp = ''; + if ($currvalue) { + foreach ($ISSUE_TYPES as $key => $value) { + if ($currvalue == $key) { + $tmp = $value[1]; + } + } + if (empty($tmp)) $tmp = "($currvalue)"; + } + if ($tmp === '') $tmp = ' '; + else $tmp = htmlspecialchars($tmp, ENT_QUOTES); + echo $tmp; + } + // a set of labeled checkboxes else if ($data_type == 21) { // In this special case, fld_length is the number of columns generated. @@ -1346,6 +1454,8 @@ function generate_print_field($frow, $currvalue) { } function generate_display_field($frow, $currvalue) { + global $ISSUE_TYPES; + $data_type = $frow['data_type']; $field_id = isset($frow['field_id']) ? $frow['field_id'] : null; $list_id = $frow['list_id']; @@ -1430,6 +1540,25 @@ function generate_display_field($frow, $currvalue) { $s = htmlspecialchars($currvalue,ENT_NOQUOTES); } + // insurance company list + else if ($data_type == 16) { + $insprovs = getInsuranceProviders(); + foreach ($insprovs as $key => $ipname) { + if ($currvalue == $key) { + $s .= htmlspecialchars($ipname, ENT_NOQUOTES); + } + } + } + + // issue types + else if ($data_type == 17) { + foreach ($ISSUE_TYPES as $key => $value) { + if ($currvalue == $key) { + $s .= htmlspecialchars($value[1], ENT_NOQUOTES); + } + } + } + // a set of labeled checkboxes else if ($data_type == 21) { $avalue = explode('|', $currvalue); @@ -1656,6 +1785,8 @@ function generate_display_field($frow, $currvalue) { // More field types might need to be supported here in the future. // function generate_plaintext_field($frow, $currvalue) { + global $ISSUE_TYPES; + $data_type = $frow['data_type']; $field_id = isset($frow['field_id']) ? $frow['field_id'] : null; $list_id = $frow['list_id']; @@ -1717,6 +1848,25 @@ function generate_plaintext_field($frow, $currvalue) { $s = $uname; } + // insurance company list + else if ($data_type == 16) { + $insprovs = getInsuranceProviders(); + foreach ($insprovs as $key => $ipname) { + if ($currvalue == $key) { + $s .= $ipname; + } + } + } + + // insurance company list + else if ($data_type == 17) { + foreach ($ISSUE_TYPES as $key => $value) { + if ($currvalue == $key) { + $s .= $value[1]; + } + } + } + // a set of labeled checkboxes else if ($data_type == 21) { $avalue = explode('|', $currvalue); @@ -2259,37 +2409,37 @@ function display_layout_tabs_data_editable($formtype, $result1, $result2='') { // From the currently posted HTML form, this gets the value of the // field corresponding to the provided layout_options table row. // -function get_layout_form_value($frow) { +function get_layout_form_value($frow, $prefix='form_') { // Bring in $sanitize_all_escapes variable, which will decide // the variable escaping method. global $sanitize_all_escapes; - $maxlength = $frow['max_length']; + $maxlength = empty($frow['max_length']) ? 0 : intval($frow['max_length']); $data_type = $frow['data_type']; $field_id = $frow['field_id']; $value = ''; - if (isset($_POST["form_$field_id"])) { + if (isset($_POST["$prefix$field_id"])) { if ($data_type == 21) { - // $_POST["form_$field_id"] is an array of checkboxes and its keys + // $_POST["$prefix$field_id"] is an array of checkboxes and its keys // must be concatenated into a |-separated string. - foreach ($_POST["form_$field_id"] as $key => $val) { + foreach ($_POST["$prefix$field_id"] as $key => $val) { if (strlen($value)) $value .= '|'; $value .= $key; } } else if ($data_type == 22) { - // $_POST["form_$field_id"] is an array of text fields to be imploded + // $_POST["$prefix$field_id"] is an array of text fields to be imploded // into "key:value|key:value|...". - foreach ($_POST["form_$field_id"] as $key => $val) { + foreach ($_POST["$prefix$field_id"] as $key => $val) { $val = str_replace('|', ' ', $val); if (strlen($value)) $value .= '|'; $value .= "$key:$val"; } } else if ($data_type == 23) { - // $_POST["form_$field_id"] is an array of text fields with companion + // $_POST["$prefix$field_id"] is an array of text fields with companion // radio buttons to be imploded into "key:n:notes|key:n:notes|...". - foreach ($_POST["form_$field_id"] as $key => $val) { + foreach ($_POST["$prefix$field_id"] as $key => $val) { $restype = $_POST["radio_{$field_id}"][$key]; if (empty($restype)) $restype = '0'; $val = str_replace('|', ' ', $val); @@ -2298,9 +2448,9 @@ function get_layout_form_value($frow) { } } else if ($data_type == 25) { - // $_POST["form_$field_id"] is an array of text fields with companion + // $_POST["$prefix$field_id"] is an array of text fields with companion // checkboxes to be imploded into "key:n:notes|key:n:notes|...". - foreach ($_POST["form_$field_id"] as $key => $val) { + foreach ($_POST["$prefix$field_id"] as $key => $val) { $restype = empty($_POST["check_{$field_id}"][$key]) ? '0' : '1'; $val = str_replace('|', ' ', $val); if (strlen($value)) $value .= '|'; @@ -2308,17 +2458,17 @@ function get_layout_form_value($frow) { } } else if ($data_type == 28 || $data_type == 32) { - // $_POST["form_$field_id"] is an date text fields with companion + // $_POST["$prefix$field_id"] is an date text fields with companion // radio buttons to be imploded into "notes|type|date". $restype = $_POST["radio_{$field_id}"]; if (empty($restype)) $restype = '0'; $resdate = str_replace('|', ' ', $_POST["date_$field_id"]); - $resnote = str_replace('|', ' ', $_POST["form_$field_id"]); + $resnote = str_replace('|', ' ', $_POST["$prefix$field_id"]); if ($data_type == 32) { //VicarePlus :: Smoking status data is imploded into "note|type|date|list". - $reslist = str_replace('|', ' ', $_POST["form_$field_id"]); - $res_text_note = str_replace('|', ' ', $_POST["form_text_$field_id"]); + $reslist = str_replace('|', ' ', $_POST["$prefix$field_id"]); + $res_text_note = str_replace('|', ' ', $_POST["{$prefix}text_$field_id"]); $value = "$res_text_note|$restype|$resdate|$reslist"; } else @@ -2337,7 +2487,7 @@ function get_layout_form_value($frow) { } } else { - $value = $_POST["form_$field_id"]; + $value = $_POST["$prefix$field_id"]; } } diff --git a/sql/4_1_2-to-4_1_3_upgrade.sql b/sql/4_1_2-to-4_1_3_upgrade.sql index 8ca886aed..bbbe7f8f0 100644 --- a/sql/4_1_2-to-4_1_3_upgrade.sql +++ b/sql/4_1_2-to-4_1_3_upgrade.sql @@ -163,7 +163,6 @@ UPDATE `layout_options` SET `list_backup_id` = 'ethrace' WHERE `layout_options`. UPDATE `layout_options` SET `data_type` = '36' WHERE `layout_options`.`form_id` = 'DEM' AND `layout_options`.`field_id` = 'race'; UPDATE `layout_options` SET `data_type` = '1', `datacols` = '3' WHERE `layout_options`.`form_id` = 'DEM' AND `layout_options`.`field_id` = 'language'; - #IfNotTable modules CREATE TABLE `modules` ( `mod_id` INT(11) NOT NULL AUTO_INCREMENT, @@ -247,3 +246,17 @@ CREATE TABLE `modules_settings` ( `path` VARCHAR(255) DEFAULT NULL ) ENGINE=InnoDB; #EndIf + +#IfNotRow2D list_options list_id lists option_id insurance_types +INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('lists','insurance_types','Insurance Types',1); +INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('insurance_types','primary' ,'Primary' ,10); +INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('insurance_types','secondary','Secondary',20); +INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('insurance_types','tertiary' ,'Tertiary' ,30); +#EndIf + +#IfMissingColumn patient_data cmsportal_login +ALTER TABLE `patient_data` ADD COLUMN `cmsportal_login` varchar(60) NOT NULL default ''; +INSERT INTO `layout_options` (`form_id`, `field_id`, `group_name`, `title`, `seq`, `data_type`, `uor`, `fld_length`, `max_length`, `list_id`, `titlecols`, `datacols`, `default_value`, `edit_options`, `description`, `fld_rows`) VALUES + ('DEM', 'cmsportal_login', '3Choices', 'CMS Portal Login', 15, 2, 1, 30, 60, '', 1, 1, '', '', 'Login ID for the CMS Patient Portal', 0); +#EndIf + diff --git a/sql/database.sql b/sql/database.sql index 0aea2e943..ace855ff1 100644 --- a/sql/database.sql +++ b/sql/database.sql @@ -2553,6 +2553,7 @@ INSERT INTO `layout_options` VALUES ('DEM', 'allow_imm_reg_use', '3Choices', 'Al INSERT INTO `layout_options` VALUES ('DEM', 'allow_imm_info_share', '3Choices', 'Allow Immunization Info Sharing', 11, 1, 1, 0, 0, 'yesno', 1, 1, '', '', '', 0, ''); INSERT INTO `layout_options` VALUES ('DEM', 'allow_health_info_ex', '3Choices', 'Allow Health Information Exchange', 12, 1, 1, 0, 0, 'yesno', 1, 1, '', '', '', 0, ''); INSERT INTO `layout_options` VALUES ('DEM', 'allow_patient_portal', '3Choices', 'Allow Patient Portal', 13, 1, 1, 0, 0, 'yesno', 1, 1, '', '', '', 0, ''); +INSERT INTO `layout_options` VALUES ('DEM', 'cmsportal_login', '3Choices', 'CMS Portal Login', 15, 2, 1, 30, 60, '', 1, 1, '', '', 'CMS Portal Login ID', 0, ''); INSERT INTO `layout_options` VALUES ('DEM', 'occupation', '4Employer', 'Occupation', 1, 2, 1, 20, 63, '', 1, 1, '', 'C', 'Occupation', 0, ''); INSERT INTO `layout_options` VALUES ('DEM', 'em_name', '4Employer', 'Employer Name', 2, 2, 1, 20, 63, '', 1, 1, '', 'C', 'Employer Name', 0, ''); INSERT INTO `layout_options` VALUES ('DEM', 'em_street', '4Employer', 'Employer Address', 3, 2, 1, 25, 63, '', 1, 1, '', 'C', 'Street and Number', 0, ''); @@ -3689,6 +3690,12 @@ INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('general_issue_lis -- Issue Types List INSERT INTO list_options (`list_id`,`option_id`,`title`) VALUES ('lists','issue_types','Issue Types'); +-- Insurance Types List +INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('lists','insurance_types','Insurance Types',1); +INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('insurance_types','primary' ,'Primary' ,10); +INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('insurance_types','secondary','Secondary',20); +INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`) VALUES ('insurance_types','tertiary' ,'Tertiary' ,30); + -- -------------------------------------------------------- -- @@ -4241,6 +4248,7 @@ CREATE TABLE `patient_data` ( `deceased_date` datetime default NULL, `deceased_reason` varchar(255) NOT NULL default '', `soap_import_status` TINYINT(4) DEFAULT NULL COMMENT '1-Prescription Press 2-Prescription Import 3-Allergy Press 4-Allergy Import', + `cmsportal_login` varchar(60) NOT NULL default '', UNIQUE KEY `pid` (`pid`), KEY `id` (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 ; diff --git a/version.php b/version.php index 668a90f4e..2f82d373a 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 = 107; +$v_database = 108; // 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