/** * @param $params * @return array */ public function UploadPatientDocument($params) { $this->constructor($params); if (!$this->isAuth()) { return ['Success' => false, 'Error' => 'Error: HTTP 403 Access Forbidden']; } if (!$this->isPatientValid()) { return ['Success' => false, 'Error' => 'Error: No Valid Patient Found']; } if (!$this->isProviderValid()) { return ['Success' => false, 'Error' => 'Error: No Valid Provider Found']; } $document = new stdClass(); $document->eid = 0; $document->pid = $this->patient->pid; $document->uid = $this->provider->id; $document->name = 'SoapUpload.pdf'; $document->date = $params->Document->Date; $document->title = $params->Document->Title; $document->document = $params->Document->Base64Document; $document->docType = isset($params->Document->Category) ? $params->Document->Category : 'General'; $document->note = isset($params->Document->Notes) ? $params->Document->Notes : ''; $document->encrypted = isset($params->Document->Encrypted) ? $params->Document->Encrypted : false; require_once ROOT . '/dataProvider/DocumentHandler.php'; $DocumentHandler = new DocumentHandler(); $result = $DocumentHandler->addPatientDocument($document); unset($DocumentHandler); return ['Success' => isset($result['data']->id)]; }
/** * Method view() */ public function archive() { try { header('Content-type: application/xml'); $xml = $this->xml->saveXML(); $name = $this->getFileName() . '.xml'; $date = date('Y-m-d H:i:s'); $document = new stdClass(); $document->pid = $this->pid; $document->eid = $this->eid; $document->uid = $_SESSION['user']['id']; $document->docType = 'C-CDA'; $document->name = $name; $document->date = $date; $document->note = ''; $document->title = 'C-CDA'; $document->encrypted = 0; $document->document = base64_encode($xml); include_once ROOT . '/dataProvider/DocumentHandler.php'; $DocumentHandler = new DocumentHandler(); $DocumentHandler->addPatientDocument($document); unset($DocumentHandler, $document, $name, $date); print $xml; } catch (Exception $e) { print $e->getMessage(); } }