Patient Summary Top Bar Buttons Layout

rayaz wrote on Wednesday, March 11, 2009:

Hi all
Can anyone point out how get a patients summary in the top title bar of an active patient window. This summary is seen when you have concurrent_layout set to 0 in globals.php. When set to 1 or 2 this summary is replaced with just the patient name and PID.

With the old style it’s quite helpful to be able to have the age of the patient highly visible.

Anyone?

Regards
Rayaz

cfapress wrote on Wednesday, March 11, 2009:

Rayaz,

The file you’re looking for is <oemr>/interface/main/main_title.php

The data you’re looking to see displayed is what gets loaded in this file:
<oemr>/interface/patient_file/summary/summary_title.php

You can copy and paste the relevant lines between the files to get the patient’s age to appear in the main_title file.

Jason

rayaz wrote on Wednesday, March 11, 2009:

Jason

Messed around with these files before as well. Could get the required info in the top bar but it would not refresh. If I refreshed the whole page the info would update with the last open patient, with the calender open.

So what specifically to change?

Rayaz

cfapress wrote on Thursday, March 12, 2009:

Rayaz,

Apparently the logic is a bit more difficult than I originally thought. When you choose a patient, in the radio-button/collapsible-tree view, the top title bar is changed via javascript in this file:
<oemr>/interface/main/left_nav.php

Around line 500 there is a function called setPatient which changes the content of some of the frames including the Title frame. The content is determined by the value in the ‘str’ variable.
function setPatient(pname, pid, pubpid, frname) {
  var str = ‘<b>’ + pname + ’ (’ + pubpid + ‘)</b>’;
  setDivContent(‘current_patient’, str);
  setTitleContent(‘current_patient’, str);

The setPatient function is called from another file,
<oemr>interface/patient_file/summary/demographics_full.php

Around line 606 in that file you’ll see these lines:
<?php if ($GLOBALS[‘concurrent_layout’] && $set_pid) { ?>
parent.left_nav.setPatient(<?php echo “’” . addslashes($result[‘fname’]) . " " . addslashes($result[‘lname’]) . “’,$pid,’” . addslashes($result[‘pubpid’]) . “’,’’”; ?>);
parent.left_nav.setRadio(window.name, ‘dem’);
<?php } ?>

So… what does all this mean?

It means that code in the <oemr>/interface/main/left_nav.php file needs to be changed so that it loads the patient’s info. I suggest you rework the code to read something like this:

function setPatient(pname, pid, pubpid, frname) {
  var str = ‘<b>’ + pname + ’ (’ + pubpid + ‘)</b>’;
  setDivContent(‘current_patient’, str);
<?php
  $result = getPatientData($pid, “fname,lname,pid,pubpid,phone_home,pharmacy_id,DOB,DATE_FORMAT(DOB,’%Y%m%d’) as DOB_YMD”);
  $age = getPatientAge($result[“DOB_YMD”]);
?>
  var str = ‘<b>’ + pname + ’ (’ + pubpid + ‘)</b>’ + ’ DOB: <?php echo $result[“DOB_YMD”]; ?> Age:’ + <?php echo $age; ?>;

*** AND ***

At around line 90 of the left_nav.php file you’ll need to add this line:
include_once("…/…/library/patient.inc");

Jason

bradymiller wrote on Thursday, March 12, 2009:

nice,

I attempted this a year ago, and finally gave up before hurdling myself off my rooftop.  If your fix indeed works, then I’m for getting it into CVS (whenever its back up).  Having the DOB and age always visible is a huge deal for clinicians.

-brady

cfapress wrote on Friday, March 13, 2009:

Well, I tested my code recommendations on OEMR v3 yesterday before making that post. It worked like a charm for me. I’ll modify the CVS code and commit the change. It makes sense to include it in the v3 release because the UI (concurrent/non-concurrent) shouldn’t be different in the the data being displayed, just the layout.

I’ll make the code change today.

Jason

cfapress wrote on Friday, March 13, 2009:

OK… CVS has been updated with my code changes.

It turns out I had to modify a few more files than expected.

Jason

rayaz wrote on Friday, March 13, 2009:

Jason
Could you please let me know what files you updated? I am using version 2.9.0 and don’t want to upgrade yet due my personal mods.
Thanks
Rayaz