예제 #1
0
$where = array();
$where["entree"] = "< '{$next}'";
$where["sortie"] = "> '{$date}'";
$where["group_id"] = "= '{$group->_id}'";
$where["annule"] = "= '0'";
$order = array();
$order[] = "sortie";
$order[] = "entree";
$step = 30;
$limit = "{$page},{$step}";
/** @var CSejour[] $listSejours */
$count = $sejour->countList($where);
$listSejours = $sejour->loadList($where, $order, $limit);
$patients = CSejour::massLoadFwdRef($listSejours, "patient_id");
$ipps = CPatient::massLoadIPP($patients);
$ndas = CSejour::massLoadNDA($listSejours);
$praticiens = CSejour::massLoadFwdRef($listSejours, "praticien_id");
CMediusers::massLoadFwdRef($praticiens, "function_id");
CSejour::massLoadFwdRef($listSejours, "group_id");
CSejour::massLoadFwdRef($listSejours, "etablissement_sortie_id");
CSejour::massLoadFwdRef($listSejours, "service_sortie_id");
CSejour::massLoadFwdRef($listSejours, "service_sortie_id");
foreach ($listSejours as $_sejour) {
    $_sejour->_ref_patient = $patients[$_sejour->patient_id];
    $_sejour->loadRefPraticien();
    $_sejour->loadExtCodesCCAM();
    $_sejour->loadRefsFactureEtablissement();
    $_sejour->countActes();
    $_sejour->loadRefTraitementDossier();
}
// Création du template
예제 #2
0
        $where["sejour.annule"] = " = '0'";
        if (CAppUI::conf("dPurgences create_sejour_hospit")) {
            $where["rpu.mutation_sejour_id"] = "IS NULL";
        }
        break;
    default:
        $where["affectation.entree"] = "<= '{$datetime_max}'";
        $where["affectation.sortie"] = ">= '{$datetime_min}'";
        $where["affectation.service_id"] = " = '{$service_id}'";
}
$patients_offline = array();
/** @var CSejour[] $sejours */
$sejours = $sejour->loadList($where, null, null, "sejour.sejour_id", $ljoin);
CSejour::massLoadSurrAffectation($sejours, $datetime_avg);
CSejour::massLoadCurrAffectation($sejours, $datetime_avg, $service_id);
CSejour::massLoadNDA($sejours);
/** @var CPatient[] $patients */
$patients = CStoredObject::massLoadFwdRef($sejours, "patient_id");
CPatient::massLoadIPP($patients);
CStoredObject::massCountBackRefs($sejours, "operations");
// Recherche de transmissions // observations // consultations
$datetime_delta = CMbDT::date("-3 days", $datetime_avg);
$sejours_ids = CMbArray::pluck($sejours, "_id");
$where = array("sejour_id" => CSQLDataSource::prepareIn($sejours_ids));
// Transmissions
$whereTrans = $where;
$whereTrans["libelle_atc"] = "IS NOT NULL";
$whereTrans["date"] = "BETWEEN '{$datetime_delta}' AND '{$datetime_avg}'";
$transmission = new CTransmissionMedicale();
$transmissions = $transmission->loadList($whereTrans, "date");
$whereTrans = $where;
예제 #3
0
            $next["CSejour"]->loadRefsNotes();
            if ($filter == "dhe") {
                unset($listConsultations[$_consult->_id]);
            }
        }
        $_consult->_next_sejour_and_operation = $next;
    } elseif ($filter == "dhe") {
        unset($listConsultations[$_consult->_id]);
    }
}
CStoredObject::massLoadFwdRef($sejours_total, "patient_id");
CStoredObject::massLoadFwdRef($sejours_total, "praticien_id");
CStoredObject::massLoadBackRefs($sejours_total, "notes");
CStoredObject::massLoadBackRefs($sejours_total, "affectations", "sortie DESC");
// Chargement des NDA
CSejour::massLoadNDA($sejours_total);
// Chargement optimisé des prestations
CSejour::massCountPrestationSouhaitees($sejours_total);
foreach ($sejours_total as $_sejour) {
    $_sejour->loadRefPatient();
    $_sejour->loadRefPraticien();
    $_sejour->loadRefsNotes();
    $_sejour->loadRefFirstAffectation();
    $_sejour->getDroitsCMU();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("hier", $hier);
$smarty->assign("demain", $demain);
$smarty->assign("filter", $filter);
$smarty->assign("is_modal", $is_modal);
예제 #4
0
/**
 * Charge complètement un service pour l'affichage des affectations
 *
 * @param CService $service       le service concerné
 * @param string   $date          le filtre de date sur les affectations
 * @param string   $mode          forcer le chargement des affectations effectuées
 * @param int      $praticien     charge les séjours pour un praticien en particulier
 * @param string   $type          charge les séjours pour un type d'hospitalisation
 * @param int      $prestation_id charge la prestation éventuellement associée à chaque séjour
 *
 *
 * @return void
 */
function loadServiceComplet(&$service, $date, $mode, $praticien_id = "", $type = "", $prestation_id = "", $with_dossier_medical = true)
{
    $service->_nb_lits_dispo = 0;
    $dossiers = array();
    $systeme_presta = CAppUI::conf("dPhospi prestations systeme_prestations", CGroups::loadCurrent());
    $lits = $service->loadRefsLits();
    foreach ($lits as $_lit) {
        $_lit->_ref_affectations = array();
        $_lit->checkDispo($date);
    }
    $affectations = $service->loadRefsAffectations($date, $mode, false, true);
    $sejours = CMbObject::massLoadFwdRef($affectations, "sejour_id");
    CMbObject::massLoadFwdRef($sejours, "patient_id");
    CMbObject::massLoadFwdRef($sejours, "prestation_id");
    CMbObject::massLoadFwdRef($sejours, "praticien_id");
    if (CModule::getActive("dPImeds")) {
        CSejour::massLoadNDA($sejours);
    }
    foreach ($affectations as $_affectation) {
        $sejour = $_affectation->loadRefSejour();
        if ($praticien_id) {
            if ($sejour->praticien_id != $praticien_id) {
                unset($affectations[$_affectation->_id]);
                continue;
            }
        }
        if ($type) {
            if ($sejour->type != $type) {
                unset($affectations[$_affectation->_id]);
                continue;
            }
        }
        $lits[$_affectation->lit_id]->_ref_affectations[$_affectation->_id] = $_affectation;
        $_affectation->loadRefsAffectations(true);
        $_affectation->checkDaysRelative($date);
        $aff_prev = $_affectation->_ref_prev;
        if ($aff_prev->_id) {
            if ($aff_prev->lit_id) {
                $aff_prev->loadRefLit();
            } else {
                $aff_prev->loadRefService();
            }
        }
        $aff_next = $_affectation->_ref_next;
        if ($aff_next->_id) {
            if ($aff_next->lit_id) {
                $aff_prev->loadRefLit();
            } else {
                $aff_prev->loadRefService();
            }
        }
        $sejour->loadRefPrestation();
        $sejour->loadRefsOperations();
        $sejour->loadNDA();
        $sejour->loadRefPraticien();
        $sejour->loadRefPatient();
        if ($with_dossier_medical) {
            $sejour->_ref_patient->loadRefDossierMedical(false);
            $dossiers[] = $sejour->_ref_patient->_ref_dossier_medical;
        }
        // Chargement des droits CMU
        $sejour->getDroitsCMU();
        foreach ($sejour->_ref_operations as $_operation) {
            $_operation->loadExtCodesCCAM();
        }
        $_affectation->_ref_lit = $lits[$_affectation->lit_id];
        $_affectation->loadRefLit();
        $_affectation->_ref_lit->_ref_chambre->_nb_affectations++;
        if ($systeme_presta == "expert" && $prestation_id) {
            $sejour->loadLiaisonsForDay($prestation_id, $date);
        }
    }
    foreach ($lits as $_lit) {
        array_multisort(CMbArray::pluck($_lit->_ref_affectations, "_ref_sejour", "entree"), SORT_ASC, $_lit->_ref_affectations);
    }
    if ($with_dossier_medical) {
        CDossierMedical::massCountAntecedentsByType($dossiers, "deficience");
    }
    if (!$service->externe) {
        foreach ($service->_ref_chambres as $_chambre) {
            $_chambre->checkChambre();
            $service->_nb_lits_dispo += $_chambre->_nb_lits_dispo;
        }
    }
}
예제 #5
0
    CApp::$chrono->start();
    // Affectations dans les couloirs
    $where = array();
    $where[] = "affectation.service_id IN (" . join($services_ids, ',') . ")";
    $where["sejour.annule"] = " = '0'";
    $where[] = "(affectation.entree BETWEEN '{$date} 00:00:00' AND '{$date} 23:59:59')\r\n            OR (affectation.sortie BETWEEN '{$date} 00:00:00' AND '{$date} 23:59:59')";
    $groupSejourNonAffectes["couloir"] = loadAffectationsCouloirs($where, $order, null, $prestation_id);
}
$imeds_active = CModule::getActive("dPImeds");
$functions_filter = array();
foreach ($groupSejourNonAffectes as $_keyGroup => $_group) {
    if ($_keyGroup == "couloir") {
        continue;
    }
    if ($imeds_active) {
        CSejour::massLoadNDA($_group);
    }
    /** @var CSejour[] $_group */
    foreach ($_group as $_key => $_sejour) {
        $_sejour->loadRefChargePriceIndicator();
        $functions_filter[$_sejour->_ref_praticien->function_id] = $_sejour->_ref_praticien->_ref_function;
        if ($filterFunction && $filterFunction != $_sejour->_ref_praticien->function_id) {
            unset($groupSejourNonAffectes[$_keyGroup][$_key]);
        }
    }
}
$affectation = new CAffectation();
$affectation->entree = CMbDT::addDateTime("08:00:00", $date);
$affectation->sortie = CMbDT::addDateTime("23:00:00", $date);
// Chargement conf prestation
$systeme_presta = CAppUI::conf("dPhospi prestations systeme_prestations", "CGroups-{$g}");