org.hl7.fhir.r4.model.Enumerations Java Examples

The following examples show how to use org.hl7.fhir.r4.model.Enumerations. 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: ShExGenerator.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
/**
 * Generate a type reference and optional value set definition
 * @param sd Containing StructureDefinition
 * @param ed Element being defined
 * @param typ Element type
 * @return Type definition
 */
private String simpleElement(StructureDefinition sd, ElementDefinition ed, String typ) {
  String addldef = "";
  ElementDefinition.ElementDefinitionBindingComponent binding = ed.getBinding();
  if(binding.hasStrength() && binding.getStrength() == Enumerations.BindingStrength.REQUIRED && "code".equals(typ)) {
    ValueSet vs = resolveBindingReference(sd, binding.getValueSet());
    if (vs != null) {
      addldef = tmplt(VALUESET_DEFN_TEMPLATE).add("vsn", vsprefix(vs.getUrl())).render();
      required_value_sets.add(vs);
    }
  }
  // TODO: check whether value sets and fixed are mutually exclusive
  if(ed.hasFixed()) {
    addldef = tmplt(FIXED_VALUE_TEMPLATE).add("val", ed.getFixed().primitiveValue()).render();
  }
  return tmplt(SIMPLE_ELEMENT_DEFN_TEMPLATE).add("typ", typ).add("vsdef", addldef).render();
}
 
Example #2
Source File: daoutilsR4.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
public static Enumerations.AdministrativeGender getGender(String gender) {

            switch (gender)
            {
                case "MALE":
                   return Enumerations.AdministrativeGender.MALE;
                case "FEMALE":
                    return Enumerations.AdministrativeGender.FEMALE;
                case "OTHER":
                    return Enumerations.AdministrativeGender.OTHER;
                case "UNKNOWN":
                    return Enumerations.AdministrativeGender.UNKNOWN;
            }

        return null;
    }
 
Example #3
Source File: Example07_ClientReadAndUpdate.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
	FhirContext ctx = FhirContext.forR4();
	IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/R4");

	Patient patient = new Patient();
	patient.setId("Patient/example"); // Give the patient an ID
	patient.addName().setFamily("Simpson").addGiven("Homer");
	patient.setGender(Enumerations.AdministrativeGender.MALE);

	// Update the patient
	MethodOutcome outcome = client
        .update()
        .resource(patient)
        .execute();
	
	System.out.println("Now have ID: " + outcome.getId());
}
 
Example #4
Source File: ActivityDefinitionBuilder.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
public ActivityDefinitionBuilder buildIdentification(String url, String version, Enumerations.PublicationStatus status) {
    complexProperty.setUrl(url);
    complexProperty.setVersion(version);
    complexProperty.setStatus(status);

    return this;
}
 
Example #5
Source File: TestApplicationHints.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void step3_create_patient() {
	// Create a patient
	Patient newPatient = new Patient();

	// Populate the patient with fake information
	newPatient
		.addName()
			.setFamily("DevDays2015")
			.addGiven("John")
			.addGiven("Q");
	newPatient
		.addIdentifier()
			.setSystem("http://acme.org/mrn")
			.setValue("1234567");
	newPatient.setGender(Enumerations.AdministrativeGender.MALE);
	newPatient.setBirthDateElement(new DateType("2015-11-18"));

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

	// Create the resource on the server
	MethodOutcome outcome = client
		.create()
		.resource(newPatient)
		.execute();

	// Log the ID that the server assigned
	IIdType id = outcome.getId();
	System.out.println("Created patient, got ID: " + id);
}
 
Example #6
Source File: StructuredMapBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public StructuredMapBuilder buildStatus(Enumerations.PublicationStatus publicationStatus) {
    complexProperty.setStatus(publicationStatus);
    return this;
}
 
Example #7
Source File: ValueSetBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public ValueSetBuilder buildStatus() {
    complexProperty.setStatus(Enumerations.PublicationStatus.DRAFT);
    return this;
}
 
Example #8
Source File: ValueSetBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public ValueSetBuilder buildStatus(String status) throws FHIRException {
    complexProperty.setStatus(Enumerations.PublicationStatus.fromCode(status));
    return this;
}
 
Example #9
Source File: ValueSetBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public ValueSetBuilder buildStatus(Enumerations.PublicationStatus status) {
    complexProperty.setStatus(status);
    return this;
}
 
Example #10
Source File: LibraryBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public LibraryBuilder buildStatus(Enumerations.PublicationStatus status) {
    complexProperty.setStatus(status);
    return this;
}