

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# HealthLake 的 FHIR `$submit`操作
<a name="reference-fhir-operations-submit"></a>

`$submit` 此操作可讓您以電子方式提交預先授權請求給付款人以進行核准。此操作實作 [Da Vinci 預先授權支援 (PAS) 實作指南](https://hl7.org/fhir/us/davinci-pas/)，為預先授權提交提供標準化的 FHIR 工作流程。

## 運作方式
<a name="submit-how-it-works"></a>
+ **提交**：您傳送 FHIR 套件，其中包含您的預先授權請求和支援的臨床資料
+ **驗證**：HealthLake 會根據 PAS 要求驗證提交
+ **持久**性：所有資源都存放在 HealthLake 資料存放區中
+ **回應**：您立即收到「佇列」狀態的回應
+ **程序**：由付款人非同步處理授權決策

## API 端點
<a name="submit-api-endpoint"></a>

```
POST /datastore/{datastoreId}/r4/Claim/$submit  
Content-Type: application/fhir+json
```

## 請求結構
<a name="submit-request-structure"></a>

### 套件需求
<a name="submit-bundle-requirements"></a>

您的請求必須是具有下列項目的 FHIR 套件資源：
+ **Bundle.type**：必須為 `"collection"`
+ **Bundle.entry**：必須包含**一個**具有 的宣告資源 `use = "preauthorization"`
+ **參考資源**： 宣告參考的所有資源必須包含在套件中

### 必要的資源
<a name="submit-required-resources"></a>


| 資源 | 基數 | 設定檔 | Description | 
| --- | --- | --- | --- | 
| 宣告 | 1 | PAS 宣告 | 預先授權請求 | 
| 病患 | 1 | PAS 病患 | 病患人口統計資訊 | 
| Organization （保險業者） | 1 | PAS Insurer | 保險公司 | 
| Organization （提供者） | 1 | PAS 請求者 | 提交請求的醫療保健供應商 | 
| 涵蓋範圍 | 1 個或多個 | PAS 涵蓋範圍 | 保險涵蓋範圍詳細資訊 | 

### 選用資源
<a name="submit-optional-resources"></a>


| 資源 | 基數 | 設定檔 | Description | 
| --- | --- | --- | --- | 
| 從業人員 | 0 或以上 | PAS 從業人員 | 醫療保健從業人員 | 
| PractitionerRole | 0 或以上 | PAS PractitionerRole | 從業人員角色 | 
| ServiceRequest | 0 或以上 | PAS ServiceRequest | 請求的醫療保健 | 
| DeviceRequest | 0 或以上 | PAS DeviceRequest | 請求的醫療設備 | 
| MedicationRequest | 0 或以上 | PAS MedicationRequest | 請求的藥品 | 
| DocumentReference | 0 或以上 | PAS DocumentReference | 支援臨床文件 | 

## 範例請求
<a name="submit-example-request"></a>

```
POST /datastore/example-datastore/r4/Claim/$submit  
Content-Type: application/fhir+json  
Authorization: Bearer <your-token>  
  
{  
  "resourceType" : "Bundle",  
  "id" : "MedicalServicesAuthorizationBundleExample",  
  "meta" : {  
    "profile" : ["http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-pas-request-bundle"]  
  },  
  "identifier" : {  
    "system" : "http://example.org/SUBMITTER_TRANSACTION_IDENTIFIER",  
    "value" : "5269367"  
  },  
  "type" : "collection",  
  "timestamp" : "2005-05-02T11:01:00+05:00",  
  "entry" : [{  
    "fullUrl" : "http://example.org/fhir/Claim/MedicalServicesAuthorizationExample",  
    "resource" : {  
      "resourceType" : "Claim",  
      "id" : "MedicalServicesAuthorizationExample",  
      "meta" : {  
        "profile" : ["http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-claim"]  
      },  
      "identifier" : [{  
        "system" : "http://example.org/PATIENT_EVENT_TRACE_NUMBER",  
        "value" : "111099"   
      }],  
      "status" : "active",  
      "type" : {  
        "coding" : [{  
          "system" : "http://terminology.hl7.org/CodeSystem/claim-type",  
          "code" : "professional"  
        }]  
      },  
      "use" : "preauthorization",  
      "patient" : {  
        "reference" : "Patient/SubscriberExample"  
      },  
      "created" : "2005-05-02T11:01:00+05:00",  
      "insurer" : {  
        "reference" : "Organization/InsurerExample"  
      },  
      "provider" : {  
        "reference" : "Organization/UMOExample"  
      },  
      "priority" : {  
        "coding" : [{  
          "system" : "http://terminology.hl7.org/CodeSystem/processpriority",  
          "code" : "normal"  
        }]  
      },  
      "insurance" : [{  
        "sequence" : 1,  
        "focal" : true,  
        "coverage" : {  
          "reference" : "Coverage/InsuranceExample"  
        }  
      }],  
      "item" : [{  
        "extension" : [{  
          "url" : "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-serviceItemRequestType",  
          "valueCodeableConcept" : {  
            "coding" : [{  
              "system" : "https://codesystem.x12.org/005010/1525",  
              "code" : "IN",  
              "display" : "Initial Medical Services Reservation"  
            }]  
          }  
        },  
        {  
          "url" : "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-certificationType",  
          "valueCodeableConcept" : {  
            "coding" : [{  
              "system" : "https://codesystem.x12.org/005010/1322",  
              "code" : "I",  
              "display" : "Initial"  
            }]  
          }  
        },  
        {  
          "url" : "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-authorizationNumber",  
          "valueString" : "1122344"  
        },  
        {  
          "url" : "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-administrationReferenceNumber",  
          "valueString" : "33441122"  
        }],  
        "sequence" : 1,  
        "category" : {  
          "coding" : [{  
            "system" : "https://codesystem.x12.org/005010/1365",  
            "code" : "1",  
            "display" : "Medical Care"  
          }]  
        },  
        "productOrService" : {  
          "coding" : [{  
            "system" : "http://www.cms.gov/Medicare/Coding/HCPCS​ReleaseCodeSets",  
            "code" : "99212",  
            "display" : "Established Office Visit"  
          }]  
        },  
        "servicedDate" : "2005-05-10",  
        "locationCodeableConcept" : {  
          "coding" : [{  
            "system" : "https://www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set",  
            "code" : "11"  
          }]  
        }  
      }]  
    }  
  },  
  {  
    "fullUrl" : "http://example.org/fhir/Organization/UMOExample",  
    "resource" : {  
      "resourceType" : "Organization",  
      "id" : "UMOExample",  
      "meta" : {  
        "profile" : ["http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-requestor"]  
      },  
      "identifier" : [{  
        "system" : "http://hl7.org/fhir/sid/us-npi",  
        "value" : "8189991234"  
      }],  
      "active" : true,  
      "type" : [{  
        "coding" : [{  
          "system" : "https://codesystem.x12.org/005010/98",  
          "code" : "X3"  
        }]  
      }],  
      "name" : "DR. JOE SMITH CORPORATION",  
      "address" : [{  
        "line" : ["111 1ST STREET"],  
        "city" : "SAN DIEGO",  
        "state" : "CA",  
        "postalCode" : "92101",  
        "country" : "US"  
      }]  
    }  
  },  
  {  
    "fullUrl" : "http://example.org/fhir/Organization/InsurerExample",  
    "resource" : {  
      "resourceType" : "Organization",  
      "id" : "InsurerExample",  
      "meta" : {  
        "profile" : ["http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-insurer"]  
      },  
      "identifier" : [{  
        "system" : "http://hl7.org/fhir/sid/us-npi",  
        "value" : "1234567893"  
      }],  
      "active" : true,  
      "type" : [{  
        "coding" : [{  
          "system" : "https://codesystem.x12.org/005010/98",  
          "code" : "PR"  
        }]  
      }],  
      "name" : "MARYLAND CAPITAL INSURANCE COMPANY"  
    }  
  },  
  {  
    "fullUrl" : "http://example.org/fhir/Coverage/InsuranceExample",  
    "resource" : {  
      "resourceType" : "Coverage",  
      "id" : "InsuranceExample",  
      "meta" : {  
        "profile" : ["http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-coverage"]  
      },  
      "status" : "active",  
      "subscriberId" : "1122334455",  
      "beneficiary" : {  
        "reference" : "Patient/SubscriberExample"  
      },  
      "relationship" : {  
        "coding" : [{  
          "system" : "http://terminology.hl7.org/CodeSystem/subscriber-relationship",  
          "code" : "self"  
        },  
        {  
          "system" : "https://codesystem.x12.org/005010/1069",  
          "code" : "18"  
        }]  
      },  
      "payor" : [{  
        "reference" : "Organization/InsurerExample"  
      }]  
    }  
  },  
  {  
    "fullUrl" : "http://example.org/fhir/Patient/SubscriberExample",  
    "resource" : {  
      "resourceType" : "Patient",  
      "id" : "SubscriberExample",  
      "meta" : {  
        "profile" : ["http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-subscriber"]  
      },  
      "extension" : [{  
        "url" : "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-militaryStatus",  
        "valueCodeableConcept" : {  
          "coding" : [{  
            "system" : "https://codesystem.x12.org/005010/584",  
            "code" : "RU"  
          }]  
        }  
      }],  
      "identifier" : [{  
        "type" : {  
          "coding" : [{  
            "system" : "http://terminology.hl7.org/CodeSystem/v2-0203",  
            "code" : "MB"  
          }]  
        },  
        "system" : "http://example.org/MIN",  
        "value" : "12345678901"  
      }],  
      "name" : [{  
        "family" : "SMITH",  
        "given" : ["JOE"]  
      }],  
      "gender" : "male"  
    }  
  }]  
}
```

## 回應格式
<a name="submit-response-format"></a>

### 成功回應 (200 OK)
<a name="submit-success-response"></a>

您將會收到 PAS 回應套件，其中包含：
+ 使用 `outcome: "queued"`和 的 **ClaimResponse** `status: "active"`
+ 請求中的所有原始資源
+ 確認接收的時間戳記

```
{  
  "resourceType" : "Bundle",  
  "identifier": {  
        "system": "http://example.org/SUBMITTER_TRANSACTION_IDENTIFIER",  
        "value": "5269367"  
  },  
  "type" : "collection",  
  "timestamp" : "2005-05-02T11:02:00+05:00",  
  "entry" : [{  
    "fullUrl" : "http://example.org/fhir/ClaimResponse/PractitionerRequestorPendingResponseExample",  
    "resource" : {  
      "resourceType" : "ClaimResponse",  
      "id" : "PractitionerRequestorPendingResponseExample",  
      "meta" : {  
        "profile" : ["http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-claimresponse"]  
      },  
      "identifier" : [{  
        "system" : "http://example.org/PATIENT_EVENT_TRACE_NUMBER",  
        "value" : "111099"  
      }],  
      "status" : "active",  
      "type" : {  
        "coding" : [{  
          "system" : "http://terminology.hl7.org/CodeSystem/claim-type",  
          "code" : "professional"  
        }]  
      },  
      "use" : "preauthorization",  
      "patient" : {  
        "reference" : "Patient/SubscriberExample"  
      },  
      "created" : "2005-05-02T11:02:00+05:00",  
      "insurer" : {  
        "reference" : "Organization/InsurerExample"  
      },  
      "requestor" : {  
        "reference" : "PractitionerRole/ReferralPractitionerRoleExample"  
      },  
      "request" : {  
        "reference" : "Claim/MedicalServicesAuthorizationExample"  
      },  
      "outcome" : "queued"  
    }  
  },  
  {  
    "fullUrl" : "http://example.org/fhir/Claim/MedicalServicesAuthorizationExample",  
    "resource" : {  
      "resourceType" : "Claim",  
      "id" : "MedicalServicesAuthorizationExample",  
      "meta" : {  
        "profile": [  
            "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-claim",  
            "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-claim|2.1.0"  
        ]  
      },  
      "identifier" : [{  
        "system" : "http://example.org/PATIENT_EVENT_TRACE_NUMBER",  
        "value" : "111099"  
        }  
      }],  
      "status" : "active",  
      "type" : {  
        "coding" : [{  
          "system" : "http://terminology.hl7.org/CodeSystem/claim-type",  
          "code" : "professional"  
        }]  
      },  
      "use" : "preauthorization",  
      "patient" : {  
        "reference" : "Patient/SubscriberExample"  
      },  
      "created" : "2005-05-02T11:01:00+05:00",  
      "insurer" : {  
        "reference" : "Organization/InsurerExample"  
      },  
      "provider" : {  
        "reference" : "Organization/UMOExample"  
      },  
      "priority" : {  
        "coding" : [{  
          "system" : "http://terminology.hl7.org/CodeSystem/processpriority",  
          "code" : "normal"  
        }]  
      },  
      "insurance" : [{  
        "sequence" : 1,  
        "focal" : true,  
        "coverage" : {  
          "reference" : "Coverage/InsuranceExample"  
        }  
      }],  
      "item" : [{  
        "extension" : [{  
          "url" : "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-serviceItemRequestType",  
          "valueCodeableConcept" : {  
            "coding" : [{  
              "system" : "https://codesystem.x12.org/005010/1525",  
              "code" : "IN",  
              "display" : "Initial Medical Services Reservation"  
            }]  
          }  
        },  
        {  
          "url" : "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-certificationType",  
          "valueCodeableConcept" : {  
            "coding" : [{  
              "system" : "https://codesystem.x12.org/005010/1322",  
              "code" : "I",  
              "display" : "Initial"  
            }]  
          }  
        },  
        {  
          "url" : "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-authorizationNumber",  
          "valueString" : "1122344"  
        },  
        {  
          "url" : "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-administrationReferenceNumber",  
          "valueString" : "33441122"  
        }],  
        "sequence" : 1,  
        "category" : {  
          "coding" : [{  
            "system" : "https://codesystem.x12.org/005010/1365",  
            "code" : "1",  
            "display" : "Medical Care"  
          }]  
        },  
        "productOrService" : {  
          "coding" : [{  
            "system" : "http://www.cms.gov/Medicare/Coding/HCPCS​ReleaseCodeSets",  
            "code" : "99212",  
            "display" : "Established Office Visit"  
          }]  
        },  
        "servicedDate" : "2005-05-10",  
        "locationCodeableConcept" : {  
          "coding" : [{  
            "system" : "https://www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set",  
            "code" : "11"  
          }]  
        }  
      }]  
    }  
  },  
  {  
    "fullUrl" : "http://example.org/fhir/Organization/UMOExample",  
    "resource" : {  
      "resourceType" : "Organization",  
      "id" : "UMOExample",  
      "meta" : {  
        "profile": [  
            "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-requestor",  
            "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-requestor|2.1.0"  
        ]  
      },  
      "identifier" : [{  
        "system" : "http://hl7.org/fhir/sid/us-npi",  
        "value" : "8189991234"  
      }],  
      "active" : true,  
      "type" : [{  
        "coding" : [{  
          "system" : "https://codesystem.x12.org/005010/98",  
          "code" : "X3"  
        }]  
      }],  
      "name" : "DR. JOE SMITH CORPORATION",  
      "address" : [{  
        "line" : ["111 1ST STREET"],  
        "city" : "SAN DIEGO",  
        "state" : "CA",  
        "postalCode" : "92101",  
        "country" : "US"  
      }]  
    }  
  },  
  {  
    "fullUrl" : "http://example.org/fhir/Organization/InsurerExample",  
    "resource" : {  
      "resourceType" : "Organization",  
      "id" : "InsurerExample",  
      "meta" : {  
           "profile": [  
                "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-insurer",  
                "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-insurer|2.1.0"  
            ]  
      },  
      "identifier" : [{  
        "system" : "http://hl7.org/fhir/sid/us-npi",  
        "value" : "1234567893"  
      }],  
      "active" : true,  
      "type" : [{  
        "coding" : [{  
          "system" : "https://codesystem.x12.org/005010/98",  
          "code" : "PR"  
        }]  
      }],  
      "name" : "MARYLAND CAPITAL INSURANCE COMPANY"  
    }  
  },  
  {  
    "fullUrl" : "http://example.org/fhir/Coverage/InsuranceExample",  
    "resource" : {  
      "resourceType" : "Coverage",  
      "id" : "InsuranceExample",  
      "meta": {  
            "profile": [  
                "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-coverage",  
                "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-coverage|2.1.0"  
            ]  
        },  
      "status" : "active",  
      "subscriberId" : "1122334455",  
      "beneficiary" : {  
        "reference" : "Patient/SubscriberExample"  
      },  
      "relationship" : {  
        "coding" : [{  
          "system" : "http://terminology.hl7.org/CodeSystem/subscriber-relationship",  
          "code" : "self"  
        },  
        {  
          "system" : "https://codesystem.x12.org/005010/1069",  
          "code" : "18"  
        }]  
      },  
      "payor" : [{  
        "reference" : "Organization/InsurerExample"  
      }]  
    }  
  },  
  {  
    "fullUrl" : "http://example.org/fhir/Patient/SubscriberExample",  
    "resource" : {  
      "resourceType" : "Patient",  
      "id" : "SubscriberExample",  
      "meta": {  
            "profile": [  
                "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-subscriber",  
                "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-beneficiary",  
                "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-beneficiary|2.1.0"  
            ]  
        },  
      "extension" : [{  
        "url" : "http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-militaryStatus",  
        "valueCodeableConcept" : {  
          "coding" : [{  
            "system" : "https://codesystem.x12.org/005010/584",  
            "code" : "RU"  
          }]  
        }  
      }],  
      "identifier" : [{  
        "type" : {  
          "coding" : [{  
            "system" : "http://terminology.hl7.org/CodeSystem/v2-0203",  
            "code" : "MB"  
          }]  
        },  
        "system" : "http://example.org/MIN",  
        "value" : "12345678901"  
      }],  
      "name" : [{  
        "family" : "SMITH",  
        "given" : ["JOE"]  
      }],  
      "gender" : "male"  
    }  
  }]  
}
```

## 錯誤回應
<a name="submit-error-responses"></a>

### 400 錯誤的請求
<a name="submit-400-error"></a>

當請求格式無效或格式不正確時傳回。

```
{  
  "resourceType": "OperationOutcome",  
  "issue": [{  
    "severity": "error",  
    "code": "invalid",  
    "diagnostics": "The provided payload was invalid and could not be parsed correctly."  
  }]  
}
```

### 412 先決條件失敗
<a name="submit-412-error"></a>

已提交相同的預先授權請求時傳回 （偵測到重複提交）。

```
{  
  "resourceType": "OperationOutcome",  
  "issue": [{  
    "severity": "error",  
    "code": "processing",  
    "diagnostics": "PreAuth Claim already exists"  
  }]  
}
```

**冪等性**  
`$submit` 操作是等冪的。多次提交相同的請求不會建立重複的預先授權請求。反之，您會收到 412 錯誤，指示您使用 `$inquire`來檢查原始提交的狀態。

### 422 無法處理的實體
<a name="submit-422-error"></a>

FHIR 驗證失敗時傳回。

```
{  
  "resourceType": "OperationOutcome",  
  "issue": [{  
    "severity": "error",  
    "code": "required",  
    "diagnostics": "Bundle contains more than one preauthorization claim"  
  }]  
}
```

## 驗證規則
<a name="submit-validation-rules"></a>

HealthLake 會對您的提交執行全面的驗證：

### 套件驗證
<a name="submit-bundle-validation"></a>
+ 必須符合 PAS 請求套件描述檔
+ `Bundle.type` 必須 `"collection"`
+ 可以包含多個宣告資源
+ 不過， 必須包含一個具有預先授權使用的宣告資源
  + 此宣告資源必須是套件中的第一個項目
+ 套件中必須包含所有參考的資源

### 宣告驗證
<a name="submit-claim-validation"></a>
+ 必須符合 PAS 宣告描述檔
+ `Claim.use` 必須 `"preauthorization"`
+ 必要欄位：`patient`、`insurer`、`provider`、`created`、 `priority`
+ 業務識別符必須存在且有效

### 資源驗證
<a name="submit-resource-validation"></a>
+ 所有資源必須符合其各自的 PAS 設定檔
+ 必要的支援資源必須存在 （病患、涵蓋範圍、組織）
+ 交互參考在套件中必須是有效且可解析的

## 效能規格
<a name="submit-performance-specs"></a>


| 指標 | 規格 | 
| --- | --- | 
| 套件大小限制 | 最多 5 MB | 
| 資源計數限制 | 每個套件 500 個資源 | 

## 所需的許可
<a name="submit-required-permissions"></a>

若要使用 `$submit`操作，使用者可以在 FHIR 上使用 AWS Sigv4 或 SMART：
+ 確保您的 IAM 角色具有：`healthlake:SubmitPreAuthClaim`- 呼叫 操作

**FHIR 範圍上的 SMART**  
**所需範圍下限：**
+ **SMART v1**： `user/Claim.write & <all_resourceTypes_in_Bundle>.write`
+ **SMART v2**： `user/Claim.c & <all_resourceTypes_in_Bundle>.c or system/*.*`

## 重要實作備註
<a name="submit-implementation-notes"></a>

### 資源持久性
<a name="submit-resource-persistence"></a>
+ 所有套件項目都會保留為資料存放區中的個別 FHIR 資源
+ 客戶提供IDs 會在提供時保留
+ 維護版本歷史記錄以供稽核之用
+ 重複偵測可防止資源衝突

### 處理行為
<a name="submit-processing-behavior"></a>
+ 每個有效的提交只會產生一個 ClaimResponse `"queued"`結果
+ 無效提交會傳回 400 或 422 狀態碼，其中包含詳細的錯誤資訊
+ 系統錯誤會傳回適當的 5xx 狀態碼
+ 所有成功的提交都會傳回 200 狀態與待定的 ClaimResponse

### 套件需求
<a name="submit-bundle-requirements-impl"></a>
+ `Bundle.entry.fullUrl` 值必須是 REST URLs或`"urn:uuid:[guid]"`格式
+ 所有 GUIDs提交之間必須是唯一的 （相同資源執行個體除外）
+ 參考的資源必須存在於套件中或可解析

## 相關的 操作
<a name="submit-related-operations"></a>
+ `Claim/$inquire` - 查詢提交的預先授權請求的狀態
+ `Patient/$everything` - 針對預先授權內容擷取完整的患者資料