示例#1
0
$plage = new CPlageOp();
/** @var COperation[] $urgences */
foreach ($urgences as &$urgence) {
    $urgence->loadRefsFwd();
    $urgence->loadRefAnesth();
    $urgence->_ref_chir->loadRefsFwd();
    $sejour = $urgence->_ref_sejour;
    $patient = $sejour->loadRefPatient();
    $sejour->loadRefGrossesse();
    $dossier_medical = $patient->loadRefDossierMedical();
    $dossier_medical->loadRefsAntecedents();
    $dossier_medical->countAntecedents();
    $dossier_medical->countAllergies();
    if ($reservation_installed) {
        $first_log = $urgence->loadFirstLog();
        if (abs(CMbDT::hoursRelative($urgence->_datetime_best, $first_log->date)) <= $diff_hour_urgence) {
            $urgence->_is_urgence = true;
        }
    }
    // Chargement des plages disponibles pour cette intervention
    $urgence->_ref_chir->loadBackRefs("secondary_functions");
    $secondary_functions = array();
    foreach ($urgence->_ref_chir->_back["secondary_functions"] as $curr_sec_func) {
        $secondary_functions[$curr_sec_func->function_id] = $curr_sec_func;
    }
    $where = array();
    $selectPlages = "(plagesop.chir_id = %1 OR plagesop.spec_id = %2\n    OR plagesop.spec_id " . CSQLDataSource::prepareIn(array_keys($secondary_functions)) . ")";
    $where[] = $ds->prepare($selectPlages, $urgence->chir_id, $urgence->_ref_chir->function_id);
    $where["date"] = "= '{$date}'";
    $where["salle_id"] = CSQLDataSource::prepareIn(array_keys($listSalles));
    $order = "salle_id, debut";
     // On simule une fin à 23h59 afin de rester dans la même journée
     $save_hour_fin_postop = "";
     if ($hour_fin_postop < $fin_op) {
         $save_hour_fin_postop = $hour_fin_postop;
         $hour_fin_postop = "23:59:59";
     }
     $offset_bottom = CMbDT::minutesRelative($fin_op, $hour_fin_postop);
     if ($save_hour_fin_postop) {
         $offset_bottom += CMbDT::minutesRelative("00:00:00", $save_hour_fin_postop);
         // On simule une fin à 23h59, alors il faut encore une minute pour aller jusqu'à 00h00
         $offset_bottom += 1;
     }
     $duree = $duree + $offset_bottom;
 }
 $datetime_creation = $workflow->date_creation ? $workflow->date_creation : $_operation->loadFirstLog()->date;
 $interv_en_urgence = abs(CMbDT::hoursRelative($_operation->_datetime_best, $datetime_creation)) <= $diff_hour_urgence;
 //factures
 $sejour->loadRefsFactureEtablissement();
 $facture = $sejour->_ref_last_facture;
 $_operation->loadLiaisonLibelle();
 //template de contenu
 $smarty = new CSmartyDP("modules/reservation");
 $smarty->assign("operation", $_operation);
 $smarty->assign("patient", $patient);
 $smarty->assign("sejour", $sejour);
 $smarty->assign("liaison_sejour", $liaison_sejour);
 $smarty->assign("charge", $charge);
 $smarty->assign("facture", $facture);
 $smarty->assign("debut_op", $debut_op);
 $smarty->assign("fin_op", $fin_op);
 $smarty->assign("lit", $lit);
示例#3
0
 /**
  * Cherche des séjours les dates d'entrée ou sortie sont proches,
  * pour le même patient dans le même établissement
  *
  * @param int  $tolerance Tolérance en heures
  * @param bool $use_type  Matche sur le type de séjour aussi
  *
  * @return CSejour[]
  */
 function getSiblings($tolerance = 1, $use_type = false)
 {
     $sejour = new CSejour();
     $sejour->patient_id = $this->patient_id;
     $sejour->group_id = $this->group_id;
     // Si on veut rechercher pour un type de séjour donné
     if ($use_type) {
         $sejour->type = $this->type;
     }
     /** @var CSejour[] $siblings */
     $siblings = $sejour->loadMatchingList();
     $this->updateFormFields();
     // Entree et sortie ne sont pas forcément stored
     $entree = $this->entree_reelle ? $this->entree_reelle : $this->entree_prevue;
     $sortie = $this->sortie_reelle ? $this->sortie_reelle : $this->sortie_prevue;
     foreach ($siblings as $_sibling) {
         if ($_sibling->_id == $this->_id) {
             unset($siblings[$_sibling->_id]);
             continue;
         }
         $entree_relative = abs(CMbDT::hoursRelative($entree, $_sibling->entree));
         $sortie_relative = abs(CMbDT::hoursRelative($sortie, $_sibling->sortie));
         if ($entree_relative > $tolerance && $sortie_relative > $tolerance) {
             unset($siblings[$_sibling->_id]);
         }
     }
     return $siblings;
 }