/** * Load the latest constants of the patient * * @param string $datetime The reference datetime * @param array $selection A selection of constantes to load * @param CMbObject $context A particular context * @param boolean $use_cache Force the function to return the latest_values is already set * * @return array */ function loadRefLatestConstantes($datetime = null, $selection = array(), $context = null, $use_cache = true) { $latest = CConstantesMedicales::getLatestFor($this, $datetime, $selection, $context, $use_cache); list($this->_ref_constantes_medicales, $this->_latest_constantes_dates) = $latest; $this->_ref_constantes_medicales->updateFormFields(); return $latest; }
$can_create = $perms->edit; if ($perms->edit && $constantes->_id && $modif_timeout > 0 && time() - strtotime($constantes->datetime) > $modif_timeout * 3600) { $can_edit = 0; } else { $modif_timeout = 0; } /* Gestion des droits d'edition sur les constantes */ if (is_null($can_edit)) { /* Impossible d'éditer si on est pas dans le contexte actuel */ if ($constantes->_id && $context_guid != $constantes->_ref_context->_guid) { $can_edit = 0; } else { $can_edit = $perms->edit; } } $latest_constantes = CConstantesMedicales::getLatestFor($patient_id, $constantes->datetime, array(), $context, false); // Création du template $smarty = new CSmartyDP(); $smarty->assign('constantes', $constantes); $smarty->assign('latest_constantes', $latest_constantes); $smarty->assign('context_guid', $context_guid); $smarty->assign('selection', $selection); $smarty->assign('dates', $dates); $smarty->assign('can_create', $can_create); $smarty->assign('can_edit', $can_edit); $smarty->assign('modif_timeout', $modif_timeout); $smarty->assign('display_graph', $display_graph); $smarty->assign('unique_id', $unique_id); $smarty->assign('show_cat_tabs', $show_cat_tabs); $smarty->assign('show_enable_all_button', $show_enable_all_button); $smarty->display('inc_form_edit_constantes_medicales.tpl');
} $consultations =& $patient->_ref_consultations; $sejours =& $patient->_ref_sejours; // Consultations foreach ($consultations as $consultation) { $consultation->loadRefsDocItems(false); $consultation->countDocItems(); $consultation->loadRefConsultAnesth(); $consultation->loadRefsExamsComp(); $consultation->loadRefsFichesExamen(); $consultation->loadRefsActesCCAM(); $consultation->loadRefsActesNGAP(); $consultation->loadRefsReglements(); $consultation->loadRefPlageConsult(); $consultation->_ref_plageconsult->_ref_chir->loadRefFunction(); $_latest_constantes = CConstantesMedicales::getLatestFor($patient, null, array("poids", "taille"), $consultation); $consultation->_latest_constantes = $_latest_constantes[0]; // Affichage des ordonnances $consultation->loadRefsPrescriptions(); if (isset($consultation->_ref_prescriptions["externe"])) { $consultation->_ref_prescriptions["externe"]->loadRefsFiles(); foreach ($consultation->_ref_prescriptions["externe"]->_ref_files as $key => $_file) { if ($_file->annule) { unset($consultation->_ref_prescriptions["externe"]->_ref_files[$key]); } } } } // Sejours $where = array(); $where["chir_id"] = CSQLDataSource::prepareIn(array_keys($listPrat));
/** * 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); }
$age_patient = $patient->_annees; if ($age_patient < 40) { $exam_igs->age = '0'; } elseif ($age_patient <= 59) { $exam_igs->age = '7'; } elseif ($age_patient <= 69) { $exam_igs->age = '12'; } elseif ($age_patient <= 74) { $exam_igs->age = '15'; } elseif ($age_patient <= 79) { $exam_igs->age = '16'; } else { $exam_igs->age = '18'; } // Pre-remplissage des constantes médicales: FC, TA, temp, diurese (l/jour) list($constantes_medicales, $dates) = CConstantesMedicales::getLatestFor($patient, $date); $FC = $constantes_medicales->pouls; if ($FC) { $last_constantes["FC"] = $FC; if ($FC < 40) { $exam_igs->FC = '11'; } elseif ($FC <= 69) { $exam_igs->FC = '2'; } elseif ($FC <= 119) { $exam_igs->FC = '0'; } elseif ($FC <= 159) { $exam_igs->FC = '4'; } else { $exam_igs->FC = '7'; } }