本文整理汇总了Java中ca.uhn.fhir.context.FhirContext.forDstu2Hl7Org方法的典型用法代码示例。如果您正苦于以下问题:Java FhirContext.forDstu2Hl7Org方法的具体用法?Java FhirContext.forDstu2Hl7Org怎么用?Java FhirContext.forDstu2Hl7Org使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.uhn.fhir.context.FhirContext
的用法示例。
在下文中一共展示了FhirContext.forDstu2Hl7Org方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadHapiTestData
import ca.uhn.fhir.context.FhirContext; //导入方法依赖的package包/类
/**
* Load test data files onto HAPI test server using FileBasedFhirDstu2Provider
* Assumes each resource has an identifier with system http://mcm.usciitg-prep.org
* and value equal to json file resource Id
*
* @throws JAXBException
*/
@BeforeClass
public static void loadHapiTestData() throws JAXBException {
FhirContext fhirContext = FhirContext.forDstu2Hl7Org();
FileBasedFhirDstu2Provider provider = new FileBasedFhirDstu2Provider(System.getProperty("user.dir") + "/src/test/resources/org/partners/usciitg_prep/fhir/cql/data", null);
provider.setFhirContext(fhirContext);
provider.setPackageName("org.hl7.fhir.instance.model");
UsciitgLibraryManager libraryManager = new UsciitgLibraryManager(
new ModelManager(),
System.getProperty("user.dir") + "/src/test/resources/org/partners/usciitg_prep/fhir/cql");
LibraryLoader libraryLoader = new LibraryLoaderImpl(libraryManager);
VersionedIdentifier libraryIdentifier = new VersionedIdentifier()
.withId("usciitg_flu_study");
Context context = new Context(libraryLoader.load(libraryIdentifier));
TerminologyProvider terminologyProvider = new TestTerminologyProvider();
provider.setTerminologyProvider(terminologyProvider);
context.registerDataProvider("http://hl7.org/fhir", provider);
context.registerTerminologyProvider(terminologyProvider);
context.setContextValue("Patient", "fhirTest");
IGenericClient client = fhirContext.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu2");
Iterable<Object> resources = provider.retrieve("Patient", "fhirTest", "Patient", null, null, null, null, null, null, null, null);
createServerResources(client, resources, "Patient");
resources = provider.retrieve("Patient", "fhirTest", "Observation", null, null, null, null, null, null, null, null);
deleteServerResources(client, resources, "Observation");
createServerResources(client, resources, "Observation");
resources = provider.retrieve("Patient", "fhirTest", "MedicationOrder", null, null, null, null, null, null, null, null);
deleteServerResources(client, resources, "MedicationOrder");
createServerResources(client, resources, "MedicationOrder");
resources = provider.retrieve("Patient", "fhirTest", "Immunization", null, null, null, null, null, null, null, null);
deleteServerResources(client, resources, "Immunization");
createServerResources(client, resources, "Immunization");
}
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:45,代码来源:UsciitgFhirDataProviderHL7IT.java
示例2: getPatient
import ca.uhn.fhir.context.FhirContext; //导入方法依赖的package包/类
public PatientInformation getPatient(String endpoint, String PatientId) throws UnsupportedEncodingException {
FhirContext ctx = FhirContext.forDstu2Hl7Org();// ca.uhn.fhir.model.dstu2.resource.Patient
IGenericClient client = ctx.newRestfulGenericClient(endpoint);
org.hl7.fhir.instance.model.Bundle bundleResult = client.search()
.byUrl("/Patient?_id=" + URLEncoder.encode(PatientId, "UTF-8"))
.returnBundle(org.hl7.fhir.instance.model.Bundle.class)
.execute();
if (bundleResult != null && bundleResult.hasEntry()) {
for (Bundle.BundleEntryComponent bundleEntryComponent : bundleResult
.getEntry()) {
if (bundleEntryComponent.getResource().getResourceType() == ResourceType.Patient) {
Patient patient = (Patient) bundleEntryComponent
.getResource();
String resultName = "";
if (patient.getName() != null
&& patient.getName().size() > 0) {
if (patient.getName().get(0).getFamily() != null
&& patient.getName().get(0).getFamily()
.size() > 0) {
resultName = patient.getName().get(0)
.getFamily().get(0).getValueNotNull();
}
if (patient.getName().get(0).getGiven() != null
&& patient.getName().get(0).getGiven()
.size() > 0) {
if (!resultName.isEmpty()) {
resultName += ", ";
}
resultName += patient.getName().get(0)
.getGiven().get(0).getValueNotNull();
}
}
PatientInformation patientInformation = new PatientInformation();
patientInformation.setName(resultName);
patientInformation.setId(patient.getId());
if (patient.getBirthDate() == null) {
patientInformation.setDoB(null);
} else {
patientInformation.setDoB(patient.getBirthDate()
.toString());
}
return patientInformation;
}
}
}
return null;
}