use of org.hl7.fhir.dstu2.model.ContactPoint in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method createContact.
// patientDetailsToMinimalPatient
/**
* add a set of contact details into the patient record NB these are
* Contacts (related people etc) not contactpoints (telecoms)
*
* @param patient fhirResource object
*/
private void createContact(Patient patient) {
// relationships
Patient.ContactComponent contact = new ContactComponent();
for (String relationship : new String[] { "Emergency contact", "Next of kin", "Daughter" }) {
CodeableConcept crelationship = new CodeableConcept();
crelationship.setText(relationship);
contact.addRelationship(crelationship);
}
// contact address
Address address = new Address();
address.addLine("Trevelyan Square");
address.addLine("Boar Ln");
address.setPostalCode("LS1 6AE");
address.setType(AddressType.PHYSICAL);
address.setUse(AddressUse.HOME);
contact.setAddress(address);
// gender
contact.setGender(AdministrativeGender.FEMALE);
// telecom
ContactPoint telecom = new ContactPoint();
telecom.setSystem(ContactPointSystem.PHONE);
telecom.setUse(ContactPointUse.MOBILE);
telecom.setValue("07777123123");
contact.addTelecom(telecom);
// Name
HumanName name = new HumanName();
name.addGiven("Jane");
name.setFamily("Jackson");
List<StringType> prefixList = new ArrayList<>();
prefixList.add(new StringType("Miss"));
name.setPrefix(prefixList);
name.setText("JACKSON Jane (Miss)");
name.setUse(NameUse.OFFICIAL);
contact.setName(name);
patient.addContact(contact);
}
use of org.hl7.fhir.dstu2.model.ContactPoint in project dpc-app by CMSgov.
the class ContactPointConverter method toFHIR.
@Override
public ContactPoint toFHIR(FHIREntityConverter converter, ContactPointEntity entity) {
final ContactPoint cp = new ContactPoint();
cp.setSystem(entity.getSystem());
cp.setUse(entity.getUse());
cp.setValue(entity.getValue());
if (entity.getRank() != null) {
cp.setRank(entity.getRank());
}
return cp;
}
use of org.hl7.fhir.dstu2.model.ContactPoint in project dpc-app by CMSgov.
the class ContactPointEntity method toFHIR.
public ContactPoint toFHIR() {
final ContactPoint cp = new ContactPoint();
cp.setSystem(this.system);
cp.setUse(this.use);
cp.setValue(this.value);
if (this.rank != null) {
cp.setRank(this.rank);
}
return cp;
}
use of org.hl7.fhir.dstu2.model.ContactPoint in project MobileAccessGateway by i4mi.
the class Iti93AddRequestConverter method doCreate.
/**
* add a new patient
* @param header
* @param entriesByReference
* @return
* @throws JAXBException
*/
public String doCreate(MessageHeader header, Map<String, BundleEntryComponent> entriesByReference) throws JAXBException {
PRPAIN201301UV02Type resultMsg = new PRPAIN201301UV02Type();
resultMsg.setITSVersion("XML_1.0");
// String UUID.randomUUID().toString();
resultMsg.setId(new II(config.getPixQueryOid(), uniqueId()));
// Now
resultMsg.setCreationTime(new TS(Timestamp.now().toHL7()));
resultMsg.setProcessingCode(new CS("T", null, null));
resultMsg.setProcessingModeCode(new CS("T", null, null));
resultMsg.setInteractionId(new II("2.16.840.1.113883.1.18", "PRPA_IN201301UV02"));
resultMsg.setAcceptAckCode(new CS("AL", null, null));
MCCIMT000100UV01Receiver receiver = new MCCIMT000100UV01Receiver();
resultMsg.addReceiver(receiver);
receiver.setTypeCode(CommunicationFunctionType.RCV);
MCCIMT000100UV01Device receiverDevice = new MCCIMT000100UV01Device();
receiver.setDevice(receiverDevice);
receiverDevice.setClassCode(EntityClassDevice.DEV);
receiverDevice.setDeterminerCode(EntityDeterminer.INSTANCE);
receiverDevice.setId(Collections.singletonList(new II(config.getPixReceiverOid(), null)));
MCCIMT000100UV01Sender sender = new MCCIMT000100UV01Sender();
resultMsg.setSender(sender);
sender.setTypeCode(CommunicationFunctionType.SND);
MCCIMT000100UV01Device senderDevice = new MCCIMT000100UV01Device();
sender.setDevice(senderDevice);
senderDevice.setClassCode(EntityClassDevice.DEV);
senderDevice.setDeterminerCode(EntityDeterminer.INSTANCE);
senderDevice.setId(Collections.singletonList(new II(config.getPixMySenderOid(), null)));
PRPAIN201301UV02MFMIMT700701UV01ControlActProcess controlActProcess = new PRPAIN201301UV02MFMIMT700701UV01ControlActProcess();
resultMsg.setControlActProcess(controlActProcess);
controlActProcess.setClassCode(ActClassControlAct.CACT);
controlActProcess.setMoodCode(XActMoodIntentEvent.EVN);
controlActProcess.setCode(new CD("PRPA_TE201301UV02", null, "2.16.840.1.113883.1.18"));
for (BundleEntryComponent entry : entriesByReference.values()) {
if (entry.getResource() instanceof Patient) {
HTTPVerb method = entry.getRequest().getMethod();
if (method == null)
throw new InvalidRequestException("HTTP verb missing in Bundle for Patient resource.");
Patient in = (Patient) entry.getResource();
PRPAIN201301UV02MFMIMT700701UV01Subject1 subject = new PRPAIN201301UV02MFMIMT700701UV01Subject1();
controlActProcess.addSubject(subject);
subject.setTypeCode("SUBJ");
// ???
subject.setContextConductionInd(false);
PRPAIN201301UV02MFMIMT700701UV01RegistrationEvent registrationEvent = new PRPAIN201301UV02MFMIMT700701UV01RegistrationEvent();
subject.setRegistrationEvent(registrationEvent);
registrationEvent.setClassCode(ActClass.REG);
registrationEvent.setMoodCode(ActMood.EVN);
// ???
registrationEvent.setStatusCode(new CS("active", null, null));
PRPAIN201301UV02MFMIMT700701UV01Subject2 subject1 = new PRPAIN201301UV02MFMIMT700701UV01Subject2();
registrationEvent.setSubject1(subject1);
subject1.setTypeCode(ParticipationTargetSubject.SBJ);
PRPAMT201301UV02Patient patient = new PRPAMT201301UV02Patient();
subject1.setPatient(patient);
patient.setClassCode("PAT");
// ???
patient.setStatusCode(new CS("active", null, null));
PRPAMT201301UV02Person patientPerson = new PRPAMT201301UV02Person();
patient.setPatientPerson(patientPerson);
patientPerson.setClassCode(EntityClass.PSN);
patientPerson.setDeterminerCode(EntityDeterminer.INSTANCE);
// TODO How is the correct mapping done?
for (Identifier id : in.getIdentifier()) {
patient.addId(patientIdentifier(id));
}
for (HumanName name : in.getName()) {
patientPerson.addName(transform(name));
}
patientPerson.setBirthTime(transform(in.getBirthDateElement()));
if (in.hasGender()) {
switch(in.getGender()) {
case MALE:
patientPerson.setAdministrativeGenderCode(new CE("M", "Male", "2.16.840.1.113883.12.1"));
break;
case FEMALE:
patientPerson.setAdministrativeGenderCode(new CE("F", "Female", "2.16.840.1.113883.12.1"));
break;
case OTHER:
patientPerson.setAdministrativeGenderCode(new CE("A", "Ambiguous", "2.16.840.1.113883.12.1"));
break;
case UNKNOWN:
patientPerson.setAdministrativeGenderCode(new CE("U", "Unknown", "2.16.840.1.113883.12.1"));
break;
}
}
if (in.hasAddress())
patientPerson.setAddr(new ArrayList<AD>());
for (Address address : in.getAddress()) {
patientPerson.addAddr(transform(address));
}
for (ContactPoint contactPoint : in.getTelecom()) {
patientPerson.addTelecom(transform(contactPoint));
}
List<II> orgIds = new ArrayList<II>();
Organization managingOrg = getManagingOrganization(in);
// NULL POINTER CHECK
for (Identifier id : managingOrg.getIdentifier()) {
orgIds.add(new II(getScheme(id.getSystem()), null));
}
if (in.hasDeceasedBooleanType()) {
patientPerson.setDeceasedInd(new BL(in.getDeceasedBooleanType().getValue()));
}
if (in.hasDeceasedDateTimeType()) {
patientPerson.setDeceasedTime(transform(in.getDeceasedDateTimeType()));
}
if (in.hasMultipleBirthBooleanType()) {
patientPerson.setMultipleBirthInd(new BL(in.getMultipleBirthBooleanType().getValue()));
}
if (in.hasMultipleBirthIntegerType()) {
patientPerson.setMultipleBirthOrderNumber(new INT(in.getMultipleBirthIntegerType().getValue()));
}
if (in.hasMaritalStatus()) {
patientPerson.setMaritalStatusCode(transform(in.getMaritalStatus()));
}
if (in.hasCommunication()) {
for (PatientCommunicationComponent pcc : in.getCommunication()) {
PRPAMT201301UV02LanguageCommunication languageCommunication = new PRPAMT201301UV02LanguageCommunication();
languageCommunication.setLanguageCode(transform(pcc.getLanguage()));
// NULL POINTER EXCEPTION
if (pcc.hasPreferred())
languageCommunication.setPreferenceInd(new BL(pcc.getPreferred()));
patientPerson.addLanguageCommunication(languageCommunication);
}
}
COCTMT150003UV03Organization providerOrganization = new COCTMT150003UV03Organization();
patient.setProviderOrganization(providerOrganization);
providerOrganization.setClassCode(EntityClassOrganization.ORG);
providerOrganization.setDeterminerCode(EntityDeterminer.INSTANCE);
providerOrganization.setId(orgIds);
ON name = null;
if (managingOrg.hasName()) {
name = new ON();
name.setMixed(Collections.singletonList(managingOrg.getName()));
providerOrganization.setName(Collections.singletonList(name));
}
COCTMT150003UV03ContactParty contactParty = new COCTMT150003UV03ContactParty();
contactParty.setClassCode(RoleClassContact.CON);
for (ContactPoint contactPoint : managingOrg.getTelecom()) {
contactParty.addTelecom(transform(contactPoint));
}
if (managingOrg.hasAddress())
contactParty.setAddr(new ArrayList<AD>());
for (Address address : managingOrg.getAddress()) {
contactParty.addAddr(transform(address));
}
if (managingOrg.hasContact()) {
OrganizationContactComponent occ = managingOrg.getContactFirstRep();
COCTMT150003UV03Person contactPerson = new COCTMT150003UV03Person();
contactPerson.setClassCode(EntityClass.PSN);
contactPerson.setDeterminerCode(EntityDeterminer.INSTANCE);
if (occ.hasName())
contactPerson.setName(Collections.singletonList(transform(occ.getName())));
contactParty.setContactPerson(contactPerson);
}
providerOrganization.setContactParty(Collections.singletonList(contactParty));
MFMIMT700701UV01Custodian custodian = new MFMIMT700701UV01Custodian();
registrationEvent.setCustodian(custodian);
custodian.setTypeCode(ParticipationType.CST);
COCTMT090003UV01AssignedEntity assignedEntity = new COCTMT090003UV01AssignedEntity();
custodian.setAssignedEntity(assignedEntity);
assignedEntity.setClassCode(RoleClassAssignedEntity.ASSIGNED);
List<II> custIds = new ArrayList<II>();
custIds.add(new II(getScheme(config.getCustodianOid()), null));
assignedEntity.setId(custIds);
// assignedEntity.setId(orgIds);
COCTMT090003UV01Organization assignedOrganization = new COCTMT090003UV01Organization();
assignedEntity.setAssignedOrganization(assignedOrganization);
assignedOrganization.setClassCode(EntityClassOrganization.ORG);
assignedOrganization.setDeterminerCode(EntityDeterminer.INSTANCE);
if (managingOrg.hasName()) {
assignedOrganization.setName(Collections.singletonList(name));
}
}
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
HL7V3Transformer.marshallMessage(PRPAIN201301UV02Type.class, out, resultMsg);
String outArray = new String(out.toByteArray());
return outArray;
}
use of org.hl7.fhir.dstu2.model.ContactPoint in project MobileAccessGateway by i4mi.
the class Iti66ResponseConverter method translateToFhir.
/**
* convert ITI-18 query response to ITI-66 response bundle
*/
@Override
public List<ListResource> translateToFhir(QueryResponse input, Map<String, Object> parameters) {
ArrayList<ListResource> list = new ArrayList<ListResource>();
if (input != null && Status.SUCCESS.equals(input.getStatus())) {
Map<String, ListResource> targetList = new HashMap<String, ListResource>();
if (input.getSubmissionSets() != null) {
for (SubmissionSet submissionSet : input.getSubmissionSets()) {
ListResource documentManifest = new ListResource();
documentManifest.setId(noUuidPrefix(submissionSet.getEntryUuid()));
documentManifest.setCode(new CodeableConcept(new Coding("http://profiles.ihe.net/ITI/MHD/CodeSystem/MHDlistTypes", "submissionset", "Submission Set")));
targetList.put(documentManifest.getId(), documentManifest);
list.add(documentManifest);
// limitedMetadata -> meta.profile canonical [0..*]
if (submissionSet.isLimitedMetadata()) {
documentManifest.getMeta().addProfile("http://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Minimal.SubmissionSet");
} else {
documentManifest.getMeta().addProfile("http://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Comprehensive.SubmissionSet");
}
// comment -> text Narrative [0..1]
LocalizedString comments = submissionSet.getComments();
if (comments != null) {
documentManifest.addNote().setText(comments.getValue());
}
// uniqueId -> masterIdentifier Identifier [0..1] [1..1]
if (submissionSet.getUniqueId() != null) {
documentManifest.addIdentifier((new Identifier().setUse(IdentifierUse.USUAL).setSystem("urn:ietf:rfc:3986").setValue("urn:oid:" + submissionSet.getUniqueId())));
}
// entryUUID -> identifier Identifier [0..*]
if (submissionSet.getEntryUuid() != null) {
documentManifest.addIdentifier((new Identifier().setUse(IdentifierUse.OFFICIAL).setSystem("urn:ietf:rfc:3986").setValue(asUuid(submissionSet.getEntryUuid()))));
}
// approved -> status=current Other status values are allowed but are not defined in this mapping to XDS.
if (AvailabilityStatus.APPROVED.equals(submissionSet.getAvailabilityStatus())) {
documentManifest.setStatus(ListResource.ListStatus.CURRENT);
}
documentManifest.setMode(ListMode.WORKING);
// contentTypeCode -> type CodeableConcept [0..1]
if (submissionSet.getContentTypeCode() != null) {
documentManifest.addExtension().setUrl("http://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-designationType").setValue(transform(submissionSet.getContentTypeCode()));
}
// patientId -> subject Reference(Patient| Practitioner| Group| Device) [0..1], Reference(Patient)
if (submissionSet.getPatientId() != null) {
Identifiable patient = submissionSet.getPatientId();
documentManifest.setSubject(transformPatient(patient));
}
// submissionTime -> created dateTime [0..1]
if (submissionSet.getSubmissionTime() != null) {
documentManifest.setDate(Date.from(submissionSet.getSubmissionTime().getDateTime().toInstant()));
}
// authorInstitution, authorPerson, authorRole, authorSpeciality, authorTelecommunication -> author Reference(Practitioner| PractitionerRole| Organization| Device| Patient| RelatedPerson) [0..*]
if (submissionSet.getAuthors() != null) {
for (Author author : submissionSet.getAuthors()) {
documentManifest.setSource(transformAuthor(author));
}
}
// intendedRecipient -> recipient Reference(Patient| Practitioner| PractitionerRole| RelatedPerson| Organization) [0..*]
List<Recipient> recipients = submissionSet.getIntendedRecipients();
for (Recipient recipient : recipients) {
Organization org = recipient.getOrganization();
Person person = recipient.getPerson();
ContactPoint contact = transform(recipient.getTelecom());
var organization = transform(org);
Practitioner practitioner = transformPractitioner(person);
if (organization != null && practitioner == null) {
if (contact != null)
organization.addTelecom(contact);
documentManifest.addExtension().setUrl("http://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-intendedRecipient").setValue(new Reference().setResource(organization));
} else if (organization != null && practitioner != null) {
PractitionerRole role = new PractitionerRole();
role.setPractitioner((Reference) new Reference().setResource(practitioner));
role.setOrganization((Reference) new Reference().setResource(organization));
if (contact != null)
role.addTelecom(contact);
documentManifest.addExtension().setUrl("http://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-intendedRecipient").setValue(new Reference().setResource(role));
} else if (organization == null && practitioner != null) {
// May be a patient, related person or practitioner
}
}
// sourceId -> source uri [0..1] [1..1]
if (submissionSet.getSourceId() != null) {
documentManifest.addExtension().setUrl("http://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-sourceId").setValue(new Identifier().setValue("urn:oid:" + submissionSet.getSourceId()));
}
// title -> description string [0..1]
LocalizedString title = submissionSet.getTitle();
if (title != null) {
documentManifest.setTitle(title.getValue());
}
}
}
if (input.getAssociations() != null) {
for (Association ass : input.getAssociations()) {
AssociationType tt = ass.getAssociationType();
String source = ass.getSourceUuid();
String target = ass.getTargetUuid();
if (tt == AssociationType.HAS_MEMBER) {
ListResource s = targetList.get(noUuidPrefix(source));
if (s != null) {
s.addEntry().setItem(new Reference().setReference("DocumentReference/" + noUuidPrefix(target)));
}
}
}
}
} else {
processError(input);
}
return list;
}
Aggregations