当前位置: 首页>>代码示例>>Java>>正文


Java IBundleProvider类代码示例

本文整理汇总了Java中ca.uhn.fhir.rest.api.server.IBundleProvider的典型用法代码示例。如果您正苦于以下问题:Java IBundleProvider类的具体用法?Java IBundleProvider怎么用?Java IBundleProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IBundleProvider类属于ca.uhn.fhir.rest.api.server包,在下文中一共展示了IBundleProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluatePatientListMeasure

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
private MeasureReport evaluatePatientListMeasure(Measure measure, String practitioner) {
        SearchParameterMap map = new SearchParameterMap();
        map.add("general-practitioner", new ReferenceParam(practitioner));
        IBundleProvider patientProvider = ((PatientResourceProvider) provider.resolveResourceProvider("Patient")).getDao().search(map);
        List<IBaseResource> patientList = patientProvider.getResources(0, patientProvider.size());

        if (patientList.isEmpty()) {
            throw new IllegalArgumentException("No patients were found with practitioner reference " + practitioner);
        }

        List<Patient> patients = new ArrayList<>();
        patientList.forEach(x -> patients.add((Patient) x));

//        context.setContextValue("Population", patients);

        report = evaluator.evaluate(context, measure, patients, measurementPeriod, MeasureReport.MeasureReportType.PATIENTLIST);
        validateReport();
        return report;
    }
 
开发者ID:DBCG,项目名称:cqf-ruler,代码行数:20,代码来源:FHIRMeasureResourceProvider.java

示例2: testSearchWithFetchSizeDefaultMaximum

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
@Test
public void testSearchWithFetchSizeDefaultMaximum() {
	myDaoConfig.setFetchSizeDefaultMaximum(5);
	
	for (int i = 0; i < 10; i++) {
		Patient p = new Patient();
		p.addName().setFamily("PT" + i);
		myPatientDao.create(p);
	}
	
	SearchParameterMap map = new SearchParameterMap();
	map.setLoadSynchronous(true);
	IBundleProvider values = myPatientDao.search(map);
	assertEquals(5, values.size().intValue());
	assertEquals(5, values.getResources(0, 1000).size());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:17,代码来源:FhirResourceDaoDstu3SearchNoFtTest.java

示例3: testSearchWithMissingDate2

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
@Test
public void testSearchWithMissingDate2() {
	MedicationRequest mr1 = new MedicationRequest();
	mr1.getCategory().addCoding().setSystem("urn:medicationroute").setCode("oral");
	mr1.addDosageInstruction().getTiming().addEventElement().setValueAsString("2017-01-01");
	IIdType id1 = myMedicationRequestDao.create(mr1).getId().toUnqualifiedVersionless();
	
	MedicationRequest mr2 = new MedicationRequest();
	mr2.getCategory().addCoding().setSystem("urn:medicationroute").setCode("oral");
	IIdType id2 = myMedicationRequestDao.create(mr2).getId().toUnqualifiedVersionless();

	SearchParameterMap map = new SearchParameterMap();
	map.add(MedicationRequest.SP_DATE, new DateParam().setMissing(true));
	IBundleProvider results = myMedicationRequestDao.search(map);
	List<String> ids = toUnqualifiedVersionlessIdValues(results);

	assertThat(ids, contains(id2.getValue()));
	
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:20,代码来源:FhirResourceDaoDstu3SearchNoFtTest.java

示例4: testSearchSynchronousUsingUniqueComposite

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
@Test
public void testSearchSynchronousUsingUniqueComposite() {
	createUniqueBirthdateAndGenderSps();

	Patient pt1 = new Patient();
	pt1.setGender(Enumerations.AdministrativeGender.MALE);
	pt1.setBirthDateElement(new DateType("2011-01-01"));
	IIdType id1 = myPatientDao.create(pt1).getId().toUnqualifiedVersionless();

	Patient pt2 = new Patient();
	pt2.setGender(Enumerations.AdministrativeGender.MALE);
	pt2.setBirthDateElement(new DateType("2011-01-02"));
	IIdType id2 = myPatientDao.create(pt2).getId().toUnqualifiedVersionless();

	SearchBuilder.resetLastHandlerMechanismForUnitTest();
	SearchParameterMap params = new SearchParameterMap();
	params.setLoadSynchronousUpTo(100);
	params.add("gender", new TokenParam("http://hl7.org/fhir/administrative-gender", "male"));
	params.add("birthdate", new DateParam("2011-01-01"));
	IBundleProvider results = myPatientDao.search(params);
	assertThat(toUnqualifiedVersionlessIdValues(results), containsInAnyOrder(id1.getValue()));
	assertEquals(SearchBuilder.HandlerTypeEnum.UNIQUE_INDEX, SearchBuilder.getLastHandlerMechanismForUnitTest());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:24,代码来源:FhirResourceDaoDstu3UniqueSearchParamTest.java

示例5: testAsyncSearchSmallResultSetSameCoordinator

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
@Test
public void testAsyncSearchSmallResultSetSameCoordinator() {
	SearchParameterMap params = new SearchParameterMap();
	params.add("name", new StringParam("ANAME"));

	List<Long> pids = createPidSequence(10, 100);
	SlowIterator<Long> iter = new SlowIterator<Long>(pids.iterator(), 2);
	when(mySearchBuider.createQuery(Mockito.same(params), any(String.class))).thenReturn(iter);

	doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));

	IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
	assertNotNull(result.getUuid());
	assertEquals(90, result.size().intValue());

	List<IBaseResource> resources = result.getResources(0, 30);
	assertEquals(30, resources.size());
	assertEquals("10", resources.get(0).getIdElement().getValueAsString());
	assertEquals("39", resources.get(29).getIdElement().getValueAsString());

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:22,代码来源:SearchCoordinatorSvcImplTest.java

示例6: testChainedMedication

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
/**
 * See #441
 */
@Test
public void testChainedMedication() {
	Medication medication = new Medication();
	medication.getCode().addCoding().setSystem("SYSTEM").setCode("04823543");
	IIdType medId = myMedicationDao.create(medication).getId().toUnqualifiedVersionless();

	MedicationAdministration ma = new MedicationAdministration();
	ma.setMedication(new Reference(medId));
	IIdType moId = myMedicationAdministrationDao.create(ma).getId().toUnqualified();

	SearchParameterMap map = new SearchParameterMap();
	map.add(MedicationAdministration.SP_MEDICATION, new ReferenceAndListParam().addAnd(new ReferenceOrListParam().add(new ReferenceParam("code", "04823543"))));
	IBundleProvider results = myMedicationAdministrationDao.search(map);
	List<String> ids = toUnqualifiedIdValues(results);

	assertThat(ids, contains(moId.getValue()));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:21,代码来源:FhirResourceDaoR4SearchNoFtTest.java

示例7: testSearchWithUriParam

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
@Test
public void testSearchWithUriParam() throws Exception {
	Class<ValueSet> type = ValueSet.class;
	String resourceName = "/valueset-dstu2.json";
	ValueSet vs = loadResourceFromClasspath(type, resourceName);
	IIdType id1 = myValueSetDao.update(vs, mySrd).getId().toUnqualifiedVersionless();

	ValueSet vs2 = new ValueSet();
	vs2.setUrl("http://hl7.org/foo/bar");
	myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless();

	IBundleProvider result;
	result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/basic-resource-type")));
	assertThat(toUnqualifiedVersionlessIds(result), contains(id1));

	result = myValueSetDao
			.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/basic-resource-type").setQualifier(UriParamQualifierEnum.BELOW)));
	assertThat(toUnqualifiedVersionlessIds(result), contains(id1));

	result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/").setQualifier(UriParamQualifierEnum.BELOW)));
	assertThat(toUnqualifiedVersionlessIds(result), contains(id1));

	result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/FOOOOOO")));
	assertThat(toUnqualifiedVersionlessIds(result), empty());

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:27,代码来源:FhirResourceDaoDstu3SearchNoFtTest.java

示例8: doEverythingOperation

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
private IBundleProvider doEverythingOperation(IIdType theId, IPrimitiveType<Integer> theCount, DateRangeParam theLastUpdated, SortSpec theSort, StringAndListParam theContent, StringAndListParam theNarrative, RequestDetails theRequestDetails) {
	SearchParameterMap paramMap = new SearchParameterMap();
	if (theCount != null) {
		paramMap.setCount(theCount.getValue());
	}
	if (theContent != null) {
		paramMap.add(Constants.PARAM_CONTENT, theContent);
	}
	if (theNarrative != null) {
		paramMap.add(Constants.PARAM_TEXT, theNarrative);
	}
	paramMap.setIncludes(Collections.singleton(IResource.INCLUDE_ALL.asRecursive()));
	paramMap.setEverythingMode(theId != null ? EverythingModeEnum.PATIENT_INSTANCE : EverythingModeEnum.PATIENT_TYPE);
	paramMap.setSort(theSort);
	paramMap.setLastUpdated(theLastUpdated);
	if (theId != null) {
		paramMap.add("_id", new StringParam(theId.getIdPart()));
	}
	
	if (!isPagingProviderDatabaseBacked(theRequestDetails)) {
		paramMap.setLoadSynchronous(true);
	}
	
	return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName(), new CacheControlDirective().parse(theRequestDetails.getHeaders(Constants.HEADER_CACHE_CONTROL)));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:26,代码来源:FhirResourceDaoPatientDstu3.java

示例9: testSearchWithNoResults

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
@Test
public void testSearchWithNoResults() {
	Device dev = new Device();
	dev.addIdentifier().setSystem("Foo");
	myDeviceDao.create(dev, mySrd);

	IBundleProvider value = myDeviceDao.search(new SearchParameterMap());
	ourLog.info("Initial size: " + value.size());
	for (IBaseResource next : value.getResources(0, value.size())) {
		ourLog.info("Deleting: {}", next.getIdElement());
		myDeviceDao.delete((IIdType) next.getIdElement(), mySrd);
	}

	value = myDeviceDao.search(new SearchParameterMap());
	if (value.size() > 0) {
		ourLog.info("Found: " + (value.getResources(0, 1).get(0).getIdElement()));
		fail(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(value.getResources(0, 1).get(0)));
	}
	assertEquals(0, value.size().intValue());

	List<IBaseResource> res = value.getResources(0, 0);
	assertTrue(res.isEmpty());

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:25,代码来源:FhirResourceDaoDstu2SearchNoFtTest.java

示例10: testReverseIncludes

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
@Test
public void testReverseIncludes() {
	String methodName = "testReverseIncludes";
	Organization org = new Organization();
	org.setName("X" + methodName + "X");
	IIdType orgId = myOrganizationDao.create(org, mySrd).getId();

	Patient pat = new Patient();
	pat.addName().setFamily("X" + methodName + "X");
	pat.getManagingOrganization().setReferenceElement(orgId.toUnqualifiedVersionless());
	myPatientDao.create(pat, mySrd);

	SearchParameterMap map = new SearchParameterMap();
	map.add(Organization.SP_NAME, new StringParam("X" + methodName + "X"));
	map.setRevIncludes(Collections.singleton(Patient.INCLUDE_ORGANIZATION));
	IBundleProvider resultsP = myOrganizationDao.search(map);
	assertEquals(1, resultsP.size().intValue());

	List<IBaseResource> results = resultsP.getResources(0, resultsP.size());
	assertEquals(2, results.size());
	assertEquals(Organization.class, results.get(0).getClass());
	assertEquals(BundleEntrySearchModeEnum.MATCH.getCode(), ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get((IAnyResource) results.get(0)));
	assertEquals(Patient.class, results.get(1).getClass());
	assertEquals(BundleEntrySearchModeEnum.INCLUDE.getCode(), ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get((IAnyResource) results.get(1)));
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:26,代码来源:FhirResourceDaoR4Test.java

示例11: encounterInstanceEverything

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
@Override
	public IBundleProvider encounterInstanceEverything(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType<Integer> theCount, DateRangeParam theLastUpdated, SortSpec theSort) {
		SearchParameterMap paramMap = new SearchParameterMap();
		if (theCount != null) {
			paramMap.setCount(theCount.getValue());
		}

//		paramMap.setRevIncludes(Collections.singleton(IResource.INCLUDE_ALL.asRecursive()));
		paramMap.setIncludes(Collections.singleton(IResource.INCLUDE_ALL.asRecursive()));
		paramMap.setEverythingMode(theId != null ? EverythingModeEnum.ENCOUNTER_INSTANCE : EverythingModeEnum.ENCOUNTER_TYPE);
		paramMap.setSort(theSort);
		paramMap.setLastUpdated(theLastUpdated);
		if (theId != null) {
			paramMap.add("_id", new StringParam(theId.getIdPart()));
		}
		IBundleProvider retVal = search(paramMap);
		return retVal;
	}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:19,代码来源:FhirResourceDaoEncounterDstu2.java

示例12: testSearchWithNoResults

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
@Test
public void testSearchWithNoResults() {
	Device dev = new Device();
	dev.addIdentifier().setSystem("Foo");
	myDeviceDao.create(dev, mySrd);

	IBundleProvider value = myDeviceDao.search(new SearchParameterMap());
	ourLog.info("Initial size: " + value.size());
	for (IBaseResource next : value.getResources(0, value.size())) {
		ourLog.info("Deleting: {}", next.getIdElement());
		myDeviceDao.delete(next.getIdElement(), mySrd);
	}

	value = myDeviceDao.search(new SearchParameterMap());
	if (value.size() > 0) {
		ourLog.info("Found: " + (value.getResources(0, 1).get(0).getIdElement()));
		fail(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(value.getResources(0, 1).get(0)));
	}
	assertEquals(0, value.size().intValue());

	List<IBaseResource> res = value.getResources(0, 0);
	assertTrue(res.isEmpty());

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:25,代码来源:FhirResourceDaoR4SearchNoFtTest.java

示例13: testTransactionWithReferenceUuid

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
@Test
public void testTransactionWithReferenceUuid() {
	Bundle request = new Bundle();

	Patient p = new Patient();
	p.setActive(true);
	p.setId(IdType.newRandomUuid());
	request.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.POST).setUrl(p.getId());

	Observation o = new Observation();
	o.getCode().setText("Some Observation");
	o.getSubject().setReference(p.getId());
	request.addEntry().setResource(o).getRequest().setMethod(HTTPVerb.POST);

	Bundle resp = mySystemDao.transaction(mySrd, request);
	ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp));

	String patientId = new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualifiedVersionless().getValue();
	assertThat(patientId, startsWith("Patient/"));

	SearchParameterMap params = new SearchParameterMap();
	params.setLoadSynchronous(true);
	params.add("subject", new ReferenceParam(patientId));
	IBundleProvider found = myObservationDao.search(params);
	assertEquals(1, found.size().intValue());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:27,代码来源:FhirSystemDaoR4Test.java

示例14: testTransactionDoesNotLeavePlaceholderIds

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
@Test
public void testTransactionDoesNotLeavePlaceholderIds() throws Exception {
	String input;
	try {
		input = IOUtils.toString(getClass().getResourceAsStream("/cdr-bundle.json"), StandardCharsets.UTF_8);
	} catch (IOException e) {
		fail(e.toString());
		return;
	}
	Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
	mySystemDao.transaction(mySrd, bundle);

	IBundleProvider history = mySystemDao.history(null, null, null);
	Bundle list = toBundleR4(history);
	ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(list));

	assertEquals(6, list.getEntry().size());

	Patient p = find(list, Patient.class, 0);
	assertTrue(p.getIdElement().isIdPartValidLong());
	assertTrue(p.getGeneralPractitionerFirstRep().getReferenceElement().isIdPartValidLong());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:23,代码来源:FhirSystemDaoR4Test.java

示例15: toUnqualifiedVersionlessIds

import ca.uhn.fhir.rest.api.server.IBundleProvider; //导入依赖的package包/类
protected List<IIdType> toUnqualifiedVersionlessIds(IBundleProvider theFound) {
	List<IIdType> retVal = new ArrayList<>();
	Integer size = theFound.size();
	StopWatch sw = new StopWatch();
	while (size == null) {
		int timeout = 20000;
		if (sw.getMillis() > timeout) {
			fail("Waited over "+timeout+"ms for search");
		}
		try {
			Thread.sleep(100);
		} catch (InterruptedException theE) {
			//ignore
		}
		size = theFound.size();
	}

	ourLog.info("Found {} results", size);
	List<IBaseResource> resources = theFound.getResources(0, size);
	for (IBaseResource next : resources) {
		retVal.add(next.getIdElement().toUnqualifiedVersionless());
	}
	return retVal;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:25,代码来源:BaseJpaTest.java


注:本文中的ca.uhn.fhir.rest.api.server.IBundleProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。