use of org.hl7.fhir.r4.model.RelatedPerson in project integration-adaptor-111 by nhsconnect.
the class RelatedPersonMapper method mapRelatedPerson.
public RelatedPerson mapRelatedPerson(POCDMT000002UK01Informant12 informant, Encounter encounter) {
if (!informant.isSetRelatedEntity()) {
return null;
}
POCDMT000002UK01RelatedEntity relatedEntity = informant.getRelatedEntity();
RelatedPerson relatedPerson = new RelatedPerson();
relatedPerson.setIdElement(resourceUtil.newRandomUuid());
relatedPerson.setActive(true).setPatient(encounter.getSubject()).setGender(UNKNOWN);
if (relatedEntity.isSetRelatedPerson()) {
relatedPerson.setName(getHumanNameFromITK(relatedEntity.getRelatedPerson()));
}
if (relatedEntity.sizeOfTelecomArray() > 0) {
relatedPerson.setTelecom(getTelecomFromITK(relatedEntity.getTelecomArray()));
}
if (relatedEntity.sizeOfAddrArray() > 0) {
relatedPerson.setAddress(getAddressesFromITK(relatedEntity.getAddrArray()));
}
if (relatedEntity.isSetEffectiveTime()) {
Period period = new Period();
if (relatedEntity.getEffectiveTime().isSetLow()) {
period.setStartElement(DateUtil.parse(relatedEntity.getEffectiveTime().getLow().getValue()));
}
if (relatedEntity.getEffectiveTime().isSetHigh()) {
period.setEndElement(DateUtil.parse(relatedEntity.getEffectiveTime().getHigh().getValue()));
}
relatedPerson.setPeriod(period);
}
relatedPerson.setPeriod(getPeriod(relatedEntity));
setRelationship(relatedEntity, relatedPerson);
markEmergencyContact(relatedEntity.getTelecomArray(), relatedPerson);
return relatedPerson;
}
use of org.hl7.fhir.r4.model.RelatedPerson in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeRelatedPerson.
protected void composeRelatedPerson(Complex parent, String parentType, String name, RelatedPerson element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "RelatedPerson", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "RelatedPerson", "identifier", element.getIdentifier().get(i), i);
if (element.hasActiveElement())
composeBoolean(t, "RelatedPerson", "active", element.getActiveElement(), -1);
if (element.hasPatient())
composeReference(t, "RelatedPerson", "patient", element.getPatient(), -1);
if (element.hasRelationship())
composeCodeableConcept(t, "RelatedPerson", "relationship", element.getRelationship(), -1);
for (int i = 0; i < element.getName().size(); i++) composeHumanName(t, "RelatedPerson", "name", element.getName().get(i), i);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "RelatedPerson", "telecom", element.getTelecom().get(i), i);
if (element.hasGenderElement())
composeEnum(t, "RelatedPerson", "gender", element.getGenderElement(), -1);
if (element.hasBirthDateElement())
composeDate(t, "RelatedPerson", "birthDate", element.getBirthDateElement(), -1);
for (int i = 0; i < element.getAddress().size(); i++) composeAddress(t, "RelatedPerson", "address", element.getAddress().get(i), i);
for (int i = 0; i < element.getPhoto().size(); i++) composeAttachment(t, "RelatedPerson", "photo", element.getPhoto().get(i), i);
if (element.hasPeriod())
composePeriod(t, "RelatedPerson", "period", element.getPeriod(), -1);
}
use of org.hl7.fhir.r4.model.RelatedPerson in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireBuilder method addTimingQuestions.
private void addTimingQuestions(GroupComponent group, ElementDefinition element, String path, List<QuestionnaireResponse.GroupComponent> answerGroups) throws FHIRException {
ToolingExtensions.addType(group, "Schedule");
addQuestion(group, AnswerFormat.STRING, path, "text", "text:", answerGroups);
addQuestion(group, AnswerFormat.DATETIME, path, "date", "date:", answerGroups);
QuestionComponent q = addQuestion(group, AnswerFormat.REFERENCE, path, "author", "author:", answerGroups);
ToolingExtensions.addReference(q, "/Patient?");
ToolingExtensions.addReference(q, "/Practitioner?");
ToolingExtensions.addReference(q, "/RelatedPerson?");
}
use of org.hl7.fhir.r4.model.RelatedPerson in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeRelatedPerson.
protected void composeRelatedPerson(Complex parent, String parentType, String name, RelatedPerson element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "RelatedPerson", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "RelatedPerson", "identifier", element.getIdentifier().get(i), i);
if (element.hasPatient())
composeReference(t, "RelatedPerson", "patient", element.getPatient(), -1);
if (element.hasRelationship())
composeCodeableConcept(t, "RelatedPerson", "relationship", element.getRelationship(), -1);
if (element.hasName())
composeHumanName(t, "RelatedPerson", "name", element.getName(), -1);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "RelatedPerson", "telecom", element.getTelecom().get(i), i);
if (element.hasGenderElement())
composeEnum(t, "RelatedPerson", "gender", element.getGenderElement(), -1);
if (element.hasBirthDateElement())
composeDate(t, "RelatedPerson", "birthDate", element.getBirthDateElement(), -1);
for (int i = 0; i < element.getAddress().size(); i++) composeAddress(t, "RelatedPerson", "address", element.getAddress().get(i), i);
for (int i = 0; i < element.getPhoto().size(); i++) composeAttachment(t, "RelatedPerson", "photo", element.getPhoto().get(i), i);
if (element.hasPeriod())
composePeriod(t, "RelatedPerson", "period", element.getPeriod(), -1);
}
use of org.hl7.fhir.r4.model.RelatedPerson in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireBuilder method addTimingQuestions.
private void addTimingQuestions(QuestionnaireItemComponent group, ElementDefinition element, String path, List<QuestionnaireResponse.QuestionnaireResponseItemComponent> answerGroups) throws FHIRException {
ToolingExtensions.addFhirType(group, "Schedule");
addQuestion(group, QuestionnaireItemType.STRING, path, "text", "text:", answerGroups);
addQuestion(group, QuestionnaireItemType.DATETIME, path, "date", "date:", answerGroups);
QuestionnaireItemComponent q = addQuestion(group, QuestionnaireItemType.REFERENCE, path, "author", "author:", answerGroups);
ToolingExtensions.addAllowedResource(q, "Patient");
ToolingExtensions.addAllowedResource(q, "Practitioner");
ToolingExtensions.addAllowedResource(q, "RelatedPerson");
}
Aggregations