use of org.openehealth.ipf.commons.ihe.xds.core.metadata.XpnName in project MobileAccessGateway by i4mi.
the class Iti65RequestConverter method transform.
/**
* FHIR HumanName -> XDS Name
* @param name
* @return
*/
public Name transform(HumanName name) {
Name targetName = new XpnName();
if (name.hasPrefix())
targetName.setPrefix(name.getPrefixAsSingleString());
if (name.hasSuffix())
targetName.setSuffix(name.getSuffixAsSingleString());
targetName.setFamilyName(name.getFamily());
List<StringType> given = name.getGiven();
if (given != null && !given.isEmpty()) {
targetName.setGivenName(given.get(0).getValue());
if (given.size() > 1) {
StringBuffer restOfName = new StringBuffer();
for (int part = 1; part < given.size(); part++) {
if (part > 1)
restOfName.append(" ");
restOfName.append(given.get(part).getValue());
}
targetName.setSecondAndFurtherGivenNames(restOfName.toString());
}
}
return targetName;
}
use of org.openehealth.ipf.commons.ihe.xds.core.metadata.XpnName in project ipf by oehf.
the class SourcePatientNamePIDTransformerTest method testToHL7.
@Test
public void testToHL7() {
var patientInfo = new PatientInfo();
Name name = new XpnName();
name.setFamilyName("Jo|man");
name.setGivenName("Jo|chen");
name.setSecondAndFurtherGivenNames("Jo|achim");
name.setSuffix("von Jo|del");
name.setPrefix("Jo|dler");
patientInfo.getNames().add(name);
var iterator = patientInfo.getHl7FieldIterator("PID-5");
assertEquals("Jo\\F\\man^Jo\\F\\chen^Jo\\F\\achim^von Jo\\F\\del^Jo\\F\\dler", iterator.next());
assertFalse(iterator.hasNext());
}
Aggregations