/**
     * Generate Health Status Alerts default object for condition
     * @return string PHP code for handlerObject
     */
    public function generateDefaultHandlerObject()
    {
        $audit = new Audit();
        $audit->auditId = $this->condition;
        $audit->populate();
        $handlerName = Handler::normalizeHandlerName($this->name);
        $healthStatusHandler = '';
        $objectClass = $audit->objectClass;
        if (strlen($objectClass) > 0 && class_exists($objectClass)) {
            $tmp = new $objectClass();
            $healthStatusHandler .= <<<EOL
\t\tif (\$auditOrm->objectClass == '{$objectClass}' && \$auditOrm->type == '{$audit->type}') {
\t\t\treturn true;
\t\t}
EOL;
        }
        $handlerObject = <<<EOL

class {$handlerName}HealthStatusHandlerObject extends HealthStatusHandlerObjectAbstract {
\t//abstract requires at least this method
\tpublic static function matchAudit(HealthStatusHandler \$handler,Audit \$auditOrm) {
{$healthStatusHandler}
\t\treturn false;
\t}

\tpublic static function fulfill(HealthStatusHandler \$handler,\$patientId) {
\t}

\tpublic static function patientMatch(HealthStatusHandler \$handler,\$patientId) {
\t}
}

EOL;
        return $handlerObject;
    }
 public function processResendOutboundFaxAction()
 {
     $messagingId = (int) $this->_getParam('messagingId');
     $faxNumber = $this->_getParam('faxNumber');
     $messaging = new Messaging();
     if ($messagingId > 0) {
         $messaging->messagingId = $messagingId;
         $messaging->populate();
     }
     if ($messagingId->auditId > 0) {
         $messaging->faxNumber = '';
         if (is_numeric($faxNumber) && strlen($faxNumber) > 9) {
             $messaging->faxNumber = $faxNumber;
         }
         $messaging->resend = 1;
         $messaging->persist();
         $audit = new Audit();
         $audit->auditId = $messagingAudit->auditId;
         $audit->populate();
         $audit->startProcessing = '0000-00-00 00:00:00';
         $audit->endProcessing = '0000-00-00 00:00:00';
         $audit->persist();
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(true);
 }
Exemple #3
0
    /**
     * Generate Health Status Alerts default object for condition
     * @return string PHP code for conditionObject
     */
    public function generateHSADefaultConditionObject()
    {
        $audit = new Audit();
        $audit->auditId = $this->condition;
        $audit->populate();
        $handlerName = self::normalizeHandlerName($this->name);
        $conditionHandler = '';
        $dataIntegrationDatasource = '';
        $objectClass = $audit->objectClass;
        if (strlen($objectClass) > 0 && class_exists($objectClass)) {
            $tmp = new $objectClass();
            $conditionHandler .= <<<EOL
\t\tif (\$auditOrm->objectClass == '{$objectClass}' && \$auditOrm->type == '{$audit->type}') {
\t\t\treturn true;
\t\t}
EOL;
            $dataIntegrationDatasource .= <<<EOL
\t\tif (class_exists('{$objectClass}')) {
\t\t\t\$orm = new {$objectClass}();
EOL;
            foreach ($tmp->_primaryKeys as $key) {
                $dataIntegrationDatasource .= <<<EOL

\t\t\t\$orm->{$key} = {$audit->objectId};
EOL;
            }
            $dataIntegrationDatasource .= <<<EOL

\t\t\t\$orm->populate();
\t\t\t\$ret = \$orm->toArray();
\t\t}
EOL;
        }
        $conditionObject = <<<EOL

class {$handlerName}ConditionHandler extends DataIntegrationConditionHandlerAbstract {
\t//abstract requires at least this method
\tpublic static function matchAudit(Audit \$auditOrm) {
{$conditionHandler}
\t\treturn false;
\t}

\tpublic static function fulfill(HealthStatusAlert \$alert) {
\t\t\$alert->status = 'fulfilled';
\t\t\$alert->persist();
\t}

\tpublic static function patientMatch(Handler \$handler,Patient \$patient) {
\t\t// get/retrieve patient alert using personId of \$patient and handlerId of \$handler
\t\t\$alert = new HealthStatusAlert();
\t\t\$alert->populateByHandlerPatientId(\$handler->handlerId,\$patient->personId);
\t\tif (strlen(\$alert->status) > 0) {
\t\t\t//return true;
\t\t}
\t\tif (\$alert->status == 'active' || \$alert->status == 'fulfilled' || \$alert->status == 'ignored') {
\t\t\treturn false;
\t\t}
\t\treturn true;
\t}
}

class {$handlerName}DataIntegrationDatasource extends DataIntegrationDatasourceAbstract {
\t//abstract requires at least this method
\tpublic static function sourceData(Audit \$auditOrm) {
\t\t\$ret = array();
{$dataIntegrationDatasource}
\t\treturn \$ret;
\t}
}

EOL;
        return $conditionObject;
    }