使用 curl 和 PowerShell 存储医疗保健数据

本页面介绍了如何使用 Cloud Healthcare API 和 curl 或 PowerShell 来完成以下任务:

  1. 创建 Cloud Healthcare API 数据集。
  2. 在数据集内创建以下数据存储区之一:
    • 医学数字图像和通信 (DICOM) 存储区
    • 快速医疗互操作性资源 (FHIR) 存储区
    • Health Level Seven International 版本 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

      API Explorer

      打开方法参考页面。APIs Explorer 面板会在页面右侧打开。您可以与此工具进行交互以发送请求。 填写所有必填字段,然后点击执行

      输出如下所示。响应包含长时间运行的操作 (LRO) 的标识符。如果方法调用可能需要额外的时间才能完成,系统就会返回长时间运行的操作。记下 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

      API 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

    API 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:唯一标识实例

    查看 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

    API 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 版本 R4 的 FHIR 存储区。

    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

    API Explorer

    复制请求正文并打开方法参考页面。APIs Explorer 面板会在页面右侧打开。您可以与此工具进行交互以发送请求。 将请求正文粘贴到此工具中,填写任何其他必填字段,然后点击执行

    您应该收到类似以下内容的 JSON 响应:

    存储 FHIR 资源

    REST

    使用 projects.locations.datasets.fhirStores.fhir.create 方法在 FHIR 存储区中创建患者资源。

    在使用任何请求数据之前,请先进行以下替换:

    • 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

    API 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 消息包含以下信息,这些信息采用 base-64 编码存放在示例文件的 data 字段中:

      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

      API Explorer

      打开方法参考页面。APIs Explorer 面板会在页面右侧打开。您可以与此工具进行交互以发送请求。 填写所有必填字段,然后点击执行

      输出如下所示。在此输出中:

      • PROJECT_IDus-central1my-datasetmy-hl7v2-store:您在方法调用中提供的值
      • MESSAGE_ID:Cloud Healthcare API 提供的 HL7v2 消息的标识符。记下 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

    API Explorer

    打开方法参考页面。APIs Explorer 面板会在页面右侧打开。您可以与此工具进行交互以发送请求。 填写所有必填字段,然后点击执行

    您应该收到类似以下内容的 JSON 响应:

    在 Cloud Healthcare API 中存储和查看 HL7v2 消息后,请继续清理,以避免因本页中使用的资源导致您的 Google Cloud 账号产生费用。

    如需详细了解如何使用 HL7v2 数据,请参阅后续步骤

    清理

    为避免因本页面中使用的资源导致您的 Google Cloud 账号产生费用,请删除包含这些资源的 Google Cloud 项目。

    如果您为此快速入门创建了新项目,请按照删除项目中的步骤操作。否则,请按照删除数据集中的步骤操作。

  17. Optional: Revoke credentials from the gcloud CLI.

    gcloud auth revoke
  18. 删除项目

      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

    API Explorer

    打开方法参考页面。APIs Explorer 面板会在页面右侧打开。您可以与此工具进行交互以发送请求。 填写所有必填字段,然后点击执行

    您应该会收到一个成功的状态代码 (2xx) 和一个空响应。

    结果怎么样?

    后续步骤

    如需了解有关 Cloud Healthcare API 的一般信息以及如何使用其他界面执行本快速入门中的任务,请参阅以下部分:

    DICOM

    如需了解 Cloud Healthcare API 如何实现 DICOMweb 标准,请参阅 DICOM 一致性声明

    FHIR

    如需了解 Cloud Healthcare API 如何实现 FHIR 标准,请参阅 FHIR 一致性声明

    HL7v2