132 lines
5.6 KiB
PHP
132 lines
5.6 KiB
PHP
<?php
|
|
|
|
class Nonlab extends MY_Controller
|
|
{
|
|
|
|
|
|
|
|
function get_call($station_id=NULL,$trx_date=NULL,$status=NULL) {
|
|
|
|
$this->db_onedev = $this->load->database("onedev", true);
|
|
$sql = " SELECT CONCAT(IFNULL(M_TitleName,''),' ',IFNULL(M_PatientPrefix,''),M_PatientName,IFNULL(M_PatientSuffix,'')) as patient_name,
|
|
T_SamplingQueueLastStatusID as trx_id,
|
|
T_SampleStationName as sample_station,
|
|
T_OrderHeaderLabNumber as nolab,
|
|
T_OrderHeaderLabNumberExt as nolab_ext
|
|
FROM t_sampling_queue_last_status
|
|
JOIN t_orderheader ON T_OrderHeaderID = T_SamplingQueueLastStatusT_OrderHeaderID
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
|
|
LEFT JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
|
JOIN t_samplestation ON T_SamplingQueueLastStatusT_SampleStationID = T_SampleStationID AND
|
|
T_SampleStationIsActive = 'Y'
|
|
WHERE
|
|
T_SamplingQueueLastStatusT_SampleStationID = ? AND
|
|
T_SamplingQueueLastStatusT_SamplingQueueStatusID = ? AND
|
|
DATE(T_SamplingQueueLastStatusLastUpdated) = ? AND
|
|
T_SamplingQueueLastStatusIsActive = 'Y'";
|
|
$query = $this->db_onedev->query($sql,array($station_id,$status,$trx_date));
|
|
|
|
if ($query)
|
|
{
|
|
$row = $query->result_array();
|
|
$s_data = $row;
|
|
$this->sys_ok($s_data);
|
|
exit;
|
|
}
|
|
//echo $this->db_onedev->last_query();
|
|
$this->sys_error_db("NOT FOUND CALL", $this->db_onedev);
|
|
|
|
}
|
|
|
|
function get_data($station_id=NULL,$trx_date=NULL) {
|
|
|
|
$this->db_onedev = $this->load->database("onedev", true);
|
|
$sql = "SELECT T_OrderHeaderID as order_id,
|
|
T_OrderHeaderLabNumber as nolab,
|
|
T_OrderHeaderLabNumberExt as nolab_ext,
|
|
CONCAT(IFNULL(M_TitleName,''),' ',IFNULL(M_PatientPrefix,''),M_PatientName,IFNULL(M_PatientSuffix,'')) as patient_name,
|
|
IFNULL(T_SamplingQueueStatusName,'new') as status,
|
|
IFNULL(T_SamplingQueueLastStatusT_SamplingQueueStatusID,0) as last_status_id
|
|
FROM t_orderheader
|
|
JOIN t_orderheaderaddon ON T_OrderHeaderAddOnT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
|
|
LEFT JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
|
LEFT JOIN t_orderpromise ON T_OrderPromiseT_OrderHeaderID = T_OrderHeaderID AND T_OrderPromiseIsActive = 'Y'
|
|
JOIN t_orderdetail ON T_OrderDetailT_OrderHeaderID = T_OrderHeaderID AND T_OrderDetailIsActive = 'Y'
|
|
JOIN t_test ON T_OrderDetailT_TestID = T_TestID AND T_TestIsResult = 'Y'
|
|
JOIN t_sampletype ON T_TestT_SampleTypeID = T_SampleTypeID
|
|
JOIN t_bahan ON T_SampleTypeT_BahanID = T_BahanID
|
|
JOIN t_samplestation ON T_BahanT_SampleStationID = T_SampleStationID AND T_SampleStationID = ?
|
|
JOIN last_status ON Last_StatusT_OrderHeaderID = T_OrderHeaderID
|
|
LEFT JOIN t_samplingso ON T_SamplingSoT_OrderHeaderID = T_OrderHeaderID AND
|
|
T_SamplingSoT_TestID = T_TestID AND
|
|
T_SamplingSoT_SampleStationID = T_SampleStationID AND
|
|
T_SamplingSoIsActive = 'Y'
|
|
LEFT JOIN t_sampling_queue_last_status ON T_OrderHeaderID = T_SamplingQueueLastStatusT_OrderHeaderID
|
|
LEFT JOIN t_sampling_queue_status ON T_SamplingQueueLastStatusT_SamplingQueueStatusID = T_SamplingQueueStatusID AND
|
|
T_SamplingCallStatusIsActive = 'Y'
|
|
WHERE
|
|
T_OrderHeaderIsActive = 'Y' AND
|
|
( DATE(T_OrderHeaderAddonIsComingDate) = ? OR DATE(T_OrderHeaderDate) = ? )
|
|
GROUP BY T_OrderHeaderID
|
|
HAVING fn_fo_get_laststatus(T_OrderHeaderID) IN (3,5) AND last_status_id NOT IN (1,3,5)
|
|
ORDER BY T_OrderHeaderIsCito DESC, T_OrderHeaderID ASC";
|
|
//echo $sql;
|
|
$query = $this->db_onedev->query($sql,array($station_id,$trx_date,$trx_date));
|
|
|
|
if ($query)
|
|
{
|
|
$row = $query->result_array();
|
|
$s_data = $row;
|
|
$this->sys_ok($s_data);
|
|
exit;
|
|
}
|
|
//echo $this->db_onedev->last_query();
|
|
$this->sys_error_db("NOT FOUND CALL", $this->db_onedev);
|
|
|
|
}
|
|
|
|
function get_station(){
|
|
$this->db_onedev = $this->load->database("onedev", true);
|
|
$sql = " SELECT T_SampleStationID as id,
|
|
T_SampleStationCode as code,
|
|
T_SampleStationName as name,
|
|
T_SampleStationIsNonLab as is_nonlab
|
|
FROM t_samplestation
|
|
WHERE
|
|
T_SampleStationIsActive = 'Y'";
|
|
$query = $this->db_onedev->query($sql);
|
|
|
|
if ($query)
|
|
{
|
|
$row = $query->result_array();
|
|
$s_data = $row;
|
|
$this->sys_ok($s_data);
|
|
exit;
|
|
}
|
|
$this->sys_error_db("NOT FOUND CALL", $this->db_onedev);
|
|
}
|
|
|
|
function get_images(){
|
|
$dir = "/home/one/project/one/one-media/one-antrian/nonlab/";
|
|
$files = scandir($dir);
|
|
$results = [];
|
|
foreach ($files as $key => $value) {
|
|
$path = realpath($dir . DIRECTORY_SEPARATOR . $value);
|
|
if (!is_dir($path)) {
|
|
$results[] = $_SERVER['SERVER_NAME']."/one-media/one-antrian/nonlab/".basename($path, ".pdf");
|
|
} else if ($value != "." && $value != "..") {
|
|
getDirContents($path, $results);
|
|
$results[] = $_SERVER['SERVER_NAME']."/one-media/one-antrian/nonlab/".basename($path, ".pdf");
|
|
}
|
|
}
|
|
$this->sys_ok($results);
|
|
exit;
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
?>
|