Search in sources :

Example 66 with HumanName

use of org.hl7.fhir.r4b.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;
}
Also used : ContactDetail(org.hl7.fhir.dstu3.model.ContactDetail) HumanName(org.hl7.fhir.dstu3.model.HumanName) ArrayList(java.util.ArrayList) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 67 with HumanName

use of org.hl7.fhir.r4b.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;
}
Also used : HumanName(org.hl7.fhir.dstu3.model.HumanName) Patient(org.hl7.fhir.dstu3.model.Patient)

Example 68 with HumanName

use of org.hl7.fhir.r4b.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;
}
Also used : Practitioner(org.hl7.fhir.dstu3.model.Practitioner) IdParam(ca.uhn.fhir.rest.annotation.IdParam) Identifier(org.hl7.fhir.dstu3.model.Identifier) Coding(org.hl7.fhir.dstu3.model.Coding) IdType(org.hl7.fhir.dstu3.model.IdType) Autowired(org.springframework.beans.factory.annotation.Autowired) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) Extension(org.hl7.fhir.dstu3.model.Extension) RequiredParam(ca.uhn.fhir.rest.annotation.RequiredParam) Locale(java.util.Locale) Search(ca.uhn.fhir.rest.annotation.Search) IResourceProvider(ca.uhn.fhir.rest.server.IResourceProvider) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) Location(org.hl7.fhir.dstu3.model.Location) Read(ca.uhn.fhir.rest.annotation.Read) Practitioner(org.hl7.fhir.dstu3.model.Practitioner) Sort(ca.uhn.fhir.rest.annotation.Sort) Count(ca.uhn.fhir.rest.annotation.Count) Collectors(java.util.stream.Collectors) SystemURL(uk.gov.hscic.SystemURL) IssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType) TokenParam(ca.uhn.fhir.rest.param.TokenParam) PractitionerDetails(uk.gov.hscic.model.practitioner.PractitionerDetails) AdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender) OperationOutcomeFactory(uk.gov.hscic.OperationOutcomeFactory) List(java.util.List) Component(org.springframework.stereotype.Component) SortSpec(ca.uhn.fhir.rest.api.SortSpec) IdentifierValidator(uk.gov.hscic.common.validators.IdentifierValidator) SystemCode(uk.gov.hscic.SystemCode) Collections(java.util.Collections) HumanName(org.hl7.fhir.dstu3.model.HumanName) NameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse) HumanName(org.hl7.fhir.dstu3.model.HumanName) Identifier(org.hl7.fhir.dstu3.model.Identifier) Coding(org.hl7.fhir.dstu3.model.Coding) IdType(org.hl7.fhir.dstu3.model.IdType)

Example 69 with HumanName

use of org.hl7.fhir.r4b.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);
}
Also used : ContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent) ContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent)

Example 70 with HumanName

use of org.hl7.fhir.r4b.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;
}
Also used : ContactDetail(org.hl7.fhir.dstu3.model.ContactDetail) HumanName(org.hl7.fhir.dstu3.model.HumanName) Coding(org.hl7.fhir.dstu3.model.Coding) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Aggregations

HumanName (org.hl7.fhir.r4.model.HumanName)84 HumanName (org.hl7.fhir.dstu3.model.HumanName)37 Patient (org.hl7.fhir.r4.model.Patient)37 Test (org.junit.jupiter.api.Test)29 ArrayList (java.util.ArrayList)27 Patient (org.hl7.fhir.dstu3.model.Patient)27 Test (org.junit.Test)26 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)23 Address (org.hl7.fhir.r4.model.Address)20 Identifier (org.hl7.fhir.r4.model.Identifier)20 PersonName (org.openmrs.PersonName)17 CamelSpringBootTest (org.apache.camel.test.spring.junit5.CamelSpringBootTest)16 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)16 GET (javax.ws.rs.GET)15 Path (javax.ws.rs.Path)15 Produces (javax.ws.rs.Produces)15 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)15 NotImplementedException (org.apache.commons.lang3.NotImplementedException)14 StringType (org.hl7.fhir.r4.model.StringType)14 Date (java.util.Date)13