/**
  * @see parent::checkProperty()
  */
 function checkProperty($object)
 {
     $propValue =& $object->{$this->fieldName};
     $time_format = "/^\\d{1,2}:\\d{1,2}(:\\d{1,2})?\$/";
     // Format
     if (!preg_match($time_format, $propValue)) {
         if ($propValue === 'current' || $propValue === 'now') {
             $propValue = CMbDT::time();
             return null;
         }
         return "Format d'heure invalide";
     }
     // min
     if ($this->min) {
         if (!preg_match($time_format, $this->min)) {
             trigger_error("Spécification de minimum time invalide (min = {$this->min})", E_USER_WARNING);
             return "Erreur système";
         }
         if ($propValue < $this->min) {
             return "Doit avoir une valeur minimale de {$this->min}";
         }
     }
     // max
     if ($this->max) {
         if (!preg_match($time_format, $this->max)) {
             trigger_error("Spécification de maximum time invalide (max = {$this->max})", E_USER_WARNING);
             return "Erreur système";
         }
         if ($propValue > $this->max) {
             return "Doit avoir une valeur maximale de {$this->max}";
         }
     }
     return null;
 }
Beispiel #2
0
/**
 * $Id: inc_personnel.php 20938 2013-11-13 11:02:47Z aurelie17 $
 *
 * @package    Mediboard
 * @subpackage bloodSalvage
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 20938 $
 */
function loadAffected(&$blood_salvage_id, &$list_nurse_sspi, &$tabAffected, &$timingAffect)
{
    $affectation = new CAffectationPersonnel();
    $affectation->object_class = "CBloodSalvage";
    $affectation->object_id = $blood_salvage_id;
    $tabAffected = $affectation->loadMatchingList();
    foreach ($tabAffected as $key => $affect) {
        if (array_key_exists($affect->personnel_id, $list_nurse_sspi)) {
            unset($list_nurse_sspi[$affect->personnel_id]);
        }
        $affect->_ref_personnel->loadRefUser();
    }
    // Initialisations des tableaux des timings
    foreach ($tabAffected as $key => $affectation) {
        $timingAffect[$affectation->_id]["_debut"] = array();
        $timingAffect[$affectation->_id]["_fin"] = array();
    }
    // Remplissage des tableaux des timings
    foreach ($tabAffected as $id => $affectation) {
        foreach ($timingAffect[$affectation->_id] as $key => $value) {
            for ($i = -10; $i < 10 && $affectation->{$key} !== null; $i++) {
                $timingAffect[$affectation->_id][$key][] = CMbDT::time("{$i} minutes", $affectation->{$key});
            }
        }
    }
}
 /**
  * Range constructor
  *
  * @param string $guid      GUID
  * @param string $date      Date
  * @param int    $length    Length
  * @param string $title     Title
  * @param null   $color     Color
  * @param null   $css_class CSS class
  */
 function __construct($guid, $date, $length = 0, $title = "", $color = null, $css_class = null)
 {
     $this->guid = $guid;
     $this->internal_id = "CPlanningRange-" . uniqid();
     $this->start = $date;
     $this->length = $length;
     $this->title = CMbString::htmlEntities($title);
     $this->color = $color;
     $this->css_class = is_array($css_class) ? implode(" ", $css_class) : $css_class;
     if (preg_match("/[0-9]+ /", $this->start)) {
         $parts = split(" ", $this->start);
         $this->end = "{$parts[0]} " . CMbDT::time("+{$this->length} MINUTES", $parts[1]);
         $this->day = $parts[0];
         $this->hour = CMbDT::format($parts[1], "%H");
         $this->minutes = CMbDT::format($parts[1], "%M");
     } else {
         $this->day = CMbDT::date($date);
         $this->end = CMbDT::dateTime("+{$this->length} MINUTES", $date);
         $this->hour = CMbDT::format($date, "%H");
         $this->minutes = CMbDT::format($date, "%M");
     }
 }
/**
 * $Id$
 *
 * @category Admissions
 * @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();
//Initialisations des variables
$date = CValue::getOrSession("date", CMbDT::date());
$today = CMbDT::date();
$hour = CMbDT::time(null);
$board = CValue::get("board", 1);
$boardItem = CValue::get("boardItem", 1);
$consult = new CConsultation();
// Récupération des fonctions
$cabinets = CMediusers::loadFonctions();
// Récupération de la liste des anesthésistes
$mediuser = new CMediusers();
$anesthesistes = $mediuser->loadAnesthesistes(PERM_READ);
if ($consult->consultation_id) {
    $date = $consult->_ref_plageconsult->date;
    CValue::setSession("date", $date);
}
// Récupération des plages de consultation du jour et chargement des références
$listPlages = array();
foreach ($anesthesistes as $anesth) {
            $modificateur->_checked = $modificateur->code;
        } elseif ($modificateur->_double == "2") {
            $modificateur->_checked = $modificateur->code . $modificateur->_double;
        } else {
            $modificateur->_checked = null;
        }
    } else {
        $modificateur->_checked = null;
    }
}
/* Vérification et précodage des modificateurs */
if (CAppUI::conf('dPccam CCodeCCAM use_new_association_rules')) {
    CCodageCCAM::precodeModifiers($phase->_modificateurs, $acte, $acte->loadRefObject());
} elseif (!$acte->_id) {
    foreach ($phase->_modificateurs as $modificateur) {
        $modificateur->_checked = $acte->_ref_object->checkModificateur($modificateur->code, CMbDT::time($acte->execution));
    }
}
$acte->getMontantModificateurs($phase->_modificateurs);
// Liste des dents CCAM
$liste_dents = reset(CDentCCAM::loadList());
// Chargement des listes de praticiens
$user = new CMediusers();
$listAnesths = $user->loadAnesthesistes(PERM_DENY);
$listChirs = $user->loadPraticiens(PERM_DENY);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("acte", $acte);
$smarty->assign("code", $code);
$smarty->assign("activite", $activite);
$smarty->assign("phase", $phase);
Beispiel #6
0
 /**
  * Charge les actes CCAM codables en fonction des code CCAM fournis
  *
  * @param integer $praticien_id L'id du praticien auquel seront liés les actes
  *
  * @return void
  */
 function loadPossibleActes($praticien_id = 0)
 {
     $this->preparePossibleActes();
     $depassement_affecte = false;
     $depassement_anesth_affecte = false;
     $this->guessActesAssociation();
     // Check if depassement is already set
     $this->loadRefsActesCCAM();
     foreach ($this->_ref_actes_ccam as $_acte) {
         if ($_acte->code_activite == 1 && $_acte->montant_depassement) {
             $depassement_affecte = true;
         }
         if ($_acte->code_activite == 4 && $_acte->montant_depassement) {
             $depassement_anesth_affecte = true;
         }
     }
     // existing acts may only be affected once to possible acts
     $used_actes = array();
     if ($praticien_id) {
         $praticien = CMediusers::get($praticien_id);
         $executant_id = $praticien_id;
     } else {
         $praticien = $this->loadRefPraticien();
         $executant_id = 0;
     }
     $praticien->loadRefDiscipline();
     $this->loadRefPatient()->evalAge();
     $this->loadExtCodesCCAM();
     foreach ($this->_ext_codes_ccam as $code_ccam) {
         foreach ($code_ccam->activites as $activite) {
             foreach ($activite->phases as $phase) {
                 $possible_acte = new CActeCCAM();
                 $possible_acte->montant_depassement = "";
                 $possible_acte->code_acte = $code_ccam->code;
                 $possible_acte->code_activite = $activite->numero;
                 $possible_acte->_anesth = $activite->numero == 4;
                 $possible_acte->code_phase = $phase->phase;
                 $possible_acte->execution = CAppUI::pref("use_acte_date_now") ? CMbDT::dateTime() : $this->_acte_execution;
                 // Affectation du dépassement au premier acte de chirugie
                 if (!$depassement_affecte and $possible_acte->code_activite == 1) {
                     $possible_acte->montant_depassement = $this->_acte_depassement;
                     $depassement_affecte = true;
                 }
                 // Affectation du dépassement au premier acte d'anesthésie
                 if (!$depassement_anesth_affecte and $possible_acte->code_activite == 4) {
                     $possible_acte->montant_depassement = $this->_acte_depassement_anesth;
                     $depassement_anesth_affecte = true;
                 }
                 if (!$praticien_id) {
                     $executant_id = CAppUI::pref("user_executant") ? CMediusers::get()->_id : $this->getExecutantId($possible_acte->code_activite);
                 }
                 $possible_acte->executant_id = $executant_id;
                 $possible_acte->object_class = $this->_class;
                 $possible_acte->object_id = $this->_id;
                 if ($possible_acte->code_activite == 4) {
                     $possible_acte->extension_documentaire = $this->getExtensionDocumentaire($possible_acte->executant_id);
                 }
                 /* Gestion du champ remboursé */
                 if ($code_ccam->remboursement == 1) {
                     /* Cas ou l'acte est remboursable */
                     $possible_acte->rembourse = '1';
                 } else {
                     /* Cas ou l'acte est non */
                     $possible_acte->rembourse = '0';
                 }
                 $possible_acte->updateFormFields();
                 $possible_acte->loadRefExecutant();
                 $possible_acte->loadRefCodeCCAM();
                 if (CAppUI::conf('dPccam CCodeCCAM use_new_association_rules')) {
                     $possible_acte->loadRefCodageCCAM();
                 }
                 $possible_acte->getAnesthAssocie();
                 // Affect a loaded acte if exists
                 foreach ($this->_ref_actes_ccam as $_acte) {
                     if ($_acte->code_acte == $possible_acte->code_acte && $_acte->code_activite == $possible_acte->code_activite && $_acte->code_phase == $possible_acte->code_phase) {
                         if (!isset($used_actes[$_acte->acte_id])) {
                             $possible_acte = $_acte;
                             $used_actes[$_acte->acte_id] = true;
                             break;
                         }
                     }
                 }
                 if ($possible_acte->_id) {
                     $possible_acte->getTarif();
                 } else {
                     $possible_acte->getTarifSansAssociationNiCharge();
                 }
                 // Keep references !
                 $phase->_connected_acte = $possible_acte;
                 $listModificateurs = $phase->_connected_acte->modificateurs;
                 if (!$possible_acte->_id) {
                     $possible_acte->facturable = '1';
                     $possible_acte->checkFacturable();
                     if (CAppUI::conf('dPccam CCodeCCAM use_new_association_rules')) {
                         CCodageCCAM::precodeModifiers($phase->_modificateurs, $possible_acte, $this);
                         $possible_acte->getMontantModificateurs($phase->_modificateurs);
                     } else {
                         $possible_acte->getMontantModificateurs($phase->_modificateurs);
                         foreach ($phase->_modificateurs as $modificateur) {
                             $modificateur->_checked = $this->checkModificateur($modificateur->code, CMbDT::time($phase->_connected_acte->execution));
                         }
                     }
                 } else {
                     // Récupération des modificateurs codés
                     foreach ($phase->_modificateurs as $modificateur) {
                         /* Dans le cas des modificateurs doubles, les 2 composantes peuvent être séparées (IJKO dans le cas de IO par exemple) */
                         if ($modificateur->_double == "2") {
                             $position = strpos($listModificateurs, $modificateur->code[0]) !== false && strpos($listModificateurs, $modificateur->code[1]) !== false;
                         } else {
                             $position = strpos($listModificateurs, $modificateur->code);
                         }
                         if ($position !== false) {
                             if ($modificateur->_double == "1") {
                                 $modificateur->_checked = $modificateur->code;
                             } elseif ($modificateur->_double == "2") {
                                 $modificateur->_checked = $modificateur->code . $modificateur->_double;
                             } else {
                                 $modificateur->_checked = null;
                             }
                         } else {
                             $modificateur->_checked = null;
                         }
                     }
                     /* Vérification et précodage des modificateurs */
                     if (CAppUI::conf('dPccam CCodeCCAM use_new_association_rules')) {
                         CCodageCCAM::precodeModifiers($phase->_modificateurs, $possible_acte, $this);
                     }
                     $possible_acte->getMontantModificateurs($phase->_modificateurs);
                 }
             }
         }
     }
 }
Beispiel #7
0
 * @category Cabinet
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision: 28718 $
 * @link     http://www.mediboard.org
 */
CCanDo::checkEdit();
$user = CMediusers::get();
$date = CValue::getOrSession("date", CMbDT::date());
$vue = CValue::getOrSession("vue2", CAppUI::pref("AFFCONSULT", 0));
$prat_id = CValue::getOrSession("chirSel", $user->_id);
$selConsult = CValue::getOrSession("selConsult");
$dossier_anesth_id = CValue::getOrSession("dossier_anesth_id");
$today = CMbDT::date();
$hour = CMbDT::time();
$now = CMbDT::dateTime();
if (!isset($current_m)) {
    global $m;
    $current_m = CValue::get("current_m", $m);
}
if (isset($_GET["date"])) {
    $selConsult = null;
    CValue::setSession("selConsult", null);
}
// Test compliqué afin de savoir quelle consultation charger
$consult = new CConsultation();
$consult->load($selConsult);
if (isset($_GET["selConsult"])) {
    if ($consult->_id && $consult->patient_id) {
        $consult->loadRefPlageConsult();
Beispiel #8
0
 /**
  * Check the modifiers of the given act
  *
  * @param CObject   &$modifiers The modifiers to check
  * @param CActeCCAM &$act       The dateTime of the execution of the act
  * @param CCodable  $codable    The codable
  *
  * @return void
  */
 public static function precodeModifiers(&$modifiers, &$act, $codable)
 {
     $date = CMbDT::date(null, $act->execution);
     $time = CMbDT::time(null, $act->execution);
     $act->loadRefExecutant();
     $act->_ref_executant->loadRefDiscipline();
     $discipline = $act->_ref_executant->_ref_discipline;
     $patient = $codable->loadRefPatient();
     $patient->evalAge();
     $checked = 0;
     $spe_gyneco = $spe_gyneco = array('GYNECOLOGIE MEDICALE, OBSTETRIQUE', 'GYNECOLOGIE-OBSTETRIQUE', 'MEDECINE DE LA REPRODUCTION ET GYNECOLOGIE MEDICAL');
     $spe_gen_pediatre = array("MEDECINE GENERALE", "PEDIATRIE");
     $count_exclusive_modifiers = self::countExclusiveModifiers($act);
     $store_act = 0;
     $modifiers_to_add = "";
     $achieved = CMbDate::achievedDurations($patient->naissance, CMbDT::date(null, $act->execution));
     $patient_age = $achieved["year"];
     foreach ($modifiers as $_modifier) {
         switch ($_modifier->code) {
             case 'A':
                 $checked = $patient_age < 4 || $patient_age >= 80;
                 $_modifier->_state = $checked ? 'prechecked' : 'not_recommended';
                 break;
             case 'E':
                 $checked = $patient->_annees < 5;
                 $_modifier->_state = $checked ? 'prechecked' : 'not_recommended';
                 break;
             case 'F':
                 $checked = ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers == 0) && (CMbDT::transform('', $act->execution, '%w') == 0 || CMbDate::isHoliday($date)) && ($time > '08:00:00' && $time < '20:00:00');
                 if ($checked) {
                     $_modifier->_state = 'prechecked';
                 } elseif ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers > 0) {
                     $_modifier->_state = 'forbidden';
                 } else {
                     $_modifier->_state = 'not_recommended';
                 }
                 break;
             case "J":
                 $checked = $codable->_class == 'COperation' && CAppUI::pref('precode_modificateur_J');
                 $_modifier->_state = $checked ? 'prechecked' : null;
                 break;
             case 'K':
                 $checked = !$act->montant_depassement && ($act->_ref_executant->secteur == 1 || $act->_ref_executant->secteur == 2 && $patient->cmu || $act->_ref_executant->contrat_acces_soins || $act->_ref_executant->option_coordination);
                 if ($checked) {
                     $_modifier->_state = 'prechecked';
                 } elseif (!in_array($discipline, $spe_gyneco)) {
                     $_modifier->_state = 'not_recommended';
                 }
                 if (self::isModifierchecked('K', $act) && !$act->montant_depassement) {
                     $checked = true;
                 }
                 break;
             case 'L':
                 if (self::isModifierchecked('L', $act)) {
                     $_modifier->_state = 'prechecked';
                     $checked = true;
                 }
                 break;
             case 'M':
                 $checked = 0;
                 if (!in_array($discipline->text, $spe_gen_pediatre)) {
                     $_modifier->_state = 'not_recommended';
                 }
                 break;
             case 'N':
                 $checked = $patient->_annees < 13;
                 $_modifier->_state = $checked ? 'prechecked' : 'not_recommended';
                 break;
             case 'P':
                 $checked = ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers == 0) && in_array($discipline->text, $spe_gen_pediatre) && ($time > "20:00:00" && $time < "23:59:59");
                 if ($checked) {
                     $_modifier->_state = 'prechecked';
                 } elseif ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers > 0) {
                     $_modifier->_state = 'forbidden';
                 } else {
                     $_modifier->_state = 'not_recommended';
                 }
                 break;
             case 'R':
                 if (self::isModifierchecked('R', $act)) {
                     $_modifier->_state = 'prechecked';
                     $checked = true;
                 }
                 break;
             case 'S':
                 $checked = (in_array($discipline->text, $spe_gen_pediatre) || $codable->_class == "COperation" && $codable->_lu_type_anesth) && ($time >= "00:00:00" && $time < "08:00:00") && ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers == 0);
                 if ($checked) {
                     $_modifier->_state = 'prechecked';
                 } elseif ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers > 0) {
                     $_modifier->_state = 'forbidden';
                 } else {
                     $_modifier->_state = 'not_recommended';
                 }
                 break;
             case 'U':
                 $checked = ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers == 0) && !in_array($discipline->text, $spe_gen_pediatre) && ($time > '20:00:00' || $time < '08:00:00');
                 if ($checked) {
                     $_modifier->_state = 'prechecked';
                 } elseif ($count_exclusive_modifiers == 1 && $_modifier->_checked || $count_exclusive_modifiers > 0) {
                     $_modifier->_state = 'forbidden';
                 } else {
                     $_modifier->_state = 'not_recommended';
                 }
                 break;
             case "7":
                 $checked = CAppUI::pref('precode_modificateur_7') && $codable->_class == 'COperation' && (isset($codable->anesth_id) || $act->_ref_executant->isAnesth());
                 if ($checked) {
                     $_modifier->_state = 'prechecked';
                 } else {
                     $_modifier->_state = $codable->_class == 'COperation' && (isset($codable->anesth_id) || $act->_ref_executant->isAnesth()) ? null : 'not_recommended';
                 }
                 break;
             default:
                 $checked = 0;
                 break;
         }
         if (!$act->_id && !isset($_modifier->_checked)) {
             $_modifier->_checked = $checked;
         }
     }
     /* Handle the case where the mods S and U are both prechecked */
     if (isset($modifiers['S']) && isset($modifiers['U'])) {
         $modS =& $modifiers['S'];
         $modU =& $modifiers['U'];
         if ($modS->_state == 'prechecked' && $modU->_state == 'prechecked') {
             $modU->_checked = 0;
             $modU->_state = 'forbidden';
         }
     }
 }
        }
    }
    otherOrder($mouvementsNP, "np", $order_col, $order_way);
    $update_count = count($mouvements) . "/" . count($mouvementsNP);
    /** @var CAffectation[] $mouvements_by_service */
    /** @var CAffectation[] $mouvementsNP_by_service */
    $mouvements_by_service = array();
    $mouvementsNP_by_service = array();
    foreach ($mouvements as $_mouvement) {
        if (!isset($mouvements_by_service[$_mouvement->service_id])) {
            $mouvements_by_service[$_mouvement->service_id] = array();
        }
        $mouvements_by_service[$_mouvement->service_id][] = $_mouvement;
    }
    $mouvements = $mouvements_by_service;
    CSejour::massLoadCurrAffectation($mouvementsNP, $date . " " . CMbDT::time());
    foreach ($mouvementsNP as $_mouvement) {
        $_service_id = $_mouvement->service_id;
        if ($_mouvement->_ref_curr_affectation->service_id && !$_mouvement->_ref_curr_affectation->lit_id) {
            $_service_id = $_mouvement->_ref_curr_affectation->service_id;
        }
        if (!isset($mouvementsNP_by_service[$_service_id])) {
            $mouvementsNP_by_service[$_service_id] = array();
        }
        $mouvementsNP_by_service[$_service_id][] = $_mouvement;
    }
    $mouvementsNP = $mouvementsNP_by_service;
} else {
    // Patients placés
    $where["affectation.sortie"] = "BETWEEN '{$limit1}' AND '{$limit2}'";
    $where["sejour.sortie"] = "= affectation.sortie";
if (CValue::getOrSession("order_col_" . $type) == "_patient") {
    $sorter = CMbArray::pluck($listOperations, "_ref_patient", "nom");
    array_multisort($sorter, $order_way_final == "ASC" ? SORT_ASC : SORT_DESC, $listOperations);
    $order_col = CValue::getOrSession("order_col_" . $type);
}
// Création du template
$smarty = new CSmartyDP();
// Daily check lists
$smarty->assign("date_close_checklist", $date_close_checklist);
$smarty->assign("date_open_checklist", $date_open_checklist);
$smarty->assign("require_check_list", $require_check_list);
$smarty->assign("require_check_list_close", $require_check_list_close);
$smarty->assign("daily_check_lists", $daily_check_lists);
$smarty->assign("daily_check_list_types", $daily_check_list_types);
$smarty->assign("listChirs", $listChirs);
$smarty->assign("listAnesths", $listAnesths);
$smarty->assign("type", $type);
$smarty->assign("bloc_id", $bloc_id);
$smarty->assign("personnels", $personnels);
$smarty->assign("order_way", $order_way);
$smarty->assign("order_col", $order_col);
$smarty->assign("listOperations", $listOperations);
$smarty->assign("plages", $plages);
$smarty->assign("date", $date);
$smarty->assign("isbloodSalvageInstalled", CModule::getActive("bloodSalvage"));
$smarty->assign("hour", CMbDT::time());
$smarty->assign("modif_operation", $modif_operation);
$smarty->assign("isImedsInstalled", CModule::getActive("dPImeds") && CImeds::getTagCIDC($group));
$smarty->assign("nb_sorties_non_realisees", $nb_sorties_non_realisees);
$smarty->assign("is_anesth", $curr_user->isAnesth());
$smarty->display("inc_reveil_{$type}.tpl");
    }
}
// Ajout des plages, OK
foreach ($plages_by_salle as $salle_id => $_plages) {
    $i = array_search($salle_id, $salles_ids);
    CMbObject::massLoadRefsNotes($_plages);
    CMbObject::massLoadFwdRef($_plages, "chir_id");
    CMbObject::massLoadFwdRef($_plages, "anesth_id");
    CMbObject::massLoadFwdRef($_plages, "spec_id");
    foreach ($_plages as $_plage) {
        $_plage->loadRefsNotes();
        $_plage->loadRefChir()->loadRefFunction();
        $_plage->loadRefSpec();
        $_plage->loadRefAnesth()->loadRefFunction();
        $debut = "{$i} " . CMbDT::time($_plage->debut);
        $duree = CMbDT::minutesRelative(CMbDT::time($_plage->debut), CMbDT::time($_plage->fin));
        //fetch
        $smarty = new CSmartyDP("modules/reservation");
        $smarty->assign("plageop", $_plage);
        $smarty_plageop = $smarty->fetch("inc_planning/libelle_plageop.tpl");
        $smarty_plageop = htmlspecialchars_decode(CMbString::htmlEntities($smarty_plageop, ENT_NOQUOTES), ENT_NOQUOTES);
        $event = new CPlanningEvent($_plage->_guid, $debut, $duree, $smarty_plageop, "#efbf99", true, null, $_plage->_guid, false);
        $event->below = true;
        $event->type = "plage_planning";
        $event->plage["id"] = $_plage->_id;
        if ($can_edit) {
            $event->addMenuItem("edit", CMbString::htmlEntities("Modifier cette plage"));
            $event->addMenuItem("list", CMbString::htmlEntities("Gestion des interventions"));
        }
        $planning->addEvent($event);
    }
 * $Id$
 *
 * @package    Mediboard
 * @subpackage SalleOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$evenement_guid = CValue::get("evenement_guid");
$operation_id = CValue::get("operation_id");
$datetime = CValue::get("datetime");
$interv = new COperation();
$interv->load($operation_id);
$interv->loadRefAnesth();
if (!$datetime) {
    $datetime = CMbDT::date($interv->_datetime) . " " . CMbDT::time();
}
list($evenement_class, $evenement_id) = explode("-", $evenement_guid);
/** @var CAnesthPerop $evenement */
$evenement = new $evenement_class();
if ($evenement_id) {
    $evenement->load($evenement_id);
    $evenement->loadRefsNotes();
} else {
    $evenement->datetime = $datetime;
}
$evenement->operation_id = $interv->_id;
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("evenement", $evenement);
$smarty->assign("datetime", $datetime);
Beispiel #13
0
 /**
  * Load ref consult
  *
  * @return CConsultation
  */
 function loadRefConsult()
 {
     // Chargement de la consultation ATU
     if (!$this->_ref_sejour) {
         $this->loadRefSejour();
     }
     $sejour =& $this->_ref_sejour;
     $sejour->loadRefsConsultations();
     if (!CAppUI::conf("dPurgences create_sejour_hospit") && $this->mutation_sejour_id) {
         $this->loadRefSejourMutation()->loadRefsConsultations();
         $this->_ref_consult = $this->_ref_sejour_mutation->_ref_consult_atu;
     } else {
         $this->_ref_consult = $this->_ref_sejour->_ref_consult_atu;
     }
     // Calcul du l'attente
     $this->_attente = $this->_presence;
     if ($this->_ref_consult->_id) {
         $entree = CMbDT::time($this->_ref_sejour->_entree);
         $this->_attente = CMbDT::subTime(CMbDT::transform($entree, null, "%H:%M:00"), CMbDT::transform(CMbDT::time($this->_ref_consult->heure), null, "%H:%M:00"));
     }
     $this->_can_leave_level = $sejour->sortie_reelle ? "" : "ok";
     if (!$sejour->sortie_reelle) {
         if (!$this->_ref_consult->_id) {
             $this->_can_leave_level = "warning";
         }
         // En consultation
         if ($this->_ref_consult->chrono != 64) {
             $this->_can_leave = -1;
             $this->_can_leave_level = "warning";
         } else {
             if (CMbDT::time($sejour->sortie_prevue) > CMbDT::time()) {
                 $this->_can_leave_since = true;
                 $this->_can_leave = CMbDT::timeRelative(CMbDT::time(), CMbDT::time($sejour->sortie_prevue));
             } else {
                 $this->_can_leave_about = true;
                 $this->_can_leave = CMbDT::timeRelative(CMbDT::time($sejour->sortie_prevue), CMbDT::time());
             }
             if (CAppUI::conf("dPurgences rpu_warning_time") < $this->_can_leave) {
                 $this->_can_leave_level = "warning";
             }
             if (CAppUI::conf("dPurgences rpu_warning_time") < $this->_can_leave) {
                 $this->_can_leave_level = "error";
             }
         }
     }
     return $this->_ref_consult;
 }
 /**
  * @see parent::updatePlainFields()
  */
 function updatePlainFields()
 {
     if ($this->object_class == "COperation" || $this->object_class == "CBloodSalvage") {
         $this->loadRefObject();
         $this->_ref_object->loadRefPlageOp();
         if ($this->_debut == "current") {
             $this->_debut = CMbDT::time();
         }
         if ($this->_fin == "current") {
             $this->_fin = CMbDT::time();
         }
         if ($this->_debut !== null && $this->_debut != "") {
             $this->_debut = CMbDT::time($this->_debut);
             $this->debut = CMbDT::addDateTime($this->_debut, CMbDT::date($this->_ref_object->_datetime));
         }
         if ($this->_fin !== null && $this->_fin != "") {
             $this->_fin = CMbDT::time($this->_fin);
             $this->fin = CMbDT::addDateTime($this->_fin, CMbDT::date($this->_ref_object->_datetime));
         }
         if ($this->_debut_dt !== null && $this->_debut_dt != "") {
             $this->debut = $this->_debut_dt;
         }
         if ($this->_fin_dt !== null && $this->_fin_dt != "") {
             $this->fin = $this->_fin_dt;
         }
         // Suppression de la valeur
         if ($this->_debut === "") {
             $this->debut = "";
         }
         if ($this->_fin === "") {
             $this->fin = "";
         }
         // Mise a jour du champ realise
         if ($this->debut !== null && $this->fin !== null) {
             $this->realise = 1;
         }
         if ($this->debut === "" || $this->fin === "") {
             $this->realise = 0;
         }
     }
 }
Beispiel #15
0
    $lit = $_affectation->loadRefLit();
    $lit->loadRefChambre()->loadRefService();
    $sejour = $_affectation->loadRefSejour();
    $sejour->loadRefPraticien();
    $patient = $_affectation->_ref_sejour->loadRefPatient();
    $patient->loadIPP();
    $list_affectations[$key]["nom"] = $patient->nom;
    $list_affectations[$key]["prenom"] = $patient->prenom;
    $list_affectations[$key]["id"] = $IPP ? $patient->_IPP : $patient->_id;
    $list_affectations[$key]["service"] = $lit->_ref_chambre->_ref_service->_id;
    $list_affectations[$key]["chambre"] = $lit->_ref_chambre->_id;
    $list_affectations[$key]["lit"] = $lit->_id;
    $list_affectations[$key]["sexe"] = $patient->sexe;
    $list_affectations[$key]["naissance"] = CMbDT::format($patient->naissance, "%Y%m%d");
    $list_affectations[$key]["date_entree"] = CMbDT::format(CMbDT::date($sejour->entree), "%Y%m%d");
    $list_affectations[$key]["heure_entree"] = CMbDT::format(CMbDT::time($sejour->entree), "%H%M");
    $list_affectations[$key]["date_sortie"] = CMbDT::format(CMbDT::date($sejour->sortie), "%Y%m%d");
    $list_affectations[$key]["heure_sortie"] = CMbDT::format(CMbDT::time($sejour->sortie), "%H%M");
    $list_affectations[$key]["type"] = $sejour->type;
    if ($detail_lit) {
        $list_affectations[$key]["lit_nom"] = $lit->nom;
        $list_affectations[$key]["chambre_nom"] = $lit->_ref_chambre->nom;
        $list_affectations[$key]["nom_naissance"] = $patient->nom_jeune_fille;
    }
}
header("Content-Type: text/plain;");
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("list_affectations", $list_affectations);
$smarty->assign("detail_lit", $detail_lit);
$smarty->display("get_etat_lits_txt.tpl");
        }
        // Chargement de la categorie
        $consultation->loadRefCategorie();
        $consultation->loadRefConsultAnesth();
        $consult_anesth = $consultation->_ref_consult_anesth;
        if ($consult_anesth->operation_id) {
            $consult_anesth->loadRefOperation();
            $consult_anesth->_ref_operation->loadRefPraticien(true);
            $consult_anesth->_ref_operation->loadRefPlageOp(true);
            $consult_anesth->_ref_operation->loadExtCodesCCAM();
            $consult_anesth->_date_op =& $consult_anesth->_ref_operation->_ref_plageop->date;
        }
        $keyPlace = CMbDT::timeCountIntervals($plage->debut, $consultation->heure, $plage->freq);
        for ($i = 0; $i < $consultation->duree; $i++) {
            if (!isset($plage->listPlace[$keyPlace + $i]["time"])) {
                $plage->listPlace[$keyPlace + $i]["time"] = CMbDT::time("+ " . $plage->_freq * $i . " minutes", $consultation->heure);
                @($plage->listPlace[$keyPlace + $i]["consultations"][] = $consultation);
            } else {
                @($plage->listPlace[$keyPlace + $i]["consultations"][] = $consultation);
            }
        }
    }
}
// Suppression des plages vides
if (!$filter->_plages_vides) {
    foreach ($listPlage as $plage) {
        if (!count($plage->_ref_consultations)) {
            unset($listPlage[$plage->_id]);
        }
    }
}
Beispiel #17
0
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 24015 $
 */
$prat_id = CValue::post("prat_id");
$consult = new CConsultation();
$consult->load(CValue::post("consultation_id"));
$consult->loadRefPlageConsult();
$_datetime = $consult->_datetime;
if (!isset($current_m)) {
    $current_m = CValue::post("current_m", "dPcabinet");
}
$day_now = CMbDT::format($_datetime, "%Y-%m-%d");
$time_now = CMbDT::format($_datetime, "%H:%M:00");
$hour_now = CMbDT::format($_datetime, "%H:00:00");
$hour_next = CMbDT::time("+1 HOUR", $hour_now);
$plage = new CPlageconsult();
$plageBefore = new CPlageconsult();
$plageAfter = new CPlageconsult();
// Cas ou une plage correspond
$where = array();
$where["chir_id"] = "= '{$prat_id}'";
$where["date"] = "= '{$day_now}'";
$where["debut"] = "<= '{$time_now}'";
$where["fin"] = "> '{$time_now}'";
$plage->loadObject($where);
if (!$plage->_id) {
    // Cas ou on a des plage en collision
    $where = array();
    $where["chir_id"] = "= '{$prat_id}'";
    $where["date"] = "= '{$day_now}'";
$smarty->assign("atc_classes", $atc_classes);
if (CModule::getActive("dPprescription")) {
    $smarty->assign("prescription", $prescription);
    $smarty->assign("tabHours", $tabHours);
    $smarty->assign("prescription_id", $prescription->_id);
    $smarty->assign("categorie", new CCategoryPrescription());
    $smarty->assign("count_composition_dossier", $count_composition_dossier);
    $smarty->assign("composition_dossier", $composition_dossier);
    $smarty->assign("bornes_composition_dossier", $bornes_composition_dossier);
    $smarty->assign("configs", $configs);
}
$smarty->assign("sejour", $sejour);
$smarty->assign("date", $date);
$smarty->assign("now", CMbDT::dateTime());
$smarty->assign("real_date", CMbDT::date());
$smarty->assign("real_time", CMbDT::time());
$smarty->assign("operations", $operations);
$smarty->assign("mode_dossier", $mode_dossier);
$smarty->assign("prev_date", CMbDT::date("- 1 DAY", $date));
$smarty->assign("next_date", CMbDT::date("+ 1 DAY", $date));
$smarty->assign("today", CMbDT::date());
$smarty->assign("move_dossier_soin", false);
$smarty->assign("params", CConstantesMedicales::$list_constantes);
$smarty->assign("hide_close", $hide_close);
$smarty->assign("manual_planif", $planif_manuelle);
$smarty->assign("regroup_lines", $regroup_lines);
$smarty->assign("hide_old_lines", $hide_old_lines);
$smarty->assign("hidden_lines_count", $hidden_lines_count);
$smarty->assign("hide_line_inactive", $hide_line_inactive);
$smarty->assign("hide_inactive_count", $hide_inactive_count);
// Affichage d'une ligne
Beispiel #19
0
        $week_a = CMbDT::transform($temp_datetime, null, "%V");
        $week_b = CMbDT::transform($datetime, null, "%V");
        // les semaines
        $days[$datetime] = $week_b;
        // On stocke le changement de mois s'il advient
        if (CMbDT::transform($datetime, null, "%m") != CMbDT::transform($temp_datetime, null, "%m")) {
            // Entre deux semaines
            if ($i % 7 == 0) {
                $change_month[$week_a] = array("right" => $temp_datetime);
                $change_month[$week_b] = array("left" => $datetime);
            } else {
                $change_month[$week_b] = array("left" => $temp_datetime, "right" => $datetime);
            }
        }
    } else {
        if ($granularite == "week" && CMbDT::date($current) == CMbDT::date($temp_datetime) && CMbDT::time($datetime) >= CMbDT::time($temp_datetime) && CMbDT::time($current) <= CMbDT::time($datetime)) {
            $current = $temp_datetime;
        }
        // le datetime, pour avoir soit le jour soit l'heure
        $days[] = CMbDT::date($datetime);
    }
    $temp_datetime = $datetime;
}
$days = array_unique($days);
// Cas de la semaine 00
if ($granularite == "4weeks" && count($days) == 5) {
    array_pop($days);
}
$where["sejour.entree"] = "< '{$date_max}'";
$where["sejour.sortie"] = "> '{$date_min}'";
if ($duree_uscpo) {
 * $Id$
 *
 * @package    Mediboard
 * @subpackage bloodSalvage
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$blood_salvage_id = CValue::getOrSession("blood_salvage_id");
$date = CValue::getOrSession("date", CMbDT::date());
$modif_operation = CCanDo::edit() || $date >= CMbDT::date();
$timing = CValue::getOrSession("timing");
$blood_salvage = new CBloodSalvage();
if ($blood_salvage_id) {
    $blood_salvage->load($blood_salvage_id);
    $timing["_recuperation_start"] = array();
    $max_add_minutes = CAppUI::conf("dPsalleOp max_add_minutes");
    foreach ($timing as $key => $value) {
        for ($i = -CAppUI::conf("dPsalleOp max_sub_minutes"); $i < $max_add_minutes && $blood_salvage->{$key} !== null; $i++) {
            $timing[$key][] = CMbDT::time("{$i} minutes", $blood_salvage->{$key});
        }
    }
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("blood_salvage", $blood_salvage);
$smarty->assign("date", $date);
$smarty->assign("modif_operation", $modif_operation);
$smarty->assign("timing", $timing);
$smarty->display("inc_vw_recuperation_start_timing.tpl");
} else {
    $where["sejour.praticien_id"] = "= '{$chirSel}'";
}
$where["sejour.entree"] = "<= '{$date} 23:59:59'";
$where["sejour.sortie"] = ">= '{$date} 00:00:00'";
$where["sejour.annule"] = "= '0'";
$where["sejour.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
$sejour = new CSejour();
/** @var CSejour[] $listSejours */
$listSejours = $sejour->loadList($where, null, null, null, $ljoin);
CStoredObject::massLoadFwdRef($listSejours, "patient_id");
foreach ($listSejours as $_sejour) {
    $_sejour->loadRefPraticien();
    $_sejour->loadRefPatient();
    $_sejour->loadRefsOperations();
    $_sejour->loadRefCurrAffectation("{$date} " . CMbDT::time());
    $_sejour->_ref_curr_affectation->loadRefLit();
    $_sejour->_ref_curr_affectation->_ref_lit->loadCompleteView();
}
$lits = CMbArray::pluck($listSejours, "_ref_curr_affectation", "_ref_lit");
$sorter_chambre = CMbArray::pluck($lits, "_ref_chambre", "_view");
$sorter_service = CMbArray::pluck($lits, "_ref_chambre", "_ref_service", "_view");
$sorter_lit = CMbArray::pluck($lits, "_view");
$sorter_sejour_sortie = CMbArray::pluck($listSejours, "sortie");
$sorter_sejour_entree = CMbArray::pluck($listSejours, "entree");
array_multisort($sorter_service, SORT_ASC, $sorter_chambre, SORT_ASC, $sorter_lit, SORT_ASC, $sorter_sejour_sortie, SORT_ASC, $sorter_sejour_entree, SORT_DESC, $listSejours);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("praticien", $praticien);
$smarty->assign("listSejours", $listSejours);
// L'utilisateur est-il praticien ?
$chir = null;
$mediuser = CMediusers::get();
if ($mediuser->isPraticien()) {
    $chir = $mediuser->createUser();
}
// Praticien selectionné
$chirSel = CValue::getOrSession("chirSel", $chir ? $chir->user_id : null);
// Type de vue
$show_payees = CValue::getOrSession("show_payees", 1);
$show_annulees = CValue::getOrSession("show_annulees", 0);
// Plage de consultation selectionnée
$plageconsult_id = CValue::getOrSession("plageconsult_id", null);
$plageSel = new CPlageconsult();
if ($plageconsult_id === null && $chirSel && $is_in_period) {
    $nowTime = CMbDT::time();
    $where = array("chir_id = '{$chirSel}' OR remplacant_id = '{$chirSel}' OR pour_compte_id = '{$chirSel}'", "date" => "= '{$today}'", "debut" => "<= '{$nowTime}'", "fin" => ">= '{$nowTime}'");
    $plageSel->loadObject($where);
}
if (!$plageSel->plageconsult_id) {
    $plageSel->load($plageconsult_id);
} else {
    $plageconsult_id = $plageSel->plageconsult_id;
}
$plageSel->loadRefChir();
$plageSel->loadRefRemplacant();
$plageSel->loadRefPourCompte();
$plageSel->loadRefsNotes();
$plageSel->loadRefsBack($show_annulees, true, $show_payees);
if ($plageSel->_affected && count($plageSel->_ref_consultations)) {
    $firstconsult = reset($plageSel->_ref_consultations);
 /**
  * Return the time of the object
  *
  * @param CMbObject $object Reference Object
  *
  * @return null|time
  */
 function getHourWithObject($object)
 {
     $heure = null;
     switch (get_class($object)) {
         case "COperation":
             /** @var COperation $object */
             $time_operation = $object->time_operation == "00:00:00" ? null : $object->time_operation;
             $heure = CValue::first($object->debut_op, $object->entree_salle, $time_operation, $object->horaire_voulu);
             break;
         case "CConsultation":
             /** @var CConsultation $object */
             $heure = $object->heure;
             break;
         case "CSejour":
             /** @var CSejour $object */
             $heure = CMbDT::time($object->entree);
             break;
     }
     return $heure;
 }
 /**
  * @see parent::updatePlainFields()
  */
 function updatePlainFields()
 {
     $this->loadRefPlageOp();
     if ($this->_recuperation_start == "current") {
         $this->_recuperation_start = CMbDT::time();
     }
     if ($this->_recuperation_end == "current") {
         $this->_recuperation_end = CMbDT::time();
     }
     if ($this->_transfusion_start == "current") {
         $this->_transfusion_start = CMbDT::time();
     }
     if ($this->_transfusion_end == "current") {
         $this->_transfusion_end = CMbDT::time();
     }
     if ($this->_recuperation_start !== null && $this->_recuperation_start != "") {
         $this->_recuperation_start = CMbDT::time($this->_recuperation_start);
         $this->recuperation_start = CMbDT::addDateTime($this->_recuperation_start, CMbDT::date($this->_datetime));
     }
     if ($this->_recuperation_start === "") {
         $this->recuperation_start = "";
     }
     if ($this->_recuperation_end !== null && $this->_recuperation_end != "") {
         $this->_recuperation_end = CMbDT::time($this->_recuperation_end);
         $this->recuperation_end = CMbDT::addDateTime($this->_recuperation_end, CMbDT::date($this->_datetime));
     }
     if ($this->_recuperation_end === "") {
         $this->recuperation_end = "";
     }
     if ($this->_transfusion_start !== null && $this->_transfusion_start != "") {
         $this->_transfusion_start = CMbDT::time($this->_transfusion_start);
         $this->transfusion_start = CMbDT::addDateTime($this->_transfusion_start, CMbDT::date($this->_datetime));
     }
     if ($this->_transfusion_start === "") {
         $this->transfusion_start = "";
     }
     if ($this->_transfusion_end !== null && $this->_transfusion_end != "") {
         $this->_transfusion_end = CMbDT::time($this->_transfusion_end);
         $this->transfusion_end = CMbDT::addDateTime($this->_transfusion_end, CMbDT::date($this->_datetime));
     }
     if ($this->_transfusion_end === "") {
         $this->transfusion_end = "";
     }
 }
$sejour = new CSejour();
$where = array();
$where["sejour.grossesse_id"] = "IS NOT NULL";
$where["sejour.entree"] = "<= '{$date} 23:59:59' ";
$where["sejour.sortie"] = ">= '{$date} 00:00:00' ";
$where["sejour.group_id"] = " = '{$group->_id}' ";
$order = "sejour.entree DESC";
/** @var CSejour[] $listSejours */
$listSejours = $sejour->loadList($where, $order, null, null, null);
$grossesses = CMbObject::massLoadFwdRef($listSejours, "grossesse_id");
CMbObject::massLoadFwdRef($grossesses, "parturiente_id");
$naissances = CMbObject::massLoadBackRefs($grossesses, "naissances");
$sejours_enfant = CMbObject::massLoadFwdRef($naissances, "sejour_enfant_id");
CMbObject::massLoadFwdRef($sejours_enfant, "patient_id");
foreach ($listSejours as $_sejour) {
    $grossesse = $_sejour->loadRefGrossesse();
    $grossesse->loadRefParturiente();
    $naissances = $grossesse->loadRefsNaissances();
    $grossesse->_ref_sejour = $_sejour;
    $grossesse->loadRefLastOperation();
    foreach ($naissances as $_naissance) {
        $_naissance->loadRefSejourEnfant()->loadRefPatient();
        $_naissance->loadRefOperation();
    }
    $_sejour->loadRefCurrAffectation($date . " " . CMbDT::time());
    $grossesse->getDateAccouchement();
}
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("listSejours", $listSejours);
$smarty->display("inc_tdb_hospitalisations.tpl");
Beispiel #26
0
    // cp of the current group
    $tplHeader->assign("browser", $browser);
    $tplHeader->assign("errorMessage", CAppUI::getMsg());
    $tplHeader->assign("Etablissements", $etablissements);
    $tplHeader->assign("applicationVersion", $applicationVersion);
    $tplHeader->assign("allInOne", CValue::get("_aio"));
    $tplHeader->assign("portal", array("help" => mbPortalURL($m, $tab), "tracker" => mbPortalURL("tracker")));
    $tplHeader->display("header.tpl");
}
// Check muters
if ($muters = CValue::get("muters")) {
    $muters = explode("-", $muters);
    if (count($muters) % 2 != 0) {
        trigger_error("Muters should come by min-max intervals time pairs", E_USER_WARNING);
    } else {
        $time_now = CMbDT::time();
        while (count($muters)) {
            $time_min = array_shift($muters);
            $time_max = array_shift($muters);
            if (CMbRange::in($time_now, $time_min, $time_max)) {
                CAppUI::stepMessage(UI_MSG_OK, "msg-common-system-muted", $time_now, $time_min, $time_max);
                return;
            }
        }
    }
}
// Check whether we should trace SQL queries
if ($query_trace = CValue::get("query_trace")) {
    CSQLDataSource::$trace = true;
}
if ($query_report = CValue::get("query_report")) {
 * @package    Mediboard
 * @subpackage Soins
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 27852 $
 */
ob_clean();
CApp::setMemoryLimit("1024M");
CApp::setTimeLimit(240);
$service_id = CValue::get("service_id");
$date = CValue::get("date", CMbDT::date());
$service = new CService();
$service->load($service_id);
$datetime_min = "{$date} 00:00:00";
$datetime_max = "{$date} 23:59:59";
$datetime_avg = "{$date} " . CMbDT::time();
$sejour = new CSejour();
$where = array();
$ljoin = array();
$ljoin["affectation"] = "sejour.sejour_id = affectation.sejour_id";
$where["sejour.entree"] = "<= '{$datetime_max}'";
$where["sejour.sortie"] = " >= '{$datetime_min}'";
$where["affectation.entree"] = "<= '{$datetime_max}'";
$where["affectation.sortie"] = ">= '{$datetime_min}'";
$where["affectation.service_id"] = " = '{$service_id}'";
/** @var CSejour[] $sejours */
$sejours = $sejour->loadList($where, null, null, "sejour.sejour_id", $ljoin);
$ordonnances = array();
foreach ($sejours as $_sejour) {
    $_prescription = $_sejour->loadRefPrescriptionSejour();
    $_patient = $_sejour->loadRefPatient();
Beispiel #28
0
 public function setEventIdentification()
 {
     $event_identification = $this->msg_xml->addElement($this->audit_message, 'EventIdentification');
     $this->msg_xml->addAttribute($event_identification, 'EventActionCode', 'E');
     $this->msg_xml->addAttribute($event_identification, 'EventDateTime', CMbDT::date(null, $this->hl7_xml_msh_data['dateHeureProduction']) . 'T' . CMbDT::time(null, $this->hl7_xml_msh_data['dateHeureProduction']) . 'Z');
     $this->event_identification = $event_identification;
     $this->setEventOutcomeIndicatorAttribute();
     $this->setEventID();
     $this->setEventTypeCode();
 }
/**
 * Calcul le taux d'utilisation de prise de rendez-vous par créneaux de 5 minutes
 *
 * @param CPlageconsult[] $plages Plages
 * @param array           $list   Liste
 * @param CPlageconsult   $plage  Plage
 *
 * @return array
 */
function utilisation_rdv($plages, $list, $plage)
{
    $utilisation = array();
    // Granularité de 5 minutes.
    // 288 créneaux de 5 minutes dans 24 heures
    for ($i = 0; $i < 288; $i++) {
        $time = CMbDT::time($i * 5 . " minutes", $plage->debut);
        $utilisation[$time] = 0;
        if ($time == $plage->fin) {
            break;
        }
    }
    foreach ($plages as $_plage) {
        $rdvs = $_plage->loadRefsConsultations(false);
        $freq = CMbDT::transform($_plage->freq, null, "%M");
        foreach ($rdvs as $_rdv) {
            $nb_cases = $_rdv->duree * $freq / 5;
            for ($i = 0; $i < $nb_cases; $i++) {
                $time = CMbDT::time($i * 5 . " minutes", $_rdv->heure);
                if (!isset($utilisation[$time])) {
                    continue;
                }
                $utilisation[$time]++;
            }
        }
    }
    ksort($utilisation);
    // Granularité à la fréquence des consultations de la plage
    $creneaux = array_flip(CMbArray::pluck($list, "time"));
    $save_key = 0;
    foreach ($utilisation as $key => $_util) {
        if (!isset($creneaux[$key]) && isset($utilisation[$save_key])) {
            $utilisation[$save_key] = max($_util, $utilisation[$save_key]);
            unset($utilisation[$key]);
        } else {
            $utilisation[$key] = $_util;
            $save_key = $key;
        }
    }
    return $utilisation;
}
Beispiel #30
0
        $nbIntervNonPlacees += $plage->_count_operations - $plage->_count_operations_placees;
        $plage->loadAffectationsPersonnel();
        $plage->fin = min($plage->fin, $max);
        $plage->debut = max($plage->debut, $min);
        $plage->updateFormFields();
        $plage->makeView();
        if ($plage->debut >= $plage->fin) {
            unset($listPlages[$keyDate][$plage->_id]);
        }
    }
    // Remplissage du tableau de visualisation
    foreach ($listPlages[$keyDate] as $plage) {
        $plage->debut = CMbDT::timeGetNearestMinsWithInterval($plage->debut, CPlageOp::$minutes_interval);
        $plage->fin = CMbDT::timeGetNearestMinsWithInterval($plage->fin, CPlageOp::$minutes_interval);
        $plage->_nbQuartHeure = CMbDT::timeCountIntervals($plage->debut, $plage->fin, "00:" . CPlageOp::$minutes_interval . ":00");
        for ($time = $plage->debut; $time < $plage->fin; $time = CMbDT::time("+" . CPlageOp::$minutes_interval . " minutes", $time)) {
            $affichages["{$keyDate}-{$time}"] = "full";
        }
        $affichages["{$keyDate}-{$plage->debut}"] = $plage->_id;
    }
    // Ajout des interventions hors plage
    foreach ($horsPlages as $_op) {
        if ($_op->salle_id) {
            $affichages["{$keyDate}-HorsPlage"][$_op->_id] = $_op;
        }
    }
}
//Création du template
$smarty = new CSmartyDP();
$smarty->assign("listPlages", $listPlages);
$smarty->assign("listDays", $listDays);