Esempio n. 1
0
 // Each line
 while ($line = fgetcsv($fp, null, ";")) {
     if (!isset($line[0]) || $line[0] == "") {
         continue;
     }
     // Parsing
     $results[$i]["service"] = addslashes(trim($line[0]));
     $results[$i]["chambre"] = addslashes(trim($line[1]));
     $results[$i]["nom"] = addslashes(trim($line[2]));
     $results[$i]["nomcomplet"] = @addslashes(trim($line[3]));
     $results[$i]["error"] = 0;
     // Service
     $service = new CService();
     $service->nom = $results[$i]["service"];
     $service->group_id = CGroups::loadCurrent()->_id;
     $service->loadMatchingObject();
     if (!$service->_id) {
         $service->urgence = 0;
         $service->uhcd = 0;
         $service->hospit_jour = 0;
         $service->externe = 0;
         $service->cancelled = 0;
         $msg = $service->store();
         if ($msg) {
             CAppUI::setMsg($msg, UI_MSG_ERROR);
             $results[$i]["error"] = $msg;
             $i++;
             continue;
         }
         CAppUI::setMsg("Service créé", UI_MSG_OK);
     }
Esempio n. 2
0
 /**
  * Charge le service de radiologie de l'établissement
  *
  * @param string $group_id Group
  *
  * @return CService
  */
 static function loadServiceRadiologie($group_id = null)
 {
     $service = new CService();
     $service->group_id = $group_id ? $group_id : CGroups::loadCurrent()->_id;
     $service->radiologie = "1";
     $service->cancelled = "0";
     $service->loadMatchingObject();
     return $service;
 }
Esempio n. 3
0
 /**
  * Test A21 - Gone on a leave of absence
  *
  * @param CCnStep $step Step
  *
  * @throws CMbException
  *
  * @return void
  */
 static function testA21(CCnStep $step)
 {
     // PES-PAM_Encounter_Management_ADVANCE
     $step_number = null;
     $add_day = 0;
     if ($step->number == 60) {
         $add_day = 1;
         $step_number = 30;
     }
     if ($step->number == 70) {
         $add_day = 2;
         $step_number = 20;
     }
     if (!$step_number) {
         throw new CMbException("Aucune étape trouvée");
     }
     $patient = self::loadPatientPES($step, $step_number);
     $sejour = self::loadAdmitPES($patient);
     $service_externe = new CService();
     $service_externe->group_id = $step->_ref_test->group_id;
     $service_externe->externe = 1;
     $service_externe->loadMatchingObject();
     if (!$service_externe->_id) {
         throw new CMbException("Aucun service externe de configuré");
     }
     $affectation = new CAffectation();
     $affectation->service_id = $service_externe->_id;
     $affectation->sejour_id = $sejour->_id;
     $affectation->entree = $sejour->entree;
     $affectation->sortie = CMbDT::dateTime("+{$add_day} day", $affectation->entree);
     self::storeObject($affectation);
 }