45 lines
1.3 KiB
PHP
Executable File
45 lines
1.3 KiB
PHP
Executable File
<?php
|
|
|
|
class History extends MY_Controller
|
|
{
|
|
var $db_onedev;
|
|
public function index()
|
|
{
|
|
echo "History API";
|
|
}
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->db_onedev = $this->load->database("onedev", true);
|
|
}
|
|
|
|
public function search()
|
|
{
|
|
$prm = $this->sys_input;
|
|
|
|
$sql = "SELECT T_OrderHeaderID, T_OrderHeaderDate, T_OrderHeaderLabNumber,
|
|
GROUP_CONCAT(T_OrderDetailT_TestName SEPARATOR ', ') T_TestName
|
|
FROM t_orderheader
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
|
|
JOIN t_orderdetail ON T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
|
|
AND T_OrderDetailIsActive = 'Y'
|
|
AND T_OrderDetailT_TestIsPrice = 'Y'
|
|
WHERE T_OrderHeaderM_PatientID = ?
|
|
AND T_OrderHeaderIsActive = 'Y'
|
|
GROUP BY T_OrderHeaderID
|
|
ORDER BY T_OrderHeaderDate DESC
|
|
LIMIT 5";
|
|
$query = $this->db_onedev->query($sql, [$prm['patient_id']]);
|
|
if ($query)
|
|
{
|
|
$rows = $query->result_array();
|
|
$this->sys_ok(["records"=>$rows]);
|
|
}
|
|
else
|
|
{
|
|
$this->sys_error_db("Patient History count", $this->db_onedev);
|
|
}
|
|
}
|
|
}
|
|
?>
|