Exemplo n.º 1
0
 /**
  * Loads messages from a publication date perspective
  *
  * @param string $status   Wanted status, null for all
  * @param string $mod_name Module name restriction, null for all
  * @param int    $group_id Group ID
  *
  * @return self[] Published messages
  */
 function loadPublications($status = null, $mod_name = null, $group_id = null)
 {
     $now = CMbDT::dateTime();
     $where = array();
     switch ($status) {
         case "past":
             $where["fin"] = "< '{$now}'";
             break;
         case "present":
             $where["deb"] = "< '{$now}'";
             $where["fin"] = "> '{$now}'";
             break;
         case "future":
             $where["deb"] = "> '{$now}'";
             break;
     }
     if ($group_id) {
         $where[] = "group_id = '{$group_id}' OR group_id IS NULL";
     }
     /** @var self[] $messages */
     $messages = $this->loadList($where, "deb DESC");
     // Module name restriction
     if ($mod_name) {
         foreach ($messages as $message_id => $_message) {
             if ($_message->module_id) {
                 if ($_message->loadRefModuleObject()->mod_name != $mod_name) {
                     unset($messages[$message_id]);
                 }
             }
         }
     }
     return $messages;
 }
Exemplo n.º 2
0
 static function mine($parent_class)
 {
     $classes = CApp::getChildClasses($parent_class);
     $limit = CAppUI::conf("dataminer_limit");
     foreach ($classes as $_class) {
         $miner = new $_class();
         $report = $miner->mineSome($limit, "mine");
         $dt = CMbDT::dateTime();
         echo "<{$dt}> Miner: {$_class}. Success mining count is '" . $report["success"] . "'\n";
         if (!$report["failure"]) {
             echo "<{$dt}> Miner: {$_class}. Failure mining counts is '" . $report["failure"] . "'\n";
         }
         $miner = new $_class();
         $report = $miner->mineSome($limit, "remine");
         $dt = CMbDT::dateTime();
         echo "<{$dt}> Reminer: {$_class}. Success remining count is '" . $report["success"] . "'\n";
         if (!$report["failure"]) {
             echo "<{$dt}> Reminer: {$_class}. Failure remining counts is '" . $report["failure"] . "'\n";
         }
         $miner = new $_class();
         $report = $miner->mineSome($limit, "postmine");
         $dt = CMbDT::dateTime();
         echo "<{$dt}> Postminer: {$_class}. Success postmining count is '" . $report["success"] . "'\n";
         if (!$report["failure"]) {
             echo "<{$dt}> Postminer: {$_class}. Failure postmining counts is '" . $report["failure"] . "'\n";
         }
     }
 }
 /**
  * @see parent::store()
  */
 function store()
 {
     if ($this->fieldModified("content") || !$this->last_modified) {
         $this->last_modified = CMbDT::dateTime();
     }
     return parent::store();
 }
Exemplo n.º 4
0
 /**
  * @see parent::store()
  */
 function store()
 {
     $this->completeField("handled");
     if (!$this->creation_date) {
         $this->creation_date = CMbDT::dateTime();
         if ($this->_id) {
             $this->creation_date = $this->loadFirstLog()->date;
         }
     }
     if ($this->fieldModified("handled", "1") || $this->handled && !$this->handled_date && !$this->handled_user_id) {
         $this->handled_date = CMbDT::dateTime();
         $this->handled_user_id = CMediusers::get()->_id;
         if ($this->handled) {
             $last_log = $this->loadLastLog();
             $this->handled_date = $last_log->date;
             $this->handled_user_id = $last_log->user_id;
         }
     }
     if ($this->fieldModified("handled", "0")) {
         $this->handled_date = $this->handled_user_id = "";
     }
     if ($msg = parent::store()) {
         return $msg;
     }
 }
Exemplo n.º 5
0
 /**
  * Build EVN segement
  *
  * @param CHL7v2Event $event Event
  *
  * @return null
  */
 function build(CHL7v2Event $event)
 {
     parent::build($event);
     $version = $event->message->version;
     $data = array();
     // EVN-1: Event Type Code (ID) (optional)
     // This field has been retained for backward compatibility only
     $data[] = $version < "2.5" ? $event->code : null;
     // EVN-2: Recorded Date/Time (TS)
     $data[] = CMbDT::dateTime();
     // EVN-3: Date/Time Planned Event (TS)(optional)
     $data[] = $this->planned_datetime;
     // EVN-4: Event Reason Code (IS) (optional)
     // Table 062
     // 01 - Patient request
     // 02 - Physician/health practitioner order
     // 03 - Census management
     // O  - Other
     // U  - Unknown
     $data[] = null;
     // EVN-5: Operator ID (XCN) (optional repeating)
     //$data[] = $this->getXCN($event->last_log->loadRefUser());
     $data[] = null;
     // EVN-6: Event Occurred (TS) (optional)
     $data[] = $this->occured_datetime;
     // EVN-7: Event Facility (HD) (optional)
     $data[] = null;
     $this->fill($data);
 }
Exemplo n.º 6
0
 /**
  * @see parent::build
  */
 function build(CHPREvent $event)
 {
     parent::build($event);
     $message = $event->message;
     $data = array();
     // H-1 : Field Separator
     $data[] = $message->fieldSeparator;
     // H-2: Encoding Characters (ST)
     $data[] = substr($message->getEncodingCharacters(), 1);
     // H-3 : Message ID
     $data[] = $event->_exchange_hpr->_id;
     // H-4 : Password
     $data[] = null;
     // H-5 : Sender ID
     $data[] = $event->_sender->nom;
     // H-6 : Sender address
     $data[] = null;
     // H-7 : Context
     $data[] = $event->event_type;
     // H-8 : Sender phone
     $data[] = null;
     // H-9 : Transmission characteristics
     $data[] = null;
     // H-10 : Receiver ID
     $data[] = array($event->_receiver->_id, $event->_receiver->nom);
     // H-11 : Comment
     $data[] = null;
     // H-12 : Processing ID
     $data[] = null;
     // H-13 : Version and Type
     $data[] = array(array($event->version, $event->_exchange_hpr->type));
     // H-14 : Date/Time of Message
     $data[] = CMbDT::dateTime();
     $this->fill($data);
 }
 /**
  * logSejourAccess
  *
  * @param CSejour $sejour
  *
  * @return bool has the access been logged
  */
 static function logForSejour($sejour)
 {
     $group = $sejour->loadRefEtablissement();
     if (!CAppUI::conf("admin CLogAccessMedicalData enable_log_access", $group) || !$sejour->_id) {
         return false;
     }
     $user = CMediusers::get();
     $conf = CAppUI::conf("admin CLogAccessMedicalData round_datetime", $group);
     $datetime = CMbDT::dateTime();
     switch ($conf) {
         case '1m':
             // minute
             $datetime = CMbDT::format($datetime, "%y-%m-%d %H:%M:00");
             break;
         case '10m':
             // 10 minutes
             $minute = CMbDT::format($datetime, "%M");
             $minute = str_pad(floor($minute / 10) * 10, 2, 0, STR_PAD_RIGHT);
             $datetime = CMbDT::format($datetime, "%y-%m-%d %H:{$minute}:00");
             break;
         case '1d':
             // 1 day
             $datetime = CMbDT::format($datetime, "%y-%m-%d 00:00:00");
             break;
         default:
             // 1 hour
             $datetime = CMbDT::format($datetime, "%y-%m-%d %H:00:00");
             break;
     }
     return self::logintoDb($user->_id, $sejour->_class, $sejour->_id, $datetime, $group->_id);
 }
Exemplo n.º 8
0
 /**
  * Magic method (do not call directly).
  * @param string $name method name
  * @param array  $args arguments
  *
  * @return mixed
  *
  * @throws Exception
  * @throws CMbException
  */
 function __call($name, $args)
 {
     $name = strtolower($name);
     $silent = strncmp($name, 'try', 3) === 0;
     $function_name = $silent ? substr($name, 3) : $name;
     $function_name = '_' . (isset(self::$aliases[$function_name]) ? self::$aliases[$function_name] : $function_name);
     if (!method_exists($this, $function_name)) {
         throw new CMbException("CSourceFTP-call-undefined-method", $name);
     }
     if ($function_name == "_init") {
         return call_user_func_array(array($this, $function_name), $args);
     }
     if (!$this->loggable) {
         try {
             return call_user_func_array(array($this, $function_name), $args);
         } catch (CMbException $fault) {
             throw $fault;
         }
     }
     $echange_ftp = new CExchangeFTP();
     $echange_ftp->date_echange = CMbDT::dateTime();
     $echange_ftp->emetteur = CAppUI::conf("mb_id");
     $echange_ftp->destinataire = $this->hostname;
     $echange_ftp->function_name = $name;
     CApp::$chrono->stop();
     $chrono = new Chronometer();
     $chrono->start();
     $output = null;
     try {
         $output = call_user_func_array(array($this, $function_name), $args);
     } catch (CMbException $fault) {
         $echange_ftp->date_echange = CMbDT::dateTime();
         $echange_ftp->output = $fault->getMessage();
         $echange_ftp->ftp_fault = 1;
         $echange_ftp->store();
         CApp::$chrono->start();
         throw $fault;
     }
     $chrono->stop();
     CApp::$chrono->start();
     // response time
     $echange_ftp->response_time = $chrono->total;
     // Truncate input and output before storing
     $args = array_map_recursive(array("CFTP", "truncate"), $args);
     $echange_ftp->input = serialize($args);
     if ($echange_ftp->ftp_fault != 1) {
         if ($function_name == "_getlistfiles") {
             // Truncate le tableau des fichiers reçus dans le cas où c'est > 100
             $array_count = count($output);
             if ($array_count > 100) {
                 $output = array_slice($output, 0, 100);
                 $output["count"] = "{$array_count} files";
             }
         }
         $echange_ftp->output = serialize(array_map_recursive(array("CFTP", "truncate"), $output));
     }
     $echange_ftp->store();
     return $output;
 }
Exemplo n.º 9
0
 /**
  * Return the create date of the document
  *
  * @return datetime|Null
  */
 function getCreateDate()
 {
     $create_date = $this->queryAttributNode("/cda:ClinicalDocument/cda:effectiveTime", null, "value");
     if ($create_date) {
         $create_date = CMbDT::dateTime($create_date);
     }
     return $create_date;
 }
Exemplo n.º 10
0
 /**
  * @see parent::store()
  */
 function store()
 {
     if (!$this->creation_datetime) {
         $this->creation_datetime = CMbDT::dateTime();
     }
     if ($msg = parent::store()) {
         return $msg;
     }
 }
 /**
  * @see parent::doStore()
  */
 function doStore()
 {
     if (isset($_FILES['attachment'])) {
         $mail_id = CValue::post('mail_id');
         $mail = new CUserMail();
         $mail->load($mail_id);
         $files = array();
         foreach ($_FILES['attachment']['error'] as $key => $file_error) {
             if (isset($_FILES['attachment']['name'][$key])) {
                 $files[] = array('name' => $_FILES['attachment']['name'][$key], 'tmp_name' => $_FILES['attachment']['tmp_name'][$key], 'error' => $_FILES['attachment']['error'][$key], 'size' => $_FILES['attachment']['size'][$key]);
             }
         }
         foreach ($files as $_key => $_file) {
             if ($_file['error'] == UPLOAD_ERR_NO_FILE) {
                 continue;
             }
             if ($_file['error'] != 0) {
                 CAppUI::setMsg(CAppUI::tr("CFile-msg-upload-error-" . $_file["error"]), UI_MSG_ERROR);
                 continue;
             }
             $attachment = new CMailAttachments();
             $attachment->name = $_file['name'];
             $content_type = mime_content_type($_file['tmp_name']);
             $attachment->type = $attachment->getTypeInt($content_type);
             $attachment->bytes = $_file['size'];
             $attachment->mail_id = $mail_id;
             $content_type = explode('/', $content_type);
             $attachment->subtype = strtoupper($content_type[1]);
             $attachment->disposition = 'ATTACHMENT';
             $attachment->extension = substr(strrchr($attachment->name, '.'), 1);
             $attachment->part = $mail->countBackRefs('mail_attachments') + 1;
             $attachment->store();
             $file = new CFile();
             $file->setObject($attachment);
             $file->author_id = CAppUI::$user->_id;
             $file->file_name = $attachment->name;
             $file->file_date = CMbDT::dateTime();
             $file->fillFields();
             $file->updateFormFields();
             $file->doc_size = $attachment->bytes;
             $file->file_type = mime_content_type($_file['tmp_name']);
             $file->moveFile($_file, true);
             if ($msg = $file->store()) {
                 CAppUI::setMsg(CAppUI::tr('CMailAttachments-error-upload-file') . ':' . CAppUI::tr($msg), UI_MSG_ERROR);
                 CApp::rip();
             }
             $attachment->file_id = $file->_id;
             if ($msg = $attachment->store()) {
                 CAppUI::setMsg($msg, UI_MSG_ERROR);
                 CApp::rip();
             }
         }
         CAppUI::setMsg('CMailAttachments-msg-added', UI_MSG_OK);
     } else {
         parent::doStore();
     }
 }
Exemplo n.º 12
0
 /**
  * check if $this is an older rule
  *
  * @return bool
  */
 function checkOlder()
 {
     $now = CMbDT::dateTime();
     if ($this->date_min && $now < $this->date_min) {
         return $this->_inactive = true;
     }
     if ($this->date_max && $now > $this->date_max) {
         return $this->_inactive = true;
     }
     return $this->_inactive = false;
 }
Exemplo n.º 13
0
 /**
  * History constructor
  *
  * @param string    $m          Module
  * @param string    $action     Action
  * @param string    $actionType Action type
  * @param CMbObject $object     Object
  * @param array     $params     Parameters
  * @param string    $type       Type of view
  */
 protected function __construct($m, $action, $actionType, CMbObject $object, $params, $type)
 {
     $this->datetime = CMbDT::dateTime();
     $this->m = $m;
     $this->action = $action;
     $this->actionType = $actionType;
     $this->params = $params;
     $this->type = $type;
     $this->object_guid = $object->_guid;
     $this->object = $object;
 }
 /**
  * @see parent::checkProperty()
  */
 function checkProperty($object)
 {
     $propValue =& $object->{$this->fieldName};
     if (!preg_match("/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}[ \\+][0-9]{1,2}:[0-9]{1,2}(:[0-9]{1,2})?\$/", $propValue)) {
         if ($propValue === 'current' || $propValue === 'now') {
             $propValue = CMbDT::dateTime();
             return null;
         }
         return "format de dateTime invalide : '{$propValue}'";
     }
     $propValue = strtr($propValue, "+", " ");
     return null;
 }
Exemplo n.º 15
0
 /**
  * @see parent::store()
  */
 function store()
 {
     // Save owner and creation date
     if (!$this->_id) {
         if (!$this->creation_date) {
             $this->creation_date = CMbDT::dateTime();
         }
         if (!$this->owner_id) {
             $this->owner_id = CMediusers::get()->_id;
         }
     }
     return parent::store();
 }
 function bindEchange($fileName = null)
 {
     $this->_echange_hprim21->date_production = CMbDT::dateTime($this->date);
     $this->_echange_hprim21->version = $this->version;
     $this->_echange_hprim21->nom_fichier = $this->nom_fichier;
     // Read => Mediboard
     $this->_echange_hprim21->receiver_id = null;
     $this->_echange_hprim21->sous_type = $this->sous_type;
     $this->_echange_hprim21->type = $this->type;
     $this->_echange_hprim21->date_echange = CMbDT::dateTime();
     if ($fileName) {
         $this->_echange_hprim21->_message = file_get_contents($fileName);
     }
     return $this->_echange_hprim21;
 }
Exemplo n.º 17
0
 /**
  * Generate exchange HL7v3
  *
  * @return CExchangeHL7v3
  */
 function generateExchange()
 {
     $exchange_hl7v3 = new CExchangeHL7v3();
     $exchange_hl7v3->date_production = CMbDT::dateTime();
     $exchange_hl7v3->receiver_id = $this->_receiver->_id;
     $exchange_hl7v3->group_id = $this->_receiver->group_id;
     $exchange_hl7v3->sender_id = $this->_sender ? $this->_sender->_id : null;
     $exchange_hl7v3->sender_class = $this->_sender ? $this->_sender->_id : null;
     $exchange_hl7v3->type = $this->event_type;
     $exchange_hl7v3->sous_type = $this->interaction_id;
     $exchange_hl7v3->object_id = $this->object->_id;
     $exchange_hl7v3->object_class = $this->object->_class;
     $exchange_hl7v3->store();
     return $this->_exchange_hl7v3 = $exchange_hl7v3;
 }
Exemplo n.º 18
0
 /**
  * store into temporary table all the data from CMbObject
  * Méthode effectuant tous les remplissages de la table buffer selon les CMbObject
  *
  * @param string $name_type the name of the CMbObject required
  *
  * @return string[]
  */
 function firstIndexingStore($name_type)
 {
     $date = CMbDT::dateTime();
     switch ($name_type) {
         case 'CCompteRendu':
             $queries = array("INSERT INTO `search_indexing` (`object_class`, `object_id`, `type`, `date`)\n          SELECT 'CCompteRendu', `compte_rendu`.`compte_rendu_id`, 'create', '{$date}'\n          FROM `compte_rendu`, `users_mediboard`, `functions_mediboard`\n          WHERE `compte_rendu`.`object_id` IS NOT NULL\n          AND   `compte_rendu`.`object_class` != 'CPatient'\n          AND `users_mediboard`.`user_id` =  `compte_rendu`.`author_id`\n          AND `functions_mediboard`.`function_id` = `users_mediboard`.`function_id`");
             break;
         case 'CTransmissionMedicale':
             $queries = array("INSERT INTO `search_indexing` (`object_class`, `object_id`, `type`, `date`)\n          SELECT 'CTransmissionMedicale', `transmission_medicale`.`transmission_medicale_id`, 'create', '{$date}'\n          FROM `transmission_medicale`, `users_mediboard`, `functions_mediboard`\n          WHERE `users_mediboard`.`user_id` =  `transmission_medicale`.`user_id`\n          AND `functions_mediboard`.`function_id` = `users_mediboard`.`function_id`");
             break;
         case 'CObservationMedicale':
             $queries = array("INSERT INTO `search_indexing` (`object_class`, `object_id`, `type`, `date`)\n          SELECT 'CObservationMedicale', `observation_medicale`.`observation_medicale_id`, 'create', '{$date}'\n          FROM `observation_medicale`, `users_mediboard`, `functions_mediboard`\n          WHERE `users_mediboard`.`user_id` =  `observation_medicale`.`user_id`\n          AND `functions_mediboard`.`function_id` = `users_mediboard`.`function_id`");
             break;
         case 'CConsultation':
             $queries = array("INSERT INTO `search_indexing` (`object_class`, `object_id`, `type`, `date`)\n          SELECT 'CConsultation', `consultation`.`consultation_id`, 'create', '{$date}'\n          FROM `consultation`, `users_mediboard`, `functions_mediboard`, `plageconsult`\n          WHERE `plageconsult`.`plageconsult_id` = `consultation`.`plageconsult_id`\n          AND `users_mediboard`.`user_id` =  `plageconsult`.`chir_id`\n          AND `functions_mediboard`.`function_id` = `users_mediboard`.`function_id`");
             break;
         case 'CConsultAnesth':
             $queries = array("INSERT INTO `search_indexing` (`object_class`, `object_id`, `type`, `date`)\n          SELECT 'CConsultAnesth', `consultation_anesth`.`consultation_anesth_id`, 'create', '{$date}'\n          FROM `consultation_anesth`, `users_mediboard`, `functions_mediboard`, `plageconsult`, `consultation`\n          WHERE   `consultation_anesth`.`consultation_id` = `consultation`.`consultation_id`\n          AND `plageconsult`.`plageconsult_id` = `consultation`.`plageconsult_id`\n          AND `users_mediboard`.`user_id` =  `plageconsult`.`chir_id`\n          AND `functions_mediboard`.`function_id` = `users_mediboard`.`function_id`");
             break;
         case 'CFile':
             $queries = array("INSERT INTO `search_indexing` (`object_class`, `object_id`, `type`, `date`)\n          SELECT 'CFile', `files_mediboard`.`file_id`, 'create', '{$date}'\n          FROM `files_mediboard`\n          WHERE `files_mediboard`.`object_class` IN  ('CSejour', 'CConsultation', 'CConsultAnesth', 'COperation')\n          AND `files_mediboard`.`file_type` NOT LIKE 'video/%'\n          AND `files_mediboard`.`file_type` NOT LIKE 'audio/%'");
             break;
         case 'CPrescriptionLineMedicament':
             $queries = array("INSERT INTO `search_indexing` (`object_class`, `object_id`, `type`, `date`)\n          SELECT 'CPrescriptionLineMedicament', `prescription_line_medicament`.`prescription_line_medicament_id`, 'create', '{$date}'\n          FROM `prescription_line_medicament`, `prescription`\n          WHERE  `prescription_line_medicament`.`prescription_id` = `prescription`.`prescription_id`\n           AND `prescription`.`object_class` != 'CDossierMedical'\n          AND `prescription`.`object_id` IS NOT NULL");
             break;
         case 'CPrescriptionLineMix':
             $queries = array("INSERT INTO `search_indexing` (`object_class`, `object_id`, `type`, `date`)\n          SELECT 'CPrescriptionLineMix', `prescription_line_mix`.`prescription_line_mix_id`, 'create', '{$date}'\n          FROM `prescription_line_mix`, `prescription`\n          WHERE  `prescription_line_mix`.`prescription_id` = `prescription`.`prescription_id`\n          AND `prescription`.`object_class` != 'CDossierMedical'\n          AND `prescription`.`object_id` IS NOT NULL");
             break;
         case 'CPrescriptionLineElement':
             $queries = array("INSERT INTO `search_indexing` (`object_class`, `object_id`, `type`, `date`)\n          SELECT 'CPrescriptionLineElement', `prescription_line_element`.`prescription_line_element_id`, 'create', '{$date}'\n          FROM `prescription_line_element`, `prescription`\n          WHERE  `prescription_line_element`.`prescription_id` = `prescription`.`prescription_id`\n          AND `prescription`.`object_class` != 'CDossierMedical'\n          AND `prescription`.`object_id` IS NOT NULL");
             break;
         case 'CExObject':
             $ds = $this->getDS();
             $ex_classes_ids = $ds->loadColumn("SELECT ex_class_id FROM ex_class");
             $queries = array();
             foreach ($ex_classes_ids as $_ex_class_id) {
                 $queries[] = "INSERT INTO `search_indexing` (`object_class`, `object_id`, `type`, `date`)\n          SELECT 'CExObject_{$_ex_class_id}', `ex_object_id`, 'create', '{$date}'\n          FROM `ex_object_{$_ex_class_id}`";
             }
             break;
         case 'COperation':
             $queries = array("INSERT INTO `search_indexing` (`object_class`, `object_id`, `type`, `date`)\n          SELECT 'COperation', `operations`.`operation_id`, 'create', '{$date}'\n          FROM `operations`, `users_mediboard`, `functions_mediboard`\n          WHERE `users_mediboard`.`user_id` =  `operations`.`chir_id`\n          AND `functions_mediboard`.`function_id` = `users_mediboard`.`function_id`");
             break;
         default:
             $queries = array();
     }
     // on retourne un tableau à cause des formulaires.
     return $queries;
 }
Exemplo n.º 19
0
 /**
  * Build MFI segement
  *
  * @param CHL7v2Event $event Event
  *
  * @return null
  */
 function build(CHL7v2Event $event)
 {
     parent::build($event);
     // MFI-1: Master File Identifier - MFI (CE) (Requis)
     $data[] = "LOC";
     // MFI-2: Master File Application Identifier - MFI (HD) (Requis)
     $data[] = "Mediboard_LOC_FRA";
     // MFI-3: File-Level Event Code - MFI (ID) (Requis)
     $data[] = "REP";
     // MFI-4: Enterd Date/Time - MFI (TS) (Optional)
     $data[] = null;
     // MFI-5: Effective Date/Time - MFI (TS) (Requis)
     $data[] = CMbDT::dateTime();
     // MFI-6: Response Level Code - MFI (ID) (Requis)
     $data[] = "AL";
     $this->fill($data);
 }
 /**
  * Generate content message
  *
  * @param CSejour $sejour Admit
  *
  * @return void
  */
 function generateFromOperation(CSejour $sejour)
 {
     $evenementsServeurEtatsPatient = $this->documentElement;
     // Ajout du patient
     $mbPatient = $sejour->loadRefPatient();
     $patient = $this->addElement($evenementsServeurEtatsPatient, "patient");
     $this->addPatient($patient, $mbPatient, false, true);
     // Ajout de la venue, c'est-à-dire le séjour
     $venue = $this->addElement($evenementsServeurEtatsPatient, "venue");
     $this->addVenue($venue, $sejour, false, true);
     $dateObservation = $this->addElement($evenementsServeurEtatsPatient, "dateObservation");
     $this->addDateHeure($dateObservation, CMbDT::dateTime());
     // Ajout des diagnostics
     $Diagnostics = $this->addElement($evenementsServeurEtatsPatient, "Diagnostics");
     $this->addDiagnosticsEtat($Diagnostics, $sejour);
     // Traitement final
     $this->purgeEmptyElements();
 }
Exemplo n.º 21
0
 /**
  * @see parent::onAfterMain()
  */
 function onAfterMain()
 {
     $cron_log_id = CValue::get("execute_cron_log_id");
     if (!$cron_log_id) {
         return;
     }
     //Mise à jour du statut du log suite à l'appel au script
     $cron_log = new CCronJobLog();
     $cron_log->load($cron_log_id);
     if (CCronJobLog::$log) {
         $cron_log->status = "error";
         $cron_log->error = CCronJobLog::$log;
         $cron_log->end_datetime = CMbDT::dateTime();
     } else {
         $cron_log->status = "finished";
         $cron_log->end_datetime = CMbDT::dateTime();
     }
     $cron_log->store();
 }
Exemplo n.º 22
0
 function doStore()
 {
     global $_validation, $m;
     if (!$_validation) {
         // Pas de $_validation ==> pas d'edition de la fiche
         if (!$this->_old->fiche_ei_id) {
             // Nouvelle fiche
             $this->_obj->date_fiche = CMbDT::dateTime();
         } elseif ($this->_old->qualite_date_validation) {
             // NE RIEN FAIRE !! -> Attente de verif et de controle
         } elseif (!$this->_old->qualite_date_validation && $this->_old->service_date_validation) {
             $this->_obj->qualite_date_validation = CMbDT::dateTime();
         } elseif (!$this->_old->service_date_validation && $this->_old->date_validation) {
             $this->_obj->service_date_validation = CMbDT::dateTime();
         } elseif (!$this->_old->date_validation) {
             $this->_obj->date_validation = CMbDT::dateTime();
         }
     }
     $this->redirectStore = "m={$m}&tab=vw_incidentvalid";
     parent::doStore();
 }
 /**
  * Range constructor
  *
  * @param string $guid      GUID
  * @param string $date      Date
  * @param int    $length    Length
  * @param string $title     Title
  * @param null   $color     Color
  * @param null   $css_class CSS class
  */
 function __construct($guid, $date, $length = 0, $title = "", $color = null, $css_class = null)
 {
     $this->guid = $guid;
     $this->internal_id = "CPlanningRange-" . uniqid();
     $this->start = $date;
     $this->length = $length;
     $this->title = CMbString::htmlEntities($title);
     $this->color = $color;
     $this->css_class = is_array($css_class) ? implode(" ", $css_class) : $css_class;
     if (preg_match("/[0-9]+ /", $this->start)) {
         $parts = split(" ", $this->start);
         $this->end = "{$parts[0]} " . CMbDT::time("+{$this->length} MINUTES", $parts[1]);
         $this->day = $parts[0];
         $this->hour = CMbDT::format($parts[1], "%H");
         $this->minutes = CMbDT::format($parts[1], "%M");
     } else {
         $this->day = CMbDT::date($date);
         $this->end = CMbDT::dateTime("+{$this->length} MINUTES", $date);
         $this->hour = CMbDT::format($date, "%H");
         $this->minutes = CMbDT::format($date, "%M");
     }
 }
Exemplo n.º 24
0
 /**
  * @see parent::build
  */
 function build(CHPrimSanteEvent $event)
 {
     parent::build($event);
     $message = $event->message;
     $data = array();
     // H-1 : Field Separator
     $data[] = $message->fieldSeparator;
     // H-2: Encoding Characters (ST)
     $data[] = substr($message->getEncodingCharacters(), 1);
     // H-3 : Message ID
     $data[] = $event->_exchange_hpr->_id;
     // H-4 : Password
     $data[] = null;
     // H-5 : Sender ID
     $data[] = CAppUI::conf("hprimsante sending_application");
     // H-6 : Sender address
     $data[] = null;
     // H-7 : Context
     $data[] = $event->type;
     // H-8 : Sender phone
     $data[] = null;
     // H-9 : Transmission characteristics
     $data[] = null;
     // H-10 : Receiver ID
     $receiver = $event->_receiver && $event->_receiver->_id ? $event->_receiver : $event->_sender;
     $data[] = array(array($receiver->_id, $receiver->nom));
     // H-11 : Comment
     $data[] = null;
     // H-12 : Processing ID
     $data[] = CAppUI::conf("instance_role") == "prod" ? "P" : "T";
     // H-13 : Version and Type
     $data[] = array(array($event->version, $event->type_liaison));
     // H-14 : Date/Time of Message
     $data[] = CMbDT::dateTime();
     $this->fill($data);
 }
Exemplo n.º 25
0
foreach ($list_affectations as $key => $_affectation) {
    // Chargement des références nécessaire pour parcourir les affectations
    $_affectation->loadRefLit();
    $_affectation->_ref_lit->loadRefChambre();
    $_affectation->_ref_lit->_ref_chambre->loadRefsFwd();
    $_affectation->loadRefSejour();
    $_affectation->_ref_sejour->loadRefPraticien(1);
    // Stockage des informations liées aux services
    foreach ($services as $key => $_service) {
        if ($_service->_id == $_affectation->_ref_lit->_ref_chambre->_ref_service->_id && !$_affectation->_ref_sejour->annule) {
            $total_service[$_service->_id]["total"]++;
        }
    }
}
$date_debut = CMbDT::dateTime("00:01:00", $date);
$date_fin = CMbDT::dateTime("23:59:00", $date);
// present du jour
$sejourJour = new CSejour();
$whereJour = array();
$whereJour["sejour.entree"] = "<= '{$date_fin}'";
$whereJour["sejour.sortie"] = ">= '{$date_debut}'";
$whereJour["annule"] = "= '0'";
$whereJour["type"] = "= 'comp'";
$countPresentJour = $sejourJour->countList($whereJour);
// present de la veille
$sejourVeille = new CSejour();
$whereVeille = array();
$whereVeille["sejour.entree"] = "<= '{$hierEntree}'";
$whereVeille["sejour.sortie"] = ">= '{$dateSortie}'";
$whereVeille["annule"] = "= '0'";
$whereVeille["type"] = "= 'comp'";
Exemplo n.º 26
0
$consult_id = CValue::get("consult_id", 0);
$sejour_id = CValue::get("sejour_id", 0);
$chir_id = CValue::get("chir_id", 0);
$sejour = new CSejour();
$sejour->load($sejour_id);
if ($sejour->_id) {
    $chir = new CMediusers();
    if ($chir_id) {
        $chir->load($chir_id);
    } else {
        $chir->load($sejour->praticien_id);
    }
    $sejour->loadRefPraticien();
    $sejour->loadRefsActes();
    $sejour->updateFormFields();
    $sejour->_datetime = CMbDT::dateTime();
    // Récupération des tarifs
    /** @var CTarif $tarif */
    $tarif = new CTarif();
    $tarifs = array();
    $order = "description";
    $where = array();
    $where["chir_id"] = "= '{$chir->_id}'";
    $tarifs["user"] = $tarif->loadList($where, $order);
    foreach ($tarifs["user"] as $_tarif) {
        /**@var CTarif $_tarif */
        $_tarif->getPrecodeReady();
    }
    $where = array();
    $where["function_id"] = "= '{$chir->function_id}'";
    $tarifs["func"] = $tarif->loadList($where, $order);
Exemplo n.º 27
0
             $format = $_format;
         }
     }
 }
 preg_match($format_regexp, $line, $date_reg);
 $date_reg = $date_reg[0];
 $date = DateTime::createFromFormat($format, $date_reg);
 $date = $date->format("Y-m-d H:i:s");
 preg_match("/[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+/", $line, $ip);
 // If a domain name, next line
 if (!isset($ip[0])) {
     continue;
 }
 $ip = $ip[0];
 $day = CMbDT::transform(CMbDT::dateTime($date), null, "%Y-%m-%d");
 $hour = CMbDT::transform(CMbDT::dateTime($date), null, "%H");
 if (!isset($count_by_day[$day])) {
     $count_by_day[$day] = 0;
 }
 if (!isset($count_by_hour[$hour])) {
     $count_by_hour[$hour] = 0;
 }
 if (!isset($count_by_ip[$ip])) {
     $count_by_ip[$ip] = 0;
 }
 if (!isset($count_by_hour_ip[$hour])) {
     $count_by_hour_ip[$hour] = array();
 }
 if (!isset($count_by_hour_ip[$hour][$ip])) {
     $count_by_hour_ip[$hour][$ip] = 0;
 }
Exemplo n.º 28
0
        $sejour->load($sejour_id);
        $sejour->type = CValue::post("type");
        if ($sejour->type == "ambu" || $sejour->type == "urg") {
            $sejour->sortie_prevue = CMbDT::dateTime("+4 HOURS", $sejour->entree);
            if ($sejour->sortie_reelle) {
                $sejour->sortie_reelle = CMbDT::dateTime("+4 HOURS", $sejour->entree);
            }
            /* TODO Supprimer ceci après l'ajout des times picker */
            $sejour->_hour_entree_prevue = null;
            $sejour->_min_entree_prevue = null;
            $sejour->_hour_sortie_prevue = null;
            $sejour->_min_sortie_prevue = null;
        } elseif ($sejour->type == "comp") {
            $sejour->sortie_prevue = CMbDT::dateTime("+72 HOURS", $sejour->entree);
            if ($sejour->sortie_reelle) {
                $sejour->sortie_reelle = CMbDT::dateTime("+72 HOURS", $sejour->entree);
            }
            /* TODO Supprimer ceci après l'ajout des times picker */
            $sejour->_hour_entree_prevue = null;
            $sejour->_min_entree_prevue = null;
            $sejour->_hour_sortie_prevue = null;
            $sejour->_min_sortie_prevue = null;
        }
        if ($msg = $sejour->store()) {
            CAppUI::stepAjax($msg, UI_MSG_ERROR);
        }
        break;
    default:
        CAppUI::stepAjax("L'évenement choisit n'est pas supporté", UI_MSG_ERROR);
}
CAppUI::stepAjax("Evenement effectué");
$offline = CValue::get("offline");
$in_modal = CValue::get("in_modal");
$embed = CValue::get("embed");
$period = CValue::get("period");
$forms_limit = CValue::get("forms_limit");
if (!$sejour_id) {
    CAppUI::stepMessage(UI_MSG_WARNING, "Veuillez sélectionner un sejour pour visualiser le dossier complet");
    return;
}
$fiches_anesthesies = array();
$formulaires = null;
global $atc_classes;
$atc_classes = array();
$datetime_min = "";
if ($period) {
    $datetime_min = CMbDT::dateTime("- {$period} HOURS");
}
// Chargement du sejour
$sejour = new CSejour();
$sejour->load($sejour_id);
$sejour->loadNDA();
$sejour->loadExtDiagnostics();
$sejour->loadRefsConsultAnesth();
$sejour->_ref_consult_anesth->loadRefConsultation();
$sejour->canRead();
// Chargement des affectations
$sejour->loadRefCurrAffectation()->loadRefLit();
foreach ($sejour->loadRefsAffectations() as $_affectation) {
    $_affectation->loadRefLit();
}
// Chargement des tâches
Exemplo n.º 30
0
/**
 * $Id:$
 *
 * @package    Mediboard
 * @subpackage dPfacturation
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision:$
 */
CCanDo::checkEdit();
$date_min = CValue::getOrSession("_date_min", CMbDT::date());
$date_max = CValue::getOrSession("_date_max", CMbDT::date());
$type_journal = CValue::get("type_journal");
$date_min = CMbDT::dateTime($date_min);
$date_max = CMbDT::dateTime(CMbDT::date("+1 day", $date_max));
$ljoin = array();
$ljoin["facture_journal"] = "facture_journal.journal_id = files_mediboard.object_id";
$where = array();
$where["object_class"] = " = 'CJournalBill'";
$where["file_date"] = "BETWEEN '{$date_min}' AND '{$date_max}'";
$where["facture_journal.type"] = "= '{$type_journal}'";
$file = new CFile();
$files = $file->loadList($where, null, null, null, $ljoin);
foreach ($files as $_file) {
    $_file->canDo();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("files", $files);
$smarty->assign("name_readonly", 1);