使用 curl 和 PowerShell 儲存醫療照護資料

本頁說明如何使用 Cloud Healthcare API 和 curl 或 PowerShell 完成下列工作:

  1. 建立 Cloud Healthcare API 資料集。
  2. 在資料集中建立下列任一資料儲存庫:
    • 數位醫學影像和通訊 (DICOM) 儲存庫
    • 快速醫療照護互通資源 (FHIR) 儲存庫
    • 健康狀態層級七 (國際版本 2) (HL7v2) 儲存庫
  3. 儲存及檢查 DICOM、FHIR 或 HL7v2 儲存庫中特定類型的醫療資料。

如果您只想使用一種資料儲存庫,完成「事前準備」和「建立資料集」中的步驟後,可以直接跳到快速入門指南的相關章節。

事前準備

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. Install the Google Cloud CLI.

  3. 如果您使用外部識別資訊提供者 (IdP),請先 使用聯合身分登入 gcloud CLI

  4. 如要初始化 gcloud CLI,請執行下列指令:

    gcloud init
  5. Create or select a Google Cloud project.

    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the Cloud Healthcare API:

    gcloud services enable healthcare.googleapis.com
  8. Grant roles to your user account. Run the following command once for each of the following IAM roles: roles/healthcare.datasetAdmin, roles/healthcare.fhirStoreAdmin, roles/healthcare.dicomStoreAdmin, roles/healthcare.hl7V2StoreAdmin

    gcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_IDENTIFIER" --role=ROLE

    Replace the following:

    • PROJECT_ID: your project ID.
    • USER_IDENTIFIER: the identifier for your user account—for example, myemail@example.com.
    • ROLE: the IAM role that you grant to your user account.
  9. Install the Google Cloud CLI.

  10. 如果您使用外部識別資訊提供者 (IdP),請先 使用聯合身分登入 gcloud CLI

  11. 如要初始化 gcloud CLI,請執行下列指令:

    gcloud init
  12. Create or select a Google Cloud project.

    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  13. Verify that billing is enabled for your Google Cloud project.

  14. Enable the Cloud Healthcare API:

    gcloud services enable healthcare.googleapis.com
  15. Grant roles to your user account. Run the following command once for each of the following IAM roles: roles/healthcare.datasetAdmin, roles/healthcare.fhirStoreAdmin, roles/healthcare.dicomStoreAdmin, roles/healthcare.hl7V2StoreAdmin

    gcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_IDENTIFIER" --role=ROLE

    Replace the following:

    • PROJECT_ID: your project ID.
    • USER_IDENTIFIER: the identifier for your user account—for example, myemail@example.com.
    • ROLE: the IAM role that you grant to your user account.
  16. 建立資料集

    「資料集」包含資料儲存庫,以及含有醫療照護資料的資料儲存庫。 如要使用 Cloud Healthcare API,您至少須建立一個資料集。

    以下範例顯示如何在 us-central1 區域中建立名為 my-dataset 的資料集。在本快速入門導覽課程中,您會使用資料集建立 DICOM 存放區、FHIR 存放區和 HL7v2 存放區。

    REST

    1. 使用 projects.locations.datasets.create 方法建立資料集。

      使用任何要求資料之前,請先替換以下項目:

      • PROJECT_ID:您在「事前準備」中建立或選取的 Google Cloud 專案 ID

      如要傳送要求,請選擇以下其中一個選項:

      curl

      執行下列指令:

      curl -X POST \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      -H "Content-Type: application/json; charset=utf-8" \
      -d "" \
      "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets?datasetId=my-dataset"

      PowerShell

      執行下列指令:

      $cred = gcloud auth print-access-token
      $headers = @{ "Authorization" = "Bearer $cred" }

      Invoke-WebRequest `
      -Method POST `
      -Headers $headers `
      -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets?datasetId=my-dataset" | Select-Object -Expand Content

      APIs Explorer

      開啟方法參考頁面。系統會在頁面右側開啟 APIs Explorer 面板。您可以使用這項工具來傳送要求。完成任何必填欄位,然後按一下「執行」

      輸出內容如下所示。回應會包含長時間執行作業 (LRO) 的 ID。如果方法呼叫可能需要額外時間才能完成,系統就會傳回長時間執行的作業。請記下 OPERATION_ID 的值。您會在下一個步驟中用到這個值。

    2. 使用 projects.locations.datasets.operations.get 方法取得長時間執行的作業狀態。

      使用任何要求資料之前,請先替換以下項目:

      • PROJECT_ID:您的 Google Cloud 專案 ID
      • OPERATION_ID:長時間執行的作業傳回的 ID

      如要傳送要求,請選擇以下其中一個選項:

      curl

      執行下列指令:

      curl -X GET \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/operations/OPERATION_ID"

      PowerShell

      執行下列指令:

      $cred = gcloud auth print-access-token
      $headers = @{ "Authorization" = "Bearer $cred" }

      Invoke-WebRequest `
      -Method GET `
      -Headers $headers `
      -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/operations/OPERATION_ID" | Select-Object -Expand Content

      APIs Explorer

      開啟方法參考頁面。系統會在頁面右側開啟 APIs Explorer 面板。您可以使用這項工具來傳送要求。完成任何必填欄位,然後按一下「執行」

      輸出內容如下所示。如果回應包含 "done": true,表示長時間執行的作業已完成。

    如要完成這項快速入門導覽課程,請選擇下列其中一個部分:

    儲存及查看 DICOM 執行個體

    本節說明如何完成下列工作:

    1. 建立 DICOM 儲存庫。
    2. 在 DICOM 儲存庫中儲存 DICOM 執行個體。
    3. 查看 DICOM 執行個體的中繼資料。

    Cloud Healthcare API 會導入 DICOMweb 標準,用於儲存及存取醫療影像資料。

    建立 DICOM 儲存庫

    DICOM 儲存庫位於資料集內,並含有 DICOM 執行個體。下列範例說明如何建立名為 my-dicom-store 的 DICOM 儲存庫。

    REST

    使用 projects.locations.datasets.dicomStores.create 方法建立 DICOM 儲存庫。

    使用任何要求資料之前,請先替換以下項目:

    • PROJECT_ID:您在「事前準備」中建立或選取的 Google Cloud 專案 ID

    如要傳送要求,請選擇以下其中一個選項:

    curl

    執行下列指令:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d "" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores?dicomStoreId=my-dicom-store"

    PowerShell

    執行下列指令:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores?dicomStoreId=my-dicom-store" | Select-Object -Expand Content

    APIs Explorer

    開啟方法參考頁面。系統會在頁面右側開啟 APIs Explorer 面板。您可以使用這項工具來傳送要求。完成任何必填欄位,然後按一下「執行」

    您應該會收到如下的 JSON 回應:

    儲存 DICOM 執行個體

    1. 範例 DICOM 執行個體檔案下載至電腦。 檔案包含去識別化的病患 X 光片。

      curl

      curl -O https://cloud.google.com/healthcare-api/docs/resources/dicom_00000001_000.dcm

      PowerShell

      Invoke-WebRequest -Uri "https://cloud.google.com/healthcare-api/docs/resources/dicom_00000001_000.dcm" -OutFile $pwd/dicom_00000001_000.dcm
    2. 使用 dicomStores.storeInstances 方法儲存 DICOM 執行個體。 本快速入門導覽課程假設您在下載 DICOM 執行個體的同一目錄中執行指令。

      REST

      使用任何要求資料之前,請先替換以下項目:

      • PROJECT_ID:您在「事前準備」中建立或選取的 Google Cloud 專案 ID

      如要傳送要求,請選擇以下其中一個選項:

      curl

      執行下列指令:

      curl -X POST \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      -H "Content-Type: application/dicom" \
      --data-binary @dicom_00000001_000.dcm \
      "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/studies"

      PowerShell

      執行下列指令:

      $cred = gcloud auth print-access-token
      $headers = @{ "Authorization" = "Bearer $cred" }

      Invoke-WebRequest `
      -Method POST `
      -Headers $headers `
      -InFile dicom_00000001_000.dcm `
      -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/studies" | Select-Object -Expand Content

      輸出內容為下列 XML 回應。輸出內容如下:

      • PROJECT_IDus-central1my-datasetmy-dicom-store:執行指令時提供的值
      • SOPClassUID:唯一識別服務物件配對 (SOP) 類別
      • SOPInstanceUID:唯一識別服務物件配對 (SOP) 例項
      • STUDY_UID:可專屬識別研究執行個體
      • SERIES_UID:用於專屬識別序列執行個體
      • INSTANCE_UID:執行個體的專屬 ID

    查看 DICOM 執行個體中繼資料

    REST

    使用 dicomStores.searchForInstances 方法查看執行個體的中繼資料。

    使用任何要求資料之前,請先替換以下項目:

    • PROJECT_ID:您在「事前準備」中建立或選取的 Google Cloud 專案 ID

    如要傳送要求,請選擇以下其中一個選項:

    curl

    執行下列指令:

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/instances"

    PowerShell

    執行下列指令:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/instances" | Select-Object -Expand Content

    APIs Explorer

    開啟方法參考頁面。系統會在頁面右側開啟 APIs Explorer 面板。您可以使用這項工具來傳送要求。完成任何必填欄位,然後按一下「執行」

    您應該會收到如下的 JSON 回應:

    在 Cloud Healthcare API 中儲存及查看 DICOM 執行個體後,請繼續清除資源,以免系統向您的 Google Cloud 帳戶收取本頁面所用資源的費用。

    如要進一步瞭解如何使用 DICOM 資料,請參閱後續步驟

    儲存及查看 FHIR 資源

    本節說明如何完成下列工作:

    1. 建立 FHIR 儲存庫。
    2. 在 FHIR 存放區中儲存 FHIR 資源。
    3. 查看 FHIR 資源的資料。

    Cloud Healthcare API 會導入 FHIR 標準,用於儲存及存取 FHIR 資料。

    建立 FHIR 儲存庫

    FHIR 儲存庫位於資料集內,並含有 FHIR 資源。下列範例說明如何建立名為 my-fhir-store 的 FHIR 儲存庫,並使用 FHIR R4 版

    REST

    使用 projects.locations.datasets.fhirStores.create 方法建立 FHIR 儲存庫。

    使用任何要求資料之前,請先替換以下項目:

    • PROJECT_ID:您在「事前準備」中建立或選取的 Google Cloud 專案 ID

    JSON 要求主體:

    {
      "version": "R4"
    }
    

    如要傳送要求,請選擇以下其中一個選項:

    curl

    將要求主體儲存在名為 request.json 的檔案中。 在終端機中執行下列指令,在目前目錄中建立或覆寫這個檔案:

    cat > request.json << 'EOF'
    {
      "version": "R4"
    }
    EOF

    接著,請執行下列指令來傳送 REST 要求:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores?fhirStoreId=my-fhir-store"

    PowerShell

    將要求主體儲存在名為 request.json 的檔案中。 在終端機中執行下列指令,在目前目錄中建立或覆寫這個檔案:

    @'
    {
      "version": "R4"
    }
    '@  | Out-File -FilePath request.json -Encoding utf8

    接著,請執行下列指令來傳送 REST 要求:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/json; charset=utf-8" `
    -InFile request.json `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores?fhirStoreId=my-fhir-store" | Select-Object -Expand Content

    APIs Explorer

    複製要求內文並開啟方法參考資料頁面。系統會在頁面右側開啟 APIs Explorer 面板。您可以使用這項工具來傳送要求。將要求內文貼到這項工具中,並填妥其他必填欄位,然後按一下「Execute」(執行)

    您應該會收到如下的 JSON 回應:

    儲存 FHIR 資源

    REST

    使用 projects.locations.datasets.fhirStores.fhir.create 方法在 FHIR 儲存庫中建立 Patient 資源。

    使用任何要求資料之前,請先替換以下項目:

    • PROJECT_ID:您在「事前準備」中建立或選取的 Google Cloud 專案 ID

    JSON 要求主體:

    {
      "name": [
        {
          "use": "official",
          "family": "Smith",
          "given": [
            "Darcy"
          ]
        }
      ],
      "gender": "female",
      "birthDate": "1970-01-01",
      "resourceType": "Patient"
    }
    

    如要傳送要求,請選擇以下其中一個選項:

    curl

    將要求主體儲存在名為 request.json 的檔案中。 在終端機中執行下列指令,在目前目錄中建立或覆寫這個檔案:

    cat > request.json << 'EOF'
    {
      "name": [
        {
          "use": "official",
          "family": "Smith",
          "given": [
            "Darcy"
          ]
        }
      ],
      "gender": "female",
      "birthDate": "1970-01-01",
      "resourceType": "Patient"
    }
    EOF

    接著,請執行下列指令來傳送 REST 要求:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/fhir+json" \
    -d @request.json \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient"

    PowerShell

    將要求主體儲存在名為 request.json 的檔案中。 在終端機中執行下列指令,在目前目錄中建立或覆寫這個檔案:

    @'
    {
      "name": [
        {
          "use": "official",
          "family": "Smith",
          "given": [
            "Darcy"
          ]
        }
      ],
      "gender": "female",
      "birthDate": "1970-01-01",
      "resourceType": "Patient"
    }
    '@  | Out-File -FilePath request.json -Encoding utf8

    接著,請執行下列指令來傳送 REST 要求:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/fhir+json" `
    -InFile request.json `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient" | Select-Object -Expand Content

    您應該會收到如下的 JSON 回應:

    查看 FHIR 資源內容

    REST

    使用 projects.locations.datasets.fhirStores.fhir.search 方法查看病患資源的相關資訊。

    使用任何要求資料之前,請先替換以下項目:

    • PROJECT_ID:您在「事前準備」中建立或選取的 Google Cloud 專案 ID

    如要傳送要求,請選擇以下其中一個選項:

    curl

    執行下列指令:

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient"

    PowerShell

    執行下列指令:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient" | Select-Object -Expand Content

    您應該會收到如下的 JSON 回應:

    {
      "entry": [
        {
          "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient/PATIENT_ID",
          "resource": {
            "birthDate": "1970-01-01",
            "gender": "female",
            "id": "PATIENT_ID",
            "meta": {
              "lastUpdated": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
              "versionId": "MTY5MDQxMDk5ODU1OTkxNTAwMA"
            },
            "name": [
              {
                "family": "Smith",
                "given": [
                  "Darcy"
                ],
                "use": "official"
              }
            ],
            "resourceType": "Patient"
          },
          "search": {
            "mode": "match"
          }
        }
      ],
      "link": [
        {
          "relation": "search",
          "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient/?"
        },
        {
          "relation": "first",
          "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient/?"
        },
        {
          "relation": "self",
          "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient/?"
        }
      ],
      "resourceType": "Bundle",
      "total": 1,
      "type": "searchset"
    }
    

    在 Cloud Healthcare API 中儲存及查看 FHIR 資源後,請繼續清除資源,以免系統向您的 Google Cloud 帳戶收取本頁面所用資源的費用。

    如要進一步瞭解如何使用 FHIR 資料,請參閱後續步驟

    儲存及查看 HL7v2 訊息

    本節說明如何完成下列工作:

    1. 建立 HL7v2 儲存庫。
    2. 將 HL7v2 訊息儲存在 HL7v2 儲存庫中。
    3. 查看 HL7v2 訊息資料。

    Cloud Healthcare API 中的 HL7v2 實作符合 HL7v2 標準

    建立 HL7v2 儲存庫

    HL7v2 儲存庫位於資料集內,並含有 HL7v2 訊息。下列範例說明如何建立名為 my-hl7v2-store 的 HL7v2 儲存庫。

    REST

    使用 projects.locations.datasets.hl7V2Stores.create 方法建立 HL7v2 儲存庫。

    使用任何要求資料之前,請先替換以下項目:

    • PROJECT_ID:您在「事前準備」中建立或選取的 Google Cloud 專案 ID

    如要傳送要求,請選擇以下其中一個選項:

    curl

    執行下列指令:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d "" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores?hl7V2StoreId=my-hl7v2-store"

    PowerShell

    執行下列指令:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores?hl7V2StoreId=my-hl7v2-store" | Select-Object -Expand Content

    APIs Explorer

    開啟方法參考頁面。系統會在頁面右側開啟 APIs Explorer 面板。您可以使用這項工具來傳送要求。完成任何必填欄位,然後按一下「執行」

    您應該會收到如下的 JSON 回應:

    建立 HL7v2 訊息

    1. 範例 HL7v2 訊息檔案下載到電腦:

      curl

      curl -O https://cloud.google.com/healthcare-api/docs/resources/hl7v2-sample.json

      PowerShell

      Invoke-WebRequest -Uri "https://cloud.google.com/healthcare-api/docs/resources/hl7v2-sample.json" -OutFile $pwd/hl7v2-sample.json

      HL7v2 訊息包含下列資訊,這些資訊已在範例檔案的 data 欄位中採用 Base64 編碼:

      MSH|^~\&|A|SEND_FACILITY|A|A|20180101000000||TYPE^A|20180101000000|T|0.0|||AA||00|ASCII
      EVN|A00|20180101040000
      PID||14^111^^^^MRN|11111111^^^^MRN~1111111111^^^^ORGNMBR
      
    2. 使用 projects.locations.datasets.hl7V2Stores.messages.create 方法,將 HL7v2 訊息儲存在 HL7v2 儲存庫中。本快速入門導覽課程假設您在下載 HL7v2 訊息的目錄中執行指令。

      REST

      使用任何要求資料之前,請先替換以下項目:

      • PROJECT_ID:您在「事前準備」中建立或選取的 Google Cloud 專案 ID

      如要傳送要求,請選擇以下其中一個選項:

      curl

      執行下列指令:

      curl -X POST \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      -H "Content-Type: application/json; charset=utf-8" \
      --data-binary @hl7v2-sample.json \
      "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages"

      PowerShell

      執行下列指令:

      $cred = gcloud auth print-access-token
      $headers = @{ "Authorization" = "Bearer $cred" }

      Invoke-WebRequest `
      -Method POST `
      -Headers $headers `
      -InFile hl7v2-sample.json `
      -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages" | Select-Object -Expand Content

      APIs Explorer

      開啟方法參考頁面。系統會在頁面右側開啟 APIs Explorer 面板。您可以使用這項工具來傳送要求。完成任何必填欄位,然後按一下「執行」

      輸出內容如下所示。輸出內容如下:

      • PROJECT_IDus-central1my-datasetmy-hl7v2-store:您在方法呼叫中提供的值
      • MESSAGE_ID:Cloud Healthcare API 提供的 HL7v2 訊息 ID。請記下 MESSAGE_ID 的值。下一個步驟會用到這個值。

    查看 HL7v2 訊息內容

    在您建立 HL7v2 訊息時收到的回應中,找出 MESSAGE_ID

    REST

    使用 projects.locations.datasets.hl7V2stores.messages.get 方法查看 HL7v2 訊息詳細資料。

    使用任何要求資料之前,請先替換以下項目:

    • PROJECT_ID:您在「事前準備」中建立或選取的 Google Cloud 專案 ID
    • HL7V2_MESSAGE_ID:建立 HL7v2 訊息時收到的回應 ID

    如要傳送要求,請選擇以下其中一個選項:

    curl

    執行下列指令:

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages/HL7V2_MESSAGE_ID"

    PowerShell

    執行下列指令:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages/HL7V2_MESSAGE_ID" | Select-Object -Expand Content

    APIs Explorer

    開啟方法參考頁面。系統會在頁面右側開啟 APIs Explorer 面板。您可以使用這項工具來傳送要求。完成任何必填欄位,然後按一下「執行」

    您應該會收到如下的 JSON 回應:

    在 Cloud Healthcare API 中儲存及查看 HL7v2 訊息後,請繼續清除資源,以免系統向您的 Google Cloud 帳戶收取本頁面所用資源的費用。

    如要進一步瞭解如何使用 HL7v2 資料,請參閱後續步驟

    清除所用資源

    如要避免系統向您的 Google Cloud 帳戶收取本頁面所用資源的費用,請刪除含有這些資源的 Google Cloud 專案。

    如果您是為本快速入門導覽課程建立新專案,請按照「刪除專案」一節的步驟操作。如果沒有,請按照「刪除資料集」一節的步驟操作。

    Optional: Revoke credentials from the gcloud CLI.

    gcloud auth revoke

    刪除專案

      Delete a Google Cloud project:

      gcloud projects delete PROJECT_ID

    刪除資料集

    如果不再需要這個快速入門導覽課程中建立的資料集,您可以刪除該資料集。如果刪除資料集,該資料集以及其中包含的所有 FHIR、HL7v2 或 DICOM 儲存庫都會永久刪除。

    REST

    使用 projects.locations.datasets.delete 方法刪除資料集。

    使用任何要求資料之前,請先替換以下項目:

    • PROJECT_ID:您在「事前準備」中建立或選取的 Google Cloud 專案 ID

    如要傳送要求,請選擇以下其中一個選項:

    curl

    執行下列指令:

    curl -X DELETE \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset"

    PowerShell

    執行下列指令:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method DELETE `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset" | Select-Object -Expand Content

    APIs Explorer

    開啟方法參考頁面。系統會在頁面右側開啟 APIs Explorer 面板。您可以使用這項工具來傳送要求。完成任何必填欄位,然後按一下「執行」

    您應該會收到執行成功的狀態碼 (2xx) 和空白回應。

    還順利嗎?

    後續步驟

    如要瞭解 Cloud Healthcare API 的一般資訊,以及如何使用其他介面執行本快速入門導覽課程中的工作,請參閱下列章節:

    DICOM

    如要瞭解 Cloud Healthcare API 如何導入 DICOMweb 標準,請參閱 DICOM 符合聲明

    FHIR

    要瞭解 Cloud Healthcare API 如何導入 FHIR 標準,請參閱 FHIR 符合聲明

    HL7v2