3 /* +-----------------------------------------------------------------------------+
4 * Copyright 2016 matrix israel
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 3
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see
15 * http://www.gnu.org/licenses/licenses.html#GPL
16 * @author Dror Golan <drorgo@matrix.co.il>
17 * +------------------------------------------------------------------------------+
21 namespace Patientvalidation\Model
;
23 use Laminas\Db\Sql\Expression
;
24 use Laminas\Db\TableGateway\TableGateway
;
25 use Laminas\Db\Sql\Predicate
;
26 use Application\Model\ApplicationTable
;
27 use Laminas\Db\Adapter\Adapter
;
29 class PatientDataTable
31 protected $tableGateway;
36 * PatientTable constructor.
37 * @param TableGateway $tableGateway
39 public function __construct(TableGateway
$tableGateway)
41 $this->tableGateway
= $tableGateway;
42 $adapter = \Laminas\Db\TableGateway\Feature\GlobalAdapterFeature
::getStaticAdapter();
43 $this->adapter
= $adapter;
55 * @param array $parameters
58 public function getPatients(array $parameters)
60 //You can use this function to write whatever rules that you need from the DB
61 //$sql="SELECT * FROM patient_data WHERE fname like ".$parameters['fname']." OR lname like ".$parameters['lname'] ." OR DOB like ".$parameters['DOB'];
64 $obj = new ApplicationTable();
65 $sql = " SELECT * FROM patient_data WHERE fname like ? OR lname like ? OR DOB like ? OR pubpid = ?";
66 $params = array($parameters['fname'],$parameters['lname'],$parameters['DOB'],isset($parameters['pubpid']) ?
$parameters['pubpid'] : '');
67 $rowset = $obj->zQuery($sql, $params);
71 foreach ($rowset as $row) {