Java Code Examples for org.hl7.fhir.dstu3.model.Extension#setValue()
The following examples show how to use
org.hl7.fhir.dstu3.model.Extension#setValue() .
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: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void setAllowableUnits(ElementDefinition eld, CodeableConcept cc) { for (Extension e : eld.getExtension()) if (e.getUrl().equals(EXT_ALLOWABLE_UNITS)) { e.setValue(cc); return; } eld.getExtension().add(new Extension().setUrl(EXT_ALLOWABLE_UNITS).setValue(cc)); }
Example 2
Source File: AbstractFindingModelAdapter.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public void addStringExtension(String theUrl, String theValue){ Optional<IBaseResource> resource = loadResource(); if (resource.isPresent() && resource.get() instanceof DomainResource) { DomainResource domainResource = (DomainResource) resource.get(); Extension extension = new Extension(theUrl); extension.setValue(new StringType().setValue(theValue)); domainResource.addExtension(extension); saveResource(domainResource); } }
Example 3
Source File: ObservationAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void setExtensions(ObservationComponent iComponent, Element observationComponentComponent){ for (String url : iComponent.getExtensions().keySet()) { Extension extension = new Extension(url); extension.setValue(new StringType().setValue(iComponent.getExtensions().get(url))); observationComponentComponent.addExtension(extension); } }
Example 4
Source File: FhirStu3.java From synthea with Apache License 2.0 | 5 votes |
/** * Create an extension in with a valueMoney in USD. * @param url The url of the extension. * @param value The value in USD. * @return the Extension */ private static Extension createMoneyExtension(String url, double value) { Money money = new Money(); money.setValue(value); money.setSystem("urn:iso:std:iso:4217"); money.setCode("USD"); Extension extension = new Extension(); extension.setUrl(url); extension.setValue(money); return extension; }
Example 5
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void setExtension(Element focus, String url, Coding c) { for (Extension e : focus.getExtension()) if (e.getUrl().equals(url)) { e.setValue(c); return; } focus.getExtension().add(new Extension().setUrl(url).setValue(c)); }
Example 6
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void addDEReference(DataElement de, String value) { for (Extension e : de.getExtension()) if (e.getUrl().equals(EXT_CIMI_REFERENCE)) { e.setValue(new UriType(value)); return; } de.getExtension().add(new Extension().setUrl(EXT_CIMI_REFERENCE).setValue(new UriType(value))); }
Example 7
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 8
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void setIntegerExtension(DomainResource resource, String uri, int value) { Extension ext = getExtension(resource, uri); if (ext != null) ext.setValue(new IntegerType(value)); else resource.getExtension().add(new Extension(new UriType(uri)).setValue(new IntegerType(value))); }
Example 9
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 10
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void setStringExtension(Element element, String uri, String value) { Extension ext = getExtension(element, uri); if (ext != null) ext.setValue(new StringType(value)); else element.getExtension().add(new Extension(new UriType(uri)).setValue(new StringType(value))); }
Example 11
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void setStringExtension(DomainResource resource, String uri, String value) { Extension ext = getExtension(resource, uri); if (ext != null) ext.setValue(new StringType(value)); else resource.getExtension().add(new Extension(new UriType(uri)).setValue(new StringType(value))); }
Example 12
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void addIntegerExtension(DomainResource dr, String url, int value) { Extension ex = getExtension(dr, url); if (ex != null) ex.setValue(new IntegerType(value)); else dr.getExtension().add(Factory.newExtension(url, new IntegerType(value), true)); }
Example 13
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void addStringExtension(DomainResource e, String url, String content) { if (!StringUtils.isBlank(content)) { Extension ex = getExtension(e, url); if (ex != null) ex.setValue(new StringType(content)); else e.getExtension().add(Factory.newExtension(url, new StringType(content), true)); } }
Example 14
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void addStringExtension(Element e, String url, String content) { if (!StringUtils.isBlank(content)) { Extension ex = getExtension(e, url); if (ex != null) ex.setValue(new StringType(content)); else e.getExtension().add(Factory.newExtension(url, new StringType(content), true)); } }
Example 15
Source File: ToolingExtensions.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void addMarkdownExtension(DomainResource dr, String url, String content) { if (!StringUtils.isBlank(content)) { Extension ex = getExtension(dr, url); if (ex != null) ex.setValue(new StringType(content)); else dr.getExtension().add(Factory.newExtension(url, new MarkdownType(content), true)); } }
Example 16
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 17
Source File: HospitalExporterStu3.java From synthea with Apache License 2.0 | 4 votes |
/** * Add FHIR extensions to capture additional information. */ public static void addHospitalExtensions(Provider h, Organization organizationResource) { Table<Integer, String, AtomicInteger> utilization = h.getUtilization(); // calculate totals for utilization int totalEncounters = utilization.column(Provider.ENCOUNTERS).values().stream() .mapToInt(ai -> ai.get()).sum(); Extension encountersExtension = new Extension(SYNTHEA_URI + "utilization-encounters-extension"); IntegerType encountersValue = new IntegerType(totalEncounters); encountersExtension.setValue(encountersValue); organizationResource.addExtension(encountersExtension); int totalProcedures = utilization.column(Provider.PROCEDURES).values().stream() .mapToInt(ai -> ai.get()).sum(); Extension proceduresExtension = new Extension(SYNTHEA_URI + "utilization-procedures-extension"); IntegerType proceduresValue = new IntegerType(totalProcedures); proceduresExtension.setValue(proceduresValue); organizationResource.addExtension(proceduresExtension); int totalLabs = utilization.column(Provider.LABS).values().stream().mapToInt(ai -> ai.get()) .sum(); Extension labsExtension = new Extension(SYNTHEA_URI + "utilization-labs-extension"); IntegerType labsValue = new IntegerType(totalLabs); labsExtension.setValue(labsValue); organizationResource.addExtension(labsExtension); int totalPrescriptions = utilization.column(Provider.PRESCRIPTIONS).values().stream() .mapToInt(ai -> ai.get()).sum(); Extension prescriptionsExtension = new Extension( SYNTHEA_URI + "utilization-prescriptions-extension"); IntegerType prescriptionsValue = new IntegerType(totalPrescriptions); prescriptionsExtension.setValue(prescriptionsValue); organizationResource.addExtension(prescriptionsExtension); Integer bedCount = h.getBedCount(); if (bedCount != null) { Extension bedCountExtension = new Extension(SYNTHEA_URI + "bed-count-extension"); IntegerType bedCountValue = new IntegerType(bedCount); bedCountExtension.setValue(bedCountValue); organizationResource.addExtension(bedCountExtension); } }
Example 18
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 4 votes |
@Operation(name = "$evaluate-measure", idempotent = true, type = Measure.class) public MeasureReport evaluateMeasure(@IdParam IdType theId, @RequiredParam(name = "periodStart") String periodStart, @RequiredParam(name = "periodEnd") String periodEnd, @OptionalParam(name = "measure") String measureRef, @OptionalParam(name = "reportType") String reportType, @OptionalParam(name = "patient") String patientRef, @OptionalParam(name = "productLine") String productLine, @OptionalParam(name = "practitioner") String practitionerRef, @OptionalParam(name = "lastReceivedOn") String lastReceivedOn, @OptionalParam(name = "source") String source, @OptionalParam(name = "user") String user, @OptionalParam(name = "pass") String pass) throws InternalErrorException, FHIRException { LibraryLoader libraryLoader = LibraryHelper.createLibraryLoader(this.libraryResolutionProvider); MeasureEvaluationSeed seed = new MeasureEvaluationSeed(this.factory, libraryLoader, this.libraryResolutionProvider); Measure measure = this.measureResourceProvider.getDao().read(theId); if (measure == null) { throw new RuntimeException("Could not find Measure/" + theId.getIdPart()); } seed.setup(measure, periodStart, periodEnd, productLine, source, user, pass); // resolve report type MeasureEvaluation evaluator = new MeasureEvaluation(seed.getDataProvider(), this.registry, seed.getMeasurementPeriod()); if (reportType != null) { switch (reportType) { case "patient": return evaluator.evaluatePatientMeasure(seed.getMeasure(), seed.getContext(), patientRef); case "patient-list": return evaluator.evaluatePatientListMeasure(seed.getMeasure(), seed.getContext(), practitionerRef); case "population": return evaluator.evaluatePopulationMeasure(seed.getMeasure(), seed.getContext()); default: throw new IllegalArgumentException("Invalid report type: " + reportType); } } // default report type is patient MeasureReport report = evaluator.evaluatePatientMeasure(seed.getMeasure(), seed.getContext(), patientRef); if (productLine != null) { Extension ext = new Extension(); ext.setUrl("http://hl7.org/fhir/us/cqframework/cqfmeasures/StructureDefinition/cqfm-productLine"); ext.setValue(new StringType(productLine)); report.addExtension(ext); } return report; }
Example 19
Source File: AbstractFindingsAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
public void addStringExtension(DomainResource resource, String theUrl, String theValue){ Extension extension = new Extension(theUrl); extension.setValue(new StringType().setValue(theValue)); resource.addExtension(extension); }