OpenEMR - Adding Time Stamp to Past Encounter List

The challenge was to change the current encounter list to include the time of the encounter.

This was an important feature to have for the behavioral health client. So we set out on the task to see what could be done to place the data here. 

Original Look of the past encounter list

Tracing down the code that generated this display, we could see that this was a function of a SQL call to two tables. We needed to add a third table where the appointments are stored. Once getting the SQL call down to where it would extract and match up the data from all three tables. We were able to produce this.

The finished product adding the time stamp

However, there was a side effect of adding the time to the list of encounters.  The list will only show past encounters that have a calendar appointment with it. If the encounter does not have a calendar appointment, it will not show.  See image below.

You see an encounter at the bottom but there is no encounter listed under encounter history because the first encounter was only to record the patient diagnosis and did not need a calendar appointment. The past appointments list does not show the 2015-12-29 encounter. So,  in a way it is a good thing that only past encounters that have an appointment attached to it will show up in the upper list and not show every miscellaneous encounter created. 
The modification did unexpectedly add more accuracy to the past encounter drop down list.