/** * Load service * * @return CService */ function loadRefService() { if (!$this->_ref_chambre) { $this->loadRefChambre(); } return $this->_ref_service = $this->_ref_chambre->loadRefService(); }
/** * 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; } }
/** * Récupération de l'emplacement du patient * * @param DOMNode $node Node * @param CSejour $newVenue Sejour * @param CAffectation $affectation Affectation * * @return void */ function getEmplacement(DOMNode $node, CSejour $newVenue, CAffectation $affectation) { $xpath = new CHPrimXPath($node->ownerDocument); $sender = $this->_ref_echange_hprim->_ref_sender; $chambreSeul = $xpath->queryAttributNode("hprim:emplacement", $node, "chambreSeul"); if ($chambreSeul) { $newVenue->chambre_seule = $chambreSeul == "oui" ? 1 : 0; } $emplacement = $xpath->queryUniqueNode("hprim:emplacement", $node); // Récupération de la chambre $chambre_node = $xpath->queryUniqueNode("hprim:chambre", $emplacement); $nom_chambre = $xpath->queryTextNode("hprim:code", $chambre_node); $chambre = new CChambre(); // Récupération du lit $lit_node = $xpath->queryUniqueNode("hprim:lit", $emplacement); $nom_lit = $xpath->queryTextNode("hprim:code", $lit_node); $lit = new C**t(); $where = $ljoin = array(); $ljoin["service"] = "service.service_id = chambre.service_id"; $where["chambre.nom"] = " = '{$nom_chambre}'"; $where["group_id"] = " = '{$sender->group_id}'"; $where["chambre.annule"] = " = '0'"; $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(); // Affectation du lit $affectation->lit_id = $lit->_id; }
/** * Chargements des chambres du service * * @param bool $annule Charge les chambres desactivées aussi * * @return CChambre[] */ function loadRefsChambres($annule = true) { $chambre = new CChambre(); $where = array("service_id" => "= '{$this->_id}'"); if (!$annule) { $where["annule"] = "= '0'"; } $order = "ISNULL(rank), rank, nom"; return $this->_ref_chambres = $this->_back["chambres"] = $chambre->loadList($where, $order); }
* @subpackage Hospi * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 24144 $ */ global $g; CCanDo::checkRead(); // Récupération des paramètres $date = CValue::getOrSession("date", CMbDT::dateTime()); $service_id = CValue::get("service_id"); $chambre_id = CValue::get("chambre_id"); $service = new CService(); if ($service_id) { $service->load($service_id); } elseif ($chambre_id) { $chambre = new CChambre(); $chambre->load($chambre_id); $service = $chambre->loadRefService(); } $ensemble_lits_charges = array(); $grille = array_fill(0, 10, array_fill(0, 10, 0)); $chambres = $service->loadRefsChambres(); foreach ($chambres as $ch) { /* @var CChambre $ch*/ $ch->loadRefEmplacement(); if ($ch->_ref_emplacement->_id) { $ch->loadRefsLits(); if (!count($ch->_ref_lits)) { unset($chambres[$ch->_id]); continue; }
* * @package Mediboard * @subpackage Urgences * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 27226 $ */ CCanDo::checkRead(); // Récupération des paramètres //$date = CValue::getOrSession("date", CMbDT::date()); $date = CMbDT::dateTime(); $date_tolerance = CAppUI::conf("dPurgences date_tolerance"); $date_before = CMbDT::date("-{$date_tolerance} DAY", $date); $date_after = CMbDT::date("+1 DAY", $date); //recherche des chambres d'urgences placées $chambre = new CChambre(); $ljoin = array(); $ljoin["service"] = "service.service_id = chambre.service_id"; $ljoin["emplacement"] = "emplacement.chambre_id = chambre.chambre_id"; $where = array(); $where["annule"] = "= '0'"; $where[] = "service.urgence = '1' OR service.radiologie = '1'"; $where["service.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'"; $where["emplacement.plan_x"] = "IS NOT NULL"; $chambres_urgences = $chambre->loadList($where, null, null, "chambre_id", $ljoin); $where = array(); $where["annule"] = "= '0'"; $where["service.uhcd"] = "= '1'"; $where["service.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'"; $where["emplacement.plan_x"] = "IS NOT NULL"; $chambres_uhcd = $chambre->loadList($where, null, null, "chambre_id", $ljoin);
} /** * Construit le tag Chambre en fonction des variables de configuration * * @param string $group_id Permet de charger l'id externe d'une chambre pour un établissement donné si non null * * @return string|null */ static function getTagChambre($group_id = null) { // Pas de tag Chambre if (null == ($tag_chambre = CAppUI::conf("dPhospi CChambre tag"))) { return null; } // Permettre des id externes en fonction de l'établissement $group = CGroups::loadCurrent(); if (!$group_id) { $group_id = $group->_id; } return str_replace('$g', $group_id, $tag_chambre); } /** * @see parent::getDynamicTag */ function getDynamicTag() { return $this->conf("tag"); } } CChambre::$_prefixe = CAppUI::conf("dPhospi CChambre prefixe");
/** * Update the form (derived) fields plain fields * * @return void */ function updateFormFields() { parent::updateFormFields(); $this->_view = $this->libelle ? $this->libelle : $this->nom; $this->_type_echange = $this->_class; $this->_self_tag = $this->getTag($this->group_id); $this->_tag_patient = CPatient::getTagIPP($this->group_id); $this->_tag_sejour = CSejour::getTagNDA($this->group_id); $this->_tag_consultation = CConsultation::getObjectTag($this->group_id); $this->_tag_mediuser = CMediusers::getObjectTag($this->group_id); $this->_tag_service = CService::getObjectTag($this->group_id); $this->_tag_chambre = CChambre::getObjectTag($this->group_id); $this->_tag_lit = C**t::getObjectTag($this->group_id); $this->_tag_movement = CMovement::getObjectTag($this->group_id); $this->_tag_visit_number = CSmp::getObjectTag($this->group_id); }
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 21168 $ */ CCanDo::checkRead(); // Récupération des paramètres $service_id = CValue::postOrSession("service_id"); //Chargement de tous les services $service = new CService(); $where = array(); $where["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'"; $where["cancelled"] = "= '0'"; $services = $service->loadGroupList($where, "nom ASC"); $service_selectionne = new CService(); $where["service_id"] = " = '{$service_id}'"; $service_selectionne->loadObject($where); $chambre = new CChambre(); $where = array(); $where["service_id"] = " = '{$service_selectionne->_id}'"; $chambres_service = $chambre->loadGroupList($where); $ljoin = array(); $ljoin["service"] = "service.service_id = chambre.service_id"; $ljoin["emplacement"] = "emplacement.chambre_id = chambre.chambre_id"; $where = array(); $where["annule"] = "= '0'"; $where["emplacement.plan_x"] = "IS NOT NULL"; $where["emplacement.plan_y"] = "IS NOT NULL"; $where["service.service_id"] = " = '{$service_id}'"; $where["service.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'"; $chambre_places = $chambre->loadGroupList($where, null, null, null, $ljoin); $chambres_non_placees = $chambres_service; if (count($chambre_places)) {
$service->urgence = 0; $service->uhcd = 0; $service->hospit_jour = 0; $service->externe = 0; $service->cancelled = 0; $msg = $service->store(); if ($msg) { CAppUI::setMsg($msg, UI_MSG_ERROR); $results[$i]["error"] = $msg; $i++; continue; } CAppUI::setMsg("Service créé", UI_MSG_OK); } // Chambre $chambre = new CChambre(); $chambre->nom = $results[$i]["chambre"]; $chambre->service_id = $service->_id; $chambre->loadMatchingObject(); if (!$chambre->_id) { $chambre->lits_alpha = 0; $chambre->annule = 0; $msg = $chambre->store(); if ($msg) { CAppUI::setMsg($msg, UI_MSG_ERROR); $results[$i]["error"] = $msg; $i++; continue; } CAppUI::setMsg("Chambre créée", UI_MSG_OK); }
$ljoin["users_mediboard"] = "plageconsult.chir_id = users_mediboard.user_id"; $ljoin["functions_mediboard"] = "users_mediboard.function_id = functions_mediboard.function_id"; $where["functions_mediboard.group_id"] = " = '{$current_group}'"; $res_current_etab["CConsultation"] = $consultation->countList($where, null, $ljoin); // - Lits $ljoin = array(); $where = array(); $lit = new C**t(); $ljoin["chambre"] = "lit.chambre_id = chambre.chambre_id"; $ljoin["service"] = "chambre.service_id = service.service_id"; $where["service.group_id"] = " = '{$current_group}'"; $res_current_etab["C**t"] = $lit->countList($where, null, $ljoin); // - Chambres $ljoin = array(); $where = array(); $chambre = new CChambre(); $ljoin["service"] = "chambre.service_id = service.service_id"; $where["service.group_id"] = " = '{$current_group}'"; $res_current_etab["CChambre"] = $chambre->countList($where, null, $ljoin); // - Utilisateurs $ljoin = array(); $where = array(); $mediuser = new CMediusers(); $ljoin["functions_mediboard"] = "users_mediboard.function_id = functions_mediboard.function_id"; $where["functions_mediboard.group_id"] = " = '{$current_group}'"; $res_current_etab["CMediusers"] = $mediuser->countList($where, null, $ljoin); $smarty->assign("res_current_etab", $res_current_etab); $smarty->display("inc_metrique_current_etab.tpl"); } else { $ds = CSQLDataSource::get("std"); $etab = CGroups::loadCurrent();
/** * 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; }
* @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $service_id = CValue::getOrSession("service_id"); $chambre_id = CValue::getOrSession("chambre_id"); $lit_id = CValue::getOrSession("lit_id"); $group = CGroups::loadCurrent(); // Chargement de la chambre à ajouter/editer $chambre = new CChambre(); $chambre->service_id = $service_id; $chambre->load($chambre_id); $chambre->loadRefsNotes(); $chambre->loadRefService(); foreach ($chambre->loadRefsLits(true) as $_lit) { $_lit->loadRefsNotes(); } // Récupération des chambres/services $where = array(); $where["group_id"] = "= '{$group->_id}'"; $order = "nom"; $service = new CService(); $services = $service->loadListWithPerms(PERM_READ, $where, $order); // Création du template $smarty = new CSmartyDP(); $smarty->assign("services", $services); $smarty->assign("chambre", $chambre); $smarty->assign("tag_chambre", CChambre::getTagChambre($group->_id)); $smarty->assign("tag_lit", C**t::getTagLit($group->_id)); $smarty->display("inc_vw_chambre.tpl");
/** * $Id: ajax_choice_lit.php 21637 2014-01-13 13:21:23Z aurelie17 $ * * @package Mediboard * @subpackage Hospi * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 21637 $ */ // Récupération des paramètres $chambre_id = CValue::get("chambre_id"); $patient_id = CValue::get("patient_id"); $vue_hospi = CValue::get("vue_hospi", false); $date = CValue::getOrSession("date", CMbDT::date()); $chambre = new CChambre(); $chambre->load($chambre_id); $chambre->loadRefsLits(); $patient = new CPatient(); $patient->load($patient_id); $affectations = array(); $nb_lits = 0; $q = ""; foreach ($chambre->_ref_lits as $lit) { if ($nb_lits) { $q .= " OR "; } if ($vue_hospi) { $q .= "lit_id = '" . $lit->_id . "'"; } else { $q .= "rpu.box_id = '" . $lit->_id . "'";