Permalink
Browse files

final mu2 changes by Visolve for certification, take 2.

  • Loading branch information...
1 parent e7d6310 commit 60c6b978d533397bc0081feb543b0cbc9f40319f Saravanan Rathinakumar committed with bradymiller Oct 12, 2016
@@ -1225,13 +1225,15 @@ function tag_action_process($patient_id="", $document_id) {
$formID = sqlInsert($query,$bindArray);
addForm($encounter, "New Patient Encounter",$formID,"newpatient", $patient_id, "1", date("Y-m-d H:i:s"), $username );
$d->set_encounter_id($encounter);
+ $this->image_result_indication($d->id, $encounter);
} else {
$d->set_encounter_id($encounter_id);
+ $this->image_result_indication($d->id, $encounter_id);
}
$d->set_encounter_check($encounter_check);
$d->persist();
-
+
$messages .= xlt('Document tagged to Encounter successfully') . "<br>";
}
@@ -1247,7 +1249,7 @@ function image_procedure_action($patient_id="",$document_id){
$proc_code = $_POST['procedure_code'];
if(is_numeric($document_id)){
-
+
$img_order = sqlQuery("select * from procedure_order_code where procedure_order_id = ? and procedure_code = ? ",array($img_procedure_id,$proc_code));
$img_report = sqlQuery("select * from procedure_report where procedure_order_id = ? and procedure_order_seq = ? ",array($img_procedure_id,$img_order['procedure_order_seq']));
$img_report_id = !empty($img_report['procedure_report_id']) ? $img_report['procedure_report_id'] : 0;
@@ -1260,6 +1262,8 @@ function image_procedure_action($patient_id="",$document_id){
if(empty($img_result)){
sqlInsert("INSERT INTO procedure_result(procedure_report_id,date,document_id,result_status) values(?,?,?,'final')",array($img_report_id,date('Y-m-d H:i:s'),$document_id));
}
+
+ $this->image_result_indication($document_id, 0,$img_procedure_id);
}
return $this->view_action($patient_id, $document_id);
}
@@ -1283,5 +1287,24 @@ function get_mapped_procedure($document_id){
return $map;
}
+function image_result_indication($doc_id,$encounter,$image_procedure_id = 0){
+ $doc_notes = sqlQuery("select note from notes where foreign_id = ?",array($doc_id));
+ $narration = isset($doc_notes['note']) ? 'With Narration': 'Without Narration';
+
+ if($encounter != 0) {
+ $ep = sqlQuery("select u.username as assigned_to from form_encounter inner join users u on u.id = provider_id where encounter = ?",array($encounter));
+ }
+ else if($image_procedure_id != 0){
+ $ep = sqlQuery("select u.username as assigned_to from procedure_order inner join users u on u.id = provider_id where procedure_order_id = ?",array($image_procedure_id));
+ }
+ else{
+ $ep = array('assigned_to' => $_SESSION['authUser']);
+ }
+
+ $encounter_provider = isset($ep['assigned_to']) ? $ep['assigned_to'] : $_SESSION['authUser'];
+ $noteid = addPnote($_SESSION['pid'],'New Image Report received '.$narration,0,1,'Image Results',$encounter_provider,'','New','');
+ setGpRelation(1, $doc_id, 6, $noteid);
+}
+
}
?>
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -124,7 +124,9 @@ function setpatient(pid, lname, fname, dob) {
<?php
$sortby = formData('sortby','G') ;
+$direction = formData('direction','G') ;
?>
+<input type="hidden" name="direction" id="direction" value="<?php echo !empty($direction) ? $direction : 'asc'; ?>">
<input type="hidden" name="sortby" id="sortby" value="<?php echo $sortby; ?>">
<input type=hidden name=csum value="">
<table>
@@ -253,6 +255,14 @@ function setpatient(pid, lname, fname, dob) {
<input type=hidden name="event" value=<?php echo $event ; ?>>
<a href="javascript:document.theform.submit();" class='link_submit'>[<?php xl('Refresh','e'); ?>]</a>
</td>
+<td>
+<div id='valid_button'>
+<input type=button id='validate_log' onclick='validatelog();' value='<?php echo xla('Validate Log'); ?>'></input>
+</div>
+<div id='log_loading' style="display: none">
+<img src='../../images/loading.gif'/>
+</div>
+</td>
</tr>
</table>
</FORM>
@@ -263,16 +273,17 @@ function setpatient(pid, lname, fname, dob) {
<table>
<tr>
<!-- <TH><?php xl('Date', 'e'); ?><TD> -->
- <th id="sortby_date" class="text" title="<?php xl('Sort by date/time','e'); ?>"><?php xl('Date','e'); ?></th>
- <th id="sortby_event" class="text" title="<?php xl('Sort by Event','e'); ?>"><?php xl('Event','e'); ?></th>
- <th id="sortby_user" class="text" title="<?php xl('Sort by User','e'); ?>"><?php xl('User','e'); ?></th>
- <th id="sortby_cuser" class="text" title="<?php xl('Sort by Crt User','e'); ?>"><?php xl('Certificate User','e'); ?></th>
- <th id="sortby_group" class="text" title="<?php xl('Sort by Group','e'); ?>"><?php xl('Group','e'); ?></th>
- <th id="sortby_pid" class="text" title="<?php xl('Sort by PatientID','e'); ?>"><?php xl('PatientID','e'); ?></th>
- <th id="sortby_success" class="text" title="<?php xl('Sort by Success','e'); ?>"><?php xl('Success','e'); ?></th>
- <th id="sortby_comments" class="text" title="<?php xl('Sort by Comments','e'); ?>"><?php xl('Comments','e'); ?></th>
+ <th id="sortby_date" class="text sortby" title="<?php xl('Sort by date/time','e'); ?>"><?php xl('Date','e'); ?></th>
+ <th id="sortby_event" class="text sortby" title="<?php xl('Sort by Event','e'); ?>"><?php xl('Event','e'); ?></th>
+ <th id="sortby_category" class="text sortby" title="<?php xl('Sort by Category','e'); ?>"><?php xl('Category','e'); ?></th>
+ <th id="sortby_user" class="text sortby" title="<?php xl('Sort by User','e'); ?>"><?php xl('User','e'); ?></th>
+ <th id="sortby_cuser" class="text sortby" title="<?php xl('Sort by Crt User','e'); ?>"><?php xl('Certificate User','e'); ?></th>
+ <th id="sortby_group" class="text sortby" title="<?php xl('Sort by Group','e'); ?>"><?php xl('Group','e'); ?></th>
+ <th id="sortby_pid" class="text sortby" title="<?php xl('Sort by PatientID','e'); ?>"><?php xl('PatientID','e'); ?></th>
+ <th id="sortby_success" class="text sortby" title="<?php xl('Sort by Success','e'); ?>"><?php xl('Success','e'); ?></th>
+ <th id="sortby_comments" class="text sortby" title="<?php xl('Sort by Comments','e'); ?>"><?php xl('Comments','e'); ?></th>
<?php if($check_sum) {?>
- <th id="sortby_checksum" class="text" title="<?php xl('Sort by Checksum','e'); ?>"><?php xl('Checksum','e'); ?></th>
+ <th id="sortby_checksum" class="text sortby" title="<?php xl('Sort by Checksum','e'); ?>"><?php xl('Checksum','e'); ?></th>
<?php } ?>
</tr>
<?php
@@ -299,7 +310,7 @@ function setpatient(pid, lname, fname, dob) {
else
{$gev = $getevent;}
-if ($ret = getEvents(array('sdate' => $get_sdate,'edate' => $get_edate, 'user' => $form_user, 'patient' => $form_pid, 'sortby' => $_GET['sortby'], 'levent' =>$gev, 'tevent' =>$tevent))) {
+if ($ret = getEvents(array('sdate' => $get_sdate,'edate' => $get_edate, 'user' => $form_user, 'patient' => $form_pid, 'sortby' => $_GET['sortby'], 'levent' =>$gev, 'tevent' =>$tevent,'direction' => $_GET['direction']))) {
foreach ($ret as $iter) {
@@ -325,6 +336,7 @@ function setpatient(pid, lname, fname, dob) {
<TR class="oneresult">
<TD class="text"><?php echo oeFormatShortDate(substr($iter["date"], 0, 10)) . substr($iter["date"], 10) ?></TD>
<TD class="text"><?php echo preg_replace('/select$/','Query',$iter["event"]); //Convert select term to Query for MU2 requirements ?></TD>
+ <TD class="text"><?php echo $iter["category"]?></TD>
<TD class="text"><?php echo $iter["user"]?></TD>
<TD class="text"><?php echo $iter["crt_user"]?></TD>
<TD class="text"><?php echo $iter["groupname"]?></TD>
@@ -350,6 +362,7 @@ function setpatient(pid, lname, fname, dob) {
<TR class="oneresult">
<TD class="text"><?php echo htmlspecialchars(oeFormatShortDate(substr($iter["date"], 0, 10)) . substr($iter["date"], 10),ENT_NOQUOTES); ?></TD>
<TD class="text"><?php echo htmlspecialchars(xl($iter["event"]),ENT_NOQUOTES);?></TD>
+ <TD class="text"><?php echo htmlspecialchars(xl($iter["category"]),ENT_NOQUOTES);?></TD>
<TD class="text"><?php echo htmlspecialchars($iter["user"],ENT_NOQUOTES);?></TD>
<TD class="text"><?php echo htmlspecialchars($iter["crt_user"],ENT_NOQUOTES);?></TD>
<TD class="text"><?php echo htmlspecialchars($iter["groupname"],ENT_NOQUOTES);?></TD>
@@ -387,22 +400,63 @@ function setpatient(pid, lname, fname, dob) {
$(".oneresult").mouseout(function() { $(this).toggleClass("highlight"); $(this).children().toggleClass("highlight"); });
// click-able column headers to sort the list
- $("#sortby_date").click(function() { $("#sortby").val("date"); $("#theform").submit(); });
- $("#sortby_event").click(function() { $("#sortby").val("event"); $("#theform").submit(); });
- $("#sortby_user").click(function() { $("#sortby").val("user"); $("#theform").submit(); });
- $("#sortby_cuser").click(function() { $("#sortby").val("user"); $("#theform").submit(); });
- $("#sortby_group").click(function() { $("#sortby").val("groupname"); $("#theform").submit(); });
- $("#sortby_pid").click(function() { $("#sortby").val("patient_id"); $("#theform").submit(); });
- $("#sortby_success").click(function() { $("#sortby").val("success"); $("#theform").submit(); });
- $("#sortby_comments").click(function() { $("#sortby").val("comments"); $("#theform").submit(); });
- $("#sortby_checksum").click(function() { $("#sortby").val("checksum"); $("#theform").submit(); });
+ $('.sortby')
+ $("#sortby_date").click(function() { set_sort_direction(); $("#sortby").val("date"); $("#theform").submit(); });
+ $("#sortby_event").click(function() { set_sort_direction(); $("#sortby").val("event"); $("#theform").submit(); });
+ $("#sortby_category").click(function() { set_sort_direction(); $("#sortby").val("category"); $("#theform").submit(); });
+ $("#sortby_user").click(function() { set_sort_direction(); $("#sortby").val("user"); $("#theform").submit(); });
+ $("#sortby_cuser").click(function() { set_sort_direction(); $("#sortby").val("user"); $("#theform").submit(); });
+ $("#sortby_group").click(function() { set_sort_direction(); $("#sortby").val("groupname"); $("#theform").submit(); });
+ $("#sortby_pid").click(function() { set_sort_direction(); $("#sortby").val("patient_id"); $("#theform").submit(); });
+ $("#sortby_success").click(function() { set_sort_direction(); $("#sortby").val("success"); $("#theform").submit(); });
+ $("#sortby_comments").click(function() { set_sort_direction(); $("#sortby").val("comments"); $("#theform").submit(); });
+ $("#sortby_checksum").click(function() { set_sort_direction(); $("#sortby").val("checksum"); $("#theform").submit(); });
});
+function set_sort_direction(){
+ if($('#direction').val() == 'asc')
+ $('#direction').val('desc');
+ else
+ $('#direction').val('asc');
+}
+
+
/* required for popup calendar */
Calendar.setup({inputField:"start_date", ifFormat:"%Y-%m-%d %H:%M:%S", button:"img_begin_date", showsTime:true});
Calendar.setup({inputField:"end_date", ifFormat:"%Y-%m-%d %H:%M:%S", button:"img_end_date", showsTime:true});
+function validatelog(){
+ var img = document.getElementById('log_loading');
+ var btn = document.getElementById('valid_button');
+ if(img){
+ if(img.style.display == "block"){
+ return false;
+ }
+ img.style.display = "block";
+ if(btn){btn.style.display = "none"}
+ }
+ $.ajax({
+ url:"../../library/log_validation.php",
+ asynchronous : true,
+ method: "post",
+ success :function(response){
+ if(img){
+ img.style.display="none";
+ if(btn){btn.style.display="block";}
+ }
+ alert(response);
+ },
+ failure :function(){
+ if(img){
+ img.style.display="none";
+ if(btn){btn.style.display="block";}
+ }
+ alert('<?php echo xls("Audit Log Validation Failed"); ?>');
+ }
+ });
+
+}
</script>
</html>
@@ -536,6 +536,8 @@ function gzopen($filename, $mode, $use_include_path = 0)
$res=sqlStatement("rename table log_comment_encrypt to log_comment_encrypt_backup,log_comment_encrypt_new to log_comment_encrypt");
$res=sqlStatement("create table if not exists log_new like log");
$res=sqlStatement("rename table log to log_backup,log_new to log");
+$res=sqlStatement("create table if not exists log_validator_new like log_validator");
+$res=sqlStatement("rename table log_validator to log_validator_backup, log_validator_new to log_validator");
echo "<br>";
$cmd = "$mysql_dump_cmd -u " . escapeshellarg($sqlconf["login"]) .
" -p" . escapeshellarg($sqlconf["pass"]) .
@@ -573,13 +575,16 @@ function gzopen($filename, $mode, $use_include_path = 0)
$res=sqlStatement("rename table log_comment_encrypt_backup to log_comment_encrypt");
$res=sqlStatement("drop table if exists log");
$res=sqlStatement("rename table log_backup to log");
+ $res=sqlStatement("drop table if exists log_validator");
+ $res=sqlStatement("rename table log_validator_backup to log_validator");
}
die("\"$cmd\" returned $tmp2: $tmp0");
}
// ViSolve: If the Eventlog is set, then clear the temporary table -- Start here
if ($eventlog==1) {
$res=sqlStatement("drop table if exists log_backup");
$res=sqlStatement("drop table if exists log_comment_encrypt_backup");
+ $res=sqlStatement("drop table if exists log_validator_backup");
echo "<br><b>";
echo xl('Backup Successfully taken in')." ";
echo $BACKUP_EVENTLOG_DIR;
@@ -1,23 +1,28 @@
#/bin/bash
# $1 - mysql user $2 mysql password $3 mysql Database $4 Log backup directory
-# Create temp tables as that of Eventlog and log_comment_encrypt
+# Create temp tables as that of Eventlog and log_comment_encrypt and log_validator
mysql -u $1 -p$2 -D $3 -e "create table if not exists log_comment_encrypt_new like log_comment_encrypt"
mysql -u $1 -p$2 -D $3 -e "create table if not exists log_new like log"
+mysql -u $1 -p$2 -D $3 -e "create table if not exists log_validator_new like log_validator"
# Rename the existing tables to backup & New tables to Event tables
mysql -u $1 -p$2 -D $3 -e "rename table log_comment_encrypt to log_comment_encrypt_backup,log_comment_encrypt_new to log_comment_encrypt"
mysql -u $1 -p$2 -D $3 -e "rename table log to log_backup,log_new to log"
+mysql -u $1 -p$2 -D $3 -e "rename table log_validator to log_validator_backup,log_validator_new to log_validator"
# Dump the Backup tables
-mysqldump -u $1 -p$2 --opt --quote-names -r $4 $3 --tables log_comment_encrypt_backup log_backup
+mysqldump -u $1 -p$2 --opt --quote-names -r $4 $3 --tables log_comment_encrypt_backup log_backup log_validator_backup
if [ $? -eq 0 ]
then
# After Successful dumping, drop the Backup tables
mysql -u $1 -p$2 -D $3 -e "drop table if exists log_comment_encrypt_backup"
mysql -u $1 -p$2 -D $3 -e "drop table if exists log_backup"
+mysql -u $1 -p$2 -D $3 -e "drop table if exists log_validator_backup"
else
# If dumping fails, then restore the previous state
mysql -u $1 -p$2 -D $3 -e "drop table if exists log_comment_encrypt"
mysql -u $1 -p$2 -D $3 -e "rename table log_comment_encrypt_backup to log_comment_encrypt"
mysql -u $1 -p$2 -D $3 -e "drop table if exists log"
mysql -u $1 -p$2 -D $3 -e "rename table log_backup to log"
+mysql -u $1 -p$2 -D $3 -e "drop table if exists log_validator"
+mysql -u $1 -p$2 -D $3 -e "rename table log_validator_backup to log_validator"
fi
@@ -235,7 +235,7 @@
<?php
}
if ($reply_to) {
- $prow = sqlQuery("SELECT lname, fname " .
+ $prow = sqlQuery("SELECT lname, fname,pid, pubpid, DOB " .
"FROM patient_data WHERE pid = ?", array($reply_to) );
$patientname = $prow['lname'] . ", " . $prow['fname'];
}
@@ -298,11 +298,12 @@
echo xlt('Linked document') . ":</b>\n";
while ($gprow = sqlFetchArray($tmp)) {
$d = new Document($gprow['id1']);
- echo " <a href='";
- echo $GLOBALS['webroot'] . "/controller.php?document&retrieve";
- echo "&patient_id=" . $d->get_foreign_id();
- echo "&document_id=" . $d->get_id();
- echo "&as_file=true' target='_blank' onclick='top.restoreSession()'>";
+ $enc_list = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
+ " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($prow['pid']));
+ $str_dob = htmlspecialchars(Xl("DOB:".$prow['DOB']." Age:".getPatientAge($prow['DOB'])));
+ $pname = $prow['fname']." ".$prow['lname'];
+ echo "<a href='javascript:void(0);' ";
+ echo "onClick=\"gotoReport(".addslashes(attr($d->get_id())).",'".addslashes(attr($pname))."',".addslashes(attr($prow['pid'])).",".addslashes(attr($prow['pubpid'])).",'".addslashes(attr($str_dob))."');\">";
echo text($d->get_url_file());
echo "</a>\n";
}
@@ -409,6 +410,35 @@
$("#new_note").submit();
}
});
+ function gotoReport(doc_id,pname,pid,pubpid,str_dob){
+ EncounterDateArray=new Array;
+ CalendarCategoryArray=new Array;
+ EncounterIdArray=new Array;
+ Count = 0;
+ <?php
+ if(isset($enc_list) && sqlNumRows($enc_list) >0 ){
+ while($row = sqlFetchArray($enc_list)){
+ ?>
+ EncounterIdArray[Count]='<?php echo attr($row['encounter']); ?>';
+ EncounterDateArray[Count]='<?php echo attr(oeFormatShortDate(date("Y-m-d", strtotime($row['date'])))); ?>';
+ CalendarCategoryArray[Count]='<?php echo attr(xl_appt_category($row['pc_catname'])); ?>';
+ Count++;
+ <?php
+ }
+ }
+ ?>
+ $.ajax({
+ type:'get',
+ url:'<?php echo $GLOBALS['webroot']."/interface/patient_file/encounter/patient_encounter.php";?>',
+ data:{set_pid: pid},
+ async: false
+ });
+ parent.left_nav.setPatient(pname,pid,pubpid,window.name,str_dob);
+ parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray);
+ var baseurl = '<?php echo $GLOBALS['webroot'] . "/controller.php?document&view"; ?>';
+ var params = "&patient_id=" + pid + "&document_id=" + doc_id + "&";
+ location.href = baseurl + params;
+ }
// This is for callback by the find-patient popup.
function setpatient(pid, lname, fname, dob) {
var f = document.forms[0];
@@ -220,6 +220,18 @@ function generate_result_row(&$ctx, &$row, &$rrow, $priors_omitted=false) {
echo "</a>";
}
echo "</td>\n";
+ $narrative_notes = sqlQuery("select group_concat(note SEPARATOR '\n') as notes from notes where foreign_id = ?",array($result_document_id));
+ if(!empty($narrative_notes)){
+ $nnotes = explode("\n",$narrative_notes['notes']);
+ $narrative_note_list = '';
+ foreach($nnotes as $nnote){
+ if($narrative_note_list == '') $narrative_note_list = 'Narrative Notes:';
+ $narrative_note_list .= $nnote;
+ }
+
+ if($narrative_note_list != ''){ if ($result_noteid) $result_noteid .= ', '; $result_noteid .= 1 + storeNote($narrative_note_list);}
+ }
+
}
else {
echo " <td>";
@@ -532,7 +532,10 @@ function divtoggle(spanid, divid) {
}
?>
<br>
- <a title="<?php echo attr($note);?>" href="<?php echo $doc_url;?>" style="font-size:small;" onsubmit="return top.restoreSession()"><?php echo oeFormatShortDate($doc_iter[docdate]) . ": " . text(basename($doc_iter[url]));?></a>
+ <a href="<?php echo $doc_url;?>" style="font-size:small;" onsubmit="return top.restoreSession()"><?php echo oeFormatShortDate($doc_iter[docdate]) . ": " . text(basename($doc_iter[url]));?></a>
+ <?php if($note != '') {?>
+ <a href="javascript:void(0);" title="<?php echo attr($note);?>"><img src="../../../images/info.png"/></a>
+ <?php }?>
<?php } ?>
</div>
<?php } ?>
Oops, something went wrong.

0 comments on commit 60c6b97

Please sign in to comment.