

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 를 사용하여 임상 문서 생성 `$document`
<a name="reference-fhir-operations-document"></a>

AWS HealthLake 는 이제 구성 리소스에 대한 `$document` 작업을 지원하므로 참조된 모든 리소스와 구성을 단일 응집력 있는 패키지로 번들링하여 전체 임상 문서를 생성할 수 있습니다. 이 작업은 다음을 수행해야 하는 의료 애플리케이션에 필수적입니다.
+ 표준화된 임상 문서 생성
+ 전체 환자 레코드 교환
+ 포괄적인 임상 문서 저장
+ 모든 관련 컨텍스트를 포함하는 보고서 생성

## 사용법
<a name="document-usage"></a>

GET 및 POST 메서드를 모두 사용하여 구성 리소스에서 `$document` 작업을 호출할 수 있습니다.

**지원되는 작업**  


```
GET/POST [base]/Composition/[id]/$document
```

## 지원되는 파라미터
<a name="document-parameters"></a>

HealthLake는 다음 FHIR `$document` 파라미터를 지원합니다.


| 파라미터 | Type | 필수 | 기본값 | 설명 | 
| --- | --- | --- | --- | --- | 
| persist | 부울 | 아니요 | false | 서버가 생성된 문서 번들을 저장해야 하는지 여부를 나타내는 부울 | 

## 예제
<a name="document-examples"></a>

**GET 요청**  


```
GET [base]/Composition/180f219f-97a8-486d-99d9-ed631fe4fc57/$document?persist=true
```

**파라미터를 사용한 POST 요청**  


```
POST [base]/Composition/180f219f-97a8-486d-99d9-ed631fe4fc57/$document
Content-Type: application/fhir+json

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "persist",
      "valueBoolean": true
    }
  ]
}
```

**샘플 응답**  
작업은 구성 및 참조된 모든 리소스가 포함된 "문서" 유형의 번들 리소스를 반환합니다.

```
{
  "resourceType": "Bundle",
  "id": "180f219f-97a8-486d-99d9-ed631fe4fc57",
  "type": "document",
  "identifier": {
    "system": "urn:ietf:rfc:3986",
    "value": "urn:uuid:0c3151bd-1cbf-4d64-b04d-cd9187a4c6e0"
  },
  "timestamp": "2024-06-21T15:30:00Z",
  "entry": [
    {
      "fullUrl": "http://example.org/fhir/Composition/180f219f-97a8-486d-99d9-ed631fe4fc57",
      "resource": {
        "resourceType": "Composition",
        "id": "180f219f-97a8-486d-99d9-ed631fe4fc57",
        "status": "final",
        "type": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "34133-9",
              "display": "Summary of Episode Note"
            }
          ]
        },
        "subject": {
          "reference": "Patient/example"
        },
        "section": [
          {
            "title": "Allergies",
            "entry": [
              {
                "reference": "AllergyIntolerance/123"
              }
            ]
          }
        ]
      }
    },
    {
      "fullUrl": "http://example.org/fhir/Patient/example",
      "resource": {
        "resourceType": "Patient",
        "id": "example",
        "name": [
          {
            "family": "Smith",
            "given": ["John"]
          }
        ]
      }
    },
    {
      "fullUrl": "http://example.org/fhir/AllergyIntolerance/123",
      "resource": {
        "resourceType": "AllergyIntolerance",
        "id": "123",
        "patient": {
          "reference": "Patient/example"
        },
        "code": {
          "coding": [
            {
              "system": "http://snomed.info/sct",
              "code": "418689008",
              "display": "Allergy to penicillin"
            }
          ]
        }
      }
    }
  ]
}
```

## 동작
<a name="document-behavior"></a>

`$document` 작업:

1. 지정된 구성 리소스를 문서의 기반으로 사용합니다.

1. 구성에서 직접 참조하는 모든 리소스를 식별하고 검색합니다.

1. 구성 및 참조된 모든 리소스를 "문서" 유형의 번들로 패키징합니다.

1. 지속 파라미터가 true로 설정된 경우 생성된 문서 번들을 데이터 스토어에 저장합니다.

1. 포괄적인 문서 생성을 위해 구성에서 간접적으로 참조하는 리소스를 식별하고 검색합니다.

`$document` 작업은 현재 다음 형식의 리소스 참조 검색을 지원합니다.

1. 

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

1. 리소스/id

구성 리소스 내에서 지원되지 않는 리소스 참조는 생성된 문서에서 필터링됩니다.

## 오류 처리
<a name="document-error-handling"></a>

작업은 다음 오류 조건을 처리합니다.
+ 400 잘못된 요청: 잘못된 `$document` 작업(부적합 요청) 또는 지속이 true로 설정된 경우 필터링된 참조로 인해 결과 문서가 FHIR 검증에 실패하는 경우
+ 404 찾을 수 없음: 구성 리소스를 찾을 수 없음

`$document` 작업 사양에 대한 자세한 내용은 [FHIR R4 구성 `$document`](https://www.hl7.org/fhir/R4/composition-operation-document.html) 설명서를 참조하세요.