示例#1
0
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 public function testUnsignedItem()
 {
     $this->_objects = GeneralAlertHandler::generateClinicalNoteHandler();
     $objects = array();
     $db = Zend_Registry::get('dbAdapter');
     $clinicalNote = new ClinicalNote();
     $clinicalNote->personId = $this->_objects['person']->person_id;
     $clinicalNote->visitId = 100;
     $clinicalNote->clinicalNoteDefinitionId = 19;
     $clinicalNote->dateTime = date('Y-m-d H:i:s');
     $clinicalNote->persist();
     $objects['clinicalNote'] = $clinicalNote;
     $eSign = new ESignature();
     // cleanup all generalAlerts
     $db->query('DELETE FROM ' . $eSign->_table);
     $eSign->dateTime = date('Y-m-d H:i:s');
     $eSign->signedDateTime = '0000-00-00 00:00:00';
     $eSign->signingUserId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
     $eSign->objectId = $clinicalNote->clinicalNoteId;
     $eSign->objectClass = get_class($clinicalNote);
     $eSign->summary = ' **Unsigned**';
     $eSign->persist();
     $objects['eSignature'] = $eSign;
     // cleanup all generalAlerts
     $generalAlert = new GeneralAlert();
     $db->query('DELETE FROM ' . $generalAlert->_table);
     $process = Processingd::getInstance();
     $process->clearProcesses();
     $process->addProcess(new ProcessAlert());
     $process->startProcessing(false);
     $generalAlertIterator = $generalAlert->getIterator();
     $ctr = 0;
     foreach ($generalAlertIterator as $alert) {
         $objects['generalAlert' . $ctr++] = $alert;
     }
     $this->assertEquals($ctr, 1, 'No alert created even with signed items');
     $this->_cleanUpObjects($objects);
 }
 public function testTetanusShotsFulfillWithAudit()
 {
     $this->_objects = HealthStatusHandler::generateTestTetanus();
     $objects = array();
     $timeTrigger = date('h:i A', strtotime('-10 minutes'));
     $processHSA = new ProcessHSA($timeTrigger);
     $process = Processingd::getInstance();
     $process->clearProcesses();
     $process->addProcess($processHSA);
     $process->startProcessing(false);
     $audit = new Audit();
     $audit->_ormPersist = true;
     $audit->objectClass = get_class($this->_objects['medication']);
     $audit->objectId = $this->_objects['medication']->medicationId;
     $audit->dateTime = date('Y-m-d H:i:s');
     $audit->type = WebVista_Model_ORM::REPLACE;
     $audit->userId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
     $audit->persist();
     $objects['audit'] = $audit;
     $time = date('h:i A', strtotime('-2 minutes'));
     // advance the time to 2 minutes due to fast processing
     $processHSA->setCurrentTime($time);
     $process->clearProcesses();
     $process->addProcess($processHSA);
     $process->startProcessing(false);
     $healthStatusAlert = new HealthStatusAlert();
     $healthStatusAlert->populateByHandlerPatientId($this->_objects['healthStatusHandler']->healthStatusHandlerId, $this->_objects['patient']->personId);
     $objects['healthStatusAlert'] = $healthStatusAlert;
     $this->_cleanUpObjects($objects);
     $this->assertTrue(strlen($healthStatusAlert->status) > 0, 'No alert created');
     $this->assertEquals($healthStatusAlert->status, 'fulfilled', 'Alert is not fulfilled');
     $this->assertEquals(date('Y-m-d', strtotime($healthStatusAlert->dateDue)), date('Y-m-d', strtotime('+1 month')), 'Due date is invalid');
 }