コード例 #1
0
ファイル: CPatient.class.php プロジェクト: fbone/mediboard4
 /**
  * Charge les consultations du patient
  *
  * @param array|null $where [optional] Clauses SQL
  *
  * @return CConsultation[]
  */
 function loadRefsConsultations($where = null)
 {
     $consultation = new CConsultation();
     $group_id = CGroups::loadCurrent()->_id;
     $curr_user = CAppUI::$user;
     if ($this->_id) {
         if ($where === null) {
             $where = array();
         }
         if (!$curr_user->isAdmin()) {
             $where[] = "functions_mediboard.consults_partagees = '1' ||\r\n                    (functions_mediboard.consults_partagees = '0' && functions_mediboard.function_id = '{$curr_user->function_id}')";
         }
         $where["patient_id"] = "= '{$this->_id}'";
         if (CAppUI::conf("dPpatients CPatient multi_group") == "hidden") {
             $where["functions_mediboard.group_id"] = "= '{$group_id}'";
         }
         $order = "plageconsult.date DESC, consultation.heure DESC";
         $leftjoin = array();
         $leftjoin["plageconsult"] = "consultation.plageconsult_id = plageconsult.plageconsult_id";
         $leftjoin["users_mediboard"] = "plageconsult.chir_id = users_mediboard.user_id";
         $leftjoin["functions_mediboard"] = "users_mediboard.function_id = functions_mediboard.function_id";
         return $this->_ref_consultations = $consultation->loadList($where, $order, null, null, $leftjoin);
     }
     return $this->_ref_consultations = array();
 }
コード例 #2
0
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$date = CValue::get("date", CMbDT::date());
$group = CGroups::loadCurrent();
$consultation = new CConsultation();
$where = array();
$where["consultation.grossesse_id"] = "IS NOT NULL";
$where["plageconsult.date"] = "= '{$date}'";
$where["group_id"] = " = '{$group->_id}'";
$ljoin = array();
$ljoin["plageconsult"] = "plageconsult.plageconsult_id = consultation.plageconsult_id";
$ljoin["users_mediboard"] = "plageconsult.chir_id = users_mediboard.user_id";
$ljoin["functions_mediboard"] = "functions_mediboard.function_id = users_mediboard.function_id";
$order = "heure ASC";
/** @var CConsultation[] $listConsults */
$listConsults = $consultation->loadList($where, $order, null, null, $ljoin);
$plage = CMbObject::massLoadFwdRef($listConsults, "plageconsult_id");
CMbObject::massLoadFwdRef($plage, "chir_id");
CMbObject::massLoadFwdRef($listConsults, "sejour_id");
$grossesses = CMbObject::massLoadFwdRef($listConsults, "grossesse_id");
CMbObject::massLoadFwdRef($grossesses, "parturiente_id");
foreach ($listConsults as $_consult) {
    $_consult->loadRefPraticien();
    $_consult->loadRefSejour()->loadRefGrossesse();
    $_consult->loadRefGrossesse()->loadRefParturiente();
}
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("listConsults", $listConsults);
$smarty->display("inc_tdb_consultations.tpl");
コード例 #3
0
$transmission = new CTransmissionMedicale();
$transmissions = array_merge($transmissions, $transmission->loadList($whereTrans, "date"));
CStoredObject::massLoadFwdRef($transmissions, "user_id");
array_multisort(CMbArray::pluck($transmissions, "date"), SORT_ASC, $transmissions);
// Observations
$observation = new CObservationMedicale();
$whereObs = $where;
$whereObs["date"] = "BETWEEN '{$datetime_delta}' AND '{$datetime_avg}'";
$observations = $observation->loadList($whereObs, "date");
CStoredObject::massLoadFwdRef($observations, "user_id");
// Consultations
$consultation = new CConsultation();
$whereConsult = $where;
$whereConsult["plageconsult.date"] = "BETWEEN '{$datetime_delta}' AND '{$datetime_avg}'";
$ljoin = array("plageconsult" => "plageconsult.plageconsult_id = consultation.plageconsult_id");
$consultations = $consultation->loadList($whereConsult, "plageconsult.date", null, null, $ljoin);
CStoredObject::massLoadFwdRef($consultations, "plageconsult_id");
$smarty_cstes = new CSmartyDP("modules/dPpatients");
$smarty_cstes->assign("empty_lines", 2);
$smarty_cstes->assign("offline", 1);
// Constantes des 12 dernières heures
$where_cste = array("datetime" => "BETWEEN '" . CMbDT::subDateTime("12:00:00", $datetime_avg) . "' AND '{$datetime_avg}'");
CPrescriptionLine::$_offline_lite = true;
CPrescriptionLineMix::$_offline_lite = true;
CPrescription::$_offline_lite = true;
foreach ($sejours as $_sejour) {
    $patient = $_sejour->loadRefPatient();
    $_sejour->loadRefPraticien();
    $_sejour->loadJourOp($date);
    if ($service_id == "urgence") {
        $_sejour->_veille = CMbDT::date($_sejour->entree) != $date;
コード例 #4
0
$where = array();
$where["sejour.entree"] = " BETWEEN '{$debut}' AND '{$fin}'";
$where["sejour.annule"] = "= '0'";
$where["consultation.annule"] = "= '0'";
if (!$interv_with_no_codes) {
    $where[] = "LENGTH(consultation.codes_ccam) > 0";
}
if ($all_prats) {
    $prats = $user->loadPraticiens(PERM_READ);
    $where["plageconsult.chir_id"] = CSQLDataSource::prepareIn(array_keys($prats));
} else {
    $where["plageconsult.chir_id"] = "= '{$user->_id}'";
}
/* @var CConsultation[] $consultations*/
$consultation = new CConsultation();
$consultations = $consultation->loadList($where, null, null, null, $ljoin);
$totals["consultations"] = count($consultations);
/** @var CPlageConsult[] $plages */
$plages = CStoredObject::massLoadFwdRef($consultations, "plageconsult_id");
CStoredObject::massLoadFwdRef($consultations, "sejour_id");
CStoredObject::massLoadFwdRef($consultations, "patient_id");
// Pré-chargement des users
$where = array("user_id" => CSQLDataSource::prepareIn(CMbArray::pluck($plages, "chir_id")));
$user->loadList($where);
/** @var CMediusers[] $chirs */
$chirs = CStoredObject::massLoadFwdRef($plages, "chir_id");
CStoredObject::massLoadFwdRef($chirs, "function_id");
CStoredObject::massLoadBackRefs($consultations, "actes_ccam");
foreach ($consultations as $key => $_consult) {
    // Chargemement des codes CCAM
    $_consult->loadExtCodesCCAM();
コード例 #5
0
$chir_id = CValue::get("chir_id");
$function_id = CValue::get("function_id");
$list_chir_ids = array();
$user = new CMediusers();
$user->load($chir_id);
$ds = $user->getDS();
if ($function_id) {
    $users = CConsultation::loadPraticiens(PERM_EDIT, $function_id);
    $list_chir_ids = array_keys($users);
} else {
    $list_chir_ids = array($chir_id);
}
// Liste des consultations a avancer si desistement
$now = CMbDT::date();
$where = array("plageconsult.date" => " > '{$now}'", "plageconsult.chir_id" => $ds->prepareIn($list_chir_ids), "consultation.si_desistement" => "= '1'", "consultation.annule" => "= '0'");
$ljoin = array("plageconsult" => "plageconsult.plageconsult_id = consultation.plageconsult_id");
$consultation_desist = new CConsultation();
/** @var CConsultation[] $consultations */
$consultations = $consultation_desist->loadList($where, "date, heure", null, null, $ljoin);
foreach ($consultations as $_consult) {
    $_consult->loadRefPatient();
    $_consult->loadRefPlageConsult();
    $_consult->loadRefCategorie();
    $_consult->loadRefPraticien()->loadRefFunction();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("consultations", $consultations);
$smarty->assign("function_id", $function_id);
$smarty->assign("user", $user);
$smarty->display("inc_list_consult_si_desistement.tpl");
コード例 #6
0
        $where_consult[] = $where_examen;
    }
    if ($traitement_consult) {
        $where_traitement = "`traitement` LIKE '%{$traitement_consult}%'";
        $where_consult[] = $where_traitement;
    }
    if ($where_consult) {
        $where_consult = implode(" OR ", $where_consult);
    }
}
$patients_consult = array();
$order_consult = "patient_id";
$total_consults = null;
if ($where_consult) {
    $total_consults = $consult->countList($where_consult);
    $consultations = $consult->loadList($where_consult, $order_consult, "{$page_consult}, 30");
}
foreach ($consultations as $value) {
    $value->loadRefPatient();
}
// Recherche sur les sejours
/** @var CSejour[] $sejours */
$sejours = array();
$sejour = new CSejour();
$patients_sejour = array();
$where_sejour = null;
if ($recherche_sejour == "and") {
    if ($typeAdmission_sejour) {
        $where_sejour["type"] = "LIKE '%{$typeAdmission_sejour}%'";
    }
    if ($convalescence_sejour) {
コード例 #7
0
 /**
  * Load consultations
  *
  * @param bool $withCanceled Include cancelled consults
  * @param bool $withClosed   Include closed consults
  * @param bool $withPayees   Include payed consults
  *
  * @return CConsultation[]
  */
 function loadRefsConsultations($withCanceled = true, $withClosed = true, $withPayees = true)
 {
     $where["plageconsult_id"] = "= '{$this->_id}'";
     if (!$withCanceled) {
         $where["annule"] = "= '0'";
     }
     if (!$withClosed) {
         $where["chrono"] = "!=  '" . CConsultation::TERMINE . "'";
     }
     $order = "heure";
     $consult = new CConsultation();
     $this->_ref_consultations = $consult->loadList($where, $order);
     foreach ($this->_ref_consultations as $_consult) {
         $this->_cumulative_minutes += $_consult->duree * $this->_freq_minutes;
     }
     if (!$withPayees) {
         foreach ($this->_ref_consultations as $key => $consult) {
             /** @var CConsultation $consult */
             $facture = $consult->loadRefFacture();
             if ($facture->_id && $facture->patient_date_reglement) {
                 unset($this->_ref_consultations[$key]);
             }
         }
     }
     return $this->_ref_consultations;
 }
コード例 #8
0
$prat = $consultation->_ref_plageconsult->_ref_chir;
$prat->loadRefs();
$patient = $consultation->_ref_patient;
$patient->loadRefs();
$prat->loadRefFunction();
$chir_ids = array_keys($prat->_ref_function->loadRefsUsers());
$ds = $consultation->getDS();
// nexts rdvs for the same function
$ljoin = array("plageconsult" => "plageconsult.plageconsult_id = consultation.plageconsult_id");
$where = array();
$where["date"] = ">= '{$date}' ";
$where["patient_id"] = " = '{$consultation->patient_id}' ";
$where[] = "plageconsult.chir_id " . $ds->prepareIn($chir_ids) . " OR plageconsult.remplacant_id " . $ds->prepareIn($chir_ids);
$where["annule"] = " != '1' ";
$where[$consultation->_spec->key] = " != '{$consultation->_id}'";
/** @var CConsultation[] $consultations */
$consultations = $consultation->loadList($where, "date ASC, heure ASC", null, null, $ljoin);
foreach ($consultations as $_consult) {
    $_consult->_ref_patient = $consultation->_ref_patient;
    $_consult->loadRefPraticien()->loadRefFunction();
    $_consult->_ref_plageconsult->loadRefRemplacant();
}
$today = CMbDT::date();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("consultation", $consultation);
$smarty->assign("consultations", $consultations);
$smarty->assign("patient", $patient);
$smarty->assign("prat", $prat);
$smarty->assign("today", $today);
$smarty->display("view_consultation.tpl");
コード例 #9
0
ファイル: CFacture.class.php プロジェクト: fbone/mediboard4
 /**
  * Chargement de toutes les consultations de la facture
  *
  * @return object
  **/
 function loadRefsConsultation()
 {
     if (count($this->_ref_consults)) {
         return $this->_ref_consults;
     }
     $consult = new CConsultation();
     if ($this->_id) {
         if (CModule::getActive("dPfacturation")) {
             $ljoin = array();
             $ljoin["facture_liaison"] = "facture_liaison.object_id = consultation.consultation_id";
             $where = array();
             $where["facture_liaison.facture_id"] = " = '{$this->_id}'";
             $where["facture_liaison.facture_class"] = " = '{$this->_class}'";
             $where["facture_liaison.object_class"] = " = 'CConsultation'";
             $this->_ref_consults = $consult->loadList($where, null, null, "consultation.consultation_id", $ljoin);
         }
     } elseif ($this->_consult_id) {
         $consult->consultation_id = $this->_consult_id;
         $this->_ref_consults = $consult->loadMatchingList();
     }
     if (count($this->_ref_consults) > 0) {
         // Chargement des actes de consultations
         foreach ($this->_ref_consults as $_consult) {
             $_consult->loadRefPlageConsult();
             $_consult->loadRefsActes($this->numero, 1);
             $_consult->loadExtCodesCCAM();
             $this->rangeActes($_consult);
         }
         $this->_ref_last_consult = end($this->_ref_consults);
         $this->_ref_first_consult = reset($this->_ref_consults);
     } else {
         $this->_ref_last_consult = new CConsultation();
         $this->_ref_first_consult = new CConsultation();
     }
     return $this->_ref_consults;
 }
コード例 #10
0
         }
     }
 }
 //consultations
 $consult = new CConsultation();
 $whereC = array();
 $whereC["plageconsult_id"] = " = '{$_plage->_id}' ";
 $whereC["annule"] = " = '{$show_cancelled}'";
 if ($status) {
     $whereC["chrono"] = " = '{$status}'";
 }
 if ($facturated) {
     $whereC["facture"] = " = '1'";
 }
 /** @var CConsultation[] $consults */
 $consults = $consult->loadList($whereC, "heure");
 foreach ($consults as $_consult) {
     if ($_consult->heure < $min_hour) {
         $min_hour = CMbDT::format($_consult->heure, "%H");
     }
     if ($actes != "") {
         $_actes = $_consult->loadRefsActes();
         $nb_actes = $_consult->_count_actes;
         // avec des actes
         if ($actes && !$nb_actes) {
             continue;
         }
         // sans actes
         if ($actes === "0" && $nb_actes > 0) {
             continue;
         }
コード例 #11
0
$group = CGroups::loadCurrent();
$consultation = new CConsultation();
$where = array();
$where["consultation.grossesse_id"] = "IS NOT NULL";
$where["consultation.annule"] = "= '0'";
$where["plageconsult.date"] = "= '{$date}'";
$where["functions_mediboard.group_id"] = "= '{$group->_id}'";
$ljoin = array();
$ljoin["plageconsult"] = "plageconsult.plageconsult_id = consultation.plageconsult_id";
$ljoin["users_mediboard"] = "plageconsult.chir_id = users_mediboard.user_id";
$ljoin["functions_mediboard"] = "functions_mediboard.function_id = users_mediboard.function_id";
$curr_user = CMediusers::get();
if ($curr_user->isPraticien() || $curr_user->isSageFemme()) {
    $where["plageconsult.chir_id"] = "= '{$curr_user->_id}'";
}
/** @var CConsultation[] $listConsults */
$listConsults = $consultation->loadList($where, "heure ASC", null, null, $ljoin);
$plages = CStoredObject::massLoadFwdRef($listConsults, "plageconsult_id");
CStoredObject::massLoadFwdRef($plages, "chir_id");
CStoredObject::massLoadFwdRef($listConsults, "sejour_id");
$grossesses = CStoredObject::massLoadFwdRef($listConsults, "grossesse_id");
CStoredObject::massLoadFwdRef($grossesses, "parturiente_id");
foreach ($listConsults as $_consult) {
    $_consult->loadRefPraticien();
    $_consult->loadRefSejour()->loadRefGrossesse();
    $_consult->loadRefGrossesse()->loadRefParturiente();
}
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("listConsults", $listConsults);
$smarty->display("inc_tdb_consultations.tpl");
コード例 #12
0
    $plageconsult_id = $plageSel->plageconsult_id;
}
$plageSel->loadRefsFwd(1);
$plageSel->loadRefsNotes();
$plageSel->loadRefsBack();
//check 3333tel
if (CModule::getActive("3333tel")) {
    C3333TelTools::checkPlagesConsult($plageSel, $plageSel->_ref_chir->function_id);
}
$pause = new CConsultation();
//find the unique pause;
if ($plageSel->_id) {
    $where_p = array();
    $where_p["plageconsult_id"] = " = '{$plageSel->_id}' ";
    $where_p["patient_id"] = " IS NULL";
    $list = $pause->loadList($where_p);
    if (count($list) == 1) {
        /** @var CConsultation $pause */
        $pause = reset($list);
        $plageSel->_pause = $pause->heure;
        $plageSel->_pause_id = $pause->_id;
        $plageSel->_pause_repeat_time = $pause->duree;
    }
}
if ($plageSel->_affected) {
    $firstconsult = reset($plageSel->_ref_consultations);
    $_firstconsult_time = substr($firstconsult->heure, 0, 5);
    $lastconsult = end($plageSel->_ref_consultations);
    $_lastconsult_time = substr($lastconsult->heure, 0, 5);
}
// Détails sur les consultation affichées
コード例 #13
0
CCanDo::checkEdit();
$consult_id = CValue::get("consult_id");
$first_consult = new CConsultation();
$first_consult->load($consult_id);
$plage_consult = $first_consult->loadRefPlageConsult();
$first_consult->loadRefPatient();
$first_consult->loadRefPraticien();
$date = $plage_consult->date;
$praticien = new CMediusers();
$praticiens = $praticien->loadPraticiens(PERM_EDIT);
$next_consult = new CConsultation();
$ljoin = array();
$where = array();
$where["patient_id"] = " = '{$first_consult->patient_id}'";
$where["date"] = " >= '{$date}'";
$ljoin["plageconsult"] = "plageconsult.plageconsult_id = consultation.plageconsult_id";
/** @var CConsultation[] $next_consults */
$next_consults = $next_consult->loadList($where, "date ASC", null, null, $ljoin);
foreach ($next_consults as $_key => $_consult) {
    $_consult->loadRefPraticien();
    //no rights on prat, skip the consult
    if (!$_consult->_ref_praticien->canDo()->edit) {
        unset($next_consults[$_key]);
    }
}
//smarty
$smarty = new CSmartyDP();
$smarty->assign("consults", $next_consults);
$smarty->assign("consult", $first_consult);
$smarty->assign("praticiens", $praticiens);
$smarty->display("inc_edit_multiconsult.tpl");