Exemplo n.º 1
0
if ($isolement) {
    $ljoin["sejour"] = "sejour.sejour_id = affectation.sejour_id";
    $where["isolement"] = "= '1'";
}
if ($item_prestation_id && $prestation_id) {
    if (isset($items_prestation[$item_prestation_id])) {
        $ljoin["item_liaison"] = "affectation.sejour_id = item_liaison.sejour_id";
        $where["item_liaison.item_souhait_id"] = " = '{$item_prestation_id}'";
    }
}
$affectation = new CAffectation();
$affectations = $affectation->loadList($where, $order, null, null, $ljoin);
$_sejours = CStoredObject::massLoadFwdRef($affectations, "sejour_id");
$services = $services + CStoredObject::massLoadFwdRef($affectations, "service_id");
$patients = CStoredObject::massLoadFwdRef($_sejours, "patient_id");
CPatient::massCountPhotoIdentite($patients);
foreach ($affectations as $_affectation_imc) {
    /* @var CAffectation $_affectation_imc*/
    if (CAppUI::conf("dPhospi vue_temporelle show_imc_patient", "CService-" . $_affectation_imc->service_id)) {
        $_affectation_imc->loadRefSejour()->loadRefPatient()->loadRefLatestConstantes(null, array("poids", "taille"));
    }
}
// Préchargement des users
$user = new CUser();
$where = array("user_id" => CSQLDataSource::prepareIn(CMbArray::pluck($_sejours, "praticien_id")));
$users = $user->loadList($where);
$praticiens = CStoredObject::massLoadFwdRef($_sejours, "praticien_id");
CStoredObject::massLoadFwdRef($praticiens, "function_id");
CStoredObject::massCountBackRefs($affectations, "affectations_enfant");
$_operations = CStoredObject::massLoadBackRefs($sejours, "operations", "date ASC");
CStoredObject::massLoadFwdRef($_operations, "plageop_id");