} else { $notification->date_echange = ""; $notification->store(); } } } else { // Chargement de l'objet /** @var CEchangeHprim $echange_hprim */ $echange_hprim = new $echange_hprim_classname(); $echange_hprim->load($echange_hprim_id); $dest_hprim = new CDestinataireHprim(); $dest_hprim->load($echange_hprim->receiver_id); $source = CExchangeSource::get("{$dest_hprim->_guid}-evenementPatient"); $source->setData($echange_hprim->_message); $source->send(); $acquittement = $source->getACQ(); if ($acquittement) { $domGetAcquittement = new CHPrimXMLAcquittementsPatients(); $domGetAcquittement->loadXML($acquittement); $doc_valid = $domGetAcquittement->schemaValidate(null, false, $dest_hprim->display_errors); if ($doc_valid) { $echange_hprim->statut_acquittement = $domGetAcquittement->getStatutAcquittementPatient(); } $echange_hprim->acquittement_valide = $doc_valid ? 1 : 0; $echange_hprim->date_echange = CMbDT::dateTime(); $echange_hprim->_acquittement = $acquittement; $echange_hprim->store(); CAppUI::setMsg("Message HPRIM envoyé", UI_MSG_OK); echo CAppUI::getMsg(); } }
/** * Send event patient * * @param CHPrimXMLEvenementsPatients $dom_evt Event * @param CMbObject $mbObject Object * @param bool $referent Referent * @param bool $initiateur Initiateur * * @throws CMbException * * @return void */ function sendEvenementPatient(CHPrimXMLEvenementsPatients $dom_evt, CMbObject $mbObject, $referent = null, $initiateur = null) { if (!($msg = $dom_evt->generateTypeEvenement($mbObject, $referent, $initiateur))) { return; } $exchange = $dom_evt->_ref_echange_hprim; if (!$exchange->message_valide) { return null; } if (!$this->synchronous) { return null; } $source = CExchangeSource::get("{$this->_guid}-evenementPatient"); if (!$source->_id || !$source->active) { return; } $source->setData($msg, false, $exchange); try { $source->send(); } catch (Exception $e) { throw new CMbException("CExchangeSource-no-response"); } $exchange->date_echange = CMbDT::dateTime(); $acq = $source->getACQ(); if (!$acq) { $exchange->store(); return; } $dom_acq = new CHPrimXMLAcquittementsPatients(); $dom_acq->loadXML($acq); $dom_acq->_ref_echange_hprim = $exchange; $doc_valid = $dom_acq->schemaValidate(null, false, $this->display_errors); $exchange->statut_acquittement = $dom_acq->getStatutAcquittementPatient(); $exchange->acquittement_valide = $doc_valid ? 1 : 0; $exchange->_acquittement = $acq; $exchange->store(); }
/** * Get observations * * @param bool $display_errors Display errors * * @return array */ function getObservations($display_errors = false) { if (!$this->_acquittement) { return null; } if ($this->type == "patients") { $domGetAcquittement = new CHPrimXMLAcquittementsPatients(); $domGetAcquittement->loadXML($this->_acquittement); $doc_valid = $domGetAcquittement->schemaValidate(null, false, false); if ($doc_valid) { return $this->_observations = $domGetAcquittement->getAcquittementObservationPatients(); } } /* @todo a remplir ... */ if ($this->type == "pmsi") { return $this->_observations = array(); } return null; }