/** * Build event * * @param CMbObject $object Object * * @see parent::build() * * @return void */ function build($object) { parent::build($object); // Message Header $this->addMSH(); // Event Type $this->addEVN($this->getEVNPlannedDateTime($object), $this->getEVNOccuredDateTime($object)); }
/** * Build event * * @param CMbObject $object Object * * @see parent::build() * * @return void */ function build($object) { parent::build($object); // Message Header $this->addMSH(); // Master File Identification $this->addMFI(); foreach ($object->_objects as $_entity) { // Master File Entry $this->addMFE($_entity); // Location Identification $this->addLOC($_entity); // Location Characteristic foreach (CHL7v2TableEntry::getTable("7878", false) as $_code) { if (!$_code) { continue; } $this->addLCH($_entity, $_code); } // Location Relationship /* $this->addLRL();*/ } }
/** * Build event * * @param CMbObject $object Object * * @see parent::build() * * @return void */ function build($object) { parent::build($object); // Message Header $this->addMSH(); }
/** * Send event * * @param CHL7v2Event $evenement Event type * @param CMbObject $mbObject Object * * @return null|string * * @throws CMbException */ function sendEvent($evenement, CMbObject $mbObject) { $evenement->_receiver = $this; // build_mode = Mode simplifié lors de la génération du message $this->loadConfigValues(); CHL7v2Message::setBuildMode($this->_configs["build_mode"]); $evenement->build($mbObject); CHL7v2Message::resetBuildMode(); if (!($msg = $evenement->flatten())) { return null; } $exchange = $evenement->_exchange_hl7v2; // Si l'échange est invalide if (!$exchange->message_valide) { return null; } // Si on n'est pas en synchrone if (!$this->synchronous) { return null; } // Si on n'a pas d'IPP et NDA if ($exchange->master_idex_missing) { return null; } $evt = $this->getEventMessage($evenement->profil); $source = CExchangeSource::get("{$this->_guid}-{$evt}"); if (!$source->_id || !$source->active) { return null; } if ($this->_configs["encoding"] == "UTF-8") { $msg = utf8_encode($msg); } $source->setData($msg, null, $exchange); try { $source->send(); } catch (Exception $e) { throw new CMbException("CExchangeSource-no-response"); } $exchange->date_echange = CMbDT::dateTime(); $ack_data = $source->getACQ(); if (!$ack_data) { $exchange->store(); return null; } $data_format = CIHE::getEvent($exchange); $ack = new CHL7v2Acknowledgment($data_format); $ack->handle($ack_data); $exchange->date_echange = CMbDT::dateTime(); $exchange->statut_acquittement = $ack->getStatutAcknowledgment(); $exchange->acquittement_valide = $ack->message->isOK(CHL7v2Error::E_ERROR) ? 1 : 0; $exchange->_acquittement = $ack_data; $exchange->store(); return $ack_data; }
/** * Build event * * @param CMbObject $object Object * * @see parent::build() * * @return void */ function build($object) { parent::build($object); $this->addMSH($object); }