public function indexAction() { $action = $this->getRequest()->getPost('action'); $am_id = $this->getRequest()->getPost('am_id'); if ($action == 'add_new_patient') { $this->getCcrTable()->insert_patient($am_id); } $category_details = $this->getCcrTable()->fetch_cat_id('CCR'); $time_start = date('Y-m-d H:i:s'); $docid = \Documents\Controller\DocumentsController::uploadAction(); $uploaded_documents = array(); $uploaded_documents = $this->getCcrTable()->fetch_uploaded_documents(array('user' => $_SESSION['authId'], 'time_start' => $time_start, 'time_end' => date('Y-m-d H:i:s'))); if ($uploaded_documents[0]['id'] > 0) { $_REQUEST["document_id"] = $uploaded_documents[0]['id']; $_REQUEST["batch_import"] = 'YES'; $this->importAction(); } else { $result = \Documents\Plugin\Documents::fetchXmlDocuments(); foreach ($result as $row) { if ($row['doc_type'] == 'CCR') { $_REQUEST["document_id"] = $row['doc_id']; $this->importAction(); \Documents\Model\DocumentsTable::updateDocumentCategoryUsingCatname($row['doc_type'], $row['doc_id']); } } } $records = $this->getCcrTable()->document_fetch(array('cat_title' => 'CCR')); $view = new ViewModel(array('records' => $records, 'category_id' => $category_details[0]['id'], 'file_location' => basename($_FILES['file']['name']), 'patient_id' => '00', 'listenerObject' => $this->listenerObject, 'commonplugin' => $this->CommonPlugin())); return $view; }
public function uploadAction() { $request = $this->getRequest(); $upload = $request->getPost('upload'); $category_details = \Carecoordination\Controller\CarecoordinationController::getCarecoordinationTable()->fetch_cat_id('CCD'); if ($upload == 1) { $time_start = date('Y-m-d H:i:s'); $cdoc = \Documents\Controller\DocumentsController::uploadAction(); $uploaded_documents = array(); $uploaded_documents = \Carecoordination\Controller\CarecoordinationController::getCarecoordinationTable()->fetch_uploaded_documents(array('user' => $_SESSION['authId'], 'time_start' => $time_start, 'time_end' => date('Y-m-d H:i:s'))); if ($uploaded_documents[0]['id'] > 0) { $_REQUEST["document_id"] = $uploaded_documents[0]['id']; $_REQUEST["batch_import"] = 'YES'; $this->importAction(); } } else { $result = \Documents\Plugin\Documents::fetchXmlDocuments(); foreach ($result as $row) { if ($row['doc_type'] == 'CCD') { $_REQUEST["document_id"] = $row['doc_id']; $this->importAction(); \Documents\Model\DocumentsTable::updateDocumentCategoryUsingCatname($row['doc_type'], $row['doc_id']); } } } $records = \Carecoordination\Controller\CarecoordinationController::getCarecoordinationTable()->document_fetch(array('cat_title' => 'CCD', 'type' => '13')); $view = new ViewModel(array('records' => $records, 'category_id' => $category_details[0]['id'], 'file_location' => basename($_FILES['file']['name']), 'patient_id' => '00', 'listenerObject' => $this->listenerObject)); return $view; }