Ejemplo n.º 1
0
$page_dossierMedical = CValue::get('page_dossierMedical', 0);
// Recherche sur les antecedents
$ant = new CAntecedent();
/** @var CAntecedent[] $antecedents */
$antecedents = array();
$patients_ant = array();
$where_ant = array();
$ljoin["dossier_medical"] = "dossier_medical.object_id = antecedent.antecedent_id";
if ($antecedent_patient) {
    $where_ant["rques"] = "LIKE '%{$antecedent_patient}%'";
    $where_ant["object_class"] = " = 'CPatient'";
}
$order_ant = "antecedent_id, rques";
$total_antecedents = null;
if ($where_ant) {
    $total_antecedents = $ant->countList($where_ant, null, $ljoin);
    $antecedents = $ant->loadList($where_ant, $order_ant, "{$page_antecedent}, 30", null, $ljoin);
}
foreach ($antecedents as $key => $_antecedent) {
    // Chargement du dossier medical du patient pour chaque antecedent
    $_antecedent->loadRefDossierMedical();
    $_antecedent->_ref_dossier_medical->loadRefObject();
    $antecedents_[$key] = $_antecedent->_ref_dossier_medical->object_id;
    $_antecedent->loadRefsFwd();
}
// Recherche sur les traitements
$trait = new CTraitement();
/** @var CTraitement[] $traitements */
$traitements = array();
$patients_trait = array();
$where_trait = array();
 /**
  * Compte les antecedents de type allergies
  * tout en tenant compte de la config pour ignorer certaines allergies
  *
  * @return int
  */
 function countAllergies()
 {
     if (!$this->_id) {
         return $this->_count_allergies = 0;
     }
     $antecedent = new CAntecedent();
     $where["type"] = "= 'alle'";
     $where["annule"] = " ='0'";
     $where["dossier_medical_id"] = " = '{$this->_id}'";
     $where["rques"] = 'NOT IN ("' . str_replace('|', '","', CAppUI::conf("soins Other ignore_allergies", CGroups::loadCurrent()->_guid)) . '")';
     return $this->_count_allergies = $antecedent->countList($where);
 }