OphCoTherapyapplication_Processor::getProcessWarnings PHP Method

getProcessWarnings() public method

Get any relevant warnings.
public getProcessWarnings ( ) : array
return array
    public function getProcessWarnings()
    {
        $warnings = array();
        $el_diag = $this->getElement('Element_OphCoTherapyapplication_Therapydiagnosis');
        $sides = array();
        if ($el_diag->hasLeft()) {
            $sides[] = 'left';
        }
        if ($el_diag->hasRight()) {
            $sides[] = 'right';
        }
        if ($api = Yii::app()->moduleAPI->get('OphCiExamination')) {
            $missing_sides = array();
            foreach ($sides as $side) {
                if (!$api->getInjectionManagementComplexInEpisodeForDisorder($this->event->episode->patient, $this->event->episode, $side, $el_diag->{$side . '_diagnosis1_id'}, $el_diag->{$side . '_diagnosis2_id'})) {
                    $missing_sides[] = $side;
                }
            }
            foreach ($missing_sides as $missing) {
                $warnings[] = 'No Injection Management has been created for ' . $missing . ' diagnosis.';
            }
            // if the application doesn't have a given side, the VA value can be NR (e.g. eye missing etc)
            // but if it does, then we need an actual VA value.
            if (!$api->getLetterVisualAcuityForEpisodeLeft($this->event->episode, !$el_diag->hasLeft(), $this->event->event_date)) {
                $warnings[] = 'Visual acuity not found for left eye.';
            }
            if (!$api->getLetterVisualAcuityForEpisodeRight($this->event->episode, !$el_diag->hasRight(), $this->event->event_date)) {
                $warnings[] = 'Visual acuity not found for right eye.';
            }
        }
        if ($api = Yii::app()->moduleAPI->get('OphTrConsent')) {
            $procedures = Procedure::model()->findAll(array('condition' => 'snomed_code = :snomed or snomed_code = :snomed2 ', 'params' => array(':snomed' => $this::SNOMED_INTRAVITREAL_INJECTION, ':snomed2' => $this::SNOMED_PDT)));
            foreach ($sides as $side) {
                $sideHasConsent = false;
                foreach ($procedures as $procedure) {
                    if ($api->hasConsentForProcedure($this->event->episode, $procedure, $side)) {
                        $sideHasConsent = true;
                        break;
                    }
                }
                if (!$sideHasConsent) {
                    $warnings[] = 'Consent form is required for ' . $side . ' eye.';
                }
            }
        }
        return $warnings;
    }

Usage Example

コード例 #1
0
ファイル: view.php プロジェクト: openeyes/openeyes
 * OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>.
 *
 * @link http://www.openeyes.org.uk
 *
 * @author OpenEyes <*****@*****.**>
 * @copyright Copyright (c) 2008-2011, Moorfields Eye Hospital NHS Foundation Trust
 * @copyright Copyright (c) 2011-2012, OpenEyes Foundation
 * @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0
 */
?>

<?php 
$service = new OphCoTherapyapplication_Processor($this->event);
$status = $service->getApplicationStatus();
$warnings = $service->getProcessWarnings();
if (!$warnings && !$this->event->isLocked()) {
    if ($status != $service::STATUS_SENT) {
        $nonCompliant = $service->isEventNonCompliant();
        if ($nonCompliant) {
            $preview_button = EventAction::link('Preview Application', $this->createUrl('previewApplication', array('event_id' => $this->event->id)), null, array('id' => 'application-preview', 'class' => 'button small'));
            $submit_button_text = 'Submit Application';
        } else {
            $preview_button = EventAction::button('Preview Application', null, array('disabled' => true), array('title' => 'Preview unavailable for NICE compliant applications', 'class' => 'button small'));
            $submit_button_text = 'Submit Notification';
        }
        if ($this->checkPrintAccess()) {
            $this->event_actions[] = $preview_button;
        }
        if ($this->checkEditAccess()) {
            $url = '#';