Exemple #1
0
 /**
  * Création des consults anesth liées à des consults d'anesthésistes
  *
  * @return bool
  */
 protected function consultAnesth()
 {
     $ds = $this->ds;
     $utypes_flip = array_flip(CUser::$types);
     $id_anesth = $utypes_flip["Anesthésiste"];
     $query = "SELECT users.user_id\r\n                  FROM users, users_mediboard\r\n                  WHERE users.user_id = users_mediboard.user_id\r\n                  AND users.user_type='{$id_anesth}'";
     $result = $ds->loadList($query);
     $listAnesthid = array();
     foreach ($result as $keyresult => $resultAnesth) {
         $listAnesthid[$keyresult] = $result[$keyresult]["user_id"];
     }
     $in_anesth = CSQLDataSource::prepareIn($listAnesthid);
     $query = "SELECT consultation.consultation_id FROM consultation\r\n                  LEFT JOIN consultation_anesth ON consultation.consultation_id = consultation_anesth.consultation_id\r\n                  LEFT JOIN plageconsult ON consultation.plageconsult_id = plageconsult.plageconsult_id\r\n                  WHERE plageconsult.chir_id {$in_anesth} AND consultation_anesth.consultation_anesth_id IS NULL";
     $result = $ds->loadList($query);
     foreach ($result as $keyresult => $resultAnesth) {
         $consultAnesth = new CConsultAnesth();
         $consultAnesth->consultation_anesth_id = 0;
         $consultAnesth->consultation_id = $result[$keyresult]["consultation_id"];
         $consultAnesth->store();
     }
     return true;
 }
    CModule::getCanDo('dPcabinet')->redirect();
}
$date = CValue::getOrSession("date", CMbDT::date());
$print = CValue::getOrSession("print", false);
$today = CMbDT::date();
$dossier_anesth_id = CValue::get("dossier_anesth_id");
$operation_id = CValue::getOrSession("operation_id");
$create_dossier_anesth = CValue::get("create_dossier_anesth", 1);
$multi = CValue::get("multi");
$offline = CValue::get("offline");
$display = CValue::get("display");
$pdf = CValue::get("pdf", 1);
$lines = array();
$lines_per_op = array();
// Consultation courante
$dossier_anesth = new CConsultAnesth();
if (!$dossier_anesth_id) {
    $where = array();
    $where["operation_id"] = " = '{$operation_id}'";
    $dossier_anesth->loadObject($where);
} else {
    $dossier_anesth->load($dossier_anesth_id);
}
if (!$dossier_anesth->_id) {
    $selOp = new COperation();
    $selOp->load($operation_id);
    $selOp->loadRefsFwd();
    $selOp->_ref_sejour->loadRefsFwd();
    $selOp->_ref_sejour->loadRefsConsultAnesth();
    $selOp->_ref_sejour->_ref_consult_anesth->loadRefsFwd();
    $patient = $selOp->_ref_sejour->_ref_patient;
/**
 * Duplication de dossier d'anesthésie
 *  
 * @category Cabinet
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @version  SVN: $Id:\$ 
 * @link     http://www.mediboard.org
 */
$dossier_anesth_id = CValue::post("_consult_anesth_id");
$sejour_id = CValue::post("sejour_id");
$operation_id = CValue::post("operation_id");
$redirect = CValue::post("redirect", 1);
$consult_anesth = new CConsultAnesth();
$consult_anesth->load($dossier_anesth_id);
$consult_anesth->_id = $consult_anesth->operation_id = $consult_anesth->sejour_id = null;
if ($sejour_id) {
    $consult_anesth->sejour_id = $sejour_id;
}
if ($operation_id) {
    $consult_anesth->operation_id = $operation_id;
}
$msg = $consult_anesth->store();
$represcription = 0;
if ($msg) {
    CAppUI::setMsg($msg);
} else {
    CAppUI::setMsg(CAppUI::tr("CConsultAnesth-msg-duplicate"));
    //Création de la prescription de séjour selon pref user
<?php

/**
 * $Id: $
 *
 * @package    Mediboard
 * @subpackage Cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: $
 */
$consult_id = CValue::get("consult_id");
$patient_id = CValue::get("patient_id");
$consult_anesth = new CConsultAnesth();
$consult_anesth->load($consult_id);
$patient = new CPatient();
$patient->load($patient_id);
$dossier_medical = $patient->loadRefDossierMedical();
$consult_anesth->apfel_femme = 0;
$consult_anesth->apfel_atcd_nvp = 0;
$consult_anesth->apfel_morphine = 0;
$consult_anesth->apfel_non_fumeur = 1;
// Femme
if ($patient->sexe === "f") {
    $consult_anesth->apfel_femme = 1;
}
// Non fumeur
if (count($dossier_medical->_codes_cim)) {
    $is_fumeur = 0;
    foreach ($dossier_medical->_codes_cim as $_code_cim) {
        if (preg_match("/^(F17|T652|Z720|Z864|Z587)/", $_code_cim)) {
/**
 * $Id$
 *  
 * @package    Mediboard
 * @subpackage cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 * @link       http://www.mediboard.org
 */
$operation_id = CValue::get('operation_id');
$consult_anesth_id = CValue::get('consult_anesth_id');
$operation = new COperation();
$operation->load($operation_id);
$consult_anesth = new CConsultAnesth();
$consult_anesth->load($consult_anesth_id);
$fields = array('passage_uscpo' => array('object' => 'COperation'), 'duree_uscpo' => array('object' => 'COperation'), 'ASA' => array('object' => 'COperation'), 'position' => array('object' => 'COperation'), 'type_anesth' => array('object' => 'COperation'), 'rques' => array('object' => 'COperation'));
$auto_link = true;
foreach ($fields as $_name => &$_field) {
    if (is_null($consult_anesth->{$_name}) || is_null($operation->{$_name})) {
        $_field['status'] = 'warning';
    } elseif ($consult_anesth->{$_name} == $operation->{$_name}) {
        $_field['status'] = 'ok';
        if ($_name == 'duree_uscpo' && ($consult_anesth->{$_name} == 0 && $operation->{$_name} == 0)) {
            $_field['status'] = 'warning';
        }
    } else {
        $_field['status'] = 'error';
        $auto_link = false;
    }
 /**
  * @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;
 }
/**
 * $Id$
 *  
 * @package    Mediboard
 * @subpackage cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 * @link       http://www.mediboard.org
 */
$operation_id = CValue::post('operation_id');
$consult_anesth_id = CValue::post('consult_anesth_id');
$operation = new COperation();
$operation->load($operation_id);
$consult_anesth = new CConsultAnesth();
$consult_anesth->load($consult_anesth_id);
$fields = array();
$fields['type_anesth'] = CValue::post('type_anesth', 'COperation');
$fields['ASA'] = CValue::post('ASA', 'COperation');
$fields['position'] = CValue::post('position', 'COperation');
$fields['rques'] = CValue::post('rques', 'COperation');
if (CAppUI::conf('dPplanningOp COperation show_duree_uscpo')) {
    $fields['passage_uscpo'] = CValue::post('passage_uscpo', 'COperation');
    $fields['duree_uscpo'] = CValue::post('duree_uscpo', 'COperation');
}
foreach ($fields as $_field => $_object) {
    if ($_object == 'CConsultAnesth') {
        $operation->{$_field} = $consult_anesth->{$_field};
    } else {
        $consult_anesth->{$_field} = $operation->{$_field};
}
$query .= "GROUP BY `consultation_anesth`.`operation_id`\n  HAVING total > 1\n  ORDER BY `consultation_anesth`.`operation_id` DESC";
$dossier = new CConsultAnesth();
$ds = $dossier->_spec->ds;
$result = $ds->loadHashAssoc($query);
$count = count($result);
CAppUI::setMsg("{$count} dossier(s) restants en doublon avant traitement", UI_MSG_OK);
$log = new CUserLog();
foreach ($result as $_doublon) {
    if ($limit < 1) {
        break;
    }
    $_doublon_ids = explode(",", $_doublon["doublons"]);
    foreach ($_doublon_ids as $_doublon_id) {
        $infoAnesth = false;
        $consultAnesth = new CConsultAnesth();
        $consultAnesth->load($_doublon_id);
        $consultAnesth->loadLogs();
        foreach ($consultAnesth->_ref_logs as $_log) {
            if ($_log->type != "create" && $_log->fields != "operation_id" && $_log->fields != "operation_id sejour_id") {
                $infoAnesth = $_log->fields;
            }
        }
        if (count($consultAnesth->_ref_logs) < 3 && !$infoAnesth) {
            if ($msg = $consultAnesth->delete()) {
                CAppUI::setMsg($msg, UI_MSG_WARNING);
            } else {
                CAppUI::setMsg("Dossier supprimés", UI_MSG_OK);
                $limit--;
            }
            break;
<?php

/**
 * $Id$
 *  
 * @category Cabinet
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$dossier_anesth_id = CValue::get("dossier_anesth_id");
$consult_anesth = new CConsultAnesth();
$consult_anesth->load($dossier_anesth_id);
$consult = $consult_anesth->loadRefConsultation();
$smarty = new CSmartyDP();
$smarty->assign("consult", $consult);
$smarty->assign("consult_anesth", $consult_anesth);
$smarty->display("inc_consult_anesth/acc_examens_clinique.tpl");
Exemple #10
0
 /**
  * @see parent::loadComplete()
  */
 function loadComplete()
 {
     parent::loadComplete();
     // Chek if operations were loaded yet (cf ExObjects)
     $operations = $this->_ref_operations;
     if ($operations === null) {
         $operations = $this->loadRefsOperations();
     }
     foreach ($operations as $operation) {
         $operation->loadRefsFwd();
         $operation->loadBrancardage();
         $operation->_ref_chir->loadRefFunction();
         $operation->_ref_chir->loadRefSpecCPAM();
         $operation->_ref_chir->loadRefDiscipline();
     }
     foreach ($this->_ref_affectations as $affectation) {
         $affectation->loadRefLit();
         $affectation->_ref_lit->loadCompleteView();
     }
     if ($this->_ref_actes_ccam) {
         foreach ($this->_ref_actes_ccam as $acte_ccam) {
             $acte_ccam->loadRefsFwd();
         }
     }
     $this->loadExtDiagnostics();
     // Chargement du RPU dans le cas des urgences
     $this->loadRefRPU();
     if ($this->_ref_rpu) {
         $this->_ref_rpu->loadRefSejour();
     }
     $this->loadNDA();
     // Chargement de la consultation anesth pour l'affichage de la fiche d'anesthesie
     $this->loadRefsConsultAnesth();
     $this->_ref_consult_anesth->loadRefConsultation();
     $this->loadSuiviMedical();
     $this->_ref_patient->loadRefPhotoIdentite();
 }
<?php

/**
 * $Id$
 * 
 * @package    Mediboard
 * @subpackage dPcabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$consult_id = CValue::post("consult_id");
$dossier_anesth = new CConsultAnesth();
$dossier_anesth->consultation_id = $consult_id;
if ($msg = $dossier_anesth->store()) {
    CAppUI::setMsg($msg, UI_MSG_ERROR);
} else {
    CAppUI::setMsg(CAppUI::tr("CConsultAnesth-msg-create"), UI_MSG_OK);
}
CAppUI::redirect($_POST["postRedirect"]);