/** * @see parent::updatePlainFields() */ function updatePlainFields() { parent::updatePlainFields(); if ($this->_message !== null) { /** @var CContentTabular $content */ $content = $this->loadFwdRef("message_content_id", true); $content->content = $this->_message; if ($msg = $content->store()) { return; } if (!$this->message_content_id) { $this->message_content_id = $content->_id; } } if ($this->_acquittement !== null) { /** @var CContentTabular $content */ $content = $this->loadFwdRef("acquittement_content_id", true); $content->content = $this->_acquittement; if ($msg = $content->store()) { return; } if (!$this->acquittement_content_id) { $this->acquittement_content_id = $content->_id; } } }
/** * @see parent::getProps() */ function getProps() { $props = parent::getProps(); $props["message_content_id"] = "ref class|CContentAny show|0 cascade"; $props["acquittement_content_id"] = "ref class|CContentAny show|0 cascade"; $props["receiver_id"] = "ref class|CInteropReceiver"; $props["object_class"] = "enum list|CPatient|CSejour show|0"; $props["_message"] = "str"; $props["_acquittement"] = "str"; return $props; }
/** * Count the exchanges for the all sejours * * @param CMbObject[] $objects CMbObject * @param String $type Type * @param String $subtype Sous type * * @return void */ static function massCountExchanges($objects, $type = null, $subtype = null) { if (!count($objects)) { return null; } $object = current($objects); $object_ids = CMbArray::pluck($objects, $object->_spec->key); $object_ids = array_unique($object_ids); CMbArray::removeValue("", $object_ids); if (!count($object_ids)) { return null; } $where = array("object_id" => CSQLDataSource::prepareIn($object_ids), "object_class" => "= '{$object->_class}'"); if ($type) { $where["type"] = "= '{$type}'"; } if ($subtype) { $where["sous_type"] = "= '{$subtype}'"; } $count_exchanges = array(); foreach (CExchangeDataFormat::getAll() as $_data_format) { /** @var CExchangeDataFormat $data_format */ $data_format = new $_data_format(); if (!$data_format->hasTable()) { continue; } $table_exchange = $data_format->_spec->table; $count_exchanges[$table_exchange] = $data_format->countMultipleList($where, null, "object_id", null, array("object_id")); } foreach ($count_exchanges as $_exchange => $_counts) { foreach ($_counts as $_value) { $total = $_value["total"]; $object_id = $_value["object_id"]; if (!isset($objects[$object_id]->_nb_exchanges_by_format[$_exchange])) { $objects[$object_id]->_nb_exchanges_by_format[$_exchange] = 0; } $objects[$object_id]->_nb_exchanges_by_format[$_exchange] += $total; $objects[$object_id]->_nb_exchanges += $total; } } }
* @category EAI * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $count = CValue::getOrSession("count", 30); $date_production = CValue::getOrSession("date_production", CMbDT::date()); $group_id = CValue::getOrSession("group_id", CGroups::loadCurrent()->_id); $filter = new CExchangeDataFormat(); $filter->date_production = $date_production; $filter->group_id = $group_id; $exchanges_classes = array(); foreach (CExchangeDataFormat::getAll() as $key => $_exchange_class) { foreach (CApp::getChildClasses($_exchange_class, true) as $_child_key => $_child_class) { $exchanges_classes[$_exchange_class][] = $_child_class; } if ($_exchange_class == "CExchangeAny") { $exchanges_classes[$_exchange_class][] = $_exchange_class; } } $criteres = array('no_date_echange', 'emetteur', 'destinataire', 'message_invalide', 'acquittement_invalide'); $smarty = new CSmartyDP(); $smarty->assign("count", $count); $smarty->assign("date_production", $date_production); $smarty->assign("filter", $filter); $smarty->assign("exchanges_classes", $exchanges_classes); $smarty->assign("criteres", $criteres); $smarty->display("vw_stats.tpl");
if ($actor instanceof CInteropSender) { $formats_xml = CExchangeDataFormat::getAll("CEchangeXML"); foreach ($formats_xml as &$_format_xml) { /** @var CEchangeXML $_format_xml */ $_format_xml = new $_format_xml(); $temp = $_format_xml->getMessagesSupported($actor_guid, false, null, true); $messages_xml = array_merge($messages_xml, $temp); } $formats_tabular = CExchangeDataFormat::getAll("CExchangeTabular"); foreach ($formats_tabular as &$_format_tabular) { /** @var CExchangeTabular $_format_tabular */ $_format_tabular = new $_format_tabular(); $temp = $_format_tabular->getMessagesSupported($actor_guid, false, null, true); $messages_tabular = array_merge($messages_tabular, $temp); } $formats_binary = CExchangeDataFormat::getAll("CExchangeBinary"); foreach ($formats_binary as &$_format_binary) { /** @var CExchangeBinary $_format_binary */ $_format_binary = new $_format_binary(); $temp = $_format_binary->getMessagesSupported($actor_guid, false, null, true); $messages_binary = array_merge($messages_binary, $temp); } } else { if ($actor instanceof CInteropReceiver) { $exchanges = $actor->makeBackSpec("echanges"); $actor->_backSpecs["echanges"]; $data_format = new $exchanges->class(); if ($data_format instanceof CExchangeTabular) { $formats_tabular[] = $data_format; $temp = $data_format->getMessagesSupported($actor_guid, false, null, true); $messages_tabular = array_merge($messages_tabular, $temp);
* @category EAI * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ CCanDo::checkRead(); $actor_guid = CValue::getOrSession("actor_guid"); $formats_xml = CExchangeDataFormat::getAll("CEchangeXML"); foreach ($formats_xml as &$_format_xml) { $_format_xml = new $_format_xml(); $_format_xml->getConfigs($actor_guid); } $formats_tabular = CExchangeDataFormat::getAll("CExchangeTabular"); foreach ($formats_tabular as &$_format_tabular) { $_format_tabular = new $_format_tabular(); $_format_tabular->getConfigs($actor_guid); } $formats_binary = CExchangeDataFormat::getAll('CExchangeBinary'); foreach ($formats_binary as &$_format_binary) { $_format_binary = new $_format_binary(); $_format_binary->getConfigs($actor_guid); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("actor_guid", $actor_guid); $smarty->assign("formats_xml", $formats_xml); $smarty->assign("formats_tabular", $formats_tabular); $smarty->assign('formats_binary', $formats_binary); $smarty->display("inc_configs_formats.tpl");
/** * Get messages supported by family * * @return array */ function getMessagesSupportedByFamily() { $family = array(); foreach (CExchangeDataFormat::getAll() as $_data_format_class) { $_data_format = new $_data_format_class(); $temp = $_data_format->getFamily(); $family = array_merge($family, $temp); } if (empty($family)) { return $this->_ref_msg_supported_family; } $supported = $this->loadRefsMessagesSupported(); foreach ($family as $_family => $_root_class) { $root = new $_root_class(); foreach ($root->getEvenements() as $_evt => $_evt_class) { foreach ($supported as $_msg_supported) { if (!$_msg_supported->active) { continue; } if ($_msg_supported->message != $_evt_class) { continue; } $messages = $this->_spec->messages; if (isset($messages[$root->type])) { $this->_ref_msg_supported_family = array_merge($this->_ref_msg_supported_family, $messages[$root->type]); continue 3; } } } } return $this->_ref_msg_supported_family; }
/** * Get configs * * @param CExchangeDataFormat $data_format Exchange * * @return void */ function getConfigs(CExchangeDataFormat $data_format) { $data_format->getConfigs($this->_guid); $format_config = $data_format->_configs_format; if (!isset($format_config->_id)) { return; } foreach ($format_config->getConfigFields() as $_config_field) { $this->_configs[$_config_field] = $format_config->{$_config_field}; } }
/** * Event dispatch * * @param CExchangeDataFormat $data_format Exchange data format * * @throws CMbException * * @return string Acquittement */ function event(CExchangeDataFormat $data_format) { $msg = $data_format->_message; /** @var CHPrimXML $evt */ $evt = $data_format->_family_message; $evt->_data_format = $data_format; /** @var CHPrimXMLEvenements $dom_evt */ $dom_evt = $evt->getHPrimXMLEvenements($msg); $dom_evt_class = get_class($dom_evt); if (!in_array($dom_evt_class, $data_format->_messages_supported_class)) { throw new CMbException(CAppUI::tr("CEAIDispatcher-no_message_supported_for_this_actor", $dom_evt_class)); } // Récupération du noeud racine $root = $dom_evt->documentElement; $nodeName = $root->nodeName; // Création de l'échange $echg_hprim = new CEchangeHprim(); $data_format->loadRefsInteropActor(); $data_format->_ref_sender->getConfigs($data_format); $dom_evt->_ref_sender = $data_format->_ref_sender; try { // Récupération des données de l'entête $data = $dom_evt->getEnteteEvenementXML($nodeName); $echg_hprim->load($data_format->_exchange_id); // Gestion des notifications ? if (!$echg_hprim->_id) { $echg_hprim->populateEchange($data_format, $dom_evt); $echg_hprim->identifiant_emetteur = $data['identifiantMessage']; $echg_hprim->message_valide = 1; } $echg_hprim->loadRefsInteropActor(); // Chargement des configs de l'expéditeur $echg_hprim->_ref_sender->getConfigs($data_format); $configs = $echg_hprim->_ref_sender->_configs; $display_errors = isset($configs["display_errors"]) ? $configs["display_errors"] : true; $doc_errors = $dom_evt->schemaValidate(null, false, $display_errors); // Gestion de l'acquittement $dom_acq = CHPrimXMLAcquittements::getAcquittementEvenementXML($dom_evt); $dom_acq->_identifiant_acquitte = $data['identifiantMessage']; $dom_acq->_sous_type_evt = $dom_evt->sous_type; // Acquittement d'erreur d'un document XML recu non valide if ($doc_errors !== true) { $echg_hprim->populateEchange($data_format, $dom_evt); $dom_acq->_ref_echange_hprim = $echg_hprim; $msgAcq = $dom_acq->generateAcquittements($dom_acq instanceof CHPrimXMLAcquittementsServeurActivitePmsi ? "err" : "erreur", "E002", $doc_errors); $doc_valid = $dom_acq->schemaValidate(null, false, $display_errors); $echg_hprim->populateErrorEchange($msgAcq, $doc_valid, "erreur"); return $msgAcq; } $echg_hprim->date_production = CMbDT::dateTime(); $echg_hprim->store(); if (!$data_format->_to_treatment) { return null; } $dom_evt->_ref_echange_hprim = $echg_hprim; $dom_acq->_ref_echange_hprim = $echg_hprim; // Message événement patient if ($dom_evt instanceof CHPrimXMLEvenementsPatients) { return self::eventPatient($dom_evt, $dom_acq, $echg_hprim, $data); } // Message serveur activité PMSI if ($dom_evt instanceof CHPrimXMLEvenementsServeurActivitePmsi) { return self::eventPMSI($dom_evt, $dom_acq, $echg_hprim, $data); } } catch (Exception $e) { $echg_hprim->populateEchange($data_format, $dom_evt); $dom_acq = CHPrimXMLAcquittements::getAcquittementEvenementXML($dom_evt); // Type par défaut $dom_acq->_sous_type_evt = "none"; $dom_acq->_identifiant_acquitte = isset($data['identifiantMessage']) ? $data['identifiantMessage'] : "000000000"; $dom_acq->_ref_echange_hprim = $echg_hprim; $msgAcq = $dom_acq->generateAcquittements($dom_acq instanceof CHPrimXMLAcquittementsServeurActivitePmsi ? "err" : "erreur", "E009", $e->getMessage(), null, $data); $doc_valid = $dom_acq->schemaValidate(null, false, false); $echg_hprim->populateErrorEchange($msgAcq, $doc_valid, "erreur"); return $msgAcq; } return null; }
/** * Message understood ? * * @param string $data Data * @param CInteropSender $actor Actor data * @param mixed $contexts Used with Dicom, the presentation contexts * * @return bool Understood ? */ static function understand($data, $actor = null, $contexts = null) { foreach (CExchangeDataFormat::getAll() as $_exchange_class) { foreach (CApp::getChildClasses($_exchange_class, true) as $_data_format) { /** * @var CExchangeDataFormat $data_format */ $data_format = new $_data_format(); // Test si le message est compris if ($contexts) { $understand = $data_format->understand($data, $actor, $contexts); } else { $understand = $data_format->understand($data, $actor); } if ($understand) { return $data_format; } } } return null; }