将 json 反序列化为 FHIR 约会实例时遇到问题

Having trouble Deserializing json to FHIR Appointment Instance

我正在获得以下内容 json:

{
  "fullUrl": "https://my.fhir-server.com:8181/multi-m2integrationtest/firm/xyz123/ema/fhir/v2/Appointment/7240",
  "resource": {
    "resourceType": "Appointment",
    "id": "7240",
    "meta": {
      "lastUpdated": "2020-11-16T15:00:40-05:00"
    },
    "status": "pending",
    "appointmentType": {
      "coding": [
        {
          "system": "https://my.fhir-server.com:8181/multi-m2integrationtest/firm/xyz123/ema/fhir/v2/ValueSet/appointment-type",
          "code": "599",
          "display": "New Patient"
        }
      ],
      "text": "New Patient"
    },
    "reasonCode": [
      {
        "coding": [
          {
            "system": "https://my.fhir-server.com:8181/multi-m2integrationtest/firm/xyz123/ema/fhir/v2/ValueSet/reportable-reason",
            "code": "Other",
            "display": "OTHER"
          }
        ],
        "text": "OTHER"
      }
    ],
    "supportingInformation": [
      {
        "identifier": {
          "system": "NEW_PATIENT",
          "value": "true"
        },
        "display": "New Patient: true"
      }
    ],
    "start": "2020-11-17T09:55:00-05:00",
    "end": "2020-11-17T10:10:00-05:00",
    "minutesDuration": 15,
    "created": "2020-11-16T15:00:40-05:00",
    "participant": [
      {
        "actor": {
          "reference": "https://my.fhir-server.com:8181/multi-m2integrationtest/firm/xyz123/ema/fhir/v2/Location/271",
          "display": "https://my.fhir-server.com:8181/multi-m2integrationtest/firm/xyz123/ema/fhir/v2/Location/271"
        }
      },
      {
        "actor": {
          "reference": "https://my.fhir-server.com:8181/multi-m2integrationtest/firm/xyz123/ema/fhir/v2/Practitioner/116249",
          "display": "https://my.fhir-server.com:8181/multi-m2integrationtest/firm/xyz123/ema/fhir/v2/Practitioner/116249"
        }
      },
      {
        "actor": {
          "reference": "https://my.fhir-server.com:8181/multi-m2integrationtest/firm/xyz123/ema/fhir/v2/Patient/116453",
          "display": "https://my.fhir-server.com:8181/multi-m2integrationtest/firm/xyz123/ema/fhir/v2/Patient/116453"
        }
      }
    ]
  }
}

这是一个约会结构:

当我尝试将其反序列化为 FHIR 约会时 class,尝试失败:

Appointment a = JsonConvert.DeserializeObject<Appointment>(strAppt, jss);

没有例外,但显然,这没有成功:

约会 class 已实例化,但其所有属性均为 null 或 0

这是我合并到我的项目中的 FHIR 包:

解决方案不是使用 JsonConvert,而是使用专门的 FhirJsonParser。

这个有效:

FhirJsonParser fjp = new FhirJsonParser();
Bundle bundle = fjp.Parse<Bundle>(Response);
foreach (var entry in bundle.Entry)
{
    Appointment appt = (Appointment)entry.Resource;
}

很好的文档资源:https://docs.fire.ly/firelynetsdk/start.html