/**
  * check access for a sejour
  *
  * @param string|CMbObject $sejour
  */
 static function checkForSejour($sejour, $modal = true)
 {
     if (is_string($sejour)) {
         $sejour = CMbObject::loadFromGuid($sejour);
     }
     $canAccess = CBrisDeGlace::checkForSejour($sejour, $modal);
     CLogAccessMedicalData::logForSejour($sejour);
     return $canAccess;
 }
Esempio n. 2
0
/**
 * Returns the CMbObject with given GET or SESSION params keys,
 * if it doesn't exist, a redirect is made
 *
 * @param string $class_key The class name of the object
 * @param string $id_key    The object ID
 * @param string $guid_key  The object GUID (classname-id)
 *
 * @return CMbObject The object loaded or nothing
 **/
function mbGetObjectFromGetOrSession($class_key, $id_key, $guid_key = null)
{
    $object_class = CValue::getOrSession($class_key);
    $object_id = CValue::getOrSession($id_key);
    $object_guid = "{$object_class}-{$object_id}";
    if ($guid_key) {
        $object_guid = CValue::getOrSession($guid_key, $object_guid);
    }
    $object = CMbObject::loadFromGuid($object_guid);
    // Redirection
    if (!$object || !$object->_id) {
        global $ajax;
        CAppUI::redirect("ajax={$ajax}" . "&suppressHeaders=1" . "&m=system" . "&a=object_not_found" . "&object_guid={$object_guid}");
    }
    return $object;
}
 * @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();
$exchange_guid = CValue::post("exchange_guid");
$_message = CValue::post("_message");
$segment_terminator = CValue::post("segment_terminator");
$_message = str_replace("\\\\", "\\", $_message);
$_message = str_replace('\\"', '"', $_message);
$map = array("CR" => "\r", "LF" => "\n", "CRLF" => "\r\n");
$segment_terminator = CValue::read($map, $segment_terminator);
if ($segment_terminator) {
    $lines = preg_split("/(\r\n|\r|\n)/", $_message);
    $_message = implode($segment_terminator, $lines);
}
/**
 * @var CExchangeDataFormat
 */
$exchange = CMbObject::loadFromGuid($exchange_guid);
if ($exchange->_id) {
    $exchange->_message = $_message;
    if ($msg = $exchange->store()) {
        CAppUI::setMsg($msg, UI_MSG_ERROR);
    } else {
        CAppUI::setMsg("{$exchange->_class}-msg-modify");
    }
}
echo CAppUI::getMsg();
CApp::rip();
 /**
  * Charge la source d'impression
  *
  * @return CSourcePrinter
  */
 function loadRefSource()
 {
     $source_guid = $this->object_class . '-' . $this->object_id;
     return $this->_ref_source = CMbObject::loadFromGuid($source_guid);
 }
Esempio n. 5
0
$draw_id = CValue::get('id');
$context_guid = CValue::get("context_guid");
$draw = new CFile();
$draw->load($draw_id);
$draw->loadRefsNotes();
$draw->loadRefAuthor();
$draw->loadRefsNotes();
$draw->getBinaryContent();
$user = CMediusers::get();
$user->loadRefFunction();
$functions = $user->loadRefsSecondaryFunctions();
$admin = $user->isAdmin();
$files_in_context = array();
$object = null;
if ($context_guid) {
    $object = CMbObject::loadFromGuid($context_guid);
    if ($object->_id) {
        $object->loadRefsFiles();
        foreach ($object->_ref_files as $file_id => $_file) {
            if (strpos($_file->file_type, "image/") === false || $_file->file_type == "image/fabricjs" || $_file->annule) {
                unset($object->_ref_files[$file_id]);
            }
        }
    }
}
// creation
if (!$draw->_id) {
    // author = self
    $draw->author_id = $user->_id;
    $draw->_ref_author = $user;
    $draw->file_type = "image/svg+xml";
$const_id = CValue::get('const_id', 0);
$context_guid = CValue::get('context_guid');
$patient_id = CValue::get('patient_id');
$can_edit = CValue::get('can_edit');
$selection = CValue::get('selection');
$host_guid = CValue::get('host_guid');
$display_graph = CValue::get('display_graph', 1);
$unique_id = CValue::get('unique_id', '');
$context = null;
if ($context_guid) {
    $context = CMbObject::loadFromGuid($context_guid);
}
/** @var CGroups|CService|CRPU $host */
// On cherche le meilleur "herbegement" des constantes, pour charger les configuration adequat
if ($host_guid) {
    $host = CMbObject::loadFromGuid($host_guid);
} else {
    $host = CConstantesMedicales::guessHost($context);
}
$show_cat_tabs = CConstantesMedicales::getHostConfig("show_cat_tabs", $host);
$show_enable_all_button = CConstantesMedicales::getHostConfig("show_enable_all_button", $host);
$dates = array();
if (!$selection) {
    $selection = CConstantesMedicales::getConstantsByRank('form', true, $host);
} else {
    $selection = CConstantesMedicales::selectConstants($selection, 'form');
}
foreach (CConstantesMedicales::$list_constantes as $key => $cst) {
    $dates["{$key}"] = CMbDT::format(null, '%d/%m/%y');
}
$patient_id = $constantes->patient_id ? $constantes->patient_id : $patient_id;
<?php

/**
 * $Id$
 *  
 * @category dPurgences
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
$sejour_guid = CValue::post("sejour_guid");
/** @var CSejour $sejour */
$sejour = CMbObject::loadFromGuid($sejour_guid);
if ($sejour && !$sejour->_id) {
    CAppUI::setMsg("Sejour non renseigné", UI_MSG_ERROR);
}
$rpu = $sejour->loadRefRPU();
$sejour_mutation = $rpu->loadRefSejourMutation();
//Envoie d'un A07 que si le A06 a été envoyé
if ($sejour->sortie_reelle) {
    $sejour_mutation->_cancel_hospitalization = true;
}
//On annule le relicat
$sejour->mode_sortie = "";
$sejour->entree_reelle = "";
$sejour->annule = "1";
if ($msg = $sejour->store()) {
    CAppUI::setMsg($msg, UI_MSG_ERROR);
    return;
 /**
  * Get events for an object
  *
  * @param CMbObject|string $object                     Object or GUID
  * @param string           $event_name                 Event name
  * @param string           $type                       Type: required, disabled or conditional
  * @param array            $exclude_ex_class_event_ids List of class events' ids
  *
  * @return CExClassEvent[]
  */
 static function getForObject($object, $event_name, $type = "required", $exclude_ex_class_event_ids = array())
 {
     static $events_cache = array();
     if (is_string($object)) {
         $object = CMbObject::loadFromGuid($object);
     }
     if ($type == "required" && !CValue::read($object->_spec->events[$event_name], "auto", false)) {
         return array();
     }
     $ex_class_event = new self();
     $group_id = CGroups::loadCurrent()->_id;
     $ds = $ex_class_event->_spec->ds;
     $key = "{$object->_class}/{$event_name}/{$group_id}/{$type}";
     if (isset($events_cache[$key])) {
         $ex_class_events = $events_cache[$key];
     } else {
         $where = array("ex_class_event.host_class" => $ds->prepare("=%", $object->_class), "ex_class_event.event_name" => $ds->prepare("=%", $event_name), "ex_class_event.disabled" => $ds->prepare("=%", 0), "ex_class.conditional" => $ds->prepare("=%", 0), $ds->prepare("ex_class.group_id = % OR group_id IS NULL", $group_id));
         $ljoin = array("ex_class" => "ex_class.ex_class_id = ex_class_event.ex_class_id");
         switch ($type) {
             case "disabled":
                 $where["ex_class_event.disabled"] = 1;
                 break;
             case "conditional":
                 $where["ex_class.conditional"] = 1;
                 break;
         }
         /** @var CExClassEvent[] $ex_class_events */
         $ex_class_events = $ex_class_event->loadList($where, null, null, null, $ljoin);
         $events_cache[$key] = $ex_class_events;
     }
     foreach ($ex_class_events as $_id => $_ex_class_event) {
         if (isset($exclude_ex_class_event_ids[$_id]) || !$_ex_class_event->checkConstraints($object)) {
             unset($ex_class_events[$_id]);
         } else {
             $_ex_class_event->_host_object = $object;
         }
     }
     return $ex_class_events;
 }
 /**
  * Load target object, similar to CMbMetaObject's
  *
  * @return CMbObject
  */
 function loadTargetObject()
 {
     $this->loadRefExClassEvent();
     $this->completeField("field", "value");
     if (!$this->_id) {
         return $this->_ref_target_object = new CMbObject();
     }
     $ref_object = new $this->_ref_ex_class_event->host_class();
     $spec = $this->resolveSpec($ref_object);
     if ($spec instanceof CRefSpec && $this->value && preg_match("/[a-z][a-z0-9_]+-[0-9]+/i", $this->value)) {
         $this->_ref_target_object = CMbObject::loadFromGuid($this->value);
     } else {
         // empty object
         $this->_ref_target_object = new CMbObject();
     }
     $this->_ref_target_spec = $spec;
     return $this->_ref_target_object;
 }
<?php

/**
 * $Id: ajax_reglements_fact_etab.php 28346 2015-05-21 08:49:27Z aurelie17 $
 *
 * @package    Mediboard
 * @subpackage dPfacturation
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 28346 $
 */
CCanDo::checkEdit();
$facture_guid = CValue::get("object_guid");
/* @var CFactureEtablissement $facture*/
$facture = CMbObject::loadFromGuid($facture_guid);
$facture->loadRefsObjects();
$facture->updateMontants();
$facture->loadRefsReglements();
// Ajout de reglements
$facture->_new_reglement_patient = new CReglement();
$facture->_new_reglement_patient->setObject($facture);
$facture->_new_reglement_patient->montant = $facture->_du_restant;
$use_mode_default = CAppUI::conf("dPfacturation CReglement use_mode_default");
$facture->_new_reglement_patient->mode = $use_mode_default != "none" ? $use_mode_default : "autre";
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("facture", $facture);
$smarty->assign("reload", 1);
$smarty->display("inc_vw_reglements_etab.tpl");
Esempio n. 11
0
 *  
 * @package    Mediboard
 * @subpackage ccam
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 * @link       http://www.mediboard.org
 */
$praticien_id = CValue::get('praticien_id');
$codable_class = CValue::get('codable_class');
$codable_id = CValue::get('codable_id');
$date = Cvalue::get('date');
$lock = CValue::get('lock', 1);
$user = CMediusers::get();
/** @var CCodable $codable */
$codable = CMbObject::loadFromGuid("{$codable_class}-{$codable_id}");
$codage = CCodageCCAM::get($codable, $praticien_id, 1, $date);
if (CAppUI::conf('ccam CCodable lock_codage_ccam') != 'password' && $codable_class != 'CSejour') {
    $codage = new CCodageCCAM();
    $codage->praticien_id = $praticien_id;
    $codage->codable_class = $codable_class;
    $codage->codable_id = $codable_id;
    $codages = $codage->loadMatchingList();
    foreach ($codages as $_codage) {
        $_codage->locked = $lock;
        $_codage->store();
    }
    $msg = $lock ? 'CCodageCCAM-msg-codage_locked' : 'CCodageCCAM-msg-codage_unlocked';
    CAppUI::setMsg($msg, UI_MSG_OK);
    echo CAppUI::getMsg();
    CApp::rip();
 /**
  * Trigger after event merge
  *
  * @param CMbObject $mbObject Object
  *
  * @throws CMbException
  *
  * @return bool
  */
 function onAfterMerge(CMbObject $mbObject)
 {
     if (!$this->isHandled($mbObject)) {
         return false;
     }
     $patient = $mbObject;
     $patient->check();
     $patient->updateFormFields();
     $receiver = $mbObject->_receiver;
     // Si Client
     if (!CAppUI::conf('sip server')) {
         foreach ($mbObject->_fusion as $group_id => $infos_fus) {
             if ($receiver->group_id != $group_id) {
                 continue;
             }
             /** @var CInteropSender $sender */
             $sender = $mbObject->_eai_sender_guid ? CMbObject::loadFromGuid($mbObject->_eai_sender_guid) : null;
             if ($sender && $sender->group_id == $receiver->group_id) {
                 continue;
             }
             $patient1_ipp = $patient->_IPP = $infos_fus["patient1_ipp"];
             $patient_eliminee = $infos_fus["patientElimine"];
             $patient2_ipp = $patient_eliminee->_IPP = $infos_fus["patient2_ipp"];
             // Cas 0 IPP : Aucune notification envoyée
             if (!$patient1_ipp && !$patient2_ipp) {
                 continue;
             }
             // Cas 1 IPP : Pas de message de fusion mais d'une modification du patient
             if (!$patient1_ipp && $patient2_ipp || $patient1_ipp && !$patient2_ipp) {
                 if ($patient2_ipp) {
                     $patient->_IPP = $patient2_ipp;
                 }
                 $this->sendEvenementPatient("CHPrimXMLEnregistrementPatient", $patient);
                 continue;
             }
             // Cas 2 IPPs : Message de fusion
             if ($patient1_ipp && $patient2_ipp) {
                 $patient->_patient_elimine = $patient_eliminee;
                 $this->sendEvenementPatient("CHPrimXMLFusionPatient", $patient);
                 continue;
             }
         }
     }
     return true;
 }
Esempio n. 13
0
}
$lettre = CValue::get("lettre");
$category_id = CValue::getOrSession("category_id", CAppUI::conf('dPmedicament CBcbProduitLivretTherapeutique product_category_id'));
$listProduits = array();
// Chargement des functions
$function = new CFunctions();
$functions = $function->loadSpecialites(PERM_EDIT);
// Si on est admin ou que $functions contient plus d'un élément,
// on récupère la fonction en session
if (CAppUI::$user->isAdmin() || count($functions) > 1) {
    $function_guid = CValue::getOrSession("function_guid", reset($functions)->_guid);
} else {
    // Sinon, c'est la fonction de l'utilisateur
    $function_guid = "CFunctions-" . CAppUI::$user->function_id;
}
$function = CMbObject::loadFromGuid($function_guid);
// Chargement des produits du livret therapeutique
$produits_livret = CBcbProduit::loadRefLivretTherapeutique($function->_guid);
$tabLettre = range('A', 'Z');
// --- Chargement de l'arbre ATC ---
$codeATC = CValue::get("codeATC");
$classeATC = new CBcbClasseATC();
$chapitreATC = $codeATC ? $classeATC->getLibelle($codeATC) : '';
// Nom du chapitre selectionné
$arbreATC = $classeATC->loadArbre($codeATC);
// Chargements des sous chapitres
$categories = array();
if (CModule::getActive("dPstock")) {
    $category = new CProductCategory();
    $categories = $category->loadList(null, "name");
}
Esempio n. 14
0
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
$default_disposition = CValue::get("disposition", CAppUI::pref("mozaic_disposition", "2x2"));
$context = CValue::get("context_guid");
$doc = new CFile();
$doc->canDo();
if (!$doc->_can->edit) {
    CAppUI::stepAjax("pas le droit de créer un CFile", UI_MSG_ERROR);
}
if (!$context) {
    CAppUI::stepAjax("no_context_provided", UI_MSG_ERROR);
}
$context = CMbObject::loadFromGuid($context);
if (!$context->_id) {
    CAppUI::stepAjax("unexisting", UI_MSG_ERROR);
}
$context->canDo();
if (!$context->_can->read) {
    CAppUI::stepAjax("No right", UI_MSG_ERROR);
}
switch ($context->_class) {
    case 'CPatient':
        $patient = $context;
        break;
    case 'CSejour':
        /** @var CSejour $context */
        $patient = $context->loadRefPatient();
        break;
<?php

/**
 * $Id$
 *  
 * @package    Mediboard
 * @subpackage patients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 * @link       http://www.mediboard.org
 */
$selection = json_decode(stripslashes(CValue::get('constants', '[]')));
$patient_id = CValue::get('patient_id');
$context_guid = CValue::get('context_guid');
$period = CValue::get('period', 'month');
$patient = CMbObject::loadFromGuid("CPatient-{$patient_id}");
$smarty = new CSmartyDP();
$smarty->assign('patient', $patient);
$smarty->assign('context_guid', $context_guid);
$smarty->assign('constants', json_encode($selection));
$smarty->assign('period', $period);
$smarty->display('inc_select_constants_graph_period.tpl');
Esempio n. 16
0
 * Import CExchangeDataFormatConfig
 *  
 * @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();
$actor_guid = CValue::request("actor_guid");
$format_config_guid = CValue::request("format_config_guid");
$file = isset($_FILES['import']) ? $_FILES['import'] : null;
if (!empty($file) && ($contents = file_get_contents($file['tmp_name']))) {
    $actor = CMbObject::loadFromGuid($actor_guid);
    $format_config = CMbObject::loadFromGuid($format_config_guid);
    if (!$format_config->sender_class || !$format_config->sender_id) {
        $format_config->sender_class = $actor->_class;
        $format_config->sender_id = $actor->_id;
    }
    $dom = new CMbXMLDocument();
    $dom->loadXML($contents);
    $root_name = $dom->documentElement->nodeName;
    $fields = $format_config->getPlainFields();
    unset($fields[$format_config->_spec->key]);
    unset($fields["sender_id"]);
    unset($fields["sender_class"]);
    if ($root_name == $format_config->_class) {
        $xpath = new CMbXPath($dom);
        $nodeList = $xpath->query("//{$root_name}/*");
        $array_configs = array();
Esempio n. 17
0
/**
 * $Id$
 *  
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
$guid = CValue::get("source_guid");
$source_name = CValue::get("source_name");
$object_guid = CValue::get("object_guid");
$light = CValue::get("light", false);
/** @var CExchangeSource $source */
$source = CMbObject::loadFromGuid($guid);
if (!$source->_id) {
    $source->name = $source_name;
}
if ($source instanceof CSourcePOP) {
    if (!$source->_id && $object_guid) {
        list($object_class, $object_id) = explode("-", $object_guid);
        /** @var CSourcePOP $source */
        $source->object_class = $object_class;
        $source->object_id = $object_id;
    }
    $source->loadRefMetaObject();
}
$smarty = new CSmartyDP("modules/" . $source->_ref_module->mod_name);
$smarty->assign("source", $source);
$smarty->assign("light", $light);
 /**
  * Inject master idex (IPP/NDA) missing
  *
  * @throws CMbException
  *
  * @return void
  */
 function injectMasterIdexMissing()
 {
     $patient = null;
     $sejour = null;
     if ($this->object_class && $this->object_id) {
         $object = CMbObject::loadFromGuid("{$this->object_class}-{$this->object_id}");
         if ($object instanceof CPatient) {
             $patient = $object;
             $patient->loadIPP($this->group_id);
             if (!$patient->_IPP) {
                 return;
             }
         }
         if ($object instanceof CSejour) {
             $sejour = $object;
             $sejour->loadNDA($this->group_id);
             $object->loadRefPatient()->loadIPP($this->group_id);
             $patient = $sejour->_ref_patient;
             if (!$sejour->_NDA) {
                 return;
             }
         }
     }
     $pattern = "===IPP_MISSING===";
     if (strpos($this->_message, $pattern) !== false) {
         $this->_message = str_replace("===IPP_MISSING===", $patient->_IPP, $this->_message);
     }
     $pattern = "===NDA_MISSING===";
     if (strpos($this->_message, $pattern) !== false) {
         $this->_message = str_replace("===NDA_MISSING===", $sejour->_NDA, $this->_message);
     }
     $this->master_idex_missing = strpos($this->_message, "===NDA_MISSING===") !== false || strpos($this->_message, "===IPP_MISSING===") !== false;
     if ($msg = $this->store()) {
         throw new CMbException(CAppUI::tr("{$this->_class}-msg-store-failed") . $msg);
     }
 }
<?php

/**
 * $Id: vw_daily_check_list_preview.php 25685 2014-11-03 15:34:02Z aurelie17 $
 *
 * @package    Mediboard
 * @subpackage SalleOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 25685 $
 */
CCanDo::checkEdit();
$object_class = CValue::get("object_class");
$object_id = CValue::get("object_id");
$type = CValue::get("type", "ouverture_salle");
$object = CMbObject::loadFromGuid("{$object_class}-{$object_id}");
// Vérification de la check list journalière
$daily_check_lists = array();
$daily_check_list_types = array();
list($check_list_not_validated, $daily_check_list_types, $daily_check_lists) = CDailyCheckList::getCheckLists($object, "1970-01-01", $type);
$validateur = new CPersonnel();
$validateur->_ref_user = new CMediusers();
$validateur->_ref_user->_view = "Validateur test";
$listValidateurs = array($validateur);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("daily_check_lists", $daily_check_lists);
$smarty->assign("listValidateurs", $listValidateurs);
$smarty->display("vw_daily_check_list_preview.tpl");
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$receiver_guid = CValue::sessionAbs("cn_receiver_guid");
if (!$receiver_guid || $receiver_guid == "none") {
    CAppUI::stepAjax("Aucun destinataire HL7v2", UI_MSG_ERROR);
}
$profil = "PAM";
$transaction = "ITI30";
$message = "ADT";
$patient_id = CValue::get("patient_id");
$event = CValue::get("event");
/** @var CReceiverHL7v2 $receiver */
$receiver = CMbObject::loadFromGuid($receiver_guid);
$receiver->loadConfigValues();
$receiver->getInternationalizationCode($transaction);
$patient = new CPatient();
$patient->load($patient_id);
$ack_data = null;
$iti_handler = new CITI30DelegatedHandler();
switch ($event) {
    case "A28":
        if (!$iti_handler->isMessageSupported($iti_handler->transaction, $iti_handler->message, $event, $receiver)) {
            CAppUI::setMsg("CEAIDispatcher-_family_message_no_supported_for_this_actor", UI_MSG_ERROR, $receiver);
        }
        $patient->_receiver = $receiver;
        // Envoi de l'évènement
        $iti_handler->sendITI($iti_handler->profil, $iti_handler->transaction, $iti_handler->message, $event, $patient);
        break;
Esempio n. 21
0
 /**
  * load accoun user
  *
  * @return CMbObject
  */
 function loadAccount()
 {
     return $this->_ref_source_account = CMbObject::loadFromGuid("{$this->account_class}-{$this->account_id}", true);
 }
Esempio n. 22
0
$patient->sexe = $patient_sexe;
$sejour = new CSejour();
$sejour->_admission = $admit_class;
$sejour->_service = $admit_service;
$sejour->_chambre = $admit_room;
$sejour->_lit = $admit_bed;
$sejour->_praticien_attending = $admit_attending_doctor;
// Praticien
$sejour->_praticien_referring = $admit_referring_doctor;
// Nom du médecin adressant
$sejour->_praticien_admitting = $admit_admitting_doctor;
// Médecin traitant
$sejour->_praticien_consulting = $admit_consulting_doctor;
$cn_receiver_guid = CValue::sessionAbs("cn_receiver_guid");
if ($cn_receiver_guid) {
    $receiver_hl7v2 = CMbObject::loadFromGuid($cn_receiver_guid);
    $receivers = array($receiver_hl7v2);
} else {
    $receiver_hl7v2 = new CReceiverHL7v2();
    $receiver_hl7v2->actif = 1;
    $receiver_hl7v2->group_id = CGroups::loadCurrent()->_id;
    $receivers = $receiver_hl7v2->loadMatchingList();
}
$profil = "PDQ";
$transaction = "ITI21";
$message = "QBP";
$code = "Q22";
if ($admit_class || $admit_service || $admit_room || $admit_bed || $admit_attending_doctor || $admit_referring_doctor || $admit_consulting_doctor || $admit_admitting_doctor) {
    $transaction = "ITI22";
    $code = "ZV1";
}
Esempio n. 23
0
 /**
  * Get objects by events
  *
  * @param array            $events   Events name
  * @param CInteropReceiver $receiver receiver
  *
  * @return array Receivers supported
  */
 static function getObjectsBySupportedEvents($events = array(), CInteropReceiver $receiver = null)
 {
     $receivers = array();
     foreach ($events as $_event) {
         $msg_supported = new CMessageSupported();
         $where = array();
         $where["message"] = " = '{$_event}'";
         $where["active"] = " = '1'";
         $ljoin = array();
         if ($receiver) {
             $table = $receiver->_spec->table;
             $ljoin[$table] = "{$table}.{$table}" . "_id" . " = message_supported.object_id";
             $where["object_class"] = " = '{$receiver->_class}'";
             if ($receiver->_id) {
                 $where["object_id"] = " = '{$receiver->_id}'";
             }
             $where["{$table}.actif"] = " = '1'";
         }
         if (!$msg_supported->loadObject($where, null, null, $ljoin)) {
             $receivers[$_event] = null;
             return $receivers;
         }
         $messages = $msg_supported->loadList($where, "object_class", null, null, $ljoin);
         foreach ($messages as $_message) {
             /** @var CInteropReceiver $receiver */
             $receiver = CMbObject::loadFromGuid("{$_message->object_class}-{$_message->object_id}");
             if (!$receiver->actif) {
                 continue;
             }
             $receiver->loadRefGroup();
             $receiver->isReachable();
             $receivers[$_event][] = $receiver;
         }
     }
     return $receivers;
 }
Esempio n. 24
0
<?php

/**
 * $Id$
 *  
 * @category Modèles
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$owner_guid = CView::request("owner_guid", "str");
CView::checkin();
$smarty = new CSmartyDP();
$smarty->assign("owner", CMbObject::loadFromGuid($owner_guid));
$smarty->display("inc_vw_import_modele.tpl");
Esempio n. 25
0
<?php

/**
 * Details interop receiver EAI
 *
 * @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");
/** @var CInteropActor $actor */
$actor = CMbObject::loadFromGuid($actor_guid);
if ($actor->_id) {
    $actor->loadRefGroup();
    $actor->loadRefUser();
    $actor->loadRefObjectConfigs();
    if ($actor instanceof CInteropSender) {
        $actor->countBackRefs("routes_sender");
    }
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("actor", $actor);
$smarty->display("inc_view_actor.tpl");
Esempio n. 26
0
<?php

/**
 * Export CExchangeDataFormatConfig
 *  
 * @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();
$config_guid = CValue::get("config_guid");
/**
 * @var CExchangeDataFormatConfig
 */
$config = CMbObject::loadFromGuid($config_guid);
$name = $config->loadRefSender()->_view;
ob_clean();
header("Content-Type: text/xml");
header("Content-Disposition: attachment; filename=\"config-{$name}.xml\"");
echo $config->exportXML()->saveXML();
CApp::rip();
Esempio n. 27
0
<?php

/**
 * $Id$
 *  
 * @category Modèles
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$owner_guid = CView::post("owner_guid", "str");
CView::checkin();
$owner = CMbObject::loadFromGuid($owner_guid);
if (!$owner || !$owner->_id) {
    CAppUI::stepMessage(UI_MSG_WARNING, "Le propriétaire souhaité n'existe pas.");
}
$user_id = "";
$function_id = "";
$group_id = "";
switch ($owner->_class) {
    case "CMediusers":
    default:
        $user_id = $owner->_id;
        break;
    case "CFunctions":
        $function_id = $owner->_id;
        break;
    case "CGroups":
/**
 * $Id: vw_antecedents_allergies.php 28933 2015-07-09 14:18:15Z aurelie17 $
 *
 * @category soins
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision: 28933 $
 */
CCanDo::checkRead();
$show_atcd = CValue::get("show_atcd", 1);
$patient_guid = CValue::get("patient_guid");
$sejour_id = CValue::get("sejour_id");
$consult_id = CValue::get("consult_id");
/* @var CPatient $patient*/
$patient = CMbObject::loadFromGuid($patient_guid);
$dossier_medical = $patient->loadRefDossierMedical();
if ($dossier_medical->_id) {
    $dossier_medical->loadRefsAllergies();
    $dossier_medical->loadRefsAntecedents();
    $dossier_medical->countAntecedents(false);
    $dossier_medical->countAllergies();
}
$new_sejour_id = null;
$dossier_medical_sejour = new CDossierMedical();
if ($show_atcd && ($consult_id || $sejour_id)) {
    if ($consult_id) {
        $consult = new CConsultation();
        $consult->load($consult_id);
        $consult->loadRefPatient();
        $sejour = $consult->loadRefSejour();
Esempio n. 29
0
 * Envoi d'un docitem par mail
 *
 * @category CompteRendu
 * @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();
$nom = CValue::post("nom");
$email = CValue::post("email");
$subject = CValue::post("subject");
$body = CValue::post("body");
$object_guid = CValue::post("object_guid");
$object = CMbObject::loadFromGuid($object_guid);
/** @var $exchange_source CSourceSMTP */
$exchange_source = CExchangeSource::get("mediuser-" . CMediusers::get()->_id, "smtp");
$exchange_source->init();
if (CAppUI::pref('hprim_med_header')) {
    $body = $object->makeHprimHeader($exchange_source->email, $email) . "\n" . $body;
}
try {
    $exchange_source->setRecipient($email, $nom);
    $exchange_source->setSubject($subject);
    $exchange_source->setBody(nl2br($body));
    switch ($object->_class) {
        case "CCompteRendu":
            /** @var $object CCompteRendu */
            $object->makePDFpreview(true);
            $file = $object->_ref_file;
Esempio n. 30
0
 /**
  * Load the aggregation and format array to display in the search template
  *
  * @param array $aggregation the aggregation
  *
  * @return array
  */
 function loadAggregationLog($aggregation)
 {
     $objects_refs = array();
     $agg_user_date = $aggregation['date_log']['buckets'];
     foreach ($agg_user_date as $_agg) {
         $date = $_agg["key_as_string"] != "" ? CMbDT::format($_agg["key_as_string"], "%Y-%m-%d 00:00:00") : "";
         $agg_ref_user_id = $_agg['user_id']['buckets'];
         foreach ($agg_ref_user_id as $__agg) {
             $id_object = $__agg['key'] . " " . $date;
             $object = CMbObject::loadFromGuid("CMediusers-{$id_object}");
             $object->loadRefFunction();
             $objects_refs[$id_object]["date_log"] = $date;
             $objects_refs[$id_object]["object"] = $object;
             $agg_contexte = $__agg['contexte']['buckets'];
             foreach ($agg_contexte as $_key => $___agg) {
                 $key = $___agg['key'];
                 $count = $___agg['doc_count'];
                 $objects_refs[$id_object]['contexte'][$_key]['key'] = $key;
                 $objects_refs[$id_object]['contexte'][$_key]['count'] = $count;
             }
         }
     }
     return $objects_refs;
 }