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,192 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
class Barcode extends CI_Controller
{
function formulir() {
$orderId = $this->input->get("orderId");
$this->db_onedev = $this->load->database("onedev", true);
if ($orderId == "") $orderId= "'0'";
$sql = "select
DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg,
T_OrderHeaderLabNumber as nolab,
M_PatientNoReg as noreg,
CONCAT(M_TitleName,'. ',M_PatientName) AS M_PatientName,
T_OrderHeaderM_PatientAge as age,
DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB,
(SELECT M_PatientAddressDescription from m_patientaddress AS p
WHERE M_PatientAddressM_PatientID = M_PatientID
ORDER BY M_PatientAddressM_PatientID
LIMIT 1) AS alamat,
M_CityName as city,
CONCAT(M_DoctorPrefix,' ',M_DoctorName,' ',M_DoctorSufix) AS M_DoctorName,
group_concat(distinct T_TestName) as test ,
M_SexCode as sexcode, M_CompanyName as patienttype
from t_orderheader
join m_patient on T_OrderHeaderM_PatientID = M_PatientID
join t_orderdetail on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
join t_test on T_OrderDetailT_TestID = T_TestID
join m_title on M_PatientM_TitleID = M_TitleID
left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y'
left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y'
left join m_mou ON T_OrderHeaderM_MouID = M_MouID AND M_MouIsActive = 'Y'
left join m_doctor ON T_OrderHeaderSenderM_DoctorID = M_DoctorID AND M_DoctorIsActive = 'Y'
left join m_patientaddress on M_PatientAddressM_PatientID = M_PatientID
left join m_kelurahan on M_PatientAddressM_KelurahanID = M_KelurahanID
left join m_district on M_KelurahanM_DistrictID = M_DistrictID
left join m_city on M_DistrictM_CityID = M_CityID
where T_OrderHeaderID = $orderId
group by T_OrderHeaderID ";
$query = $this->db_onedev->query($sql);
$rows = $query->result_array();
$data = array();
if (count($rows) > 0 ) $data = $rows[0];
echo json_encode( array(
"status" => "OK",
"message" => "",
"rows" => $data
));
}
function so_group() {
$orderId = $this->input->get("orderId");
$this->db_onedev = $this->load->database("onedev", true);
if ($orderId == "") $orderId= "'0'";
$sql = "select
DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg,
T_OrderHeaderLabNumber as nolab,
M_PatientNoReg as noreg,
CONCAT(M_TitleName,'. ',M_PatientName) AS M_PatientName,
T_OrderHeaderM_PatientAge as age,
DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB,
(SELECT M_PatientAddressDescription from m_patientaddress AS p
WHERE M_PatientAddressM_PatientID = M_PatientID
ORDER BY M_PatientAddressM_PatientID
LIMIT 1) AS alamat,
M_CityName as city,
CONCAT(M_DoctorPrefix,' ',M_DoctorName,' ',M_DoctorSufix) AS M_DoctorName,
group_concat(distinct T_TestName separator ', ') as test ,
M_SexCode as sexcode, M_CompanyName as patienttype
from t_orderheader
join m_patient on T_OrderHeaderM_PatientID = M_PatientID
join t_orderdetail on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
join t_test on T_OrderDetailT_TestID = T_TestID
join so_resultentry on T_OrderDetailID = So_ResultEntryT_OrderDetailID
join m_title on M_PatientM_TitleID = M_TitleID
left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y'
left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y'
left join m_mou ON T_OrderHeaderM_MouID = M_MouID AND M_MouIsActive = 'Y'
left join m_doctor ON T_OrderHeaderSenderM_DoctorID = M_DoctorID AND M_DoctorIsActive = 'Y'
left join m_patientaddress on M_PatientAddressM_PatientID = M_PatientID
left join m_kelurahan on M_PatientAddressM_KelurahanID = M_KelurahanID
left join m_district on M_KelurahanM_DistrictID = M_DistrictID
left join m_city on M_DistrictM_CityID = M_CityID
where T_OrderHeaderID = $orderId and T_TestIsResult ='y' and T_TestIsNonLab <> ''
group by T_OrderHeaderID ";
$query = $this->db_onedev->query($sql);
$rows = $query->result_array();
$data = array();
if (count($rows) > 0 ) $data = $rows[0];
echo json_encode( array(
"status" => "OK",
"message" => "",
"rows" => $data
));
}
/*
//+ "^FT5,200^A0N,23,24^FH\^FD"+ data.city+"^FS"+ "\n"
//+ "^FT5,175^A0N,23,24^FH\^FD" + data.address + "^FS"+ "\n"
//+ "^FT3,150^A0N,28,28^FH\^FD"+ data.title+" "+ data.patientName +"^FS"+ "\n"
//+ "^BY3,3,45^FT22,70^BCN,,Y,N"+ "\n"
//+ "^FD>;" + xbarcodeId + "^FS"+ "\n"
//+ "^FT5,225^A0N,23,24^FH\^FD"+ data.patienttype +"^FS"+ "\n"
//+ "^PQ1,0,1,Y^XZ"+ "\n"
*/
function so() {
$orderId= $this->input->get("orderId");
$this->db_onedev = $this->load->database("onedev", true);
if ($orderId == "") $orderId = "'0'";
// orderId = order detail id
$sql = "select
DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg,
T_OrderHeaderLabNumber as nolab,
M_PatientNoReg as noreg,
CONCAT(M_TitleName,'. ',M_PatientName) AS M_PatientName,
T_OrderHeaderM_PatientAge as age,
DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB,
(SELECT M_PatientAddressDescription from m_patientaddress AS p
WHERE M_PatientAddressM_PatientID = M_PatientID
ORDER BY M_PatientAddressM_PatientID
LIMIT 1) AS alamat,
M_CityName as city,
CONCAT(M_DoctorPrefix,' ',M_DoctorName,' ',M_DoctorSufix) AS M_DoctorName,
T_TestName as test ,
M_SexCode as sexcode, M_CompanyName as patienttype
from t_orderheader
join m_patient on T_OrderHeaderM_PatientID = M_PatientID
join t_orderdetail on T_OrderHeaderID = T_OrderDetailT_OrderHeaderID and T_OrderDetailID = $orderId
join t_test on T_OrderDetailT_TestID = T_TestID
join so_resultentry on T_OrderDetailID = So_ResultEntryT_OrderDetailID
join m_title on M_PatientM_TitleID = M_TitleID
left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y'
left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y'
left join m_mou ON T_OrderHeaderM_MouID = M_MouID AND M_MouIsActive = 'Y'
left join m_doctor ON T_OrderHeaderSenderM_DoctorID = M_DoctorID AND M_DoctorIsActive = 'Y'
left join m_patientaddress on M_PatientAddressM_PatientID = M_PatientID
left join m_kelurahan on M_PatientAddressM_KelurahanID = M_KelurahanID
left join m_district on M_KelurahanM_DistrictID = M_DistrictID
left join m_city on M_DistrictM_CityID = M_CityID";
$query = $this->db_onedev->query($sql);
$rows = $query->result_array();
echo json_encode( array(
"status" => "OK",
"message" => "",
"rows" => $rows
));
}
function pk() {
$barcodeId = $this->input->get("barcodeId");
$this->db_onedev = $this->load->database("onedev", true);
if ($barcodeId == "") $barcodeId = "'0'";
$a_bcodes = explode(",", $barcodeId);
$s_bcode = "";
foreach($a_bcodes as $b) {
if ($s_bcode != "") $s_bcode .= ",";
$s_bcode .= "'$b'";
}
$sql = "select
RIGHT(T_OrderHeaderLabNumber,7 ) T_OrderHeaderLabNumber ,
T_OrderHeaderLabNumber Full_T_OrderHeaderLabNumber,
T_SampleTypeName,
T_BarcodeLabBarcode ,
concat(M_TitleName, ' ', M_PatientName) M_PatientName,
M_PatientNoReg,
T_OrderHeaderM_PatientAge,
DATE_FORMAT(T_OrderHeaderDate,'%d/%m/%Y %T') T_OrderHeaderDate
from t_barcodelab
join t_sampletype on T_BarcodeLabT_SampleTypeID = T_SampleTypeID
join t_orderheader on T_BarcodeLabT_OrderHeaderID = T_OrderHeaderID
join m_patient on T_OrderHeaderM_PatientID = M_PatientID
join m_title on M_PatientM_TitleID = M_TitleID
where T_BarcodeLabBarcode in ( $s_bcode ) ";
$query = $this->db_onedev->query($sql);
$rows = $query->result_array();
echo json_encode( array(
"status" => "OK",
"message" => "",
"rows" => $rows
));
}
}
?>

View File

@@ -0,0 +1,136 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
class Barcode extends CI_Controller
{
function so_group() {
$orderId = $this->input->get("orderId");
$this->db_onedev = $this->load->database("onedev", true);
if ($orderId == "") $orderId= "'0'";
$sql = "select
DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg,
T_OrderHeaderLabNumber as nolab,
M_PatientNoReg as noreg,
CONCAT(M_TitleName,'. ',M_PatientName) AS M_PatientName,
T_OrderHeaderM_PatientAge as age,
DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB,
(SELECT M_PatientAddressDescription from m_patientaddress AS p
WHERE M_PatientAddressM_PatientID = M_PatientID
ORDER BY M_PatientAddressM_PatientID
LIMIT 1) AS alamat,
M_CityName as city,
CONCAT(M_DoctorPrefix,' ',M_DoctorName,' ',M_DoctorSufix) AS M_DoctorName,
group_concat(distinct T_TestName) as test ,
M_SexCode as sexcode, M_CompanyName as patienttype
from t_orderheader
join m_patient on T_OrderHeaderM_PatientID = M_PatientID
join t_orderdetail on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
join t_test on T_OrderDetailT_TestID = T_TestID
join so_resultentry on T_OrderDetailID = So_ResultEntryT_OrderDetailID
join m_title on M_PatientM_TitleID = M_TitleID
left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y'
left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y'
left join m_mou ON T_OrderHeaderM_MouID = M_MouID AND M_MouIsActive = 'Y'
left join m_doctor ON T_OrderHeaderSenderM_DoctorID = M_DoctorID AND M_DoctorIsActive = 'Y'
left join m_patientaddress on M_PatientAddressM_PatientID = M_PatientID
left join m_kelurahan on M_PatientAddressM_KelurahanID = M_KelurahanID
left join m_district on M_KelurahanM_DistrictID = M_DistrictID
left join m_city on M_DistrictM_CityID = M_CityID
where T_OrderHeaderID = $orderId and T_TestIsResult ='y' and T_TestIsNonLab <> ''
group by T_OrderHeaderID ";
$query = $this->db_onedev->query($sql);
$rows = $query->result_array();
$data = array();
if (count($rows) > 0 ) $data = $rows[0];
echo json_encode( array(
"status" => "OK",
"message" => "",
"rows" => $data
));
}
/*
//+ "^FT5,200^A0N,23,24^FH\^FD"+ data.city+"^FS"+ "\n"
//+ "^FT5,175^A0N,23,24^FH\^FD" + data.address + "^FS"+ "\n"
//+ "^FT3,150^A0N,28,28^FH\^FD"+ data.title+" "+ data.patientName +"^FS"+ "\n"
//+ "^BY3,3,45^FT22,70^BCN,,Y,N"+ "\n"
//+ "^FD>;" + xbarcodeId + "^FS"+ "\n"
//+ "^FT5,225^A0N,23,24^FH\^FD"+ data.patienttype +"^FS"+ "\n"
//+ "^PQ1,0,1,Y^XZ"+ "\n"
*/
function so() {
$orderId= $this->input->get("orderId");
$this->db_onedev = $this->load->database("onedev", true);
if ($orderId == "") $orderId = "'0'";
// orderId = order detail id
$sql = "select
DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg,
T_OrderHeaderLabNumber as nolab,
M_PatientNoReg as noreg,
CONCAT(M_TitleName,'. ',M_PatientName) AS M_PatientName,
T_OrderHeaderM_PatientAge as age,
DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB,
(SELECT M_PatientAddressDescription from m_patientaddress AS p
WHERE M_PatientAddressM_PatientID = M_PatientID
ORDER BY M_PatientAddressM_PatientID
LIMIT 1) AS alamat,
M_CityName as city,
CONCAT(M_DoctorPrefix,' ',M_DoctorName,' ',M_DoctorSufix) AS M_DoctorName,
T_TestName as test ,
M_SexCode as sexcode, M_CompanyName as patienttype
from t_orderheader
join m_patient on T_OrderHeaderM_PatientID = M_PatientID
join t_orderdetail on T_OrderHeaderID = T_OrderDetailT_OrderHeaderID and T_OrderDetailID = $orderId
join t_test on T_OrderDetailT_TestID = T_TestID
join so_resultentry on T_OrderDetailID = So_ResultEntryT_OrderDetailID
join m_title on M_PatientM_TitleID = M_TitleID
left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y'
left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y'
left join m_mou ON T_OrderHeaderM_MouID = M_MouID AND M_MouIsActive = 'Y'
left join m_doctor ON T_OrderHeaderSenderM_DoctorID = M_DoctorID AND M_DoctorIsActive = 'Y'
left join m_patientaddress on M_PatientAddressM_PatientID = M_PatientID
left join m_kelurahan on M_PatientAddressM_KelurahanID = M_KelurahanID
left join m_district on M_KelurahanM_DistrictID = M_DistrictID
left join m_city on M_DistrictM_CityID = M_CityID";
$query = $this->db_onedev->query($sql);
$rows = $query->result_array();
echo json_encode( array(
"status" => "OK",
"message" => "",
"rows" => $rows
));
}
function pk() {
$barcodeId = $this->input->get("barcodeId");
$this->db_onedev = $this->load->database("onedev", true);
if ($barcodeId == "") $barcodeId = "'0'";
$a_bcodes = explode(",", $barcodeId);
$s_bcode = "";
foreach($a_bcodes as $b) {
if ($s_bcode != "") $s_bcode .= ",";
$s_bcode .= "'$b'";
}
$sql = "select
T_OrderHeaderLabNumber , T_SampleTypeName, T_BarcodeLabBarcode ,
concat(M_TitleName, ' ', M_PatientName) M_PatientName
from t_barcodelab
join t_sampletype on T_BarcodeLabT_SampleTypeID = T_SampleTypeID
join t_orderheader on T_BarcodeLabT_OrderHeaderID = T_OrderHeaderID
join m_patient on T_OrderHeaderM_PatientID = M_PatientID
join m_title on M_PatientM_TitleID = M_TitleID
where T_BarcodeLabBarcode in ( $s_bcode ) ";
$query = $this->db_onedev->query($sql);
$rows = $query->result_array();
echo json_encode( array(
"status" => "OK",
"message" => "",
"rows" => $rows
));
}
}
?>

View File

@@ -0,0 +1,14 @@
<?php
class Code128 extends CI_Controller
{
function test() {
echo "Test";
}
function index(){
$no = $this->input->get("no");
$generator = new Picqer\Barcode\BarcodeGeneratorJPG();
header('Content-type: image/jpg');
echo $generator->getBarcode($no, $generator::TYPE_CODE_128);
}
}
?>

View File

@@ -0,0 +1,17 @@
<?php
class Photo extends CI_Controller
{
var $base_dir = "/home/one/project/one/one-media/one-photo/patient/";
function test() {
echo "Test";
}
function small(){
$y = $this->input->get("y");
$pid = $this->input->get("pid");
$foto_file = $this->base_dir . "$y" . "/" . $pid . "_thumb.jpg";
header('Content-type: image/jpg');
echo file_get_contents($foto_file);
}
}
?>

View File

@@ -0,0 +1,61 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
class Portserver extends MY_Controller
{
public function __construct() {
parent::__construct();
$this->db_one = $this->load->database("onedev", true);
}
function raw() {
$param = $this->sys_input;
try {
$instrumentID = $param["instrumentID"];
$data = $param["data"];
$sql = "insert into itf_raw(itf_RawNat_InstrumentID,itf_RawData)
values(?,?)";
$this->db_one->query($sql, array($instrumentID, base64_decode($data)));
echo json_encode(
array("status" => "OK" , "id" => $this->db_one->insert_id() , "message" => "")
);
} catch(exception $e) {
echo json_encode(
array("status" => "ERR" , "id" => 0, "message" => $e.message() )
);
}
}
function result() {
$param = $this->sys_input;
try {
$instrumentID = $param["instrumentID"];
$rawID = $param["rawID"];
$result= $param["result"];
$noreg = $result["nolab"];
$sql = "insert into itf_result(itf_ResultNat_InstrumentID, itf_ResultItf_RawID,
Itf_ResultNoreg, Itf_ResultInstrumentDate, itf_ResultKode, itf_ResultResult, itf_ResultFlag)
values(?,?,?,?,?,?,?)";
foreach($result["result"] as $r) {
$tgl = $r["date"];
$px = $r["px"];
$result = $r["result"];
$this->db_one->query($sql,
array($instrumentID, $rawID, $noreg, $tgl , $px,
$result,$r["flag"]));
echo $this->db_one->last_query();
}
echo json_encode(
array("status" => "OK" , "message" => "")
);
} catch(exception $e) {
echo json_encode(
array("status" => "ERR" , "message" => $e.message() )
);
}
}
function order() {
$param = $this->sys_input;
}
}
?>

View File

@@ -0,0 +1,51 @@
<?php
class Queue extends MY_Controller
{
public function __construct() {
parent::__construct();
$this->db_smartone = $this->load->database("onedev", true);
}
function now() {
$sql = "select
ifnull( sum( if(queueStatusTicket + interval 5 minute > now() , 1, 0) ), 0 ) Less5Min,
ifnull( sum( if(queueStatusTicket + interval 5 minute <= now() , 1, 0) ), 0 ) More5Min
from antrione.queue
join antrione.queue_status on queueID = queueStatusQueueID
and queueStatusFirstCall is null
and date(queueStatusTicket) = date(now()) ";
$qry = $this->db_smartone->query($sql);
if ($qry) {
$rows = $qry->result_array();
$this->sys_ok(
$rows[0]
);
} else {
$this->sys_error_db(
"",
$this->db_smartone
);
}
}
function status() {
$sql = "select
HourStepHour Hour, count(*) Total,
sum(if(queueStatusTicket + interval 5 minute > queueStatusFirstCall , 1, 0)) Less5Min,
sum(if(queueStatusTicket + interval 5 minute <= queueStatusFirstCall , 1, 0)) More5Min
from antrione.hourstep
left join antrione.queue_status on HourStepHour = hour(queueStatusTicket)
group by HourStepHour ";
$qry = $this->db_smartone->query($sql);
if ($qry) {
$rows = $qry->result_array();
$this->sys_ok(
$rows
);
} else {
$this->sys_error_db(
"",
$this->db_smartone
);
}
}
}
?>

View File

@@ -0,0 +1,87 @@
<?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
);
}
}
}
?>