Files
BE_IBL/application/controllers/nat_patient/Test.php
2026-04-15 15:23:57 +07:00

191 lines
5.3 KiB
PHP

<?php
class Test extends MY_Controller
{
function __construct()
{
parent::__construct();
}
function connection()
{
$this->load->library("NatPatientLib");
$result = $this->natpatientlib->check_connection();
print_r($result);
}
function save_nasional() {
$this->load->library("NatPatientLib");
$result = $this->natpatientlib->save_nasional("joko", ["M_BranchID" => 1000, "M_BranchCode" => "ZZZ", "M_PatientName" => "TEST"]);
print_r($result);
}
function get_by_nik()
{
$sql = "select m_patient.*,M_PatientAddressDescription,
fn_get_patient_atribute(M_PatientiD) pasien
from m_patient
join m_patientaddress on M_PatientID = ?
and M_PatientAddressM_PatientID = M_PatientID
and M_PatientAddressIsActive = 'Y'
limit 0,1";
$qry = $this->db->query($sql, [889229]);
if (!$qry) {
echo "Error : " .
$this->db->error()["message"] .
"|\n" .
$this->db->last_query();
exit();
}
$rows = $qry->result_array();
if (count($rows) == 0) {
echo "Error : " .
$this->db->error()["message"] .
"|\n" .
$this->db->last_query();
exit();
}
$r = $rows[0];
$pasien = json_decode($r["pasien"], true);
$full_name = $r["M_PatientName"];
if ($pasien["patient_fullname"] != "") {
$full_name = $pasien["patient_fullname"];
}
$param = [
"nik" => $r["M_PatientIDNumber"],
"dob" => $r["M_PatientDOB"],
"name" => $r["M_PatientName"],
"full_name" => $full_name,
"hp" => $r["M_PatientHp"],
"alamat" => $r["M_PatientAddressDescription"],
];
$this->load->library("NatPatientLib");
$resp = $this->natpatientlib->search_by_nik($param);
print_r($resp);
}
function confirm_by_nik()
{
$lokalM_PatientID = 3;
$userID = 3;
$userName = "admin";
$lokalM_PatientID = 903865;
$arr_remote = [
[
"status" => "Y",
"name" => "HANDOYO",
"dob" => "1971-05-31",
"hp" => "082113702602",
"address" => "JL NILAM I NO.14 RT005 RW006",
"M_BranchID" => "23",
"M_BranchCode" => "BA",
"M_PatientID" => "1136067",
"M_BranchName" => "Pramita Matraman",
],
[
"status" => "Y",
"name" => "HANDOYO",
"dob" => "1971-08-15",
"hp" => "082113702602",
"address" => "Jl Mataram Selatan RT 01 RW 11",
"M_BranchID" => "8",
"M_BranchCode" => "TA",
"M_PatientID" => "22",
"M_BranchName" => "Pramita Manado",
],
[
"status" => "Y",
"name" => "HANDOYO",
"dob" => "1971-05-31",
"hp" => null,
"address" => "Jl Mataram Selatan No 212 ",
"M_BranchID" => "6",
"M_BranchCode" => "HD",
"M_PatientID" => "799671",
"M_BranchName" => "Pramita Tegal",
],
[
"status" => "Y",
"name" => "TN HANDOYO",
"dob" => "1971-05-31",
"hp" => null,
"address" => "Jl Mataram Selatan No 212 ",
"M_BranchID" => "11",
"M_BranchCode" => "AB",
"M_PatientID" => "796332",
"M_BranchName" => "Pramita Sultan Agung",
],
[
"status" => "Y",
"name" => "TN TN HANDOYO",
"dob" => "1971-05-31",
"hp" => null,
"address" => "Jl Mataram Selatan No 212 ",
"M_BranchID" => "34",
"M_BranchCode" => "HC",
"M_PatientID" => "988065",
"M_BranchName" => "Pramita Salatiga",
],
[
"status" => "Y",
"name" => "UJI COBA PASIEN PERBATASAN",
"dob" => "2019-12-26",
"hp" => "082113702602",
"address" => "Jl Martadinata No 135 ",
"M_BranchID" => "1",
"M_BranchCode" => "DA",
"M_PatientID" => "763448",
"M_BranchName" => "Pramita Bandung",
],
[
"status" => "Y",
"name" => "UJI COBA PASIEN PERBATASAN",
"dob" => "2019-12-26",
"hp" => "082113702602",
"address" => "Jl Martadinata No 135 ",
"M_BranchID" => "5",
"M_BranchCode" => "DD",
"M_PatientID" => "763448",
"M_BranchName" => "Pramita Cimahi",
],
[
"status" => "Y",
"name" => "UJI COBA PASIEN PERBATASAN",
"dob" => "2019-12-26",
"hp" => "082113702602",
"address" => "Jl Martadinata No 135 ",
"M_BranchID" => "3",
"M_BranchCode" => "DC",
"M_PatientID" => "763448",
"M_BranchName" => "Pramita Padjajaran",
],
[
"status" => "N",
"name" => "UJI COBA PASIEN PERBATASAN",
"dob" => "2019-12-26",
"hp" => "082113702602",
"address" => "Jl Martadinata No 135 ",
"M_BranchID" => "4",
"M_BranchCode" => "DB",
"M_PatientID" => "763448",
"M_BranchName" => "Pramita Moh Toha",
],
[
"status" => "N",
"name" => "TN HANDOYO",
"dob" => "1971-05-31",
"hp" => null,
"address" => "Jl Mataram Selatan No 212 ",
"M_BranchID" => "35",
"M_BranchCode" => "LM",
"M_PatientID" => "843457",
"M_BranchName" => "Pramita Madiun",
],
];
$this->load->library("NatPatientLib");
$resp = $this->natpatientlib->confirm(
$lokalM_PatientID,
$arr_remote,
$userID,
$userName
);
echo json_encode($resp);
}
}