ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum Java Examples

The following examples show how to use ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleConditionsRulesJUnitTest.java    From drools-workshop with Apache License 2.0 6 votes vote down vote up
@Test
public void testPatientRulesInheritanceInModel() {
    Assert.assertNotNull(kSession);
    System.out.println(" ---- Starting testPatientRulesInheritanceInModel() Test ---");
    
    kSession.insert(new AsthmaticPatient()
        .setDiagnosedDate(new DateDt(parseDate("2014-06-07")))
        .setBirthDateWithDayPrecision(parseDate("1982-01-01"))
        .setGender(AdministrativeGenderEnum.MALE)
        .addAddress(new AddressDt().setCity("London"))
        .setId("Patient/1")
    );

    Assert.assertEquals(5, kSession.fireAllRules());
    System.out.println(" ---- Finished testPatientRulesInheritanceInModel() Test ---");
}
 
Example #2
Source File: FhirDstu2.java    From synthea with Apache License 2.0 5 votes vote down vote up
/**
 * Map the clinician into a FHIR Practitioner resource, and add it to the given Bundle.
 * @param bundle The Bundle to add to
 * @param clinician The clinician
 * @return The added Entry
 */
protected static Entry practitioner(Bundle bundle, Clinician clinician) {
  Practitioner practitionerResource = new Practitioner();

  practitionerResource.addIdentifier().setSystem("http://hl7.org/fhir/sid/us-npi")
  .setValue("" + clinician.identifier);
  practitionerResource.setActive(true);
  practitionerResource.getName().addFamily(
      (String) clinician.attributes.get(Clinician.LAST_NAME))
    .addGiven((String) clinician.attributes.get(Clinician.FIRST_NAME))
    .addPrefix((String) clinician.attributes.get(Clinician.NAME_PREFIX));

  AddressDt address = new AddressDt()
      .addLine((String) clinician.attributes.get(Clinician.ADDRESS))
      .setCity((String) clinician.attributes.get(Clinician.CITY))
      .setPostalCode((String) clinician.attributes.get(Clinician.ZIP))
      .setState((String) clinician.attributes.get(Clinician.STATE));
  if (COUNTRY_CODE != null) {
    address.setCountry(COUNTRY_CODE);
  }
  practitionerResource.addAddress(address);

  if (clinician.attributes.get(Person.GENDER).equals("M")) {
    practitionerResource.setGender(AdministrativeGenderEnum.MALE);
  } else if (clinician.attributes.get(Person.GENDER).equals("F")) {
    practitionerResource.setGender(AdministrativeGenderEnum.FEMALE);
  }

  return newEntry(bundle, practitionerResource, clinician.getResourceID());
}
 
Example #3
Source File: SimpleInferenceRulesJUnitTest.java    From drools-workshop with Apache License 2.0 5 votes vote down vote up
@Test
public void testFemaleSevereAsthmaticPatient() {
    Assert.assertNotNull(kBase);
    KieSession kSession = kBase.newKieSession();
    System.out.println(" ---- Starting testFemaleSevereAsthmaticPatient() Test ---");
    
    //Female, Mild Asthmatic Patient
    Patient patient1 = (Patient) new Patient()
        .setGender(AdministrativeGenderEnum.FEMALE)
        .setId("Patient/1");
    Condition condition1 = createAsthmaCondition(patient1, "Condition/1", Severity.MILD);
    kSession.insert(patient1);
    kSession.insert(condition1);
    
    //Male, Severe Asthmatic Patient
    Patient patient2 = (Patient) new Patient()
        .setGender(AdministrativeGenderEnum.MALE)
        .setId("Patient/2");
    Condition condition2 = createAsthmaCondition(patient2, "Condition/2", Severity.SEVERE);
    kSession.insert(patient2);
    kSession.insert(condition2);
    
    //Female, Severe Asthmatic Patient
    Patient patient3 = (Patient) new Patient()
        .setGender(AdministrativeGenderEnum.FEMALE)
        .setId("Patient/3");
    Condition condition3 = createAsthmaCondition(patient3, "Condition/3", Severity.SEVERE);
    kSession.insert(patient3);
    kSession.insert(condition3);
    
    
    
    Assert.assertEquals(3, kSession.fireAllRules());
    System.out.println(" ---- Finished testFemaleSevereAsthmaticPatient() Test ---");
    kSession.dispose();
}
 
Example #4
Source File: SimpleConditionsRulesJUnitTest.java    From drools-workshop with Apache License 2.0 5 votes vote down vote up
@Test
public void testPatientRulesWithAPatientFromLondonFrom82() {
    Assert.assertNotNull(kSession);
    System.out.println(" ---- Starting testPatientRulesWithAPatientFromLondonFrom82() Test ---");
    kSession.insert(new Patient()
        .setBirthDateWithDayPrecision(parseDate("1982-01-01"))
        .setGender(AdministrativeGenderEnum.MALE)
        .addAddress(new AddressDt().setCity("London"))
        .setId("Patient/1")
    );

    Assert.assertEquals(4, kSession.fireAllRules());
    System.out.println(" ---- Finished testPatientRulesWithAPatientFromLondonFrom82() Test ---");
}