示例#1
0
 /**
  * Vérification du modificateur
  *
  * @param int    $code  code de l'acte
  * @param string $heure heure d'exécution
  *
  * @return array|void
  */
 function checkModificateur($code, $heure)
 {
     $keys = array("A", "E", "P", "S", "U", "7", "J");
     if (!in_array($code, $keys)) {
         return null;
     }
     $patient = $this->loadRefPatient();
     $this->loadRefPraticien();
     $discipline = $this->_ref_praticien->loadRefDiscipline();
     // Il faut une date complête pour la comparaison
     $date_ref = CMbDT::date();
     $date = "{$date_ref} {$heure}";
     switch ($code) {
         case "A":
             return $patient->_annees < 4 || $patient->_annees >= 80;
             break;
         case "E":
             return $patient->_annees < 5;
             break;
         case "P":
             return in_array($discipline->text, array("MEDECINE GENERALE", "PEDIATRIE")) && ($date > "{$date_ref} 20:00:00" && $date <= "{$date_ref} 23:59:59" || $date > "{$date_ref} 06:00:00" && $date < "{$date_ref} 08:00:00");
             break;
         case "S":
             return in_array($discipline->text, array("MEDECINE GENERALE", "PEDIATRIE")) && ($date >= "{$date_ref} 00:00:01" && $date < "{$date_ref} 06:00:00");
             break;
         case "U":
             $date_tomorrow = CMbDT::date("+1 day", $date_ref) . " 08:00:00";
             return !in_array($discipline->text, array("MEDECINE GENERALE", "PEDIATRIE")) && ($date > "{$date_ref} 20:00:00" && $date < $date_tomorrow);
             break;
         case "7":
             return CAppUI::pref('precode_modificateur_7');
             break;
         case "J":
             return CAppUI::pref('precode_modificateur_J') && $this->_class == 'COperation';
     }
     return null;
 }
if ($codeCCAM) {
    $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'";
}
$query .= "\nGROUP BY users.user_id ORDER BY users.user_last_name, users.user_first_name";
$ds = CSQLDataSource::get("std");
$result = $ds->loadList($query);
$total_interventions = 0;
$duree_totale_intervs = 0;
$nb_interv_intervs = 0;
$duree_totale_occupation = 0;
$nb_interv_occupation = 0;
foreach ($result as $praticien) {
    $prat = new CMediusers();
    $prat->load($praticien["user_id"]);
    $prat->loadRefFunction();
    $prat->loadRefDiscipline();
    $tableau[$praticien["user_id"]]["user"] = $prat;
    $total_interventions += $praticien["nbInterv"];
    $tableau[$praticien["user_id"]]["total_interventions"] = $praticien["nbInterv"];
    $tableau[$praticien["user_id"]]["duree_totale_intervs"] = 0;
    $tableau[$praticien["user_id"]]["duree_moyenne_intervs"] = 0;
    $tableau[$praticien["user_id"]]["nb_interv_intervs"] = 0;
    $tableau[$praticien["user_id"]]["duree_totale_occupation"] = 0;
    $tableau[$praticien["user_id"]]["duree_moyenne_occupation"] = 0;
    $tableau[$praticien["user_id"]]["nb_interv_occupation"] = 0;
}
// Durée d'intervention
$query = "SELECT COUNT(*) AS nbInterv,\n    SUM(TIME_TO_SEC(operations.fin_op)-TIME_TO_SEC(operations.debut_op)) AS duree_totale,\n    users.user_id\n  FROM operations\n  LEFT JOIN sejour ON operations.sejour_id = sejour.sejour_id\n  LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\n  LEFT JOIN users ON operations.chir_id = users.user_id\n  WHERE operations.annulee = '0'\n  AND operations.date BETWEEN '{$debut}' AND '{$fin}'\n  {$where_hors_plage}\n  AND operations.debut_op IS NOT NULL\n  AND operations.fin_op IS NOT NULL\n  AND operations.debut_op < operations.fin_op\n  AND sejour.group_id = '" . CGroups::loadCurrent()->_id . "'\n  AND operations.salle_id " . CSQLDataSource::prepareIn(array_keys($salles)) . "\n  AND users.user_id " . CSQLDataSource::prepareIn(array_keys($listPrats));
if ($type_hospi) {
    $query .= "\nAND sejour.type = '{$type_hospi}'";
}