(C) Moorfields Eye Hospital NHS Foundation Trust, 2008-2011 (C) OpenEyes Foundation, 2011-2013 This file is part of OpenEyes. OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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 .
Author: OpenEyes (info@openeyes.org.uk)
Ejemplo n.º 1
0
 /**
  * @param $event
  */
 public function getUniqueCodeForCviEvent($event)
 {
     $eventUniqueCodeId = \UniqueCodeMapping::model()->findAllByAttributes(array('event_id' => $event->id));
     $eventUniqueCode = \UniqueCodes::model()->findByPk($eventUniqueCodeId[0]->unique_code_id);
     $salt = isset(\Yii::app()->params['portal']['credentials']['client_id']) ? \Yii::app()->params['portal']['credentials']['client_id'] : '';
     $check_digit1 = new \CheckDigitGenerator(\Yii::app()->params['institution_code'] . $eventUniqueCode->code, $salt);
     $check_digit2 = new \CheckDigitGenerator($eventUniqueCode->code . $event->episode->patient->dob, $salt);
     $finalEventUniqueCode = \Yii::app()->params['institution_code'] . $check_digit1->generateCheckDigit() . '-' . $eventUniqueCode->code . '-' . $check_digit2->generateCheckDigit();
     return $finalEventUniqueCode;
 }
Ejemplo n.º 2
0
 public function generateUniqueCodeWithChecksum($uniqueCodeId)
 {
     $uniqueCode = UniqueCodes::model()->findByPk($uniqueCodeId)->code;
     $salt = isset(Yii::app()->params['portal']['credentials']['client_id']) ? Yii::app()->params['portal']['credentials']['client_id'] : '';
     $check_digit1 = new CheckDigitGenerator(Yii::app()->params['institution_code'] . $uniqueCode, $salt);
     $check_digit2 = new CheckDigitGenerator($uniqueCode . Yii::app()->user->id, $salt);
     $finalUniqueCode = Yii::app()->params['institution_code'] . $check_digit1->generateCheckDigit() . '-' . $uniqueCode . '-' . $check_digit2->generateCheckDigit();
     return $finalUniqueCode;
 }
Ejemplo n.º 3
0
 public function getPatientUniqueCode($patient)
 {
     $patient_latest_event = $patient->getLatestOperationNoteEventUniqueCode();
     $event_unique_code = '';
     if (!empty($patient_latest_event)) {
         $salt = isset(Yii::app()->params['portal']['credentials']['client_id']) ? Yii::app()->params['portal']['credentials']['client_id'] : '';
         $check_digit1 = new CheckDigitGenerator(Yii::app()->params['institution_code'] . $patient_latest_event, $salt);
         $check_digit2 = new CheckDigitGenerator($patient_latest_event . $patient->dob, $salt);
         $event_unique_code = Yii::app()->params['institution_code'] . $check_digit1->generateCheckDigit() . '-' . $patient_latest_event . '-' . $check_digit2->generateCheckDigit();
     }
     return $event_unique_code;
 }