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

The following examples show how to use org.hl7.fhir.dstu3.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: FhirSearchTest.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Test
public void searchTest() {
    Patient one = new Patient();
    one.setId("one");
    one.setGender(Enumerations.AdministrativeGender.UNKNOWN);
    Patient two = new Patient();
    two.setId("two");
    two.setGender(Enumerations.AdministrativeGender.UNKNOWN);

    Bundle bundle = new Bundle();
    bundle.getEntry().add(new Bundle.BundleEntryComponent().setResource(one));
    bundle.getEntry().add(new Bundle.BundleEntryComponent().setResource(two));

    stubFhirRequest(get(urlEqualTo("/Patient?gender=unknown&_format=xml")).willReturn(okXml(toXml(bundle))));

    FhirResourceQuery query = new FhirResourceQuery();
    query.setQuery("gender=unknown");

    String result = template.requestBody("direct:start", query, String.class);

    Assertions.assertThat(result).isEqualTo(
        "[<Patient xmlns=\"http://hl7.org/fhir\"><id value=\"one\"/><gender value=\"unknown\"/></Patient>, " +
        "<Patient xmlns=\"http://hl7.org/fhir\"><id value=\"two\"/><gender value=\"unknown\"/></Patient>]");
}
 
Example #3
Source File: daoutils.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 #4
Source File: Example02_EnumeratedTypes.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void main(String[] theArgs) {

      Patient pat = new Patient();

      pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J");
      pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135");

      // Enumerated types are provided for many coded elements
      ContactPoint contact = pat.addTelecom();
      contact.setUse(ContactPoint.ContactPointUse.HOME);
      contact.setSystem(ContactPoint.ContactPointSystem.PHONE);
      contact.setValue("1 (416) 340-4800");

      pat.setGender(Enumerations.AdministrativeGender.MALE);
   }
 
Example #5
Source File: FhirDstu3Processor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep(onlyIf = FhirFlags.Dstu3Enabled.class)
void enableReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        Dstu3PropertiesBuildItem propertiesBuildItem) {
    Set<String> classes = new HashSet<>();
    classes.add(DomainResource.class.getCanonicalName());
    classes.add(Resource.class.getCanonicalName());
    classes.add(org.hl7.fhir.dstu3.model.BaseResource.class.getCanonicalName());
    classes.add(Base.class.getCanonicalName());
    classes.addAll(getModelClasses(propertiesBuildItem.getProperties()));
    classes.addAll(getInnerClasses(Enumerations.class.getCanonicalName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, true, Meta.class.getCanonicalName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, true, MetadataResource.class.getCanonicalName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, classes.toArray(new String[0])));
}
 
Example #6
Source File: Example02_EnumeratedTypes.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void main(String[] theArgs) {

      Patient pat = new Patient();

      pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J");
      pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135");

      // Enumerated types are provided for many coded elements
      ContactPoint contact = pat.addTelecom();
      contact.setUse(ContactPoint.ContactPointUse.HOME);
      contact.setSystem(ContactPoint.ContactPointSystem.PHONE);
      contact.setValue("1 (416) 340-4800");

      pat.setGender(Enumerations.AdministrativeGender.MALE);
   }
 
Example #7
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 #8
Source File: PatientEntityToFHIRPatientTransformerTest.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Test
public void testTransformSimplePatientEntity() throws FHIRException {

    LocalDate dateOfBirth = LocalDate.of(1996, 6, 21);

    final PatientEntity patientEntity = new PatientEntityBuilder()
            .setDateOfBirth(dateOfBirth)
            .build();

    final Patient patient = transformer.transform(patientEntity);

    assertThat(patient, not(nullValue()));
    assertThat(patient.getActive(), equalTo(true));
    assertThat(patient.getName().size(), equalTo(1));

    HumanName name = patient.getName().get(0);
    assertThat(name.getGivenAsSingleString(), equalTo("John"));
    assertThat(name.getFamily(), equalTo("Smith"));
    assertThat(name.getUse(), equalTo(HumanName.NameUse.OFFICIAL));
    assertThat(name.getPrefixAsSingleString(), equalTo("Mr"));

    assertThat(patient.getGender(), equalTo(Enumerations.AdministrativeGender.MALE));

    assertThat(patient.getBirthDate(), not(nullValue()));
    LocalDate patientDoB = DateUtils.asLocalDate(patient.getBirthDate());
    assertThat(patientDoB, equalTo(dateOfBirth));
}
 
Example #9
Source File: CodeSystemEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public void setStatus(Enumerations.PublicationStatus status) {
	this.status = status;
}
 
Example #10
Source File: DocumentReferenceEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public Enumerations.DocumentReferenceStatus getStatus() {
    return status;
}
 
Example #11
Source File: DocumentReferenceEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public void setStatus(Enumerations.DocumentReferenceStatus status) {
    this.status = status;
}
 
Example #12
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;
}
 
Example #13
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 #14
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 #15
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 #16
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 #17
Source File: NamingSystemEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public Enumerations.PublicationStatus getStatus() {
	return status;
}
 
Example #18
Source File: NamingSystemEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public void setStatus(Enumerations.PublicationStatus status) {
	this.status = status;
}
 
Example #19
Source File: ConceptMapEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public Enumerations.PublicationStatus getStatus() {
	return status;
}
 
Example #20
Source File: ConceptMapEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public void setStatus(Enumerations.PublicationStatus status) {
	this.status = status;
}
 
Example #21
Source File: CodeSystemEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public Enumerations.PublicationStatus getStatus() {
	return status;
}
 
Example #22
Source File: QuestionnaireEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public void setStatus(Enumerations.PublicationStatus status) {
    this.status = status;
}
 
Example #23
Source File: QuestionnaireEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public Enumerations.PublicationStatus getStatus() {
    return status;
}
 
Example #24
Source File: StructureDefinitionEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public void setStatus(Enumerations.PublicationStatus status) {
    this.status = status;
}
 
Example #25
Source File: StructureDefinitionEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public Enumerations.PublicationStatus getStatus() {
    return status;
}
 
Example #26
Source File: MessageDefinitionEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public void setStatus(Enumerations.PublicationStatus status) {
	this.status = status;
}
 
Example #27
Source File: MessageDefinitionEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public Enumerations.PublicationStatus getStatus() {
	return status;
}
 
Example #28
Source File: GraphDefinitionEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public void setStatus(Enumerations.PublicationStatus status) {
    this.status = status;
}
 
Example #29
Source File: GraphDefinitionEntity.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
public Enumerations.PublicationStatus getStatus() {
    return status;
}