Initial import
This commit is contained in:
73
application/controllers/etl/Getorder.php
Normal file
73
application/controllers/etl/Getorder.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
class Getorder extends MY_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo "GET RESULT";
|
||||
}
|
||||
|
||||
public function getdata()
|
||||
{
|
||||
try {
|
||||
$prm = $this->sys_input;
|
||||
$limit = 10;
|
||||
if (isset($prm['limit'])) {
|
||||
$limit = trim($prm["limit"]);
|
||||
$limit = $prm['limit'];
|
||||
}
|
||||
//tidak ada checking payment
|
||||
$sql = "SELECT
|
||||
T_OrderHeaderID,
|
||||
Mgm_McuID,
|
||||
T_OrderHeaderLabNumber as no_reg,
|
||||
T_OrderHeaderDate,
|
||||
concat(M_TitleName, ' ',
|
||||
ifnull(M_PatientPrefix,' '),
|
||||
M_PatientName,
|
||||
ifnull(M_PatientSuffix,'')
|
||||
) as nama_pasien,
|
||||
'' as test,
|
||||
M_PatientIdentifierValue M_PatientIDNumber,
|
||||
M_PatientHP,
|
||||
IFNULL(Mcu_OrderStatus,'-') as Mcu_OrderStatus,
|
||||
Mcu_OrderRetry
|
||||
from t_orderheader
|
||||
join t_orderdetail
|
||||
ON T_OrderHeaderID = T_OrderDetailT_OrderHeaderID
|
||||
AND T_OrderDetailIsActive = 'Y'
|
||||
AND T_OrderHeaderIsActive = 'Y'
|
||||
join m_patient
|
||||
ON T_OrderHeaderM_PatientID = M_PatientID
|
||||
join m_title
|
||||
on M_PatientM_TitleID = M_TitleID
|
||||
join mcu_order
|
||||
ON T_OrderHeaderID = Mcu_OrderT_OrderHeaderID
|
||||
and (Mcu_OrderStatus = 'C' OR Mcu_OrderStatus = 'R' OR Mcu_OrderStatus = 'E') AND Mcu_OrderRetry <= 5
|
||||
join mgm_mcu
|
||||
ON Mgm_McuID = Mcu_OrderMgm_McuID AND Mgm_McuIsActive = 'Y'
|
||||
group by T_OrderHeaderID
|
||||
limit $limit";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$last_qry = $this->db->last_query();
|
||||
if (!$query) {
|
||||
$error = array(
|
||||
"message" => $this->db->error()["message"],
|
||||
"sql" => $last_qry
|
||||
);
|
||||
$this->sys_error_db($error);
|
||||
exit;
|
||||
}
|
||||
$rows = $query->result_array();
|
||||
$this->sys_ok($rows);
|
||||
} catch (Exception $exc) {
|
||||
$message = $exc->getMessage();
|
||||
$this->sys_error($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user