How can get in Java this structure about FHIR?
{
"resourceType": "Patient",
"name": [
{
"family": "Family1-Family2",
"_family": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/humanname-mothers-family",
"valueString": "Family2"
}
]
}
"given": ["Names"],
}
]
}
I try with
HumanName name = HumanName();
name.setFamilyElement(_family).addExtension(ext);
But this instruction rename mi obeject name.Family to _family and not generate extensión into _family.
I tried with
HumanName name = HumanName();
Extensión ext = new Extensión() ......
......
name.setFamilyElement(_family).addExtension(ext);
But this instruction rename my object name.Family to _family and not generate extensión into _family.
I try with name.addChild(_family)
, but dosent work.
Some idea?
2
Answers
@Lloyd,first of all thanks for your reply.
Then how can get extension is into family and appear that structured?
I have: HumaName name = HumanName(); ..... name.setfamily(firstName) ...... name.addExtension(ext).
When transform to json appear:
First of all appear the extension with url and value secondName
Then appear use,text,given un wrong structured.
Thanks un avance. BEST Regards
In the Java, you don’t need to differentiate ‘family’ and ‘_family’ – those are artifacts of the JSON representation (they don’t show up that way in XML or RDF). In the Java objects, there’s just ‘family’. The _family bit will manifest automatically when you serialize as JSON.