You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SMART on FHIR JS API获取Patient资源异常及文档代码报错问题

问题:使用SMART on FHIR JavaScript Library获取完整Patient资源的正确方式

我正基于Cerner的SMART on FHIR教程开发应用,示例代码通过以下方式获取患者与观测数据:

var patient = smart.patient;
var pt = patient.read();
var obv = smart.patient.api.fetchAll({
            type: 'Observation',
            query: {
              code: {
                $or: ['http://loinc.org|8302-2', 'http://loinc.org|8462-4',
                      'http://loinc.org|8480-6', 'http://loinc.org|2085-9',
                      'http://loinc.org|2089-1', 'http://loinc.org|55284-4']
              }
            }
          });

修改后的代码在SMART App Launcher运行正常,但移除smart.patient.api.fetchAll获取Observation的调用后,Patient的JSON字符串为空。

尝试按照官方文档使用以下代码时出现报错:

<!-- index.html -->
<script src="./node_module/fhirclient/build/fhir-client.js"></script>
<script>
FHIR.oauth2.ready()
    .then(client => client.request("Patient"))
    .then(console.log)
    .catch(console.error);
</script>

报错截图:
报错截图

使用的库直接来自Cerner教程:
使用的库

咨询:使用SMART on FHIR JavaScript Library获取完整Patient资源的正确方式是什么?


内容的提问来源于stack exchange,提问作者John

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 10:31:20