示例#1
0
 /**
  * Ordonnancement par degré des constantes notées
  *
  * @return void
  */
 function orderCtes()
 {
     if (!$this->_id) {
         return null;
     }
     $this->_ref_cts_degre = array(1 => array(), 2 => array(), 3 => array(), 4 => array());
     $this->_estimation_ccmu = 4;
     $this->_ref_latest_constantes = CConstantesMedicales::getLatestFor($this->_patient_id, null, array(), $this->_ref_sejour, false);
     $where = array();
     $where["patient_id"] = " = '" . $this->_patient_id . "'";
     $where["context_class"] = " = '" . $this->_ref_sejour->_class . "'";
     $where["context_id"] = " = '" . $this->_ref_sejour->_id . "'";
     $where["comment"] = " IS NOT NULL";
     $constante = new CConstantesMedicales();
     $constante->loadObject($where, "datetime ASC");
     if ($constante->_id) {
         $this->_ref_latest_constantes[0]->comment = $constante->comment;
     }
     $latest_constantes = $this->_ref_latest_constantes;
     $echelle_tri = $this->loadRefEchelleTri();
     $grossesse = $this->_ref_sejour->loadRefGrossesse();
     $sa_grossesse = CModule::getActive("maternite") && $grossesse->terme_prevu ? $grossesse->_semaine_grossesse : $echelle_tri->enceinte == 1 ?: 0;
     if ($glasgow = $latest_constantes[0]->glasgow) {
         $degre = $glasgow <= 8 ? 1 : 4;
         if ($glasgow >= 9 && $glasgow <= 13) {
             $degre = 2;
         } elseif ($glasgow == 14 && $glasgow == 15) {
             $degre = 3;
         }
         $this->_ref_cts_degre[$degre][] = 'glasgow';
     }
     if ($pouls = $latest_constantes[0]->pouls) {
         $degre = $pouls < 40 || $pouls > 150 ? 1 : 4;
         if ($pouls >= 40 && $pouls <= 50 || $pouls >= 130 && $pouls <= 150) {
             $degre = 2;
         } elseif ($pouls >= 51 && $pouls <= 129) {
             $degre = 3;
         }
         $this->_ref_cts_degre[$degre][] = 'pouls';
     }
     //Tensions
     if ($latest_constantes[0]->ta_gauche) {
         $this->orderTA("ta_gauche", $latest_constantes[0]->_ta_gauche_systole, $latest_constantes[0]->_ta_gauche_diastole);
     }
     if ($latest_constantes[0]->ta_droit) {
         $this->orderTA("ta_droit", $latest_constantes[0]->_ta_droit_systole, $latest_constantes[0]->_ta_droit_diastole);
     }
     if ($latest_constantes[0]->ta) {
         $this->orderTA("ta", $latest_constantes[0]->_ta_systole, $latest_constantes[0]->_ta_diastole);
     }
     if ($frequence = $latest_constantes[0]->frequence_respiratoire) {
         $degre = $frequence > 35 || $frequence <= 8 ? 1 : 4;
         if ($frequence >= 25 && $frequence <= 35 || $frequence >= 9 && $frequence <= 12) {
             $degre = 2;
         } elseif ($frequence >= 13 && $frequence <= 24) {
             $degre = 3;
         }
         $this->_ref_cts_degre[$degre][] = 'frequence_respiratoire';
     }
     if ($spo2 = $latest_constantes[0]->spo2) {
         $degre = $spo2 < 90 ? 1 : 4;
         if ($spo2 >= 90 && $spo2 <= 93) {
             $degre = 2;
         } elseif ($spo2 >= 94 && $spo2 <= 100) {
             $degre = 3;
         }
         $this->_ref_cts_degre[$degre][] = 'spo2';
     }
     if ($temp = $latest_constantes[0]->temperature) {
         $degre = $temp < 32 ? 1 : 4;
         if ($temp >= 32 && $temp <= 35 || $temp > 40) {
             $degre = 2;
         } elseif ($temp > 35 && $temp <= 40) {
             $degre = 3;
         }
         $this->_ref_cts_degre[$degre][] = 'temperature';
     }
     if ($glycemie = $latest_constantes[0]->glycemie) {
         if ($glycemie < 4 || $glycemie >= 25) {
             $degre = 2;
         } elseif ($glycemie >= 4 && $glycemie < 25) {
             $degre = 3;
         }
         $this->_ref_cts_degre[$degre][] = 'glycemie';
     }
     if ($cetonemie = $latest_constantes[0]->cetonemie) {
         if ($cetonemie >= 0.6) {
             $degre = 2;
         } elseif ($cetonemie < 0.6) {
             $degre = 3;
         }
         $this->_ref_cts_degre[$degre][] = 'cetonemie';
     }
     $patient = $this->_ref_sejour->_ref_patient;
     if ($latest_constantes[0]->peak_flow && $latest_constantes[0]->taille && $patient->_annees && $patient->sexe) {
         //(H)DEPTh = Exp[(0,544 x Log(Age)) - (0,0151 x Age) - (74,7 / Taille) + 5,48]
         //((F)DEPTh = Exp[(0,376 x Log(Age)) - (0,0120 x Age) - (58,8 / Taille) + 5,63]
         if ($patient->sexe == 'f') {
             $depth = round(exp(0.376 * log($patient->_annees) - 0.012 * $patient->_annees - 58.8 / $latest_constantes[0]->taille + 5.63), 2);
         } else {
             $depth = round(exp(0.544 * log($patient->_annees) - 0.0151 * $patient->_annees - 74.7 / $latest_constantes[0]->taille + 5.48));
         }
         $taux = round($latest_constantes[0]->peak_flow / $depth * 100, 2);
         $degre = $taux > 50 ? 3 : 2;
         $this->_ref_cts_degre[$degre][$depth] = 'peak_flow';
     }
     if ($contraction_uterine = $latest_constantes[0]->contraction_uterine) {
         $degre = $contraction_uterine >= 3 ? 1 : 4;
         if ($contraction_uterine > 1 && $contraction_uterine < 3) {
             $degre = 2;
         } elseif ($contraction_uterine <= 1) {
             $degre = 3;
         }
         $this->_ref_cts_degre[$degre][] = 'contraction_uterine';
     }
     if ($latest_constantes[0]->bruit_foetal && $sa_grossesse >= 20) {
         $bruit_foetal = $latest_constantes[0]->bruit_foetal;
         $degre = 4;
         if ($sa_grossesse > 24) {
             if ($bruit_foetal >= 40 && $bruit_foetal <= 100 || $bruit_foetal >= 180) {
                 $degre = 1;
             } elseif ($bruit_foetal == 0 || $bruit_foetal >= 101 && $bruit_foetal <= 119 || $bruit_foetal >= 160 && $bruit_foetal <= 179) {
                 $degre = 2;
             } elseif ($bruit_foetal >= 120 && $bruit_foetal <= 159) {
                 $degre = 3;
             }
         } else {
             $degre = $bruit_foetal > 0 ? 3 : 2;
         }
         $this->_ref_cts_degre[$degre][] = 'bruit_foetal';
     }
     if ($echelle_tri->liquide && $grossesse->_id) {
         $degre = $echelle_tri->liquide == 'meconial' ? 2 : 3;
         $this->_ref_cts_degre[$degre][] = 'liquide';
     }
     if ($echelle_tri->pupille_droite || $echelle_tri->pupille_gauche) {
         $gauche = $echelle_tri->pupille_gauche;
         $droit = $echelle_tri->pupille_droite;
         $degre = $gauche == 3 || $gauche == 1 || $droit == 3 || $droit == 1 ? 2 : 3;
         $this->_ref_cts_degre[$degre][] = 'pupilles';
     }
     unset($this->_ref_cts_degre[4]);
     if (count($this->_ref_cts_degre[1])) {
         $this->_estimation_ccmu = 1;
     } elseif (count($this->_ref_cts_degre[2])) {
         $this->_estimation_ccmu = 2;
     } elseif (count($this->_ref_cts_degre[3])) {
         $this->_estimation_ccmu = 3;
     }
     ksort($this->_ref_cts_degre);
 }