Exemplo n.º 1
0
        if (!$usermessage->subject) {
            $usermessage->subject = "Re: " . $origin->subject;
        }
        $usermessage->to = $origin->from;
    }
}
if ($usermessage->to) {
    $usermessage->loadRefUsersTo();
}
// Historique des messages avec le destinataire
$where = array();
$where[] = "(usermessage.from = '{$usermessage->from}' AND usermessage.to = '{$usermessage->to}')" . "OR (usermessage.from = '{$usermessage->to}' AND usermessage.to = '{$usermessage->from}')";
$where["date_sent"] = " IS NOT NULL";
$historique = $usermessage->loadList($where, "date_sent DESC", "20", "date_sent, subject");
CMbObject::massLoadFwdRef($historique, "from");
CMbObject::massLoadFwdRef($historique, "to");
/** @var $historique CUserMessage[] */
foreach ($historique as $_mail) {
    $_mail->loadRefUserFrom();
    $_mail->loadRefUsersTo();
}
// Initialisation de CKEditor
$templateManager = new CTemplateManager();
$templateManager->editor = "ckeditor";
$templateManager->simplifyMode = true;
if ($usermessage->date_sent) {
    $templateManager->printMode = true;
}
$templateManager->initHTMLArea();
// Création du template
$smarty = new CSmartyDP();
Exemplo n.º 2
0
        $where["du_tiers"] = "> 0";
    }
}
// Reglements via les factures de consultation
$where["cloture"] = "IS NOT NULL";
$where["patient_id"] = "IS NOT NULL";
$order = "ouverture, praticien_id";
$facture = new CFactureCabinet();
if ($all_group_money) {
    $listFactures = $facture->loadList($where, $order, null, null, $ljoin);
} else {
    $listFactures = $facture->loadGroupList($where, $order, null, null, $ljoin);
}
$listPlages = array();
CMbObject::massLoadFwdRef($listFactures, "praticien_id");
CMbObject::massLoadFwdRef($listFactures, "patient_id");
CMbObject::massCountBackRefs($listFactures, "reglements");
CMbObject::massCountBackRefs($listFactures, "notes");
foreach ($listFactures as $_facture) {
    /* @var CFactureCabinet $_facture */
    $_facture->loadRefGroup();
    $_facture->loadRefPatient();
    $_facture->loadRefPraticien();
    $_facture->loadRefsConsultation();
    if (count($_facture->_ref_consults)) {
        $_facture->loadRefCoeffFacture();
        $_facture->updateMontants();
        $_facture->loadRefsReglements();
        $_facture->loadRefsNotes();
        if ($all_impayes) {
            $_facture->loadRefsRelances();
Exemplo n.º 3
0
$date = CValue::get("date");
$bloc_id = CValue::get("bloc_id");
$bloc = new CBlocOperatoire();
$bloc->load($bloc_id);
$in_salles = CSQLDataSource::prepareIn($bloc->loadBackIds("salles"));
$ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id";
$where[] = "operations.salle_id {$in_salles} OR plagesop.salle_id {$in_salles}";
$where[] = "operations.date = '{$date}'";
$where["labo"] = "= 1";
$order = "entree_salle, time_operation";
$operation = new COperation();
/** @var COperation[] $operations */
$operations = $operation->loadList($where, $order, null, null, $ljoin);
CMbObject::massLoadFwdRef($operations, "plageop_id");
$chirs = CMbObject::massLoadFwdRef($operations, "chir_id");
CMbObject::massLoadFwdRef($chirs, "function_id");
$sejours = CMbObject::massLoadFwdRef($operations, "sejour_id");
CMbObject::massLoadFwdRef($sejours, "patient_id");
foreach ($operations as $_operation) {
    $_operation->loadRefPatient();
    $_operation->loadRefPlageOp();
    $_operation->updateSalle();
    $_operation->loadRefChir()->loadRefFunction();
    $_operation->loadExtCodesCCAM();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("bloc", $bloc);
$smarty->assign("operations", $operations);
$smarty->display("print_bacterio.tpl");
 $whereSortants["sejour.sortie"] = "!= affectation.sortie";
 unset($whereEntrants["service.group_id"]);
 unset($whereSortants["service.group_id"]);
 $whereEntrants["sejour.group_id"] = "= '{$group->_id}'";
 $whereSortants["sejour.group_id"] = "= '{$group->_id}'";
 /** @var CAffectation[] $deplacements */
 /** @var CAffectation[] $dep_entrants */
 /** @var CAffectation[] $dep_sortants */
 $dep_entrants = $affectation->loadList($whereEntrants, $order, null, "affectation_id", $ljoin);
 $dep_sortants = $affectation->loadList($whereSortants, $order, null, "affectation_id", $ljoin);
 $deplacements = array_merge($dep_entrants, $dep_sortants);
 $sejours = CMbObject::massLoadFwdRef($deplacements, "sejour_id");
 $patients = CMbObject::massLoadFwdRef($sejours, "patient_id");
 $praticiens = CMbObject::massLoadFwdRef($sejours, "praticien_id");
 CMbObject::massLoadFwdRef($praticiens, "function_id");
 CMbObject::massLoadFwdRef($deplacements, "lit_id");
 $update_count = count($dep_entrants) . "/" . count($dep_sortants);
 foreach ($deplacements as $_deplacement) {
     $_deplacement->loadRefsFwd();
     $sejour = $_deplacement->_ref_sejour;
     $sejour->loadRefPatient(1);
     $sejour->loadRefPraticien(1);
     $sejour->loadNDA();
     $_deplacement->_ref_next->loadRefLit()->loadCompleteView();
     $_deplacement->_ref_prev->loadRefLit()->loadCompleteView();
     if ($show_hour_anesth) {
         $op = $sejour->loadRefCurrOperation($date);
         $op->loadRefPlageOp();
         $op->_ref_anesth->loadRefFunction();
     }
     if ($prestation_id) {
Exemplo n.º 5
0
 /**
  * Load documents and files for object and sort by category
  *
  * @param boolean $with_cancelled Inclure les fichiers annulés
  *
  * @return int document + files count
  */
 function loadRefsDocItems($with_cancelled = true)
 {
     $this->_nb_files = $this->loadRefsFiles();
     $this->_nb_docs = $this->loadRefsDocs();
     $this->_nb_files_docs = $this->_nb_files + $this->_nb_docs;
     $categories_files = CMbObject::massLoadFwdRef($this->_ref_files, "file_category_id");
     $categories_docs = CMbObject::massLoadFwdRef($this->_ref_documents, "file_category_id");
     $categories = $categories_docs + $categories_files;
     foreach ($this->_ref_documents as $_document) {
         $cat_name = $_document->file_category_id ? $categories[$_document->file_category_id]->nom : "";
         @($this->_ref_documents_by_cat[$cat_name][] = $_document);
         @($this->_refs_docitems_by_cat[$cat_name][] = $_document);
     }
     foreach ($this->_ref_files as $_key => $_file) {
         if (!$with_cancelled && $_file->annule) {
             unset($this->_ref_files[$_key]);
             continue;
         }
         $cat_name = $_file->file_category_id ? $categories[$_file->file_category_id]->nom : "";
         @($this->_ref_files_by_cat[$cat_name][] = $_file);
         @($this->_refs_docitems_by_cat[$cat_name][] = $_file);
     }
     ksort(@$this->_refs_docitems_by_cat);
 }
    $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);
    $_firstconsult_time = substr($firstconsult->heure, 0, 5);
    $lastconsult = end($plageSel->_ref_consultations);
    $_lastconsult_time = substr($lastconsult->heure, 0, 5);
}
$consults = $plageSel->_ref_consultations;
CStoredObject::massLoadFwdRef($consults, "sejour_id");
$patients = CMbObject::massLoadFwdRef($consults, "patient_id");
CStoredObject::massCountBackRefs($patients, "notes");
CStoredObject::massLoadFwdRef($consults, "categorie_id");
// Détails sur les consultation affichées
foreach ($plageSel->_ref_consultations as $keyConsult => &$consultation) {
    $consultation->_ref_plageconsult = $plageSel;
    $consultation->loadRefSejour();
    $consultation->loadRefPatient()->loadRefsNotes();
    $consultation->loadRefCategorie();
    $consultation->countDocItems();
    $consultation->_view = "Consult. de " . $consultation->_ref_patient->_view;
    $consultation->_view .= " (" . CMbDT::format($plageSel->date, "%d/%m/%Y") . ")";
    //check 3333tel
    if (CModule::getActive("3333tel")) {
        C3333TelTools::checkConsults($consultation, $plageSel->_ref_chir->function_id);
    }
Exemplo n.º 7
0
}
$order = array();
$order[] = "date";
$order[] = "chir_id";
$order[] = "debut";
/** @var CPlageconsult[] $listPlage */
$listPlage = $plage->loadList($where, $order);
// Pour chaque plage on selectionne les consultations
foreach ($listPlage as $plage) {
    $plage->listPlace = array();
    $plage->listPlace2 = array();
    $plage->listBefore = array();
    $plage->listAfter = array();
    $plage->listHorsPlace = array();
    $listPlage[$plage->_id]->loadRefs(false, 1);
    CMbObject::massLoadFwdRef($plage->_ref_consultations, "sejour_id");
    for ($i = 0; $i <= $plage->_total; $i++) {
        $minutes = $plage->_freq * $i;
        $plage->listPlace[$i]["time"] = CMbDT::time("+ {$minutes} minutes", $plage->debut);
        $plage->listPlace[$i]["consultations"] = array();
    }
    foreach ($plage->_ref_consultations as $keyConsult => $valConsult) {
        /** @var CConsultation $consultation */
        $consultation = $plage->_ref_consultations[$keyConsult];
        $patient = $consultation->loadRefPatient(1);
        $patient->loadIPP();
        if ($consultation->sejour_id) {
            $patient->_ref_curr_affectation = $consultation->loadRefSejour()->loadRefCurrAffectation(CMbDT::date($consultation->_datetime));
            $patient->_ref_curr_affectation->loadView();
            if ($patient->_ref_curr_affectation->_id) {
                $show_lit = true;
Exemplo n.º 8
0
            $plageConsult->countPatients();
            $plageConsult->loadFillRate();
            if ($details) {
                $plageConsult->loadRefsConsultations();
            }
        }
        $plagesConsult[$date] = $plagesPerDayConsult;
    }
    if (in_array("interv", $export)) {
        $where = array();
        $where[] = "chir_id = '{$prat_id}' OR anesth_id = '{$prat_id}'";
        $where["date"] = "= '{$date}'";
        $where["salle_id"] = CSQLDataSource::prepareIn(array_keys($listSalles));
        $plagesPerDayOp = $plageOp->loadList($where);
        $salles = CMbObject::massLoadFwdRef($plagesPerDayOp, "salle_id");
        CMbObject::massLoadFwdRef($salles, "bloc_id");
        CMbObject::massLoadBackRefs($plagesPerDayOp, "operations");
        foreach ($plagesPerDayOp as $key => $plage) {
            $plage->loadRefSalle();
            $plage->_ref_salle->loadRefBloc();
            $plage->_ref_salle->_ref_bloc->loadRefGroup();
            if ($details) {
                $plage->loadRefsOperations();
            }
            $plage->multicountOperations();
            $plagesOp[$plage->salle_id][$date] = $plagesPerDayOp[$key];
        }
    }
}
// Création du calendrier
$v = new CMbCalendar("Planning");
Exemplo n.º 9
0
CCanDo::checkRead();
// Current user and current function
$mediuser = CMediusers::get();
$function = $mediuser->loadRefFunction();
// Filter
$filter = new CPlageconsult();
$filter->_user_id = CValue::get("_user_id", null);
$filter->_date_min = CValue::get("_date_min", CMbDT::date("last month"));
$filter->_date_max = CValue::get("_date_max", CMbDT::date());
$ds = $filter->_spec->ds;
$stats_creation = array();
$prats_creation = array();
if ($filter->_user_id) {
    $query = "CREATE TEMPORARY TABLE consultation_creation AS \n    SELECT user_log.user_id as user_id, plageconsult.chir_id as chir_id\n    FROM user_log\n    LEFT JOIN consultation ON consultation.consultation_id = user_log.object_id\n    LEFT JOIN plageconsult ON plageconsult.plageconsult_id = consultation.plageconsult_id\n    WHERE user_log.object_class = 'CConsultation'\n    AND user_log.date BETWEEN '{$filter->_date_min} 00:00:00' AND '{$filter->_date_max} 23:59:59'\n    AND user_log.type = 'create'";
    $ds->exec($query);
    $query = "SELECT consultation_creation.user_id, count(consultation_creation.user_id) AS total\n    FROM consultation_creation\n    WHERE consultation_creation.chir_id = '{$filter->_user_id}'\n    GROUP BY consultation_creation.user_id\n    ORDER BY total DESC";
    $stats_creation = $ds->loadList($query);
    $where = array();
    $where["user_id"] = CSQLDataSource::prepareIn(CMbArray::pluck($stats_creation, "user_id"));
    /* @var CMediusers[] $prats_creation*/
    $prats_creation = $mediuser->loadList($where);
    CMbObject::massLoadFwdRef($prats_creation, "function_id");
    foreach ($prats_creation as $_prat) {
        $_prat->loadRefFunction();
    }
}
$smarty = new CSmartyDP();
$smarty->assign("filter", $filter);
$smarty->assign("prats_creation", $prats_creation);
$smarty->assign("stats_creation", $stats_creation);
$smarty->display("inc_stats_prise_rdv.tpl");
Exemplo n.º 10
0
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Hospi
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$lit_id = CValue::get("lit_id");
$lit_liaison_item = new CLitLiaisonItem();
$lit_liaison_item->lit_id = $lit_id;
/** @var CLitLiaisonItem[] $lits_liaisons_items */
$lits_liaisons_items = $lit_liaison_item->loadMatchingList();
CMbObject::massLoadFwdRef($lits_liaisons_items, "item_prestation_id");
foreach ($lits_liaisons_items as $_lit_liaison_item) {
    $_lit_liaison_item->loadRefItemPrestation();
    $_lit_liaison_item->_ref_item_prestation->loadRefObject();
}
$smarty = new CSmartyDP();
$smarty->assign("lits_liaisons_items", $lits_liaisons_items);
$smarty->assign("lit_id", $lit_id);
$smarty->display("inc_edit_liaisons_items.tpl");
Exemplo n.º 11
0
}
$show_curr_affectation = CAppUI::conf("dPadmissions show_curr_affectation");
/** @var CSejour[] $sejours */
$sejours = $sejour->loadList($where, $order, null, null, $ljoin);
if ($heure) {
    $date_min = CMbDT::dateTime("00:00:00", $date);
    $date_max = CMbDT::dateTime("23:59:59", $date);
    $where["sejour.entree"] = "<= '{$date_max}'";
    $where["sejour.sortie"] = ">= '{$date_min}'";
    $total_sejours = $sejour->loadList($where, $order, null, null, $ljoin);
} else {
    $total_sejours = null;
}
$patients = CMbObject::massLoadFwdRef($sejours, "patient_id");
$praticiens = CMbObject::massLoadFwdRef($sejours, "praticien_id");
$functions = CMbObject::massLoadFwdRef($praticiens, "function_id");
// Chargement optimisée des prestations
CSejour::massCountPrestationSouhaitees($sejours);
CStoredObject::massLoadBackRefs($sejours, "notes");
CStoredObject::massLoadBackRefs($patients, "dossier_medical");
// Chargement des NDA
CSejour::massLoadNDA($sejours);
// Chargement des IPP
CPatient::massLoadIPP($patients);
// Chargement optimisé des prestations
CSejour::massCountPrestationSouhaitees($sejours);
$operations = CStoredObject::massLoadBackRefs($sejours, "operations", "date ASC", array("annulee" => "= '0'"));
CStoredObject::massLoadBackRefs($operations, "actes_ngap", "lettre_cle DESC");
$order = "code_association, code_acte,code_activite, code_phase, acte_id";
CStoredObject::massLoadBackRefs($operations, "actes_ccam", $order);
CStoredObject::massLoadBackRefs($sejours, "affectations");
Exemplo n.º 12
0
 /**
  * Chargement des besoins
  *
  * @param string $from Date de début
  * @param string $to   Date de fin
  *
  * @return CBesoinRessource[]
  */
 function loadRefsBesoins($from, $to)
 {
     if (!$from && !$to) {
         return $this->_ref_besoins = array();
     }
     $besoin = new CBesoinRessource();
     $where = array();
     $ljoin = array();
     $from_date = CMbDT::date($from);
     $to_date = CMbDT::date($to);
     $ljoin["operations"] = "besoin_ressource.operation_id = operations.operation_id";
     $ljoin["usage_ressource"] = "usage_ressource.besoin_ressource_id = besoin_ressource.besoin_ressource_id";
     // On ne charge que les besoins qui n'ont pas d'usage
     $where[] = "usage_ressource.usage_ressource_id IS NULL";
     $where["operations.date"] = "BETWEEN '{$from_date}' AND '{$to_date}'";
     // Sur les interventions non annulées
     $where["operations.annulee"] = "= '0'";
     if ($this->type_ressource_id) {
         $ljoin["ressource_materielle"] = "ressource_materielle.type_ressource_id = besoin_ressource.type_ressource_id";
         $where["ressource_materielle.type_ressource_id"] = "= '{$this->type_ressource_id}'";
     }
     /** @var CBesoinRessource[] $besoins */
     $besoins = $besoin->loadList($where, null, null, "besoin_ressource_id", $ljoin);
     CMbObject::massLoadFwdRef($besoins, "operation_id");
     foreach ($besoins as $_besoin) {
         $operation = $_besoin->loadRefOperation();
         $operation->loadRefPlageOp();
         $deb_op = $operation->_datetime;
         $fin_op = CMbDT::addDateTime($operation->temp_operation, $deb_op);
         if ($deb_op > $to || $fin_op < $from) {
             unset($besoins[$_besoin->_id]);
         }
     }
     return $this->_ref_besoins = $besoins;
 }
Exemplo n.º 13
0
 function fillLimitedTemplate(&$template)
 {
     $this->loadRefsFwd(1);
     $this->loadRefPraticien();
     $this->loadRefChir2();
     $this->loadRefChir3();
     $this->loadRefChir4();
     $this->loadRefsFiles();
     $this->loadAffectationsPersonnel();
     $plageop = $this->_ref_plageop;
     $plageop->loadAffectationsPersonnel();
     foreach ($this->_ext_codes_ccam as $_code) {
         $_code->getRemarques();
         $_code->getActivites();
     }
     $this->notify("BeforeFillLimitedTemplate", $template);
     for ($i = 1; $i < 5; $i++) {
         $prop = "_ref_chir" . ($i == 1 ? "" : "_{$i}");
         $praticien = $this->{$prop};
         $praticien->loadRefFunction();
         $praticien->loadRefDiscipline();
         $praticien->loadRefSpecCPAM();
         $number = $i == 1 ? "" : " {$i}";
         $template->addProperty("Opération - Chirurgien{$number}", $praticien->_id ? "Dr " . $praticien->_view : '');
         $template->addProperty("Opération - Chirurgien{$number} - Nom", $praticien->_user_last_name);
         $template->addProperty("Opération - Chirurgien{$number} - Prénom", $praticien->_user_first_name);
         $template->addProperty("Opération - Chirurgien{$number} - Initiales", $praticien->_shortview);
         $template->addProperty("Opération - Chirurgien{$number} - Discipline", $praticien->_ref_discipline->_view);
         $template->addProperty("Opération - Chirurgien{$number} - Spécialité", $praticien->_ref_spec_cpam->_view);
         $template->addProperty("Opération - Chirurgien{$number} - CAB", $praticien->cab);
         $template->addProperty("Opération - Chirurgien{$number} - CONV", $praticien->conv);
         $template->addProperty("Opération - Chirurgien{$number} - ZISD", $praticien->zisd);
         $template->addProperty("Opération - Chirurgien{$number} - IK", $praticien->ik);
         $template->addProperty("Opération - Chirurgien{$number} - Titres", $praticien->titres);
         $template->addProperty("Opération - Chirurgien{$number} - ADELI", $praticien->adeli);
         $template->addBarcode("Opération - Chirurgien{$number} - Code barre ADELI", $praticien->adeli, array("barcode" => array("title" => CAppUI::tr("CMediusers-adeli"))));
         $template->addProperty("Opération - Chirurgien{$number} - RPPS", $praticien->rpps);
         $template->addBarcode("Opération - Chirurgien{$number} - Code barre RPPS", $praticien->rpps, array("barcode" => array("title" => CAppUI::tr("CMediusers-rpps"))));
         $template->addProperty("Opération - Chirurgien{$number} - E-mail", $praticien->_user_email);
         $template->addProperty("Opération - Chirurgien{$number} - E-mail Apicrypt", $praticien->mail_apicrypt);
     }
     $template->addProperty("Opération - Anesthésiste - nom", @$this->_ref_anesth->_user_last_name);
     $template->addProperty("Opération - Anesthésiste - prénom", @$this->_ref_anesth->_user_first_name);
     $template->addProperty("Opération - Anesthésie", $this->_lu_type_anesth);
     $template->addProperty("Opération - libellé", $this->libelle);
     $template->addProperty("Opération - CCAM1 - code", @$this->_ext_codes_ccam[0]->code);
     $template->addProperty("Opération - CCAM1 - description", @$this->_ext_codes_ccam[0]->libelleLong);
     $template->addProperty("Opération - CCAM1 - montant activité 1", @$this->_ext_codes_ccam[0]->activites[1]->phases[0]->tarif);
     $template->addProperty("Opération - CCAM1 - montant activité 4", @$this->_ext_codes_ccam[0]->activites[4]->phases[0]->tarif);
     $template->addProperty("Opération - CCAM2 - code", @$this->_ext_codes_ccam[1]->code);
     $template->addProperty("Opération - CCAM2 - description", @$this->_ext_codes_ccam[1]->libelleLong);
     $template->addProperty("Opération - CCAM2 - montant activité 1", @$this->_ext_codes_ccam[1]->activites[1]->phases[0]->tarif);
     $template->addProperty("Opération - CCAM2 - montant activité 4", @$this->_ext_codes_ccam[1]->activites[4]->phases[0]->tarif);
     $template->addProperty("Opération - CCAM3 - code", @$this->_ext_codes_ccam[2]->code);
     $template->addProperty("Opération - CCAM3 - description", @$this->_ext_codes_ccam[2]->libelleLong);
     $template->addProperty("Opération - CCAM3 - montant activité 1", @$this->_ext_codes_ccam[2]->activites[1]->phases[0]->tarif);
     $template->addProperty("Opération - CCAM3 - montant activité 4", @$this->_ext_codes_ccam[2]->activites[4]->phases[0]->tarif);
     $template->addProperty("Opération - CCAM - codes", implode(" - ", $this->_codes_ccam));
     if (CModule::getActive("tarmed") && CAppUI::conf("tarmed CCodeTarmed use_cotation_tarmed")) {
         $this->loadRefsActes();
         $template->addProperty("Opération - TARMED - codes", CActeTarmed::actesHtml($this), '', false);
         $template->addProperty("Opération - Caisse - codes", CActeCaisse::actesHtml($this), '', false);
     }
     $template->addProperty("Opération - CCAM - descriptions", implode(" - ", CMbArray::pluck($this->_ext_codes_ccam, "libelleLong")));
     $template->addProperty("Opération - salle", @$this->_ref_salle->nom);
     $template->addProperty("Opération - côté", $this->cote);
     $template->addProperty("Opération - position", $this->getFormattedValue("position"));
     $template->addDateProperty("Opération - date", $this->_datetime_best != " 00:00:00" ? $this->_datetime_best : "");
     $template->addLongDateProperty("Opération - date longue", $this->_datetime_best != " 00:00:00" ? $this->_datetime_best : "");
     $template->addTimeProperty("Opération - heure", $this->time_operation);
     $template->addTimeProperty("Opération - durée", $this->temp_operation);
     $template->addTimeProperty("Opération - durée réelle", $this->_duree_interv);
     $template->addTimeProperty("Opération - entrée bloc", $this->entree_salle);
     $template->addTimeProperty("Opération - pose garrot", $this->pose_garrot);
     $template->addTimeProperty("Opération - début induction", $this->induction_debut);
     $template->addTimeProperty("Opération - début op", $this->debut_op);
     $template->addTimeProperty("Opération - fin op", $this->fin_op);
     $template->addTimeProperty("Opération - fin induction", $this->induction_fin);
     $template->addTimeProperty("Opération - retrait garrot", $this->retrait_garrot);
     $template->addTimeProperty("Opération - sortie bloc", $this->sortie_salle);
     $template->addTimeProperty("Opération - entrée SSPI", $this->entree_reveil);
     $template->addTimeProperty("Opération - sortie SSPI", $this->sortie_reveil_reel);
     $template->addProperty("Opération - dépassement anesth", $this->depassement_anesth);
     $template->addProperty("Opération - Passage USCPO", "{$this->duree_uscpo} nuit(s)");
     if (CModule::getActive("mvsante")) {
         $template->addTimeProperty("Opération - Remise au chirurgien", $this->remise_chir);
         /** @var CLiaisonLibelleInterv[] $liaisons_libelles */
         $liaisons_libelles = $this->loadBackRefs("liaison_libelle", "numero");
         CMbObject::massLoadFwdRef($liaisons_libelles, "libelleop_id");
         $libelles = array(0 => "", 1 => "", 2 => "", 3 => "");
         foreach ($liaisons_libelles as $_liaison) {
             $libelles[$_liaison->numero - 1] = $_liaison->loadRefLibelle()->nom;
         }
         $template->addProperty("Opération - Libellé 1", $libelles[0]);
         $template->addProperty("Opération - Libellé 2", $libelles[1]);
         $template->addProperty("Opération - Libellé 3", $libelles[2]);
         $template->addProperty("Opération - Libellé 4", $libelles[3]);
     }
     $template->addProperty("Opération - depassement", $this->depassement);
     $template->addProperty("Opération - exams pre-op", $this->examen);
     $template->addProperty("Opération - matériel", $this->materiel);
     $template->addProperty("Opération - exam per-op", $this->exam_per_op);
     $template->addProperty("Opération - convalescence", $this->_ref_sejour->convalescence);
     $template->addProperty("Opération - remarques", $this->rques);
     $template->addProperty("Opération - Score ASA", $this->getFormattedValue("ASA"));
     $consult_anesth = $this->_ref_consult_anesth;
     $consult = $consult_anesth->loadRefConsultation();
     $consult->loadRefPlageConsult();
     $prat = $consult->loadRefPraticien();
     $template->addDateProperty("Opération - Consultation anesthésie - Date", $consult->_id ? $consult->_datetime : "");
     $template->addLongDateProperty("Opération - Consultation anesthésie - Date (longue)", $consult->_id ? $consult->_datetime : "");
     $template->addLongDateProperty("Opération - Consultation anesthésie - Date (longue, minuscule)", $consult->_id ? $consult->_datetime : "", true);
     $template->addTimeProperty("Opération - Consultation anesthésie - Heure", $consult->_id ? $consult->_datetime : "");
     $template->addProperty("Opération - Consultation anesthésie - Praticien - Prénom", $consult->_id ? $prat->_user_first_name : "");
     $template->addProperty("Opération - Consultation anesthésie - Praticien - Nom", $consult->_id ? $prat->_user_last_name : "");
     $template->addProperty("Opération - Consultation anesthésie - Remarques", $consult->rques);
     /** @var CMediusers $prat_visite */
     $prat_visite = $this->loadFwdRef("prat_visite_anesth_id", true);
     $template->addDateProperty("Opération - Visite pré anesthésie - Date", $this->date_visite_anesth);
     $template->addLongDateProperty("Opération - Visite pré anesthésie - Date (longue)", $this->date_visite_anesth);
     $template->addProperty("Opération - Visite pré anesthésie - Rques", $this->getFormattedValue("rques_visite_anesth"));
     $template->addProperty("Opération - Visite pré anesthésie - Autorisation", $this->getFormattedValue("autorisation_anesth"));
     $template->addProperty("Opération - Visite pré anesthésie - Praticien - Prénom", $prat_visite->_user_first_name);
     $template->addProperty("Opération - Visite pré anesthésie - Praticien - Nom", $prat_visite->_user_last_name);
     $template->addBarcode("Opération - Code Barre ID", $this->_id);
     $list = CMbArray::pluck($this->_ref_files, "file_name");
     $template->addListProperty("Opération - Liste des fichiers", $list);
     foreach ($this->_ref_affectations_personnel as $emplacement => $affectations) {
         $locale = CAppUI::tr("CPersonnel.emplacement.{$emplacement}");
         $property = implode(" - ", CMbArray::pluck($affectations, "_ref_personnel", "_ref_user", "_view"));
         $template->addProperty("Opération - personnel réel - {$locale}", $property);
     }
     foreach ($plageop->_ref_affectations_personnel as $emplacement => $affectations) {
         $locale = CAppUI::tr("CPersonnel.emplacement.{$emplacement}");
         $property = implode(" - ", CMbArray::pluck($affectations, "_ref_personnel", "_ref_user", "_view"));
         $template->addProperty("Opération - personnel prévu - {$locale}", $property);
     }
     $evts = $incidents = array();
     foreach ($this->loadRefsAnesthPerops() as $_evt) {
         if ($_evt->incident) {
             $incidents[] = $_evt;
             continue;
         }
         $evts[] = $_evt;
     }
     $template->addListProperty("Opération - Evenements per-opératoires", $evts);
     $template->addListProperty("Opération - Incidents per-opératoires", $incidents);
     CSupervisionGraph::addObservationDataToTemplate($template, $this, "Opération");
     if (CModule::getActive("forms")) {
         CExObject::addFormsToTemplate($template, $this, "Opération");
     }
     if (CAppUI::conf("dPsalleOp enable_surveillance_perop")) {
         $obs_view = "";
         if ($template->valueMode && $this->_id && $this->graph_pack_id) {
             /** @var CObservationResultSet[] $list_obr */
             list($list, $grid, $graphs, $labels, $list_obr) = CObservationResultSet::getChronological($this, $this->graph_pack_id);
             foreach ($grid as $_row) {
                 /** @var CObservationResult[] $_row */
                 foreach ($_row as $_cell) {
                     if ($_cell && $_cell->file_id) {
                         $_cell->loadRefFile()->getDataUri();
                     }
                 }
             }
             $smarty = new CSmartyDP("modules/dPpatients");
             // Horizontal
             $smarty->assign("observation_grid", $grid);
             $smarty->assign("observation_labels", $labels);
             $smarty->assign("observation_list", $list_obr);
             $smarty->assign("in_compte_rendu", true);
             $obs_view = $smarty->fetch("inc_observation_results_grid.tpl", '', '', 0);
             $obs_view = preg_replace('`([\\n\\r])`', '', $obs_view);
         }
         $template->addProperty("Opération - Tableau supervision", $obs_view, '', false);
     }
     $this->notify("AfterFillLimitedTemplate", $template);
 }
Exemplo n.º 14
0
     foreach ($observations as $_obs) {
         $_obs->loadRefUser();
         $_obs->loadTargetObject();
         if ($_obs->_ref_object) {
             $_obs->_ref_object->loadRefsFwd();
         }
         $_obs->_ref_sejour = $sejours[$_obs->sejour_id];
         $trans_and_obs[$_obs->_ref_sejour->patient_id][$_obs->date][] = $_obs;
     }
     $cste = new CConstantesMedicales();
     $whereCstes = array();
     $whereCstes[] = "(datetime >= '{$dateTime_min} ' AND datetime <= '{$dateTime_max}')";
     $whereCstes["context_class"] = " = 'CSejour'";
     $whereCstes["context_id"] = CSQLDataSource::prepareIn(array_keys($sejours));
     $constantes = $cste->loadList($whereCstes, "FIND_IN_SET(context_id, '" . implode(',', $sejours_ids) . "')");
     CMbObject::massLoadFwdRef($constantes, "user_id");
     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));
Exemplo n.º 15
0
 /**
  * @see parent::loadView()
  */
 function loadView()
 {
     parent::loadView();
     $naissances = $this->loadRefsNaissances();
     $sejours = CMbObject::massLoadFwdRef($naissances, "sejour_enfant_id");
     CMbObject::massLoadFwdRef($sejours, "patient_id");
     foreach ($naissances as $_naissance) {
         $_naissance->loadRefSejourEnfant()->loadRefPatient();
     }
     $this->loadLastAllaitement();
 }
Exemplo n.º 16
0
        $_affectation->loadRefLit()->loadCompleteView();
        $_affectation->_rowspan = CMbDT::daysRelative($_affectation->entree, $_affectation->sortie) + 1;
        $date_temp = CMbDT::date($_affectation->entree);
        while ($date_temp <= CMbDT::date($_affectation->sortie)) {
            $dates[$date_temp] = $_affectation->_id;
            $date_temp = CMbDT::date("+1 day", $date_temp);
        }
    }
}
// Gestion des liaisons hors séjour
$dates_after = array();
/** @var CItemLiaison[] $items_liaisons */
$items_liaisons = $sejour->loadBackRefs("items_liaisons");
CMbObject::massLoadFwdRef($items_liaisons, "item_souhait_id");
CMbObject::massLoadFwdRef($items_liaisons, "item_realise_id");
CMbObject::massLoadFwdRef($items_liaisons, "sous_item_id");
foreach ($items_liaisons as $_item_liaison) {
    if ($_item_liaison->date > CMbDT::date($sejour->sortie)) {
        $dates_after[] = CMbDT::date($_item_liaison->date);
    }
    $_item = $_item_liaison->loadRefItem();
    $_item_liaison->loadRefItemRealise();
    if (!$_item->_id) {
        $_item = $_item_liaison->_ref_item_realise;
    }
    $_item_liaison->loadRefSousItem();
    switch ($_item->object_class) {
        case "CPrestationJournaliere":
            $liaisons_j[$_item_liaison->date][$_item->object_id] = $_item_liaison;
            break;
        case "CPrestationPonctuelle":
Exemplo n.º 17
0
$where["debut"] = "BETWEEN '{$planning->_date_min_planning} 00:00:00' AND '{$planning->_date_max_planning} 23:59:59'";
$where["therapeute_id"] = " = '{$kine->_id}'";
$where["type_seance"] = $surveillance ? " = 'non_dediee'" : " <> 'non_dediee'";
/** @var CEvenementSSR[] $evenements */
$evenements = $evenement->loadList($where);
// Chargement des evenements SSR de "charge"
$where["type_seance"] = $surveillance ? " <> 'non_dediee'" : " = 'non_dediee'";
/** @var CEvenementSSR[] $evenements_charge */
$evenements_charge = $evenement->loadList($where);
foreach ($evenements_charge as $_evenement) {
    $planning->addLoad($_evenement->debut, $_evenement->duree);
}
CMbObject::massLoadFwdRef($evenements, "prescription_line_element_id");
CMbObject::massLoadFwdRef($evenements, "equipement_id");
$therapeutes = CMbObject::massLoadFwdRef($evenements, "therapeute_id");
CMbObject::massLoadFwdRef($therapeutes, "function_id");
CMbObject::massCountBackRefs($evenements, "evenements_ssr");
CMbObject::massCountBackRefs($evenements, "actes_cdarr");
CMbObject::massCountBackRefs($evenements, "actes_csarr");
foreach ($evenements as $_evenement) {
    $important = $sejour_id ? $_evenement->sejour_id == $sejour_id : true;
    $sejour = $_evenement->loadRefSejour();
    $patient = $sejour->loadRefPatient();
    $equipement = $_evenement->loadRefEquipement();
    // Title
    if ($_evenement->sejour_id) {
        $title = $patient->nom;
    } else {
        $title = $_evenement->_count["evenements_ssr"] . " patient(s)";
    }
    if ($large) {
Exemplo n.º 18
0
$plage->loadRefsFwd();
$intervs = $plage->loadRefsOperations(true, "rank, rank_voulu, horaire_voulu", true, $list_type != "left");
$chirs = CMbObject::massLoadFwdRef($intervs, "chir_id");
CMbObject::massLoadFwdRef($chirs, "function_id");
$sejours = CMbObject::massLoadFwdRef($intervs, "sejour_id");
CMbObject::massLoadFwdRef($sejours, "patient_id");
foreach ($intervs as $_interv) {
    $_interv->loadRefsFwd();
    $_interv->_ref_chir->loadRefFunction();
    $_interv->_ref_sejour->loadRefsFwd();
    $_interv->_count_affectations_personnel = $_interv->countBackRefs("affectations_personnel");
    $patient = $_interv->_ref_sejour->_ref_patient;
    $patient->loadRefDossierMedical();
    $patient->_ref_dossier_medical->countAllergies();
}
// liste des plages du praticien
$where = array("date" => "= '{$plage->date}'", "chir_id" => "= '{$plage->chir_id}'");
/** @var CPlageOp[] $list_plages */
$list_plages = $plage->loadList($where);
CMbObject::massLoadFwdRef($list_plages, "salle_id");
foreach ($list_plages as $_plage) {
    $_plage->loadRefSalle();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("listPlages", $list_plages);
$smarty->assign("plage", $plage);
$smarty->assign("anesth", $anesth);
$smarty->assign("intervs", $intervs);
$smarty->assign("list_type", $list_type);
$smarty->display("inc_list_intervs.tpl");
Exemplo n.º 19
0
CMbObject::massLoadFwdRef($sejours, "grossesse_id");
CMbObject::massCountBackRefs($sejours, "operations");
/** @var  $sejours CSejour[] */
foreach ($sejours as $_sejour) {
    $_sejour->loadRefPatient();
    $_sejour->loadRefsOperations();
    $grossesse = $_sejour->loadRefGrossesse();
    $grossesse->_praticiens = CMbObject::massLoadFwdRef($grossesse->loadRefsSejours(), "praticien_id");
    $grossesse->_praticiens += CMbObject::massLoadFwdRef($grossesse->loadRefsConsultations(), "_prat_id");
    $naissances = $grossesse->loadRefsNaissances();
    $sejours_enfant = CMbObject::massLoadFwdRef($naissances, "sejour_enfant_id");
    CMbObject::massLoadFwdRef($sejours_enfant, "patient_id");
    foreach ($naissances as $_naissance) {
        $_naissance->loadRefSejourEnfant()->loadRefPatient();
    }
    CMbObject::massLoadFwdRef($grossesse->_praticiens, "function_id");
    foreach ($grossesse->_praticiens as $_praticien) {
        $_praticien->loadRefFunction();
    }
}
$smarty = new CSmartyDP();
$smarty->assign("sejours", $sejours);
$smarty->assign("days", $days);
$smarty->assign("date", $date);
$smarty->assign("view", $view);
$smarty->assign("date_before", $date_before);
$smarty->assign("date_after", $date_after);
$smarty->assign("prev_month", $prev_month);
$smarty->assign("next_month", $next_month);
$smarty->assign("bank_holidays", $bank_holidays);
$smarty->display("vw_admissions.tpl");
$date = CValue::get("date", CMbDT::date());
$group = CGroups::loadCurrent();
$date_min = CMbDT::date("-" . CAppUI::conf("maternite CGrossesse min_check_terme", $group) . " DAYS", $date);
$date_max = CMbDT::date("+" . CAppUI::conf("maternite CGrossesse max_check_terme", $group) . " DAYS", $date);
$where = array();
$ljoin = array();
$where["terme_prevu"] = "BETWEEN '{$date_min}' AND '{$date_max}'";
$where["group_id"] = " = '{$group->_id}' ";
$ljoin["patients"] = "patients.patient_id = grossesse.parturiente_id";
$grossesse = new CGrossesse();
/** @var CStoredObject[] $grossesses */
$grossesses = $grossesse->loadGroupList($where, "terme_prevu ASC, nom ASC", null, null, $ljoin);
CMbObject::massLoadFwdRef($grossesses, "parturiente_id");
CMbObject::massCountBackRefs($grossesses, "sejours");
$consultations = CMbObject::massLoadBackRefs($grossesses, "consultations");
CMbObject::massLoadFwdRef($consultations, "plageconsult_id");
/** @var CGrossesse[] $grossesses */
foreach ($grossesses as $_grossesse) {
    $_grossesse->loadRefParturiente();
    $_grossesse->countRefSejours();
    $_grossesse->loadRefsConsultations(true);
    foreach ($_grossesse->_ref_consultations as $_consult) {
        $_consult->loadRefPlageConsult();
    }
}
$smarty = new CSmartyDP();
$smarty->assign("grossesses", $grossesses);
$smarty->assign("date", $date);
$smarty->assign("date_min", $date_min);
$smarty->assign("date_max", $date_max);
$smarty->display("inc_tdb_grossesses.tpl");
/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Hospi
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkEdit();
// Récupération des paramètres
$object_guid = CValue::get("object_guid");
$object = CMbObject::loadFromGuid($object_guid);
/** @var CAffectationUniteFonctionnelle[] $affectations_uf */
$affectations_uf = $object->loadBackRefs("ufs");
CMbObject::massLoadFwdRef($affectations_uf, "uf_id");
$ufs_selected = array("medicale" => false, "hebergement" => false, "soins" => false);
foreach ($affectations_uf as $key => $_affectation_uf) {
    $_affectation_uf->loadRefUniteFonctionnelle();
    //Utilisation d'un seul type d'uf par service/chambre/lit?
    $ufs_selected[$_affectation_uf->_ref_uf->_id] = true;
    $ufs_selected[$_affectation_uf->_ref_uf->type] = true;
}
$ufs = CUniteFonctionnelle::getUFs($object->_class);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("object", $object);
$smarty->assign("ufs", $ufs);
$smarty->assign("affectations_uf", $affectations_uf);
$smarty->assign("ufs_selected", $ufs_selected);
$smarty->display("inc_affectation_uf.tpl");
Exemplo n.º 22
0
$where = array();
$where["cancelled"] = "= '0'";
$services = $service->loadGroupList($where);
// Chargement des sejours pour le service selectionné
$sejours = array();
$affectation = new CAffectation();
$where = array();
$datetime_min = CMbDT::dateTime($datetime);
$datetime_max = CMbDT::dateTime("+{$nb_periods} {$period}", $datetime);
$where["sortie"] = ">= '{$datetime_min}'";
$where["entree"] = "<= '{$datetime_max}'";
$where["affectation.service_id"] = " = '{$service_id}'";
$affectations = $affectation->loadList($where);
$planifications = array();
$ressources = array();
CMbObject::massLoadFwdRef($affectations, "sejour_id");
foreach ($affectations as $_affectation) {
    $_affectation->loadView();
    // Chargement du séjour
    $sejour = $_affectation->loadRefSejour(1);
    $sejour->_ref_current_affectation = $_affectation;
    $sejour->loadRefPatient();
    $sejour->entree = CMbDate::dirac($period, $sejour->entree);
    $sejour->sortie = CMbDate::dirac($period, $sejour->sortie);
    $sejours[$sejour->_id] = $sejour;
    // Chargement des planification système
    $planif = new CPlanificationSysteme();
    $ljoin = array();
    $ljoin["affectation"] = "affectation.sejour_id = planification_systeme.sejour_id";
    $where = array();
    $where["planification_systeme.sejour_id"] = " = '{$sejour->_id}'";
Exemplo n.º 23
0
$dateW = $consult->_ref_plageconsult->date;
$whereN = array();
$ljoin = array();
$ljoin["plageconsult"] = "plageconsult.plageconsult_id = consultation.plageconsult_id";
$whereN["patient_id"] = " = '{$consult->patient_id}'";
$whereN["plageconsult.date"] = " >= '{$dateW}'";
$whereN["heure"] = " >= '{$consult->heure}'";
/** @var CConsultation[] $consults */
$consults = $consult->loadListWithPerms(PERM_READ, $whereN, null, null, null, $ljoin);
foreach ($consults as $_consult) {
    $_consult->loadRefPraticien()->loadRefFunction();
    $_consult->loadRefSejour();
}
// sejours
$where = array();
$where[] = "'{$consult->_date}' BETWEEN DATE(entree) AND DATE(sortie)";
$where["sejour.type"] = "!= 'consult'";
$where["sejour.group_id"] = "= '{$group_id}'";
$where["sejour.patient_id"] = "= '{$consult->patient_id}'";
/** @var CSejour[] $sejours */
$sejour = new CSejour();
$sejours = $sejour->loadListWithPerms(PERM_READ, $where);
CMbObject::massLoadFwdRef($sejours, "praticien_id");
foreach ($sejours as $_sejour) {
    $_sejour->loadRefPraticien()->loadRefFunction();
}
$smarty = new CSmartyDP();
$smarty->assign("sejours", $sejours);
$smarty->assign("consult", $consult);
$smarty->assign("next_consults", $consults);
$smarty->display("inc_link_sejour.tpl");
         $lenght = CMBDT::minutesRelative("00:00:00", $_horsplage->temp_operation);
         $op = new CPlanningRange($_horsplage->_guid, $jour . " " . $_horsplage->time_operation, $lenght, $_horsplage, "3c75ea", "horsplage");
         $planning->addRange($op);
     }
     // INTERVENTIONS
     /** @var CPlageOp[] $intervs */
     $interv = new CPlageOp();
     $intervs = $interv->loadList($whereInterv);
     CMbObject::massLoadFwdRef($intervs, "chir_id");
     foreach ($intervs as $_interv) {
         $range = new CPlanningRange($_interv->_guid, $jour . " " . $_interv->debut, CMbDT::minutesRelative($_interv->debut, $_interv->fin), CAppUI::tr($_interv->_class), "bbccee", "plageop");
         $planning->addRange($range);
     }
 }
 $plages = $plage->loadList($where);
 CMbObject::massLoadFwdRef($plages, "chir_id");
 /** @var $_plage CPlageconsult */
 foreach ($plages as $_plage) {
     $_plage->loadRefsFwd(1);
     $_plage->loadRefsConsultations(false);
     $range = new CPlanningRange($_plage->_guid, $jour . " " . $_plage->debut, CMbDT::minutesRelative($_plage->debut, $_plage->fin));
     $range->color = $_plage->color;
     $range->type = "plageconsult";
     $planning->addRange($range);
     foreach ($_plage->_ref_consultations as $_consult) {
         $debute = "{$jour} {$_consult->heure}";
         if ($_consult->patient_id) {
             $_consult->loadRefPatient();
             $color = "#fee";
             if ($_consult->premiere) {
                 $color = "#faa";
Exemplo n.º 25
0
 /**
  * Charge la liste de plages et opérations pour un jour donné
  * Analogue à CMediusers::loadRefsForDay
  *
  * @param string $date Date to look for
  * @param bool   $second_chir Use chir_2, chir_3 and chir_4
  *
  * @return void
  */
 function loadRefsForDay($date, $second_chir = false)
 {
     // Liste des utilisateurs
     $user = new CMediusers();
     $listPrats = $user->loadPraticiens(PERM_READ);
     // Liste des fonctions
     $function = new CFunctions();
     $listFunctions = $function->loadListWithPerms(PERM_READ);
     // Plages d'opérations
     $plage = new CPlageOp();
     $conf_chambre_operation = $plage->conf("chambre_operation");
     $ljoin = array();
     $add_where = "";
     $add_or_where = "";
     if ($second_chir) {
         $ljoin["operations"] = "plagesop.plageop_id = operations.plageop_id";
         $prepare_prats = CSQLDataSource::prepareIn(array_keys($listPrats));
         $add_where = "operations.chir_id " . $prepare_prats . " OR operations.chir_2_id " . $prepare_prats . " OR operations.chir_3_id " . $prepare_prats . " OR operations.chir_4_id " . $prepare_prats;
         $add_or_where = " OR {$add_where}";
     }
     $where = array();
     $where["plagesop.date"] = "= '{$date}'";
     $where["plagesop.salle_id"] = "= '{$this->_id}'";
     $where[] = "`plagesop`.`chir_id` " . CSQLDataSource::prepareIn(array_keys($listPrats)) . " OR `plagesop`.`spec_id` " . CSQLDataSource::prepareIn(array_keys($listFunctions)) . $add_or_where;
     $order = "debut";
     $this->_ref_plages = $plage->loadList($where, $order, null, "plageop_id", $ljoin);
     // Chargement d'optimisation
     CMbObject::massLoadFwdRef($this->_ref_plages, "chir_id");
     CMbObject::massLoadFwdRef($this->_ref_plages, "anesth_id");
     CMbObject::massLoadFwdRef($this->_ref_plages, "spec_id");
     CMbObject::massLoadFwdRef($this->_ref_plages, "salle_id");
     CMbObject::massCountBackRefs($this->_ref_plages, "notes");
     CMbObject::massCountBackRefs($this->_ref_plages, "affectations_personnel");
     foreach ($this->_ref_plages as $_plage) {
         /** @var CPlageOp $_plage */
         $_plage->loadRefChir();
         $_plage->loadRefAnesth();
         $_plage->loadRefSpec();
         $_plage->loadRefSalle();
         $_plage->makeView();
         $_plage->loadRefsOperations();
         $_plage->loadRefsNotes();
         $_plage->loadAffectationsPersonnel();
         $_plage->_unordered_operations = array();
         // Chargement d'optimisation
         CMbObject::massLoadFwdRef($_plage->_ref_operations, "chir_id");
         $sejours = CMbObject::massLoadFwdRef($_plage->_ref_operations, "sejour_id");
         CMbObject::massLoadFwdRef($sejours, "patient_id");
         foreach ($_plage->_ref_operations as $operation) {
             $operation->loadRefAnesth();
             $operation->loadRefChirs();
             $operation->loadRefPatient();
             $operation->loadExtCodesCCAM();
             $operation->loadRefPlageOp();
             if ($conf_chambre_operation) {
                 $operation->loadRefAffectation();
             }
             // Extraire les interventions non placées
             if ($operation->rank == 0) {
                 $_plage->_unordered_operations[$operation->_id] = $operation;
                 unset($_plage->_ref_operations[$operation->_id]);
             }
         }
     }
     // Interventions déplacés
     $deplacee = new COperation();
     $ljoin = array();
     $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id";
     $where = array();
     $where["operations.plageop_id"] = "IS NOT NULL";
     $where["plagesop.salle_id"] = "!= operations.salle_id";
     $where["plagesop.date"] = "= '{$date}'";
     $where["operations.salle_id"] = "= '{$this->_id}'";
     $where[] = "`plagesop`.`chir_id` " . CSQLDataSource::prepareIn(array_keys($listPrats)) . " OR `plagesop`.`spec_id` " . CSQLDataSource::prepareIn(array_keys($listFunctions)) . $add_or_where;
     $order = "operations.time_operation";
     $this->_ref_deplacees = $deplacee->loadList($where, $order, null, "operation_id", $ljoin);
     // Chargement d'optimisation
     CMbObject::massLoadFwdRef($this->_ref_deplacees, "chir_id");
     $sejours_deplacees = CMbObject::massLoadFwdRef($this->_ref_deplacees, "sejour_id");
     CMbObject::massLoadFwdRef($sejours_deplacees, "patient_id");
     foreach ($this->_ref_deplacees as $_deplacee) {
         /** @var COperation $_deplacee */
         $_deplacee->loadRefChirs();
         $_deplacee->loadRefPatient();
         $_deplacee->loadExtCodesCCAM();
         $_deplacee->loadRefPlageOp();
     }
     // Hors plage
     $urgence = new COperation();
     $ljoin = array();
     $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id";
     $where = array();
     $where["operations.date"] = "= '{$date}'";
     $where["operations.plageop_id"] = "IS NULL";
     $where["operations.salle_id"] = "= '{$this->_id}'";
     if ($second_chir) {
         $where[] = $add_where;
     } else {
         $where["operations.chir_id"] = CSQLDataSource::prepareIn(array_keys($listPrats));
     }
     $order = "time_operation, chir_id";
     $this->_ref_urgences = $urgence->loadList($where, $order, null, "operation_id");
     // Chargement d'optimisation
     CMbObject::massLoadFwdRef($this->_ref_urgences, "chir_id");
     $sejours_urgences = CMbObject::massLoadFwdRef($this->_ref_urgences, "sejour_id");
     CMbObject::massLoadFwdRef($sejours_urgences, "patient_id");
     foreach ($this->_ref_urgences as $_urgence) {
         /** @var COperation $_urgence */
         $_urgence->loadRefChirs();
         $_urgence->loadRefPatient();
         $_urgence->loadExtCodesCCAM();
         $_urgence->loadRefPlageOp();
         if ($conf_chambre_operation) {
             $_urgence->loadRefAffectation();
         }
     }
 }
Exemplo n.º 26
0
        $event->plage["id"] = $_commentaire->_id;
        if ($can_edit) {
            $event->addMenuItem("edit", "Modifier ce commentaire");
            $event->addMenuItem("copy", "Copier ce commentaire");
            $event->addMenuItem("cancel", "Supprimer ce commentaire");
        }
        $planning->addEvent($event);
    }
}
// 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";
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$date = CValue::get("date", CMbDT::date());
$group = CGroups::loadCurrent();
$consultation = new CConsultation();
$where = array();
$where["consultation.grossesse_id"] = "IS NOT NULL";
$where["plageconsult.date"] = "= '{$date}'";
$where["group_id"] = " = '{$group->_id}'";
$ljoin = array();
$ljoin["plageconsult"] = "plageconsult.plageconsult_id = consultation.plageconsult_id";
$ljoin["users_mediboard"] = "plageconsult.chir_id = users_mediboard.user_id";
$ljoin["functions_mediboard"] = "functions_mediboard.function_id = users_mediboard.function_id";
$order = "heure ASC";
/** @var CConsultation[] $listConsults */
$listConsults = $consultation->loadList($where, $order, null, null, $ljoin);
$plage = CMbObject::massLoadFwdRef($listConsults, "plageconsult_id");
CMbObject::massLoadFwdRef($plage, "chir_id");
CMbObject::massLoadFwdRef($listConsults, "sejour_id");
$grossesses = CMbObject::massLoadFwdRef($listConsults, "grossesse_id");
CMbObject::massLoadFwdRef($grossesses, "parturiente_id");
foreach ($listConsults as $_consult) {
    $_consult->loadRefPraticien();
    $_consult->loadRefSejour()->loadRefGrossesse();
    $_consult->loadRefGrossesse()->loadRefParturiente();
}
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("listConsults", $listConsults);
$smarty->display("inc_tdb_consultations.tpl");
Exemplo n.º 28
0
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$key = CValue::get("key");
// Load preferences
$preference = new CPreferences();
$where["key"] = "= '{$key}'";
$where["value"] = "IS NOT NULL";
$preferences = $preference->loadList($where);
// Mass preloading
/** @var CUser[] $users */
$users = CMbObject::massLoadFwdRef($preferences, "user_id");
$profiles = CMbObject::massLoadFwdRef($users, "profile_id");
// Attach preferences to users
$default = null;
foreach ($preferences as $_preference) {
    if (!$_preference->user_id) {
        $default = $_preference;
        continue;
    }
    $users[$_preference->user_id]->_ref_preference = $_preference;
}
// Build profile hierarchy
$hierarchy = array("default" => array());
foreach ($users as $_user) {
    if ($_user->profile_id && isset($users[$_user->profile_id])) {
        $hierarchy[$_user->profile_id][] = $_user->_id;
    } else {
Exemplo n.º 29
0
$chir = $plagesel->loadRefChir();
$chir->loadRefFunction();
$_functions = $chir->loadBackRefs("secondary_functions");
// Liste des Specialités
$function = new CFunctions();
$specs = $function->loadSpecialites(PERM_READ, 1);
// Liste des Anesthésistes
$mediuser = new CMediusers();
$anesths = $mediuser->loadAnesthesistes();
CMbObject::massLoadFwdRef($anesths, "function_id");
foreach ($anesths as $_anesth) {
    $_anesth->loadRefFunction();
}
// Liste des praticiens
$chirs = $mediuser->loadChirurgiens();
CMbObject::massLoadFwdRef($chirs, "function_id");
foreach ($chirs as $_chir) {
    $_chir->loadRefFunction();
}
// Chargement du personnel
$listPers = array("iade" => CPersonnel::loadListPers("iade"), "op" => CPersonnel::loadListPers("op"), "op_panseuse" => CPersonnel::loadListPers("op_panseuse"), "sagefemme" => CPersonnel::loadListPers("sagefemme"), "manipulateur" => CPersonnel::loadListPers("manipulateur"));
if ($plagesel->_id) {
    $plagesel->multicountOperations();
    $plagesel->countOperationsAnnulees();
    $plagesel->loadRefsNotes();
    $listPers = $plagesel->loadPersonnelDisponible($listPers);
}
//Création du template
$smarty = new CSmartyDP();
$smarty->assign("listBlocs", $listBlocs);
$smarty->assign("bloc", $bloc);
Exemplo n.º 30
0
 /**
  * Charge la liste de plages et interventions pour un jour donné
  * Analogue à CSalle::loadRefsForDay
  *
  * @param string $date        Date to look for
  * @param bool   $second_chir Use chir_2, chir_3 and chir_4
  *
  * @return void
  */
 function loadRefsForDay($date, $second_chir = false)
 {
     $this->loadBackRefs("secondary_functions");
     $secondary_specs = array();
     foreach ($this->_back["secondary_functions"] as $_sec_spec) {
         /** @var CSecondaryFunction $_sec_spec */
         $_sec_spec->loadRefFunction();
         $_sec_spec->loadRefUser();
         $_function = $_sec_spec->_ref_function;
         $secondary_specs[$_function->_id] = $_function;
     }
     // Plages d'intervention
     $plage = new CPlageOp();
     $ljoin = array();
     $add_where = "";
     if ($second_chir) {
         $ljoin["operations"] = "plagesop.plageop_id = operations.plageop_id";
         $add_where = " OR operations.chir_id = '{$this->_id}' OR operations.chir_2_id = '{$this->_id}'\r\n                    OR operations.chir_3_id = '{$this->_id}' OR operations.chir_4_id = '{$this->_id}'";
     }
     $where = array();
     $where["plagesop.date"] = "= '{$date}'";
     $where[] = "plagesop.chir_id = '{$this->_id}' OR plagesop.spec_id = '{$this->function_id}' OR plagesop.spec_id " . CSQLDataSource::prepareIn(array_keys($secondary_specs)) . $add_where;
     $order = "debut";
     $this->_ref_plages = $plage->loadList($where, $order, null, "plageop_id", $ljoin);
     // Chargement d'optimisation
     CMbObject::massLoadFwdRef($this->_ref_plages, "chir_id");
     CMbObject::massLoadFwdRef($this->_ref_plages, "anesth_id");
     CMbObject::massLoadFwdRef($this->_ref_plages, "spec_id");
     CMbObject::massLoadFwdRef($this->_ref_plages, "salle_id");
     CMbObject::massCountBackRefs($this->_ref_plages, "notes");
     CMbObject::massCountBackRefs($this->_ref_plages, "affectations_personnel");
     foreach ($this->_ref_plages as $_plage) {
         /** @var CPlageOp $_plage */
         $_plage->loadRefChir();
         $_plage->loadRefAnesth();
         $_plage->loadRefSpec();
         $_plage->loadRefSalle();
         $_plage->makeView();
         $_plage->loadRefsOperations();
         $_plage->loadRefsNotes();
         $_plage->loadAffectationsPersonnel();
         $_plage->_unordered_operations = array();
         // Chargement d'optimisation
         CMbObject::massLoadFwdRef($_plage->_ref_operations, "chir_id");
         $sejours = CMbObject::massLoadFwdRef($_plage->_ref_operations, "sejour_id");
         CMbObject::massLoadFwdRef($sejours, "patient_id");
         foreach ($_plage->_ref_operations as $_operation) {
             if ($_operation->chir_id != $this->_id && (!$second_chir || $_operation->chir_2_id != $this->_id && $_operation->chir_3_id != $this->_id && $_operation->chir_4_id != $this->_id)) {
                 unset($_plage->_ref_operations[$_operation->_id]);
             } else {
                 $_operation->_ref_chir = $this;
                 $_operation->loadExtCodesCCAM();
                 $_operation->updateSalle();
                 $_operation->loadRefPatient();
                 // Extraire les interventions non placées
                 if ($_operation->rank == 0) {
                     $_plage->_unordered_operations[$_operation->_id] = $_operation;
                     unset($_plage->_ref_operations[$_operation->_id]);
                 }
             }
         }
         if (count($_plage->_ref_operations) + count($_plage->_unordered_operations) < 1) {
             unset($this->_ref_plages[$_plage->_id]);
         }
     }
     // Interventions déplacés
     $deplacee = new COperation();
     $ljoin = array();
     $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id";
     $where = array();
     $where["operations.plageop_id"] = "IS NOT NULL";
     $where["operations.annulee"] = "= '0'";
     $where["plagesop.salle_id"] = "!= operations.salle_id";
     $where["plagesop.date"] = "= '{$date}'";
     $where[] = "plagesop.chir_id = '{$this->_id}'" . $add_where;
     $order = "operations.time_operation";
     $this->_ref_deplacees = $deplacee->loadList($where, $order, null, "operation_id", $ljoin);
     // Chargement d'optimisation
     CMbObject::massLoadFwdRef($this->_ref_deplacees, "chir_id");
     $sejours_deplacees = CMbObject::massLoadFwdRef($this->_ref_deplacees, "sejour_id");
     CMbObject::massLoadFwdRef($sejours_deplacees, "patient_id");
     foreach ($this->_ref_deplacees as $_deplacee) {
         /** @var COperation $_deplacee */
         $_deplacee->loadRefChir();
         $_deplacee->loadRefPatient();
         $_deplacee->loadExtCodesCCAM();
     }
     // Urgences
     $urgence = new COperation();
     $where = array();
     $where["plageop_id"] = "IS NULL";
     $where["date"] = "= '{$date}'";
     if ($second_chir) {
         $where[] = "chir_id = '{$this->_id}' OR chir_2_id = '{$this->_id}' OR chir_3_id = '{$this->_id}' OR chir_4_id = '{$this->_id}'";
     } else {
         $where["chir_id"] = "= '{$this->_id}'";
     }
     $where["annulee"] = "= '0'";
     $this->_ref_urgences = $urgence->loadList($where, null, null, "operation_id");
     // Chargement d'optimisation
     CMbObject::massLoadFwdRef($this->_ref_urgences, "chir_id");
     $sejours_urgences = CMbObject::massLoadFwdRef($this->_ref_urgences, "sejour_id");
     CMbObject::massLoadFwdRef($sejours_urgences, "patient_id");
     foreach ($this->_ref_urgences as $_urgence) {
         /** @var COperation $_urgence */
         $_urgence->loadRefChir();
         $_urgence->loadRefPatient();
         $_urgence->loadExtCodesCCAM();
     }
 }