function doBind() { parent::doBind(); // recuperation du sejour_id $_sejour_id = CValue::post("_sejour_id", null); // si pas de sejour_id, redirection if (!$_sejour_id) { $this->doRedirect(); } // Creation du nouvel antecedent unset($_POST["antecedent_id"]); $this->_obj = $this->_old; $this->_obj->_id = null; $this->_obj->antecedent_id = null; // Calcul de la valeur de l'id du dossier_medical du sejour $this->_obj->dossier_medical_id = CDossierMedical::dossierMedicalId($_sejour_id, "CSejour"); }
<?php /** * $Id: do_traitement_aed.php 19219 2013-05-21 12:26:07Z phenxdesign $ * * @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 19219 $ */ $autoadd_default = CAppUI::pref("AUTOADDSIGN", true); $del = $_POST["del"]; // Sejour // si on a un sejour et que l'option d'ajout automatique est activée if (isset($_POST["_sejour_id"]) && $autoadd_default && $_POST["_sejour_id"] != "") { $doSejour = new CDoObjectAddEdit("CTraitement", "traitement_id"); // Ajout de l'antecedent dans le sejour $_POST["dossier_medical_id"] = CDossierMedical::dossierMedicalId($_POST["_sejour_id"], "CSejour"); $doSejour->redirectStore = null; $doSejour->redirect = null; $doSejour->doIt(); } $_POST["del"] = $del; // Patient $doPatient = new CDoObjectAddEdit("CTraitement", "traitement_id"); if ($_POST["del"] != 1 && isset($_POST["_patient_id"])) { $_POST["dossier_medical_id"] = CDossierMedical::dossierMedicalId($_POST["_patient_id"], "CPatient"); } $_POST["ajax"] = 1; $doPatient->doIt();
foreach ($traitements as $key => $_traitement) { $_traitement->loadRefDossierMedical(); $_traitement->_ref_dossier_medical->loadRefObject(); $traitements_[$key] = $_traitement->_ref_dossier_medical->object_id; $_traitement->loadRefsFwd(); } // Recherche sur les diagnostics /** @var CDossierMedical[] $dossiersMed */ $dossiersMed = array(); $where_diag = array(); if ($diagnostic_patient) { $where_diag["codes_cim"] = "LIKE '%{$diagnostic_patient}%'"; $where_diag["object_class"] = " = 'CPatient'"; } $order_diag = "object_id"; $dossierMedical = new CDossierMedical(); $pat_diag = new CPatient(); $total_dossierMedicals = null; if ($where_diag) { $total_dossierMedicals = $dossierMedical->countList($where_diag); $dossiersMed = $dossierMedical->loadList($where_diag, $order_diag, "{$page_dossierMedical}, 30"); } foreach ($dossiersMed as $value) { $value->loadRefObject(); $value->loadRefsFwd(); } $where_motif = null; $where_remarque = null; $where_examen = null; $where_traitement = null; $where_consult = null;
$dossier_medical_sejour->loadRefsAntecedents(); $dossier_medical_sejour->countAntecedents(false); $dossier_medical_sejour->countAllergies(); } $patient->loadRefPhotoIdentite(); $dossier_medical_patient = $patient->loadRefDossierMedical(); $patient->loadRefLatestConstantes(null, array("poids", "taille")); if ($dossier_medical_patient->_id) { $dossier_medical_patient->loadRefsAllergies(); $dossier_medical_patient->loadRefsAntecedents(); $dossier_medical_patient->countAntecedents(false); $dossier_medical_patient->countAllergies(); } /* Suppression des antecedents du dossier medical du patients présent dans le dossier medical du sejour */ if ($dossier_medical_patient->_id && $dossier_medical_sejour->_id) { CDossierMedical::cleanAntecedentsSignificatifs($dossier_medical_sejour, $dossier_medical_patient); } $operation = new COperation(); if ($operation->load($operation_id)) { $operation->loadRefPlageOp(); $operation->_ref_anesth->loadRefFunction(); } $is_praticien = CAppUI::$user->isPraticien(); if (CModule::getActive("dPprescription")) { CPrescription::$_load_lite = false; } $sejour->countAlertsNotHandled("medium", "observation"); $smarty = new CSmartyDP(); $smarty->assign("sejour", $sejour); $smarty->assign("patient", $patient); $smarty->assign("date", $date);
function addIntervention($elParent, COperation $operation, $referent = null, $light = false) { $identifiant = $this->addElement($elParent, "identifiant"); $this->addElement($identifiant, "emetteur", $operation->_id); $last_idex = $operation->_ref_last_id400; if (isset($last_idex->_id)) { $this->addElement($identifiant, "recepteur", $last_idex->id400); } $sejour = $operation->loadRefSejour(); if (!$operation->plageop_id) { $operation->completeField("date"); } // Calcul du début de l'intervention $mbOpDate = CValue::first($operation->_ref_plageop->date, $operation->date); $time_operation = $operation->time_operation == "00:00:00" ? null : $operation->time_operation; $mbOpHeureDebut = CValue::first($operation->debut_op, $operation->entree_salle, $time_operation, $operation->horaire_voulu, $operation->_ref_plageop->debut); $mbOpDebut = CMbRange::forceInside($sejour->entree, $sejour->sortie, "{$mbOpDate} {$mbOpHeureDebut}"); // Calcul de la fin de l'intervention $mbOpHeureFin = CValue::first($operation->fin_op, $operation->sortie_salle, CMbDT::addTime($operation->temp_operation, CMbDT::time($mbOpDebut))); $mbOpFin = CMbRange::forceInside($sejour->entree, $sejour->sortie, "{$mbOpDate} {$mbOpHeureFin}"); $debut = $this->addElement($elParent, "debut"); $this->addElement($debut, "date", CMbDT::date($mbOpDebut)); $this->addElement($debut, "heure", CMbDT::time($mbOpDebut)); $fin = $this->addElement($elParent, "fin"); $this->addElement($fin, "date", CMbDT::date($mbOpFin)); $this->addElement($fin, "heure", CMbDT::time($mbOpFin)); if ($light) { // Ajout des participants $mbParticipants = array(); foreach ($operation->_ref_actes_ccam as $acte_ccam) { $acte_ccam->loadRefExecutant(); $mbParticipant = $acte_ccam->_ref_executant; $mbParticipants[$mbParticipant->user_id] = $mbParticipant; } $participants = $this->addElement($elParent, "participants"); foreach ($mbParticipants as $mbParticipant) { $participant = $this->addElement($participants, "participant"); $medecin = $this->addElement($participant, "medecin"); $this->addProfessionnelSante($medecin, $mbParticipant); } // Libellé de l'opération $this->addTexte($elParent, "libelle", $operation->libelle, 80); } else { $this->addUniteFonctionnelle($elParent, $operation); // Uniquement le responsable de l’'intervention $participants = $this->addElement($elParent, "participants"); $participant = $this->addElement($participants, "participant"); $medecin = $this->addElement($participant, "medecin"); $this->addProfessionnelSante($medecin, $operation->loadRefChir()); // Libellé de l'opération $this->addTexte($elParent, "libelle", $operation->libelle, 4000); // Remarques sur l'opération $this->addTexte($elParent, "commentaire", CMbString::convertHTMLToXMLEntities("{$operation->materiel} - {$operation->rques}"), 4000); // Conventionnée ? $this->addElement($elParent, "convention", $operation->conventionne ? 1 : 0); // TypeAnesthésie : nomemclature externe (idex) if ($operation->type_anesth) { $tag_hprimxml = $this->_ref_receiver->_tag_hprimxml; $idexTypeAnesth = CIdSante400::getMatch("CTypeAnesth", $tag_hprimxml, null, $operation->type_anesth); $this->addElement($elParent, "typeAnesthesie", $idexTypeAnesth->id400); } // Indicateurs $indicateurs = $this->addElement($elParent, "indicateurs"); $dossier_medical = new CDossierMedical(); $dossier_medical->object_class = "CPatient"; $dossier_medical->object_id = $operation->loadRefPatient()->_id; $dossier_medical->loadMatchingObject(); $antecedents = $dossier_medical->loadRefsAntecedents(); foreach ($antecedents as $_antecedent) { $rques = CMbString::htmlspecialchars($_antecedent->rques); $rques = CMbString::convertHTMLToXMLEntities($rques); $this->addCodeLibelle($indicateurs, "indicateur", $_antecedent->_id, $rques); } // Extemporané if ($operation->exam_extempo) { $this->addCodeLibelle($indicateurs, "indicateur", "EXT", "Extemporané"); } // Recours / Durée USCPO $this->addElement($elParent, "recoursUscpo", $operation->duree_uscpo ? 1 : 0); $this->addElement($elParent, "dureeUscpo", $operation->duree_uscpo ? $operation->duree_uscpo : null); // Côté (droit|gauche|bilatéral|total|inconnu) // D - Droit // G - Gauche // B - Bilatéral // T - Total // I - Inconnu $cote = array("droit" => "D", "gauche" => "G", "bilatéral" => "B", "total" => "T", "inconnu" => "I", "haut" => "HT", "bas" => "BS"); $this->addCodeLibelle($elParent, "cote", $cote[$operation->cote], CMbString::capitalize($operation->cote)); } }
$nbIntervHorsPlage = CIntervHorsPlage::countForDates($date_planning, null, array($praticien_id)); $prats = CStoredObject::massLoadFwdRef($operations, "chir_id"); CStoredObject::massLoadFwdRef($prats, "function_id"); CStoredObject::massLoadFwdRef($operations, "plageop_id"); CStoredObject::massLoadFwdRef($operations, "salle_id"); CStoredObject::massLoadFwdRef($operations, "anesth_id"); CStoredObject::massLoadFwdRef($operations, "chir_2_id"); CStoredObject::massLoadFwdRef($operations, "chir_3_id"); CStoredObject::massLoadFwdRef($operations, "chir_4_id"); CStoredObject::massLoadBackRefs($operations, "workflow"); $sejours = CStoredObject::massLoadFwdRef($operations, "sejour_id"); $affectations = CStoredObject::massLoadBackRefs($sejours, "affectations"); CStoredObject::massLoadFwdRef($affectations, "lit_id"); $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); $dossiers = CStoredObject::massLoadBackRefs($patients, "dossier_medical"); CDossierMedical::massCountAllergies($dossiers); // Récupération des commentaires $commentaire = new CCommentairePlanning(); $where = array(); $where["debut"] = " <= '{$date_planning} 23:59:59'"; $where["fin"] = " >= '{$date_planning} 00:00:00'"; $where["salle_id"] = CSQLDataSource::prepareIn($salles_ids); $commentaires = $commentaire->loadListWithPerms(PERM_READ, $where); // Récupération des plages opératoires $plageop = new CPlageOp(); $where = array(); $where["date"] = " = '{$date_planning}'"; $where["salle_id"] = CSQLDataSource::prepareIn($salles_ids); $plages = $plageop->loadListWithPerms(PERM_READ, $where); // Création du planning $planning = new CPlanningWeek(0, 0, count($salles), count($salles), false, "auto");
/** * @param CConsultation $consult * @param CDossierMedical $dossier_medical * @param CConsultAnesth $consultAnesth * @param CSejour $sejour * @param array $list_etat_dents * * @return array */ static function makeTabsCount($consult, $dossier_medical, $consultAnesth, $sejour, $list_etat_dents) { $tabs_count = array("AntTrait" => 0, "Constantes" => 0, "prescription_sejour" => 0, "facteursRisque" => 0, "Examens" => 0, "Exams" => 0, "ExamsComp" => 0, "Intub" => 0, "InfoAnesth" => 0, "dossier_traitement" => 0, "dossier_suivi" => 0, "Actes" => 0, "fdrConsult" => 0, "reglement" => 0); if (CModule::getActive("dPprescription")) { CPrescription::$_load_lite = true; } foreach ($tabs_count as $_tab => $_count) { $count = 0; switch ($_tab) { case "AntTrait": $prescription = $dossier_medical->loadRefPrescription(); $count_meds = 0; if (CModule::getActive("dPprescription")) { $count_meds = $prescription->countBackRefs("prescription_line_medicament"); } $dossier_medical->countTraitements(); $dossier_medical->countAntecedents(false); $dossier_medical->countAllergies(); $tabs_count[$_tab] = $dossier_medical->_count_antecedents + $dossier_medical->_count_allergies + $dossier_medical->_count_traitements + $count_meds + count($dossier_medical->_ext_codes_cim); break; case "Constantes": if ($sejour->_ref_rpu && $sejour->_ref_rpu->_id) { $tabs_count[$_tab] = $sejour->countBackRefs("contextes_constante"); } else { $tabs_count[$_tab] = $consult->countBackRefs("contextes_constante"); } break; case "prescription_sejour": $_sejour = $sejour; if ($consultAnesth->_id && $consultAnesth->operation_id) { $_sejour = $consultAnesth->loadRefOperation()->loadRefSejour(); } if ($_sejour->_id) { $_sejour->loadRefsPrescriptions(); foreach ($_sejour->_ref_prescriptions as $key => $_prescription) { if (!$_prescription->_id) { unset($_sejour->_ref_prescriptions[$key]); continue; } $_sejour->_ref_prescriptions[$_prescription->_id] = $_prescription; unset($_sejour->_ref_prescriptions[$key]); } if (count($_sejour->_ref_prescriptions)) { $prescription = new CPrescription(); $prescription->massCountMedsElements($_sejour->_ref_prescriptions); foreach ($_sejour->_ref_prescriptions as $_prescription) { $count += array_sum($_prescription->_counts_by_chapitre); } } } $tabs_count[$_tab] = $count; break; case "facteursRisque": if (!$consultAnesth) { break; } if ($dossier_medical->_id) { $fields = array("risque_antibioprophylaxie", "risque_MCJ_chirurgie", "risque_MCJ_patient", "risque_prophylaxie", "risque_thrombo_chirurgie", "risque_thrombo_patient"); foreach ($fields as $_field) { if ($dossier_medical->{$_field} != "NR") { $count++; } } if ($dossier_medical->facteurs_risque) { $count++; } } $tabs_count[$_tab] = $count; break; case "Examens": if ($consultAnesth->_id) { break; } $fields = array("motif", "rques", "examen", "histoire_maladie", "conclusion"); foreach ($fields as $_field) { if ($consult->{$_field}) { $count++; } } $count += $consult->countBackRefs("examaudio"); $count += $consult->countBackRefs("examnyha"); $count += $consult->countBackRefs("exampossum"); $tabs_count[$_tab] = $count; break; case "Exams": if (!$consultAnesth->_id) { break; } $fields = array("examenCardio", "examenPulmo", "examenDigest", "examenAutre"); foreach ($fields as $_field) { if ($consultAnesth->{$_field}) { $count++; } } if ($consult->examen != "") { $count++; } $count += $consult->countBackRefs("examaudio"); $count += $consult->countBackRefs("examnyha"); $count += $consult->countBackRefs("exampossum"); $tabs_count[$_tab] = $count; break; case "ExamsComp": if (!$consultAnesth->_id) { break; } $count += $consult->countBackRefs("examcomp"); if ($consultAnesth->result_ecg) { $count++; } if ($consultAnesth->result_rp) { $count++; } $tabs_count[$_tab] = $count; break; case "Intub": if (!$consultAnesth->_id) { break; } $fields = array("mallampati", "bouche", "distThyro", "mob_cervicale", "etatBucco", "conclusion", "plus_de_55_ans", "edentation", "barbe", "imc_sup_26", "ronflements", "piercing"); foreach ($fields as $_field) { if ($consultAnesth->{$_field}) { $count++; } } $count += count(array_filter($list_etat_dents)); $tabs_count[$_tab] = $count; break; case "InfoAnesth": if (!$consultAnesth->_id) { break; } $op = $consultAnesth->loadRefOperation(); $fields_anesth = array("prepa_preop", "premedication", "apfel_femme", "apfel_non_fumeur", "apfel_atcd_nvp", "apfel_morphine"); $fields_op = array("passage_uscpo", "type_anesth", "ASA", "position"); foreach ($fields_anesth as $_field) { if ($consultAnesth->{$_field}) { $count++; } } if ($op->_id) { foreach ($fields_op as $_field) { if ($op->{$_field}) { $count++; } } } if ($consult->rques) { $count++; } $count += $consultAnesth->countBackRefs("techniques"); $tabs_count[$_tab] = $count; break; case "dossier_traitement": break; case "dossier_suivi": break; case "Actes": $consult->countActes(); $tabs_count[$_tab] = $consult->_count_actes; if ($sejour->_id) { if ($sejour->DP) { $tabs_count[$_tab]++; } if ($_sejour->DR) { $tabs_count[$_tab]++; } $sejour->loadDiagnosticsAssocies(); $tabs_count[$_tab] += count($sejour->_diagnostics_associes); } break; case "fdrConsult": $consult->_docitems_from_dossier_anesth = false; $consult->countDocs(); $consult->countFiles(); $consult->loadRefsPrescriptions(); $tabs_count[$_tab] = $consult->_nb_docs + $consult->_nb_files; if (isset($consult->_ref_prescriptions["externe"])) { $tabs_count[$_tab]++; } if ($sejour->_id) { $sejour->countDocs(); $sejour->countFiles(); $tabs_count[$_tab] += $sejour->_nb_docs + $sejour->_nb_files; } break; case "reglement": $consult->loadRefFacture()->loadRefsReglements(); $tabs_count[$_tab] = count($consult->_ref_facture->_ref_reglements); } } if (CModule::getActive("dPprescription")) { CPrescription::$_load_lite = false; } return $tabs_count; }
// Chargement de l'affectation $affectation = $sejour->loadRefFirstAffectation(); // Chargement des interventions $whereOperations = array("annulee" => "= '0'"); $operations = $sejour->loadRefsOperations($whereOperations); // Chargement optimisée des prestations CSejour::massCountPrestationSouhaitees(array($sejour)); foreach ($operations as $operation) { $operation->loadRefsActes(); $dossier_anesth = $operation->loadRefsConsultAnesth(); $consultation = $dossier_anesth->loadRefConsultation(); $consultation->loadRefPlageConsult(); $dossier_anesth->_date_consult = $consultation->_date; } if (CAppUI::conf("dPadmissions show_deficience")) { CDossierMedical::massCountAntecedentsByType(array($dossier_medical), "deficience"); } $list_mode_entree = array(); if (CAppUI::conf("dPplanningOp CSejour use_custom_mode_entree")) { $mode_entree = new CModeEntreeSejour(); $where = array("actif" => "= '1'"); $list_mode_entree = $mode_entree->loadGroupList($where); } $smarty = new CSmartyDP(); $smarty->assign("_sejour", $sejour); $smarty->assign("date_min", $date_min); $smarty->assign("date_max", $date_max); $smarty->assign("date_actuelle", $date_actuelle); $smarty->assign("date_demain", $date_demain); $smarty->assign("list_mode_entree", $list_mode_entree); $smarty->assign("prestations", CPrestation::loadCurrentList());
/** * Chargement des affectations dans les couloirs */ function loadAffectationsCouloirs($where, $order = null, $praticien_id = null, $prestation_id = null) { $group_id = CGroups::loadCurrent()->_id; $systeme_presta = CAppUI::conf("dPhospi prestations systeme_prestations", "CGroups-{$group_id}"); $ljoin = array("sejour" => "affectation.sejour_id = sejour.sejour_id", "patients" => "sejour.patient_id = patients.patient_id", "users_mediboard" => "sejour.praticien_id = users_mediboard.user_id", "users" => "users.user_id = users_mediboard.user_id"); if ($praticien_id) { $where["sejour.praticien_id"] = " = '{$praticien_id}'"; } if ($order == null) { $order = "users_mediboard.function_id, sejour.entree_prevue, patients.nom, patients.prenom"; } $where["affectation.lit_id"] = " IS NULL"; $affectation = new CAffectation(); /* @var CAffectation[] $affectations*/ $affectations = $affectation->loadList($where, $order, null, null, $ljoin); $sejours = CMbObject::massLoadFwdRef($affectations, "sejour_id"); CMbObject::massLoadFwdRef($sejours, "praticien_id"); CMbObject::massLoadFwdRef($sejours, "patient_id"); $tab_affectations = array(); foreach ($affectations as $affectation) { $affectation->loadRefsAffectations(); $affectation->loadRefSejour()->loadRefPatient(); $affectation->_ref_prev->loadRefLit(); $affectation->_ref_next->loadRefLit(); $sejour =& $affectation->_ref_sejour; $sejour->loadRefPrestation(); $sejour->loadRefsOperations(); $sejour->loadNDA(); $sejour->loadRefPraticien(); $sejour->loadRefPatient(); $sejour->_ref_patient->loadRefDossierMedical(false); if ($systeme_presta == "expert" && $prestation_id) { $sejour->loadLiaisonsForPrestation($prestation_id); } // Chargement des droits CMU $sejour->getDroitsCMU(); foreach ($sejour->_ref_operations as $operation_id => $curr_operation) { $sejour->_ref_operations[$operation_id]->loadExtCodesCCAM(); } $tab_affectations[$affectation->service_id][] = $affectation; } $dossiers = CMbArray::pluck($affectations, "_ref_sejour", "_ref_patient", "_ref_dossier_medical"); CDossierMedical::massCountAntecedentsByType($dossiers, "deficience"); return $tab_affectations; }
<?php /** * $Id$ * * @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $do = new CDoObjectAddEdit("CDossierMedical"); if ($_POST["del"] == 0) { // calcul de la valeur de l'id du dossier medical du patient $_POST["dossier_medical_id"] = CDossierMedical::dossierMedicalId($_POST["object_id"], $_POST["object_class"]); } $do->doIt();
* * @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision:$ */ CCanDo::checkRead(); $dossier_medical_id = CValue::get("dossier_medical_id"); $object_guid = CValue::get("object_guid"); $type = CValue::get("type"); $exclude = CValue::get("exclude"); if ($object_guid) { $dossier_medical = CMbObject::loadFromGuid($object_guid); } else { $dossier_medical = new CDossierMedical(); $dossier_medical->load($dossier_medical_id); } if ($type) { $dossier_medical->loadRefsAntecedentsOfType($type); } else { $dossier_medical->loadRefsAntecedents(); } $tab_atc = array(); $ant_communs = array(); $patient = null; if ($dossier_medical->object_class == "CSejour") { $dossier_medical->loadRefObject(); /* @var CSejour $sejour*/ $sejour = $dossier_medical->_ref_object; $doss_patient = $sejour->loadRefPatient()->loadRefDossierMedical();
$patient->loadRefPhotoIdentite(); $patient->loadRefDossierMedical(false); if (CAppUI::conf("pharmacie Display show_risq_population", CGroups::loadCurrent()) && $lite_view && $patient->sexe == "f") { $patient->loadLastGrossesse(); } $dossier_medical = $patient->_ref_dossier_medical; if ($dossier_medical->_id) { $dossiers[$dossier_medical->_id] = $dossier_medical; } } // Récupération des identifiants des dossiers médicaux $dossiers_id = CMbArray::pluck($sejours, "_ref_patient", "_ref_dossier_medical", "_id"); // Suppressions des dossiers médicaux inexistants CMbArray::removeValue("", $dossiers); $_counts_allergie = CDossierMedical::massCountAllergies($dossiers_id); $_counts_antecedent = CDossierMedical::massCountAntecedents($dossiers_id); /* @var CDossierMedical[] $dossiers*/ foreach ($dossiers as $_dossier) { if ($print) { $_dossier->loadRefsAllergies(); $_dossier->loadRefsAntecedents(); } $_dossier->_count_allergies = array_key_exists($_dossier->_id, $_counts_allergie) ? $_counts_allergie[$_dossier->_id] : 0; $_dossier->_count_antecedents = array_key_exists($_dossier->_id, $_counts_antecedent) ? $_counts_antecedent[$_dossier->_id] : 0; } if ($service_id == "NP") { $sorter = CMbArray::pluck($sejours, "_ref_patient", "nom"); array_multisort($sorter, SORT_ASC, $sejours); } $function = new CFunctions(); $function->load($function_id);
/** * Vérifie et extrait les codes CIM des remarques pour les sauvegarder dans le dossier médical * * @return void */ function checkCodeCim10() { preg_match_all('/\\b[A-Z]\\d{2}\\.?\\d{0,2}\\b/i', $this->rques, $matches); foreach ($matches as $match_) { foreach ($match_ as &$match) { // Transformation du code CIM pour le tester $match = str_replace(".", "", $match); $match = strtoupper($match); // Chargement du code CIM 10 $code_cim10 = CCodeCIM10::get($match); if ($code_cim10->libelle != "Code CIM inexistant") { // Cas du code valide, sauvegarde du code CIM $dossier_medical = new CDossierMedical(); $dossier_medical->load($this->dossier_medical_id); // si le code n'est pas deja present, on le rajoute if (!array_key_exists($match, $dossier_medical->_ext_codes_cim)) { if ($dossier_medical->codes_cim != "") { $dossier_medical->codes_cim .= "|"; } $dossier_medical->codes_cim .= $match; $dossier_medical->store(); } } } } }
<?php /** * $Id: do_etat_dent_aed.php 19219 2013-05-21 12:26:07Z phenxdesign $ * * @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 19219 $ */ $_POST['dossier_medical_id'] = CDossierMedical::dossierMedicalId($_POST['_patient_id'], 'CPatient'); $do = new CDoObjectAddEdit('CEtatDent'); $do->doIt();
/** * Identifiant de dossier médical lié à l'objet fourni. * Crée le dossier médical si nécessaire * * @param integer $object_id Identifiant de l'objet * @param string $object_class Classe de l'objet * * @return integer Id du dossier médical */ static function dossierMedicalId($object_id, $object_class) { $dossier = new CDossierMedical(); $dossier->object_id = $object_id; $dossier->object_class = $object_class; $dossier->loadMatchingObject(); if (!$dossier->_id) { $dossier->store(); } return $dossier->_id; }
$users = $user->loadList($where); $praticiens = CStoredObject::massLoadFwdRef($_sejours, "praticien_id"); CStoredObject::massLoadFwdRef($praticiens, "function_id"); CStoredObject::massCountBackRefs($affectations, "affectations_enfant"); $_operations = CStoredObject::massLoadBackRefs($sejours, "operations", "date ASC"); CStoredObject::massLoadFwdRef($_operations, "plageop_id"); loadVueTempo($sejours, $suivi_affectation, null, $operations, $date_min, $date_max, $period, $prestation_id, $functions_filter, $filter_function, $sejours_non_affectes); if (CAppUI::conf("dPadmissions show_deficience")) { CStoredObject::massLoadBackRefs($patients, "dossier_medical"); $dossiers = CMbArray::pluck($sejours, "_ref_patient", "_ref_dossier_medical"); CDossierMedical::massCountAntecedentsByType($dossiers, "deficience"); } loadVueTempo($affectations, $suivi_affectation, null, $operations, $date_min, $date_max, $period, $prestation_id, $functions_filter, $filter_function, $sejours_non_affectes); if (count($affectations) && CAppUI::conf("dPadmissions show_deficience")) { $dossiers = CMbArray::pluck($affectations, "_ref_sejour", "_ref_patient", "_ref_dossier_medical"); CDossierMedical::massCountAntecedentsByType($dossiers, "deficience"); } ksort($sejours_non_affectes, SORT_STRING); $_sejour = new CSejour(); $_sejour->_type_admission = $_type_admission; $smarty = new CSmartyDP(); $smarty->assign("sejours_non_affectes", $sejours_non_affectes); $smarty->assign("_sejour", $_sejour); $smarty->assign("triAdm", $triAdm); $smarty->assign("functions_filter", $functions_filter); $smarty->assign("filter_function", $filter_function); $smarty->assign("granularite", $granularite); $smarty->assign("date", $date); $smarty->assign("date_min", $date_min); $smarty->assign("date_max", $date_max); $smarty->assign("nb_ticks", $nb_ticks);
/** * @see parent::importObject() */ function importObject(DOMElement $element) { $id = $element->getAttribute("id"); if (isset($this->imported[$id])) { return; } $this->name_suffix = " (import du " . CMbDT::dateTime() . ")"; $_class = $element->getAttribute("class"); $imported_object = null; $idex = self::lookupObject($id); if ($idex->_id) { $this->imported[$id] = true; $this->map[$id] = $idex->loadTargetObject()->_guid; return; } switch ($_class) { // COperation = Intervention: Données incorrectes, Le code CCAM 'QZEA024 + R + J' n'est pas valide case "CPatient": /** @var CPatient $_patient */ $_patient = $this->getObjectFromElement($element); if ($_patient->naissance == "0000-00-00") { $_patient->naissance = "1850-01-01"; } $_patient->loadMatchingPatient(); $is_new = !$_patient->_id; $_patient->_merging = true; // TODO a supprimer if ($msg = $_patient->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); break; } if ($is_new) { CAppUI::stepAjax("Patient '%s' créé", UI_MSG_OK, $_patient->_view); } else { CAppUI::stepAjax("Patient '%s' retrouvé", UI_MSG_OK, $_patient->_view); } $imported_object = $_patient; break; case "CDossierMedical": /** @var CDossierMedical $_object */ $_object = $this->getObjectFromElement($element); $_dossier = new CDossierMedical(); $_dossier->object_id = $_object->object_id; $_dossier->object_class = $_object->object_class; $_dossier->loadMatchingObject(); if (!$_dossier->_id) { if ($msg = $_object->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); break; } CAppUI::stepAjax(CAppUI::tr($_object->_class) . " '%s' créé", UI_MSG_OK, $_object); $imported_object = $_object; } else { $imported_object = $_dossier; } break; case "CAntecedent": /** @var CAntecedent $_new_atcd */ $_new_atcd = $this->getObjectFromElement($element); // On cherche un ATCD similaire $_empty_atcd = new CAntecedent(); $_empty_atcd->dossier_medical_id = $_new_atcd->dossier_medical_id; $_empty_atcd->type = $_new_atcd->type ?: null; $_empty_atcd->appareil = $_new_atcd->appareil ?: null; $_empty_atcd->annule = $_new_atcd->annule ?: null; $_empty_atcd->date = $_new_atcd->date ?: null; $_empty_atcd->rques = $_new_atcd->rques ?: null; $_empty_atcd->loadMatchingObject(); if (!$_empty_atcd->_id) { $_new_atcd->_forwardRefMerging = true; // To accept any ATCD type if ($msg = $_new_atcd->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); break; } CAppUI::stepAjax("Antécédent '%s' créé", UI_MSG_OK, $_new_atcd->_view); } $imported_object = $_new_atcd; break; case "CPlageOp": case "CPlageconsult": /** @var CPlageOp|CPlageconsult $_plage */ $_plage = $this->getObjectFromElement($element); $_plage->hasCollisions(); if (count($_plage->_colliding_plages)) { $_plage = reset($_plage->_colliding_plages); CAppUI::stepAjax("%s '%s' retrouvée", UI_MSG_OK, CAppUI::tr($_plage->_class), $_plage->_view); } else { if ($msg = $_plage->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); break; } CAppUI::stepAjax("%s '%s' créée", UI_MSG_OK, CAppUI::tr($_plage->_class), $_plage->_view); } $imported_object = $_plage; break; case "CFile": /** @var CFile $_file */ $_file = $this->getObjectFromElement($element); $_filedir = $this->getCFileDirectory($element); if (!$_file->moveFile($_filedir)) { CAppUI::stepAjax("Fichier '%s' non trouvé dans '%s'", UI_MSG_WARNING, $_file->_view, $_filedir); } else { if ($msg = $_file->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); break; } CAppUI::stepAjax("Fichier '%s' créé", UI_MSG_OK, $_file->_view); } $imported_object = $_file; break; case "CConsultation": /** @var CConsultation $_object */ $_object = $this->getObjectFromElement($element); $_new_consult = new CConsultation(); $_new_consult->patient_id = $_object->patient_id; $_new_consult->plageconsult_id = $_object->plageconsult_id; $_new_consult->loadMatchingObject(); if ($_new_consult->_id) { $_object = $_new_consult; CAppUI::stepAjax(CAppUI::tr($_object->_class) . " '%s' retrouvé", UI_MSG_OK, $_object); } else { if ($msg = $_object->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); break; } CAppUI::stepAjax(CAppUI::tr($_object->_class) . " '%s' créé", UI_MSG_OK, $_object); } $imported_object = $_object; break; case "CSejour": /** @var CSejour $_object */ $_object = $this->getObjectFromElement($element); $_collisions = $_object->getCollisions(); if (count($_collisions)) { $_object = reset($_collisions); CAppUI::stepAjax(CAppUI::tr($_object->_class) . " '%s' retrouvé", UI_MSG_OK, $_object); } else { if ($msg = $_object->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); break; } CAppUI::stepAjax(CAppUI::tr($_object->_class) . " '%s' créé", UI_MSG_OK, $_object); } $imported_object = $_object; break; case "COperation": /** @var COperation $_interv */ $_interv = $this->getObjectFromElement($element); $_ds = $_interv->getDS(); $where = array("sejour_id" => $_ds->prepare("= ?", $_interv->sejour_id), "chir_id" => $_ds->prepare("= ?", $_interv->chir_id), "date" => $_ds->prepare("= ?", $_interv->date), "cote" => $_ds->prepare("= ?", $_interv->cote), "id_sante400.id_sante400_id" => "IS NULL"); $ljoin = array("id_sante400" => "id_sante400.object_id = operations.operation_id AND\n id_sante400.object_class = 'COperation' AND\n id_sante400.tag = 'migration'"); $_matching = $_interv->loadList($where, null, null, null, $ljoin); if (count($_matching)) { $_interv = reset($_matching); CAppUI::stepAjax("%s '%s' retrouvée", UI_MSG_OK, CAppUI::tr($_interv->_class), $_interv->_view); } else { if ($msg = $_interv->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); break; } CAppUI::stepAjax("%s '%s' créée", UI_MSG_OK, CAppUI::tr($_interv->_class), $_interv->_view); } $imported_object = $_interv; break; case "CContentHTML": /** @var CContentHTML $_object */ $_object = $this->getObjectFromElement($element); $_object->content = stripslashes($_object->content); if ($msg = $_object->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); break; } CAppUI::stepAjax(CAppUI::tr($_object->_class) . " '%s' créé", UI_MSG_OK, $_object); $imported_object = $_object; break; default: // Ignored classes if (in_array($_class, self::$_ignored_classes)) { break; } $_object = $this->getObjectFromElement($element); if ($msg = $_object->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); break; } CAppUI::stepAjax(CAppUI::tr($_object->_class) . " '%s' créé", UI_MSG_OK, $_object); $imported_object = $_object; break; } // Store idex on new object if ($imported_object && $imported_object->_id) { $idex->setObject($imported_object); $idex->id400 = $id; if ($msg = $idex->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); } } else { if (!in_array($_class, self::$_ignored_classes)) { CAppUI::stepAjax("{$id} sans objet", UI_MSG_WARNING); } } if ($imported_object) { $this->map[$id] = $imported_object->_guid; } $this->imported[$id] = true; }
function fillTemplate(&$template) { $this->fillLimitedTemplate($template); // Dossier médical $this->loadRefDossierMedical(); $this->_ref_dossier_medical->fillTemplate($template); }
$request = "SELECT DISTINCT(d.object_id), d.object_class\r\n FROM `dossier_medical` d\r\n WHERE d.`object_id` <> '0'\r\n AND EXISTS (\r\n SELECT * FROM `dossier_medical` e\r\n WHERE e.`object_class` = d.`object_class`\r\n AND e.`object_id` = d.`object_id`\r\n AND e.`dossier_medical_id` <> d.`dossier_medical_id`\r\n );"; $resultats = $ds->loadList($request); CAppUI::stepAjax("Dossiers à corriger: " . count($resultats), UI_MSG_OK); if ($mode == "repair") { $correction = 0; foreach ($resultats as $result) { //Dossier de références $where = array(); $where["object_class"] = "= '" . $result['object_class'] . "'"; $where["object_id"] = "= '" . $result['object_id'] . "'"; $dossier_ok = new CDossierMedical(); $dossier_ok->loadObject($where, "dossier_medical_id ASC"); $dossier_ok->loadRefsAntecedents(); $dossier_ok->loadRefsEtatsDents(); $dossier_ok->loadRefsTraitements(); //Chargement des autres dossiers $_dossier = new CDossierMedical(); $where["dossier_medical_id"] = "!= '" . $dossier_ok->_id . "'"; $dossiers = $_dossier->loadList($where); //Merge des dossiers foreach ($dossiers as $dossier) { /* @var CDossierMedical $dossier*/ if ($msg = $dossier_ok->merge(array($dossier))) { mbTrace($msg); } else { $correction++; } } } CAppUI::stepAjax("Dossiers corrigés: {$correction}", UI_MSG_OK); }