• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IGenericClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: deleteServerResources

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
private static void deleteServerResources(IGenericClient client, Iterable<Object> resources, String dataType){
	for(Object obj : resources){
		IBaseResource resource = (IBaseResource) obj;
		try{
			//delete existing
			client.delete()
				.resourceConditionalByType(resource.getClass())
				.where(new TokenClientParam("identifier").exactly()
					.systemAndCode("http://mcm.usciitg-prep.org", resource.getIdElement().getIdPart()))
				.execute();
			System.out.println(dataType + ":" + resource.getIdElement().getValue() + " deleted ID:" + resource.getIdElement().getIdPart());
		}catch(Exception e){
			System.out.println(dataType + ":" + resource.getIdElement().getValue() + " deleted: failure" + " ID:" + resource.getIdElement().getIdPart());
		}			
	}
}
 
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:17,代码来源:UsciitgFhirDataProviderHL7IT.java


示例2: deleteDiagnosticReportBySpecimen

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deleteDiagnosticReportBySpecimen(FhirContext oContext,List<String> listIdSpecimenToDelete, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete()
                .resourceConditionalByType("DiagnosticReport")
                //.where(DiagnosticReport.SPECIMEN.hasId(idSpecimenToDelete))
                .where(DiagnosticReport.SPECIMEN.hasAnyOfIds(listIdSpecimenToDelete))
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:24,代码来源:FhirResourceValidator.java


示例3: deleteObservationBySpecimen

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deleteObservationBySpecimen(FhirContext oContext,List<String> listIdSpecimenToDelete, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete()
                .resourceConditionalByType("Observation")
                //.where(DiagnosticReport.SPECIMEN.hasId(idSpecimenToDelete))
                .where(Observation.SPECIMEN.hasAnyOfIds(listIdSpecimenToDelete))
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:24,代码来源:FhirResourceValidator.java


示例4: deleteDiagnosticOrderBySpecimen

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deleteDiagnosticOrderBySpecimen(FhirContext oContext,List<String> listIdSpecimenToDelete, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete()
                .resourceConditionalByType("DiagnosticOrder")
                //.where(DiagnosticReport.SPECIMEN.hasId(idSpecimenToDelete))
                .where(DiagnosticOrder.SPECIMEN.hasAnyOfIds(listIdSpecimenToDelete))
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:24,代码来源:FhirResourceValidator.java


示例5: deletePractitioner

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deletePractitioner(FhirContext oContext,List<IdDt> listIdsPractitioner, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        for(IdDt idToDelete:listIdsPractitioner)
        {

            IBaseOperationOutcome resp=client.delete()
                    .resourceById(idToDelete)
                    .execute();
            if(resp!=null)
            {
                OperationOutcome outcome = (OperationOutcome) resp;
                System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
            }
        }


    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:27,代码来源:FhirResourceValidator.java


示例6: deleteSpecimen

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deleteSpecimen(FhirContext oContext,List<IdDt> listIdsSpecimen, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        for(IdDt idToDelete:listIdsSpecimen)
        {

            IBaseOperationOutcome resp=client.delete()
                    .resourceById(idToDelete)
                    .execute();
            if(resp!=null)
            {
                OperationOutcome outcome = (OperationOutcome) resp;
                System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
            }
        }


    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:27,代码来源:FhirResourceValidator.java


示例7: getListConditionTrackedForPatient

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static List<Condition> getListConditionTrackedForPatient(FhirContext oContext,String patientId,String serverUrl,String logFileName)
{
    List<Condition> listOfAssociatedCondition=new ArrayList<>();
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        Bundle oBundle=client.search()
                .forResource(Condition.class)
                .where(new StringClientParam("patient").matches().value(patientId))
                .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class)
                .execute();
        for(Entry oEntry:oBundle.getEntry())
        {
            listOfAssociatedCondition.add((Condition)oEntry.getResource());
        }
    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
    return listOfAssociatedCondition;
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:24,代码来源:FhirResourceValidator.java


示例8: deleteBundle

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deleteBundle(FhirContext oContext, IdDt idBundle, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete().resourceById(idBundle)
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:21,代码来源:FhirResourceValidator.java


示例9: testFindConsent

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
/**
 * Test method for
 * {@link org.iexhub.services.JaxRsConsentRestProvider\#find(@IdParam final
 * IdDt id)}.
 */
@Test
public void testFindConsent() {

	try {
		Logger logger = LoggerFactory.getLogger(ConsentDstu3Test.class);
		LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
		loggingInterceptor.setLogRequestSummary(true);
		loggingInterceptor.setLogRequestBody(true);
		loggingInterceptor.setLogger(logger);

		IGenericClient client = ctxt.newRestfulGenericClient(serverBaseUrl);
		client.registerInterceptor(loggingInterceptor); // Required only for
														// logging
		Consent retVal = client.read(Consent.class,
				/*iExHubDomainOid + "." + consentId*/ /*"2.25.1469220780502"*/ "2.25.1471531116858");
		
		assertTrue("Error - unexpected return value for testFindConsent", retVal != null);
	} catch (Exception e) {
		fail(e.getMessage());
	}
}
 
开发者ID:bhits,项目名称:iexhub,代码行数:27,代码来源:ConsentDstu3Test.java


示例10: createProxy

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
public void createProxy() {
   // START SNIPPET: proxy
   FhirContext ctx = new FhirContext();

   // Set connections to access the network via the HTTP proxy at
   // example.com : 8888
   ctx.getRestfulClientFactory().setProxy("example.com", 8888);

   // If the proxy requires authentication, use the following as well
   ctx.getRestfulClientFactory().setProxyCredentials("theUsername", "thePassword");
   
   // Create the client
   IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
   // END SNIPPET: proxy
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:17,代码来源:ClientExamples.java


示例11: createSecurity

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
public void createSecurity() {
   // START SNIPPET: security
   // Create a context and get the client factory so it can be configured
   FhirContext ctx = new FhirContext();
   IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();

   // Create an HTTP basic auth interceptor
   String username = "foobar";
   String password = "boobear";
   BasicAuthInterceptor authInterceptor = new BasicAuthInterceptor(username, password);

   // Register the interceptor with your client (either style)
   IPatientClient annotationClient = ctx.newRestfulClient(IPatientClient.class, "http://localhost:9999/fhir");
   annotationClient.registerInterceptor(authInterceptor);

   IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
   annotationClient.registerInterceptor(authInterceptor);
   // END SNIPPET: security
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:21,代码来源:ClientExamples.java


示例12: createCookie

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
public void createCookie() {
   // START SNIPPET: cookie
   // Create a context and get the client factory so it can be configured
   FhirContext ctx = new FhirContext();
   IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();

   // Create a cookie interceptor. This cookie will have the name "mycookie" and
   // the value "Chips Ahoy"
   CookieInterceptor interceptor = new CookieInterceptor("mycookie=Chips Ahoy");

   // Register the interceptor with your client (either style)
   IPatientClient annotationClient = ctx.newRestfulClient(IPatientClient.class, "http://localhost:9999/fhir");
   annotationClient.registerInterceptor(interceptor);

   IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
   annotationClient.registerInterceptor(interceptor);
   // END SNIPPET: cookie
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:20,代码来源:ClientExamples.java


示例13: createSecurityBearer

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
public void createSecurityBearer() {
   // START SNIPPET: securityBearer
   // Create a context and get the client factory so it can be configured
   FhirContext ctx = new FhirContext();
   IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();

   // In reality the token would have come from an authorization server 
   String token = "3w03fj.r3r3t"; 
   
   BearerTokenAuthInterceptor authInterceptor = new BearerTokenAuthInterceptor(token);

   // Register the interceptor with your client (either style)
   IPatientClient annotationClient = ctx.newRestfulClient(IPatientClient.class, "http://localhost:9999/fhir");
   annotationClient.registerInterceptor(authInterceptor);

   IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
   annotationClient.registerInterceptor(authInterceptor);
   // END SNIPPET: securityBearer
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:21,代码来源:ClientExamples.java


示例14: simpleExample

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void simpleExample() {
   // START SNIPPET: simple
   // We're connecting to a DSTU1 compliant server in this example
   FhirContext ctx = FhirContext.forDstu1();
   String serverBase = "http://fhirtest.uhn.ca/baseDstu1";
   
   IGenericClient client = ctx.newRestfulGenericClient(serverBase);

   // Perform a search
   Bundle results = client
         .search()
         .forResource(Patient.class)
         .where(Patient.FAMILY.matches().value("duck"))
         .execute();

   System.out.println("Found " + results.size() + " patients named 'duck'");
   // END SNIPPET: simple
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:19,代码来源:GenericClientExample.java


示例15: operationHttpGet

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
private static void operationHttpGet() {
   // START SNIPPET: operationHttpGet
   // Create a client to talk to the HeathIntersections server
   FhirContext ctx = FhirContext.forDstu2();
   IGenericClient client = ctx.newRestfulGenericClient("http://fhir-dev.healthintersections.com.au/open");
   client.registerInterceptor(new LoggingInterceptor(true));
   
   // Create the input parameters to pass to the server
   Parameters inParams = new Parameters();
   inParams.addParameter().setName("start").setValue(new DateDt("2001-01-01"));
   inParams.addParameter().setName("end").setValue(new DateDt("2015-03-01"));
   
   // Invoke $everything on "Patient/1"
   Parameters outParams = client
      .operation()
      .onInstance(new IdDt("Patient", "1"))
      .named("$everything")
      .withParameters(inParams)
      .useHttpGet() // Use HTTP GET instead of POST
      .execute();
   // END SNIPPET: operationHttpGet
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:24,代码来源:GenericClientExample.java


示例16: operation

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
private static void operation() {
   // START SNIPPET: operation
   // Create a client to talk to the HeathIntersections server
   FhirContext ctx = FhirContext.forDstu2();
   IGenericClient client = ctx.newRestfulGenericClient("http://fhir-dev.healthintersections.com.au/open");
   client.registerInterceptor(new LoggingInterceptor(true));
   
   // Create the input parameters to pass to the server
   Parameters inParams = new Parameters();
   inParams.addParameter().setName("start").setValue(new DateDt("2001-01-01"));
   inParams.addParameter().setName("end").setValue(new DateDt("2015-03-01"));
   
   // Invoke $everything on "Patient/1"
   Parameters outParams = client
      .operation()
      .onInstance(new IdDt("Patient", "1"))
      .named("$everything")
      .withParameters(inParams)
      .execute();
   // END SNIPPET: operation
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:23,代码来源:GenericClientExample.java


示例17: operationNoIn

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
private static void operationNoIn() {
   // START SNIPPET: operationNoIn
   // Create a client to talk to the HeathIntersections server
   FhirContext ctx = FhirContext.forDstu2();
   IGenericClient client = ctx.newRestfulGenericClient("http://fhir-dev.healthintersections.com.au/open");
   client.registerInterceptor(new LoggingInterceptor(true));
   
   // Invoke $everything on "Patient/1"
   Parameters outParams = client
      .operation()
      .onInstance(new IdDt("Patient", "1"))
      .named("$everything")
      .withNoParameters(Parameters.class) // No input parameters
      .execute();
   // END SNIPPET: operationNoIn
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:18,代码来源:GenericClientExample.java


示例18: testNonRepeatableParam

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@Test
public void testNonRepeatableParam() throws Exception {
	MyServerBaseProvider patientProvider = new MyServerBaseProvider();
	myServlet.setResourceProviders(patientProvider);

	myServer.start();

	FhirContext ctx = new FhirContext();
	IGenericClient client = ctx.newRestfulGenericClient("http://localhost:" + myPort + "/");
	client.registerInterceptor(new LoggingInterceptor(true));

	try {
		client.search().forResource("Patient").where(new StringClientParam("singleParam").matches().values(Arrays.asList("AA", "BB"))).execute();
		fail();
	} catch (InvalidRequestException e) {
		assertThat(
				e.getMessage(),
				StringContains
						.containsString("HTTP 400 Bad Request: Multiple values detected for non-repeatable parameter 'singleParam'. This server is not configured to allow multiple (AND/OR) values for this param."));
	}
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:22,代码来源:ServerExtraParametersTest.java


示例19: main

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void main(String[] theArgs) {

		// Create a client
		FhirContext ctx = new FhirContext();
		String serverBaseUrl = "http://fhirtest.uhn.ca/base";
		IGenericClient client = ctx.newRestfulGenericClient(serverBaseUrl);

		// Log requests and responses
		client.registerInterceptor(new LoggingInterceptor(true));
		
		// Build a search and execute it
		Bundle response = client.search()
			.forResource(Patient.class)
			.where(Patient.NAME.matches().value("Test"))
			.and(Patient.BIRTHDATE.before().day("2014-01-01"))
			.limitTo(100)
			.execute();
		
		// How many resources did we find?
		System.out.println("Responses: " + response.size());
		
		// Print the ID of the first one
		IdDt firstResponseId = response.getEntries().get(0).getResource().getId();
		System.out.println(firstResponseId);
		
	}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:27,代码来源:Example06_ClientReadAndUpdate.java


示例20: main

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void main(String[] theArgs) {

		Patient pat = new Patient();
		pat.addName().addFamily("Simpson").addGiven("Homer").addGiven("J");
		pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135");
		pat.setGender(AdministrativeGenderCodesEnum.M);
		
		// Create a context
		FhirContext ctx = new FhirContext();
		
		// Create a client
		String serverBaseUrl = "http://fhirtest.uhn.ca/base";
		IGenericClient client = ctx.newRestfulGenericClient(serverBaseUrl);

		// Use the client to store a new resource instance 
		MethodOutcome outcome = client.create().resource(pat).execute();
	
		// Print the ID of the newly created resource
		System.out.println(outcome.getId());
		
	}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:22,代码来源:Example05_ClientCreate.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReturnInstruction类代码示例发布时间:2022-05-22
下一篇:
Java MavenProjectsManager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap