Initial import

This commit is contained in:
sas.fajri
2026-05-25 20:01:37 +07:00
commit 710d7c1b97
10371 changed files with 2381698 additions and 0 deletions

View File

@@ -0,0 +1,165 @@
<?php
/*
template function {
$this->sys_debug();
try {
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
} catch(Exception $exc) {
$message = $exc->getMessage();
$this->sys_error($message);
}
}
*/
class Patient_list extends MY_Controller
{
var $db_smartone;
public function index()
{
echo "Patient API";
}
public function __construct()
{
parent::__construct();
$this->db_smartone = $this->load->database("onedev", true);
}
public function search()
{
$prm = $this->sys_input;
$max_rst = 12;
$nolab = '%' . $prm["nolab"] . '%';
$search = '%' . $prm["search"] . '%';
if ($prm['nolab'] != '')
$nolab = "%{$prm['nolab']}%";
// QUERY TOTAL
$sql = "select count(*) total
from t_ordersample
join t_orderheader on t_ordersamplet_orderheaderid = t_orderheaderid
join m_patient on t_orderheaderm_patientid = m_patientid
join m_title on M_PatientM_TitleID = M_TitleID
join last_statussample on t_ordersamplet_orderheaderid = last_statussamplet_orderheaderid
and t_ordersamplet_sampletypeid = last_statussamplet_sampletypeid
and t_ordersamplebarcode = last_statussamplebarcode
join m_statussample on last_statussamplem_statussampleid = m_statussampleid
and m_statussamplecode = 'SAMPLING.Sampling.Sampled'
where T_OrderHeaderLabNumber like ?
and M_PatientName LIKE ?";
$query = $this->db_smartone->query($sql, array($nolab, $search));
if ($query) {
$tot_count = $query->result_array()[0]["total"];
}
else {
$this->sys_error_db("m_patient count", $this->db_smartone);
exit;
}
$sql = "select T_OrderHeaderID, T_OrderHeaderLabNumber lab, T_OrderHeaderDate `date`,
M_PatientID, M_PatientNoReg,
concat(M_TitleName,' ',M_PatientName) name,
T_OrderSampleBarcode sid, '' status, last_statussampleid id
from t_ordersample
join t_orderheader on t_ordersamplet_orderheaderid = t_orderheaderid
join m_patient on t_orderheaderm_patientid = m_patientid
join m_title on M_PatientM_TitleID = M_TitleID
join last_statussample on t_ordersamplet_orderheaderid = last_statussamplet_orderheaderid
and t_ordersamplet_sampletypeid = last_statussamplet_sampletypeid
and t_ordersamplebarcode = last_statussamplebarcode
join m_statussample on last_statussamplem_statussampleid = m_statussampleid
and m_statussamplecode = 'SAMPLING.Sampling.Sampled'
where T_OrderHeaderLabNumber like ?
and M_PatientName LIKE ?
order by t_orderheaderlabnumber desc
limit 0, {$max_rst}";
$query = $this->db_smartone->query($sql, array($nolab, $search));
if ($query) {
$rows = $query->result_array();
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows), "q" => $this->db_smartone->last_query());
$this->sys_ok($result);
}
else {
$this->sys_error_db("m_patient rows", $this->db_smartone);
exit;
}
}
public function search_sent()
{
$prm = $this->sys_input;
$max_rst = 12;
$nolab = '%' . $prm["nolab"] . '%';
$search = '%' . $prm["search"] . '%';
if ($prm['nolab'] != '')
$nolab = "%{$prm['nolab']}%";
// QUERY TOTAL
$sql = "select count(*) total
from t_ordersample
join t_orderheader on t_ordersamplet_orderheaderid = t_orderheaderid
join m_patient on t_orderheaderm_patientid = m_patientid
join m_title on M_PatientM_TitleID = M_TitleID
join last_statussample on t_ordersamplet_orderheaderid = last_statussamplet_orderheaderid
and t_ordersamplet_sampletypeid = last_statussamplet_sampletypeid
and t_ordersamplebarcode = last_statussamplebarcode
join m_statussample on last_statussamplem_statussampleid = m_statussampleid
and m_statussamplecode = 'SAMPLING.Sampling.To.Verification'
where T_OrderHeaderLabNumber like ?
and M_PatientName LIKE ?";
$query = $this->db_smartone->query($sql, array($nolab, $search));
if ($query) {
$tot_count = $query->result_array()[0]["total"];
}
else {
$this->sys_error_db("m_patient count", $this->db_smartone);
exit;
}
$sql = "select T_OrderHeaderID, T_OrderHeaderLabNumber lab, T_OrderHeaderDate `date`,
M_PatientID, M_PatientNoReg,
concat(M_TitleName,' ',M_PatientName) name,
T_OrderSampleBarcode sid, m_statussamplecode status, last_statussampleid id
from t_ordersample
join t_orderheader on t_ordersamplet_orderheaderid = t_orderheaderid
join m_patient on t_orderheaderm_patientid = m_patientid
join m_title on M_PatientM_TitleID = M_TitleID
join last_statussample on t_ordersamplet_orderheaderid = last_statussamplet_orderheaderid
and t_ordersamplet_sampletypeid = last_statussamplet_sampletypeid
and t_ordersamplebarcode = last_statussamplebarcode
join m_statussample on last_statussamplem_statussampleid = m_statussampleid
and (m_statussamplecode = 'SAMPLING.Sampling.To.Verification' or
m_statussamplecode = 'SAMPLING.Verification.From.Sampling')
where T_OrderHeaderLabNumber like ?
and M_PatientName LIKE ?
limit 0, {$max_rst}";
$query = $this->db_smartone->query($sql, array($nolab, $search));
if ($query) {
$rows = $query->result_array();
$result = array("total" => $tot_count, "records" => $rows, "total_display" => sizeof($rows), "q" => $this->db_smartone->last_query());
$this->sys_ok($result);
}
else {
$this->sys_error_db("m_patient rows", $this->db_smartone);
exit;
}
}
}

View File

@@ -0,0 +1,51 @@
<?php
class Verification extends MY_Controller
{
var $db_smartone;
function __construct()
{
parent::__construct();
$this->db_smartone = $this->load->database("onedev", true);
}
function send()
{
$prm = $this->sys_input;
$sql = "CALL sp_sampling_send_to_verification('{$prm['ids']}')";
$query = $this->db_smartone->query($sql);
if ($query)
{
$row = $query->row();
$this->sys_ok($row);
}
else {
$this->sys_error_db("sampling send", $this->db_smartone);
exit;
}
}
function remove()
{
$prm = $this->sys_input;
$sql = "CALL sp_sampling_remove_from_verification('{$prm['id']}')";
$query = $this->db_smartone->query($sql);
if ($query)
{
$row = $query->row();
$this->sys_ok($row);
}
else {
$this->sys_error_db("sampling remove", $this->db_smartone);
exit;
}
}
}
?>