/** * The constructor * * @param string $rooturl The URL of the wsdl file * @param string $type The type of exchange * @param array $options An array of options * @param boolean $loggable True if you want to log all the exchanges with the web service * @param string $local_cert Path of the certifacte * @param string $passphrase Pass phrase for the certificate * @param boolean $safe_mode Safe mode * @param boolean $verify_peer Require verification of SSL certificate used * @param string $cafile Location of Certificate Authority file on local filesystem * * @throws CMbException * * @return CNuSOAPClient */ function __construct($rooturl, $type = null, $options = array(), $loggable = null, $local_cert = null, $passphrase = null, $safe_mode = false, $verify_peer = false, $cafile = null) { $this->wsdl_url = $rooturl; if ($loggable) { $this->loggable = $loggable; } if ($type) { $this->type_echange_soap = $type; } if (!$safe_mode) { if (!($html = file_get_contents($this->wsdl_url))) { $this->soap_client_error = true; throw new CMbException("CSourceSOAP-unable-to-parse-url", $this->wsdl_url); } if (strpos($html, "<?xml") === false) { $this->soap_client_error = true; throw new CMbException("CSourceSOAP-wsdl-invalid"); } } if (array_key_exists("encoding", $options)) { $encoding = $options["encoding"]; $this->soap_defencoding = $encoding; if ($encoding == "UTF-8") { $this->decode_utf8 = false; } } if ($local_cert) { $this->certRequest = array("sslcertfile" => $local_cert); } if ($passphrase) { $this->certRequest = array("passphrase" => $passphrase); } parent::__construct($rooturl, true, false, false, false, false, CAppUI::conf("webservices connection_timeout")); $this->wsdl_url = $rooturl; }
/** * Connect to a AS400 DB2 SQL server via ODBC driver * * @throws Error on misconfigured or anavailable server * * @return void */ static function connect() { if (self::$dbh) { return; } $config = CAppUI::conf("sante400"); if (null == ($dsn = $config["dsn"])) { trigger_error("Data Source Name not defined, please configure module", E_USER_ERROR); CApp::rip(); } // Fake data source for chrono purposes CSQLDataSource::$dataSources[$dsn] = new CMySQLDataSource(); $ds =& CSQLDataSource::$dataSources[$dsn]; $ds->dsn = $dsn; self::$chrono =& CSQLDataSource::$dataSources[$dsn]->chrono; self::$chrono->start(); $prefix = $config["prefix"]; try { self::$dbh = new PDO("{$prefix}:{$dsn}", $config["user"], $config["pass"]); self::$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { mbTrace("cauguht failure on first datasource"); if (null == ($dsn = $config["other_dsn"])) { throw $e; } self::$dbh = new PDO("{$prefix}:{$dsn}", $config["user"], $config["pass"]); self::$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } self::$chrono->stop("connection"); self::traceChrono("connection"); }
/** * @see parent::doRedirect() */ function doRedirect() { if (CAppUI::conf("dPsalleOp CActeCCAM codage_strict") || !$this->_old->_id || !$this->_obj->_id) { $this->_ref_object->correctActes(); } parent::doRedirect(); }
/** * Méthode permettant de tester si le service d'extraction Tika est actif * * @return string */ function loadTikaInfos() { $conf_host = trim(CAppUI::conf("search tika_host")); $conf_port = trim(CAppUI::conf("search tika_port")); $client = new CHTTPClient("http://{$conf_host}:{$conf_port}/tika"); return $client->get(); }
/** * @see parent::generateEnteteMessageAcquittement() */ function generateEnteteMessageAcquittement($statut, $codes = null, $commentaires = null) { $echg_hprim = $this->_ref_echange_hprim; $identifiant = $echg_hprim->_id ? str_pad($echg_hprim->_id, 6, '0', STR_PAD_LEFT) : "ES{$this->now}"; $acquittementsServeurActivitePmsi = $this->addElement($this, $this->acquittement, null, "http://www.hprim.org/hprimXML"); $this->addAttribute($acquittementsServeurActivitePmsi, "version", CAppUI::conf("hprimxml {$this->evenement} version")); $enteteMessageAcquittement = $this->addElement($acquittementsServeurActivitePmsi, "enteteMessage"); $this->addAttribute($enteteMessageAcquittement, "statut", $statut); $this->addElement($enteteMessageAcquittement, "identifiantMessage", $identifiant); $this->addDateTimeElement($enteteMessageAcquittement, "dateHeureProduction"); $emetteur = $this->addElement($enteteMessageAcquittement, "emetteur"); $agents = $this->addElement($emetteur, "agents"); $this->addAgent($agents, "application", "MediBoard", "Gestion des Etablissements de Santé"); $group = CGroups::loadCurrent(); $group->loadLastId400(); $this->addAgent($agents, $this->getAttSysteme(), CAppUI::conf('mb_id'), $group->text); $echg_hprim->loadRefsInteropActor(); // Pour un acquittement l'emetteur du message devient destinataire $destinataire = $this->addElement($enteteMessageAcquittement, "destinataire"); $agents = $this->addElement($destinataire, "agents"); $this->addAgent($agents, "application", $echg_hprim->_ref_sender->nom, $echg_hprim->_ref_sender->libelle); /* @todo Doit-on gérer le système du destinataire ? */ //$this->addAgent($agents, "système", $group->_id, $group->text); $this->addElement($enteteMessageAcquittement, "identifiantMessageAcquitte", $this->_identifiant_acquitte); }
/** * Constructor * * @param string $className Class name * @param int $objectKey Object key name */ function CDoObjectAddEdit($className, $objectKey = null) { if (CAppUI::conf("readonly")) { CAppUI::stepAjax("Mode-readonly-title", UI_MSG_ERROR); return; } global $m; $this->className = $className; $this->postRedirect = null; $this->redirect = "m={$m}"; $this->redirectStore = null; $this->redirectError = null; $this->redirectDelete = null; $this->createMsg = CAppUI::tr("{$className}-msg-create"); $this->modifyMsg = CAppUI::tr("{$className}-msg-modify"); $this->deleteMsg = CAppUI::tr("{$className}-msg-delete"); $this->request =& $_POST; $this->_logIt = true; // @todo : à supprimer cf déplacement dans le doBind() $this->_obj = new $this->className(); $this->_old = new $this->className(); $this->onAfterInstanciation(); // Lancer ceci apres chaque instanciation de _obj et _old !! $this->objectKey = $objectKey ? $objectKey : $this->_obj->_spec->key; $this->objectKeys = $this->objectKey . "s"; }
/** * Check anti-CSRF protection */ static function checkProtection() { if (!CAppUI::conf("csrf_protection") || strtoupper($_SERVER['REQUEST_METHOD']) != 'POST') { return; } if (!isset($_POST["csrf"])) { CAppUI::setMsg("CCSRF-no_token", UI_MSG_ERROR); return; } if (array_key_exists($_POST['csrf'], $_SESSION["tokens"])) { $token = $_SESSION['tokens'][$_POST['csrf']]; if ($token["lifetime"] >= time()) { foreach ($token["fields"] as $_field => $_value) { if (CValue::read($_POST, $_field) != $_value) { CAppUI::setMsg("CCSRF-form_corrupted", UI_MSG_ERROR); unset($_SESSION['tokens'][$_POST['csrf']]); return; } } //mbTrace("Le jeton est accepté !"); unset($_SESSION['tokens'][$_POST['csrf']]); } else { CAppUI::setMsg("CCSRF-token_outdated", UI_MSG_ERROR); unset($_SESSION['tokens'][$_POST['csrf']]); } return; } CAppUI::setMsg("CCSRF-token_does_not_exist", UI_MSG_ERROR); return; }
/** * Mediboard class autoloader * * @param string $class Class to be loaded * * @return bool */ function mbAutoload($class) { $file_exists = false; $time = microtime(true); // Entry already in cache if (isset(CApp::$classPaths[$class])) { // The class is known to not be in MB if (CApp::$classPaths[$class] === false) { return false; } // Load it if we can if ($file_exists = file_exists(CApp::$classPaths[$class])) { CApp::$performance["autoloadCount"]++; return include_once CApp::$classPaths[$class]; } } // File moved ? if (!$file_exists) { unset(CApp::$classPaths[$class]); } // CSetup* class if (preg_match('/^CSetup(.+)$/', $class, $matches)) { $dirs = array("modules/{$matches['1']}/setup.php"); } else { $class_file = $class; $suffix = ".class"; // Namespaced class if (strpos($class_file, "\\") !== false) { $namespace = explode("\\", $class_file); // Mediboard class if ($namespace[0] === "Mediboard") { array_shift($namespace); $class_file = implode("/", $namespace); } else { $class_file = "vendor/" . implode("/", $namespace); $suffix = ""; } } $class_file .= $suffix; $dirs = array("classes/{$class_file}.php", "classes/*/{$class_file}.php", "mobile/*/{$class_file}.php", "modules/*/classes/{$class_file}.php", "modules/*/classes/*/{$class_file}.php", "modules/*/classes/*/*/{$class_file}.php", "install/classes/{$class_file}.php"); } $rootDir = CAppUI::conf("root_dir"); $class_path = false; foreach ($dirs as $dir) { $files = glob("{$rootDir}/{$dir}"); foreach ($files as $filename) { include_once $filename; // The class was found if (class_exists($class, false) || interface_exists($class, false)) { $class_path = $filename; break 2; } } } // Class not found, it is not in MB CApp::$classPaths[$class] = $class_path; SHM::put("class-paths", CApp::$classPaths); CApp::$performance["autoload"][$class] = (microtime(true) - $time) * 1000; return $class_path !== false; }
/** * @see parent::__construct */ function __construct() { $this->evenement = "evt_serveurintervention"; $this->acquittement = "acquittementsServeurActes"; $version = str_replace(".", "", CAppUI::conf("hprimxml {$this->evenement} version")); parent::__construct("serveurActivitePmsi_v{$version}", "msgAcquittementsServeurActes{$version}"); }
static function mine($parent_class) { $classes = CApp::getChildClasses($parent_class); $limit = CAppUI::conf("dataminer_limit"); foreach ($classes as $_class) { $miner = new $_class(); $report = $miner->mineSome($limit, "mine"); $dt = CMbDT::dateTime(); echo "<{$dt}> Miner: {$_class}. Success mining count is '" . $report["success"] . "'\n"; if (!$report["failure"]) { echo "<{$dt}> Miner: {$_class}. Failure mining counts is '" . $report["failure"] . "'\n"; } $miner = new $_class(); $report = $miner->mineSome($limit, "remine"); $dt = CMbDT::dateTime(); echo "<{$dt}> Reminer: {$_class}. Success remining count is '" . $report["success"] . "'\n"; if (!$report["failure"]) { echo "<{$dt}> Reminer: {$_class}. Failure remining counts is '" . $report["failure"] . "'\n"; } $miner = new $_class(); $report = $miner->mineSome($limit, "postmine"); $dt = CMbDT::dateTime(); echo "<{$dt}> Postminer: {$_class}. Success postmining count is '" . $report["success"] . "'\n"; if (!$report["failure"]) { echo "<{$dt}> Postminer: {$_class}. Failure postmining counts is '" . $report["failure"] . "'\n"; } } }
/** * @see parent::onAfterStore() */ function onAfterStore(CMbObject $mbObject) { if (!$this->isHandled($mbObject)) { return false; } /** @var CConsultation $consultation */ $consultation = $mbObject; $praticien = $consultation->loadRefPraticien(); if (!$praticien || $praticien && !$praticien->_id) { return false; } $function = $praticien->loadRefFunction(); if (!$function || $function && !$function->_id) { return false; } $functions = CAppUI::conf("ihe RAD-3 function_ids"); $functions = explode("|", $functions); if (!in_array($function->_id, $functions)) { return false; } $code = "O01"; if (!$this->isMessageSupported($this->transaction, $this->message, $code, $consultation->_receiver)) { return false; } $this->sendITI($this->profil, $this->transaction, $this->message, $code, $consultation); return true; }
/** * logSejourAccess * * @param CSejour $sejour * * @return bool has the access been logged */ static function logForSejour($sejour) { $group = $sejour->loadRefEtablissement(); if (!CAppUI::conf("admin CLogAccessMedicalData enable_log_access", $group) || !$sejour->_id) { return false; } $user = CMediusers::get(); $conf = CAppUI::conf("admin CLogAccessMedicalData round_datetime", $group); $datetime = CMbDT::dateTime(); switch ($conf) { case '1m': // minute $datetime = CMbDT::format($datetime, "%y-%m-%d %H:%M:00"); break; case '10m': // 10 minutes $minute = CMbDT::format($datetime, "%M"); $minute = str_pad(floor($minute / 10) * 10, 2, 0, STR_PAD_RIGHT); $datetime = CMbDT::format($datetime, "%y-%m-%d %H:{$minute}:00"); break; case '1d': // 1 day $datetime = CMbDT::format($datetime, "%y-%m-%d 00:00:00"); break; default: // 1 hour $datetime = CMbDT::format($datetime, "%y-%m-%d %H:00:00"); break; } return self::logintoDb($user->_id, $sejour->_class, $sejour->_id, $datetime, $group->_id); }
/** * Magic method (do not call directly). * @param string $name method name * @param array $args arguments * * @return mixed * * @throws Exception * @throws CMbException */ function __call($name, $args) { $name = strtolower($name); $silent = strncmp($name, 'try', 3) === 0; $function_name = $silent ? substr($name, 3) : $name; $function_name = '_' . (isset(self::$aliases[$function_name]) ? self::$aliases[$function_name] : $function_name); if (!method_exists($this, $function_name)) { throw new CMbException("CSourceFTP-call-undefined-method", $name); } if ($function_name == "_init") { return call_user_func_array(array($this, $function_name), $args); } if (!$this->loggable) { try { return call_user_func_array(array($this, $function_name), $args); } catch (CMbException $fault) { throw $fault; } } $echange_ftp = new CExchangeFTP(); $echange_ftp->date_echange = CMbDT::dateTime(); $echange_ftp->emetteur = CAppUI::conf("mb_id"); $echange_ftp->destinataire = $this->hostname; $echange_ftp->function_name = $name; CApp::$chrono->stop(); $chrono = new Chronometer(); $chrono->start(); $output = null; try { $output = call_user_func_array(array($this, $function_name), $args); } catch (CMbException $fault) { $echange_ftp->date_echange = CMbDT::dateTime(); $echange_ftp->output = $fault->getMessage(); $echange_ftp->ftp_fault = 1; $echange_ftp->store(); CApp::$chrono->start(); throw $fault; } $chrono->stop(); CApp::$chrono->start(); // response time $echange_ftp->response_time = $chrono->total; // Truncate input and output before storing $args = array_map_recursive(array("CFTP", "truncate"), $args); $echange_ftp->input = serialize($args); if ($echange_ftp->ftp_fault != 1) { if ($function_name == "_getlistfiles") { // Truncate le tableau des fichiers reçus dans le cas où c'est > 100 $array_count = count($output); if ($array_count > 100) { $output = array_slice($output, 0, 100); $output["count"] = "{$array_count} files"; } } $echange_ftp->output = serialize(array_map_recursive(array("CFTP", "truncate"), $output)); } $echange_ftp->store(); return $output; }
/** * Extract files * * @param string $schemaDir Schema directory * @param string $schemaFile Schema files * @param bool $delOldDir Delete old directory * * @return void */ function extractFiles($schemaDir, $schemaFile, $delOldDir = false) { $baseDir = "modules/hprimxml/xsd"; $destinationDir = "{$baseDir}/{$schemaDir}"; $archivePath = "{$baseDir}/{$schemaFile}"; if ($delOldDir && file_exists($destinationDir)) { if (CMbPath::remove($destinationDir)) { echo "<div class='info'>Suppression de {$destinationDir}</div>"; } else { echo "<div class='error'>Impossible de supprimer le dossier {$destinationDir}</div>"; return; } } if (false != ($nbFiles = CMbPath::extract($archivePath, $destinationDir))) { echo "<div class='info'>Extraction de {$nbFiles} fichiers pour {$schemaDir}</div>"; } else { echo "<div class='error'>Impossible d'extraire l'archive {$schemaFile}</div>"; return; } if (CAppUI::conf("hprimxml concatenate_xsd")) { $rootFiles = glob("{$destinationDir}/msg*.xsd"); $includeFiles = array_diff(glob("{$destinationDir}/*.xsd"), $rootFiles); foreach ($rootFiles as $rootFile) { $xsd = new CHPrimXMLSchema(); $xsd->loadXML(file_get_contents($rootFile)); $xpath = new DOMXPath($xsd); $importFiles = array(); foreach ($includeFiles as $includeFile) { $include = new DOMDOcument(); $include->loadXML(file_get_contents($includeFile)); $isImport = false; foreach ($importFiles as $key => $value) { if (strpos($includeFile, $key) !== false) { $isImport = true; break; } } foreach ($include->documentElement->childNodes as $child) { $impNode = $xsd->importNode($child, true); $existing = false; if (in_array($impNode->nodeName, array("xsd:simpleType", "xsd:complexType"))) { $name = $impNode->getAttribute('name'); $existing = $xpath->query("//{$impNode->nodeName}[@name='{$name}']")->length > 0; } if ($isImport) { $xsd->documentElement->setAttribute("xmlns:insee", "http://www.hprim.org/inseeXML"); } if (!$existing) { $xsd->documentElement->appendChild($impNode); } } } $xsd->purgeImportedNamespaces(); $xsd->purgeIncludes(); file_put_contents(substr($rootFile, 0, -4) . ".xml", $xsd->saveXML()); echo "<div class='info'>Schéma concatené</div>"; } } }
/** * @see parent::updateFormFields() */ function updateFormFields() { parent::updateFormFields(); $this->_view = "Allaitement du " . CMbDT::transform($this->date_debut, null, CAppUI::conf("date")) . " à " . CMbDT::transform($this->date_debut, null, CAppUI::conf("time")); if ($this->date_fin) { $this->_view .= " au " . CMbDT::transform($this->date_fin, null, CAppUI::conf("date")) . " à " . CMbDT::transform($this->date_fin, null, CAppUI::conf("time")); } }
/** * Try and store trigger mark according to module config * * @param CTriggerMark $mark Mark content * * @return void */ static function storeMark($mark) { if (CAppUI::conf("dPsante400 mark_row")) { if ($msg = $mark->store()) { trigger_error("Enable to store CTriggerMark: {$msg}", E_USER_WARNING); } } }
/** * CMbSemaphore Constructor * * @param string $key semaphore identifier */ function __construct($key) { $this->path = CAppUI::conf("root_dir") . "/tmp/locks"; CMbPath::forceDir($this->path); $this->process = getmypid(); $prefix = CApp::getAppIdentifier(); $this->key = "{$prefix}-sem-{$key}"; }
/** * @see parent::updateFormFields() **/ function updateFormFields() { parent::updateFormFields(); $this->_view = sprintf("FA%08d", $this->_id); if (CAppUI::conf("ref_pays") == 2) { $this->_view .= " /{$this->numero}"; } }
function updateFormFields() { parent::updateFormFields(); $this->_self_sender = $this->emetteur == CAppUI::conf('mb_id'); $this->_self_receiver = $this->destinataire == CAppUI::conf('mb_id'); // ms $this->response_time = $this->response_time * 1000; }
/** * Initialize object specification * * @return CMbObjectSpec the spec */ function getSpec() { $spec = parent::getSpec(); $spec->table = 'destinataire_hprim'; $spec->key = 'dest_hprim_id'; $spec->messages = array("patients" => array("evenementPatient"), "pmsi" => array(CAppUI::conf("hprimxml send_diagnostic") == "evt_serveuretatspatient" ? "evenementServeurEtatsPatient" : "evenementPMSI", "evenementServeurActe", "evenementFraisDivers", "evenementServeurIntervention"), "stock" => array("evenementMvtStocks")); return $spec; }
/** * @see parent::__construct() */ function __construct($key, $label = null) { parent::__construct($key, $label); $this->path = CAppUI::conf("root_dir") . "/tmp/locks"; $this->process = getmypid(); $this->filename = "{$this->path}/" . $this->getLockKey(); CMbPath::forceDir(dirname($this->filename)); }
/** * Loads a list of Javascript files, with or without minification * * @param string $type The mime type to use to include the Javascript files * * @return string A list or a single HTML script tag */ static function loadFiles($type = "text/javascript") { $result = ""; $compress = CAppUI::conf("minify_javascript"); /** * There is a speed boost on the page load when using concatenation in a single file * between the top of the head and the dom:loaded event of about 25%. * This is because of parse time that is reduced (compare the global __pageLoad variable) * The number of requests from a regular page goes down from 100 to 70. * The total size of the JS goes down from 300kB to 230kB (gzipped). */ if ($compress) { $files = self::$files; $excluded = array(); $uptodate = false; // We exclude files already in the tmp dir foreach ($files as $index => $file) { if (strpos($file, "tmp/") === 0) { $excluded[] = $file; unset($files[$index]); } } $hash = self::getHash(implode("", $files)); $cachefile = "tmp/{$hash}.js"; // If it exists, we check if it is up to date if (file_exists($cachefile)) { $uptodate = true; $last_update = self::getLastChange($cachefile); foreach ($files as $file) { if (self::getLastChange($file) > $last_update) { $uptodate = false; break; } } } if (!$uptodate) { $all_scripts = ""; foreach ($files as $file) { $_script = file_get_contents($file); if (substr($_script, 0, 3) == chr(0xef) . chr(0xbb) . chr(0xbf)) { $_script = substr($_script, 3); } $all_scripts .= $_script . "\n"; } file_put_contents($cachefile, $all_scripts); $last_update = time(); } foreach ($excluded as $file) { $result .= self::loadFile($file, null, self::getLastChange($file), $type) . "\n"; } $result .= self::loadFile($cachefile, null, $last_update, $type) . "\n"; } else { foreach (self::$files as $file) { $result .= self::loadFile($file, null, self::getLastChange($file), $type) . "\n"; } } return $result; }
/** * Get a unique order number * * @return string */ private function getUniqueNumber() { $format = CAppUI::conf('dPstock CProductOrder order_number_format'); if (strpos($format, '%id') === false) { $format .= '%id'; } $format = str_replace('%id', str_pad($this->_id ? $this->_id : 0, 4, '0', STR_PAD_LEFT), $format); return CMbDT::format(null, $format); }
/** * Construct * * @param string $key lock identifier */ function __construct($key) { $this->path = CAppUI::conf("root_dir") . "/tmp/locks"; $this->process = getmypid(); $prefix = CApp::getAppIdentifier(); $this->key = "{$prefix}-lock-{$key}"; $this->filename = "{$this->path}/{$this->key}"; CMbPath::forceDir(dirname($this->filename)); }
/** * Create a mouvement instance from given type * * @param string $type * * @return CMouvement400 concrete instance, null for unhandled type */ static function create($type) { $mode_compat = CAppUI::conf("interop mode_compat"); if (null == ($class = @self::$modes[$mode_compat][$type])) { trigger_error("Pas de gestionnaire en mode de compatibilité '{$mode_compat}' et type de mouvement '{$type}'", E_USER_ERROR); return; } return new $class(); }
/** * Profiler constructor */ public function __construct() { if (!extension_loaded("xhprof") || php_sapi_name() === "cli") { throw new Exception("The XHprof extension must be installed"); } self::$xhprof_path = CAppUI::conf("dPdeveloppement profiling_xhprof_path"); if (!self::$xhprof_path) { throw new Exception("You must configure the 'profiling_xhprof_path' config"); } }
/** * Return the instance OID * * @param CInteropReceiver $receiver Receiver * * @return String */ static function getOIDRoot($receiver = null) { if ($receiver) { $receiver->loadConfigValues(); } if ($receiver && $receiver->_configs["use_receiver_oid"]) { return $receiver->OID; } return CAppUI::conf("mb_oid"); }
/** * Init SOAP client * * @return void */ function initClientSOAP() { if ($this->clientSOAP instanceof SoapClient) { return; } try { $this->clientSOAP = new SoapClient(CAppUI::conf('dPfiles CMedinetSender rooturl')); } catch (Exception $e) { trigger_error("Instanciation du SoapClient impossible : " . $e); } }
function __construct($name, $description = "") { parent::__construct(); //Ajout de quelques proporiétés $this->setProperty("method", "PUBLISH"); $this->setProperty("x-wr-calname", $name); if ($description) { $this->setProperty("X-WR-CALDESC", $description); } $this->setProperty("X-WR-TIMEZONE", CAppUI::conf("timezone")); }
/** * Build ZBE segement * * @param CHL7v2Event $event Event * * @return null */ function build(CHL7v2Event $event) { parent::build($event); $receiver = $event->_receiver; $sejour = $this->sejour; $movement = $this->movement; $affectation = $this->curr_affectation; if ($this->other_affectation) { $affectation = $this->other_affectation; } $action_movement = null; if ($sejour->_cancel_hospitalization) { $action_movement = "CANCEL"; } else { foreach (self::$actions as $action => $events) { if (in_array($event->code, $events)) { $action_movement = $action; } } } // ZBE-1: Movement ID (EI) (optional) $identifiers[] = array($movement->_view, CAppUI::conf("hl7 assigning_authority_namespace_id"), CAppUI::conf("hl7 assigning_authority_universal_id"), CAppUI::conf("hl7 assigning_authority_universal_type_id")); $idexMovement = CIdSante400::getMatch("CMovement", $receiver->_tag_movement, null, $movement->_id); if ($idexMovement->_id) { $configs = $receiver->_configs; $identifiers[] = array($idexMovement->id400, $configs["assigning_authority_namespace_id"], $configs["assigning_authority_universal_id"], $configs["assigning_authority_universal_type_id"]); } $data[] = $identifiers; // ZBE-2: Start of Movement Date/Time (TS) $start_of_movement = $action_movement == "CANCEL" ? $movement->last_update : $movement->start_of_movement; $data[] = $start_of_movement > $sejour->sortie ? $sejour->sortie : $start_of_movement; // ZBE-3: End of Movement Date/Time (TS) (optional) // Forbidden (IHE France) $data[] = null; // ZBE-4: Action on the Movement (ID) $data[] = $action_movement; // ZBE-5: Indicator "Historical Movement" (ID) $data[] = $movement->_current ? "N" : "Y"; // ZBE-6: Original trigger event code (ID) (optional) $data[] = $action_movement == "UPDATE" || $action_movement == "CANCEL" ? $movement->original_trigger_code : null; $ufs = $sejour->getUFs(null, $affectation->_id); // ZBE-7: Ward of medical responsibility in the period starting with this movement (XON) (optional) $uf_type = $receiver->_configs["build_ZBE_7"]; $uf_medicale = isset($ufs[$uf_type]) ? $ufs[$uf_type] : null; if (isset($uf_medicale->_id)) { $data[] = array(array($uf_medicale->libelle, null, null, null, null, $this->getAssigningAuthority("mediboard"), "UF", null, null, $uf_medicale->code)); } else { $data[] = null; } // Traitement des segments spécifiques extension PAM $this->fillOtherSegments($data, $ufs, $event); $this->fill($data); }