private static Message createADT01Message() throws Exception { ADT_A01 adt = new ADT_A01(); adt.initQuickstart("ADT", "A01", "P"); // Populate the PID Segment PID pid = adt.getPID(); pid.getPatientName(0).getFamilyName().getSurname().setValue("Doe"); pid.getPatientName(0).getGivenName().setValue("John"); pid.getPatientIdentifierList(0).getID().setValue(PATIENT_ID); return adt; }
public Message populateMessage(IHL7OutboundMessageHandler event) throws Exception { LOG.debug("A13VoMapper populateMessage: entry"); ADT_A01 message = new ADT_A01(); EDAttendanceFeedVo edAttendance = null; Patient patient = null; PV1 pv = message.getPV1(); if (event instanceof EDAttendanceFeedVo) { edAttendance = (EDAttendanceFeedVo) event; ifEDAttendanceVo attendenceDetails = adt.getEDAttendanceDetails(edAttendance.getAttendance()); patient = attendenceDetails.getPatient(); // PV1-3 renderPatientLocationToPV1( attendenceDetails.getRegistrationLocation(), null, null, pv, event.getProviderSystem()); // PV1-2 pv.getPatientClass().setValue("E"); // only mandatory item // PV1-10 pv.getHospitalService().setValue("E"); // PV1-19 if (attendenceDetails.getBoId() != null) { pv.getVisitNumber().getID().setValue(attendenceDetails.getBoId().toString()); } // PV1-13 if (attendenceDetails.getAttendanceTypeIsNotNull()) { pv.getReAdmissionIndicator() .setValue( svc.getRemoteLookup( attendenceDetails.getAttendanceType().getID(), event.getProviderSystem().getCodeSystem().getText())); } // PV1-44 EVN-2 if (attendenceDetails.getRegistrationDateTimeIsNotNull()) { renderDateTimeVoToTS(attendenceDetails.getRegistrationDateTime(), pv.getAdmitDateTime()); renderDateTimeVoToTS( attendenceDetails.getRegistrationDateTime(), message.getEVN().getRecordedDateTime()); } // PV1-45 if (attendenceDetails.getDischargeDateTimeIsNotNull()) { renderDateTimeVoToTS(attendenceDetails.getDischargeDateTime(), pv.getDischargeDateTime(0)); } // PV2-3 PV2 pv2 = message.getPV2(); if (attendenceDetails.getEmergencyEpisodeIsNotNull() && attendenceDetails.getEmergencyEpisode().getPresentingComplaintIsNotNull()) { pv2.getAdmitReason() .getIdentifier() .setValue( svc.getRemoteLookup( attendenceDetails.getEmergencyEpisode().getPresentingComplaint().getID(), event.getProviderSystem().getCodeSystem().getText())); } } else // Other event types { } populateMSH( event.getProviderSystem(), message.getMSH(), Long.toString(new java.util.Date().getTime()), "ADT", "A13"); renderPatientVoToPID(patient, message.getPID(), event.getProviderSystem()); NK1 nk1 = message.getNK1(); renderNextOfKinVoToNK1(patient.getNok(), nk1, event.getProviderSystem()); PD1 pd1 = message.getPD1(); renderGPDetailsToPD1(patient, pd1); populateEVN(message.getEVN(), "A13"); return message; }