Example #1
0
 static function getInstance(CExchangeHL7v2 $exchange)
 {
     $msg = $exchange->getMessage();
     if (self::isSource($msg->toXML()->getMSHEvenementXML())) {
         $object = new CSyslogQ22Consumer();
     } else {
         $object = new CSyslogQ22Supplier();
     }
     $object->setExchange($exchange);
     return $object;
 }
Example #2
0
 static function getInstance(CExchangeHL7v2 $exchange)
 {
     $msg = $exchange->getMessage();
     if (self::isSource($msg->toXML()->getMSHEvenementXML())) {
         $object = new CSyslogProvideAndRegisterDocumentSetResponse();
     } else {
         // Not implemented yet
         return false;
     }
     $object->setExchange($exchange);
     return $object;
 }
<?php

/* $Id $ */
/**
 * @package Mediboard
 * @subpackage hl7
 * @version $Revision: 15199 $
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 */
$er7 = CValue::post("er7");
$exchange_id = CValue::post("exchange_id");
$exchange = new CExchangeHL7v2();
$exchange->load($exchange_id);
$exchange->loadRefsInteropActor();
if ($exchange->receiver_id) {
    /** @var CInteropReceiver $actor */
    $actor = $exchange->_ref_receiver;
    $actor->loadConfigValues();
} else {
    /** @var CInteropSender $actor */
    $actor = $exchange->_ref_sender;
    $actor->getConfigs($exchange);
}
$hl7_message = new CHL7v2Message();
$hl7_message->parse($er7);
/** @var CHL7v2MessageXML $xml */
$xml = $hl7_message->toXML(null, false);
$MSH = $xml->queryNode("MSH");
$EVN = $xml->queryNode("EVN");
$PID = $xml->queryNode("PID");
Example #4
0
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$do_purge = CValue::get("do_purge");
$date_max = CValue::get("date_max");
$months = CValue::get("months", 1);
$max = CValue::get("max", 1000);
// Use months syntax
if ($months) {
    $date_max = CMbDT::date("- {$months} MONTHS");
}
// Check params
if (!$date_max) {
    CAppUI::stepAjax("Merci d'indiquer une date fin de recherche.", UI_MSG_ERROR);
}
$exchange_hl7v2 = new CExchangeHL7v2();
// Dry run
if (!$do_purge) {
    $where = array();
    $where["exchange_hl7v2.date_production"] = "< '{$date_max}'";
    $where["exchange_hl7v2.message_content_id"] = "IS NOT NULL";
    $where["exchange_hl7v2.acquittement_content_id"] = "IS NOT NULL";
    $count = $exchange_hl7v2->countList($where);
    CAppUI::stepAjax("CExchangeHL7v2-msg-purge_count", UI_MSG_OK, $count);
    return;
}
// Filtre sur les enregistrements
$content_tabular = new CContentTabular();
$count = 0;
$count += deleteContentAndUpdateExchange($content_tabular, "message_content_id", $date_max, $max);
$count += deleteContentAndUpdateExchange($content_tabular, "acquittement_content_id", $date_max, $max);
Example #5
0
 private function parseRawVersion($raw, $country_code = null)
 {
     $parts = explode($this->componentSeparator, $raw);
     CMbArray::removeValue("", $parts);
     $this->version = $version = $parts[0];
     $actor = $this->actor;
     $configs = new CHL7Config();
     if ($actor instanceof CInteropSender) {
         $exchange_hl7v2 = new CExchangeHL7v2();
         $configs = $exchange_hl7v2->getConfigs($actor->_guid);
     }
     // On privilégie le code du pays sur l'acteur d'intégration
     $country_code = $configs->country_code ? $configs->country_code : $country_code;
     // Recherche depuis le code du pays
     switch ($country_code) {
         case "FRA":
         case "FR":
             $this->i18n_code = "FR";
             $this->extension = $version = "FR_2.3";
             break;
         default:
     }
     // Version spécifique française spécifiée
     if (!$country_code && count($parts) > 1) {
         $this->i18n_code = $parts[1];
         $this->extension = $version = "{$parts['1']}_{$parts['2']}";
     }
     // Dans le cas où la version passée est incorrecte on met par défaut 2.5
     if (!in_array($version, self::$versions)) {
         $this->version = CAppUI::conf("hl7 default_version");
     }
 }
 /**
  * Event
  *
  * @param CExchangeDataFormat $data_format Data format
  *
  * @return null|string
  */
 function event(CExchangeDataFormat $data_format)
 {
     $msg = $data_format->_message;
     /** @var CHL7v2Event $evt */
     $evt = $data_format->_family_message;
     $evt->_data_format = $data_format;
     // Récupération des informations du message
     /** @var CHL7v2MessageXML $dom_evt */
     $dom_evt = $evt->handle($msg);
     $dom_evt->_is_i18n = $evt->_is_i18n;
     try {
         // Création de l'échange
         $exchange_hl7v2 = new CExchangeHL7v2();
         $exchange_hl7v2->load($data_format->_exchange_id);
         // Récupération des données du segment MSH
         $data = $dom_evt->getMSHEvenementXML();
         // Gestion de l'acquittement
         $ack = $dom_evt->getEventACK($evt);
         $ack->message_control_id = $data['identifiantMessage'];
         // Message non supporté pour cet utilisateur
         $evt_class = CHL7Event::getEventClass($evt);
         if (!in_array($evt_class, $data_format->_messages_supported_class)) {
             $data_format->_ref_sender->_delete_file = false;
             // Pas de création d'échange dans le cas :
             // * où l'on ne souhaite pas traiter le message
             // * où le sender n'enregistre pas les messages non pris en charge
             if (!$data_format->_to_treatment || !$data_format->_ref_sender->save_unsupported_message) {
                 return;
             }
             $exchange_hl7v2->populateExchange($data_format, $evt);
             $exchange_hl7v2->loadRefsInteropActor();
             $exchange_hl7v2->populateErrorExchange(null, $evt);
             $ack->_ref_exchange_hl7v2 = $exchange_hl7v2;
             $msgAck = $ack->generateAcknowledgment("AR", "E001", "201");
             $exchange_hl7v2->populateErrorExchange($ack);
             return $msgAck;
         }
         $sender = $data_format->_ref_sender;
         $sender->getConfigs($data_format);
         // Acquittement d'erreur d'un document XML recu non valide
         if (!$sender->_configs["bypass_validating"] && !$evt->message->isOK(CHL7v2Error::E_ERROR)) {
             $exchange_hl7v2->populateExchange($data_format, $evt);
             $exchange_hl7v2->loadRefsInteropActor();
             $exchange_hl7v2->populateErrorExchange(null, $evt);
             $ack->_ref_exchange_hl7v2 = $exchange_hl7v2;
             $msgAck = $ack->generateAcknowledgment("AR", "E002", "207");
             $exchange_hl7v2->populateErrorExchange($ack);
             return $msgAck;
         }
         $exchange_hl7v2->populateExchange($data_format, $evt);
         $exchange_hl7v2->message_valide = 1;
         // Gestion des notifications ?
         if (!$exchange_hl7v2->_id) {
             $exchange_hl7v2->date_production = CMbDT::dateTime();
             $exchange_hl7v2->identifiant_emetteur = $data['identifiantMessage'];
         }
         $exchange_hl7v2->store();
         // Pas de traitement du message
         if (!$data_format->_to_treatment) {
             return;
         }
         $exchange_hl7v2->loadRefsInteropActor();
         // Chargement des configs de l'expéditeur
         $sender = $exchange_hl7v2->_ref_sender;
         $sender->getConfigs($data_format);
         if (!$dom_evt->checkApplicationAndFacility($data, $sender)) {
             return;
         }
         if (!empty($sender->_configs["handle_mode"])) {
             CHL7v2Message::setHandleMode($sender->_configs["handle_mode"]);
         }
         $dom_evt->_ref_exchange_hl7v2 = $exchange_hl7v2;
         $ack->_ref_exchange_hl7v2 = $exchange_hl7v2;
         // Message PAM / DEC / PDQ / SWF
         $msgAck = self::handleEvent($exchange_hl7v2, $dom_evt, $ack, $data);
         CHL7v2Message::resetBuildMode();
     } catch (Exception $e) {
         $exchange_hl7v2->populateExchange($data_format, $evt);
         $exchange_hl7v2->loadRefsInteropActor();
         $exchange_hl7v2->populateErrorExchange(null, $evt);
         $ack = new CHL7v2Acknowledgment($evt);
         $ack->message_control_id = isset($data['identifiantMessage']) ? $data['identifiantMessage'] : "000000000";
         $ack->_ref_exchange_hl7v2 = $exchange_hl7v2;
         $msgAck = $ack->generateAcknowledgment("AR", "E003", "207", "E", $e->getMessage());
         $exchange_hl7v2->populateErrorExchange($ack);
         CHL7v2Message::resetBuildMode();
     }
     return $msgAck;
 }
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$receiver_guid = CValue::get("receiver_guid");
$exclude_event = CValue::get("exclude_event");
$include_event = CValue::get("include_event");
/** @var CReceiverHL7v2 $receiver */
$receiver = CMbObject::loadFromGuid($receiver_guid);
if (!$receiver && !$receiver->_id && !$receiver->actif) {
    return;
}
$receiver->loadConfigValues();
$where = '';
$echange_hl7v2 = new CExchangeHL7v2();
$ds = $echange_hl7v2->getDS();
$where['statut_acquittement'] = "IS NULL";
$where['sender_id'] = "IS NULL";
$where['receiver_id'] = "= '{$receiver->_id}'";
$where['message_valide'] = "= '1'";
$where['date_echange'] = "IS NULL";
$where['date_production'] = "BETWEEN '" . CMbDT::dateTime("-3 DAYS") . "' AND '" . CMbDT::dateTime("+1 DAYS") . "'";
if ($exclude_event) {
    $exclude_event = explode("|", $exclude_event);
    $where['code'] = $ds->prepareNotIn($exclude_event);
}
if ($include_event) {
    $include_event = explode("|", $include_event);
    $where['code'] = $ds->prepareIn($include_event);
}