<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage dPfacturation
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @version    $Revision$
 */
CCanDo::checkEdit();
$prat_id = CValue::getOrSession("prat_id", "0");
$retrocession_id = CValue::get("retrocession_id");
$retro = new CRetrocession();
if ($retrocession_id) {
    $retro->load($retrocession_id);
    $retro->loadRefPraticien();
} else {
    $retro->praticien_id = $prat_id;
    $retro->type = "montant";
}
$mediuser = new CMediusers();
$listPrat = $mediuser->loadPraticiens();
// Creation du template
$smarty = new CSmartyDP();
$smarty->assign("listPrat", $listPrat);
$smarty->assign("retrocession", $retro);
$smarty->display("vw_edit_retrocession.tpl");
if ($mediuser->isPraticien()) {
    $chirSel = $mediuser->_id;
}
$user = new CMediusers();
$user->load($chirSel);
$ljoin = array();
$ljoin["plagesop"] = "plagesop.plageop_id = operations.plageop_id";
$where = array();
$where["operations.date"] = "BETWEEN '{$debut}' AND '{$fin}'";
$where["operations.annulee"] = "= '0'";
/**
 * Loading and analysis code above is duplicated for COperation and CConsultation
 * @TODO Unifiy them as CCodables, for chrissake !!
 */
if ($all_prats) {
    $prats = $user->loadPraticiens(PERM_READ);
    $in_prats = CSQLDataSource::prepareIn(array_keys($prats));
    $where[] = "operations.chir_id " . $in_prats . " OR operations.chir_2_id " . $in_prats . " OR operations.chir_3_id " . $in_prats . " OR operations.chir_4_id " . $in_prats;
    $where[] = "operations.anesth_id IS NULL OR operations.anesth_id {$in_prats}";
} else {
    $where_chir = "operations.chir_id = '{$user->_id}' OR operations.chir_2_id = '{$user->_id}'\n                    OR operations.chir_3_id = '{$user->_id}' OR operations.chir_4_id = '{$user->_id}'";
    if ($user->isAnesth()) {
        $where[] = "{$where_chir} OR\n      operations.anesth_id = '{$user->_id}' OR\n      (operations.anesth_id IS NULL && plagesop.anesth_id = '{$user->_id}')";
    } else {
        $where[] = $where_chir;
    }
}
/** @var COperation[] $interventions */
$operation = new COperation();
if (!$interv_with_no_codes) {
    $where[] = "LENGTH(codes_ccam) > 0";
CCanDo::checkRead();
$user = CMediusers::get();
$praticien_id = CValue::getOrSession("prat_bilan_id", $user->_id);
$signee = CValue::getOrSession("signee", 0);
// par default les non signees
$date_min = CValue::getOrSession("_date_entree_prevue", CMbDT::date());
// par default, date du jour
$date_max = CValue::getOrSession("_date_sortie_prevue", CMbDT::date());
$type_prescription = CValue::getOrSession("type_prescription", "sejour");
// sejour - externe - sortie_manquante
$board = CValue::get("board", 0);
$date_min = $date_min . " 00:00:00";
$date_max = $date_max . " 23:59:59";
// Chargement de la liste des praticiens
$mediuser = new CMediusers();
$praticiens = $mediuser->loadPraticiens();
$prescriptions = array();
$prescription = new CPrescription();
// Recherche des prescriptions
$where = array();
if ($type_prescription == "sejour" || $type_prescription == "sortie_manquante") {
    $group_id = CGroups::loadCurrent()->_id;
    $ljoin["sejour"] = "prescription.object_id = sejour.sejour_id";
    $ljoin["patients"] = "patients.patient_id = sejour.patient_id";
    $where["prescription.type"] = " = 'sejour'";
    $where["sejour.entree"] = " <= '{$date_max}'";
    $where["sejour.sortie"] = " >= '{$date_min}'";
    $where["sejour.group_id"] = " = '{$group_id}'";
} else {
    $ljoin["consultation"] = "prescription.object_id = consultation.consultation_id";
    $ljoin["plageconsult"] = "consultation.plageconsult_id = plageconsult.plageconsult_id";
$filter = new CSejour();
$filter->_date_min = CValue::get("_date_min", CMbDT::date("-1 YEAR"));
$rectif = CMbDT::transform("+0 DAY", $filter->_date_min, "%d") - 1;
$filter->_date_min = CMbDT::date("-{$rectif} DAYS", $filter->_date_min);
$filter->_date_max = CValue::get("_date_max", CMbDT::date());
$rectif = CMbDT::transform("+0 DAY", $filter->_date_max, "%d") - 1;
$filter->_date_max = CMbDT::date("-{$rectif} DAYS", $filter->_date_max);
$filter->_date_max = CMbDT::date("+ 1 MONTH", $filter->_date_max);
$filter->_date_max = CMbDT::date("-1 DAY", $filter->_date_max);
$filter->_service = CValue::get("service_id", 0);
$filter->type = CValue::get("type", 1);
$filter->praticien_id = CValue::get("prat_id", 0);
$filter->_specialite = CValue::get("discipline_id", 0);
$filter->septique = CValue::get("septique", 0);
$type_data = CValue::get("type_data", "prevue");
$user = new CMediusers();
$listPrats = $user->loadPraticiens(PERM_READ);
$service = new CService();
$where = array();
$where["cancelled"] = "= '0'";
$listServices = $service->loadGroupList($where);
$listDisciplines = new CDiscipline();
$listDisciplines = $listDisciplines->loadUsedDisciplines();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("filter", $filter);
$smarty->assign("type_data", $type_data);
$smarty->assign("listPrats", $listPrats);
$smarty->assign("listServices", $listServices);
$smarty->assign("listDisciplines", $listDisciplines);
$smarty->display("vw_hospitalisation.tpl");
$now = CMbDT::date();
$week_deb = CMbDT::date("last sunday", $now);
$week_fin = CMbDT::date("next sunday", $week_deb);
$week_deb = CMbDT::date("+1 day", $week_deb);
$rectif = CMbDT::transform("+0 DAY", $now, "%d") - 1;
$month_deb = CMbDT::date("-{$rectif} DAYS", $now);
$month_fin = CMbDT::date("+1 month", $month_deb);
$month_fin = CMbDT::date("-1 day", $month_fin);
// Chargement du filter permettant de faire la recherche
$filter = new COperation();
$filter->_date_min = $now;
$filter->_date_max = $now;
// Chargement de la liste de tous les praticiens
$praticien = new CMediusers();
$praticiens = array();
if ($user->isFromType(array("Administrator"))) {
    $praticiens = $praticien->loadPraticiens(PERM_EDIT);
}
if ($user->isPraticien()) {
    $praticiens[] = $user;
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("filter", $filter);
$smarty->assign("now", $now);
$smarty->assign("week_deb", $week_deb);
$smarty->assign("week_fin", $week_fin);
$smarty->assign("month_deb", $month_deb);
$smarty->assign("month_fin", $month_fin);
$smarty->assign("praticiens", $praticiens);
$smarty->display("vw_edit_compta.tpl");
$operation = new COperation();
$where = array();
$ljoin = array();
$where["operations.date"] = "= '{$date_planning}'";
if (!$show_cancelled) {
    $where["operations.annulee"] = " != '1'";
}
//$where["operations.plageop_id"] = "IS NULL";
if ($bloc_id) {
    $ljoin["sallesbloc"] = "sallesbloc.salle_id = operations.salle_id";
    $ljoin["bloc_operatoire"] = "bloc_operatoire.bloc_operatoire_id = sallesbloc.bloc_id";
    $where["operations.salle_id"] = CSQLDataSource::prepareIn($salles_ids);
    $where["sallesbloc.bloc_id"] = "= '{$bloc_id}'";
}
$praticien = new CMediusers();
$praticiens = $praticien->loadPraticiens();
$where["operations.chir_id"] = CSQLDataSource::prepareIn(array_keys($praticiens), $praticien_id);
/** @var COperation[] $operations */
$operations = $operation->loadListWithPerms(PERM_READ, $where, null, null, "operations.operation_id", $ljoin);
$nbIntervHorsPlage = CIntervHorsPlage::countForDates($date_planning, null, array($praticien_id));
$prats = CStoredObject::massLoadFwdRef($operations, "chir_id");
CStoredObject::massLoadFwdRef($prats, "function_id");
CStoredObject::massLoadFwdRef($operations, "plageop_id");
CStoredObject::massLoadFwdRef($operations, "salle_id");
CStoredObject::massLoadFwdRef($operations, "anesth_id");
CStoredObject::massLoadFwdRef($operations, "chir_2_id");
CStoredObject::massLoadFwdRef($operations, "chir_3_id");
CStoredObject::massLoadFwdRef($operations, "chir_4_id");
CStoredObject::massLoadBackRefs($operations, "workflow");
$sejours = CStoredObject::massLoadFwdRef($operations, "sejour_id");
$affectations = CStoredObject::massLoadBackRefs($sejours, "affectations");
Beispiel #7
0
<?php

/**
 * $Id$
 *  
 * @category PMSI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
$subject_guid = CValue::get("subject_guid");
$read_only = CValue::get("read_only", 0);
$subject = CMbObject::loadFromGuid($subject_guid);
if ($read_only && !$subject->getPerm(PERM_READ) || !$read_only && !$subject->getPerm(PERM_EDIT)) {
    CAppUI::redirect();
}
$prat = new CMediusers();
$listPrats = $prat->loadPraticiens();
$subject->loadRefsActes();
$subject->loadExtCodesCCAM();
$subject->getAssociationCodesActes();
$subject->loadPossibleActes();
$smarty = new CSmartyDP();
$smarty->assign("subject", $subject);
$smarty->assign("listPrats", $listPrats);
$smarty->assign("read_only", $read_only);
$smarty->display("inc_actes_ccam.tpl");
            $modificateur->_checked = null;
        }
    } else {
        $modificateur->_checked = null;
    }
}
/* Vérification et précodage des modificateurs */
if (CAppUI::conf('dPccam CCodeCCAM use_new_association_rules')) {
    CCodageCCAM::precodeModifiers($phase->_modificateurs, $acte, $acte->loadRefObject());
} elseif (!$acte->_id) {
    foreach ($phase->_modificateurs as $modificateur) {
        $modificateur->_checked = $acte->_ref_object->checkModificateur($modificateur->code, CMbDT::time($acte->execution));
    }
}
$acte->getMontantModificateurs($phase->_modificateurs);
// Liste des dents CCAM
$liste_dents = reset(CDentCCAM::loadList());
// Chargement des listes de praticiens
$user = new CMediusers();
$listAnesths = $user->loadAnesthesistes(PERM_DENY);
$listChirs = $user->loadPraticiens(PERM_DENY);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("acte", $acte);
$smarty->assign("code", $code);
$smarty->assign("activite", $activite);
$smarty->assign("phase", $phase);
$smarty->assign("liste_dents", $liste_dents);
$smarty->assign("listAnesths", $listAnesths);
$smarty->assign("listChirs", $listChirs);
$smarty->display("inc_edit_acte_ccam.tpl");
    $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);
}
foreach ($praticiens as $prat) {
    $prat->loadRefFunction();
    foreach ($auf->loadListFor($prat) as $_auf) {
        $uf = $_auf->loadRefUniteFonctionnelle();
        $ufs_medicale[$uf->_id] = $uf;
    }
}
$ufs_medicale = array_reverse($ufs_medicale);
$ufs_soins = array_reverse($ufs_soins);
$ufs_hebergement = array_reverse($ufs_hebergement);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("affectation", $affectation);
$smarty->assign("sejour", $sejour);
Beispiel #10
0
$tabOp = array();
$actes_ccam = array();
// Creation de la liste des praticiens
$praticiens = array();
// Tableau qui stocke le nombre d'acte non signé par praticien
$nonSigne = array();
$operations = array();
// Si mode dialog, on efface les variables de tri
if ($dialog) {
    $praticien_id = "";
    $salle_id = "";
}
$object_id = CValue::get("object_id");
$object_class = CValue::get("object_class");
$praticien = new CMediusers();
$listPraticien = $praticien->loadPraticiens();
// Signature des actes en definissant un objet
if ($dialog) {
    // Recuperation de l'operation
    // Chargement de l'objet
    $object = new $object_class();
    $object->load($object_id);
    $object->loadView();
    $operations[$object->_id] = $object;
} else {
    // On parcourt les actes ccam
    $acte_ccam = new CActeCCAM();
    $where = array();
    if ($praticien_id) {
        $where["executant_id"] = " = '{$praticien_id}'";
    }
$line_med->code_cis = CValue::getOrSession("code_cis");
$line_med->_ucd_view = CValue::getOrSession("produit");
$libelle_produit = CValue::getOrSession("libelle_produit");
$classes_atc = CValue::getOrSession("classes_atc");
$keywords_atc = CValue::getOrSession("keywords_atc");
$composant = CValue::getOrSession("composant");
$keywords_composant = CValue::getOrSession("keywords_composant");
$indication = CValue::getOrSession("indication");
$type_indication = CValue::getOrSession("type_indication");
$keywords_indication = CValue::getOrSession("keywords_indication");
$commentaire = CValue::getOrSession("commentaire");
$user = new CMediusers();
$user->load($user_id);
$users_list = array();
if (!CAppUI::$user->isPraticien()) {
    $users_list = $user->loadPraticiens(PERM_READ);
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("users_list", $users_list);
$smarty->assign("user_id", $user_id);
$smarty->assign("patient", $patient);
$smarty->assign("antecedent", $antecedent);
$smarty->assign("traitement", $traitement);
$smarty->assign("consult", $consult);
$smarty->assign("sejour", $sejour);
$smarty->assign("interv", $interv);
$smarty->assign("prescription", $prescription);
$smarty->assign("line_med", $line_med);
$smarty->assign("libelle_produit", $libelle_produit);
$smarty->assign("classes_atc", $classes_atc);
Beispiel #12
0
$group_id = CValue::get("g");
$mode = CValue::getOrSession("mode", 0);
$hour_instantane = CValue::getOrSession("hour_instantane", CMbDT::format(CMbDT::time(), "%H"));
$prestation_id = CValue::getOrSession("prestation_id", CAppUI::pref("prestation_id_hospi"));
$services_ids = CValue::getOrSession("services_ids", null);
// Si c'est la préférence utilisateur, il faut la mettre en session
CValue::setSession("prestation_id", $prestation_id);
$mouvements = array("comp" => array("entrees" => array("place" => 0, "non_place" => 0), "sorties" => array("place" => 0, "non_place" => 0)), "ambu" => array("entrees" => array("place" => 0, "non_place" => 0), "sorties" => array("place" => 0, "non_place" => 0)), "urg" => array("entrees" => array("place" => 0, "non_place" => 0), "sorties" => array("place" => 0, "non_place" => 0)), "ssr" => array("entrees" => array("place" => 0, "non_place" => 0), "sorties" => array("place" => 0, "non_place" => 0)), "psy" => array("entrees" => array("place" => 0, "non_place" => 0), "sorties" => array("place" => 0, "non_place" => 0)));
$group = CGroups::loadCurrent();
// Récupération de la liste des services et du service selectionné
$where = array("externe" => "= '0'", "group_id" => "= '{$group->_id}'");
$order = "nom";
$services_ids = CService::getServicesIdsPref($services_ids);
// Récupération de la liste des praticiens et du praticien selectionné
$praticien = new CMediusers();
$praticiens = $praticien->loadPraticiens(PERM_READ);
$praticien_id = CValue::getOrSession("praticien_id", null);
$date = CValue::getOrSession("date", CMbDT::date());
$limit1 = $date . " 00:00:00";
$limit2 = $date . " 23:59:59";
// Patients placés
$affectation = new CAffectation();
$ljoin = array();
$ljoin["sejour"] = "sejour.sejour_id = affectation.sejour_id";
$ljoin["patients"] = "sejour.patient_id = patients.patient_id";
$ljoin["users"] = "sejour.praticien_id = users.user_id";
$ljoin["service"] = "service.service_id = affectation.service_id";
$where = array();
$where["service.group_id"] = "= '{$group->_id}'";
$where["service.service_id"] = CSQLDataSource::prepareIn($services_ids);
$where["sejour.type"] = CSQLDataSource::prepareIn(array_keys($mouvements), $type_hospi);
Beispiel #13
0
$function_id = $chir_id ? null : CValue::get("function_id");
$multipleMode = CValue::get("multipleMode", false);
$date = CValue::get("date", CMbDT::date());
$plageconsult_id = CValue::get("plageconsult_id");
$hour = CValue::get("hour");
$hide_finished = CValue::get("hide_finished", true);
$_line_element_id = CValue::get("_line_element_id");
$as_place = CValue::get("as_place", 0);
// Vérification des droits sur les praticiens
$listPraticiens = CConsultation::loadPraticiens(PERM_EDIT);
$listPrat = CConsultation::loadPraticiens(PERM_EDIT, $function_id, null, true);
$list_prat = array();
$chir = new CMediusers();
$chir->load($chir_id);
if ($chir->_id) {
    $list_prat = $chir->loadPraticiens(PERM_EDIT, $chir->function_id);
}
// Récupération des plages de consultation disponibles
$listPlage = new CPlageconsult();
$plage = new CPlageconsult();
$where = array();
if ($_line_element_id) {
    $where["pour_tiers"] = "= '1'";
}
$chir_sel = CSQLDataSource::prepareIn(array_keys($listPrat), $chir_id);
$where[] = "chir_id {$chir_sel} OR remplacant_id {$chir_sel}";
// Filtres
if ($hour) {
    $where["debut"] = "<= '{$hour}:00'";
    $where["fin"] = "> '{$hour}:00'";
}
Beispiel #14
0
$etat_cloture = CValue::getOrSession("etat_cloture", 0);
$etat_cotation = CValue::getOrSession("etat_cotation", 0);
$etat_relance = CValue::getOrSession("etat_relance", 0);
$facture_id = CValue::getOrSession("facture_id");
$patient_id = CValue::getOrSession("patient_id");
$no_finish_reglement = CValue::getOrSession("no_finish_reglement", 0);
$type_date_search = CValue::getOrSession("type_date_search", "ouverture");
$chirSel = CValue::getOrSession("chirSel", "-1");
$num_facture = CValue::getOrSession("num_facture");
$numero = CValue::getOrSession("numero", 0);
$search_easy = CValue::getOrSession("search_easy", 0);
$xml_etat = CValue::getOrSession("xml_etat", "");
$page = CValue::get("page", "0");
// Liste des chirurgiens
$user = new CMediusers();
$listChir = $user->loadPraticiens(PERM_EDIT);
//Patient sélectionné
$patient = new CPatient();
$patient->load($patient_id);
$ljoin = array();
$where = array();
$where["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
if ($etat_relance || $search_easy == 7) {
    $ljoin["facture_relance"] = "facture_relance.object_id = facture_etablissement.facture_id";
    $where["facture_relance.object_class"] = " = 'CFactureEtablissement'";
}
$where["{$type_date_search}"] = "BETWEEN '{$date_min}' AND '{$date_max}'";
if (($etat_cloture == "1" || $search_easy == 3) && $type_date_search != "cloture") {
    $where["cloture"] = "IS NULL";
} elseif (($etat_cloture == "2" || $search_easy == 2) && $type_date_search != "cloture") {
    $where["cloture"] = "IS NOT NULL";
    }
}
$consult->loadRefPraticien();
$consult->loadRefsDossiersAnesth();
$consult->loadRefFirstDossierAnesth();
$tab_op = array();
foreach ($consult->_refs_dossiers_anesth as $consultation_anesth) {
    $consultation_anesth->loadRelPatient();
    $consult->_ref_patient->loadRefLatestConstantes(null, array("poids"), $consult);
    $consultation_anesth->_ref_consultation = $consult;
    $consultation_anesth->loadRefOperation()->loadRefSejour();
    $consultation_anesth->_ref_operation->_ref_sejour->loadRefDossierMedical();
}
$dossier_medical_patient = $patient->loadRefDossierMedical();
$dossier_medical_patient->loadRefsAntecedents();
$dossier_medical_patient->loadRefsTraitements();
$dossier_medical_patient->loadRefPrescription();
$user = new CMediusers();
$user->load($consult->_ref_praticien->_id);
$listChirs = $user->loadPraticiens(PERM_READ);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("consult", $consult);
$smarty->assign("patient", $patient);
$smarty->assign("dm_patient", $dossier_medical_patient);
$smarty->assign("ops_sans_dossier_anesth", $ops_sans_dossier_anesth);
$smarty->assign("ops_annulees", $ops_annulees);
$smarty->assign("first_operation", reset($ops_sans_dossier_anesth));
$smarty->assign("consult_anesth", $consult_anesth);
$smarty->assign("listChirs", $listChirs);
$smarty->display("inc_consult_anesth/vw_gestion_da.tpl");
Beispiel #16
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();
         }
     }
 }
$ljoin = CValue::get("ljoin", array());
CSessionHandler::writeClose();
/** @var CMediusers $object */
$object = new CMediusers();
$user = CMediusers::get();
$use_edit = CAppUI::pref("useEditAutocompleteUsers");
if (!$edit && $use_edit) {
    $edit = 1;
}
// Droits sur les utilisateurs retournés
$permType = $edit ? PERM_EDIT : PERM_READ;
// Récupération de la liste des utilisateurs
if ($rdv) {
    $listUsers = $object->loadProfessionnelDeSanteByPref($permType, null, $keywords);
} elseif ($praticiens) {
    $listUsers = $object->loadPraticiens($permType, null, $keywords);
} else {
    $listUsers = $object->loadUsers($permType, null, $keywords);
}
if ($compta) {
    $listUsersCompta = CConsultation::loadPraticiensCompta();
    foreach ($listUsers as $_user) {
        if (!isset($listUsersCompta[$_user->_id])) {
            unset($listUsers[$_user->_id]);
        }
    }
}
$template = $object->getTypedTemplate("autocomplete");
// Création du template
$smarty = new CSmartyDP();
$smarty->assign('matches', $listUsers);
Beispiel #18
0
<?php

/**
 * $Id: vw_rapport.php 20186 2013-08-19 07:47:12Z phenxdesign $
 *
 * @package    Mediboard
 * @subpackage Hospi
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 20186 $
 */
$date = CValue::getOrSession("date");
// Chargement des praticiens
$med = new CMediusers();
$listPrat = $med->loadPraticiens(PERM_READ);
$dateEntree = CMbDT::dateTime("23:59:00", $date);
$dateSortie = CMbDT::dateTime("00:01:00", $date);
$hierEntree = CMbDT::date("- 1 day", $dateEntree);
$hierEntree = CMbDT::dateTime("23:59:00", $hierEntree);
// Chargement des services
$service = new CService();
$whereServices = array();
$whereServices["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
$whereServices["cancelled"] = "= '0'";
$services = $service->loadListWithPerms(PERM_READ, $whereServices, "nom");
// Initialisations
$totalHospi = 0;
$totalAmbulatoire = 0;
$totalMedecin = 0;
$total_prat = array();
foreach ($listPrat as $key => $prat) {
Beispiel #19
0
 /**
  * * Construct query with prat informations
  *
  * @param string $specific_user the id of the specific user
  * @param string $sejour_id     the id of the sejour
  *
  * @return string
  */
 function constructWordsWithPrat($specific_user, $sejour_id)
 {
     $users_id = array();
     if (!$specific_user) {
         $user = new CMediusers();
         $users = $sejour_id ? $user->loadPraticiens(PERM_READ) : $user->loadPraticiens(PERM_EDIT);
         foreach ($users as $_user) {
             $users_id[] = $_user->_id;
         }
         $user_req = implode(' ', $users_id);
     } else {
         $users_id = explode('|', $specific_user);
         $user_req = implode(' ', $users_id);
     }
     $ids_conf = str_replace(";", " || ", CAppUI::conf("search ids_search"));
     if ($ids_conf) {
         $user_req .= " || {$ids_conf}";
     }
     return $user_req;
 }