/**
  * Charge la prestation
  *
  * @return CPrestationPonctuelle|CPrestationJournaliere
  */
 function loadRefObject()
 {
     $this->_ref_object = new $this->object_class();
     $this->_ref_object = $this->_ref_object->getCached($this->object_id);
     $this->_shortview = $this->_ref_object->nom . ' - ' . $this->nom;
     return $this->_ref_object;
 }
// Cas de la semaine 00
if ($granularite == "4weeks" && count($days) == 5) {
    array_pop($days);
}
$where["sejour.entree"] = "< '{$date_max}'";
$where["sejour.sortie"] = "> '{$date_min}'";
if ($duree_uscpo) {
    $ljoin["operations"] = "operations.sejour_id = sejour.sejour_id";
    $where["duree_uscpo"] = "> 0";
}
if ($isolement) {
    $where["isolement"] = "= '1'";
}
$items_prestation = array();
if ($prestation_id) {
    $prestation = new CPrestationJournaliere();
    $prestation->load($prestation_id);
    $items_prestation = $prestation->loadBackRefs("items", "rank asc");
}
if ($item_prestation_id && $prestation_id) {
    // L'axe de prestation a pu changer, donc ne pas appliquer l'item de prestation s'il ne fait pas partie de l'axe choisi
    if (isset($items_prestation[$item_prestation_id])) {
        $ljoin["item_liaison"] = "sejour.sejour_id = item_liaison.sejour_id";
        $where["item_liaison.item_souhait_id"] = " = '{$item_prestation_id}'";
    }
}
$sejours = $sejour->loadList($where, $order, null, null, $ljoin);
$praticiens = CStoredObject::massLoadFwdRef($sejours, "praticien_id");
CStoredObject::massLoadFwdRef($sejours, "prestation_id");
CStoredObject::massLoadFwdRef($praticiens, "function_id");
CStoredObject::massLoadFwdRef($sejours, "patient_id");
 /**
  * Récupération du code tarif du séjour
  *
  * @param DOMNode $node     PV1 Node
  * @param CSejour $newVenue Admit
  *
  * @return void
  */
 function getFinancialClass(DOMNode $node, CSejour $newVenue)
 {
     $sender = $this->_ref_sender;
     if ($sender->_configs["handle_PV1_20"] == "none") {
         return;
     }
     $systeme_presta = CAppUI::conf("dPhospi prestations systeme_prestations", "CGroups-" . $newVenue->group_id);
     if ($systeme_presta == "standard") {
         return;
     }
     // Uniquement pour les prestas expertes
     $prestation = explode("#", $this->queryTextNode("PV1.20", $node));
     $presta_name = CMbArray::get($prestation, 0);
     $item_name = CMbArray::get($prestation, 1);
     $item_presta = new CItemPrestation();
     if ($item_name) {
         // Chargement de la prestation journalière
         $presta_journa = new CPrestationJournaliere();
         $presta_journa->nom = $presta_name;
         $presta_journa->loadMatchingObject();
         $item_presta->object_class = "CPrestationJournaliere";
         $item_presta->object_id = $presta_journa->_id;
     } else {
         $item_name = $presta_name;
     }
     // Chargement d'un item de prestation
     $item_presta->nom = $item_name;
     $item_presta->loadMatchingObject();
     if (!$item_presta->_id) {
         return;
     }
     $item_liaison = new CItemLiaison();
     $ljoin = array("item_prestation" => "item_prestation.item_prestation_id = item_liaison.item_souhait_id", "prestation_journaliere" => "item_prestation.object_id = prestation_journaliere_id");
     $where["item_liaison.sejour_id"] = " = '{$newVenue->_id}'";
     $where["item_liaison.date"] = " = '" . CMbDT::date($newVenue->entree) . "'";
     $where["prestation_journaliere.prestation_journaliere_id"] = " = '{$presta_journa->_id}'";
     $item_liaison->loadObject($where, null, null, $ljoin);
     if (!$item_liaison->_id) {
         $item_liaison->sejour_id = $newVenue->_id;
         $item_liaison->date = CMbDT::date($newVenue->entree);
     }
     $item_liaison->item_souhait_id = $item_presta->_id;
     $item_liaison->_eai_sender_guid = $sender->_guid;
     $item_liaison->store();
 }
Exemple #4
0
}
$sejours = $sejours->loadListByReq($sejourReq);
$listDays = array();
$listPrats = array();
// Liste des services
$service = new CService();
$where = array();
$where["group_id"] = "= '{$group->_id}'";
$where["cancelled"] = "= '0'";
$order = "nom";
$services = $service->loadListWithPerms(PERM_READ, $where, $order);
$prestation_id = CAppUI::pref("prestation_id_hospi");
if (CAppUI::conf("dPhospi prestations systeme_prestations", $group) == "standard" || $prestation_id == "all") {
    $prestation_id = "";
}
$prestation = new CPrestationJournaliere();
$prestation->load($prestation_id);
CMbObject::massLoadFwdRef($sejours, "patient_id");
CMbObject::massLoadFwdRef($sejours, "praticien_id");
// ATTENTION ne pas supprimer le "&" car pose des problemes
foreach ($sejours as $key => &$sejour) {
    /** @var CSejour $sejour*/
    $sejour->loadRefsAffectations();
    $sejour->loadRefsOperations();
    $sejour->loadRefPatient();
    $sejour->_ref_first_affectation->loadRefLit()->loadRefChambre();
    $affectation = $sejour->_ref_first_affectation;
    $affectation->_ref_lit->loadCompleteView();
    if ($prestation_id) {
        $sejour->loadLiaisonsForPrestation($prestation_id);
    }
            continue;
        }
        if (!$show_cancelled) {
            if (!$_op->annulee) {
                $operations_by_salle[$salle_id][$_op->_id] = $_op;
            }
        } else {
            $operations_by_salle[$salle_id][$_op->_id] = $_op;
        }
    }
}
// Ajout des événements (opérations)
$can_edit = CCanDo::edit();
$diff_hour_urgence = CAppUI::conf("reservation diff_hour_urgence");
//prestations
$prestations_journalieres = CPrestationJournaliere::loadCurrentList();
$prestation_id = CAppUI::pref("prestation_id_hospi");
if ($show_operations) {
    /** @var $_operation COperation */
    foreach ($operations_by_salle as $salle_id => $_operations) {
        $i = array_search($salle_id, $salles_ids);
        foreach ($_operations as $_operation) {
            //CSQLDataSource::$trace = true;
            //en plage & non validé, skip
            if ($_operation->plageop_id && !$_operation->rank) {
                continue;
            }
            $_operation->_ref_salle = $salles[$_operation->salle_id];
            $workflow = $_operation->loadRefWorkflow();
            $sejour = $_operation->loadRefSejour();
            $chir = $_operation->loadRefChir();
/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage PlanningOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$sejour_id = CValue::get("sejour_id");
$context = CValue::get("context", "all");
$relative_date = CValue::get("relative_date");
$sejour = new CSejour();
$sejour->load($sejour_id);
$prestations_j = CPrestationJournaliere::loadCurrentList($sejour->type);
$dates = array();
$prestations_p = array();
$liaisons_j = array();
$liaisons_p = array();
$date_modif = array();
CStoredObject::massLoadBackRefs($prestations_j, "items", "rank");
foreach ($prestations_j as $_prestation) {
    $items = $_prestation->loadRefsItems();
    CStoredObject::massLoadBackRefs($items, "sous_items", "nom");
    foreach ($items as $_item) {
        $_item->loadRefsSousItems();
    }
}
$sejour->loadRefPrescriptionSejour();
$sejour->loadRefCurrAffectation();
Exemple #7
0
            $where["affectation.sortie"] = "BETWEEN '{$limit1}' AND '{$limit2}'";
            if (isset($where["sejour.entree"])) {
                unset($where["sejour.entree"]);
            }
            if (isset($whereNP["sejour.entree"])) {
                unset($whereNP["sejour.entree"]);
            }
            $where["sejour.sortie"] = "= affectation.sortie";
            $whereNP["sejour.sortie"] = "BETWEEN '{$limit1}' AND '{$limit2}'";
        }
        $_liste["place"] = $affectation->countList($where, null, $ljoin);
        $_liste["non_place"] = $sejour->countList($whereNP, null, $ljoinNP);
    }
}
$smarty = new CSmartyDP();
$smarty->assign("presents", $presents);
$smarty->assign("presentsNP", $presentsNP);
$smarty->assign("mouvements", $mouvements);
$smarty->assign("dep_entrants", $dep_entrants);
$smarty->assign("dep_sortants", $dep_sortants);
$smarty->assign("praticiens", $praticiens);
$smarty->assign("praticien_id", $praticien_id);
$smarty->assign("type_hospi", $type_hospi);
$smarty->assign("vue", $vue);
$smarty->assign("date", $date);
$smarty->assign("mode", $mode);
$smarty->assign("hour_instantane", $hour_instantane);
$smarty->assign("isImedsInstalled", CModule::getActive("dPImeds") && CImeds::getTagCIDC(CGroups::loadCurrent()));
$smarty->assign("prestations_journalieres", CPrestationJournaliere::loadCurrentList());
$smarty->assign("prestation_id", $prestation_id);
$smarty->display("edit_sorties.tpl");
Exemple #8
0
 /**
  * Charge les liaisons de prestations pour une prestation entre deux date
  *
  * @param ref  $prestation_id Prestation de référence
  * @param null $date_min      Date minimale
  * @param null $date_max      Date maximale
  *
  * @return CStoredObject[]
  */
 function loadLiaisonsForPrestation($prestation_id, $date_min = null, $date_max = null)
 {
     $this->_liaisons_for_prestation = array();
     if ($prestation_id == "all") {
         $presta = new CPrestationJournaliere();
         $prestation_id = $presta->loadIds();
     } else {
         $prestation_id = array($prestation_id);
     }
     if (!$date_max) {
         $date_max = $date_min;
     }
     $where = array("sejour_id" => "= '{$this->_id}'");
     $ljoin = array("item_prestation" => "item_prestation.item_prestation_id = item_liaison.item_souhait_id\r\n      OR item_prestation.item_prestation_id = item_liaison.item_realise_id");
     foreach ($prestation_id as $_presta_id) {
         $item_liaison = new CItemLiaison();
         if ($date_min && $date_max) {
             $where["date"] = "BETWEEN '{$date_min}' AND '{$date_max}'";
         }
         $where["object_id"] = "= '{$_presta_id}'";
         $liaisons = $item_liaison->loadList($where, null, null, "item_liaison_id", $ljoin);
         // S'il n'y a pas de liaison (ou que la première liaison est après la date de début)
         // et qu'une période est donnée, on cherche la dernière liaison disponible
         // avant la date de début
         $first_liaison = reset($liaisons);
         if ($date_min && $date_max && (!count($liaisons) || $first_liaison->date > $date_min)) {
             $where["date"] = "< '{$date_min}'";
             $item_liaison->loadObject($where, "date DESC", null, $ljoin);
             $liaisons = array_merge($liaisons, array($item_liaison));
         }
         foreach ($liaisons as $_liaison) {
             $this->_liaisons_for_prestation[$_liaison->_id] = $_liaison;
         }
     }
     CMbObject::massLoadFwdRef($this->_liaisons_for_prestation, "item_souhait_id");
     CMbObject::massLoadFwdRef($this->_liaisons_for_prestation, "item_realise_id");
     CMbObject::massLoadFwdRef($this->_liaisons_for_prestation, "sous_item_id");
     /** @var CItemLiaison $_liaison */
     foreach ($this->_liaisons_for_prestation as $_liaison) {
         $_liaison->loadRefItem();
         $_liaison->loadRefSousItem();
         $_liaison->loadRefItemRealise();
     }
     array_multisort(CMbArray::pluck($this->_liaisons_for_prestation, "date"), SORT_ASC, $this->_liaisons_for_prestation);
     return $this->_liaisons_for_prestation;
 }
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Hospi
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$prestation_guid = CValue::getOrSession("prestation_guid");
$where = array();
$where["group_id"] = " = '" . CGroups::loadCurrent()->_id . "'";
$prestation_journaliere = new CPrestationJournaliere();
$prestation_ponctuelle = new CPrestationPonctuelle();
$prestations[$prestation_journaliere->_class] = $prestation_journaliere->loadList($where);
$prestations[$prestation_ponctuelle->_class] = $prestation_ponctuelle->loadList($where);
foreach ($prestations as $_prestations_by_class) {
    foreach ($_prestations_by_class as $_prestation) {
        $_prestation->_count_items = $_prestation->countBackRefs("items");
    }
}
$smarty = new CSmartyDP();
$smarty->assign("prestations", $prestations);
$smarty->assign("prestation_guid", $prestation_guid);
$smarty->display("inc_list_prestations.tpl");