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


Java FhirContext类代码示例

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


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

示例1: deleteObservationBySpecimen

import ca.uhn.fhir.context.FhirContext; //导入依赖的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

示例2: deletePractitioner

import ca.uhn.fhir.context.FhirContext; //导入依赖的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

示例3: deleteSpecimen

import ca.uhn.fhir.context.FhirContext; //导入依赖的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

示例4: read

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
@Override
public Patient read(FhirContext ctx, IdType theId) {

    log.info("Looking for patient = "+theId.getIdPart());
    if (daoutils.isNumeric(theId.getIdPart())) {
        PatientEntity patientEntity = (PatientEntity) em.find(PatientEntity.class, Long.parseLong(theId.getIdPart()));

        Patient patient = null;
        if (patientEntity != null) {
            patient = patientEntityToFHIRPatientTransformer.transform(patientEntity);
            patientEntity.setResource(ctx.newJsonParser().encodeResourceToString(patient));
            em.persist(patientEntity);
        }
        return patient;
    } else {
        return null;
    }
}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:19,代码来源:PatientDao.java

示例5: validateCode

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
@Override
public CodeValidationResult validateCode(FhirContext theContext, String theCodeSystem, String theCode, String theDisplay) {
  CodeSystem cs = fetchCodeSystem(theContext, theCodeSystem);
  logD("CareConnect validateCode system = "+ theCodeSystem);

  if (cs != null) {
    boolean caseSensitive = true;
    if (cs.hasCaseSensitive()) {
      caseSensitive = cs.getCaseSensitive();
    }

    CodeValidationResult retVal = testIfConceptIsInList(theCode, cs.getConcept(), caseSensitive);

    if (retVal != null) {
      return retVal;
    }
  }

  return new CodeValidationResult(IssueSeverity.WARNING, "CareConnect Unknown code: " + theCodeSystem + " / " + theCode);
}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:21,代码来源:CareConnectProfileValidationSupport.java

示例6: searchEntity

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
List<ProcedureEntity> searchEntity(FhirContext ctx,
        @OptionalParam(name = Procedure.SP_PATIENT) ReferenceParam patient
        ,@OptionalParam(name = Procedure.SP_DATE) DateRangeParam date
        , @OptionalParam(name = Procedure.SP_SUBJECT) ReferenceParam subject
        , @OptionalParam(name = Procedure.SP_IDENTIFIER) TokenParam identifier
        ,@OptionalParam(name= Procedure.SP_RES_ID) TokenParam id
);
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:8,代码来源:ProcedureRepository.java

示例7: create

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
@Override
public Object create(String modelId, Map<String, Object> valueMap) throws ClassNotFoundException {
    Gson gson = new GsonBuilder().
            registerTypeAdapter(Double.class, (JsonSerializer<Double>) (src, typeOfSrc, context) -> {
                if (src == src.longValue())
                    return new JsonPrimitive(src.longValue());
                return new JsonPrimitive(src);
            }).create();
    String json = gson.toJson(valueMap);
    Class modelClass = Class.forName(modelId);
    IParser fhirContextParser = FhirContext.forDstu3().newJsonParser();
    return fhirContextParser.parseResource(modelClass, json);
}
 
开发者ID:gdl-lang,项目名称:gdl2,代码行数:14,代码来源:FhirDstu3ResourceCreator.java

示例8: setup

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
@BeforeClass
public static void setup(){
    dataProvider = new FileBasedFhirDstu2Provider(System.getProperty("user.dir") + "/src/test/resources/org/partners/usciitg_prep/fhir/cql/data", null);
    dataProvider.setFhirContext(FhirContext.forDstu2Hl7Org());
    dataProvider.setPackageName("org.hl7.fhir.instance.model");

    terminologyProvider = new TestTerminologyProvider();
    dataProvider.setTerminologyProvider(terminologyProvider);

    contextValues = new HashMap<String, Object>();
    contextParameters = new HashMap<String, Object>();
}
 
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:13,代码来源:FileBasedFhirDstu2ProviderIT.java

示例9: testExecuteFluStudy

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
private Map<String, Object> testExecuteFluStudy(String endpoint, String patientId, String encounterStart, String encounterEnd) throws IOException, JAXBException {
	UsciitgFhirDataProviderHL7 dataProvider = new UsciitgFhirDataProviderHL7();
	dataProvider.setFhirContext(FhirContext.forDstu2Hl7Org());
	dataProvider.setPackageName("org.hl7.fhir.instance.model");
	dataProvider.setEndpoint(endpoint);

	TerminologyProvider terminologyProvider = new TestTerminologyProvider();
	dataProvider.setTerminologyProvider(terminologyProvider);			
	
	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");
	
	Map<String, Object> contextValues = new HashMap<String, Object>();
	Map<String, Object> contextParameters = new HashMap<String, Object>();
	Map<String, Object> results;

	contextValues.put("Patient", patientId);

	DateTime encounterStartDt = createCqfDateTime(encounterStart);
	DateTime encounterEndDt = createCqfDateTime(encounterEnd);
	contextParameters.put("EncounterStart", encounterStartDt);
	contextParameters.put("EncounterEnd", encounterEndDt);

	CqlExecutor executor = new CqlFhirExecutorImpl(dataProvider, terminologyProvider, libraryIdentifier, libraryLoader);
	results = executor.execute(contextValues, contextParameters);
	
	return results;
}
 
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:33,代码来源:UsciitgFhirDataProviderHL7IT.java

示例10: readEntity

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
public OrganisationEntity readEntity(FhirContext ctx,IdType theId) {

    if (theId.getIdPart() != null) {
        OrganisationEntity organizationEntity = (OrganisationEntity) em.find(OrganisationEntity.class, Long.parseLong(theId.getIdPart()));

        return organizationEntity;
    } else {
        return null;
    }
    }
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:11,代码来源:OrganisationDao.java

示例11: read

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
@Override
public Condition read(FhirContext ctx,IdType theId) {

    if (daoutils.isNumeric(theId.getIdPart())) {
        ConditionEntity condition = (ConditionEntity) em.find(ConditionEntity.class, Long.parseLong(theId.getIdPart()));

        return condition == null
                ? null
                : conditionEntityToFHIRConditionTransformer.transform(condition);
    } else  {
        return null;
    }
}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:14,代码来源:ConditionDao.java

示例12: createPractitionerInTransaction

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
public static String createPractitionerInTransaction(FhirContext oContext,List<Practitioner> listOfPractitioners,String serverUrl) throws Exception
{
    Bundle respOutcome=null;
    String stringTransactionResult="{TransactionResultStatus:no}";
    try
    {

        Bundle resourceBundle=new Bundle();
        resourceBundle.setType(BundleTypeEnum.TRANSACTION);
        int compter=0;
        for(Practitioner oPractitioner: listOfPractitioners)
        {
            String searchPattern="Practitioner?";
            searchPattern+="_id="+oPractitioner.getId().getValueAsString();
            Entry oBundleEntry= new Entry().setResource(oPractitioner);
            oBundleEntry.setElementSpecificId(oPractitioner.getId().getValueAsString());
            oBundleEntry.setFullUrl(oPractitioner.getId());
            oBundleEntry.getRequest().setUrl(searchPattern).setMethod(HTTPVerbEnum.PUT);
            resourceBundle.addEntry(oBundleEntry);
            compter++;
            //if(compter==5) break;
        }
        //String filePath1="/home/server-hit/Desktop/"+"Bundle.json";
        //ManageJsonFile.saveResourceInJSONFile(resourceBundle,oContext,filePath1);
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        String resJSONFormat=oContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(resourceBundle);
        respOutcome=client.transaction().withBundle(resourceBundle).execute();
        //System.out.print(oContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(respOutcome));
        if(respOutcome!=null)
        {
            stringTransactionResult=FhirResourceProcessor.extractResponseStaticsFromBundleTransactionRespons(respOutcome,1);
        }

    }
    catch (Exception exc)
    {
        throw new Exception(exc.getMessage());
    }
    return  stringTransactionResult;
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:41,代码来源:FhirResourceValidator.java

示例13: search

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
@Override
public List<MedicationStatement> search(FhirContext ctx,ReferenceParam patient, DateRangeParam effectiveDate, TokenParam status, TokenParam resid) {
    List<MedicationRequestEntity> prescriptions = prescriptionDao.searchEntity(ctx,patient,null,effectiveDate,status,null,null);
    List<MedicationStatement> results = new ArrayList<>();

    for (MedicationRequestEntity prescriptionEntity : prescriptions)
    {
        // log.trace("HAPI Custom = "+doc.getId());
        MedicationStatement medicationStatement =  medicationRequestEntityToFHIRMedicationStatementTransformer.transform(prescriptionEntity);
        results.add(medicationStatement);
    }
    return results;

}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:15,代码来源:MedicationStatementDao.java

示例14: createListResourceInTransaction

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
public static String createListResourceInTransaction(FhirContext oContext,List<ListResource> listOfListResource,String serverUrl
        ,String logFileName) throws Exception
{
    Bundle respOutcome=null;
    String stringTransactionResult="{TransactionResultStatus:no}";
    try
    {

        Bundle resourceBundle=new Bundle();
        resourceBundle.setType(BundleTypeEnum.TRANSACTION);
        int compter=0;
        for(ListResource oListResource: listOfListResource)
        {

            Entry oBundleEntry= new Entry().setResource(oListResource);
            oBundleEntry.getRequest().setMethod(HTTPVerbEnum.PUT);
            resourceBundle.addEntry(oBundleEntry);
            compter++;
            //if(compter==5) break;
        }
        //String filePath1="/home/server-hit/Desktop/"+"Bundle.json";
        //ManageJsonFile.saveResourceInJSONFile(resourceBundle,oContext,filePath1);
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        String resJSONFormat=oContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(resourceBundle);
        respOutcome=client.transaction().withBundle(resourceBundle).execute();
        //System.out.print(oContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(respOutcome));
        if(respOutcome!=null)
        {
            stringTransactionResult=FhirResourceProcessor.extractResponseStaticsFromBundleTransactionRespons(respOutcome,1);
        }

    }
    catch (Exception exc)
    {
        throw new Exception(exc.getMessage());
    }
    return  stringTransactionResult;
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:39,代码来源:FhirResourceValidator.java

示例15: createBundle

import ca.uhn.fhir.context.FhirContext; //导入依赖的package包/类
public static String createBundle(FhirContext oContext,List<Bundle> listOfBundles,String serverUrl) throws Exception
{
    MethodOutcome respOutcome=null;
    String stringTransactionResult="{TransactionResultStatus:no}";
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);

        int compter=0;
        int nbreResourceCreated=0;
        int total=listOfBundles.size();
        for(Bundle oBundle: listOfBundles )
        {
            respOutcome=client.update()
                    .resource(oBundle)
                    .prettyPrint()
                    .encodedJson()
                    .execute();
            if(respOutcome.getCreated())
            {
                nbreResourceCreated++;
            }
        }
        int success=nbreResourceCreated;
        int failed=total-success;
        stringTransactionResult="total:"+total+"," +
                "succes:"+success+"," +
                "failed:"+failed+"}";

    }
    catch (Exception exc)
    {
        throw new Exception(exc.getMessage());
    }
    return  stringTransactionResult;
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:37,代码来源:FhirResourceValidator.java


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