Beispiel #1
0
     foreach ($constantes as $_constante) {
         $_constante->loadRefUser();
         $_constante->_ref_context = $sejours[$_constante->context_id];
         $trans_and_obs[$_constante->patient_id][$_constante->datetime][] = $_constante;
     }
     // Tri des transmission, observations et constantes par date décroissante
     foreach ($trans_and_obs as &$_trans) {
         krsort($_trans, SORT_STRING);
     }
 }
 if ($do_medicaments || $do_injections || $do_perfusions || $do_aerosols || $do_elements || $do_stupefiants) {
     $prescription = new CPrescription();
     $wherePresc = array();
     $wherePresc["object_class"] = " = 'CSejour'";
     $wherePresc["object_id"] = CSQLDataSource::prepareIn(array_keys($sejours));
     $prescriptions = $prescription->loadList($wherePresc);
     foreach ($prescriptions as $_prescription) {
         $sejour = $sejours[$_prescription->object_id];
         $_prescription->_ref_object = $sejour;
         // Chargement des lignes
         $_prescription->loadRefsLinesMed("1", "1", "service");
         if ($do_elements) {
             $_prescription->loadRefsLinesElementByCat("1", "1", "", "service");
         }
         if ($do_perfusions || $do_aerosols || $do_stupefiants) {
             $_prescription->loadRefsPrescriptionLineMixes();
         }
         // Calcul du plan de soin
         $_prescription->calculPlanSoin($dates);
         if ($do_medicaments || $do_injections || $do_perfusions || $do_aerosols || $do_stupefiants) {
             if ($do_perfusions || $do_aerosols || $do_stupefiants) {
    }
} else {
    if ($praticien_id) {
        $wheres = array("prescription_line_element.praticien_id    = '{$praticien_id}'", "prescription_line_medicament.praticien_id = '{$praticien_id}'", "prescription_line_mix.praticien_id        = '{$praticien_id}'");
    }
}
if (count($wheres)) {
    $keys = array();
    foreach ($wheres as $_i => $_where) {
        $where[0] = $_where;
        // Pour ne pas afficher les prescriptions en double (== group by prescription_id)
        if (count($keys)) {
            $where["prescription.prescription_id"] = $prescription->_spec->ds->prepareNotIn($keys);
        }
        $ljoin[$leftjoins[$_i][0]] = $leftjoins[$_i][1];
        $_prescriptions = $prescription->loadList($where, null, null, "prescription_id", $ljoin);
        $keys = array_merge($keys, array_keys($_prescriptions));
        $prescriptions = array_merge($prescriptions, $_prescriptions);
        $ljoin = $ljoin_save;
    }
    foreach ($prescriptions as $_presc) {
        $_presc->_ref_object->loadRefPatient();
    }
    array_multisort(CMbArray::pluck($prescriptions, "_ref_object", "_ref_patient", "nom"), SORT_ASC, $prescriptions);
} else {
    $prescriptions = $prescription->loadList($where, "patients.nom", null, "prescription_id", $ljoin);
}
if ($type_prescription == "sortie_manquante") {
    foreach ($prescriptions as $_prescription) {
        // Recherche d'une prescription de sortie correspondant à la prescription de sejour
        $_prescription_sortie = new CPrescription();
Beispiel #3
0
    $ljoin = array();
    $ljoin["sejour"] = "prescription.object_id = sejour.sejour_id";
    $ljoin["affectation"] = "sejour.sejour_id = affectation.sejour_id";
    $where = array();
    $where["prescription.object_class"] = " = 'CSejour'";
    $where["prescription.type"] = " = 'sejour'";
    $where["affectation.service_id"] = " = '{$service_id}'";
    if ($real_time) {
        $time = CMbDT::time();
        $where["affectation.entree"] = " <= '{$date} {$time}'";
        $where["affectation.sortie"] = " >= '{$date} {$time}'";
    } else {
        $where["affectation.entree"] = " < '{$date} 23:59:59'";
        $where["affectation.sortie"] = " > '{$date} 00:00:00'";
    }
    $prescriptions = $prescription->loadList($where, null, null, "prescription.prescription_id", $ljoin);
}
// Recuperation de l'heure courante
$time = CMbDT::format(null, "%H");
$tabHours = CAdministration::getTimingPlanSoins($date, $configs);
$nb_decalage = $configs["Nombre postes avant"];
$planif_manuelle = CAppUI::conf("dPprescription CPrescription planif_manuelle", $group->_guid);
$composition_dossier = array();
$bornes_composition_dossier = array();
$count_composition_dossier = array();
$date_min = "";
$date_max = "";
foreach ($tabHours as $_key_date => $_period_date) {
    foreach ($_period_date as $_key_periode => $_period_dates) {
        $count_composition_dossier[$_key_date][$_key_periode] = $planif_manuelle ? 3 : 2;
        $first_date = reset(array_keys($_period_dates));