Skip to content

Commit

Permalink
Second step in refactoring/integrating the amc rules for MU2.
Browse files Browse the repository at this point in the history
-Also a bug fix for the AMC toggles on the encounter gui
-Also bug fixes in the AMC Tracking report.
  • Loading branch information
bradymiller committed Dec 6, 2015
1 parent 841b17a commit c1ebac8
Show file tree
Hide file tree
Showing 23 changed files with 271 additions and 219 deletions.
201 changes: 97 additions & 104 deletions interface/patient_file/encounter/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,103 @@
}
}
);

$(".onerow").mouseover(function() { $(this).toggleClass("highlight"); });
$(".onerow").mouseout(function() { $(this).toggleClass("highlight"); });
$(".onerow").click(function() { GotoForm(this); });

$("#prov_edu_res").click(function() {
if ( $('#prov_edu_res').attr('checked') ) {
var mode = "add";
}
else {
var mode = "remove";
}
top.restoreSession();
$.post( "../../../library/ajax/amc_misc_data.php",
{ amc_id: "patient_edu_amc",
complete: true,
mode: mode,
patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
object_category: "form_encounter",
object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
}
);
});

$("#provide_sum_pat_flag").click(function() {
if ( $('#provide_sum_pat_flag').attr('checked') ) {
var mode = "add";
}
else {
var mode = "remove";
}
top.restoreSession();
$.post( "../../../library/ajax/amc_misc_data.php",
{ amc_id: "provide_sum_pat_amc",
complete: true,
mode: mode,
patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
object_category: "form_encounter",
object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
}
);
});

$("#trans_trand_care").click(function() {
if ( $('#trans_trand_care').attr('checked') ) {
var mode = "add";
// Enable the reconciliation checkbox
$("#med_reconc_perf").removeAttr("disabled");
}
else {
var mode = "remove";
//Disable the reconciliation checkbox (also uncheck it if applicable)
$("#med_reconc_perf").attr("disabled", true);
$("#med_reconc_perf").removeAttr("checked");
}
top.restoreSession();
$.post( "../../../library/ajax/amc_misc_data.php",
{ amc_id: "med_reconc_amc",
complete: false,
mode: mode,
patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
object_category: "form_encounter",
object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
}
);
});

$("#med_reconc_perf").click(function() {
if ( $('#med_reconc_perf').attr('checked') ) {
var mode = "complete";
}
else {
var mode = "uncomplete";
}
top.restoreSession();
$.post( "../../../library/ajax/amc_misc_data.php",
{ amc_id: "med_reconc_amc",
complete: true,
mode: mode,
patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
object_category: "form_encounter",
object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
}
);
});

// $(".deleteme").click(function(evt) { deleteme(); evt.stopPropogation(); });

var GotoForm = function(obj) {
var parts = $(obj).attr("id").split("~");
top.restoreSession();
<?php if ($GLOBALS['concurrent_layout']): ?>
parent.location.href = "<?php echo $rootdir; ?>/patient_file/encounter/view_form.php?formname="+parts[0]+"&id="+parts[1];
<?php else: ?>
top.Main.location.href = "<?php echo $rootdir; ?>/patient_file/encounter/view_form.php?formname="+parts[0]+"&id="+parts[1];
<?php endif; ?>
}
});

// Process click on Delete link.
Expand Down Expand Up @@ -500,108 +597,4 @@ function divtoggle(spanid, divid) {
</div> <!-- end large encounter_forms DIV -->
</body>

<script language="javascript">
// jQuery stuff to make the page a little easier to use

$(document).ready(function(){
$(".onerow").mouseover(function() { $(this).toggleClass("highlight"); });
$(".onerow").mouseout(function() { $(this).toggleClass("highlight"); });
$(".onerow").click(function() { GotoForm(this); });

$("#prov_edu_res").click(function() {
if ( $('#prov_edu_res').attr('checked') ) {
var mode = "add";
}
else {
var mode = "remove";
}
top.restoreSession();
$.post( "../../../library/ajax/amc_misc_data.php",
{ amc_id: "patient_edu_amc",
complete: true,
mode: mode,
patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
object_category: "form_encounter",
object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
}
);
});

$("#provide_sum_pat_flag").click(function() {
if ( $('#provide_sum_pat_flag').attr('checked') ) {
var mode = "add";
}
else {
var mode = "remove";
}
top.restoreSession();
$.post( "../../../library/ajax/amc_misc_data.php",
{ amc_id: "provide_sum_pat_amc",
complete: true,
mode: mode,
patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
object_category: "form_encounter",
object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
}
);
});

$("#trans_trand_care").click(function() {
if ( $('#trans_trand_care').attr('checked') ) {
var mode = "add";
// Enable the reconciliation checkbox
$("#med_reconc_perf").removeAttr("disabled");
}
else {
var mode = "remove";
//Disable the reconciliation checkbox (also uncheck it if applicable)
$("#med_reconc_perf").attr("disabled", true);
$("#med_reconc_perf").removeAttr("checked");
}
top.restoreSession();
$.post( "../../../library/ajax/amc_misc_data.php",
{ amc_id: "med_reconc_amc",
complete: false,
mode: mode,
patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
object_category: "form_encounter",
object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
}
);
});

$("#med_reconc_perf").click(function() {
if ( $('#med_reconc_perf').attr('checked') ) {
var mode = "complete";
}
else {
var mode = "uncomplete";
}
top.restoreSession();
$.post( "../../../library/ajax/amc_misc_data.php",
{ amc_id: "med_reconc_amc",
complete: true,
mode: mode,
patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
object_category: "form_encounter",
object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
}
);
});

// $(".deleteme").click(function(evt) { deleteme(); evt.stopPropogation(); });

var GotoForm = function(obj) {
var parts = $(obj).attr("id").split("~");
top.restoreSession();
<?php if ($GLOBALS['concurrent_layout']): ?>
parent.location.href = "<?php echo $rootdir; ?>/patient_file/encounter/view_form.php?formname="+parts[0]+"&id="+parts[1];
<?php else: ?>
top.Main.location.href = "<?php echo $rootdir; ?>/patient_file/encounter/view_form.php?formname="+parts[0]+"&id="+parts[1];
<?php endif; ?>
}
});

</script>

</html>
41 changes: 37 additions & 4 deletions interface/patient_file/transaction/add_transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,15 @@
// Set the AMC sent records flag
if (!(empty($_POST['send_sum_flag']))) {
// add the sent records flag
processAmcCall('send_sum_amc', true, 'add', $pid, 'transactions', $transid);
processAmcCall('send_sum_amc', true, 'add', $pid, 'transactions', $transid);
if (!(empty($_POST['send_sum_elec_flag']))) {
processAmcCall('send_sum_elec_amc', true, 'add', $pid, 'transactions', $transid);
}
}
else {
// remove the sent records flag
// remove the sent records flags
processAmcCall('send_sum_amc', true, 'remove', $pid, 'transactions', $transid);
processAmcCall('send_sum_elec_amc', true, 'remove', $pid, 'transactions', $transid);
}

if ($GLOBALS['concurrent_layout'])
Expand Down Expand Up @@ -165,6 +169,20 @@ function end_group() {

var mypcc = '<?php echo htmlspecialchars( $GLOBALS['phone_country_code'], ENT_QUOTES); ?>';

$(document).ready(function(){
$("#send_sum_flag").click(function() {
if ( $('#send_sum_flag').attr('checked') ) {
// Enable the send_sum_elec_flag checkbox
$("#send_sum_elec_flag").removeAttr("disabled");
}
else {
//Disable the send_sum_elec_flag checkbox (also uncheck it if applicable)
$("#send_sum_elec_flag").attr("disabled", true);
$("#send_sum_elec_flag").removeAttr("checked");
}
});
});

function titleChanged() {
var sel = document.forms[0].title;
// Layouts must not interfere with each other. Reload the document in Add mode.
Expand Down Expand Up @@ -302,15 +320,30 @@ function submitme() {
<?php if ($GLOBALS['enable_amc_prompting'] && 'LBTref' == $form_id) { ?>
<div style='float:right;margin-right:25px;border-style:solid;border-width:1px;'>
<div style='float:left;margin:5px 5px 5px 5px;'>
<?php // Display the send records checkbox (AMC prompting)

<?php // Display the send records checkboxes (AMC prompting)
$itemAMC = amcCollect("send_sum_amc", $pid, 'transactions', $transid);
$itemAMC_elec = amcCollect("send_sum_elec_amc", $pid, 'transactions', $transid);
?>

<?php if (!(empty($itemAMC))) { ?>
<input type="checkbox" id="send_sum_flag" name="send_sum_flag" checked>
<?php } else { ?>
<input type="checkbox" id="send_sum_flag" name="send_sum_flag">
<?php } ?>
<span class="text"><?php echo xl('Sent Medical Records?') ?></span><br>

<span class="text"><?php echo xlt('Sent Summary of Care?') ?></span><br>

<?php if (!(empty($itemAMC)) && !(empty($itemAMC_elec))) { ?>
&nbsp;&nbsp;<input type="checkbox" id="send_sum_elec_flag" name="send_sum_elec_flag" checked>
<?php } else if (!(empty($itemAMC))) { ?>
&nbsp;&nbsp;<input type="checkbox" id="send_sum_elec_flag" name="send_sum_elec_flag">
<?php } else { ?>
&nbsp;&nbsp;<input type="checkbox" id="send_sum_elec_flag" name="send_sum_elec_flag" disabled>
<?php } ?>

<span class="text"><?php echo xlt('Sent Summary of Care Electronically?') ?></span><br>

</div>
</div>
<?php } ?>
Expand Down
51 changes: 43 additions & 8 deletions interface/reports/amc_tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
});

function send_sum(patient_id,transaction_id) {
if ( $('#send_sum_flag').attr('checked') ) {
if ( $('#send_sum_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
var mode = "add";
}
else {
Expand All @@ -71,8 +71,32 @@ function send_sum(patient_id,transaction_id) {
);
}

function send_sum_elec(patient_id,transaction_id) {
if ( $('#send_sum_elec_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
if ( !$('#send_sum_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
$('#send_sum_elec_flag_' + patient_id + '_' + transaction_id).removeAttr("checked");
alert("<?php echo xls('Can not set this unless the Summary of Care Sent toggle is set.'); ?>");
return false;
}
var mode = "add";
}
else {
var mode = "remove";
}
top.restoreSession();
$.post( "../../library/ajax/amc_misc_data.php",
{ amc_id: "send_sum_elec_amc",
complete: true,
mode: mode,
patient_id: patient_id,
object_category: "transactions",
object_id: transaction_id
}
);
}

function provide_rec_pat(patient_id,date_created) {
if ( $('#provide_rec_pat_flag').attr('checked') ) {
if ( $('#provide_rec_pat_flag_' + patient_id ).attr('checked') ) {
var mode = "complete_safe";
}
else {
Expand All @@ -90,7 +114,7 @@ function provide_rec_pat(patient_id,date_created) {
}

function provide_sum_pat(patient_id,encounter_id) {
if ( $('#provide_sum_pat_flag').attr('checked') ) {
if ( $('#provide_sum_pat_flag_' + patient_id + '_' + encounter_id).attr('checked') ) {
var mode = "add";
}
else {
Expand Down Expand Up @@ -310,15 +334,25 @@ function provide_sum_pat(patient_id,encounter_id) {
</th>

<th>
<?php
if ($rule == "send_sum_amc" || $rule == "provide_rec_pat_amc") {
<?php
if ($rule == "provide_rec_pat_amc") {
echo htmlspecialchars( xl('Medical Records Sent'), ENT_NOQUOTES);
}
else if ($rule == "send_sum_amc") {
echo htmlspecialchars( xl('Summary of Care Sent'), ENT_NOQUOTES);
}
else { // $rule == "provide_sum_pat_amc"
echo htmlspecialchars( xl('Medical Summary Given'), ENT_NOQUOTES);
}
?>
</th>
<?php
if ($rule == "send_sum_amc") {
echo "<th>";
echo htmlspecialchars( xl('Summary of Care Sent Electronically'), ENT_NOQUOTES);
echo "<th>";
}
?>

</thead>
<tbody> <!-- added for better print-ability -->
Expand All @@ -343,13 +377,14 @@ function provide_sum_pat(patient_id,encounter_id) {
}

if ($rule == "send_sum_amc") {
echo "<td><input type='checkbox' id='send_sum_flag' onclick='send_sum(\"".htmlspecialchars($result['pid'],ENT_QUOTES)."\",\"".htmlspecialchars($result['id'],ENT_QUOTES)."\")'>" . htmlspecialchars( xl('Yes'), ENT_NOQUOTES) . "</td>";
echo "<td><input type='checkbox' id='send_sum_flag_".attr($result['pid'])."_".attr($result['id'])."' onclick='send_sum(\"".htmlspecialchars($result['pid'],ENT_QUOTES)."\",\"".htmlspecialchars($result['id'],ENT_QUOTES)."\")'>" . htmlspecialchars( xl('Yes'), ENT_NOQUOTES) . "</td>";
echo "<td><input type='checkbox' id='send_sum_elec_flag_".attr($result['pid'])."_".attr($result['id'])."' onclick='send_sum_elec(\"".htmlspecialchars($result['pid'],ENT_QUOTES)."\",\"".htmlspecialchars($result['id'],ENT_QUOTES)."\")'>" . htmlspecialchars( xl('Yes'), ENT_NOQUOTES) . "</td>";
}
else if ($rule == "provide_rec_pat_amc") {
echo "<td><input type='checkbox' id='provide_rec_pat_flag' onclick='provide_rec_pat(\"".htmlspecialchars($result['pid'],ENT_QUOTES)."\",\"".htmlspecialchars($result['date'],ENT_QUOTES)."\")'>" . htmlspecialchars( xl('Yes'), ENT_NOQUOTES) . "</td>";
echo "<td><input type='checkbox' id='provide_rec_pat_flag_".attr($result['pid'])."' onclick='provide_rec_pat(\"".htmlspecialchars($result['pid'],ENT_QUOTES)."\",\"".htmlspecialchars($result['date'],ENT_QUOTES)."\")'>" . htmlspecialchars( xl('Yes'), ENT_NOQUOTES) . "</td>";
}
else { //$rule == "provide_sum_pat_amc"
echo "<td><input type='checkbox' id='provide_sum_pat_flag' onclick='provide_sum_pat(\"".htmlspecialchars($result['pid'],ENT_QUOTES)."\",\"".htmlspecialchars($result['id'],ENT_QUOTES)."\")'>" . htmlspecialchars( xl('Yes'), ENT_NOQUOTES) . "</td>";
echo "<td><input type='checkbox' id='provide_sum_pat_flag_".attr($result['pid'])."_".attr($result['id'])."' onclick='provide_sum_pat(\"".htmlspecialchars($result['pid'],ENT_QUOTES)."\",\"".htmlspecialchars($result['id'],ENT_QUOTES)."\")'>" . htmlspecialchars( xl('Yes'), ENT_NOQUOTES) . "</td>";
}
echo "</tr>";
}
Expand Down

0 comments on commit c1ebac8

Please sign in to comment.