/** * 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; } }
$ufs_prat_placement[$uf->_id] = $uf; $ufs_medicale[$uf->_id] = $uf; } } } else { $prat_placement = $praticien; } $user = new CMediusers(); $praticiens = array(); if ($affectation->_ref_uf_medicale->_id) { $users = array(); $function_med = array(); $where = array(); $where["affectation_uf.uf_id"] = "= '" . $affectation->_ref_uf_medicale->_id . "'"; $where[] = "object_class = 'CMediusers' OR object_class = 'CFunctions'"; $aff_ufs = new CAffectationUniteFonctionnelle(); $affs = $aff_ufs->loadList($where); foreach ($affs as $_aff) { if ($_aff->object_class == "CMediusers") { $users[$_aff->object_id] = $_aff->object_id; } else { $function_med[$_aff->object_id] = $_aff->object_id; } } $where = array(); $where["actif"] = "= '1'"; $where[] = "user_id " . CSQLDataSource::prepareIn(array_keys($users)) . "OR function_id " . CSQLDataSource::prepareIn(array_keys($function_med)); $praticiens = $user->loadList($where); } else { $praticiens = $user->loadPraticiens(PERM_EDIT, $function->_id); }
function makeUF() { $this->completeField("lit_id", "uf_hebergement_id", "uf_soins_id", "uf_medicale_id", "sortie", "entree"); $this->loadRefsAffectations(); $this->loadRefLit()->loadRefChambre()->loadRefService(); $lit = $this->_ref_lit; $chambre = $lit->_ref_chambre; $service = $this->loadRefService(); $sejour = $this->loadRefSejour(); $prev_aff = $this->_ref_prev; $ljoin = array("uf" => "uf.uf_id = affectation_uf.uf_id"); $where = array(); $where[] = "uf.date_debut IS NULL OR uf.date_debut < '" . CMbDT::date($this->sortie) . "'"; $where[] = "uf.date_fin IS NULL OR uf.date_fin > '" . CMbDT::date($this->entree) . "'"; if (!$this->uf_hebergement_id || $this->fieldModified("service_id") || $this->fieldModified("lit_id")) { $affectation_uf = new CAffectationUniteFonctionnelle(); $where["uf.type"] = "= 'hebergement'"; if (!$affectation_uf->uf_id) { $where["object_id"] = "= '{$lit->_id}'"; $where["object_class"] = "= 'C**t'"; $affectation_uf->loadObject($where, null, null, $ljoin); if (!$affectation_uf->_id) { $where["object_id"] = "= '{$chambre->_id}'"; $where["object_class"] = "= 'CChambre'"; $affectation_uf->loadObject($where, null, null, $ljoin); if (!$affectation_uf->_id) { $where["object_id"] = "= '{$service->_id}'"; $where["object_class"] = "= 'CService'"; $affectation_uf->loadObject($where, null, null, $ljoin); } } } $this->uf_hebergement_id = $affectation_uf->uf_id; } if (!$this->uf_soins_id || $this->fieldModified("service_id")) { $affectation_uf = new CAffectationUniteFonctionnelle(); $where["uf.type"] = "= 'soins'"; if (!$prev_aff->_id) { $affectation_uf->uf_id = $sejour->uf_soins_id; } if (!$affectation_uf->uf_id) { $where["object_id"] = "= '{$service->_id}'"; $where["object_class"] = "= 'CService'"; $affectation_uf->loadObject($where, null, null, $ljoin); } $this->uf_soins_id = $affectation_uf->uf_id; } if (!$this->uf_medicale_id) { $affectation_uf = new CAffectationUniteFonctionnelle(); $where["uf.type"] = "= 'medicale'"; if (!$prev_aff->_id) { $affectation_uf->uf_id = $sejour->uf_medicale_id; } if (!$affectation_uf->uf_id) { if (!$this->praticien_id) { $praticien = $this->loadRefSejour()->loadRefPraticien(); } else { $praticien = $this->loadRefPraticien(); $praticien->loadRefFunction(); } $where["object_id"] = "= '{$praticien->_id}'"; $where["object_class"] = "= 'CMediusers'"; $affectation_uf->loadObject($where, null, null, $ljoin); if (!$affectation_uf->_id) { $function = $praticien->_ref_function; $where["object_id"] = "= '{$function->_id}'"; $where["object_class"] = "= 'CFunctions'"; $affectation_uf->loadObject($where, null, null, $ljoin); } } $this->uf_medicale_id = $affectation_uf->uf_id; } }
* @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 26535 $ */ CCanDo::checkRead(); $uf_id = CValue::getOrSession("uf_id"); $uf = new CUniteFonctionnelle(); $uf->load($uf_id); if ($uf->type == "hebergement") { $type_affectations = array("C**t" => array(), "CChambre" => array(), "CService" => array()); } elseif ($uf->type == "soins") { $type_affectations = array("CService" => array()); } elseif ($uf->type == "medicale") { $type_affectations = array("CMediusers" => array(), "CFunctions" => array()); } foreach ($type_affectations as $type => $tab_type) { $affect = new CAffectationUniteFonctionnelle(); $affect->uf_id = $uf_id; $affect->object_class = $type; $affectations = $affect->loadMatchingList(); foreach ($affectations as $_affect) { /* @var CAffectationUniteFonctionnelle $_affect*/ $_affect->loadTargetObject(); } $type_affectations[$type] = $affectations; } // Création du template $smarty = new CSmartyDP(); $smarty->assign("uf", $uf); $smarty->assign("type_affectations", $type_affectations); $smarty->display("vw_stats_uf.tpl");
function makeUF() { $this->completeField("uf_hebergement_id", "uf_soins_id", "uf_medicale_id", "entree_prevue", "sortie_prevue"); $ljoin = array("uf" => "uf.uf_id = affectation_uf.uf_id"); $where = array(); $where[] = "uf.date_debut IS NULL OR uf.date_debut < '" . CMbDT::date($this->sortie) . "'"; $where[] = "uf.date_fin IS NULL OR uf.date_fin > '" . CMbDT::date($this->entree) . "'"; if (!$this->uf_hebergement_id && !$this->fieldModified("uf_hebergement_id") || $this->fieldModified("service_id")) { $affectation_uf = new CAffectationUniteFonctionnelle(); $where["uf.type"] = "= 'hebergement'"; if (!$affectation_uf->uf_id) { $where["object_id"] = "= '{$this->service_id}'"; $where["object_class"] = "= 'CService'"; $affectation_uf->loadObject($where, null, null, $ljoin); } $this->uf_hebergement_id = $affectation_uf->uf_id; } if (!$this->uf_soins_id && !$this->fieldModified("uf_soins_id") || $this->fieldModified("service_id")) { $affectation_uf = new CAffectationUniteFonctionnelle(); $where["uf.type"] = "= 'soins'"; if (!$affectation_uf->uf_id) { $where["object_id"] = "= '{$this->service_id}'"; $where["object_class"] = "= 'CService'"; $affectation_uf->loadObject($where, null, null, $ljoin); } $this->uf_soins_id = $affectation_uf->uf_id; } if (!$this->uf_medicale_id && !$this->fieldModified("uf_medicale_id")) { $affectation_uf = new CAffectationUniteFonctionnelle(); $where["uf.type"] = "= 'medicale'"; if (!$affectation_uf->uf_id) { $praticien = $this->loadRefPraticien(); $praticien->loadRefFunction(); $where["object_id"] = "= '{$praticien->_id}'"; $where["object_class"] = "= 'CMediusers'"; $affectation_uf->loadObject($where, null, null, $ljoin); if (!$affectation_uf->_id) { $function = $praticien->_ref_function; $where["object_id"] = "= '{$function->_id}'"; $where["object_class"] = "= 'CFunctions'"; $affectation_uf->loadObject($where, null, null, $ljoin); } } $this->uf_medicale_id = $affectation_uf->uf_id; } }