88 lines
3.3 KiB
PHP
88 lines
3.3 KiB
PHP
<?php
|
|
// curl -d '{"station_id":1}' http://sasone.aplikasi.web.id/one-api/v1/su/samplinglab/process
|
|
//
|
|
class Samplinglab extends MY_Controller
|
|
{
|
|
public function __construct() {
|
|
parent::__construct();
|
|
$this->db_smartone = $this->load->database("onedev", true);
|
|
}
|
|
function list() {
|
|
$prm = $this->sys_input;
|
|
$station_id = $prm["station_id"];
|
|
$start_date = date("Y-m-d 00:00:01");
|
|
$end_date = date("Y-m-d 23:59:59");
|
|
$sql = "select
|
|
concat(M_TitleName,' ',M_PatientName) Name,
|
|
fn_numbering_external(T_OrderHeaderLabNumber) Noreg,
|
|
case
|
|
when T_SamplingQueueLastStatusT_SamplingQueueStatusID is null then 'Tunggu'
|
|
when T_SamplingQueueLastStatusT_SamplingQueueStatusID = 1 then 'Panggil'
|
|
when T_SamplingQueueLastStatusT_SamplingQueueStatusID = 2 then 'Skip'
|
|
end Status
|
|
from t_orderheader
|
|
join m_patient on M_PatientID = T_OrderHeaderM_PatientID
|
|
and T_OrderHeaderIsActive = 'Y'
|
|
join m_title on M_TitleID = M_PatientM_TitleID
|
|
join t_ordersample on T_OrderSampleT_OrderHeaderID = T_OrderHeaderID
|
|
left join t_sampling_queue_last_status
|
|
on T_OrderHeaderID = T_SamplingQueueLastStatusT_OrderHeaderID
|
|
where ( T_SamplingQueueLastStatusT_SamplingQueueStatusID <= 2 or
|
|
T_SamplingQueueLastStatusT_SamplingQueueStatusID is null )
|
|
and T_OrderHeaderDate > '$start_date' and T_OrderHeaderDate < '$end_date'
|
|
and T_OrderSampleT_SampleStationID = $station_id
|
|
group by T_OrderHeaderID
|
|
order by T_OrderHeaderIsCito desc, T_OrderHeaderID
|
|
";
|
|
$qry = $this->db_smartone->query($sql);
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
$this->sys_ok(
|
|
$rows
|
|
);
|
|
} else {
|
|
$this->sys_error_db(
|
|
"",
|
|
$this->db_smartone
|
|
);
|
|
}
|
|
}
|
|
function process() {
|
|
$prm = $this->sys_input;
|
|
$station_id = $prm["station_id"];
|
|
$start_date = date("Y-m-d 00:00:01");
|
|
$end_date = date("Y-m-d 23:59:59");
|
|
$sql = "select
|
|
concat(M_TitleName,' ',M_PatientName) Name,
|
|
fn_numbering_external(T_OrderHeaderLabNumber) Noreg,
|
|
case
|
|
when T_SamplingQueueLastStatusT_SamplingQueueStatusID = 1 then 'Tunggu'
|
|
when T_SamplingQueueLastStatusT_SamplingQueueStatusID = 2 then 'Tunggu'
|
|
when T_SamplingQueueLastStatusT_SamplingQueueStatusID = 3 then 'Proses'
|
|
end Status
|
|
from t_sampling_queue_last_status
|
|
join t_orderheader on T_SamplingQueueLastStatusT_OrderHeaderID = T_OrderHeaderID
|
|
and T_OrderHeaderIsActive = 'Y'
|
|
join m_patient on M_PatientID = T_OrderHeaderM_PatientID
|
|
join m_title on M_TitleID = M_PatientM_TitleID
|
|
where T_SamplingQueueLastStatusT_SamplingQueueStatusID = 3
|
|
and T_OrderHeaderDate > '$start_date' and T_OrderHeaderDate < '$end_date'
|
|
and T_SamplingQueueLastStatusT_SampleStationID = $station_id
|
|
order by T_OrderHeaderIsCito desc, T_OrderHeaderID
|
|
";
|
|
$qry = $this->db_smartone->query($sql);
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
$this->sys_ok(
|
|
$rows
|
|
);
|
|
} else {
|
|
$this->sys_error_db(
|
|
"",
|
|
$this->db_smartone
|
|
);
|
|
}
|
|
}
|
|
}
|
|
?>
|