基于OAuth 2.0的Epic FHIR API:获取含参与者及位置的预约信息
Epic FHIR API 预约查询优化方案
一、修复指定医疗机构的预约列表查询问题
你当前的请求存在几个可能导致无法获取目标机构预约的问题,调整如下:
- 修正Patient参数格式
当前请求中patient参数传入了完整的Patient资源,不符合Epic FHIR操作的常规要求。应改为传入Patient资源的相对引用(仅需资源类型+ID):
{ "name": "patient", "valueReference": { "reference": "Patient/[你的患者ID]" } }
如果不需要限定特定患者,可直接移除该参数,这样就能查询机构下所有符合条件的预约。
- 简化Location引用
location-reference参数无需传入完整URL,仅需Location资源的相对引用即可:
{ "name": "location-reference", "valueReference": { "reference": "Location/e4W4rmGe9QzuGm2Dy4NBqVc0KDe6yGld6HW95UuN-Qd03" } }
- 添加Organization参数(可选)
如果需要明确指定医疗机构(而非仅通过Location),可添加organization参数:
{ "name": "organization", "valueReference": { "reference": "Organization/[机构ID]" } }
二、获取参与者(医生、临床人员、患者)详细信息
要在返回结果中包含参与者的完整资源,需在请求中添加FHIR标准的include规则:
- 若使用POST操作(如
$find-appointments),直接在Parameters中添加include参数:
{ "name": "include", "valueString": "Appointment:participant,Appointment:patient" }
- 若使用GET方式查询Appointment资源,可在URL中添加
_include参数:
[你的Epic FHIR端点]/Appointment?_include=Appointment:participant&_include=Appointment:patient&[其他查询参数]
优化后的完整请求负载示例
{ "resourceType": "Parameters", "parameter": [ { "name": "patient", "valueReference": { "reference": "Patient/12345" } }, { "name": "startTime", "valueDateTime": "2024-01-01T00:00:00Z" }, { "name": "endTime", "valueDateTime": "2024-09-01T23:59:59Z" }, { "name": "serviceType", "valueCodeableConcept": { "coding": [ { "system": "urn:oid:1.2.840.114350.1.13.0.1.7.3.808267.11", "code": "95014", "display": "Office Visit" } ] } }, { "name": "location-reference", "valueReference": { "reference": "Location/e4W4rmGe9QzuGm2Dy4NBqVc0KDe6yGld6HW95UuN-Qd03" } }, { "name": "include", "valueString": "Appointment:participant,Appointment:patient" } ] }
额外注意事项
- 确保你的OAuth令牌拥有
Appointment.read及相关参与者资源(Patient、Practitioner等)的读取权限。 - 若使用GET方式查询,可直接将时间、服务类型等作为URL参数传递,例如:
[端点]/Appointment?date=ge2024-01-01&date=le2024-09-01&service-type=95014&location=Location/e4W4rmGe9QzuGm2Dy4NBqVc0KDe6yGld6HW95UuN-Qd03&_include=Appointment:participant&_include=Appointment:patient
内容的提问来源于stack exchange,提问作者Ashish Banjare
相关产品推荐
相关产品推荐

