/**
  * QID - Represents an HL7 Query Identification Segment
  *
  * @param CPatient $patient
  *
  * @return void
  */
 function addQID(CPatient $patient)
 {
     /** @var CHL7v2SegmentQID $QID */
     $QID = CHL7v2Segment::create("QID", $this->message);
     $QID->patient = $patient;
     $QID->build($this);
 }
 /**
  * ERR - Represents an HL7 ERR message segment (Error)
  *
  * @param CHL7Acknowledgment $acknowledgment Acknowledgment
  * @param CHL7v2Error|null   $error          Error HL7
  *
  * @return void
  */
 function addERR(CHL7Acknowledgment $acknowledgment, $error = null)
 {
     $ERR = CHL7v2Segment::create("ERR", $this->message);
     $ERR->acknowledgment = $acknowledgment;
     $ERR->error = $error;
     $ERR->build($this);
 }
 /**
  * Represents an HL7 ZFD message segment (Complément démographique)
  *
  * @param CSejour $sejour Admit
  *
  * @return void
  */
 function addZFD(CSejour $sejour = null)
 {
     /** @var CHL7v2SegmentZFD $ZFD */
     $ZFD = CHL7v2Segment::create("ZFD", $this->message);
     $ZFD->patient = $sejour->_ref_patient;
     $ZFD->build($this);
 }
 /**
  * Represents an HL7 ZDS message segment ()
  *
  * @return void
  */
 function addZDS()
 {
     $ZDS = CHL7v2Segment::create("ZDS", $this->message);
     $ZDS->build($this);
 }
 /**
  * LRL - Represents an HL7 LRL message segment (Location Relationship)
  *
  * @return void
  */
 function addLRL()
 {
     $LRL = CHL7v2Segment::create("LRL", $this->message);
     $LRL->build($this);
 }
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 */
CCanDo::checkRead();
$msg = new CHL7v2Message();
$msg->version = "2.5";
$msg->name = "ADT_A08";
//$msg->fieldSeparator = "a";
//$msg->componentSeparator = "b";
//$msg->subcomponentSeparator = "e";
//$msg->repetitionSeparator = "c";
//$msg->escapeCharacter = "d";
$segment = CHL7v2Segment::create("MSH", $msg);
$data = array(null, null, "Mediboard", "Mediboard_finess", "no_receiver", null, CMbDT::dateTime(), null, null, "Msg ctrl id", "A", null, 15, null, null, null, null, "8859/1", null, null, null);
$segment->fill($data);
$msg->appendChild($segment);
$segment = CHL7v2Segment::create("PID", $msg);
$data = array(0 => 1, 1 => null, 2 => array(0 => array(0 => '323241', 1 => null, 2 => null, 3 => array(0 => 'Mediboard', 1 => '1.2.250.1.2.3.4', 2 => 'OpenXtrem'), 4 => 'RI'), 1 => array(0 => 'fgfg', 1 => null, 2 => null, 3 => array(0 => null, 1 => '1.2.250.1.213.1.4.2', 2 => 'ISO'), 4 => 'INS-C', 5 => null, 6 => '1946-10-17')), 3 => null, 4 => array(0 => array(0 => 'EZZHJ', 1 => 'Rtaso', 2 => 'qldax', 3 => null, 4 => 'dr', 5 => null, 6 => 'D', 7 => 'A'), 1 => array(0 => 'MEBJO', 1 => 'Rtaso', 2 => 'qldax', 3 => null, 4 => 'dr', 5 => null, 6 => 'L', 7 => 'A')), 5 => null, 6 => '1987-09-24', 7 => 'F', 8 => null, 9 => null, 10 => array(0 => array(0 => "adresse test \r\n \\ | & ^ ~", 1 => null, 2 => 'rtckkljfgrw', 3 => null, 4 => '4294967295', 5 => null, 6 => 'H'), 1 => array(0 => null, 1 => null, 2 => 'vlfxif', 3 => null, 4 => '40048', 5 => '000', 6 => 'BR')), 11 => null, 12 => array(0 => array(0 => '43502', 1 => 'PRN', 2 => 'PH'), 1 => array(0 => '42287', 1 => 'ORN', 2 => 'CP'), 2 => array(0 => 'oezym', 1 => 'ORN', 2 => 'PH')), 13 => null, 14 => null, 15 => null, 16 => null, 17 => null, 18 => null, 19 => null, 20 => null, 21 => null, 22 => null, 23 => null, 24 => null, 25 => null, 26 => null, 27 => null, 28 => '1905-05-06', 29 => 'Y');
$segment->fill($data);
$msg->appendChild($segment);
$msg->validate();
foreach ($msg->errors as $error) {
    mbTrace(@$error->entity->getPathString(), CAppUI::tr("CHL7v2Exception-" . $error->code) . " - " . $error->data);
}
echo "Généré";
echo $msg->flatten(true);
$message_str = $msg->flatten();
echo "Parsé";
$msg2 = new CHL7v2Message();
$msg2->parse($message_str);
$msg2->validate();
foreach ($msg2->errors as $error) {
 /**
  * RCP - Represents an HL7 DSC message segment (Continuation Pointer)
  *
  * @param CPatient $patient Patient
  *
  * @return void
  */
 function addDSC($patient)
 {
     $DSC = CHL7v2Segment::create("DSC", $this->message);
     $DSC->patient = $patient;
     $DSC->build($this);
 }
 /**
  * AIL - Represents an HL7 AIL segment (Appointment Information - Location Resource)
  *
  * @param CConsultation $appointment Appointment
  * @param int           $set_id      Set ID
  *
  * @return void
  */
 function addAIL(CConsultation $appointment, $set_id = 1)
 {
     $AIL = CHL7v2Segment::create("AIL", $this->message);
     $AIL->set_id = $set_id;
     $AIL->appointment = $appointment;
     $AIL->build($this);
 }
 /**
  * Represents an HL7 IN2 message segment (Insurance - Additional Information)
  *
  * @param CPatient $patient Patient
  * @param int      $set_id  Set ID
  *
  * @return void
  */
 function addIN2(CPatient $patient, $set_id = 1)
 {
     /** @var CHL7v2SegmentIN2 $IN2 */
     $IN2 = CHL7v2Segment::create("IN2", $this->message);
     $IN2->patient = $patient;
     $IN2->set_id = $set_id;
     $IN2->build($this);
 }
 /**
  * Represents an HL7 PV2 message segment
  *
  * @param CSejour $sejour Admit
  * @param string  $set_id Set ID
  *
  * @return void
  */
 function addPV2(CSejour $sejour, $set_id)
 {
     $PV2 = CHL7v2Segment::create("PV2_RESP", $this->message);
     $PV2->sejour = $sejour;
     $PV2->set_id = $set_id;
     $PV2->build($this);
 }