53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
class Reference extends MY_Controller
|
|
{
|
|
var $db_smartone;
|
|
public function index()
|
|
{
|
|
echo "Patient API";
|
|
}
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->db_smartone = $this->load->database("onedev", true);
|
|
}
|
|
|
|
public function searchreference()
|
|
{
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
|
|
$q = [
|
|
'search' => '%'
|
|
];
|
|
|
|
if ($prm['search'] != '') {
|
|
$q['search'] = "%{$prm['search']}%";
|
|
}
|
|
|
|
$sql = "SELECT
|
|
M_ReferenceID,
|
|
M_ReferenceName,
|
|
M_ReferenceIsActive
|
|
FROM m_reference
|
|
WHERE M_ReferenceIsActive = 'Y'
|
|
AND (M_ReferenceName LIKE ?)";
|
|
$qry = $this->db_smartone->query($sql, array($q['search']));
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
} else {
|
|
$this->sys_error_db("reference error", $this->db_smartone);
|
|
exit;
|
|
}
|
|
|
|
$result = array(
|
|
"records" => $rows,
|
|
"total_display" => sizeof($rows)
|
|
);
|
|
$this->sys_ok($result);
|
|
}
|
|
}
|