簡體   English   中英

有沒有辦法從 FHIR 服務器獲取可用於患者 ID 的資源類型列表?

[英]Is there any way to fetch the list of resource types available for a patient id from FHIR Server?

我想從 FHIR 服務器獲取患者可用的資源類型列表。 我試圖從患者那里獲取物品清單。 但它不包含該特定患者可用的所有資源類型。

http://hapi.fhir.org/baseR4/metadata

http://wildfhir4.aegis.net/fhir4-0-1/metadata

https://vonk.fire.ly/R4/metadata

我想你在問這個。

如果您檢查上述任何參考實現。 您將獲得 CapabilityStatement。

您查看 CapabilityStatement,找到 Fhir-Resource(此處為“Patient”),然后找到任何包含和 rev-includes。

                "type": "Patient",

                "searchInclude": [
                    "Patient:general-practitioner",
                    "Patient:link",
                    "Patient:organization"
                ],
                "searchRevInclude": [
                    "Account:patient",
                    "Account:subject",

另見:

https://www.hl7.org/fhir/search.html#include

我認為您要問的是與患者相關的資源類型。 在這種情況下,您可以執行 http://base/fhir/Patient/[id]/$everything

https://hl7.org/fhir/operation-patient-everything.html

當您說“FHIR 服務器上患者可用的資源類型列表”時,我認為您的意思是患者可以在 FHIR 服務器上搜索的資源類型。

要構建這樣的列表,請閱讀 FHIR 服務器的CapabilityStatement 遍歷 CapabilityStatement 的resource數組,檢查每個項目的searchParam數組中是否存在name = 'patient' 和type = 'reference' 的元素。 如果您找到它,將該項目的type值(即資源類型)添加到列表中。

感謝大家發布您的答案。 我通過發出如下的批處理請求來實現這一點,

    Bundle bundle = new Bundle();

    bundle.setType(Bundle.BundleType.TRANSACTION);

    // Adding bundle entries to make the batch request

    // To fetch the resource count for each resource type

    for (String resource : resources) {

        String url = String.format(MyConstants.URLs.FETCH_SUMMARY_COUNT, 
        resource, patientId);

 bundle.addEntry().getRequest().setUrl(url).setMethod(Bundle.HTTPVerb.GET);

    }

    try {

        // Create a client

        IGenericClient client = fhirContext.newRestfulGenericClient(fhirServerUrl);

        BearerTokenAuthInterceptor bearerTokenAuthInterceptor = new BearerTokenAuthInterceptor(accessToken);

        client.registerInterceptor(bearerTokenAuthInterceptor);



        bundle = client.transaction().withBundle(bundle).execute();

        IFhirPath iFhirPath = fhirContext.newFhirPath();

        List<IntegerType> counts = iFhirPath.evaluate(bundle, MyConstants.FHIRPATH.SUMMARY_COUNT_FROM_BUNDLE,

                IntegerType.class);

        ResourceTypesResponse resourceTypesResponse = ResourceParser.getResourceTypes(counts, resources);

        if (resourceTypesResponse == null) {

            throw new PatientNotFoundException("Resource Not Found");

        }

        return resourceTypesResponse;

    } catch (Exception e) {

        if (e.getMessage().equalsIgnoreCase("HTTP 401 Unauthorized")) {

            return getResourceBundleForPatient(patientId, resources);

        } else {

            throw new PatientNotFoundException("Patient Id Not Found");

        }

    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM