Search in sources :

Example 11 with HumanName

use of org.hl7.fhir.r4b.model.HumanName in project cqf-ruler by DBCG.

the class Patients method john_doe.

public static Patient john_doe() {
    Patient patient = new Patient();
    patient.setId("john-doe");
    patient.setName(Arrays.asList(new HumanName().setFamily("Doe").setGiven(Arrays.asList(new StringType("John")))));
    patient.setBirthDate(new Date());
    patient.setGender(AdministrativeGender.MALE);
    Extension usCoreRace = new Extension();
    usCoreRace.setUrl(EXT_URL_US_CORE_RACE).addExtension().setUrl(OMB_CATEGORY).setValue(new Coding().setSystem(URL_SYSTEM_RACE).setCode(OMB_CATEGORY_RACE_BLACK).setDisplay(BLACK_OR_AFRICAN_AMERICAN));
    patient.getExtension().add(usCoreRace);
    return patient;
}
Also used : Extension(org.hl7.fhir.dstu3.model.Extension) HumanName(org.hl7.fhir.dstu3.model.HumanName) StringType(org.hl7.fhir.dstu3.model.StringType) Coding(org.hl7.fhir.dstu3.model.Coding) Patient(org.hl7.fhir.dstu3.model.Patient) Date(java.util.Date)

Example 12 with HumanName

use of org.hl7.fhir.r4b.model.HumanName in project quality-measure-and-cohort-service by Alvearie.

the class MeasureEvaluatorTest method in_populations_defines_returned.

@Test
public void in_populations_defines_returned() throws Exception {
    CapabilityStatement metadata = getCapabilityStatement();
    mockFhirResourceRetrieval("/metadata?_format=json", metadata);
    Patient patient = getPatient("123", AdministrativeGender.MALE, "1970-10-10");
    // Add 2 names to test list
    HumanName name1 = new HumanName();
    name1.setFamily("Jones");
    HumanName name2 = new HumanName();
    name2.setFamily("Smith");
    patient.setName(Arrays.asList(name1, name2));
    // Add marital status to test codeable concept
    CodeableConcept maritalStatus = new CodeableConcept();
    Coding maritalCoding = new Coding();
    maritalCoding.setCode("M");
    maritalCoding.setSystem("http://terminology.hl7.org/CodeSystem/v3-MaritalStatus");
    maritalCoding.setDisplay("Married");
    maritalStatus.setCoding(Arrays.asList(maritalCoding));
    maritalStatus.setText("Married");
    patient.setMaritalStatus(maritalStatus);
    mockFhirResourceRetrieval(patient);
    Library library = setupDefineReturnLibrary();
    expressionsByPopulationType.clear();
    expressionsByPopulationType.put(MeasurePopulationType.INITIALPOPULATION, INITIAL_POPULATION);
    expressionsByPopulationType.put(MeasurePopulationType.DENOMINATOR, DENOMINATOR);
    expressionsByPopulationType.put(MeasurePopulationType.NUMERATOR, NUMERATOR);
    Measure measure = getProportionMeasure("ProportionMeasureName", library, expressionsByPopulationType);
    mockFhirResourceRetrieval(measure);
    MeasureReport report = evaluator.evaluatePatientMeasure(measure.getId(), patient.getId(), null, new MeasureEvidenceOptions(true, DefineReturnOptions.ALL));
    assertNotNull(report);
    assertFalse(report.getEvaluatedResource().isEmpty());
    List<Extension> returnedExtensions = report.getExtensionsByUrl(CDMConstants.EVIDENCE_URL);
    assertFalse(returnedExtensions.isEmpty());
    assertEquals(30, returnedExtensions.size());
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) HumanName(org.hl7.fhir.r4.model.HumanName) Coding(org.hl7.fhir.r4.model.Coding) CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) Measure(org.hl7.fhir.r4.model.Measure) Patient(org.hl7.fhir.r4.model.Patient) MeasureReport(org.hl7.fhir.r4.model.MeasureReport) Library(org.hl7.fhir.r4.model.Library) MeasureEvidenceOptions(com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.Test)

Example 13 with HumanName

use of org.hl7.fhir.r4b.model.HumanName in project summary-care-record-api by NHSDigital.

the class PersonSdsMapper method mapPractitioner.

public Practitioner mapPractitioner(Node personSds) {
    var practitioner = new Practitioner();
    practitioner.setId(randomUUID());
    practitioner.addIdentifier(new Identifier().setSystem(SDS_USER_ID).setValue(xmlUtils.getValueByXPath(personSds, ID_EXTENSION_XPATH)));
    var name = xmlUtils.getOptionalValueByXPath(personSds, PERSON_NAME_XPATH);
    if (name.isPresent()) {
        practitioner.addName(new HumanName().setText(name.get()));
    }
    return practitioner;
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) HumanName(org.hl7.fhir.r4.model.HumanName) Identifier(org.hl7.fhir.r4.model.Identifier)

Example 14 with HumanName

use of org.hl7.fhir.r4b.model.HumanName in project openmrs-module-fhir2 by openmrs.

the class FhirPatientServiceImplTest method setUp.

@Before
public void setUp() {
    patientService = new FhirPatientServiceImpl() {

        @Override
        protected void validateObject(Patient object) {
        }
    };
    patientService.setDao(dao);
    patientService.setTranslator(patientTranslator);
    patientService.setSearchQuery(searchQuery);
    patientService.setSearchQueryInclude(searchQueryInclude);
    PersonName name = new PersonName();
    name.setFamilyName(PATIENT_FAMILY_NAME);
    name.setGivenName(PATIENT_GIVEN_NAME);
    patient = new Patient();
    patient.setUuid(PATIENT_UUID);
    patient.setGender("M");
    patient.addName(name);
    PersonAddress address = new PersonAddress();
    address.setCityVillage(CITY);
    address.setStateProvince(STATE);
    address.setPostalCode(POSTAL_CODE);
    address.setCountry(COUNTRY);
    HumanName humanName = new HumanName();
    humanName.addGiven(PATIENT_GIVEN_NAME);
    humanName.setFamily(PATIENT_FAMILY_NAME);
    fhirPatient = new org.hl7.fhir.r4.model.Patient();
    fhirPatient.setId(PATIENT_UUID);
    fhirPatient.addName(humanName);
}
Also used : HumanName(org.hl7.fhir.r4.model.HumanName) PersonName(org.openmrs.PersonName) PersonAddress(org.openmrs.PersonAddress) Patient(org.openmrs.Patient) Before(org.junit.Before)

Example 15 with HumanName

use of org.hl7.fhir.r4b.model.HumanName in project elexis-server by elexis.

the class PatientTest method getPatientProperties.

/**
 * Test all properties set by
 * {@link TestDatabaseInitializer#initializePatient()}.
 */
@Test
public void getPatientProperties() {
    IReadExecutable<Patient> readPatientE = client.read().resource(Patient.class).withId(AllTests.getTestDatabaseInitializer().getPatient().getId());
    Patient readPatient = readPatientE.execute();
    assertNotNull(readPatient);
    List<HumanName> names = readPatient.getName();
    assertNotNull(names);
    assertFalse(names.isEmpty());
    HumanName name = names.get(0);
    assertNotNull(name);
    assertEquals("Patient", name.getFamily());
    assertEquals("Test", name.getGivenAsSingleString());
    Date dob = readPatient.getBirthDate();
    assertNotNull(dob);
    assertEquals(LocalDate.of(1990, Month.JANUARY, 1), AllTests.getLocalDateTime(dob).toLocalDate());
    assertEquals(AdministrativeGender.FEMALE, readPatient.getGender());
    List<ContactPoint> telcoms = readPatient.getTelecom();
    assertNotNull(telcoms);
    assertEquals(2, telcoms.size());
    assertEquals(1, telcoms.get(0).getRank());
    assertEquals("+01555123", telcoms.get(0).getValue());
    assertEquals(ContactPointUse.MOBILE, telcoms.get(1).getUse());
    assertEquals("+01444123", telcoms.get(1).getValue());
    List<Address> addresses = readPatient.getAddress();
    assertNotNull(addresses);
    assertEquals(1, addresses.size());
    assertEquals(AddressUse.HOME, addresses.get(0).getUse());
    assertEquals("City", addresses.get(0).getCity());
    assertEquals("123", addresses.get(0).getPostalCode());
    assertEquals("Street 1", addresses.get(0).getLine().get(0).asStringValue());
    List<Identifier> identifiers = readPatient.getIdentifier();
    boolean ahvFound = false;
    for (Identifier identifier : identifiers) {
        if (identifier.getSystem().equals(XidConstants.CH_AHV)) {
            assertTrue(identifier.getValue().startsWith("756"));
            ahvFound = true;
        }
    }
    assertTrue(ahvFound);
}
Also used : HumanName(org.hl7.fhir.r4.model.HumanName) ContactPoint(org.hl7.fhir.r4.model.ContactPoint) Identifier(org.hl7.fhir.r4.model.Identifier) Address(org.hl7.fhir.r4.model.Address) Patient(org.hl7.fhir.r4.model.Patient) IPatient(ch.elexis.core.model.IPatient) Date(java.util.Date) LocalDate(java.time.LocalDate) Test(org.junit.Test)

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