org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender Java Examples

The following examples show how to use org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender. 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: Example04_EncodeResource.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static void main(String[] theArgs) {

		// Create a Patient
		Patient pat = new Patient();
		pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J");
		pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135");
		pat.addTelecom().setUse(ContactPointUse.HOME).setSystem(ContactPointSystem.PHONE).setValue("1 (416) 340-4800");
		pat.setGender(AdministrativeGender.MALE);

		// Create a context
		FhirContext ctx = FhirContext.forDstu3();

		// Create a JSON parser
		IParser parser = ctx.newJsonParser();
		parser.setPrettyPrint(true);

		String encode = parser.encodeResourceToString(pat);
		System.out.println(encode);

	}
 
Example #2
Source File: Example09_Interceptors.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static void main(String[] theArgs) {

		// Create a client
      IGenericClient client = FhirContext.forDstu3().newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu3");

      // Register some interceptors
      client.registerInterceptor(new CookieInterceptor("mycookie=Chips Ahoy"));
      client.registerInterceptor(new LoggingInterceptor());

      // Read a Patient
      Patient patient = client.read().resource(Patient.class).withId("example").execute();

		// Change the gender
		patient.setGender(patient.getGender() == AdministrativeGender.MALE ? AdministrativeGender.FEMALE : AdministrativeGender.MALE);

		// Update the patient
		MethodOutcome outcome = client.update().resource(patient).execute();
		
		System.out.println("Now have ID: " + outcome.getId());
	}
 
Example #3
Source File: PatientResourceProvider.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Constructor, which pre-populates the provider with one resource instance.
 */
public PatientResourceProvider() {
   long resourceId = myNextId++;

   Patient patient = new Patient();
   patient.setId(Long.toString(resourceId));
   patient.addIdentifier();
   patient.getIdentifier().get(0).setSystem("urn:hapitest:mrns");
   patient.getIdentifier().get(0).setValue("00002");
   patient.addName().setFamily("Test");
   patient.getName().get(0).addGiven("PatientOne");
   patient.setGender(AdministrativeGender.FEMALE);

   LinkedList<Patient> list = new LinkedList<>();
   list.add(patient);


   myIdToPatientVersions.put(resourceId, list);

}
 
Example #4
Source File: Practitioner.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @return {@link #gender} (Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public Enumeration<AdministrativeGender> getGenderElement() { 
  if (this.gender == null)
    if (Configuration.errorOnAutoCreate())
      throw new Error("Attempt to auto-create Practitioner.gender");
    else if (Configuration.doAutoCreate())
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
  return this.gender;
}
 
Example #5
Source File: FhirStu3.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 BundleEntryComponent 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.addName().setFamily(
      (String) clinician.attributes.get(Clinician.LAST_NAME))
    .addGiven((String) clinician.attributes.get(Clinician.FIRST_NAME))
    .addPrefix((String) clinician.attributes.get(Clinician.NAME_PREFIX));

  Address address = new Address()
      .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(AdministrativeGender.MALE);
  } else if (clinician.attributes.get(Person.GENDER).equals("F")) {
    practitionerResource.setGender(AdministrativeGender.FEMALE);
  }

  return newEntry(bundle, practitionerResource, clinician.getResourceID());
}
 
Example #6
Source File: FamilyMemberHistory.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @param value Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.
 */
public FamilyMemberHistory setGender(AdministrativeGender value) { 
  if (value == null)
    this.gender = null;
  else {
    if (this.gender == null)
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
    this.gender.setValue(value);
  }
  return this;
}
 
Example #7
Source File: FamilyMemberHistory.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @return {@link #gender} (Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public Enumeration<AdministrativeGender> getGenderElement() { 
  if (this.gender == null)
    if (Configuration.errorOnAutoCreate())
      throw new Error("Attempt to auto-create FamilyMemberHistory.gender");
    else if (Configuration.doAutoCreate())
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
  return this.gender;
}
 
Example #8
Source File: RelatedPerson.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @param value Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
 */
public RelatedPerson setGender(AdministrativeGender value) { 
  if (value == null)
    this.gender = null;
  else {
    if (this.gender == null)
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
    this.gender.setValue(value);
  }
  return this;
}
 
Example #9
Source File: RelatedPerson.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @return {@link #gender} (Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public Enumeration<AdministrativeGender> getGenderElement() { 
  if (this.gender == null)
    if (Configuration.errorOnAutoCreate())
      throw new Error("Attempt to auto-create RelatedPerson.gender");
    else if (Configuration.doAutoCreate())
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
  return this.gender;
}
 
Example #10
Source File: Patient.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @param value Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.
 */
public Patient setGender(AdministrativeGender value) { 
  if (value == null)
    this.gender = null;
  else {
    if (this.gender == null)
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
    this.gender.setValue(value);
  }
  return this;
}
 
Example #11
Source File: Patient.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @return {@link #gender} (Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public Enumeration<AdministrativeGender> getGenderElement() { 
  if (this.gender == null)
    if (Configuration.errorOnAutoCreate())
      throw new Error("Attempt to auto-create Patient.gender");
    else if (Configuration.doAutoCreate())
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
  return this.gender;
}
 
Example #12
Source File: Patient.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @param value Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes.
 */
public ContactComponent setGender(AdministrativeGender value) { 
  if (value == null)
    this.gender = null;
  else {
    if (this.gender == null)
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
    this.gender.setValue(value);
  }
  return this;
}
 
Example #13
Source File: Convert.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public AdministrativeGender makeGenderFromCD(Element cd) throws Exception {
 String code = cd.getAttribute("code");
 String system = cd.getAttribute("codeSystem");
 if ("2.16.840.1.113883.5.1".equals(system)) {
 	if ("F".equals(code))
 		return AdministrativeGender.FEMALE;
 	if ("M".equals(code))
 		return AdministrativeGender.MALE;
 }
 throw new Exception("Unable to read Gender "+system+"::"+code);
}
 
Example #14
Source File: Patient.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @return {@link #gender} (Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public Enumeration<AdministrativeGender> getGenderElement() { 
  if (this.gender == null)
    if (Configuration.errorOnAutoCreate())
      throw new Error("Attempt to auto-create ContactComponent.gender");
    else if (Configuration.doAutoCreate())
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
  return this.gender;
}
 
Example #15
Source File: Person.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @param value Administrative Gender.
 */
public Person setGender(AdministrativeGender value) { 
  if (value == null)
    this.gender = null;
  else {
    if (this.gender == null)
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
    this.gender.setValue(value);
  }
  return this;
}
 
Example #16
Source File: Practitioner.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @param value Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
 */
public Practitioner setGender(AdministrativeGender value) { 
  if (value == null)
    this.gender = null;
  else {
    if (this.gender == null)
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
    this.gender.setValue(value);
  }
  return this;
}
 
Example #17
Source File: Person.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @return {@link #gender} (Administrative Gender.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public Enumeration<AdministrativeGender> getGenderElement() { 
  if (this.gender == null)
    if (Configuration.errorOnAutoCreate())
      throw new Error("Attempt to auto-create Person.gender");
    else if (Configuration.doAutoCreate())
      this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
  return this.gender;
}
 
Example #18
Source File: Person.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @param value {@link #gender} (Administrative Gender.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public Person setGenderElement(Enumeration<AdministrativeGender> value) { 
  this.gender = value;
  return this;
}
 
Example #19
Source File: Practitioner.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @param value {@link #gender} (Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public Practitioner setGenderElement(Enumeration<AdministrativeGender> value) { 
  this.gender = value;
  return this;
}
 
Example #20
Source File: Practitioner.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @return Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
 */
public AdministrativeGender getGender() { 
  return this.gender == null ? null : this.gender.getValue();
}
 
Example #21
Source File: TestData.java    From bunsen with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a new Patient for testing.
 *
 * @return a FHIR Patient for testing.
 */
public static Patient newPatient() {

  Patient patient = new Patient();

  patient.setId("test-patient");
  patient.setGender(AdministrativeGender.MALE);
  patient.setActive(true);
  patient.setMultipleBirth(new IntegerType(1));

  patient.setBirthDateElement(new DateType("1945-01-02"));

  patient.addGeneralPractitioner().setReference("Practitioner/12345");

  Identifier practitionerIdentifier = new Identifier();
  practitionerIdentifier.setId("P123456");
  practitionerIdentifier.getAssigner().setReference("Organization/123456");
  patient.getGeneralPractitionerFirstRep().setIdentifier(practitionerIdentifier);

  Address address = patient.addAddress();
  address.addLine("123 Fake Street");
  address.setCity("Chicago");
  address.setState("IL");
  address.setDistrict("12345");

  Extension birthSex = patient.addExtension();

  birthSex.setUrl(US_CORE_BIRTHSEX);
  birthSex.setValue(new CodeType("M"));

  Extension ethnicity = patient.addExtension();
  ethnicity.setUrl(US_CORE_ETHNICITY);
  ethnicity.setValue(null);

  Coding ombCoding = new Coding();

  ombCoding.setSystem("urn:oid:2.16.840.1.113883.6.238");
  ombCoding.setCode("2135-2");
  ombCoding.setDisplay("Hispanic or Latino");

  // Add category to ethnicity extension
  Extension ombCategory = ethnicity.addExtension();

  ombCategory.setUrl("ombCategory");
  ombCategory.setValue(ombCoding);

  // Add multiple detailed sub-extension to ethnicity extension
  Coding detailedCoding1 = new Coding();
  detailedCoding1.setSystem("urn:oid:2.16.840.1.113883.6.238");
  detailedCoding1.setCode("2165-9");
  detailedCoding1.setDisplay("South American");

  Coding detailedCoding2 = new Coding();
  detailedCoding2.setSystem("urn:oid:2.16.840.1.113883.6.238");
  detailedCoding2.setCode("2166-7");
  detailedCoding2.setDisplay("Argentinean");

  final Extension detailed1 = ethnicity.addExtension();
  detailed1.setUrl("detailed");
  detailed1.setValue(detailedCoding1);

  final Extension detailed2 = ethnicity.addExtension();
  detailed2.setUrl("detailed");
  detailed2.setValue(detailedCoding2);

  // Add text display to ethnicity extension
  Extension ethnicityText = ethnicity.addExtension();
  ethnicityText.setUrl("text");
  ethnicityText.setValue(new StringType("Not Hispanic or Latino"));

  // Human Name
  HumanName humanName = new HumanName();
  humanName.setFamily("family_name");
  humanName.addGiven("given_name");
  humanName.addGiven("middle_name");
  patient.addName(humanName);

  return patient;
}
 
Example #22
Source File: FamilyMemberHistory.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @return Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.
 */
public AdministrativeGender getGender() { 
  return this.gender == null ? null : this.gender.getValue();
}
 
Example #23
Source File: FamilyMemberHistory.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @param value {@link #gender} (Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public FamilyMemberHistory setGenderElement(Enumeration<AdministrativeGender> value) { 
  this.gender = value;
  return this;
}
 
Example #24
Source File: Patient.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @return Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes.
 */
public AdministrativeGender getGender() { 
  return this.gender == null ? null : this.gender.getValue();
}
 
Example #25
Source File: Person.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @return Administrative Gender.
 */
public AdministrativeGender getGender() { 
  return this.gender == null ? null : this.gender.getValue();
}
 
Example #26
Source File: RelatedPerson.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @return Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
 */
public AdministrativeGender getGender() { 
  return this.gender == null ? null : this.gender.getValue();
}
 
Example #27
Source File: RelatedPerson.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @param value {@link #gender} (Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public RelatedPerson setGenderElement(Enumeration<AdministrativeGender> value) { 
  this.gender = value;
  return this;
}
 
Example #28
Source File: Patient.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @return Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.
 */
public AdministrativeGender getGender() { 
  return this.gender == null ? null : this.gender.getValue();
}
 
Example #29
Source File: Patient.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @param value {@link #gender} (Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public Patient setGenderElement(Enumeration<AdministrativeGender> value) { 
  this.gender = value;
  return this;
}
 
Example #30
Source File: Patient.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
/**
 * @param value {@link #gender} (Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
 */
public ContactComponent setGenderElement(Enumeration<AdministrativeGender> value) { 
  this.gender = value;
  return this;
}