| 请求载荷参数 | 说明 |
| 方法 | HTTP 请求方法,指定对 FHIR 服务器的操作类型,包括 GET(查询)、POST(创建)、PUT(全量更新)、PATCH(部分更新)和 DELETE(删除)。 |
| 路径 | 请求路径,定位到具体的资源端点。 |
| 参数 | URL 查询参数,在 FHIR 搜索中传递筛选/分页/格式控制等条件。 |
| 请求头 | HTTP 请求头,在请求中传递内容类型、认证凭据、响应格式偏好等元信息。 |
| 内容 | 请求体,在 POST/PUT/PATCH 等操作中携带资源数据。 |
一、前提条件
已 创建实例。
二、搜索参数合法性校验
在 创建实例 时,开启了严格搜索模式的实例,在搜索时,会校验搜索参数的合法性。
例如,以 ID 来查询患者信息,在使用正确的搜索参数_id 进行查询时,会查询成功。
而在使用错误的搜索参数 id 进行查询时,则会失败,提示未知搜索参数。
三、引用数据完整性校验
在 创建实例 时,开启了强制验证引用完整性功能的实例,在 创建资源 时,会校验引用的数据是否存在。
例如,创建 Patient 资源时,元素 managingOrganization(管理机构)会引用资源 Organization 下的一条数据,当这条数据不存在时,则会报错,提示找不到资源数据。
{ "resourceType": "Patient", "id": "10001", "meta": { "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient" ] }, "identifier": [ { "system": "http://example.org/mrn", "value": "MRN123456" } ], "active": true, "name": [ { "use": "official", "family": "Wang", "given": ["Wu"] } ], "gender": "male", "birthDate": "1990-08-18", "deceasedBoolean": false, "telecom": [ { "system": "phone", "value": "13500001111", "use": "work" } ], "address": [ { "use": "home", "type": "both", "line": [ "广东省深圳市宝安区新湖路100号" ], "city": "深圳市", "district": "宝安区", "postalCode": "518020", "country": "中国" } ], "managingOrganization": { "reference": "Organization/e785218b-078b-4e13-a78c-3db7a358f0a", "display": "南方医科大学深圳医院" }}
四、资源库校验
在 创建实例 时,开启了资源库校验功能的实例,在 创建资源 时,会去匹配实施指南中配置好的规则。例如,实例的实施指南中约定 Patient 资源的 gender 元素不能为空,如果创建时为空,则会报错,提示创建资源失败。
例如,将 gender 元素注释掉之后,在创建的时候就报错了,提示规则要求 gender 不能为空。
{ "resourceType": "Patient", "id":"10001", "meta": { "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient" ] }, "identifier": [ { "system": "http://example.org/mrn", "value": "MRN123456" } ], "active": true, "name":[ { "use":"official", "text": "王五", "family": "王", "given": ["五"] } ], "telecom": [ { "system":"phone", "value":"13500001111", "use":"work" } ], "gender": "male", "birthDate": "1990-08-18", "deceasedBoolean": false, "address": [ { "use": "home", "type": "both", "line": [ "广东省深圳市宝安区新湖路100号" ], "city": "深圳市", "district": "宝安区", "postalCode": "518020", "country": "中国" } ]}
五、引用目标类型校验
在 创建实例 时,开启了强制引用目标类型校验功能的实例,在 创建资源 时,会校验元素引用的类型是否符合标准规范。
例如,在创建 Patient 资源时,按照 FHIR 标准,元素 managingOrganization(管理机构)要求引用资源为 Organization 资源。
将元素 managingOrganization(管理机构)引用的资源修改为其他资源类型,则会提示报错,资源类型无效。
{ "resourceType": "Patient", "id": "10001", "meta": { "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient" ] }, "identifier": [ { "system": "http://example.org/mrn", "value": "MRN123456" } ], "active": true, "name": [ { "use": "official", "family": "Wang", "given": ["Wu"] } ], "gender": "male", "birthDate": "1990-08-18", "deceasedBoolean": false, "telecom": [ { "system": "phone", "value": "13500001111", "use": "work" } ], "address": [ { "use": "home", "type": "both", "line": [ "广东省深圳市宝安区新湖路100号" ], "city": "深圳市", "district": "宝安区", "postalCode": "518020", "country": "中国" } ], "managingOrganization": { "reference": "Organization/e785218b-078b-4e13-a78c-3db7a358f0a", "display": "南方医科大学深圳医院" }}