*
 * @package    Mediboard
 * @subpackage Hospi
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkEdit();
$affectation_id = CValue::get("affectation_id");
$lit_id = CValue::get("lit_id");
$urgence = CValue::get("urgence");
$from_tempo = CValue::get("from_tempo", 0);
$affectation = new CAffectation();
$affectation->load($affectation_id);
$lit = new C**t();
$lit->load($affectation->lit_id);
if ($urgence) {
    $service_urgence = CGroups::loadCurrent()->service_urgences_id;
    $affectation->function_id = $service_urgence;
}
$sejour_maman = null;
if (CModule::getActive("maternite") && $affectation->sejour_id) {
    $naissance = new CNaissance();
    $naissance->sejour_enfant_id = $affectation->sejour_id;
    $naissance->loadMatchingObject();
    if ($naissance->_id) {
        $sejour_maman = $naissance->loadRefSejourMaman();
        $sejour_maman->loadRefPatient();
    }
}
if ($affectation->_id) {
 /**
  * Récupération de la location du patient
  *
  * @param DOMNode      $node        PV1 Node
  * @param CAffectation $affectation Affectation
  * @param CSejour      $newVenue    Séjour
  *
  * @return void
  */
 function getPL(DOMNode $node, CAffectation $affectation, CSejour $newVenue = null)
 {
     $sender = $this->_ref_sender;
     // Récupération de la chambre
     $nom_chambre = $this->queryTextNode("PL.2", $node);
     $chambre = new CChambre();
     // Récupération du lit
     $nom_lit = $this->queryTextNode("PL.3", $node);
     $lit = new C**t();
     switch ($sender->_configs["handle_PV1_3"]) {
         // idex du service
         case 'idex':
             $chambre_id = CIdSante400::getMatch("CChambre", $sender->_tag_chambre, $nom_chambre)->object_id;
             $chambre->load($chambre_id);
             $lit_id = CIdSante400::getMatch("C**t", $sender->_tag_lit, $nom_lit)->object_id;
             $lit->load($lit_id);
             break;
             // Dans tous les cas le nom du lit est celui que l'on reçoit du flux
         // Dans tous les cas le nom du lit est celui que l'on reçoit du flux
         default:
             $where = $ljoin = array();
             $ljoin["service"] = "service.service_id = chambre.service_id";
             $where["chambre.nom"] = " = '{$nom_chambre}'";
             $where["chambre.annule"] = " = '0'";
             $where["group_id"] = " = '{$sender->group_id}'";
             $chambre->escapeValues();
             $chambre->loadObject($where, null, null, $ljoin);
             $chambre->unescapeValues();
             $where = $ljoin = array();
             $ljoin["chambre"] = "chambre.chambre_id = lit.chambre_id";
             $ljoin["service"] = "service.service_id = chambre.service_id";
             $where["lit.nom"] = " = '{$nom_lit}'";
             $where["lit.annule"] = " = '0'";
             $where["service.cancelled"] = " = '0'";
             $where["group_id"] = " = '{$sender->group_id}'";
             if ($chambre->_id) {
                 $where["chambre.chambre_id"] = " = '{$chambre->_id}'";
             }
             $lit->escapeValues();
             $lit->loadObject($where, null, null, $ljoin);
             $lit->unescapeValues();
             break;
     }
     // Affectation du lit
     $affectation->lit_id = $lit->_id;
     // Affectation de l'UF hébergement
     $date_deb = $affectation->_id ? CMbDT::date($affectation->sortie) : CMbDT::date($newVenue->sortie);
     $date_fin = $affectation->_id ? CMbDT::date($affectation->entree) : CMbDT::date($newVenue->entree);
     $uf = CUniteFonctionnelle::getUF($this->queryTextNode("PL.1", $node), "hebergement", $newVenue->group_id, $date_deb, $date_fin);
     if (!$uf->_id) {
         return;
     }
     $affectation->uf_hebergement_id = $uf->_id;
     // Affectation du service (couloir)
     if (!$affectation->lit_id) {
         $affectation_uf = new CAffectationUniteFonctionnelle();
         $affectation_uf->uf_id = $uf->_id;
         $affectation_uf->object_class = "CService";
         $affectation_uf->loadMatchingObject();
         $affectation->service_id = $affectation_uf->object_id;
     }
 }
Beispiel #3
0
 /**
  * @see parent::fillLimitedTemplate()
  */
 function fillLimitedTemplate(&$template)
 {
     $this->loadRefConsult();
     $this->_ref_consult->loadRefPraticien();
     $this->notify("BeforeFillLimitedTemplate", $template);
     // Duplication des champs de la consultation
     $template->addProperty("RPU - Consultation - Praticien nom", $this->_ref_consult->_ref_praticien->_user_first_name);
     $template->addProperty("RPU - Consultation - Praticien prénom", $this->_ref_consult->_ref_praticien->_user_last_name);
     $template->addProperty("RPU - Consultation - Motif", $this->_ref_consult->motif);
     $template->addProperty("RPU - Consultation - Remarques", $this->_ref_consult->rques);
     $template->addProperty("RPU - Consultation - Examen", $this->_ref_consult->examen);
     $template->addProperty("RPU - Consultation - Traitement", $this->_ref_consult->traitement);
     $template->addProperty("RPU - Diagnostic infirmier", $this->diag_infirmier);
     $template->addProperty("RPU - Prise en charge douleur", $this->pec_douleur);
     $template->addProperty("RPU - PeC Transport", $this->getFormattedValue("pec_transport"));
     $template->addProperty("RPU - Motif", $this->motif);
     $template->addProperty("RPU - CCMU", $this->getFormattedValue("ccmu"));
     $template->addProperty("RPU - Code GEMSA", $this->getFormattedValue("gemsa"));
     $template->addDateTimeProperty("RPU - Départ Radio", $this->radio_debut);
     $template->addDateTimeProperty("RPU - Retour Radio", $this->radio_fin);
     $template->addDateTimeProperty("RPU - Dépôt Biologie", $this->bio_depart);
     $template->addDateTimeProperty("RPU - Réception Biologie", $this->bio_retour);
     $template->addDateTimeProperty("RPU - Attente spécialiste", $this->specia_att);
     $template->addDateTimeProperty("RPU - Arrivée spécialiste", $this->specia_arr);
     $template->addProperty("RPU - Accident du travail", $this->getFormattedValue("date_at"));
     $libelle_at = $this->date_at ? "Accident du travail du " . $this->getFormattedValue("date_at") : "";
     $template->addProperty("RPU - Libellé accident du travail", $libelle_at);
     $template->addProperty("RPU - Sortie autorisée", $this->getFormattedValue("sortie_autorisee"));
     $lit = new C**t();
     if ($this->box_id) {
         $lit->load($this->box_id);
     }
     $template->addProperty("RPU - Box", $lit->_view);
     if (CAppUI::conf("dPurgences old_rpu") == "1") {
         if (CModule::getActive("sherpa")) {
             $template->addProperty("RPU - Soins pour trauma", $this->getFormattedValue("urtrau"));
             $template->addProperty("RPU - Cause du transfert", $this->getFormattedValue("urmuta"));
         }
         $template->addProperty("RPU - Type de pathologie", $this->getFormattedValue("type_pathologie"));
     } else {
         $template->addProperty("RPU - Orientation", $this->getFormattedValue("orientation"));
     }
     if (CModule::getActive("forms")) {
         CExObject::addFormsToTemplate($template, $this, "RPU");
     }
     $this->notify("AfterFillLimitedTemplate", $template);
 }
    if ($prescription->_id) {
        if (@CAppUI::conf("object_handlers CPrescriptionAlerteHandler")) {
            $prescription->_count_fast_recent_modif = $prescription->countAlertsNotHandled("medium");
            $prescription->_count_urgence["all"] = $prescription->countAlertsNotHandled("high");
        } else {
            $prescription->countFastRecentModif();
            $prescription->loadRefsLinesMedByCat();
            $prescription->loadRefsLinesElementByCat();
            $prescription->countUrgence(CMbDT::date($date));
        }
        $sejour->countDocItems();
    }
    $chambre_id = $sejour->_ref_curr_affectation->loadRefLit()->chambre_id;
    if (!$chambre_id && !CAppUI::conf("dPurgences create_affectation")) {
        $lit = new C**t();
        $lit->load($sejour->_ref_rpu->box_id);
        $chambre_id = $lit->chambre_id;
    }
    $sejours_chambre[$chambre_id][] = $sejour;
}
for ($num = 0; $num <= 1; $num++) {
    /** @var CChambre[] $chambres */
    if ($num == 0) {
        $chambres = $chambres_uhcd;
        $nom = "uhcd";
    } else {
        $chambres = $chambres_urgences;
        $nom = "urgence";
    }
    foreach ($chambres as $chambre) {
        $chambre->loadRefService();
        $intervals[$_affectation->_id] = array("lower" => $_affectation->_entree, "upper" => $_affectation->_sortie);
    }
    $lit->_lines = CMbRange::rearrange($intervals);
}
// Pour les alertes, il est nécessaire de charger les autres lits
// de la chambre concernée ainsi que les affectations
$where = array();
$where["entree"] = "<= '{$date_max}'";
$where["sortie"] = ">= '{$date_min}'";
$lits_ids = $chambre->loadBackIds("lits");
foreach ($lits_ids as $_lit_id) {
    if ($lit_id == $_lit_id) {
        continue;
    }
    $_lit = new C**t();
    $_lit->load($_lit_id);
    $where["lit_id"] = "= '{$_lit->_id}'";
    $_affectations = $affectation->loadList($where);
    $_sejours = CStoredObject::massLoadFwdRef($_affectations, "sejour_id");
    CStoredObject::massLoadFwdRef($_sejours, "patient_id");
    CStoredObject::massLoadFwdRef($_sejours, "praticien_id");
    /** @var $_affectations CAffectation[] */
    foreach ($_affectations as $_affectation) {
        $_sejour = $_affectation->loadRefSejour();
        $_sejour->loadRefPraticien();
        $_sejour->loadRefPatient();
    }
    $_lit->_ref_affectations = $_affectations;
    $chambre->_ref_lits[$_lit->_id] = $_lit;
}
if (!CAppUI::conf("dPhospi hide_alertes_temporel")) {
Beispiel #6
0
/**
 * Mettre en cache les lits
 *
 * @param CAffectation $affectation Affectation
 *
 * @return void
 */
function cacheLit(CAffectation $affectation)
{
    // Cache des lits
    $lit_id = $affectation->lit_id;
    static $lits = array();
    if (!array_key_exists($lit_id, $lits)) {
        $lit = new C**t();
        $lit->load($lit_id);
        $lits[$lit_id] = $lit;
    }
    $lit = $lits[$lit_id];
    $lit->_ref_affectations[$affectation->_id] = $affectation;
    // Cache des chambres
    $chambre_id = $lit->chambre_id;
    static $chambres = array();
    if (!array_key_exists($chambre_id, $chambres)) {
        $chambre = new CChambre();
        $chambre->load($chambre_id);
        $chambres[$chambre_id] = $chambre;
    }
    $chambre = $chambres[$chambre_id];
    $chambre->_ref_lits[$lit_id] = $lit;
    // Cache de services
    global $sejoursParService;
    $service_id = $chambre->service_id;
    if (!array_key_exists($service_id, $sejoursParService)) {
        $service = new CService();
        $service->load($service_id);
        $sejoursParService[$service_id] = $service;
    }
    $service = $sejoursParService[$service_id];
    $service->_ref_chambres[$chambre_id] = $chambre;
}
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Hospi
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$keywords = CValue::get("keywords", "%%");
$lit_id = CValue::get("lit_id");
$lit = new C**t();
$lit->load($lit_id);
$liaisons_items = $lit->loadRefsLiaisonsItems();
$items_prestations = CMbObject::massLoadFwdRef($liaisons_items, "item_prestation_id");
$items_prestations_ids = CMbArray::pluck($items_prestations, "object_id");
// Un niveau unique par prestation
$where = array();
$where["object_id"] = CSQLDataSource::prepareNotIn($items_prestations_ids);
$where["object_class"] = " = 'CPrestationJournaliere'";
$where["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
$ljoin = array();
$ljoin["prestation_journaliere"] = "prestation_journaliere.prestation_journaliere_id = item_prestation.object_id";
$item_prestation = new CItemPrestation();
/** @var CItemPrestation[] $items_prestations */
$items_prestations = $item_prestation->seek($keywords, $where, null, null, $ljoin);
$items_by_prestation = array();
$prestations = array();
foreach ($items_prestations as $_item_prestation) {