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;
}
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());
}
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;
}
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);
}
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);
}
Aggregations