There are certain name layouts that come with OpenMRS right now, they are: short (default), long, givenfamily, latinamerica and spain. These are stored in the openmrs-servlet.xml file. You can find this file in tomcathome/webapps/openmrs/WEB-INF/lib/openmrs-web...jar/openmrs-servlet.xml .
You can modify the layout.name.format global property setting (formerly global property from platform 1.8 downwards) to one of those values or to the "codeName" of a new custom layout (instructions below) to see a different name layout.
...
These are the name layouts that come with OpenMRS. The following table shows which items are contained in each of them (they are ordered from shortest to longest).
code | Prefix | Given Name | Middle Name | Family Name Prefix | Family Name | Family Name 2 | Family Name Suffix | Degree |
---|---|---|---|---|---|---|---|---|
givenfamily |
X |
X |
short |
X | X |
X |
spain |
X |
X | X |
latinamerica |
X | X |
X | X |
long | X | X | X | X | X | X | X | X |
Adding
...
Name layouts are stored in the openmrs-servlet.xml file. You can find this file in tomcathome/webapps/openmrs/WEB-INF/lib/openmrs-web...jar/openmrs-servlet.xml .
In the <bean id="nameSupport" element, add <ref bean="nameTemplateCustomized" /> .
Now after the next </bean> tag, add:
...
/Overriding existing NameTemplate
Add a new Global Property named "layout.name.template" if it already exists, update it's value to the your custom xml template:
Code Block <org.openmrs.layout.name.NameTemplate> <codeName>customXmlTemplate</codeName> <displayName>Custom Name Format</displayName> <nameMappings class="properties"> <property name="prefix" value="PersonName.prefix"/> <property name="givenName" value="PersonName.givenName"/> <property name="familyName" value="PersonName.familyName"/> </nameMappings> <sizeMappings class="properties"> <property name="prefix" value="5"/> <property name="givenName" value="30"/> <property name="familyName" value="25"/> </sizeMappings> <lineByLineFormat> <string>prefix</string> <string>givenName</string> <string>familyName</string> </lineByLineFormat> <requiredElements> <string>givenName</string> <string>familyName</string> </requiredElements> </org.openmrs.layout.name.NameTemplate>
- Change the nameMappings, sizeMappings, and lineByLineFormat elements however you like.
...
- Update the layout.name.format Global Property to the custom template's codeName so that it is chosen as the active template.
e.g. if you don't want to not show degreeprefix, you delete the lineByLineFormat line: <value>degree< <string>prefix</value>string>
e.g. if you want to have a longer givenName, you modify <prop keymodify <property name="givenName" value="30">30</prop> to be <prop key/> to be <property name="givenName" value="50">50</prop>>