use of org.openehealth.ipf.commons.ihe.xds.core.metadata.Telecom in project MobileAccessGateway by i4mi.
the class Iti65RequestConverter method transform.
/**
* FHIR ContactPoint -> XDS Telecom
* @param contactPoint
* @return
*/
public Telecom transform(ContactPoint contactPoint) {
if (contactPoint == null)
return null;
Telecom result = new Telecom();
if (contactPoint.getSystem().equals(ContactPointSystem.EMAIL) || contactPoint.getSystem().equals(ContactPointSystem.URL)) {
result.setEmail(contactPoint.getValue());
result.setUse("NET");
result.setType("Internet");
} else {
result.setUnformattedPhoneNumber(contactPoint.getValue());
if (contactPoint.hasSystem())
switch(contactPoint.getSystem()) {
case SMS:
case PHONE:
result.setType("PH");
break;
case FAX:
result.setType("FX");
break;
case PAGER:
result.setType("BP");
break;
}
if (contactPoint.hasUse())
switch(contactPoint.getUse()) {
case HOME:
result.setUse("PRN");
break;
case WORK:
result.setUse("WPN");
break;
case MOBILE:
result.setType("CP");
break;
}
}
return result;
}
use of org.openehealth.ipf.commons.ihe.xds.core.metadata.Telecom in project MobileAccessGateway by i4mi.
the class BaseQueryResponseConverter method transformAuthor.
/**
* XDS Author -> FHIR Reference
* @param author
* @return
*/
public Reference transformAuthor(Author author) {
Person person = author.getAuthorPerson();
if (isPatientAuthor(author)) {
Patient patient = transformPatient(person);
Reference result = new Reference();
List<Telecom> telecoms = author.getAuthorTelecom();
for (Telecom telecom : telecoms) patient.addTelecom(transform(telecom));
result.setResource(patient);
return result;
}
Practitioner containedPerson = transformPractitioner(person);
PractitionerRole role = null;
List<org.openehealth.ipf.commons.ihe.xds.core.metadata.Organization> orgs = author.getAuthorInstitution();
List<Identifiable> roles = author.getAuthorRole();
List<Identifiable> specialities = author.getAuthorSpecialty();
if (!orgs.isEmpty() || !roles.isEmpty() || !specialities.isEmpty()) {
role = new PractitionerRole();
if (containedPerson != null)
role.setPractitioner((Reference) new Reference().setResource(containedPerson));
}
for (org.openehealth.ipf.commons.ihe.xds.core.metadata.Organization org : orgs) {
role.setOrganization((Reference) new Reference().setResource(transform(org)));
}
for (Identifiable roleId : roles) {
role.addCode(transform(roleId));
}
for (Identifiable specId : specialities) {
role.addSpecialty(transform(specId));
}
Reference result = new Reference();
List<Telecom> telecoms = author.getAuthorTelecom();
if (role == null) {
for (Telecom telecom : telecoms) containedPerson.addTelecom(transform(telecom));
result.setResource(containedPerson);
} else {
for (Telecom telecom : telecoms) role.addTelecom(transform(telecom));
result.setResource(role);
}
return result;
}
Aggregations