org.hl7.fhir.dstu3.model.CodeType Java Examples
The following examples show how to use
org.hl7.fhir.dstu3.model.CodeType.
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: VersionConvertorPrimitiveType30_50Test.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static Stream<Arguments> r5PrimitiveTypes() { return Stream.of( Arguments.arguments(org.hl7.fhir.r5.model.BooleanType.class.getSimpleName(), new org.hl7.fhir.r5.model.BooleanType()), Arguments.arguments(org.hl7.fhir.r5.model.CodeType.class.getSimpleName(), new org.hl7.fhir.r5.model.CodeType()), Arguments.arguments(org.hl7.fhir.r5.model.DateType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateType()), Arguments.arguments(org.hl7.fhir.r5.model.DateTimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateTimeType()), Arguments.arguments(org.hl7.fhir.r5.model.DecimalType.class.getSimpleName(), new org.hl7.fhir.r5.model.DecimalType()), Arguments.arguments(org.hl7.fhir.r5.model.InstantType.class.getSimpleName(), new org.hl7.fhir.r5.model.InstantType()), Arguments.arguments(org.hl7.fhir.r5.model.PositiveIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.PositiveIntType()), Arguments.arguments(org.hl7.fhir.r5.model.UnsignedIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.UnsignedIntType()), Arguments.arguments(org.hl7.fhir.r5.model.IntegerType.class.getSimpleName(), new org.hl7.fhir.r5.model.IntegerType()), Arguments.arguments(org.hl7.fhir.r5.model.MarkdownType.class.getSimpleName(), new org.hl7.fhir.r5.model.MarkdownType()), Arguments.arguments(org.hl7.fhir.r5.model.OidType.class.getSimpleName(), new org.hl7.fhir.r5.model.OidType()), Arguments.arguments(org.hl7.fhir.r5.model.StringType.class.getSimpleName(), new org.hl7.fhir.r5.model.StringType()), Arguments.arguments(org.hl7.fhir.r5.model.TimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.TimeType()), Arguments.arguments(org.hl7.fhir.r5.model.UuidType.class.getSimpleName(), new org.hl7.fhir.r5.model.UuidType()), Arguments.arguments(org.hl7.fhir.r5.model.Base64BinaryType.class.getSimpleName(), new org.hl7.fhir.r5.model.Base64BinaryType()), Arguments.arguments(org.hl7.fhir.r5.model.UriType.class.getSimpleName(), new org.hl7.fhir.r5.model.UriType())); }
Example #2
Source File: VersionConvertorPrimitiveType30_40Test.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static Stream<Arguments> dstu3PrimitiveTypes() { return Stream.of( Arguments.arguments(BooleanType.class.getSimpleName(), new BooleanType()), Arguments.arguments(CodeType.class.getSimpleName(), new CodeType()), Arguments.arguments(DateType.class.getSimpleName(), new DateType()), Arguments.arguments(DateTimeType.class.getSimpleName(), new DateTimeType()), Arguments.arguments(DecimalType.class.getSimpleName(), new DecimalType()), Arguments.arguments(InstantType.class.getSimpleName(), new InstantType()), Arguments.arguments(PositiveIntType.class.getSimpleName(), new PositiveIntType()), Arguments.arguments(UnsignedIntType.class.getSimpleName(), new UnsignedIntType()), Arguments.arguments(IntegerType.class.getSimpleName(), new IntegerType()), Arguments.arguments(MarkdownType.class.getSimpleName(), new MarkdownType()), Arguments.arguments(OidType.class.getSimpleName(), new OidType()), Arguments.arguments(StringType.class.getSimpleName(), new StringType()), Arguments.arguments(TimeType.class.getSimpleName(), new TimeType()), Arguments.arguments(UuidType.class.getSimpleName(), new UuidType()), Arguments.arguments(Base64BinaryType.class.getSimpleName(), new Base64BinaryType()), Arguments.arguments(UriType.class.getSimpleName(), new UriType())); }
Example #3
Source File: VersionConvertorPrimitiveType30_40Test.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static Stream<Arguments> r4PrimitiveTypes() { return Stream.of( Arguments.arguments(org.hl7.fhir.r4.model.BooleanType.class.getSimpleName(), new org.hl7.fhir.r4.model.BooleanType()), Arguments.arguments(org.hl7.fhir.r4.model.CodeType.class.getSimpleName(), new org.hl7.fhir.r4.model.CodeType()), Arguments.arguments(org.hl7.fhir.r4.model.DateType.class.getSimpleName(), new org.hl7.fhir.r4.model.DateType()), Arguments.arguments(org.hl7.fhir.r4.model.DateTimeType.class.getSimpleName(), new org.hl7.fhir.r4.model.DateTimeType()), Arguments.arguments(org.hl7.fhir.r4.model.DecimalType.class.getSimpleName(), new org.hl7.fhir.r4.model.DecimalType()), Arguments.arguments(org.hl7.fhir.r4.model.InstantType.class.getSimpleName(), new org.hl7.fhir.r4.model.InstantType()), Arguments.arguments(org.hl7.fhir.r4.model.PositiveIntType.class.getSimpleName(), new org.hl7.fhir.r4.model.PositiveIntType()), Arguments.arguments(org.hl7.fhir.r4.model.UnsignedIntType.class.getSimpleName(), new org.hl7.fhir.r4.model.UnsignedIntType()), Arguments.arguments(org.hl7.fhir.r4.model.IntegerType.class.getSimpleName(), new org.hl7.fhir.r4.model.IntegerType()), Arguments.arguments(org.hl7.fhir.r4.model.MarkdownType.class.getSimpleName(), new org.hl7.fhir.r4.model.MarkdownType()), Arguments.arguments(org.hl7.fhir.r4.model.OidType.class.getSimpleName(), new org.hl7.fhir.r4.model.OidType()), Arguments.arguments(org.hl7.fhir.r4.model.StringType.class.getSimpleName(), new org.hl7.fhir.r4.model.StringType()), Arguments.arguments(org.hl7.fhir.r4.model.TimeType.class.getSimpleName(), new org.hl7.fhir.r4.model.TimeType()), Arguments.arguments(org.hl7.fhir.r4.model.UuidType.class.getSimpleName(), new org.hl7.fhir.r4.model.UuidType()), Arguments.arguments(org.hl7.fhir.r4.model.Base64BinaryType.class.getSimpleName(), new org.hl7.fhir.r4.model.Base64BinaryType()), Arguments.arguments(org.hl7.fhir.r4.model.UriType.class.getSimpleName(), new org.hl7.fhir.r4.model.UriType())); }
Example #4
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static String readStringExtension(Element c, String uri) { Extension ex = ExtensionHelper.getExtension(c, uri); if (ex == null) return null; if (ex.getValue() instanceof UriType) return ((UriType) ex.getValue()).getValue(); if (ex.getValue() instanceof CodeType) return ((CodeType) ex.getValue()).getValue(); if (ex.getValue() instanceof IntegerType) return ((IntegerType) ex.getValue()).asStringValue(); if ((ex.getValue() instanceof MarkdownType)) return ((MarkdownType) ex.getValue()).getValue(); if (!(ex.getValue() instanceof StringType)) return null; return ((StringType) ex.getValue()).getValue(); }
Example #5
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static String readStringExtension(DomainResource c, String uri) { Extension ex = getExtension(c, uri); if (ex == null) return null; if ((ex.getValue() instanceof StringType)) return ((StringType) ex.getValue()).getValue(); if ((ex.getValue() instanceof UriType)) return ((UriType) ex.getValue()).getValue(); if (ex.getValue() instanceof CodeType) return ((CodeType) ex.getValue()).getValue(); if (ex.getValue() instanceof IntegerType) return ((IntegerType) ex.getValue()).asStringValue(); if ((ex.getValue() instanceof MarkdownType)) return ((MarkdownType) ex.getValue()).getValue(); return null; }
Example #6
Source File: VersionConvertorPrimitiveType30_50Test.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static Stream<Arguments> dstu3PrimitiveTypes() { return Stream.of( Arguments.arguments(BooleanType.class.getSimpleName(), new BooleanType()), Arguments.arguments(CodeType.class.getSimpleName(), new CodeType()), Arguments.arguments(DateType.class.getSimpleName(), new DateType()), Arguments.arguments(DateTimeType.class.getSimpleName(), new DateTimeType()), Arguments.arguments(DecimalType.class.getSimpleName(), new DecimalType()), Arguments.arguments(InstantType.class.getSimpleName(), new InstantType()), Arguments.arguments(PositiveIntType.class.getSimpleName(), new PositiveIntType()), Arguments.arguments(UnsignedIntType.class.getSimpleName(), new UnsignedIntType()), Arguments.arguments(IntegerType.class.getSimpleName(), new IntegerType()), Arguments.arguments(MarkdownType.class.getSimpleName(), new MarkdownType()), Arguments.arguments(OidType.class.getSimpleName(), new OidType()), Arguments.arguments(StringType.class.getSimpleName(), new StringType()), Arguments.arguments(TimeType.class.getSimpleName(), new TimeType()), Arguments.arguments(UuidType.class.getSimpleName(), new UuidType()), Arguments.arguments(Base64BinaryType.class.getSimpleName(), new Base64BinaryType()), Arguments.arguments(UriType.class.getSimpleName(), new UriType())); }
Example #7
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static String getLanguageTranslation(Element element, String lang) { for (Extension e : element.getExtension()) { if (e.getUrl().equals(EXT_TRANSLATION)) { Extension e1 = ExtensionHelper.getExtension(e, "lang"); if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) { e1 = ExtensionHelper.getExtension(e, "content"); return ((StringType) e.getValue()).getValue(); } } } return null; }
Example #8
Source File: Example33_UseExtendedPatient.java From fhirstarters with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void main(String[] args) { Example32_ExtendedPatient pat = new Example32_ExtendedPatient(); pat.addName().setFamily("Simpson").addGiven("Homer"); pat.setEyeColour(new CodeType("blue")); IParser p = FhirContext.forDstu3().newXmlParser().setPrettyPrint(true); String encoded = p.encodeResourceToString(pat); System.out.println(encoded); }
Example #9
Source File: OrganizationResourceProvider.java From fhirstarters with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * The "@Read" annotation indicates that this method supports the read operation. It takes one argument, the Resource type being returned. * * @param theId * The read operation takes one parameter, which must be of type IdDt and must be annotated with the "@Read.IdParam" annotation. * @return Returns a resource matching this identifier, or null if none exists. */ @Read() public MyOrganization getResourceById(@IdParam IdType theId) { /* * We only support one organization, so the follwing * exception causes an HTTP 404 response if the * ID of "1" isn't used. */ if (!"1".equals(theId.getValue())) { throw new ResourceNotFoundException(theId); } MyOrganization retVal = new MyOrganization(); retVal.setId("1"); retVal.addIdentifier().setSystem("urn:example:orgs").setValue("FooOrganization"); retVal.addAddress().addLine("123 Fake Street").setCity("Toronto"); retVal.addTelecom().setUse(ContactPointUse.WORK).setValue("1-888-123-4567"); // Populate the first, primitive extension retVal.setBillingCode(new CodeType("00102-1")); // The second extension is repeatable and takes a block type MyOrganization.EmergencyContact contact = new MyOrganization.EmergencyContact(); contact.setActive(new BooleanType(true)); contact.setContact(new ContactPoint()); retVal.getEmergencyContact().add(contact); return retVal; }
Example #10
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public boolean generate(ResourceContext rcontext, OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.h2().addText(opd.getName()); x.para().addText(Utilities.capitalize(opd.getKind().toString())+": "+opd.getName()); x.para().tx("The official URL for this operation definition is: "); x.pre().tx(opd.getUrl()); addMarkdown(x, opd.getDescription()); if (opd.getSystem()) x.para().tx("URL: [base]/$"+opd.getCode()); for (CodeType c : opd.getResource()) { if (opd.getType()) x.para().tx("URL: [base]/"+c.getValue()+"/$"+opd.getCode()); if (opd.getInstance()) x.para().tx("URL: [base]/"+c.getValue()+"/[id]/$"+opd.getCode()); } x.para().tx("Parameters"); XhtmlNode tbl = x.table( "grid"); XhtmlNode tr = tbl.tr(); tr.td().b().tx("Use"); tr.td().b().tx("Name"); tr.td().b().tx("Cardinality"); tr.td().b().tx("Type"); tr.td().b().tx("Binding"); tr.td().b().tx("Documentation"); for (OperationDefinitionParameterComponent p : opd.getParameter()) { genOpParam(rcontext, tbl, "", p); } addMarkdown(x, opd.getComment()); inject(opd, x, NarrativeStatus.GENERATED); return true; }
Example #11
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private String gen(Extension extension) throws DefinitionException { if (extension.getValue() instanceof CodeType) return ((CodeType) extension.getValue()).getValue(); if (extension.getValue() instanceof Coding) return gen((Coding) extension.getValue()); throw new DefinitionException("Unhandled type "+extension.getValue().getClass().getName()); }
Example #12
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static boolean hasLanguageTranslation(Element element, String lang) { for (Extension e : element.getExtension()) { if (e.getUrl().equals(EXT_TRANSLATION)) { Extension e1 = ExtensionHelper.getExtension(e, "lang"); if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) return true; } } return false; }
Example #13
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void setCodeExtension(DomainResource resource, String uri, String value) { Extension ext = getExtension(resource, uri); if (ext != null) ext.setValue(new CodeType(value)); else resource.getExtension().add(new Extension(new UriType(uri)).setValue(new CodeType(value))); }
Example #14
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static List<CodeType> getSubsumes(ConceptDefinitionComponent c) { List<CodeType> res = new ArrayList<CodeType>(); for (Extension e : c.getExtension()) { if (EXT_SUBSUMES.equals(e.getUrl())) res.add((CodeType) e.getValue()); } return res; }
Example #15
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static Extension makeIssueSource(Source source) { Extension ex = new Extension(); // todo: write this up and get it published with the pack (and handle the redirect?) ex.setUrl(ToolingExtensions.EXT_ISSUE_SOURCE); CodeType c = new CodeType(); c.setValue(source.toString()); ex.setValue(c); return ex; }
Example #16
Source File: ProfileUtilitiesTests.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
/** * we're going to slice Patient.identifier */ private void testSlicingSimple() throws EOperationOutcome, Exception { StructureDefinition focus = new StructureDefinition(); StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); focus.setUrl(Utilities.makeUuidUrn()); focus.setBaseDefinition(base.getUrl()); focus.setType(base.getType()); focus.setDerivation(TypeDerivationRule.CONSTRAINT); // set the slice up ElementDefinition id = focus.getDifferential().addElement(); id.setPath("Patient.identifier"); id.getSlicing().setOrdered(false).setRules(SlicingRules.OPEN).addDiscriminator().setPath("use").setType(DiscriminatorType.VALUE); // first slice: id = focus.getDifferential().addElement(); id.setPath("Patient.identifier"); id.setSliceName("name1"); id = focus.getDifferential().addElement(); id.setPath("Patient.identifier.use"); id.setFixed(new CodeType("usual")); // second slice: id = focus.getDifferential().addElement(); id.setPath("Patient.identifier"); id.setSliceName("name2"); id = focus.getDifferential().addElement(); id.setPath("Patient.identifier.use"); id.setFixed(new CodeType("official")); List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); // 18 different: identifier + 8 inner children * 2 boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size() - 18; for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { if (ok) { ElementDefinition b = base.getSnapshot().getElement().get(i); ElementDefinition f = focus.getSnapshot().getElement().get(i <= 9 ? i : i + 18); if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) ok = false; else { f.setBase(null); if (f.getPath().equals("Patient.identifier")) { ok = f.hasSlicing(); if (ok) f.setSlicing(null); } ok = Base.compareDeep(b, f, true); } } } // now, check that the slices we skipped are correct: for (int i = 10; i <= 18; i++) { if (ok) { ElementDefinition d1 = focus.getSnapshot().getElement().get(i); ElementDefinition d2 = focus.getSnapshot().getElement().get(i+9); if (d1.getPath().equals("Patient.identifier.use")) { ok = d1.hasFixed() && d2.hasFixed() && !Base.compareDeep(d1.getFixed(), d2.getFixed(), true); if (ok) { d1.setFixed(null); d2.setFixed(null); } } if (d1.getPath().equals("Patient.identifier")) { ok = d1.hasSliceName() && d2.hasSliceName() && !Base.compareDeep(d1.getSliceNameElement(), d2.getSliceNameElement(), true); if (ok) { d1.setSliceName(null); d2.setSliceName(null); } } ok = Base.compareDeep(d1, d2, true); } } // for throughness, we could check against identifier too, but this is not done now. if (!ok) { compareXml(base, focus); throw new FHIRException("Snap shot generation slicing failed"); } else System.out.println("Snap shot generation slicing passed"); }
Example #17
Source File: TestData.java From bunsen with Apache License 2.0 | 4 votes |
/** * 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 #18
Source File: TranslationMatches.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
public CodeType getEquivalence() { return myEquivalence; }
Example #19
Source File: TranslationMatches.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
public void setEquivalence(CodeType theEquivalence) { myEquivalence = theEquivalence; }
Example #20
Source File: MyOrganization.java From fhirstarters with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void setBillingCode(CodeType theBillingCode) { myBillingCode = theBillingCode; }
Example #21
Source File: ProfileUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
private boolean isCoded(Type fixed) { return (fixed instanceof Coding) || (fixed instanceof CodeableConcept) || (fixed instanceof CodeType) || (fixed instanceof Quantity); }
Example #22
Source File: RdfParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
protected void decorateCode(Complex t, CodeType value) { }
Example #23
Source File: Example32_ExtendedPatient.java From fhirstarters with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void setEyeColour(CodeType theEyeColour) { myEyeColour = theEyeColour; }
Example #24
Source File: Example99_UseExtensions.java From fhirstarters with BSD 3-Clause "New" or "Revised" License | 3 votes |
public static void main(String[] args) { Example32_ExtendedPatient pat = new Example32_ExtendedPatient(); pat.addName().setFamily("Simpson").addGiven("Homer"); pat.setEyeColour(new CodeType("blue")); IParser p = FhirContext.forDstu3().newXmlParser().setPrettyPrint(true); String encoded = p.encodeResourceToString(pat); System.out.println(encoded); }