use of org.hl7.fhir.r5.model.HumanName in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method getValidContact.
private ContactDetail getValidContact() {
HumanName ctName = new HumanName();
ctName.setUse(NameUse.OFFICIAL);
ctName.setFamily("FamilyName");
List<CodeableConcept> ctRelList = new ArrayList<>();
ctRelList.add(createCoding("family", "Family", SystemURL.VS_PATIENT_CONTACT_REL));
ContactDetail contact = new ContactDetail();
contact.setName(ctName.toString());
contact.addTelecom(staticElHelper.getValidTelecom());
return contact;
}
use of org.hl7.fhir.r5.model.HumanName in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method patientDetailsToRegisterPatientResourceConverter.
// a cut-down Patient
private Patient patientDetailsToRegisterPatientResourceConverter(PatientDetails patientDetails) throws FHIRException {
Patient patient = patientDetailsToMinimalPatient(patientDetails);
HumanName name = getPatientNameFromPatientDetails(patientDetails);
patient.addName(name);
patient = setStaticPatientData(patient);
return patient;
}
use of org.hl7.fhir.r5.model.HumanName in project gpconnect-demonstrator by nhsconnect.
the class PractitionerResourceProvider method practitionerDetailsToPractitionerResourceConverter.
private Practitioner practitionerDetailsToPractitionerResourceConverter(PractitionerDetails practitionerDetails) {
Identifier identifier = new Identifier().setSystem(SystemURL.ID_SDS_USER_ID).setValue(practitionerDetails.getUserId());
Practitioner practitioner = new Practitioner().addIdentifier(identifier);
practitionerDetails.getRoleIds().stream().distinct().map(roleId -> new Identifier().setSystem(SystemURL.ID_SDS_ROLE_PROFILE_ID).setValue(roleId)).forEach(practitioner::addIdentifier);
String resourceId = String.valueOf(practitionerDetails.getId());
String versionId = String.valueOf(practitionerDetails.getLastUpdated().getTime());
String resourceType = practitioner.getResourceType().toString();
IdType id = new IdType(resourceType, resourceId, versionId);
practitioner.setId(id);
practitioner.getMeta().setVersionId(versionId);
practitioner.getMeta().setLastUpdated(practitionerDetails.getLastUpdated());
practitioner.getMeta().addProfile(SystemURL.SD_GPC_PRACTITIONER);
HumanName name = new HumanName().setFamily(practitionerDetails.getNameFamily()).addGiven(practitionerDetails.getNameGiven()).addPrefix(practitionerDetails.getNamePrefix()).setUse(NameUse.USUAL);
practitioner.addName(name);
switch(practitionerDetails.getGender().toLowerCase(Locale.UK)) {
case "male":
practitioner.setGender(AdministrativeGender.MALE);
break;
case "female":
practitioner.setGender(AdministrativeGender.FEMALE);
break;
case "other":
practitioner.setGender(AdministrativeGender.OTHER);
break;
default:
practitioner.setGender(AdministrativeGender.UNKNOWN);
break;
}
Coding roleCoding = new Coding(SystemURL.VS_SDS_JOB_ROLE_NAME, practitionerDetails.getRoleCode(), practitionerDetails.getRoleDisplay());
for (int i = 0; i < practitionerDetails.getComCode().size(); i++) {
Coding comCoding = new Coding(SystemURL.VS_HUMAN_LANGUAGE, practitionerDetails.getComCode().get(i), null).setDisplay(practitionerDetails.getComDisplay().get(i));
practitioner.addCommunication().addCoding(comCoding);
}
return practitioner;
}
use of org.hl7.fhir.r5.model.HumanName in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method createContact.
// patientDetailsToMinimalPatient
/**
* add a set of contact details into the patient record NB these are
* Contacts (related people etc) not contactpoints (telecoms)
*
* @param patient fhirResource object
*/
private void createContact(Patient patient) {
// relationships
Patient.ContactComponent contact = new ContactComponent();
for (String relationship : new String[] { "Emergency contact", "Next of kin", "Daughter" }) {
CodeableConcept crelationship = new CodeableConcept();
crelationship.setText(relationship);
contact.addRelationship(crelationship);
}
// contact address
Address address = new Address();
address.addLine("Trevelyan Square");
address.addLine("Boar Ln");
address.setPostalCode("LS1 6AE");
address.setType(AddressType.PHYSICAL);
address.setUse(AddressUse.HOME);
contact.setAddress(address);
// gender
contact.setGender(AdministrativeGender.FEMALE);
// telecom
ContactPoint telecom = new ContactPoint();
telecom.setSystem(ContactPointSystem.PHONE);
telecom.setUse(ContactPointUse.MOBILE);
telecom.setValue("07777123123");
contact.addTelecom(telecom);
// Name
HumanName name = new HumanName();
name.addGiven("Jane");
name.setFamily("Jackson");
List<StringType> prefixList = new ArrayList<>();
prefixList.add(new StringType("Miss"));
name.setPrefix(prefixList);
name.setText("JACKSON Jane (Miss)");
name.setUse(NameUse.OFFICIAL);
contact.setName(name);
patient.addContact(contact);
}
use of org.hl7.fhir.r5.model.HumanName in project gpconnect-demonstrator by nhsconnect.
the class OrganizationResourceProvider method getValidContact.
private ContactDetail getValidContact() {
HumanName orgCtName = new HumanName();
orgCtName.setUse(NameUse.USUAL);
orgCtName.setFamily("FamilyName");
Coding coding = new Coding().setSystem(SystemURL.VS_CC_ORG_CT_ENTITYTYPE).setDisplay("ADMIN");
CodeableConcept orgCtPurpose = new CodeableConcept().addCoding(coding);
ContactDetail orgContact = new ContactDetail();
orgContact.setNameElement(orgCtName.getFamilyElement());
orgContact.addTelecom(getValidTelecom());
return orgContact;
}
Aggregations