48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
|
|
class Helper extends MY_Controller
|
|
{
|
|
var $db_smartone;
|
|
|
|
public function index()
|
|
{
|
|
echo "RE Helper API";
|
|
}
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->db_smartone = $this->load->database("onedev", true);
|
|
}
|
|
|
|
public function calc_age()
|
|
{
|
|
$prm = $this->sys_input;
|
|
$orderID = $prm["orderID"];
|
|
|
|
$sql = "call sp_recount_age(?)";
|
|
$query = $this->db_smartone->query($sql,array($orderID));
|
|
|
|
if ($query) {
|
|
$sql = "select T_OrderHeaderM_PatientAge, M_PatientDOB
|
|
from t_orderheader
|
|
join m_patient on T_OrderHeaderM_PatientID = M_PatientID
|
|
and T_OrderHeaderID = ?";
|
|
$qry = $this->db_smartone->query($sql,array($orderID));
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
$rst = $rows;
|
|
if (count($rows) > 0 ) $rst = $rows[0];
|
|
$this->sys_ok($rst);
|
|
} else {
|
|
$this->sys_error_db("", $this->db_smartone);
|
|
}
|
|
}
|
|
else {
|
|
$this->sys_error_db("", $this->db_smartone);
|
|
exit;
|
|
}
|
|
}
|
|
}
|