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") {
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);
} 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');