/**
  * @see parent::store()
  */
 function store()
 {
     if (!$this->_id && $this->rpu_id) {
         $echelle = new self();
         $echelle->rpu_id = $this->rpu_id;
         $echelle->loadMatchingObject();
         $this->_id = $echelle->_id;
     }
     $glasgow = null;
     if ($this->fieldModified("ouverture_yeux") || $this->fieldModified("rep_motrice") || $this->fieldModified("rep_verbale")) {
         $glasgow = $this->calculGlasgow();
     }
     // Standard Store
     if ($msg = parent::store()) {
         return $msg;
     }
     if ($glasgow != null) {
         $sejour = $this->loadRefRPU()->loadRefSejour();
         $constante = new CConstantesMedicales();
         $constante->_new_constantes_medicales = 1;
         $constante->patient_id = $sejour->loadRefPatient()->_id;
         $constante->context_class = $sejour->_class;
         $constante->context_id = $sejour->_id;
         $constante->glasgow = $glasgow;
         $constante->datetime = 'now';
         if ($msg = $constante->store()) {
             return $msg;
         }
     }
     return null;
 }
示例#2
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);
 }
 /**
  * Get segement OBX
  *
  * @param DOMNode   $node   Node
  * @param CMbObject $object Object
  * @param array     $data   Data
  *
  * @return void
  */
 function getOBX(DOMNode $node, CMbObject $object, $data)
 {
     $type = $this->queryTextNode("OBX.3/CE.2", $node);
     $value = floatval($this->queryTextNode("OBX.5", $node));
     $constante_medicale = new CConstantesMedicales();
     if ($object instanceof CSejour) {
         $constante_medicale->context_class = "CSejour";
         $constante_medicale->context_id = $object->_id;
         $constante_medicale->patient_id = $object->patient_id;
     } else {
         if ($object instanceof CPatient) {
             $constante_medicale->context_class = "CPatient";
             $constante_medicale->context_id = $object->_id;
             $constante_medicale->patient_id = $object->_id;
         }
     }
     $constante_medicale->datetime = $this->queryTextNode("EVN.2/TS.1", $data["EVN"]);
     $constante_medicale->loadMatchingObject();
     switch ($type) {
         case "WEIGHT":
             $constante_medicale->poids = $value;
             break;
         case "HEIGHT":
             $constante_medicale->taille = $value;
             break;
         default:
     }
     $constante_medicale->_new_constantes_medicales = true;
     // Pour le moment pas de retour d'erreur dans l'acquittement
     $constante_medicale->store();
 }
示例#4
0
 /**
  * Return the graphs display mode config
  *
  * @param CMbObject|string $host Host from which we'll get the configuration
  *
  * @return array
  */
 static function getDisplayMode($host = null)
 {
     if ($host) {
         $config = CConstantesMedicales::getHostConfig('graphs_display_mode', $host);
     } else {
         $config = CConstantesMedicales::getConfig('graphs_display_mode');
     }
     $config = explode('|', $config);
     return array('mode' => $config[0], 'time' => $config[1]);
 }
示例#5
0
 /**
  * @see parent::fillLimitedTemplate
  */
 function fillLimitedTemplate(&$template)
 {
     global $rootName;
     $this->updateFormFields();
     $this->notify("BeforeFillLimitedTemplate", $template);
     $template->addProperty("Anesthésie - Tabac", $this->tabac);
     $template->addProperty("Anesthésie - Oenolisme", $this->oenolisme);
     $dossier_medical = $this->loadRefPatient()->loadRefDossierMedical();
     $template->addProperty("Anesthésie - Groupe sanguin", $dossier_medical->groupe_sanguin . " " . $dossier_medical->rhesus);
     $template->addProperty("Anesthésie - RAI", $this->rai);
     $template->addProperty("Anesthésie - Hb", "{$this->hb} g/dl");
     $template->addProperty("Anesthésie - Ht", "{$this->ht} %");
     $template->addProperty("Anesthésie - Ht final", "{$this->ht_final} %");
     $template->addProperty("Anesthésie - PSA", "{$this->_psa} ml/GR");
     $template->addProperty("Anesthésie - Plaquettes", $this->plaquettes * 1000 . "/mm3");
     $template->addProperty("Anesthésie - Créatinine", "{$this->creatinine} mg/l");
     $template->addProperty("Anesthésie - Clairance", "{$this->_clairance} ml/min");
     $template->addProperty("Anesthésie - Na+", "{$this->na} mmol/l");
     $template->addProperty("Anesthésie - K+", "{$this->k} mmol/l");
     $template->addProperty("Anesthésie - TP", "{$this->tp} %");
     $template->addProperty("Anesthésie - TCA", "{$this->tca_temoin} s / {$this->tca} s");
     $template->addProperty("Anesthésie - TS Ivy", "{$this->_min_tsivy} min {$this->_sec_tsivy} s");
     $template->addProperty("Anesthésie - ECBU", $this->ecbu);
     $template->addProperty("Anesthésie - Commentaire", $this->result_com);
     $template->addProperty("Anesthésie - ASA", $this->_ref_operation->ASA ? $this->_ref_operation->getFormattedValue("ASA") : $this->getFormattedValue("ASA"));
     $template->addProperty("Anesthésie - Préparation pré-opératoire", $this->prepa_preop);
     $template->addProperty("Anesthésie - Prémédication", $this->premedication);
     $template->addProperty("Anesthésie - Position", $this->_ref_operation->getFormattedValue('position'));
     $list = CMbArray::pluck($this->loadRefsTechniques(), 'technique');
     $template->addListProperty("Anesthésie - Techniques complémentaires", $list);
     $template->addProperty("Anesthésie - Résultats ECG", $this->result_ecg);
     $template->addProperty("Anesthésie - Résultats Radio pulmonaire", $this->result_rp);
     $template->addProperty("Anesthésie - Examen cardiovasculaire", $this->examenCardio);
     $template->addProperty("Anesthésie - Examen pulmonaire", $this->examenPulmo);
     $template->addProperty("Anesthésie - Examen digestif", $this->examenDigest);
     $template->addProperty("Anesthésie - Examen autre", $this->examenAutre);
     $template->addProperty("Anesthésie - Type d'anesthésie", $this->_ref_operation->type_anesth ? $this->_ref_operation->getFormattedValue("type_anesth") : $this->getFormattedValue("type_anesth"));
     $template->addProperty("Anesthésie - Ouverture de la bouche", $this->getFormattedValue('bouche'), null, false);
     $template->addProperty("Anesthésie - Intubation", CAppUI::tr("CConsultAnesth-_intub_" . ($this->_intub_difficile ? "difficile" : "pas_difficile")));
     $ventilation = $this->plus_de_55_ans ? "Plus de 55 ans, " : "";
     $ventilation .= $this->imc_sup_26 ? "IMC > 26Kg/m², " : "";
     $ventilation .= $this->edentation ? "Edentation, " : "";
     $ventilation .= $this->ronflements ? "Ronflements, " : "";
     $ventilation .= $this->barbe ? "Barbe" : "";
     $ventilation .= $this->piercing ? "Piercing" : "";
     $template->addProperty("Anesthésie - Critères de ventilation", $ventilation ? $ventilation : "Aucun", null, false);
     $template->addProperty("Anesthésie - Distance thyro-mentonnière", $this->getFormattedValue('distThyro'), null, false);
     $template->addProperty("Anesthésie - Mobilité cervicale", $this->getFormattedValue('mob_cervicale'), null, false);
     $template->addProperty("Anesthésie - Etat bucco-dentaire", $this->etatBucco);
     $img = "";
     if ($this->mallampati) {
         $img = $this->mallampati . '<br /> .
     <img src="/' . $rootName . '/images/pictures/' . $this->mallampati . '.png" alt="' . $this->mallampati . '" />';
     }
     $template->addProperty("Anesthésie - Mallampati", $img, null, false);
     $template->addProperty("Anesthésie - Mallampati (texte seul)", $this->getFormattedValue("mallampati"));
     $template->addProperty("Anesthésie - Remarques", $this->conclusion);
     $template->addProperty("Anesthésie - Score APFEL", $this->_score_apfel);
     $template->addProperty("Anesthésie - Stratégie antibioprophylactique ", $this->strategie_antibio);
     // Constantes médicales dans le contexte de la consultation
     $this->loadRefConsultation();
     $patient = $this->loadRefPatient();
     $patient->loadRefLatestConstantes(null, null, $this->_ref_consultation, false);
     $const_dates = $patient->_latest_constantes_dates;
     $const_med = $patient->_ref_constantes_medicales;
     $const_med->updateFormFields();
     $grid_complet = CConstantesMedicales::buildGridLatest($const_med, $const_dates, true);
     $grid_minimal = CConstantesMedicales::buildGridLatest($const_med, $const_dates, false);
     $grid_valued = CConstantesMedicales::buildGridLatest($const_med, $const_dates, false, true);
     $smarty = new CSmartyDP("modules/dPpatients");
     // Horizontal
     $smarty->assign("constantes_medicales_grid", $grid_complet);
     $constantes_complet_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0);
     $constantes_complet_horiz = preg_replace('`([\\n\\r])`', '', $constantes_complet_horiz);
     $smarty->assign("constantes_medicales_grid", $grid_minimal);
     $constantes_minimal_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0);
     $constantes_minimal_horiz = preg_replace('`([\\n\\r])`', '', $constantes_minimal_horiz);
     $smarty->assign("constantes_medicales_grid", $grid_valued);
     $constantes_valued_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0);
     $constantes_valued_horiz = preg_replace('`([\\n\\r])`', '', $constantes_valued_horiz);
     // Vertical
     $smarty->assign("constantes_medicales_grid", $grid_complet);
     $constantes_complet_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0);
     $constantes_complet_vert = preg_replace('`([\\n\\r])`', '', $constantes_complet_vert);
     $smarty->assign("constantes_medicales_grid", $grid_minimal);
     $constantes_minimal_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0);
     $constantes_minimal_vert = preg_replace('`([\\n\\r])`', '', $constantes_minimal_vert);
     $smarty->assign("constantes_medicales_grid", $grid_valued);
     $constantes_valued_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0);
     $constantes_valued_vert = preg_replace('`([\\n\\r])`', '', $constantes_valued_vert);
     $template->addProperty("Anesthésie - Constantes - mode complet horizontal", $constantes_complet_horiz, '', false);
     $template->addProperty("Anesthésie - Constantes - mode minimal horizontal", $constantes_minimal_horiz, '', false);
     $template->addProperty("Anesthésie - Constantes - mode avec valeurs horizontal", $constantes_valued_horiz, '', false);
     $template->addProperty("Anesthésie - Constantes - mode complet vertical", $constantes_complet_vert, '', false);
     $template->addProperty("Anesthésie - Constantes - mode minimal vertical", $constantes_minimal_vert, '', false);
     $template->addProperty("Anesthésie - Constantes - mode avec valeurs vertical", $constantes_valued_vert, '', false);
     if (CModule::getActive("forms")) {
         CExObject::addFormsToTemplate($template, $this, "Anesthésie");
     }
     $this->notify("AfterFillLimitedTemplate", $template);
 }
 /**
  * Return the selected constants in an formatted array (see getConstantsByRank to see the format)
  *
  * @param array            $selection The constant you want to select
  * @param string           $type      'form' or 'graph'
  * @param CMbObject|string $host      Host from which we'll get the configuration
  *
  * @return array
  */
 static function selectConstants($selection, $type = 'form', $host = null)
 {
     if ($host) {
         $show_cat_tabs = CConstantesMedicales::getHostConfig("show_cat_tabs", $host);
     } else {
         $show_cat_tabs = CConstantesMedicales::getConfig("show_cat_tabs");
     }
     $constants_by_rank = self::getRanksFor($type, $host);
     $list_constants = CConstantesMedicales::$list_constantes;
     // Keep only valid constant names
     $constants_by_rank = array_intersect_key($constants_by_rank, $list_constants);
     $constants_by_rank = CMbArray::flip($constants_by_rank);
     ksort($constants_by_rank);
     $result = array();
     foreach ($constants_by_rank as $_rank => $_constants) {
         if ($_rank === -1) {
             continue;
         }
         foreach ($_constants as $_constant) {
             if (strpos($_constant, "_") === 0) {
                 continue;
             }
             if ($show_cat_tabs) {
                 $_type = $list_constants[$_constant]["type"];
                 if (!array_key_exists($_type, $result)) {
                     $result[$_type] = array();
                 }
                 if (!in_array($_constant, $selection)) {
                     $rank = -1;
                 } else {
                     $rank = $_rank;
                 }
                 if (!array_key_exists($rank, $result[$_type])) {
                     $result[$_type][$rank] = array();
                 }
                 $result[$_type][$rank][] = $_constant;
             } else {
                 if (!array_key_exists('all', $result)) {
                     $result['all'] = array();
                 }
                 if (!in_array($_constant, $selection)) {
                     $rank = -1;
                 } else {
                     $rank = $_rank;
                 }
                 if (!array_key_exists($rank, $result['all'])) {
                     $result['all'][$rank] = array();
                 }
                 $result['all'][$rank][] = $_constant;
             }
         }
     }
     foreach ($result as $_type => $_ranks) {
         if (array_key_exists(-1, $result[$_type])) {
             $unselected_constants = $result[$_type][-1];
             unset($result[$_type][-1]);
             $result[$_type]["hidden"] = $unselected_constants;
         }
         if (array_key_exists(-1, $result[$_type])) {
             unset($result[$_type][-1]);
         }
     }
     return $result;
 }
示例#7
0
 function fillLimitedTemplate(&$template)
 {
     CDestinataire::makeAllFor($this);
     $destinataires = CDestinataire::$destByClass;
     foreach ($destinataires as $_destinataires_by_class) {
         foreach ($_destinataires_by_class as $_destinataire) {
             if (!isset($_destinataire->nom) || strlen($_destinataire->nom) == 0 || $_destinataire->nom === " ") {
                 continue;
             }
             $template->destinataires[] = array("nom" => $_destinataire->nom, "email" => $_destinataire->email, "tag" => $_destinataire->tag);
         }
     }
     $this->loadRefsFwd();
     $this->loadRefLatestConstantes(null, array(), null, false);
     $this->loadIPP();
     $this->loadLastINS();
     $this->notify("BeforeFillLimitedTemplate", $template);
     $template->addProperty("Patient - article", $this->_civilite);
     $template->addProperty("Patient - article long", ucfirst($this->_civilite_long));
     $template->addProperty("Patient - article long (minuscule)", strtolower($this->_civilite_long));
     $template->addProperty("Patient - nom", $this->nom);
     $template->addProperty("Patient - nom jeune fille", $this->nom_jeune_fille);
     $template->addProperty("Patient - prénom", $this->prenom);
     $template->addProperty("Patient - adresse", $this->adresse);
     $template->addProperty("Patient - ville", $this->ville);
     $template->addProperty("Patient - cp", $this->cp);
     $template->addProperty("Patient - années", $this->_annees);
     $template->addProperty("Patient - âge", $this->_age);
     $template->addProperty("Patient - date de naissance", $this->getFormattedValue("naissance"));
     $template->addProperty("Patient - lieu de naissance", $this->lieu_naissance);
     $template->addProperty("Patient - sexe", strtolower($this->getFormattedValue("sexe")));
     $template->addProperty("Patient - sexe court", substr(strtolower($this->getFormattedValue("sexe")), 0, 1));
     $template->addProperty("Patient - numéro d'assuré", $this->getFormattedValue("matricule"));
     $template->addProperty("Patient - téléphone", $this->getFormattedValue("tel"));
     $template->addProperty("Patient - mobile", $this->getFormattedValue("tel2"));
     $template->addProperty("Patient - téléphone autre", $this->tel_autre);
     $template->addProperty("Patient - profession", $this->profession);
     $template->addProperty("Patient - IPP", $this->_IPP);
     $template->addProperty("Patient - Qualité bénéficiaire", $this->qual_beneficiaire);
     $this->guessExoneration();
     $template->addProperty("Patient - Qualité bénéficiaire - Libellé", $this->libelle_exo);
     $template->addProperty("Patient - Numéro de sécurité sociale", $this->getFormattedValue("matricule"));
     $template->addBarcode("Patient - Code barre ID", $this->_id);
     $template->addBarcode("Patient - Code barre IPP", $this->_IPP);
     $template->addBarcode("Patient - Code barre INS", $this->_ref_last_ins ? $this->_ref_last_ins->ins : "");
     if ($this->sexe === "m") {
         $template->addProperty("Patient - il/elle", "il");
         $template->addProperty("Patient - Il/Elle (majuscule)", "Il");
         $template->addProperty("Patient - le/la", "le");
         $template->addProperty("Patient - Le/La (majuscule)", "Le");
         $template->addProperty("Patient - du/de la", "du");
         $template->addProperty("Patient - au/à la", "au");
         $template->addProperty("Patient - accord genre", "");
     } else {
         $template->addProperty("Patient - il/elle", "elle");
         $template->addProperty("Patient - Il/Elle (majuscule)", "Elle");
         $template->addProperty("Patient - le/la", "la");
         $template->addProperty("Patient - Le/La (majuscule)", "La");
         $template->addProperty("Patient - du/de la", "de la");
         $template->addProperty("Patient - au/à la", "à la");
         $template->addProperty("Patient - accord genre", "e");
     }
     $medecin = $this->_ref_medecin_traitant->_id ? $this->_ref_medecin_traitant : new CMedecin();
     $template->addProperty("Patient - médecin traitant", "{$medecin->nom} {$medecin->prenom}");
     $template->addProperty("Patient - médecin traitant - Nom Prénom", "{$medecin->nom} {$medecin->prenom}");
     $template->addProperty("Patient - médecin traitant - nom", $medecin->nom);
     $template->addProperty("Patient - médecin traitant - prenom", $medecin->prenom);
     $template->addProperty("Patient - médecin traitant - adresse", "{$medecin->adresse} \n {$medecin->cp} {$medecin->ville}");
     $template->addProperty("Patient - médecin traitant - voie", $medecin->adresse);
     $template->addProperty("Patient - médecin traitant - cp", $medecin->cp);
     $template->addProperty("Patient - médecin traitant - ville", $medecin->ville);
     $template->addProperty("Patient - médecin traitant - confraternité", $medecin->_confraternite);
     $template->addProperty("Patient - médecin traitant - tel", $medecin->getFormattedValue("tel"));
     $template->addProperty("Patient - médecin traitant - fax", $medecin->getFormattedValue("fax"));
     if ($medecin->sexe == "f") {
         $template->addProperty("Patient - médecin traitant - accord genre", "e");
         $template->addProperty("Patient - médecin traitant - article long", "Mme le docteur");
     } elseif ($medecin->sexe == "m") {
         $template->addProperty("Patient - médecin traitant - accord genre", "");
         $template->addProperty("Patient - médecin traitant - article long", "Mr le docteur");
     } else {
         $template->addProperty("Patient - médecin traitant - accord genre", "");
         $template->addProperty("Patient - médecin traitant - article long", "le docteur");
     }
     // Employeur
     $this->loadRefsCorrespondantsPatient();
     $correspondants = $this->_ref_cp_by_relation;
     foreach ($correspondants as $relation => $_correspondants) {
         $_correspondant = @reset($_correspondants);
         // Dans le cas d'un modèle, création d'un correspondant pour chaque type de relation
         if (!count($_correspondants)) {
             $_correspondant = new CCorrespondantPatient();
             $_correspondant->relation = $relation;
         }
         switch ($_correspondant->relation) {
             case "employeur":
                 $template->addProperty("Patient - employeur - nom", $_correspondant->nom);
                 $template->addProperty("Patient - employeur - adresse", $_correspondant->adresse);
                 $template->addProperty("Patient - employeur - cp", $_correspondant->cp);
                 $template->addProperty("Patient - employeur - ville", $_correspondant->ville);
                 $template->addProperty("Patient - employeur - tel", $_correspondant->getFormattedValue("tel"));
                 $template->addProperty("Patient - employeur - mobile", $_correspondant->getFormattedValue("mob"));
                 $template->addProperty("Patient - employeur - urssaf", $_correspondant->urssaf);
                 break;
             case "prevenir":
                 $template->addProperty("Patient - prévenir - nom", $_correspondant->nom);
                 $template->addProperty("Patient - prévenir - prénom", $_correspondant->prenom);
                 $template->addProperty("Patient - prévenir - adresse", $_correspondant->adresse);
                 $template->addProperty("Patient - prévenir - cp", $_correspondant->cp);
                 $template->addProperty("Patient - prévenir - ville", $_correspondant->ville);
                 $template->addProperty("Patient - prévenir - tel", $_correspondant->getFormattedValue("tel"));
                 $template->addProperty("Patient - prévenir - mobile", $_correspondant->getFormattedValue("mob"));
                 $template->addProperty("Patient - prévenir - parente", $_correspondant->parente);
                 break;
             case "confiance":
                 $template->addProperty("Patient - confiance - nom", $_correspondant->nom);
                 $template->addProperty("Patient - confiance - nom de jeune fille", $_correspondant->nom_jeune_fille);
                 $template->addProperty("Patient - confiance - prénom", $_correspondant->prenom);
                 $template->addProperty("Patient - confiance - date de naissance", $_correspondant->getFormattedValue("naissance"));
                 $template->addProperty("Patient - confiance - adresse", $_correspondant->adresse);
                 $template->addProperty("Patient - confiance - cp", $_correspondant->cp);
                 $template->addProperty("Patient - confiance - ville", $_correspondant->ville);
                 $template->addProperty("Patient - confiance - tel", $_correspondant->getFormattedValue("tel"));
                 $template->addProperty("Patient - confiance - mobile", $_correspondant->getFormattedValue("mob"));
                 $template->addProperty("Patient - confiance - parente", $_correspondant->parente);
         }
     }
     // Vider les anciens holders
     for ($i = 1; $i < 4; $i++) {
         $template->addProperty("Patient - médecin correspondant {$i}");
         $template->addProperty("Patient - médecin correspondant {$i} - adresse");
         $template->addProperty("Patient - médecin correspondant {$i} - spécialité");
     }
     $this->loadRefsCorrespondants();
     $i = 0;
     $noms = array();
     foreach ($this->_ref_medecins_correspondants as $corresp) {
         $i++;
         $corresp->loadRefsFwd();
         $medecin = $corresp->_ref_medecin;
         $nom = "{$medecin->nom} {$medecin->prenom}";
         $noms[] = $nom;
         $template->addProperty("Patient - médecin correspondant {$i}", $nom);
         $template->addProperty("Patient - médecin correspondant {$i} - adresse", "{$medecin->adresse}\n{$medecin->cp} {$medecin->ville}");
         $template->addProperty("Patient - médecin correspondant {$i} - spécialité", CMbString::htmlEntities($medecin->disciplines));
     }
     $template->addProperty("Patient - médecins correspondants", implode(" - ", $noms));
     //Liste des séjours du patient
     $this->loadRefsSejours();
     if (is_array($this->_ref_sejours)) {
         foreach ($this->_ref_sejours as $_sejour) {
             $_sejour->loadRefPraticien();
         }
         $smarty = new CSmartyDP("modules/dPpatients");
         $smarty->assign("sejours", $this->_ref_sejours);
         $sejours = $smarty->fetch("print_closed_sejours.tpl", '', '', 0);
         $sejours = preg_replace('`([\\n\\r])`', '', $sejours);
     } else {
         $sejours = CAppUI::tr("CSejour.none");
     }
     $template->addProperty("Patient - liste des séjours", $sejours, '', false);
     $const_med = $this->_ref_constantes_medicales;
     $const_dates = $this->_latest_constantes_dates;
     $grid_complet = CConstantesMedicales::buildGridLatest($const_med, $const_dates, true);
     $grid_minimal = CConstantesMedicales::buildGridLatest($const_med, $const_dates, false);
     $grid_valued = CConstantesMedicales::buildGridLatest($const_med, $const_dates, false, true);
     $smarty = new CSmartyDP("modules/dPpatients");
     // Horizontal
     $smarty->assign("constantes_medicales_grid", $grid_complet);
     $constantes_complet_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0);
     $constantes_complet_horiz = preg_replace('`([\\n\\r])`', '', $constantes_complet_horiz);
     $smarty->assign("constantes_medicales_grid", $grid_minimal);
     $constantes_minimal_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0);
     $constantes_minimal_horiz = preg_replace('`([\\n\\r])`', '', $constantes_minimal_horiz);
     $smarty->assign("constantes_medicales_grid", $grid_valued);
     $constantes_valued_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0);
     $constantes_valued_horiz = preg_replace('`([\\n\\r])`', '', $constantes_valued_horiz);
     // Vertical
     $smarty->assign("constantes_medicales_grid", $grid_complet);
     $constantes_complet_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0);
     $constantes_complet_vert = preg_replace('`([\\n\\r])`', '', $constantes_complet_vert);
     $smarty->assign("constantes_medicales_grid", $grid_minimal);
     $constantes_minimal_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0);
     $constantes_minimal_vert = preg_replace('`([\\n\\r])`', '', $constantes_minimal_vert);
     $smarty->assign("constantes_medicales_grid", $grid_valued);
     $constantes_valued_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0);
     $constantes_valued_vert = preg_replace('`([\\n\\r])`', '', $constantes_valued_vert);
     // Liste des fichiers
     $this->loadRefsFiles();
     $list = CMbArray::pluck($this->_ref_files, "file_name");
     $template->addListProperty("Patient - Liste des fichiers", $list);
     // Identité
     $identite = $this->loadNamedFile("identite.jpg");
     $template->addImageProperty("Patient - Photo d'identite", $identite->_id);
     $template->addProperty("Patient - Constantes - mode complet horizontal", $constantes_complet_horiz, '', false);
     $template->addProperty("Patient - Constantes - mode minimal horizontal", $constantes_minimal_horiz, '', false);
     $template->addProperty("Patient - Constantes - mode avec valeurs horizontal", $constantes_valued_horiz, '', false);
     $template->addProperty("Patient - Constantes - mode complet vertical", $constantes_complet_vert, '', false);
     $template->addProperty("Patient - Constantes - mode minimal vertical", $constantes_minimal_vert, '', false);
     $template->addProperty("Patient - Constantes - mode avec valeurs vertical", $constantes_valued_vert, '', false);
     $template->addProperty("Patient - poids", "{$const_med->poids} kg");
     $template->addProperty("Patient - taille", "{$const_med->taille} cm");
     $template->addProperty("Patient - Pouls", $const_med->pouls);
     $template->addProperty("Patient - IMC", $const_med->_imc);
     $template->addProperty("Patient - VST", $const_med->_vst);
     $template->addProperty("Patient - température", $const_med->temperature . "°");
     $template->addProperty("Patient - TA", $const_med->ta ? "{$const_med->_ta_systole} / {$const_med->_ta_diastole}" : "");
     $template->addProperty("Patient - Saturation (spo2)", $const_med->spo2);
     // Assuré social
     $template->addProperty("Patient - Assuré social - nom", $this->assure_nom);
     $template->addProperty("Patient - Assuré social - nom jeune fille", $this->assure_nom_jeune_fille);
     $template->addProperty("Patient - Assuré social - prénom", $this->assure_prenom);
     $template->addProperty("Patient - Assuré social - date de naissance", $this->getFormattedValue("assure_naissance"));
     $template->addProperty("Patient - Assuré social - article", $this->_assure_civilite);
     $template->addProperty("Patient - Assuré social - article long", $this->_assure_civilite_long);
     $template->addProperty("Patient - Assuré social - adresse", $this->assure_adresse);
     $template->addProperty("Patient - Assuré social - ville", $this->assure_ville);
     $template->addProperty("Patient - Assuré social - cp", $this->assure_cp);
     $template->addProperty("Patient - Assuré social - pays", $this->assure_pays);
     $template->addProperty("Patient - Assuré social - téléphone", $this->assure_tel);
     $template->addProperty("Patient - Assuré social - mobile", $this->assure_tel2);
     $template->addProperty("Patient - Assuré social - cp naissance", $this->assure_cp_naissance);
     $template->addProperty("Patient - Assuré social - lieu de naissance", $this->assure_lieu_naissance);
     $template->addProperty("Patient - Assuré social - profession", $this->assure_profession);
     // Bénéficiaire de soins
     $template->addProperty("Patient - Bénéficiaire de soin - code régime", $this->code_regime);
     $template->addProperty("Patient - Bénéficiaire de soin - caisse gest", $this->caisse_gest);
     $template->addProperty("Patient - Bénéficiaire de soin - centre gest", $this->centre_gest);
     $template->addProperty("Patient - Bénéficiaire de soin - code gest", $this->code_gestion);
     $template->addProperty("Patient - Bénéficiaire de soin - régime santé", $this->regime_sante);
     $template->addDateProperty("Patient - Bénéficiaire de soin - début période", $this->deb_amo);
     $template->addDateProperty("Patient - Bénéficiaire de soin - fin période", $this->fin_amo);
     $template->addProperty("Patient - Bénéficiaire de soin - régime am", $this->getFormattedValue("regime_am"));
     $template->addProperty("Patient - Bénéficiaire de soin - ald", $this->getFormattedValue("ald"));
     $template->addProperty("Patient - Bénéficiaire de soin - incapable majeur", $this->getFormattedValue("incapable_majeur"));
     $template->addProperty("Patient - Bénéficiaire de soin - cmu", $this->getFormattedValue("cmu"));
     $template->addProperty("Patient - Bénéficiaire de soin - ATNC", $this->getFormattedValue("ATNC"));
     $template->addDateProperty("Patient - Bénéficiaire de soin - validité vitale", $this->fin_validite_vitale);
     $template->addProperty("Patient - Bénéficiaire de soin - médecin traitant déclaré", $this->getFormattedValue("medecin_traitant_declare"));
     $template->addProperty("Patient - Bénéficiaire de soin - types contrat mutuelle", addslashes($this->mutuelle_types_contrat));
     $template->addProperty("Patient - Bénéficiaire de soin - notes amo", addslashes($this->notes_amo));
     $template->addProperty("Patient - Bénéficiaire de soin - libellé exo", addslashes($this->libelle_exo));
     $template->addProperty("Patient - Bénéficiaire de soin - notes amc", addslashes($this->notes_amc));
     if (CModule::getActive("maternite")) {
         $allaitement = $this->loadLastAllaitement();
         $template->addDateProperty("Patient - Allaitement - Début", $allaitement->date_debut);
         $template->addDateProperty("Patient - Allaitement - Fin", $allaitement->date_fin);
         $grossesse = $this->loadLastGrossesse();
         $template->addDateProperty("Patient - Grossesse - Terme prévu", $grossesse->terme_prevu);
         $template->addDateProperty("Patient - Grossesse - Date des dernières règles", $grossesse->date_dernieres_regles);
         $template->addProperty("Patient - Grossesse - En cours", $grossesse->getFormattedValue("active"));
         $template->addProperty("Patient - Grossesse - Multiple", $grossesse->getFormattedValue("multiple"));
         $template->addProperty("Patient - Grossesse - Allaitement maternel", $grossesse->getFormattedValue("allaitement_maternel"));
         $template->addProperty("Patient - Grossesse - Fausse couche", $grossesse->getFormattedValue('fausse_couche'), null, false);
         $template->addProperty("Patient - Grossesse - Lieu d'accouchement", $grossesse->getFormattedValue("lieu_accouchement"));
         $template->addProperty("Patient - Grossesse - Remarques", $grossesse->rques);
     }
     if (CModule::getActive("forms")) {
         CExObject::addFormsToTemplate($template, $this, "Patient");
     }
     $this->notify("AfterFillLimitedTemplate", $template);
 }
            $where['datetime'] = " > '" . CMbDT::dateTime('-1 month') . "'";
            break;
        case 'year':
            $where['datetime'] = " > '" . CMbDT::dateTime('-1 year') . "'";
            break;
        default:
    }
}
$whereOr = array();
foreach ($selection as $_constant) {
    $whereOr[] = "{$_constant} IS NOT NULL";
}
if (!empty($whereOr)) {
    $where[] = implode(' OR ', $whereOr);
}
$constant = new CConstantesMedicales();
$constants = $constant->loadList($where, 'datetime DESC', null, 'datetime');
$smarty = new CSmartyDP();
if (!empty($constants)) {
    $time = false;
    if ($period) {
        $time = true;
    }
    $graph = new CConstantGraph(CConstantesMedicales::guessHost($context), $context_guid, false, $time);
    $constants_by_graph = array(1 => array($selection));
    $graph->formatGraphDatas(array_reverse($constants, true), $constants_by_graph);
    $smarty->assign('graphs', array(1 => $graph->graphs[1][0]));
    $smarty->assign('min_x_index', $graph->min_x_index);
    $smarty->assign('min_x_value', $graph->min_x_value);
    if (!$period) {
        $smarty->assign('patient', $patient);
示例#9
0
 $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';
     }
 }
 * @package    Mediboard
 * @subpackage Hospi
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$sejour_id = CValue::get("sejour_id");
$transmission = new CTransmissionMedicale();
$where = array("sejour_id" => "= '{$sejour_id}'");
$nb_trans_obs = $transmission->countList($where);
$observation = new CObservationMedicale();
$nb_trans_obs += $observation->countList($where);
$consultation = new CConsultation();
$where["annule"] = "= '0'";
$nb_trans_obs += $consultation->countList($where);
unset($where["annule"]);
// Compter les consultations d'anesthésie hors séjour
$sejour = new CSejour();
$sejour->load($sejour_id);
$patient = $sejour->loadRefPatient();
$consultations = $patient->loadRefsConsultations(array("annule" => "= '0'"));
CStoredObject::massCountBackRefs($consultations, "consult_anesth");
foreach ($consultations as $_consult) {
    if ($_consult->_count["consult_anesth"]) {
        $nb_trans_obs++;
    }
}
$constantes = new CConstantesMedicales();
$where = array("context_class" => "= 'CSejour'", "context_id" => "= '{$sejour_id}'");
$nb_trans_obs += $constantes->countList($where);
echo $nb_trans_obs;
        // Et dans ce cas, la créer pour le bébé
        if ($curr_affect->_id) {
            $affectation = $sejour_enfant->loadRefCurrAffectation();
            if (!$affectation->_id) {
                $affectation = new CAffectation();
                $affectation->entree = $sejour_enfant->entree_reelle;
                $affectation->sortie = $sejour_enfant->sortie_prevue;
                $affectation->lit_id = $curr_affect->lit_id;
                $affectation->sejour_id = $sejour_enfant->_id;
                $affectation->parent_affectation_id = $curr_affect->_id;
                storeObject($affectation);
            }
        }
    }
    if ($poids || $taille || $perimetre_cranien) {
        $constantes = new CConstantesMedicales();
        $constantes->load($constantes_id);
        $constantes->poids = $poids;
        $constantes->taille = $taille;
        $constantes->perimetre_cranien = $perimetre_cranien;
        // Depuis un dossier provisoire, les constantes médicales ne sont pas créées.
        if (!$constantes->_id) {
            $constantes->context_class = $sejour_enfant->_class;
            $constantes->context_id = $sejour_enfant->_id;
            $constantes->patient_id = $patient->_id;
            $constantes->datetime = CMbDT::dateTime();
        }
        storeObject($constantes);
    }
}
echo CAppUI::getMsg();
 */
CCanDo::checkEdit();
$consult_id = CValue::getOrSession("consult_id");
$consult = new CConsultation();
$consult->load($consult_id);
$consult->loadRefPlageConsult();
$patient = $consult->loadRefPatient();
$consult->loadRefsDossiersAnesth();
$tab_op = array();
foreach ($consult->_refs_dossiers_anesth as $consult_anesth) {
    $consult_anesth->loadRelPatient();
    $consultation = $consult_anesth->_ref_consultation;
    $consultation->_ref_patient->loadRefLatestConstantes(null, array("poids"), $consultation);
    if (!$consultation->_ref_patient->_ref_constantes_medicales->poids && $consultation->loadRefSejour()->_id) {
        $date = $consultation->_ref_plageconsult->date;
        $cte = CConstantesMedicales::getRelated(array("poids"), $patient, $consultation->_ref_sejour, $date . " 00:00:00", $date . " 23:59:00");
        $consultation->_ref_patient->_ref_constantes_medicales->poids = count($cte) ? reset($cte)->poids : false;
    }
    $consult_anesth->loadRefOperation()->loadRefSejour();
    $consult_anesth->_ref_operation->_ref_sejour->loadRefDossierMedical();
    if (!$consult_anesth->operation_id) {
        $tab_op[] = 0;
    } else {
        $tab_op[] = $consult_anesth->operation_id;
    }
}
if (!count($tab_op)) {
    $tab_op[] = 0;
}
$dossier_medical_patient = $consult->_ref_patient->loadRefDossierMedical();
$dossier_medical_patient->loadRefsAntecedents();
示例#13
0
 /**
  * Chargement de constantes médicales
  *
  * @param array $where Clauses where
  *
  * @return CConstantesMedicales[]
  */
 function loadListConstantesMedicales($where = array())
 {
     if ($this->_list_constantes_medicales) {
         return $this->_list_constantes_medicales;
     }
     $this->loadRefsConsultations();
     $this->loadRefsConsultAnesth();
     if (!empty($this->_ref_consultations) || $this->_ref_consult_anesth) {
         $whereOr = array();
         $whereOr[] = "(context_class = '{$this->_class}' AND context_id = '{$this->_id}')";
         foreach ($this->_ref_consultations as $_ref_consult) {
             $whereOr[] = "(context_class = '{$_ref_consult->_class}' AND context_id = '{$_ref_consult->_id}')";
         }
         if ($this->_ref_consult_anesth) {
             $consult = $this->_ref_consult_anesth->loadRefConsultation();
             $whereOr[] = "(context_class = '{$consult->_class}' AND context_id = '{$consult->_id}')";
         }
         $where[] = implode(" OR ", $whereOr);
     } else {
         $where['context_class'] = " = '{$this->_class}'";
         $where['context_id'] = " = '{$this->_id}'";
     }
     $constantes = new CConstantesMedicales();
     $where['patient_id'] = " = '{$this->patient_id}'";
     return $this->_list_constantes_medicales = $constantes->loadList($where, 'datetime ASC');
 }
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 27073 $
 */
/**
 * Convert a string in a float value
 *
 * @param string|null $v The value
 *
 * @return float|null
 */
function getValue($v)
{
    return $v === null ? null : floatval($v);
}
$constantes = new CConstantesMedicales();
$perms = $constantes->canDo();
if (!$perms->read) {
    $perms->redirect();
}
$context_guid = CValue::get('context_guid');
$selected_context_guid = CValue::get('selected_context_guid', $context_guid);
$patient_id = CValue::get('patient_id');
$can_edit = CValue::get('can_edit');
$can_select_context = CValue::get('can_select_context', 1);
$selection = CValue::get('selection');
$date_min = CValue::get('date_min');
$date_max = CValue::get('date_max');
$print = CValue::get('print');
$paginate = CValue::get('paginate', 0);
$start = CValue::get('start', 0);
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage dPpatients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CSessionHandler::writeClose();
$const = new CConstantesMedicales();
$perms = $const->canDo();
if (!$perms->read) {
    $perms->redirect();
}
$context_guid = CValue::get('context_guid');
$context = CStoredObject::loadFromGuid($context_guid);
$ranks = CConstantesMedicales::getConstantsByRank('graph', false, CConstantesMedicales::guessHost($context));
$list_cste = array();
$list_cumul = array();
$cste_nb = 0;
$cumul_nb = 0;
if (array_key_exists(1, $ranks['all'])) {
    /* We only display constants with rank 1 */
    foreach ($ranks['all'][1] as $_cste) {
        if (substr($_cste, 0, 1) === "_") {
            continue;
        }
        /* We display at most 4 graph with cumuled constants */
示例#16
0
 $obs = new CObservationMedicale();
 $whereObs = array();
 $whereObs[] = "(degre = 'high') OR (date >= '{$dateTime_min}' AND date <= '{$dateTime_max}')";
 $whereObs["sejour_id"] = CSQLDataSource::prepareIn(array_keys($sejours));
 $observations = $obs->loadList($whereObs, "FIND_IN_SET(observation_medicale.sejour_id, '" . implode(',', $sejours_ids) . "')");
 CMbObject::massLoadFwdRef($observations, "user_id");
 foreach ($observations as $_obs) {
     $_obs->loadRefUser();
     $_obs->loadTargetObject();
     if ($_obs->_ref_object) {
         $_obs->_ref_object->loadRefsFwd();
     }
     $_obs->_ref_sejour = $sejours[$_obs->sejour_id];
     $trans_and_obs[$_obs->_ref_sejour->patient_id][$_obs->date][] = $_obs;
 }
 $cste = new CConstantesMedicales();
 $whereCstes = array();
 $whereCstes[] = "(datetime >= '{$dateTime_min} ' AND datetime <= '{$dateTime_max}')";
 $whereCstes["context_class"] = " = 'CSejour'";
 $whereCstes["context_id"] = CSQLDataSource::prepareIn(array_keys($sejours));
 $constantes = $cste->loadList($whereCstes, "FIND_IN_SET(context_id, '" . implode(',', $sejours_ids) . "')");
 CMbObject::massLoadFwdRef($constantes, "user_id");
 foreach ($constantes as $_constante) {
     $_constante->loadRefUser();
     $_constante->_ref_context = $sejours[$_constante->context_id];
     $trans_and_obs[$_constante->patient_id][$_constante->datetime][] = $_constante;
 }
 // Tri des transmission, observations et constantes par date décroissante
 foreach ($trans_and_obs as &$_trans) {
     krsort($_trans, SORT_STRING);
 }
示例#17
0
        if ($_consultation->type == "entree") {
            continue;
        }
        $_consultation->loadRefPraticien()->loadRefFunction();
        $patients_offline[$patient->_guid]["consultations"][$_consultation->_ref_chir->function_id] = $_consultation;
    }
    array_multisort(CMbArray::pluck($patients_offline[$patient->_guid]["consultations"], "_datetime"), SORT_DESC, $patients_offline[$patient->_guid]["consultations"]);
    // Constantes
    $patients_offline[$patient->_guid]["constantes"] = "";
    $cstes = array_reverse($_sejour->loadListConstantesMedicales($where_cste));
    if (count($cstes)) {
        CStoredObject::massLoadFwdRef($cstes, "user_id");
        foreach ($cstes as $_cste) {
            $_cste->loadRefUser();
        }
        $smarty_cstes->assign("constantes_medicales_grid", CConstantesMedicales::buildGrid($cstes, false));
        $smarty_cstes->assign("sejour", $_sejour);
        $patients_offline[$patient->_guid]["constantes"] = $smarty_cstes->fetch("print_constantes.tpl", '', '', 0);
    }
    // Plan de soins
    $page_break = 0;
    if (count($patients_offline[$patient->_guid]["transmissions"]) || count($patients_offline[$patient->_guid]["observations"]) || count($patients_offline[$patient->_guid]["consultations"]) || $patients_offline[$patient->_guid]["constantes"]) {
        $page_break = 1;
    }
    $params = array("sejours_ids" => $_sejour->_id, "date" => $date, "hours_before" => "2", "hours_after" => "2", "empty_lines" => "2", "dialog" => 1, "mode_lite" => 1, "page_break" => $page_break);
    $patients_offline[$patient->_guid]["plan_soins"] = CApp::fetch("soins", "offline_plan_soins", $params);
    // Pour IE9 qui a des soucis avec les espaces entre une fermeture et une ouverture de td
    $patients_offline[$patient->_guid]["plan_soins"] = preg_replace('/>\\s+<(t[dh])/mi', "><\\1", $patients_offline[$patient->_guid]["plan_soins"]);
}
if ($service_id != "urgence") {
    if ($service_id == "NP") {
示例#18
0
}
$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));
}
$show_cat_tabs = CConstantesMedicales::getHostConfig("show_cat_tabs", $host);
$show_enable_all_button = CConstantesMedicales::getHostConfig("show_enable_all_button", $host);
$dates = array();
if (!$selection) {
    $selection = CConstantesMedicales::getConstantsByRank('form', true, $host);
} else {
    $selection = CConstantesMedicales::selectConstants($selection, 'form');
}
foreach (CConstantesMedicales::$list_constantes as $key => $cst) {
    $dates["{$key}"] = CMbDT::format(null, '%d/%m/%y');
}
$patient_id = $constantes->patient_id ? $constantes->patient_id : $patient_id;
$patient = CPatient::loadFromGuid("CPatient-{$patient_id}");
$patient->loadRefLatestConstantes(null, array("poids", "taille"), null, false);
$constantes = new CConstantesMedicales();
$constantes->load($const_id);
$constantes->loadRefContext();
$constantes->loadRefPatient();
$constantes->updateFormFields();
// Pour forcer le chargement des unités lors de la saisie d'une nouvelle constante
if ($context) {
    $constantes->patient_id = $patient_id;
    $constantes->context_class = $context->_class;
    $constantes->context_id = $context->_id;
}
$modif_timeout = intval(CAppUI::conf("dPpatients CConstantesMedicales constants_modif_timeout", $host->_guid));
$can_create = $perms->edit;
if ($perms->edit && $constantes->_id && $modif_timeout > 0 && time() - strtotime($constantes->datetime) > $modif_timeout * 3600) {
    $can_edit = 0;
} else {
} elseif ($context instanceof CMbObject) {
    $context->loadRefPatient();
}
$where = array();
if ($context) {
    if ($context instanceof CCsejour) {
        $whereOr = array();
        $whereOr[] = "(context_class = '{$context->_class}' AND context_id = '{$context->_id}')";
        foreach ($context->_ref_consultations as $_ref_consult) {
            $whereOr[] = "(context_class = '{$_ref_consult->_class}' AND context_id = '{$_ref_consult->_id}')";
        }
        if ($context->_ref_consult_anesth) {
            $consult = $context->_ref_consult_anesth->loadRefConsultation();
            $whereOr[] = "(context_class = '{$consult->_class}' AND context_id = '{$consult->_id}')";
        }
        $where[] = implode(" OR ", $whereOr);
    } else {
        $where['context_class'] = " = '{$context->_class}'";
        $where['context_id'] = " = {$context->_id}";
    }
}
$where['patient_id'] = " = {$patient->_id}";
/** @var CConstantesMedicales[] $list_constantes */
$constantes = new CConstantesMedicales();
$list_constantes = $constantes->loadList($where, 'datetime DESC');
$constantes_medicales_grid = CConstantesMedicales::buildGrid($list_constantes, false, true);
$smarty = new CSmartyDP();
$smarty->assign('list_constantes', $list_constantes);
$smarty->assign('constantes_medicales_grid', $constantes_medicales_grid);
$smarty->assign('full_size', 1);
$smarty->display('print_constantes_vert.tpl');
    if (CModule::getActive("dmi")) {
        foreach ($prescription->loadRefsLinesDMI() as $_line_dmi) {
            $_line_dmi->loadRefProduct();
            $_line_dmi->loadRefPraticien();
            $_line_dmi->loadRefProductOrderItemReception()->loadRefOrderItem()->loadReference()->loadRefSociete();
        }
    }
}
ksort($dossier);
// Constantes du séjour
$where = array();
if ($datetime_min) {
    $where["datetime"] = " >= '{$datetime_min}'";
}
$sejour->loadListConstantesMedicales($where);
$constantes_grid = CConstantesMedicales::buildGrid($sejour->_list_constantes_medicales, false);
$praticien = new CMediusers();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("sejour", $sejour);
$smarty->assign("dossier", $dossier);
$smarty->assign("list_lines", $list_lines);
$smarty->assign("constantes_medicales_grid", $constantes_grid);
if (CModule::getActive("dPprescription")) {
    $smarty->assign("prescription", $prescription);
}
$smarty->assign("formulaires", $formulaires);
$smarty->assign("praticien", $praticien);
$smarty->assign("offline", $offline);
$smarty->assign("embed", $embed);
$smarty->assign("in_modal", $in_modal);
        foreach ($context->_ref_consultations as $_ref_consult) {
            $whereOr[] = "(context_class = '{$_ref_consult->_class}' AND context_id = '{$_ref_consult->_id}')";
        }
        if ($context->_ref_consult_anesth) {
            $consult = $context->_ref_consult_anesth->loadRefConsultation();
            $whereOr[] = "(context_class = '{$consult->_class}' AND context_id = '{$consult->_id}')";
        }
        $where[] = implode(" OR ", $whereOr);
    } else {
        $where['context_class'] = " = '{$context->_class}'";
        $where['context_id'] = " = {$context->_id}";
    }
}
$where['patient_id'] = " = {$patient->_id}";
$limit = "0, {$nb_input_display}";
$constantes = new CConstantesMedicales();
$constantes->patient_id = $patient->_id;
$constantes->loadRefPatient();
$constantes->updateFormFields();
if ($context) {
    $constantes->context_id = $context->_id;
    $constantes->context_class = $context->_class;
    $constantes->loadRefContext();
}
if (empty($selection) || is_null($host)) {
    $constants_ranks = CConstantesMedicales::getConstantsByRank('form', false, $host);
} else {
    $constants_ranks = CConstantesMedicales::selectConstants($selection, 'form', $host);
}
$list_constantes = $constantes->loadList($where, 'datetime DESC', $limit);
$smarty = new CSmartyDP();