I would like to get the provider details for an encounter in HTML Form entry.
On the encounter model there was a getProvider() method which was deprecated in favor of getProvidersByRole method which would take a parameter with a value 1.
@arbaughj Yes I have used that for the current encounter, but what I am looking for is how to get the encounter provider for the last encounter which has to be from a lookup complexExpression
Thanks @ssmusoke, thanks for the clarification. I think I understand what youâre trying to do now.
I think one of the velocity functions returned all of the encounter details. It was rather cryptic what it returned, if I remember correctly.
TryâŠ
Past Encounters: <lookup complexExpression="#foreach($encounter in $fn.allEncounters(null)) $encounter #end"/>
orâŠ
Past Encounter Providers: <lookup complexExpression="#foreach($encounter in $fn.allEncounters(null)) $encounter.encounterProvider #end"/>
If that doesnât work, it may never have been âfixedâ to support the multiple providers.
This is just a shot-in-the-dark. If you can get it to work, please document it on the OpenMRS Wiki.
@arbaughj Thanks for the lead, what I ended up using for the last encounter was #foreach($encounterProvider in $fn.latestEncounter('encounterTypeUuid').encounterProviders) $encounterProvider.provider.person.personName #end
which gave me the name of the provider of the last encounter