

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 读取 FHIR 资源
<a name="managing-fhir-resources-read"></a>

FHIR `read` 交互读取 HealthLake数据存储中资源的当前状态。有关更多信息，请参阅 **FHIR R4 RESTful API** 文档[https://hl7.org/fhir/R4/http.html#read](https://hl7.org/fhir/R4/http.html#read)中的。

**要读取 FHIR 资源**  


1. 收集 HealthLake `region`和`datastoreId`价值。有关更多信息，请参阅 [获取数据存储属性](managing-data-stores-describe.md)。

1. 确定`Resource`要读取的 FHIR 类型并收集相关`id`值。有关更多信息，请参阅 [资源类型](reference-fhir-resource-types.md)。

1. 使用收集到的 HealthLake `region`和值为请求构造一个 URL `datastoreId`。还要包括 FHIR `Resource` 类型及其关联`id`的。要查看以下示例中的整个 URL 路径，请滚动到 “**复制**” 按钮。

   ```
   GET https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Resource/id
   ```

1. 发送 请求。FHIR `read` 交互在 FHIR 授权上使用[AWS 签名版本 4](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html) 或 SMART 的`GET`请求。以下`curl`示例读取了 FHIR `Patient` 资源的当前状态。 HealthLake要查看整个示例，请滚动到 “复**制**” 按钮。

------
#### [ SigV4 ]

   Sigv4 授权

   ```
   curl --request GET \
     'https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Patient/id' \
     --aws-sigv4 'aws:amz:region:healthlake' \
     --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \
     --header "x-amz-security-token:$AWS_SESSION_TOKEN" \
     --header 'Accept: application/json'
   ```

------
#### [ SMART on FHIR ]

   该[https://docs.aws.amazon.com/healthlake/latest/APIReference/API_IdentityProviderConfiguration.html](https://docs.aws.amazon.com/healthlake/latest/APIReference/API_IdentityProviderConfiguration.html)数据类型的 SMART on FHIR 授权示例。

   ```
   {
       "AuthorizationStrategy": "SMART_ON_FHIR",
       "FineGrainedAuthorizationEnabled": true,
       "IdpLambdaArn": "arn:aws:lambda:your-region:your-account-id:function:your-lambda-name",
       "Metadata": "{\"issuer\":\"https://ehr.example.com\", \"jwks_uri\":\"https://ehr.example.com/.well-known/jwks.json\",\"authorization_endpoint\":\"https://ehr.example.com/auth/authorize\",\"token_endpoint\":\"https://ehr.token.com/auth/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_basic\",\"foo\"],\"grant_types_supported\":[\"client_credential\",\"foo\"],\"registration_endpoint\":\"https://ehr.example.com/auth/register\",\"scopes_supported\":[\"openId\",\"profile\",\"launch\"],\"response_types_supported\":[\"code\"],\"management_endpoint\":\"https://ehr.example.com/user/manage\",\"introspection_endpoint\":\"https://ehr.example.com/user/introspect\",\"revocation_endpoint\":\"https://ehr.example.com/user/revoke\",\"code_challenge_methods_supported\":[\"S256\"],\"capabilities\":[\"launch-ehr\",\"sso-openid-connect\",\"client-public\",\"permission-v2\"]}"
   }
   ```

   调用者可以在授权 lambda 中分配权限。有关更多信息，请参阅 [OAuth 2.0 瞄准镜](reference-smart-on-fhir-oauth-scopes.md)。

------
#### [ AWS Console ]

   1. 登录 HealthLake 控制台上的 “[运行查询](https://console.aws.amazon.com/healthlake/home#/crud)” 页面。

   2. 在 **“查询设置”** 部分下，进行以下选择。
   + **数据存储 ID**-选择数据存储 ID 以生成查询字符串。
   + **查询类型**-选择`Read`。
   + **资源类型**-选择要读取的 FHIR [资源类型](reference-fhir-resource-types.md)。
   + **资源 ID** — 输入 FHIR 资源 ID。

   3. 选择**运行查询**。

------