org.hl7.fhir.dstu3.model.Organization Java Examples
The following examples show how to use
org.hl7.fhir.dstu3.model.Organization.
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: OrganizationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Update public MethodOutcome updateOrganization(HttpServletRequest theRequest,@ResourceParam Organization organization, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Organization newOrganization = organisationDao.create(ctx, organization, theId, theConditional); method.setId(newOrganization.getIdElement()); method.setResource(newOrganization); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example #2
Source File: OrganizationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Create public MethodOutcome createOrganization(HttpServletRequest theRequest,@ResourceParam Organization organization) { resourcePermissionProvider.checkPermission("create"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Organization newOrganization = organisationDao.create(ctx, organization,null,null); method.setId(newOrganization.getIdElement()); method.setResource(newOrganization); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example #3
Source File: OrganizationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
@Read() public Organization getOrganizationById(@IdParam IdType organisationId) { resourcePermissionProvider.checkPermission("read"); Organization organisation = organisationDao.read(ctx, organisationId); if ( organisation == null) { throw OperationOutcomeFactory.buildOperationOutcomeException( new ResourceNotFoundException("No Organization/" + organisationId.getIdPart()), OperationOutcome.IssueType.NOTFOUND); } return organisation; }
Example #4
Source File: OrganisationEntityToFHIROrganizationTransformerTest.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
@Test public void testOrganisationTransform(){ OrganisationEntity organisationEntity = new OrganisationEntityBuilder().build(); Organization organisation = transformer.transform(organisationEntity); assertThat(organisation, not(nullValue())); assertThat(organisation.getId(), equalTo((new Long(OrganisationEntityBuilder.DEFAULT_ID)).toString())); }
Example #5
Source File: FhirStu3.java From synthea with Apache License 2.0 | 5 votes |
/** * Find the provider entry in this bundle, and return the associated "fullUrl" attribute. * @param provider A given provider. * @param bundle The current bundle being generated. * @return Provider.fullUrl if found, otherwise null. */ private static String findProviderUrl(Provider provider, Bundle bundle) { for (BundleEntryComponent entry : bundle.getEntry()) { if (entry.getResource().fhirType().equals("Organization")) { Organization org = (Organization) entry.getResource(); if (org.getIdentifierFirstRep().getValue().equals(provider.getResourceID())) { return entry.getFullUrl(); } } } return null; }
Example #6
Source File: HospitalExporterStu3.java From synthea with Apache License 2.0 | 5 votes |
/** * Export the hospital in FHIR STU3 format. */ public static void export(long stop) { if (Boolean.parseBoolean(Config.get("exporter.hospital.fhir_stu3.export"))) { Bundle bundle = new Bundle(); if (Boolean.parseBoolean(Config.get("exporter.fhir.transaction_bundle"))) { bundle.setType(BundleType.TRANSACTION); } else { bundle.setType(BundleType.COLLECTION); } for (Provider h : Provider.getProviderList()) { // filter - exports only those hospitals in use Table<Integer, String, AtomicInteger> utilization = h.getUtilization(); int totalEncounters = utilization.column(Provider.ENCOUNTERS).values().stream() .mapToInt(ai -> ai.get()).sum(); if (totalEncounters > 0) { BundleEntryComponent entry = FhirStu3.provider(bundle, h); addHospitalExtensions(h, (Organization) entry.getResource()); } } String bundleJson = FHIR_CTX.newJsonParser().setPrettyPrint(true) .encodeResourceToString(bundle); // get output folder List<String> folders = new ArrayList<>(); folders.add("fhir_stu3"); String baseDirectory = Config.get("exporter.baseDirectory"); File f = Paths.get(baseDirectory, folders.toArray(new String[0])).toFile(); f.mkdirs(); Path outFilePath = f.toPath().resolve("hospitalInformation" + stop + ".json"); try { Files.write(outFilePath, Collections.singleton(bundleJson), StandardOpenOption.CREATE_NEW); } catch (IOException e) { e.printStackTrace(); } } }
Example #7
Source File: OrganizationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Override public Class<Organization> getResourceType() { return Organization.class; }
Example #8
Source File: OrganizationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Validate public MethodOutcome testResource(@ResourceParam Organization resource, @Validate.Mode ValidationModeEnum theMode, @Validate.Profile String theProfile) { return resourceTestProvider.testResource(resource,theMode,theProfile); }
Example #9
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 #10
Source File: OrganisationRepository.java From careconnect-reference-implementation with Apache License 2.0 | votes |
Organization read(FhirContext ctx,IdType theId);
Example #11
Source File: OrganisationRepository.java From careconnect-reference-implementation with Apache License 2.0 | votes |
Organization create(FhirContext ctx,Organization organization, @IdParam IdType theId, @ConditionalUrlParam String theConditional) throws OperationOutcomeException;