...
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 a new Name Layout
TO DOName 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:
Code Block |
---|
<bean id="nameTemplateCustomized" class="org.openmrs.layout.web.name.NameTemplate">
<property name="displayName"><value>My custom name layout format</value></property>
<property name="codeName"><value>custom</value></property>
<property name="nameMappings">
<props>
<prop key="prefix">PersonName.prefix</prop>
<prop key="givenName">PersonName.givenName</prop>
<prop key="middleName">PersonName.middleName</prop>
<prop key="familyNamePrefix">PersonName.familyNamePrefix</prop>
<prop key="familyName">PersonName.familyName</prop>
<prop key="familyName2">PersonName.familyName2</prop>
<prop key="familyNameSuffix">PersonName.familyNameSuffix</prop>
<prop key="degree">PersonName.degree</prop>
</props>
</property>
<property name="sizeMappings">
<props>
<prop key="prefix">5</prop>
<prop key="givenName">30</prop>
<prop key="middleName">30</prop>
<prop key="familyNamePrefix">8</prop>
<prop key="familyName">25</prop>
<prop key="familyName2">25</prop>
<prop key="familyNameSuffix">8</prop>
<prop key="degree">5</prop>
</props>
</property>
<property name="lineByLineFormat">
<list>
<value>prefix</value>
<value>givenName</value>
<value>middleName</value>
<value>familyNamePrefix familyName familyName2 familyNameSuffix</value>
<value>degree</value>
</list>
</property>
</bean>
|
Change the nameMappings, sizeMappings, and lineByLineFormat elements however you like. Restart Tomcat to use the new name layout.
e.g. if you want to not show degree, you delete the lineByLineFormat line: <value>degree</value>
e.g. if you want to have a longer givenName, you modify <prop key="givenName">30</prop> to be <prop key="givenName">50</prop>