mshSegment.getMessageType().getMessageType().setValue("ADT");
mshSegment.getMessageType().getTriggerEvent().setValue("A01");
mshSegment.getMessageType().getMessageStructure().setValue("ADT A01");
// 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("123456");
/*
* In a real situation, of course, many more segments and fields would be populated
*/