Encounter Details Template

How can I customize the panel which appears after clicking show details.?

I’m using ComplexObs and I would like to create a view for that complex obs in the above mentioned panel.

I checked few modules for their implementation but I couldn’t figure out the flow. Can someone help me with this.?

At this point, I have created a JSON for adding the extension which looks like this.

    "id": "modulename.encounterTemplate",
    "extensionPointId": "org.openmrs.referenceapplication.encounterTemplate",
    "type": "fragment",
    "extensionParams": {
      "templateId": "obsEncounterTemplate", // this is a gsp fragment
      "templateFragmentProviderName": "modulename",
      "templateFragmentId": "obsEncounterTemplate",
      "supportedEncounterTypes": {
        "43c25184-f41f-11e6-bc64-92361f002671": { // this is the encounter type
          "icon": "icon-paper-clip",
          "deletable": "false"

How can I pass the obs object to the fragment and create a cusomized view using that object?

The GSP fragment is not quite self sufficient in this dashboard, it needs to be paired with a JS file that behaves like another controller for it. This is an example of a complete override for a specific encounter type (it’s coming from the Visit Documents UI module):

  • The GSP fragment: complexObsEncounterTemplate.gsp As you know this is a view, but the ‘real’ controller is not so much the Java controller but rather the JS file that goes with it, see hereunder.
  • The JS file: complexObsEncounterTemplate.js That’s the guy fetching the content of the encounter based on its UUID. I believe the default encounter template does it based on the encounter ID because… it’s a bit of a legacy piece of code.

Have you tried Visit Documents UI btw? It may possibly do just what you need out of the box. This module is likely going to become part of the Ref App distro and be ported to Bahmni. Furthermore it has been designed to be extended to more use cases than just ‘visit documents’ and will be eventually refactored into Patient Documents UI. Version 1.2 will be on out soon and allows to attach files to past/closed visits. Hopefully you will find it suitable to your needs, and we would be happy to take in your PRs should you want to bring features that you find missing.

Ahhh… That’s why I couldn’t. I completely ignored the JS files for that fragment assuming it has UI related stuff.

I checked Visit Documents UI, but reverse engineering it is little slow for me because it is developed in AngularJS which I’m not familiar with. I’m learning and exploring on the go as needed.

At this point, the content from the fragment appears like above. Is this normal?

I’ll give it another try. Hopefully, that should solve the issue.

Thanks for the detailed answer. That helped a lot.

This solved my issue.



This is related post in case someone else is looking for the same thing.