template.addGuardian(guardianFields);
}
// Provider Organisation
if (provider) {
template.setOrganisationId(new OrgID(OrgIDType.ODSOrgID.code, fields.getProviderOrganisationODSID()));
template.setOrganisationName(fields.getProviderOrganisation());
template.setOrganisationType(fields.getProviderOrganisationType());
if (providerOrganisationTelephone) {
template.addOrganisationTelephone(new Telecom()
.setTelecom("tel:" + fields.getProviderOrganisationTelephone())
.setTelecomType(TelecomUseType.WorkPlace.code));
}
if (providerOrganisationAddress) {
template.setOrganisationAddress(fields.getProviderOrganisationAddress());
}
if (providerParentOrganisationODSID) {
template.addOrganisationPartOf(new ChildPatientOrganisationPartOf()
.addOrganisationId(new OrgID(OrgIDType.ODSOrgID.code,
fields.getProviderParentOrganisationODSID())));
}
}
return template;
}