首页 > 解决方案 > 为 R4 患者添加扩展

问题描述

如何将以下内容添加到 R4 患者?

        "search": {
            "extension": [
                {
                    "url": "http://hl7.org/fhir/StructureDefinition/match-grade",
                    "valueCode": "certain"
                }
            ],
            "mode": "match",
            "score": 1.0
        }

stu2 和 stu3 下的对象(我认为)已被弃用。

DSTU3 and Later
// Create an example patient
Patient patient = new Patient();
patient.addIdentifier().setUse(Identifier.IdentifierUse.OFFICIAL).setSystem("urn:example").setValue("7000135");

// Create an extension
Extension ext = new Extension();
ext.setUrl("http://example.com/extensions#someext");
ext.setValue(new DateTimeType("2011-01-02T11:13:15"));

// Add the extension to the resource
patient.addExtension(ext);

来自以下患者匹配的完整“响应”json(示例数据,不是真实数据!!)

{
    "resourceType": "Bundle",
    "id": "94897c77-4120-482f-bdb4-4c8b9a71ade1",
    "meta": {
        "versionId": "1",
        "lastUpdated": "2020-11-24T08:45:49.445-05:00"
    },
    "type": "searchset",
    "total": 1,
    "link": [
        {
            "relation": "self",
            "url": "http://wildfhir4.aegis.net/fhir4-0-0/Patient/$match?"
        }
    ],
    "entry": [
        {
            "fullUrl": "http://wildfhir4.aegis.net/fhir4-0-0/Patient/9126db824dcf4d5ab3f68e63bd5eaced",
            "resource": {
                "resourceType": "Patient",
                "id": "9126db824dcf4d5ab3f68e63bd5eaced",
                "meta": {
                    "versionId": "1",
                    "lastUpdated": "2020-09-03T09:03:28.193-04:00",
                    "tag": [
                        {
                            "system": "http://terminology.hl7.org/CodeSystem/v3-ActReason",
                            "code": "HTEST",
                            "display": "test health data"
                        }
                    ]
                },
                "text": {
                    "status": "generated",
                    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><tbody><tr><td>Name</td><td>Peter James                             \n              <b>Chalmers</b> (&quot;Jim&quot;)                        \n            </td></tr><tr><td>Address</td><td>534 Erewhon, Pleasantville, Vic, 3999</td></tr><tr><td>Contacts</td><td>Home: unknown. Work: (03) 5555 6473</td></tr><tr><td>Id</td><td>MRN: 12345 (Acme Healthcare)</td></tr></tbody></table></div>"
                },
                "identifier": [
                    {
                        "use": "usual",
                        "type": {
                            "coding": [
                                {
                                    "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                                    "code": "MR"
                                }
                            ]
                        },
                        "system": "urn:oid:1.2.36.146.595.217.0.1",
                        "value": "12345",
                        "period": {
                            "start": "2001-05-06"
                        },
                        "assigner": {
                            "display": "Acme Healthcare"
                        }
                    }
                ],
                "active": true,
                "name": [
                    {
                        "use": "official",
                        "family": "Chalmers",
                        "given": [
                            "Peter",
                            "James"
                        ]
                    },
                    {
                        "use": "usual",
                        "given": [
                            "Jim"
                        ]
                    },
                    {
                        "use": "maiden",
                        "family": "Windsor",
                        "given": [
                            "Peter",
                            "James"
                        ],
                        "period": {
                            "end": "2002"
                        }
                    }
                ],
                "telecom": [
                    {
                        "use": "home"
                    },
                    {
                        "system": "phone",
                        "value": "(03) 5555 6473",
                        "use": "work",
                        "rank": 1
                    },
                    {
                        "system": "phone",
                        "value": "(03) 3410 5613",
                        "use": "mobile",
                        "rank": 2
                    },
                    {
                        "system": "phone",
                        "value": "(03) 5555 8834",
                        "use": "old",
                        "period": {
                            "end": "2014"
                        }
                    }
                ],
                "gender": "male",
                "birthDate": "1974-12-25",
                "_birthDate": {
                    "extension": [
                        {
                            "url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime",
                            "valueDateTime": "1974-12-25T14:35:45-05:00"
                        }
                    ]
                },
                "deceasedBoolean": false,
                "address": [
                    {
                        "use": "home",
                        "type": "both",
                        "text": "534 Erewhon St PeasantVille, Rainbow, Vic  3999",
                        "line": [
                            "534 Erewhon St"
                        ],
                        "city": "PleasantVille",
                        "district": "Rainbow",
                        "state": "Vic",
                        "postalCode": "3999",
                        "period": {
                            "start": "1974-12-25"
                        }
                    }
                ],
                "contact": [
                    {
                        "relationship": [
                            {
                                "coding": [
                                    {
                                        "system": "http://terminology.hl7.org/CodeSystem/v2-0131",
                                        "code": "N"
                                    }
                                ]
                            }
                        ],
                        "name": {
                            "family": "du Marché",
                            "_family": {
                                "extension": [
                                    {
                                        "url": "http://hl7.org/fhir/StructureDefinition/humanname-own-prefix",
                                        "valueString": "VV"
                                    }
                                ]
                            },
                            "given": [
                                "Bénédicte"
                            ]
                        },
                        "telecom": [
                            {
                                "system": "phone",
                                "value": "+33 (237) 998327"
                            }
                        ],
                        "address": {
                            "use": "home",
                            "type": "both",
                            "line": [
                                "534 Erewhon St"
                            ],
                            "city": "PleasantVille",
                            "district": "Rainbow",
                            "state": "Vic",
                            "postalCode": "3999",
                            "period": {
                                "start": "1974-12-25"
                            }
                        },
                        "gender": "female",
                        "period": {
                            "start": "2012"
                        }
                    }
                ],
                "managingOrganization": {
                    "reference": "Organization/1"
                }
            },
            "search": {
                "extension": [
                    {
                        "url": "http://hl7.org/fhir/StructureDefinition/match-grade",
                        "valueCode": "certain"
                    }
                ],
                "mode": "match",
                "score": 1.0
            }
        }
    ]
}

附录:我发现了这个:

https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/org/hl7/fhir/r4/model/codesystems/MatchGrade.html

标签: hl7-fhirhapi-fhir

解决方案


患者不允许该扩展名。它是使用 Bundle.entry.search 的上下文定义的。这不是患者自身的特征,而是基于一组特定搜索条件的搜索结果中特定条目的特征。相同的 Patient 实例很可能在一次搜索中得到很好的结果,而在不同搜索中得到较差的结果。因此,要添加扩展,您必须将其添加到“搜索”对象上,而不是耐心等待。


推荐阅读