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,29 @@
<?php
class Agama extends MY_Controller
{
public function __construct() {
parent::__construct();
$this->db_smartone = $this->load->database("regional", true);
}
function list() {
$sql = "select * from m_religion";
$qry = $this->db_smartone->query($sql);
if ($qry) {
$rows = $qry->result_array();
echo json_encode($rows);
} else {
echo json_encode(array());
}
}
function get($id) {
$sql = "select * from m_religion where M_ReligionID=?";
$qry = $this->db_smartone->query($sql,$id);
if ($qry) {
$rows = $qry->result_array();
echo json_encode($rows);
} else {
echo json_encode(array());
}
}
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,352 @@
<?php
class Fisik extends MY_Controller
{
public function __construct() {
parent::__construct();
$this->db_smartone = $this->load->database("onedev", true);
}
function pribadi($id,$langid) {
//$id = So_ResultEntryID
$sql = "select concat(M_TitleName,' ', M_PatientName) M_PatientName,
T_OrderHeaderLabNumber RegNo, fn_numbering_external(T_OrderHeaderLabNumber) ExternalRegNo,
T_OrderHeaderM_PatientAge,
date_format(M_PatientDOB,'%d-%m-%Y') M_PatientDOB ,
date_format(T_OrderHeaderDate,'%d-%m-%Y') T_OrderHeaderDate,
M_SexName,
(SELECT concat(M_PatientAddressDescription,' ',M_KelurahanName,' ' ,M_DistrictName,' ',M_CityName) from m_patientaddress AS p
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 M_PatientAddressM_PatientID = M_PatientID
ORDER BY M_PatientAddressM_PatientID
LIMIT 1) AS M_PatientAddressDescription
from so_resultentry
join t_orderheader on So_ResultEntryT_OrderHeaderID = T_OrderHeaderID
and So_ResultEntryID = ?
join m_patient on M_PatientID = T_OrderHeaderM_PatientID
join m_title on M_PatientM_TitleID = M_TitleID
left join m_sex on M_PatientM_SexID = M_SexID
";
$qry = $this->db_smartone->query($sql,array($id));
if ($qry) {
$rows = $qry->result_array();
foreach($rows as $idx => $r ) {
$rows[$idx]["keluhan_saat_ini"] = $this->keluhan_saat_ini($id,$langid);
$rows[$idx]["phobia"] = $this->phobia($id,$langid);
}
echo json_encode($rows);
} else {
echo json_encode(array());
}
}
function phobia($id,$langid) {
$sql = "select * from so_resultentry_fisik_umum
where So_ResultEntryFisikUmumSo_ResultEntryID= ?
and So_ResultEntryFisikUmumM_LangID=?
and So_ResultEntryFisikUmumType='riwayat'";
$qry = $this->db_smartone->query($sql,array($id,$langid));
if (! $qry) {
return "";
}
$rows = $qry->result_array();
if (count($rows) == 0 ) {
return "";
}
$details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
//keluhan saat ini
$phobia = "";
foreach($details as $d) {
if ($d["title"] == "RIWAYAT POBIA") {
if ($d["flag_normal"] == "Y") {
$phobia = $d["label_flag_normal"];
break;
} else {
foreach($d["details"] as $xd) {
if ($xd["chx"] == "1" ) {
if ( $phobia != "" ) $phobia .= ", ";
$phobia .= $xd["label"];
if ($xd["value"] != "") $phobia .= " (" .$xd["value"] . ")";
}
}
}
}
}
return $phobia;
}
function keluhan_saat_ini($id,$langid) {
$sql = "select * from so_resultentry_fisik_umum
where So_ResultEntryFisikUmumSo_ResultEntryID= ?
and So_ResultEntryFisikUmumM_LangID=?
and So_ResultEntryFisikUmumType='riwayat'";
$qry = $this->db_smartone->query($sql,array($id,$langid));
if (! $qry) {
return "";
}
$rows = $qry->result_array();
if (count($rows) == 0 ) {
return "";
}
$details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
//keluhan saat ini
$keluhan_saat_ini = "";
foreach($details as $d) {
if ($d["title"] == "KELUHAN SAAT INI") {
if ($d["flag_normal"] == "Y") {
$keluhan_saat_ini = $d["label_flag_normal"];
break;
} else {
foreach($d["details"] as $xd) {
if ($xd["chx"] == "1" ) {
if ( $keluhan_saat_ini != "" ) $keluhan_saat_ini .= ", ";
$keluhan_saat_ini .= $xd["label"];
}
}
}
}
}
return $keluhan_saat_ini;
}
function riwayat_penyakit($id,$langid) {
$sql = "select * from so_resultentry_fisik_umum
where So_ResultEntryFisikUmumSo_ResultEntryID= ?
and So_ResultEntryFisikUmumM_LangID=?
and So_ResultEntryFisikUmumType='riwayat'";
$qry = $this->db_smartone->query($sql,array($id,$langid));
if (! $qry) {
return "";
}
$rows = $qry->result_array();
if (count($rows) == 0 ) {
return "";
}
$details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
//keluhan saat ini
$riwayat_penyakit = array();
foreach($details as $d) {
if ($d["title"] == "RIWAYAT PENYAKIT") {
if ($d["flag_normal"] == "Y") {
$riwayat_penyakit = $d["label_flag_normal"];
break;
} else {
$prev_group = "";
$chex_group = array();
$tot_baris= 0;
$arr_result = array();
foreach($d["details"] as $gp) {
$group = $gp["name"];
if ($group == "Allergi" ) continue;
$have_detail = false;
foreach($gp["details"] as $xd ) {
if ($xd["chx"] == 1 ) {
$have_detail = true;
}
}
if ($have_detail) {
$arr_result[] = array($group, "", "","") ;
foreach($gp["details"] as $xd ) {
if ($xd["chx"] == 1 ) {
$arr_result[] = array($xd["label"], "X", "",$xd["value"]) ;
}
}
}
}
$tot_baris = ceil( count($arr_result) / 2 ) ;
for($i=0; $i < $tot_baris ; $i++) {
$left = $arr_result[$i];
$right = array("","","","");
if ( isset($arr_result[$i+$tot_baris]) ) {
$right = $arr_result[$i+$tot_baris];
}
$riwayat_penyakit[] = array(
"c1" => $left[0],
"c2" => $left[1],
"c3" => $left[2],
"c4" => $left[3],
"c5" => $right[0],
"c6" => $right[1],
"c7" => $right[2],
"c8" => $right[3],
);
}
}
}
}
echo json_encode($riwayat_penyakit);
//return ($riwayat_penyakit);
}
//riwayat penyakit keluarga
function penyakit_keluarga($id,$langid) {
$sql = "select * from so_resultentry_fisik_umum
where So_ResultEntryFisikUmumSo_ResultEntryID= ?
and So_ResultEntryFisikUmumM_LangID=?
and So_ResultEntryFisikUmumType='riwayat'";
$qry = $this->db_smartone->query($sql,array($id,$langid));
if (! $qry) {
return "";
}
$rows = $qry->result_array();
if (count($rows) == 0 ) {
return "";
}
$details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
//keluhan saat ini
$penyakit_keluarga = array();
foreach($details as $d) {
if ($d["title"] == "RIWAYAT PENYAKIT KELUARGA") {
if ($d["flag_normal"] == "Y") {
$penyakit_keluarga = $d["label_flag_normal"];
break;
} else {
$prev_group = "";
$chex_group = array();
$tot_baris= 0;
$arr_result = array();
foreach($d["details"] as $gp) {
if ($gp["chx"] == 1 ) {
$arr_result[] = array($gp["label"], "X", "",$gp["value"]) ;
}
}
$tot_baris = ceil( count($arr_result) / 2 ) ;
for($i=0; $i < $tot_baris ; $i++) {
$left = $arr_result[$i];
$right = array("","","","");
if ( isset($arr_result[$i+$tot_baris]) ) {
$right = $arr_result[$i+$tot_baris];
}
$penyakit_keluarga[] = array(
"d1" => $left[0],
"d2" => $left[1],
"d3" => $left[2],
"d4" => $left[3],
"d5" => $right[0],
"d6" => $right[1],
"d7" => $right[2],
"d8" => $right[3],
);
}
}
}
}
echo json_encode($penyakit_keluarga);
//return ($penyakit_keluarga);
}
function riwayat_alergi($id,$langid) {
$sql = "select * from so_resultentry_fisik_umum
where So_ResultEntryFisikUmumSo_ResultEntryID= ?
and So_ResultEntryFisikUmumM_LangID=?
and So_ResultEntryFisikUmumType='riwayat'";
$qry = $this->db_smartone->query($sql,array($id,$langid));
if (! $qry) {
return "";
}
$rows = $qry->result_array();
if (count($rows) == 0 ) {
return "";
}
$details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
//keluhan saat ini
$riwayat_alergi = array();
foreach($details as $d) {
if ($d["title"] == "RIWAYAT PENYAKIT") {
if ($d["flag_normal"] == "Y") {
$riwayat_alergi = $d["label_flag_normal"];
break;
} else {
$prev_group = "";
$chex_group = array();
$tot_baris= 0;
$arr_result = array();
foreach($d["details"] as $gp) {
$group = $gp["name"];
if ($group != "Allergi" ) continue;
foreach($gp["details"] as $xd ) {
if ($xd["chx"] == 1 ) {
$arr_result = array($xd["label"], "Ya", "",$xd["value"]) ;
} else {
$arr_result = array($xd["label"], "Tidak", "X",$xd["value"]) ;
}
$riwayat_alergi[] = array(
"a1" => $arr_result[0],
"a2" => $arr_result[1],
"a3" => $arr_result[2],
"a4" => $arr_result[3],
);
}
}
}
}
}
echo json_encode($riwayat_alergi);
}
function riwayat_obat($id,$langid) {
$sql = "select * from so_resultentry_fisik_umum
where So_ResultEntryFisikUmumSo_ResultEntryID= ?
and So_ResultEntryFisikUmumM_LangID=?
and So_ResultEntryFisikUmumType='riwayat'";
$qry = $this->db_smartone->query($sql,array($id,$langid));
if (! $qry) {
return json_encode(array());
}
$rows = $qry->result_array();
if (count($rows) == 0 ) {
return json_encode(array());
}
$details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
//keluhan saat ini
$riwayat_obat = array();
foreach($details as $d) {
if ($d["title"] == "RIWAYAT KONSUMSI OBAT TERATUR") {
if ($d["flag_normal"] == "Y") {
$riwayat_obat = $d["label_flag_normal"];
break;
} else {
foreach($d["details"] as $gp) {
if ($gp["chx"] == 1 ) {
$arr_result[] = array($gp["label"], "Ya", "Tidak",$gp["value"]) ;
$riwayat_obat[] = array(
"o1" => $gp["label"],
"o2" => "Ya",
"o3" => $gp["value"],
);
}
}
}
}
}
echo json_encode($riwayat_obat);
}
function list() {
$sql = "select * from m_religion";
$qry = $this->db_smartone->query($sql);
if ($qry) {
$rows = $qry->result_array();
echo json_encode($rows);
} else {
echo json_encode(array());
}
}
function get($id) {
$sql = "select * from m_religion where M_ReligionID=?";
$qry = $this->db_smartone->query($sql,$id);
if ($qry) {
$rows = $qry->result_array();
echo json_encode($rows);
} else {
echo json_encode(array());
}
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
<?php
class Lookup extends MY_Controller
{
public function __construct() {
parent::__construct();
$this->db_smartone = $this->load->database("regional", true);
}
function dropdown($sp) {
$sql = "call $sp";
$qry = $this->db_smartone->query($sql);
if (! $qry) {
echo json_encode(array());
}
$rows = $qry->result_array();
if (count($rows) == 0 ) {
echo json_encode(array());
}
echo json_encode($rows);
}
function ac($sp) {
$prm = $this->sys_input;
$search = $prm['search'];
$sql = "call $sp(?)";
if (isset($prm['dep'])) {
$sql = "call $sp(?,?)";
$value = $prm['value'];
$qry = $this->db_smartone->query($sql,array($search,$value));
} else {
$qry = $this->db_smartone->query($sql,array($search));
}
if (! $qry) {
echo json_encode(array());
}
$rows = $qry->result_array();
if (count($rows) == 0 ) {
echo json_encode(array());
exit;
}
echo json_encode($rows);
}
}

View File

@@ -0,0 +1,185 @@
<?php
class Main extends MY_Controller
{
var $db_regional;
public function index()
{
echo "Report Main API";
}
public function __construct()
{
parent::__construct();
$this->db_one= $this->load->database("regional", true);
}
function detail(){
try {
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
$id = $prm['id'];
$sql = "select *
from
r_reportdetail
join r_inputtype on R_ReportDetailR_InputTypeID = R_InputTypeID
and R_ReportDetailIsActive = 'Y'
where R_ReportDetailR_ReportID = ?
order by R_ReportDetailID, R_ReportDetailPriority desc";
// echo $sql;
$qry = $this->db_one->query($sql, array($id) );
$last_q = $this->db_one->last_query();
if ($qry) {
$rows = $qry->result_array();
foreach($rows as $idx => $r) {
$rows[$idx]["model"] = "";
$rows[$idx]["items"] = "";
$rows[$idx]["tmp_date"] = false;
}
$result = array ("total" => count($rows), "records" => $rows);
$this->sys_ok($result);
} else {
$message = "Err Report Query";
$this->sys_error($message,$this->db_one);
}
} catch(Exception $exc) {
$message = $exc->getMessage();
$this->sys_error($message);
}
}
function list(){
try {
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
$search = $prm['search'];
$q_search = "where R_ReportIsActive = 'Y'";
$q_param = array();
if ($search !== "") {
$q_search = "where R_ReportIsActive = 'Y' and ( R_ReportCode like ? or R_ReportName like ? ) ";
$q_param[] = "%$search%";
$q_param[] = "%$search%";
}
$userid = $this->sys_user["M_UserID"];
$sqlusergroup = $this->db_regional->query("SELECT M_UserM_UserGroupID FROM m_user
WHERE M_UserID = $userid")->row();
$usergroup = $sqlusergroup->M_UserM_UserGroupID;
$sql = "select
R_ReportGroupID, R_ReportGroupName, R_ReportGroupColor,
R_ReportID, R_ReportCode, R_ReportName, R_ReportUrl, R_ReportWithoutXls
from r_report
join r_reportgroup on R_ReportGroupID = R_ReportR_ReportGroupID
join usergroup_report on R_ReportID = UserGroupReportR_ReportID AND UserGroupReportM_UserGroupID = $usergroup
and UserGroupReportIsActive = 'Y'
$q_search ORDER BY R_ReportGroupName ASC, R_ReportCode ASC";
//echo $sql;
if ($q_search == "" ) {
$qry = $this->db_one->query($sql);
} else {
$qry = $this->db_one->query($sql,$q_param);
}
$last_q = $this->db_one->last_query();
if ($qry) {
$rows = $qry->result_array();
$reports = array();
$prev_group = 0;
$idx = -1;
foreach($rows as $r) {
if ($prev_group != $r["R_ReportGroupID"] ) {
$idx++;
$reports[] = array("id"=>$r["R_ReportGroupID"], "name" => $r["R_ReportGroupName"],
"color" => $r["R_ReportGroupColor"],
"reports" => array());
}
$prev_group = $r["R_ReportGroupID"];
$reports[$idx]["reports"][] = $r;
}
$result = array ("total" => count($reports), "records" => $reports);
$this->sys_ok($result);
} else {
$message = "Err Report Query";
$this->sys_error($message,$this->db_one);
}
} catch(Exception $exc) {
$message = $exc->getMessage();
$this->sys_error($message);
}
}
public function lookupparam()
{
try {
//# cek token valid
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
$search = $prm['search'];
$limit = '';
if($all == 'N'){
$limit = ' LIMIT 10';
}
$number_limit = 10;
$number_offset = ($prm['current_page'] - 1) * $number_limit ;
$sql = "select COUNT(*) as total
from r_reportparam
LEFT JOIN r_inputtype ON R_ReportParamR_InputTypeID = R_InputTypeID AND R_InputTypeIsActive = 'Y'
where
(R_ReportParamName LIKE CONCAT('%','{$search}','%') OR
IFNULL(R_InputTypeName,'') LIKE CONCAT('%','{$search}','%') OR
IFNULL(R_ReportParamLabel,'') LIKE CONCAT('%','{$search}','%')) AND
R_ReportParamIsActive = 'Y'";
$sql_param = array($search);
// $total = $this->db_regional->query($sql,$sql_param)->row()->total;
$query = $this->db_regional->query($sql);
$tot_count = 0;
$tot_page = 0;
if ($query) {
$tot_count = $query->result_array()[0]["total"];
$tot_page = ceil($tot_count/$number_limit);
} else {
$this->sys_error_db("r_reportparam count", $this->db_regional);
exit;
}
$sql = "select R_ReportParamID as id,
R_InputTypeName,
r_reportparam.*
from r_reportparam
LEFT JOIN r_inputtype ON R_ReportParamR_InputTypeID = R_InputTypeID AND R_InputTypeIsActive = 'Y'
where
(R_ReportParamName LIKE CONCAT('%','{$search}','%') OR
IFNULL(R_InputTypeName,'') LIKE CONCAT('%','{$search}','%') OR
IFNULL(R_ReportParamLabel,'') LIKE CONCAT('%','{$search}','%')) AND
R_ReportParamIsActive = 'Y'
GROUP BY R_ReportParamID
ORDER BY R_ReportParamName ASC
limit $number_limit offset $number_offset";
$sql_param = array($search);
$query = $this->db_regional->query($sql);
//echo $this->db_regional->last_query();
if ($query) {
$rows = $query->result_array();
} else {
$this->sys_error_db("r_reportparam select");
exit;
}
$result = array ("total" => $tot_page, "total_filter"=>count($rows),"records" => $rows);
$this->sys_ok($result);
} catch(Exception $exc) {
$message = $exc->getMessage();
$this->sys_error($message);
}
}
}