FHIR 订阅在 hapi-fhir 中不起作用

FHIR Subscription not working in hapi-fhir

我正在使用这个 hapi-fhir v4.2.0 server with jpa,它工作得很好。我添加了一些患者,我可以 GET/POST 向我的 hapi-fhir 本地主机环境发出请求。

我还可以使用此 URL 创建订阅:http://localhost:8080/hapi-fhir-jpaserver/fhir/Subscription 正文:

{
  "resourceType": "Subscription",
  "criteria": "Patient",
  "reason": "Give me the patient",
  "end": "2021-01-01T00:00:00Z",
  "status": "requested",
  "channel": {
    "type": "rest-hook",
    "endpoint": "http://localhost:1337",
    "payload": "application/json"
  }
}

每当我对 Patient 进行 POST 或 PUT 时,应该触发订阅并向 http://localhost:1337 发送 POST 请求,但没有任何反应。

我尝试过的:

  1. requested 更改为 active
  2. 正在将条件从 Patient 更改为 Patient?name=John
  3. 删除 payload 参数
  4. 正在阅读documentation
  5. 改为application/fhir+json

仍然无法正常工作 :( 伙计们,我在这里缺少什么?

编辑:我的后端是一个简单的 nodejs 运行 morgan,因此它将在控制台中记录每一次 POST/GET/PUT 尝试。

我也遇到过同样的事情。但是,我设法解决了它。

我们需要在 hapi.properties 文件中打开订阅 rest webhook。

...
##################################################
# Subscriptions
##################################################

# Enable REST Hook Subscription Channel
subscription.resthook.enabled=true
...

如果您现在使用的是最新版本 v5.3.0,它在 application.yaml

...
    subscription:
      resthook_enabled: true
...

作为对@nirojshrestha019 的回应,我设法通过 docker compose 版本 v.2.0.0-rc.1.

在本地 运行 它

docker-compose.yml

version: "3.9"
services:
  hapi-fhir:
    image: hapiproject/hapi:v5.2.1
    ports:
      - target: 8080
        published: 8080
        x-aws-protocol: http
    env_file:
      - .env.dev
    environment:
      profiles.active: r4
      spring.datasource.driverClassName: org.postgresql.Driver
    deploy:
      x-aws-autoscaling:
        min: 1
        max: 10 # required
        cpu: 75
      resources:
        limits:
          cpus: '2'
          memory: 4Gb
## Uncomment these lines when working on development environment
#     depends_on:
#       - db
#   db:
#     image: postgres:13.2-alpine
#     env_file:
#       - .env.dev
#     volumes:
#       - db:/var/lib/postgresql/data
#     ports:
#       - 5432:5432
# volumes:
#   db:

.env.dev

POSTGRES_PASSWORD
POSTGRES_USER=
POSTGRES_DB=
POSTGRES_PORT=
POSTGRES_HOST=
SPRING_DATASOURCE_URL=jdbc:postgresql://${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
SPRING_DATASOURCE_USERNAME=${POSTGRES_USER}
SPRING_DATASOURCE_PASSWORD=${POSTGRES_PASSWORD}
HAPI_FHIR_SERVER_ADDRESS=
HAPI_FHIR_TESTER_HOME_SERVER_ADDRESS=
HAPI_FHIR_SUBSCRIPTION_RESTHOOK_ENABLED=
HAPI_FHIR_CORS_ALLOWED_ORIGIN=