// @todo à transférer dans dPpatient // En l'état on ne peut pas vérifier les droits sur dPcabinet // CCanDo::checkRead(); $patient_id = CValue::get("patient_id"); $consult_id = CValue::get("consult_id"); // On charge le praticien $user = CMediusers::get(); $user->loadRefs(); $canUser = $user->canDo(); $consult = new CConsultation(); if ($consult_id) { $consult->load($consult_id); $consult->loadRefsFwd(); } // Chargement des aides à la saisie $antecedent = new CAntecedent(); $antecedent->loadAides($user->_id); $aides_antecedent = $antecedent->_aides_all_depends["rques"] ? $antecedent->_aides_all_depends["rques"] : array(); // On charge le patient pour connaitre ses antécedents et traitements actuels $patient = new CPatient(); $patient->load($patient_id); $patient->loadRefDossierMedical(); $dossier_medical = $patient->_ref_dossier_medical; $dossier_medical->loadRefsAntecedents(); $dossier_medical->loadRefsTraitements(); $applied_antecedents = array(); foreach ($dossier_medical->_ref_antecedents_by_type as $list) { foreach ($list as $a) { if (!isset($applied_antecedents[$a->type])) { $applied_antecedents[$a->type] = array(); }
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkEdit(); $patient_id = CValue::get("patient_id"); $type = CValue::get("type"); $antecedent_id = CValue::get("antecedent_id"); $callback = CValue::get('callback', 0); $patient = new CPatient(); $patient->load($patient_id); $antecedents = array(); if ($type) { $dossier_medical = $patient->loadRefDossierMedical(); /** @var CAntecedent[] $antecedents */ $antecedents = $dossier_medical->loadRefsAntecedentsOfType($type); foreach ($antecedents as $_antecedent) { $_antecedent->updateOwnerAndDates(); } } $antecedent = new CAntecedent(); $antecedent->load($antecedent_id); $smarty = new CSmartyDP(); $smarty->assign("patient", $patient); $smarty->assign("antecedents", $antecedents); $smarty->assign("is_anesth", CAppUI::$user->isAnesth()); $smarty->assign("antecedent", $antecedent); $smarty->assign("type", $type); if ($callback) { $smarty->assign('callback', $callback); } $smarty->display("inc_edit_antecedents.tpl");
$request_b->addLJoin($ljoin); $request_b->addRJoin($rjoinMix); $request_b->addWhere($where); $request_b->addWhere($whereMix); if (!$export) { $request_b->setLimit("{$start},30"); } $results = array_merge($results, $ds->loadList($request_b->makeSelect())); } foreach ($results as $_result) { $_patient_id = $_result["patient_id"]; $pat = new CPatient(); $pat->load($_patient_id); // Recherche sur un antécédent if (isset($_result["antecedent_id"])) { $_atcd = new CAntecedent(); $_atcd->load($_result["antecedent_id"]); $pat->_ref_antecedent = $_atcd; } else { // On affiche tous les antécédents du patient $dossier_medical = $pat->loadRefDossierMedical(false); $pat->_refs_antecedents = $dossier_medical->loadRefsAntecedents(); $pat->_refs_allergies = $dossier_medical->loadRefsAllergies(); $pat->_ext_codes_cim = $dossier_medical->_ext_codes_cim; } if (isset($_result["prescription_line_medicament_id"])) { $line = new CPrescriptionLineMedicament(); $line->load($_result["prescription_line_medicament_id"]); $pat->_distant_line = $line; } else { if (isset($_result["prescription_line_mix_item_id"])) {
$examen_intervention = CValue::getOrSession("examen_intervention"); $remarque_intervention = CValue::getOrSession("remarque_intervention"); $libelle_intervention = CValue::getOrSession("libelle_intervention"); $ccam_intervention = CValue::getOrSession("ccam_intervention"); $recherche_consult = CValue::getOrSession("recherche_consult", "or"); $recherche_sejour = CValue::getOrSession("recherche_sejour", "or"); $recherche_intervention = CValue::getOrSession("recherche_intervention", "or"); $page_sejour = CValue::get('page_sejour', 0); $page_interv = CValue::get('page_interv', 0); $page_consult = CValue::get('page_consult', 0); $page_antecedent = CValue::get('page_antecedent', 0); $page_traitement = CValue::get('page_traitement', 0); $page_consult = CValue::get('page_consult', 0); $page_dossierMedical = CValue::get('page_dossierMedical', 0); // Recherche sur les antecedents $ant = new CAntecedent(); /** @var CAntecedent[] $antecedents */ $antecedents = array(); $patients_ant = array(); $where_ant = array(); $ljoin["dossier_medical"] = "dossier_medical.object_id = antecedent.antecedent_id"; if ($antecedent_patient) { $where_ant["rques"] = "LIKE '%{$antecedent_patient}%'"; $where_ant["object_class"] = " = 'CPatient'"; } $order_ant = "antecedent_id, rques"; $total_antecedents = null; if ($where_ant) { $total_antecedents = $ant->countList($where_ant, null, $ljoin); $antecedents = $ant->loadList($where_ant, $order_ant, "{$page_antecedent}, 30", null, $ljoin); }
/** * @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; }
/** * Chargement des antécédents par type * * @param string $type Type des antécédents * * @return array|CStoredObject[] */ function loadRefsAntecedentsOfType($type) { if (!$this->_id) { return $this->_ref_antecedents_by_type[$type] = array(); } $antecedent = new CAntecedent(); $antecedent->type = $type; $antecedent->annule = "0"; $antecedent->dossier_medical_id = $this->_id; return $this->_ref_antecedents_by_type[$type] = $antecedent->loadMatchingList(); }
<?php /** * $Id: do_duplicate_antecedent_aed.php 27291 2015-02-24 13:10:50Z aurelie17 $ * * @category Patients * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 27291 $ * @link http://www.mediboard.org */ CCanDo::checkRead(); $antecedent_id = CValue::post("antecedent_id"); $callback = CValue::post("reload"); $antecedent = new CAntecedent(); $antecedent->load($antecedent_id); $antecedent->annule = 1; if ($msg = $antecedent->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); } $atcd_new = $antecedent; $atcd_new->_id = null; $atcd_new->annule = 0; if ($msg = $atcd_new->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); } $dossier_medical = $atcd_new->loadRefDossierMedical(); CAppUI::callbackAjax("Antecedent.editAntecedents", $dossier_medical->object_id, '', $callback, $atcd_new->_id); echo CAppUI::getMsg(); CApp::rip();