Compare commits
25 Commits
0f54702aa7
...
25f17896d4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25f17896d4 | ||
|
|
71d64c6637 | ||
|
|
eed0c8fe0d | ||
|
|
beac903397 | ||
|
|
16fcf81c00 | ||
|
|
e456ce6354 | ||
|
|
45e668def3 | ||
|
|
a599f15ec2 | ||
|
|
ad632ec17c | ||
|
|
5e3695a54b | ||
|
|
dc586c63f4 | ||
|
|
ae28375cc3 | ||
|
|
e7894e869d | ||
|
|
5d9c170bf4 | ||
|
|
eb4af1c67c | ||
|
|
8282acadd5 | ||
|
|
01994365d4 | ||
|
|
9dd4afed4a | ||
|
|
f1801157c2 | ||
|
|
0c9c67d30f | ||
|
|
32131fdaad | ||
|
|
473b90b697 | ||
|
|
82c3ea5ff0 | ||
|
|
e301eedbeb | ||
|
|
a5d7174b68 |
@@ -43,6 +43,7 @@ class Registrationv3 extends MY_Controller
|
||||
private function _mask_short($v) { if (!$v) return $v; $v=trim($v); $l=mb_strlen($v,'UTF-8'); if($l<=2) return '***'; return mb_substr($v,0,2,'UTF-8').'***'; }
|
||||
private function _mask_id($v) { if (!$v) return $v; $v=trim($v); $l=strlen($v); if($l<=4) return '****'; return substr($v,0,4).str_repeat('*',max(3,$l-6)).($l>6?substr($v,-2):''); }
|
||||
private function _mask_address($v) { if (!$v) return $v; $v=trim($v); $l=mb_strlen($v,'UTF-8'); if($l<=5) return '***'; return mb_substr($v,0,5,'UTF-8').'***'; }
|
||||
private function _mask_dob($v) { if (!$v) return $v; $p=explode('-',$v); return (count($p)===3) ? '**-**-'.$p[2] : '****-**-**'; }
|
||||
|
||||
public function search_x()
|
||||
{
|
||||
@@ -446,7 +447,7 @@ class Registrationv3 extends MY_Controller
|
||||
->set('M_PatientM_TitleID', $prm['M_PatientM_TitleID'])
|
||||
->set('M_PatientPrefix', $prm['M_PatientPrefix'])
|
||||
->set('M_PatientSuffix', $prm['M_PatientSuffix'])
|
||||
->set('M_PatientDOB', $pdob)
|
||||
->set('M_PatientDOB', $this->_mask_dob($dob_str))
|
||||
->set('M_PatientDOB_enc', $enc->encrypt($dob_str))
|
||||
->set('M_PatientDOB_bidx', $enc->search_bidx($dob_str))
|
||||
->set('M_PatientM_SexID', $prm['M_PatientM_SexID'])
|
||||
@@ -536,7 +537,7 @@ class Registrationv3 extends MY_Controller
|
||||
'M_PatientM_TitleID' => $prm['M_PatientM_TitleID'],
|
||||
'M_PatientPrefix' => $prm['M_PatientPrefix'],
|
||||
'M_PatientSuffix' => $prm['M_PatientSuffix'],
|
||||
'M_PatientDOB' => $pdob,
|
||||
'M_PatientDOB' => $this->_mask_dob($dob_str),
|
||||
'M_PatientDOB_enc' => $enc->encrypt($dob_str),
|
||||
'M_PatientDOB_bidx' => $enc->search_bidx($dob_str),
|
||||
'M_PatientM_SexID' => $prm['M_PatientM_SexID'],
|
||||
@@ -588,7 +589,15 @@ class Registrationv3 extends MY_Controller
|
||||
'M_PatientAddressDescription' => $this->_mask_address($address_description),
|
||||
'M_PatientAddressDescription_enc' => $enc->encrypt($address_description),
|
||||
'M_PatientAddressUserID' => $userid,
|
||||
'M_PatientAddressM_KelurahanID' => $prm['M_PatientAddressM_KelurahanID'],
|
||||
'M_PatientAddressRegionalCd' => $prm['M_PatientAddressRegionalCd'] ?? null,
|
||||
'M_PatientAddressLocation' => $prm['M_PatientAddressLocation'] ?? null,
|
||||
'M_PatientAddressCity' => $prm['M_PatientAddressCity'] ?? null,
|
||||
'M_PatientAddressVillage' => $prm['M_PatientAddressVillage'] ?? null,
|
||||
'M_PatientAddressDistrict' => $prm['M_PatientAddressDistrict'] ?? null,
|
||||
'M_PatientAddressState' => $prm['M_PatientAddressState'] ?? null,
|
||||
'M_PatientAddressCountry' => $prm['M_PatientAddressCountry'] ?? null,
|
||||
'M_PatientAddressCountryCode' => $prm['M_PatientAddressCountryCode'] ?? null,
|
||||
'M_PatientAddressNote' => $prm['M_PatientAddressNote'] ?? 'Utama',
|
||||
];
|
||||
$this->db_onedev->insert('m_patientaddress', $add);
|
||||
//echo $this->db_onedev->last_query();
|
||||
@@ -644,101 +653,76 @@ class Registrationv3 extends MY_Controller
|
||||
exit;
|
||||
}
|
||||
$prm = $this->sys_input;
|
||||
$query = " SELECT m_patientaddress.*,
|
||||
M_KelurahanName,
|
||||
M_DistrictID,
|
||||
M_DistrictName,
|
||||
M_CityID,
|
||||
M_CityName,
|
||||
'' as action
|
||||
FROM m_patientaddress
|
||||
JOIN m_kelurahan ON M_PatientAddressM_KelurahanID = M_KelurahanID
|
||||
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID
|
||||
JOIN m_city ON M_DistrictM_CityID = M_CityID
|
||||
WHERE
|
||||
M_PatientAddressIsActive = 'Y' AND M_PatientAddressM_PatientID = ?
|
||||
ORDER BY M_PatientAddressID ASC
|
||||
LIMIT 1
|
||||
|
||||
";
|
||||
//echo $query;
|
||||
$address = $this->db_onedev->query($query, array($prm['id']))->row_array();
|
||||
$address['M_PatientAddressDescription'] = stripslashes($address['M_PatientAddressDescription']);
|
||||
$query = "SELECT m_patientaddress.*,
|
||||
IFNULL(r.regional_nm, '') AS M_KelurahanName,
|
||||
IFNULL(r.full_name, '') AS M_RegionalFullName,
|
||||
IFNULL(r.pro_cd, '') AS pro_cd,
|
||||
IFNULL(r.kab_cd, '') AS kab_cd,
|
||||
IFNULL(r.kec_cd, '') AS kec_cd,
|
||||
IFNULL(pro.regional_nm, '') AS M_ProvinceName,
|
||||
IFNULL(kab.regional_nm, '') AS M_CityName,
|
||||
IFNULL(kec.regional_nm, '') AS M_DistrictName,
|
||||
'' AS action
|
||||
FROM m_patientaddress
|
||||
LEFT JOIN regional r ON M_PatientAddressRegionalCd = r.regional_cd
|
||||
LEFT JOIN regional pro ON CONCAT(r.pro_cd, REPEAT('0', 8)) = pro.regional_cd
|
||||
LEFT JOIN regional kab ON CONCAT(r.pro_cd, r.kab_cd, REPEAT('0', 6)) = kab.regional_cd
|
||||
LEFT JOIN regional kec ON CONCAT(r.pro_cd, r.kab_cd, r.kec_cd, REPEAT('0', 3)) = kec.regional_cd
|
||||
WHERE M_PatientAddressIsActive = 'Y' AND M_PatientAddressM_PatientID = ?
|
||||
ORDER BY M_PatientAddressID ASC
|
||||
LIMIT 1";
|
||||
|
||||
$address = $this->db_onedev->query($query, [$prm['id']])->row_array();
|
||||
$address['M_PatientAddressDescription'] = $this->ibl_encryptor->decrypt($address['M_PatientAddressDescription_enc'] ?? '') ?: stripslashes($address['M_PatientAddressDescription'] ?? '');
|
||||
unset($address['M_PatientAddressDescription_enc']);
|
||||
$rows['address'] = $address;
|
||||
|
||||
$query = " SELECT *
|
||||
FROM m_city
|
||||
WHERE
|
||||
M_CityIsActive = 'Y' AND M_CityID = ?
|
||||
";
|
||||
//echo $query;
|
||||
$rows['city_address'] = $this->db_onedev->query($query, array($address['M_CityID']))->row_array();
|
||||
$pro_cd = $address['pro_cd'] ?? '';
|
||||
$kab_cd = $address['kab_cd'] ?? '';
|
||||
$kec_cd = $address['kec_cd'] ?? '';
|
||||
$regional_cd = $address['M_PatientAddressRegionalCd'] ?? '';
|
||||
|
||||
$rows['province_address'] = $pro_cd ? $this->db_onedev->query(
|
||||
"SELECT regional_cd AS M_ProvinceID, regional_nm AS M_ProvinceName FROM regional WHERE regional_cd = ?",
|
||||
[$pro_cd . str_repeat('0', 8)]
|
||||
)->row_array() : [];
|
||||
|
||||
$query = " SELECT *
|
||||
FROM m_city
|
||||
WHERE
|
||||
M_CityIsActive = 'Y' AND M_CityM_ProvinceID = ?
|
||||
";
|
||||
//echo $query;
|
||||
$rows['cities'] = $this->db_onedev->query($query, array($rows['city_address']['M_CityM_ProvinceID']))->result_array();
|
||||
$rows['provinces'] = $this->db_onedev->query(
|
||||
"SELECT regional_cd AS M_ProvinceID, regional_nm AS M_ProvinceName FROM regional WHERE RIGHT(regional_cd, 8) = '00000000' ORDER BY regional_nm"
|
||||
)->result_array();
|
||||
|
||||
$query = " SELECT *
|
||||
FROM m_province
|
||||
WHERE
|
||||
M_ProvinceIsActive = 'Y' AND M_ProvinceID = ?
|
||||
";
|
||||
//echo $query;
|
||||
$rows['province_address'] = $this->db_onedev->query($query, array($rows['city_address']['M_CityM_ProvinceID']))->row_array();
|
||||
$rows['city_address'] = ($pro_cd && $kab_cd) ? $this->db_onedev->query(
|
||||
"SELECT regional_cd AS M_CityID, regional_nm AS M_CityName FROM regional WHERE regional_cd = ?",
|
||||
[$pro_cd . $kab_cd . str_repeat('0', 6)]
|
||||
)->row_array() : [];
|
||||
|
||||
$query = " SELECT *
|
||||
FROM m_province
|
||||
WHERE
|
||||
M_ProvinceIsActive = 'Y'
|
||||
";
|
||||
//echo $query;
|
||||
$rows['provinces'] = $this->db_onedev->query($query)->result_array();
|
||||
$rows['cities'] = $pro_cd ? $this->db_onedev->query(
|
||||
"SELECT regional_cd AS M_CityID, regional_nm AS M_CityName FROM regional WHERE pro_cd = ? AND RIGHT(regional_cd, 8) != '00000000' AND RIGHT(regional_cd, 6) = '000000' ORDER BY regional_nm",
|
||||
[$pro_cd]
|
||||
)->result_array() : [];
|
||||
|
||||
$query = " SELECT *
|
||||
FROM m_district
|
||||
WHERE
|
||||
M_DistrictIsActive = 'Y' AND M_DistrictM_CityID = ?
|
||||
";
|
||||
//echo $query;
|
||||
$rows['districts'] = $this->db_onedev->query($query, array($rows['city_address']['M_CityID']))->result_array();
|
||||
$rows['district_address'] = ($pro_cd && $kab_cd && $kec_cd) ? $this->db_onedev->query(
|
||||
"SELECT regional_cd AS M_DistrictID, regional_nm AS M_DistrictName FROM regional WHERE regional_cd = ?",
|
||||
[$pro_cd . $kab_cd . $kec_cd . str_repeat('0', 3)]
|
||||
)->row_array() : [];
|
||||
|
||||
$query = " SELECT *
|
||||
FROM m_district
|
||||
WHERE
|
||||
M_DistrictIsActive = 'Y' AND M_DistrictID = ?
|
||||
";
|
||||
//echo $query;
|
||||
$rows['district_address'] = $this->db_onedev->query($query, array($address['M_DistrictID']))->row_array();
|
||||
$rows['districts'] = ($pro_cd && $kab_cd) ? $this->db_onedev->query(
|
||||
"SELECT regional_cd AS M_DistrictID, regional_nm AS M_DistrictName FROM regional WHERE pro_cd = ? AND kab_cd = ? AND RIGHT(regional_cd, 6) != '000000' AND RIGHT(regional_cd, 3) = '000' ORDER BY regional_nm",
|
||||
[$pro_cd, $kab_cd]
|
||||
)->result_array() : [];
|
||||
|
||||
$query = " SELECT *
|
||||
FROM m_kelurahan
|
||||
WHERE
|
||||
M_KelurahanIsActive = 'Y' AND M_KelurahanM_DistrictID = ?
|
||||
";
|
||||
//echo $query;
|
||||
$rows['kelurahans'] = $this->db_onedev->query($query, array($address['M_DistrictID']))->result_array();
|
||||
$rows['kelurahan_address'] = $regional_cd ? $this->db_onedev->query(
|
||||
"SELECT regional_cd AS M_KelurahanID, regional_nm AS M_KelurahanName FROM regional WHERE regional_cd = ?",
|
||||
[$regional_cd]
|
||||
)->row_array() : [];
|
||||
|
||||
$query = " SELECT *
|
||||
FROM m_kelurahan
|
||||
WHERE
|
||||
M_KelurahanIsActive = 'Y' AND M_KelurahanID = ?
|
||||
";
|
||||
//echo $query;
|
||||
$rows['kelurahan_address'] = $this->db_onedev->query($query, array($address['M_PatientAddressM_KelurahanID']))->row_array();
|
||||
$rows['kelurahans'] = ($pro_cd && $kab_cd && $kec_cd) ? $this->db_onedev->query(
|
||||
"SELECT regional_cd AS M_KelurahanID, regional_nm AS M_KelurahanName FROM regional WHERE pro_cd = ? AND kab_cd = ? AND kec_cd = ? AND RIGHT(regional_cd, 3) != '000' ORDER BY regional_nm",
|
||||
[$pro_cd, $kab_cd, $kec_cd]
|
||||
)->result_array() : [];
|
||||
|
||||
|
||||
|
||||
|
||||
$result = array(
|
||||
"total" => count($rows),
|
||||
"records" => $rows,
|
||||
);
|
||||
$this->sys_ok($result);
|
||||
$this->sys_ok(["total" => count($rows), "records" => $rows]);
|
||||
exit;
|
||||
}
|
||||
function savenewaddress()
|
||||
@@ -874,182 +858,142 @@ class Registrationv3 extends MY_Controller
|
||||
|
||||
public function search()
|
||||
{
|
||||
|
||||
$prm = $this->sys_input;
|
||||
|
||||
$max_rst = 100;
|
||||
$tot_count = 0;
|
||||
$number_limit = 10;
|
||||
$number_limit = 10;
|
||||
$number_offset = (!isset($prm['current_page']) ? 1 : $prm['current_page'] - 1) * $number_limit;
|
||||
|
||||
$q = [
|
||||
'noreg' => "",
|
||||
'name' => '',
|
||||
'hp' => '',
|
||||
'dob' => '',
|
||||
'address' => '',
|
||||
'nik' => ''
|
||||
];
|
||||
$where_noreg = '';
|
||||
$where_name = '';
|
||||
$where_hp = '';
|
||||
$where_dob = '';
|
||||
$where_nik = '';
|
||||
$where_snorm = '';
|
||||
|
||||
$q_pid = "";
|
||||
|
||||
if ($prm['noreg'] != '')
|
||||
$q['noreg'] = "AND M_PatientNoReg like '%{$prm['noreg']}%'";
|
||||
|
||||
if ($prm['snorm'] == '') {
|
||||
if ($prm['search'] != '') {
|
||||
$e = explode('+', $prm['search']);
|
||||
// nama via trigram bidx
|
||||
if (!empty($e[0]) && mb_strlen(trim($e[0])) >= 3) {
|
||||
$toks = $this->ibl_encryptor->query_tokens($e[0]);
|
||||
$conds = [];
|
||||
foreach ($toks as $tok) {
|
||||
$tok_esc = $this->db_onedev->escape_str($tok);
|
||||
$conds[] = "JSON_CONTAINS(M_PatientName_bidx, '\"$tok_esc\"')";
|
||||
}
|
||||
if ($conds) $q['name'] = 'AND (' . implode(' AND ', $conds) . ')';
|
||||
}
|
||||
// HP via trigram bidx
|
||||
if (!empty($e[1]) && mb_strlen(trim($e[1])) >= 3) {
|
||||
$toks = $this->ibl_encryptor->query_tokens($e[1]);
|
||||
$conds = [];
|
||||
foreach ($toks as $tok) {
|
||||
$tok_esc = $this->db_onedev->escape_str($tok);
|
||||
$conds[] = "JSON_CONTAINS(M_PatientHP_bidx, '\"$tok_esc\"')";
|
||||
}
|
||||
if ($conds) $q['hp'] = 'AND (' . implode(' AND ', $conds) . ')';
|
||||
}
|
||||
// DOB via trigram bidx
|
||||
if (!empty($e[2]) && mb_strlen(trim($e[2])) >= 3) {
|
||||
$toks = $this->ibl_encryptor->query_tokens($e[2]);
|
||||
$conds = [];
|
||||
foreach ($toks as $tok) {
|
||||
$tok_esc = $this->db_onedev->escape_str($tok);
|
||||
$conds[] = "JSON_CONTAINS(M_PatientDOB_bidx, '\"$tok_esc\"')";
|
||||
}
|
||||
if ($conds) $q['dob'] = 'AND (' . implode(' AND ', $conds) . ')';
|
||||
}
|
||||
// Alamat dihapus dari search
|
||||
// NIK via trigram bidx (e[3] — sebelumnya e[4])
|
||||
if (!empty($e[3]) && mb_strlen(trim($e[3])) >= 3) {
|
||||
$toks = $this->ibl_encryptor->query_tokens($e[3]);
|
||||
$conds = [];
|
||||
foreach ($toks as $tok) {
|
||||
$tok_esc = $this->db_onedev->escape_str($tok);
|
||||
$conds[] = "JSON_CONTAINS(M_PatientNIK_bidx, '\"$tok_esc\"')";
|
||||
}
|
||||
if ($conds) $q['nik'] = 'AND (' . implode(' AND ', $conds) . ')';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$q_pid = "AND M_PatientNoReg = '{$prm['snorm']}'";
|
||||
if (!empty($prm['noreg'])) {
|
||||
$noreg = $this->db_onedev->escape_like_str($prm['noreg']);
|
||||
$where_noreg = "AND M_PatientNoReg LIKE '%{$noreg}%'";
|
||||
}
|
||||
|
||||
if ($prm['snorm'] != '' || $prm['search'] != '') {
|
||||
if (!empty($prm['snorm'])) {
|
||||
$where_snorm = "AND M_PatientNoReg = '{$prm['snorm']}'";
|
||||
} elseif (!empty($prm['search'])) {
|
||||
$e = explode('+', $prm['search']);
|
||||
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT 'N' divider,M_PatientID,
|
||||
M_PatientNoReg,
|
||||
M_PatientPrefix,
|
||||
M_PatientName_enc, M_PatientHP_enc, M_PatientEmail_enc,
|
||||
M_PatientPOB_enc, M_PatientPhone_enc, M_PatientIDNumber_enc, M_PatientNIK_enc,
|
||||
M_PatientDOB_enc, M_PatientDOB as dob_raw,
|
||||
M_PatientSuffix,
|
||||
M_PatientNote,
|
||||
M_PatientNIK,
|
||||
M_PatientJabatan,
|
||||
M_PatientKedudukan,
|
||||
M_PatientPJ,
|
||||
M_PatientLocation,
|
||||
M_PatientJob,
|
||||
M_PatientM_SexID,
|
||||
M_SexName,
|
||||
M_PatientM_TitleID,
|
||||
M_TitleName,
|
||||
M_PatientM_ReligionID,
|
||||
M_ReligionName,
|
||||
M_PatientM_IdTypeID,
|
||||
M_IdTypeName,
|
||||
M_PatientIDNumber,
|
||||
M_PatientPhoto,
|
||||
IF(ISNULL(M_PatientSuspendID),'active','suspend' ) as status,
|
||||
M_PatientAddressM_KelurahanID M_KelurahanID,
|
||||
0 M_DistrictID, 0 M_CityID, 0 M_ProvinceID
|
||||
FROM m_patient
|
||||
JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
||||
JOIN m_sex ON M_PatientM_SexID = M_SexID
|
||||
JOIN m_branch ON M_BranchIsActive = 'Y' AND M_BranchIsDefault = 'Y'
|
||||
JOIN m_patientaddress ON M_PatientAddressM_PatientID = M_PatientID AND M_PatientAddressIsActive = 'Y'
|
||||
LEFT JOIN m_idtype ON M_IdTypeID = M_PatientM_IdTypeID AND M_IdTypeIsActive = 'Y'
|
||||
LEFT JOIN m_religion ON m_patientm_religionid = m_religionid
|
||||
LEFT JOIN m_patientsuspend ON M_PatientSuspendM_PatientID = M_PatientID AND M_PatientSuspendIsActive = 'Y'
|
||||
WHERE
|
||||
M_PatientSuspendID IS NULL AND M_PatientIsActive = 'Y'
|
||||
{$q['address']}
|
||||
{$q['noreg']}
|
||||
{$q['name']}
|
||||
{$q['hp']}
|
||||
{$q['dob']}
|
||||
{$q['nik']}
|
||||
{$q_pid}
|
||||
|
||||
GROUP BY M_PatientID
|
||||
LIMIT $number_limit offset $number_offset";
|
||||
//echo $sql;
|
||||
$query = $this->db_onedev->query($sql);
|
||||
|
||||
if ($query) {
|
||||
$rows = $query->result_array();
|
||||
$enc = $this->ibl_encryptor;
|
||||
|
||||
foreach ($rows as $k => $v) {
|
||||
$rows[$k]['M_PatientName'] = $enc->decrypt($v['M_PatientName_enc'] ?? '') ?? '';
|
||||
$rows[$k]['M_PatientHP'] = $enc->decrypt($v['M_PatientHP_enc'] ?? '') ?? '';
|
||||
$rows[$k]['M_PatientEmail'] = $enc->decrypt($v['M_PatientEmail_enc'] ?? '') ?? '';
|
||||
$rows[$k]['M_PatientPOB'] = $enc->decrypt($v['M_PatientPOB_enc'] ?? '') ?? '';
|
||||
$rows[$k]['M_PatientPhone'] = $enc->decrypt($v['M_PatientPhone_enc'] ?? '') ?? '';
|
||||
$rows[$k]['M_PatientIDNumber'] = $enc->decrypt($v['M_PatientIDNumber_enc']?? '') ?? '';
|
||||
$rows[$k]['M_PatientNIK'] = $enc->decrypt($v['M_PatientNIK_enc'] ?? '') ?? '';
|
||||
$rows[$k]['M_PatientDOB'] = $enc->decrypt($v['M_PatientDOB_enc'] ?? '') ?? date('d-m-Y', strtotime($v['dob_raw'] ?? 'now'));
|
||||
$rows[$k]['M_PatientAddressDescription'] = $enc->decrypt($v['M_PatientAddressDescription_enc'] ?? '') ?? '';
|
||||
foreach (array_keys($rows[$k]) as $col) {
|
||||
if (substr($col, -4) === '_enc') unset($rows[$k][$col]);
|
||||
}
|
||||
unset($rows[$k]['dob_raw']);
|
||||
$patient_name = str_replace("'", "\\'", $prm['M_PatientName']);
|
||||
$sql = "SELECT *, concat('{$rows[$k]['M_PatientAddressDescription']}', '\n\n',
|
||||
m_kelurahanname, ', ',
|
||||
m_districtname,'\n',
|
||||
m_cityname, ', ',
|
||||
m_provincename) as xaddress
|
||||
FROM m_kelurahan
|
||||
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID
|
||||
JOIN m_city ON M_DistrictM_CityID = M_CityID
|
||||
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID
|
||||
WHERE
|
||||
M_KelurahanID = {$v['M_KelurahanID']} ";
|
||||
//echo $sql;
|
||||
$row_address = $this->db_onedev->query($sql)->row_array();
|
||||
$rows[$k]['M_PatientAddress'] = stripslashes($row_address['xaddress']);
|
||||
$rows[$k]['M_DistrictID'] = $row_address['M_DistrictID'];
|
||||
$rows[$k]['M_CityID'] = $row_address['M_CityID'];
|
||||
$rows[$k]['M_ProvinceID'] = $row_address['M_ProvinceID'];
|
||||
$info = $this->db_onedev->query("SELECT fn_fo_patient_visit(?) info", [$v['M_PatientID']])->row();
|
||||
$rows[$k]['info'] = json_decode($info->info);
|
||||
if (!empty($e[0]) && mb_strlen(trim($e[0])) >= 3) {
|
||||
$toks = $this->ibl_encryptor->query_tokens($e[0]);
|
||||
$conds = [];
|
||||
foreach ($toks as $tok) {
|
||||
$tok_esc = $this->db_onedev->escape_str($tok);
|
||||
$conds[] = "JSON_CONTAINS(M_PatientName_bidx, '\"$tok_esc\"')";
|
||||
}
|
||||
|
||||
$result = array("total" => $tot_page, "records" => $rows, "sql" => $this->db_onedev->last_query());
|
||||
$this->sys_ok($result);
|
||||
} else {
|
||||
$this->sys_error_db("m_patient rows", $this->db_onedev);
|
||||
exit;
|
||||
if ($conds) $where_name = 'AND (' . implode(' AND ', $conds) . ')';
|
||||
}
|
||||
|
||||
if (!empty($e[1]) && mb_strlen(trim($e[1])) >= 3) {
|
||||
$toks = $this->ibl_encryptor->query_tokens($e[1]);
|
||||
$conds = [];
|
||||
foreach ($toks as $tok) {
|
||||
$tok_esc = $this->db_onedev->escape_str($tok);
|
||||
$conds[] = "JSON_CONTAINS(M_PatientHP_bidx, '\"$tok_esc\"')";
|
||||
}
|
||||
if ($conds) $where_hp = 'AND (' . implode(' AND ', $conds) . ')';
|
||||
}
|
||||
|
||||
if (!empty($e[2]) && mb_strlen(trim($e[2])) >= 3) {
|
||||
$toks = $this->ibl_encryptor->query_tokens($e[2]);
|
||||
$conds = [];
|
||||
foreach ($toks as $tok) {
|
||||
$tok_esc = $this->db_onedev->escape_str($tok);
|
||||
$conds[] = "JSON_CONTAINS(M_PatientDOB_bidx, '\"$tok_esc\"')";
|
||||
}
|
||||
if ($conds) $where_dob = 'AND (' . implode(' AND ', $conds) . ')';
|
||||
}
|
||||
|
||||
if (!empty($e[3]) && mb_strlen(trim($e[3])) >= 3) {
|
||||
$toks = $this->ibl_encryptor->query_tokens($e[3]);
|
||||
$conds = [];
|
||||
foreach ($toks as $tok) {
|
||||
$tok_esc = $this->db_onedev->escape_str($tok);
|
||||
$conds[] = "JSON_CONTAINS(M_PatientNIK_bidx, '\"$tok_esc\"')";
|
||||
}
|
||||
if ($conds) $where_nik = 'AND (' . implode(' AND ', $conds) . ')';
|
||||
}
|
||||
} else {
|
||||
$result = array("total" => 0, "records" => [], "sql" => $this->db_onedev->last_query());
|
||||
$this->sys_ok($result);
|
||||
}
|
||||
|
||||
if (empty($prm['snorm']) && empty($prm['search']) && empty($prm['noreg'])) {
|
||||
$this->sys_ok(["total" => 0, "records" => []]);
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = "SELECT 'N' divider, M_PatientID, M_PatientNoReg, M_PatientPrefix, M_PatientSuffix,
|
||||
concat(M_TitleName,' ',IFNULL(M_PatientPrefix,''),' ',M_PatientName,' ',IFNULL(M_PatientSuffix,'')) M_PatientNameRaw,
|
||||
M_TitleID, M_TitleName, M_SexID, M_SexName,
|
||||
M_PatientDOB,
|
||||
'' M_PatientAddress,
|
||||
M_PatientAddressID,
|
||||
M_PatientAddressRegionalCd, M_PatientAddressLocation, M_PatientAddressCity,
|
||||
M_PatientAddressVillage, M_PatientAddressDistrict, M_PatientAddressState,
|
||||
M_PatientAddressCountry, M_PatientAddressCountryCode,
|
||||
M_PatientAddressM_KelurahanID M_KelurahanID, 0 M_DistrictID, 0 M_CityID, 0 M_ProvinceID,
|
||||
M_PatientM_ReligionID, IFNULL(M_ReligionName, '-') M_ReligionName,
|
||||
IFNULL(M_PatientNote, '') M_PatientNote, M_PatientPhoto,
|
||||
M_PatientM_IdTypeID,
|
||||
M_PatientJabatan, M_PatientKedudukan, M_PatientPJ, M_PatientLocation, M_PatientJob,
|
||||
IF(ISNULL(M_PatientSuspendID),'active','suspend') as status,
|
||||
M_PatientName_enc, M_PatientHP_enc, M_PatientDOB_enc,
|
||||
M_PatientEmail_enc, M_PatientPhone_enc, M_PatientPOB_enc,
|
||||
M_PatientIDNumber_enc, M_PatientNIK_enc, M_PatientAddressDescription_enc
|
||||
FROM m_patient
|
||||
JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
||||
JOIN m_sex ON M_PatientM_SexID = M_SexID
|
||||
JOIN m_patientaddress ON M_PatientAddressM_PatientID = M_PatientID AND M_PatientAddressIsActive = 'Y'
|
||||
LEFT JOIN m_religion ON M_PatientM_ReligionID = M_ReligionID
|
||||
LEFT JOIN m_patientsuspend ON M_PatientSuspendM_PatientID = M_PatientID AND M_PatientSuspendIsActive = 'Y'
|
||||
WHERE M_PatientIsActive = 'Y' AND M_PatientSuspendID IS NULL
|
||||
{$where_noreg}
|
||||
{$where_snorm}
|
||||
{$where_name}
|
||||
{$where_hp}
|
||||
{$where_dob}
|
||||
{$where_nik}
|
||||
GROUP BY M_PatientID
|
||||
LIMIT {$number_limit} OFFSET {$number_offset}";
|
||||
|
||||
$query = $this->db_onedev->query($sql);
|
||||
|
||||
if (!$query) {
|
||||
$this->sys_error_db("m_patient rows", $this->db_onedev);
|
||||
return;
|
||||
}
|
||||
|
||||
$rows = $query->result_array();
|
||||
$enc = $this->ibl_encryptor;
|
||||
|
||||
foreach ($rows as $k => $v) {
|
||||
$rows[$k]['M_PatientName'] = $enc->decrypt($v['M_PatientName_enc']) ?? $v['M_PatientNameRaw'];
|
||||
$rows[$k]['M_PatientHP'] = $enc->decrypt($v['M_PatientHP_enc']) ?? '';
|
||||
$rows[$k]['M_PatientEmail'] = $enc->decrypt($v['M_PatientEmail_enc']) ?? '';
|
||||
$rows[$k]['M_PatientPOB'] = $enc->decrypt($v['M_PatientPOB_enc']) ?? '';
|
||||
$rows[$k]['M_PatientPhone'] = $enc->decrypt($v['M_PatientPhone_enc']) ?? '';
|
||||
$rows[$k]['M_PatientIDNumber'] = $enc->decrypt($v['M_PatientIDNumber_enc']) ?? '';
|
||||
$rows[$k]['M_PatientNIK'] = $enc->decrypt($v['M_PatientNIK_enc']) ?? '';
|
||||
$dob_dec = $enc->decrypt($v['M_PatientDOB_enc']) ?? '';
|
||||
$rows[$k]['M_PatientDOB'] = $dob_dec;
|
||||
$rows[$k]['dob_ina'] = $dob_dec;
|
||||
$rows[$k]['M_PatientAddressDescription'] = $enc->decrypt($v['M_PatientAddressDescription_enc']) ?? '';
|
||||
$rows[$k]['M_PatientAddress'] = $rows[$k]['M_PatientAddressDescription'];
|
||||
|
||||
foreach (array_keys($rows[$k]) as $col) {
|
||||
if (substr($col, -4) === '_enc') unset($rows[$k][$col]);
|
||||
}
|
||||
unset($rows[$k]['M_PatientNameRaw']);
|
||||
|
||||
$info = $this->db_onedev->query("SELECT fn_fo_patient_visit(?) info", [$v['M_PatientID']])->row();
|
||||
$rows[$k]['info'] = json_decode($info->info);
|
||||
}
|
||||
|
||||
$this->sys_ok(["total" => 0, "records" => $rows]);
|
||||
}
|
||||
|
||||
function calculateAge($tanggal_lahir)
|
||||
@@ -1091,21 +1035,28 @@ class Registrationv3 extends MY_Controller
|
||||
$sql = "SELECT * FROM one_klinik.setting WHERE settingIsActive = 'Y' LIMIT 1";
|
||||
$setting_data = $this->db_oneklinik->query($sql)->row_array();
|
||||
|
||||
$price = intval($prm['doctor']['price']) == 0?$setting_data['settingPriceDefault']:$prm['doctor']['price'];
|
||||
$price = intval($prm['price'] ?? 0) != 0 ? intval($prm['price']) : $setting_data['settingPriceDefault'];
|
||||
|
||||
$sql = "INSERT INTO one_klinik.`order`
|
||||
$clinic_unit_id = isset($prm['clinic_unit_id']) && $prm['clinic_unit_id'] ? intval($prm['clinic_unit_id']) : null;
|
||||
$company_id = isset($prm['company_id']) && $prm['company_id'] ? intval($prm['company_id']) : null;
|
||||
$mou_id = isset($prm['mou_id']) && $prm['mou_id'] ? intval($prm['mou_id']) : null;
|
||||
|
||||
$sql = "INSERT INTO one_klinik.`order`
|
||||
(`orderDate`,
|
||||
`orderM_PatientID`,
|
||||
`orderM_DoctorID`,
|
||||
`orderAge`,
|
||||
`orderKeluhan`,
|
||||
`orderSubtotal`,
|
||||
`orderTotal`,
|
||||
`orderKeluhan`,
|
||||
`orderSubtotal`,
|
||||
`orderTotal`,
|
||||
`orderUserID`,
|
||||
`orderCreated`,
|
||||
orderQueueNumber,
|
||||
orderM_LocationID)
|
||||
VALUES (NOW(),?,?,?,?,?,?,$userid,NOW(),?,?)";
|
||||
orderM_LocationID,
|
||||
orderM_ClinicUnitID,
|
||||
orderM_CompanyID,
|
||||
orderM_MouID)
|
||||
VALUES (NOW(),?,?,?,?,?,?,$userid,NOW(),?,?,?,?)";
|
||||
|
||||
$save_order = $this->db_oneklinik->query($sql, array(
|
||||
$prm['patient']['M_PatientID'],
|
||||
@@ -1115,7 +1066,10 @@ class Registrationv3 extends MY_Controller
|
||||
$price,
|
||||
$price,
|
||||
$queueNumber,
|
||||
$setting_data['settingM_LocationID']
|
||||
$setting_data['settingM_LocationID'],
|
||||
$clinic_unit_id,
|
||||
$company_id,
|
||||
$mou_id
|
||||
));
|
||||
//echo $this->db_oneklinik->last_query();
|
||||
if ($save_order) {
|
||||
@@ -1270,4 +1224,163 @@ class Registrationv3 extends MY_Controller
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
function searchregion()
|
||||
{
|
||||
if (!$this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
$prm = $this->sys_input;
|
||||
$search = $prm['search'];
|
||||
|
||||
$sql = "SELECT
|
||||
r.regional_cd,
|
||||
r.regional_cd AS id,
|
||||
r.regional_nm,
|
||||
r.full_name AS text_nm,
|
||||
r.pro_cd, IFNULL(pro.regional_nm,'') AS pro_nm,
|
||||
r.kab_cd, IFNULL(kab.regional_nm,'') AS kab_nm,
|
||||
r.kec_cd, IFNULL(kec.regional_nm,'') AS kec_nm,
|
||||
r.kel_cd, IFNULL(kel.regional_nm,'') AS kel_nm,
|
||||
r.status_cd, r.old_nm
|
||||
FROM regional r
|
||||
LEFT JOIN regional pro ON CONCAT(r.pro_cd, REPEAT('0', 8)) = pro.regional_cd
|
||||
LEFT JOIN regional kab ON CONCAT(r.pro_cd, r.kab_cd, REPEAT('0', 6)) = kab.regional_cd
|
||||
LEFT JOIN regional kec ON CONCAT(r.pro_cd, r.kab_cd, r.kec_cd, REPEAT('0', 3)) = kec.regional_cd
|
||||
LEFT JOIN regional kel ON CONCAT(r.pro_cd, r.kab_cd, r.kec_cd, r.kel_cd) = kel.regional_cd
|
||||
WHERE
|
||||
r.full_name LIKE CONCAT('%','{$search}','%')
|
||||
LIMIT 100
|
||||
";
|
||||
|
||||
$qry = $this->db_onedev->query($sql);
|
||||
|
||||
if (!$qry) {
|
||||
$this->sys_error_db("search wilayah select error", $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
|
||||
$rows = $qry->result_array();
|
||||
|
||||
$result = array(
|
||||
"records" => $rows,
|
||||
"sql" => $this->db_onedev->last_query()
|
||||
);
|
||||
|
||||
$this->sys_ok($result);
|
||||
exit;
|
||||
}
|
||||
|
||||
function search_countries()
|
||||
{
|
||||
if (!$this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
$prm = $this->sys_input;
|
||||
$search = $prm['search'];
|
||||
|
||||
if (!$search || $search == '') {
|
||||
$search = 'Indonesia';
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM terminology WHERE attribute_path = 'Address.country' AND display LIKE '%$search%' ORDER BY display ASC LIMIT 20";
|
||||
$query = $this->db_onedev->query($sql);
|
||||
$rows = $query->result_array();
|
||||
$result = array("records" => $rows);
|
||||
$this->sys_ok($result);
|
||||
exit;
|
||||
}
|
||||
|
||||
function searchcompany()
|
||||
{
|
||||
if (!$this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
$prm = $this->sys_input;
|
||||
$search = $this->db_onedev->escape_like_str($prm['search'] ?? '');
|
||||
|
||||
$sql = "SELECT
|
||||
M_CompanyID AS id,
|
||||
M_CompanyName AS name,
|
||||
M_CompanyNumber AS number
|
||||
FROM m_company
|
||||
WHERE M_CompanyIsActive = 'Y'
|
||||
AND M_CompanyName LIKE '%{$search}%'
|
||||
ORDER BY M_CompanyName ASC
|
||||
LIMIT 20";
|
||||
|
||||
$query = $this->db_onedev->query($sql);
|
||||
if (!$query) {
|
||||
$this->sys_error_db("searchcompany error", $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
$this->sys_ok(array("records" => $query->result_array()));
|
||||
exit;
|
||||
}
|
||||
|
||||
function getmoubycompany()
|
||||
{
|
||||
if (!$this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
$prm = $this->sys_input;
|
||||
$company_id = intval($prm['company_id'] ?? 0);
|
||||
if (!$company_id) {
|
||||
$this->sys_error("company_id required");
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
M_MouID AS id,
|
||||
M_MouName AS name,
|
||||
M_MouNumber AS number,
|
||||
M_MouRefNumber AS ref_number,
|
||||
M_MouStartDate AS start_date,
|
||||
M_MouEndDate AS end_date
|
||||
FROM m_mou
|
||||
WHERE M_MouM_CompanyID = ?
|
||||
AND M_MouIsActive = 'Y'
|
||||
AND M_MouIsReleased = 'Y'
|
||||
AND CURDATE() BETWEEN M_MouStartDate AND M_MouEndDate
|
||||
ORDER BY M_MouName ASC";
|
||||
|
||||
$query = $this->db_onedev->query($sql, [$company_id]);
|
||||
if (!$query) {
|
||||
$this->sys_error_db("getmoubycompany error", $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
$this->sys_ok(array("records" => $query->result_array()));
|
||||
exit;
|
||||
}
|
||||
|
||||
function getpoli()
|
||||
{
|
||||
if (!$this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
M_ClinicUnitID AS id,
|
||||
M_ClinicUnitCode AS code,
|
||||
M_ClinicUnitName AS name,
|
||||
M_ClinicUnitDescription AS description,
|
||||
M_ClinicUnitSatusehatLocationID AS satusehat_location_id
|
||||
FROM one_klinik.m_clinic_unit
|
||||
WHERE M_ClinicUnitIsActive = 'Y'
|
||||
ORDER BY M_ClinicUnitID ASC";
|
||||
|
||||
$query = $this->db_oneklinik->query($sql);
|
||||
if (!$query) {
|
||||
$this->sys_error_db("getpoli error", $this->db_oneklinik);
|
||||
exit;
|
||||
}
|
||||
$rows = $query->result_array();
|
||||
$this->sys_ok(array("records" => $rows));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ class Anamnesedoctor extends MY_Controller
|
||||
parent::__construct();
|
||||
$this->db_onedev = $this->load->database("onedev", true);
|
||||
$this->db_oneklinik = $this->load->database("onedev", true);
|
||||
$this->load->library('ibl_encryptor');
|
||||
$this->IP_SOCKET_IO = "localhost";
|
||||
}
|
||||
|
||||
@@ -35,17 +36,27 @@ class Anamnesedoctor extends MY_Controller
|
||||
'N' divider,
|
||||
M_PatientID,
|
||||
M_PatientNoReg,
|
||||
M_PatientPhoto,
|
||||
M_PatientPhotoThumb,
|
||||
M_PatientPrefix,
|
||||
M_PatientName,
|
||||
M_PatientName_enc,
|
||||
M_PatientSuffix,
|
||||
M_PatientHP,
|
||||
M_PatientHP_enc,
|
||||
M_PatientEmail,
|
||||
M_PatientEmail_enc,
|
||||
M_PatientPOB,
|
||||
M_PatientPOB_enc,
|
||||
M_PatientPhone,
|
||||
M_PatientPhone_enc,
|
||||
M_PatientIDNumber,
|
||||
M_PatientIDNumber_enc,
|
||||
DATE_FORMAT(M_PatientDOB,'%d-%m-%Y') as M_PatientDOB,
|
||||
M_PatientDOB_enc,
|
||||
M_PatientNote,
|
||||
M_PatientNIK,
|
||||
M_PatientNIK_enc,
|
||||
M_PatientJabatan,
|
||||
M_PatientKedudukan,
|
||||
M_PatientPJ,
|
||||
@@ -61,9 +72,12 @@ class Anamnesedoctor extends MY_Controller
|
||||
M_IdTypeName,
|
||||
M_PatientIDNumber,
|
||||
IF(ISNULL(M_PatientSuspendID),'active','suspend' ) as status,
|
||||
M_PatientAddressM_KelurahanID M_KelurahanID,
|
||||
0 M_DistrictID,
|
||||
0 M_CityID,
|
||||
M_PatientAddressM_KelurahanID M_KelurahanID,
|
||||
M_PatientAddressRegionalCd,
|
||||
M_PatientAddressDescription,
|
||||
M_PatientAddressDescription_enc,
|
||||
0 M_DistrictID,
|
||||
0 M_CityID,
|
||||
0 M_ProvinceID
|
||||
FROM one_klinik.order
|
||||
JOIN m_patient ON M_PatientID = orderM_PatientID AND M_PatientIsActive = 'Y'
|
||||
@@ -86,26 +100,33 @@ class Anamnesedoctor extends MY_Controller
|
||||
$rows = $query->result_array();
|
||||
|
||||
foreach ($rows as $k => $v) {
|
||||
$rows[$k]['M_PatientName'] = stripslashes($rows[$k]['M_PatientName']);
|
||||
$rows[$k]['M_PatientAddressDescription'] = stripslashes($v['M_PatientAddressDescription']);
|
||||
$patient_name = str_replace("'", "\\'", $prm['M_PatientName']);
|
||||
$sql = "SELECT *, concat('{$rows[$k]['M_PatientAddressDescription']}', '\n\n',
|
||||
m_kelurahanname, ', ',
|
||||
m_districtname,'\n',
|
||||
m_cityname, ', ',
|
||||
m_provincename) as xaddress
|
||||
FROM m_kelurahan
|
||||
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID
|
||||
JOIN m_city ON M_DistrictM_CityID = M_CityID
|
||||
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID
|
||||
WHERE
|
||||
M_KelurahanID = {$v['M_KelurahanID']} ";
|
||||
//echo $sql;
|
||||
$row_address = $this->db_onedev->query($sql)->row_array();
|
||||
$rows[$k]['M_PatientAddress'] = stripslashes($row_address['xaddress']);
|
||||
$rows[$k]['M_DistrictID'] = $row_address['M_DistrictID'];
|
||||
$rows[$k]['M_CityID'] = $row_address['M_CityID'];
|
||||
$rows[$k]['M_ProvinceID'] = $row_address['M_ProvinceID'];
|
||||
$enc = $this->ibl_encryptor;
|
||||
$rows[$k]['M_PatientName'] = $enc->decrypt($v['M_PatientName_enc'] ?? '') ?: stripslashes($v['M_PatientName']);
|
||||
$rows[$k]['M_PatientHP'] = $enc->decrypt($v['M_PatientHP_enc'] ?? '') ?: $v['M_PatientHP'];
|
||||
$rows[$k]['M_PatientEmail'] = $enc->decrypt($v['M_PatientEmail_enc'] ?? '') ?: $v['M_PatientEmail'];
|
||||
$rows[$k]['M_PatientPOB'] = $enc->decrypt($v['M_PatientPOB_enc'] ?? '') ?: $v['M_PatientPOB'];
|
||||
$rows[$k]['M_PatientPhone'] = $enc->decrypt($v['M_PatientPhone_enc'] ?? '') ?: $v['M_PatientPhone'];
|
||||
$rows[$k]['M_PatientIDNumber'] = $enc->decrypt($v['M_PatientIDNumber_enc'] ?? '') ?: $v['M_PatientIDNumber'];
|
||||
$rows[$k]['M_PatientDOB'] = $enc->decrypt($v['M_PatientDOB_enc'] ?? '') ?: $v['M_PatientDOB'];
|
||||
$rows[$k]['M_PatientNIK'] = $enc->decrypt($v['M_PatientNIK_enc'] ?? '') ?: $v['M_PatientNIK'];
|
||||
$rows[$k]['M_PatientAddressDescription'] = $enc->decrypt($v['M_PatientAddressDescription_enc'] ?? '') ?: stripslashes($v['M_PatientAddressDescription'] ?? '');
|
||||
|
||||
$reg_cd = $v['M_PatientAddressRegionalCd'] ?? '';
|
||||
if ($reg_cd) {
|
||||
$reg = $this->db_onedev->query(
|
||||
"SELECT r_kel.regional_nm as kel_name, r_kec.regional_nm as kec_name, r_kab.regional_nm as kab_name, r_pro.regional_nm as pro_name
|
||||
FROM regional r_kel
|
||||
LEFT JOIN regional r_kec ON r_kec.regional_cd = CONCAT(r_kel.pro_cd, r_kel.kab_cd, r_kel.kec_cd, '000')
|
||||
LEFT JOIN regional r_kab ON r_kab.regional_cd = CONCAT(r_kel.pro_cd, r_kel.kab_cd, '000', '000')
|
||||
LEFT JOIN regional r_pro ON r_pro.regional_cd = CONCAT(r_kel.pro_cd, '00', '000', '000')
|
||||
WHERE r_kel.regional_cd = ?", [$reg_cd]
|
||||
)->row_array();
|
||||
$rows[$k]['M_PatientAddress'] = $rows[$k]['M_PatientAddressDescription'] . "\n\n" .
|
||||
implode(', ', array_filter([$reg['kel_name'] ?? '', $reg['kec_name'] ?? '', $reg['kab_name'] ?? '', $reg['pro_name'] ?? '']));
|
||||
} else {
|
||||
$rows[$k]['M_PatientAddress'] = $rows[$k]['M_PatientAddressDescription'];
|
||||
}
|
||||
|
||||
$info = $this->db_onedev->query("SELECT fn_fo_patient_visit(?) info", [$v['M_PatientID']])->row();
|
||||
$rows[$k]['info'] = json_decode($info->info);
|
||||
}
|
||||
|
||||
@@ -12,16 +12,16 @@ class Screening extends MY_Controller
|
||||
parent::__construct();
|
||||
$this->db_onedev = $this->load->database("onedev", true);
|
||||
$this->db_oneklinik = $this->load->database("onedev", true);
|
||||
$this->load->library('ibl_encryptor');
|
||||
}
|
||||
|
||||
public function search()
|
||||
{
|
||||
|
||||
$prm = $this->sys_input;
|
||||
$id = $prm['id'];
|
||||
$id = $this->db_onedev->escape_str($prm['id']);
|
||||
|
||||
$sql = "SELECT orderID,
|
||||
orderDate,
|
||||
$sql = "SELECT orderID,
|
||||
orderDate,
|
||||
orderNumber,
|
||||
orderIsScreening,
|
||||
orderIsAnamnese,
|
||||
@@ -32,14 +32,8 @@ class Screening extends MY_Controller
|
||||
M_PatientID,
|
||||
M_PatientNoReg,
|
||||
M_PatientPrefix,
|
||||
M_PatientName,
|
||||
M_PatientSuffix,
|
||||
M_PatientHP,
|
||||
M_PatientEmail,
|
||||
M_PatientPOB,
|
||||
M_PatientPhone,
|
||||
M_PatientIDNumber,
|
||||
DATE_FORMAT(M_PatientDOB,'%d-%m-%Y') as M_PatientDOB,
|
||||
concat(M_TitleName,' ',IFNULL(M_PatientPrefix,''),' ',M_PatientName,' ',IFNULL(M_PatientSuffix,'')) M_PatientNameRaw,
|
||||
M_PatientNote,
|
||||
M_PatientNIK,
|
||||
M_PatientJabatan,
|
||||
@@ -49,74 +43,59 @@ class Screening extends MY_Controller
|
||||
M_PatientJob,
|
||||
M_PatientM_SexID,
|
||||
M_SexName,
|
||||
M_TitleID, M_TitleName,
|
||||
M_PatientM_TitleID,
|
||||
M_TitleName,
|
||||
M_PatientM_ReligionID,
|
||||
M_ReligionName,
|
||||
IFNULL(M_ReligionName,'-') M_ReligionName,
|
||||
M_PatientM_IdTypeID,
|
||||
M_IdTypeName,
|
||||
M_PatientIDNumber,
|
||||
IF(ISNULL(M_PatientSuspendID),'active','suspend' ) as status,
|
||||
M_PatientAddressM_KelurahanID M_KelurahanID,
|
||||
0 M_DistrictID,
|
||||
0 M_CityID,
|
||||
0 M_ProvinceID
|
||||
FROM one_klinik.order
|
||||
IF(ISNULL(M_PatientSuspendID),'active','suspend') as status,
|
||||
M_PatientAddressRegionalCd,
|
||||
M_PatientName_enc, M_PatientHP_enc, M_PatientDOB_enc,
|
||||
M_PatientEmail_enc, M_PatientPhone_enc, M_PatientPOB_enc,
|
||||
M_PatientIDNumber_enc, M_PatientNIK_enc, M_PatientAddressDescription_enc
|
||||
FROM one_klinik.`order`
|
||||
JOIN m_patient ON M_PatientID = orderM_PatientID AND M_PatientIsActive = 'Y'
|
||||
JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
||||
JOIN m_sex ON M_PatientM_SexID = M_SexID
|
||||
JOIN m_branch ON M_BranchIsActive = 'Y' AND M_BranchIsDefault = 'Y'
|
||||
JOIN m_patientaddress ON M_PatientAddressM_PatientID = M_PatientID AND M_PatientAddressIsActive = 'Y'
|
||||
LEFT JOIN m_idtype ON M_IdTypeID = M_PatientM_IdTypeID AND M_IdTypeIsActive = 'Y'
|
||||
LEFT JOIN m_religion ON m_patientm_religionid = m_religionid
|
||||
LEFT JOIN m_religion ON M_PatientM_ReligionID = M_ReligionID
|
||||
LEFT JOIN m_patientsuspend ON M_PatientSuspendM_PatientID = M_PatientID AND M_PatientSuspendIsActive = 'Y'
|
||||
WHERE
|
||||
orderNumber = '{$id}' AND
|
||||
M_PatientSuspendID IS NULL
|
||||
|
||||
WHERE orderNumber = '{$id}' AND M_PatientSuspendID IS NULL
|
||||
GROUP BY M_PatientID";
|
||||
//echo $sql;
|
||||
|
||||
$query = $this->db_onedev->query($sql);
|
||||
|
||||
if ($query) {
|
||||
$rows = $query->result_array();
|
||||
|
||||
foreach ($rows as $k => $v)
|
||||
{
|
||||
$rows[$k]['M_PatientName'] = stripslashes($rows[$k]['M_PatientName']);
|
||||
$rows[$k]['M_PatientAddressDescription'] = stripslashes($v['M_PatientAddressDescription']);
|
||||
$patient_name = str_replace("'", "\\'", $prm['M_PatientName']);
|
||||
$sql = "SELECT *, concat('{$rows[$k]['M_PatientAddressDescription'] }', '\n\n',
|
||||
m_kelurahanname, ', ',
|
||||
m_districtname,'\n',
|
||||
m_cityname, ', ',
|
||||
m_provincename) as xaddress
|
||||
FROM m_kelurahan
|
||||
JOIN m_district ON M_KelurahanM_DistrictID = M_DistrictID
|
||||
JOIN m_city ON M_DistrictM_CityID = M_CityID
|
||||
JOIN m_province ON M_CityM_ProvinceID = M_ProvinceID
|
||||
WHERE
|
||||
M_KelurahanID = {$v['M_KelurahanID']} ";
|
||||
//echo $sql;
|
||||
$row_address = $this->db_onedev->query($sql)->row_array();
|
||||
$rows[$k]['M_PatientAddress'] = stripslashes($row_address['xaddress']);
|
||||
$rows[$k]['M_DistrictID'] = $row_address['M_DistrictID'];
|
||||
$rows[$k]['M_CityID'] = $row_address['M_CityID'];
|
||||
$rows[$k]['M_ProvinceID'] = $row_address['M_ProvinceID'];
|
||||
$info = $this->db_onedev->query("SELECT fn_fo_patient_visit(?) info", [$v['M_PatientID']])->row();
|
||||
$rows[$k]['info'] = json_decode($info->info);
|
||||
|
||||
}
|
||||
|
||||
$result = array("total" => 1, "records" => $rows, "sql"=> $this->db_onedev->last_query());
|
||||
$this->sys_ok($result);
|
||||
}
|
||||
else {
|
||||
$this->sys_error_db("m_patient rows",$this->db_onedev);
|
||||
exit;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("order rows", $this->db_onedev);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$rows = $query->result_array();
|
||||
$enc = $this->ibl_encryptor;
|
||||
|
||||
foreach ($rows as $k => $v) {
|
||||
$rows[$k]['M_PatientName'] = $enc->decrypt($v['M_PatientName_enc']) ?? $v['M_PatientNameRaw'];
|
||||
$rows[$k]['M_PatientHP'] = $enc->decrypt($v['M_PatientHP_enc']) ?? '';
|
||||
$rows[$k]['M_PatientEmail'] = $enc->decrypt($v['M_PatientEmail_enc']) ?? '';
|
||||
$rows[$k]['M_PatientPOB'] = $enc->decrypt($v['M_PatientPOB_enc']) ?? '';
|
||||
$rows[$k]['M_PatientPhone'] = $enc->decrypt($v['M_PatientPhone_enc']) ?? '';
|
||||
$rows[$k]['M_PatientIDNumber'] = $enc->decrypt($v['M_PatientIDNumber_enc']) ?? '';
|
||||
$rows[$k]['M_PatientNIK'] = $enc->decrypt($v['M_PatientNIK_enc']) ?? '';
|
||||
$rows[$k]['M_PatientDOB'] = $enc->decrypt($v['M_PatientDOB_enc']) ?? '';
|
||||
$rows[$k]['dob_ina'] = $rows[$k]['M_PatientDOB'];
|
||||
$rows[$k]['M_PatientAddressDescription'] = $enc->decrypt($v['M_PatientAddressDescription_enc']) ?? '';
|
||||
$rows[$k]['M_PatientAddress'] = $rows[$k]['M_PatientAddressDescription'];
|
||||
|
||||
foreach (array_keys($rows[$k]) as $col) {
|
||||
if (substr($col, -4) === '_enc') unset($rows[$k][$col]);
|
||||
}
|
||||
unset($rows[$k]['M_PatientNameRaw']);
|
||||
|
||||
$info = $this->db_onedev->query("SELECT fn_fo_patient_visit(?) info", [$v['M_PatientID']])->row();
|
||||
$rows[$k]['info'] = json_decode($info->info);
|
||||
}
|
||||
|
||||
$this->sys_ok(["total" => count($rows), "records" => $rows]);
|
||||
}
|
||||
|
||||
|
||||
@@ -154,6 +133,48 @@ class Screening extends MY_Controller
|
||||
}
|
||||
|
||||
|
||||
function getsexreg()
|
||||
{
|
||||
if (!$this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
$rows = [];
|
||||
$rows['default_location'] = [];
|
||||
|
||||
$rows['doctors'] = $this->db_onedev->query(
|
||||
"SELECT M_DoctorID as id, M_DoctorCode as code, M_DoctorName as name,
|
||||
M_DoctorMcuDefaultKlinik as is_default, M_DoctorMcuPriceKlinik as price
|
||||
FROM m_doctormcu JOIN m_doctor ON M_DoctorMcuM_DoctorID = M_DoctorID
|
||||
WHERE M_DoctorMcuIsActive = 'Y'"
|
||||
)->result_array();
|
||||
|
||||
$rows['default_doctor'] = [];
|
||||
foreach ($rows['doctors'] as $value) {
|
||||
if ($value['is_default'] == 'Y') { $rows['default_doctor'] = $value; break; }
|
||||
}
|
||||
|
||||
$rows['titles'] = $this->db_onedev->query("SELECT * FROM m_title WHERE M_TitleIsActive = 'Y'")->result_array();
|
||||
$rows['sexes'] = $this->db_onedev->query("SELECT * FROM m_sex WHERE M_SexIsActive = 'Y'")->result_array();
|
||||
$rows['religions'] = $this->db_onedev->query("SELECT * FROM m_religion WHERE M_ReligionIsActive = 'Y'")->result_array();
|
||||
$rows['kartuidentitass'] = $this->db_onedev->query("SELECT * FROM m_idtype WHERE M_IdTypeIsActive = 'Y'")->result_array();
|
||||
|
||||
$branch = $this->db_onedev->query("SELECT * FROM m_branch WHERE M_BranchIsDefault = 'Y' AND M_BranchIsActive = 'Y'")->row_array();
|
||||
if ($branch) {
|
||||
$rows['default_location']['city_address'] = $this->db_onedev->query("SELECT * FROM m_city WHERE M_CityIsActive = 'Y' AND M_CityID = ?", [$branch['M_BranchM_CityID']])->row_array();
|
||||
$rows['default_location']['cities'] = $this->db_onedev->query("SELECT * FROM m_city WHERE M_CityIsActive = 'Y' AND M_CityM_ProvinceID = ?", [$rows['default_location']['city_address']['M_CityM_ProvinceID']])->result_array();
|
||||
$rows['default_location']['province_address'] = $this->db_onedev->query("SELECT * FROM m_province WHERE M_ProvinceIsActive = 'Y' AND M_ProvinceID = ?", [$rows['default_location']['city_address']['M_CityM_ProvinceID']])->row_array();
|
||||
$rows['default_location']['provinces'] = $this->db_onedev->query("SELECT * FROM m_province WHERE M_ProvinceIsActive = 'Y'")->result_array();
|
||||
$rows['default_location']['districts'] = $this->db_onedev->query("SELECT * FROM m_district WHERE M_DistrictIsActive = 'Y' AND M_DistrictM_CityID = ?", [$branch['M_BranchM_CityID']])->result_array();
|
||||
$rows['default_location']['district_address'] = $this->db_onedev->query("SELECT * FROM m_district WHERE M_DistrictIsActive = 'Y' AND M_DistrictID = ?", [$branch['M_BranchM_DistrictID']])->row_array();
|
||||
$rows['default_location']['kelurahans'] = $this->db_onedev->query("SELECT * FROM m_kelurahan WHERE M_KelurahanIsActive = 'Y' AND M_KelurahanM_DistrictID = ?", [$branch['M_BranchM_DistrictID']])->result_array();
|
||||
$rows['default_location']['kelurahan_address'] = $this->db_onedev->query("SELECT * FROM m_kelurahan WHERE M_KelurahanIsActive = 'Y' AND M_KelurahanID = ?", [$branch['M_BranchM_KelurahanID']])->row_array();
|
||||
}
|
||||
|
||||
$this->sys_ok(["total" => count($rows), "records" => $rows]);
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function objToArray($obj)
|
||||
{
|
||||
// Not an object or array
|
||||
@@ -184,26 +205,47 @@ class Screening extends MY_Controller
|
||||
$status = $prm['status'];
|
||||
|
||||
$sql = "SELECT 'N' divider,
|
||||
CONCAT(IF(ISNULL(M_TitleName),'',CONCAT(M_TitleName,'. ')),M_PatientName) as patient_name,
|
||||
M_PatientName, M_PatientName_enc,
|
||||
M_PatientHP, M_PatientHP_enc,
|
||||
M_PatientDOB, M_PatientDOB_enc,
|
||||
M_PatientEmail, M_PatientEmail_enc,
|
||||
M_PatientPhone, M_PatientPhone_enc,
|
||||
M_PatientPOB, M_PatientPOB_enc,
|
||||
M_PatientIDNumber, M_PatientIDNumber_enc,
|
||||
M_PatientNIK, M_PatientNIK_enc,
|
||||
M_PatientPhoto, M_PatientPhotoThumb,
|
||||
`order`.*,DATE_FORMAT(orderDate,'%d-%m-%Y') as date_order,
|
||||
'' as kode_status, '' as status
|
||||
'' as kode_status, '' as status,
|
||||
M_TitleName, M_PatientNoReg, M_PatientM_SexID
|
||||
FROM one_klinik.`order`
|
||||
JOIN m_patient ON orderM_PatientID = M_PatientID
|
||||
LEFT JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
||||
WHERE
|
||||
orderIsActive = 'Y' AND DATE(orderDate) = ? AND orderIsScreening = ?
|
||||
WHERE
|
||||
orderIsActive = 'Y' AND DATE(orderDate) = ? AND orderIsScreening = ?
|
||||
LIMIT $number_limit offset $number_offset";
|
||||
//echo $sql;
|
||||
$query = $this->db_oneklinik->query($sql,array($xdate,$status));
|
||||
//echo $this->db_oneklinik->last_query();
|
||||
|
||||
if ($query) {
|
||||
if ($query) {
|
||||
$rows = $query->result_array();
|
||||
$result = array("total" => $tot_page, "records" => $rows, "sql"=> $this->db_onedev->last_query());
|
||||
$enc = $this->ibl_encryptor;
|
||||
foreach ($rows as $k => $v) {
|
||||
$rows[$k]['M_PatientName'] = $enc->decrypt($v['M_PatientName_enc'] ?? '') ?: $v['M_PatientName'];
|
||||
$rows[$k]['M_PatientHP'] = $enc->decrypt($v['M_PatientHP_enc'] ?? '') ?: $v['M_PatientHP'];
|
||||
$rows[$k]['M_PatientDOB'] = $enc->decrypt($v['M_PatientDOB_enc'] ?? '') ?: $v['M_PatientDOB'];
|
||||
$rows[$k]['M_PatientEmail'] = $enc->decrypt($v['M_PatientEmail_enc'] ?? '') ?: $v['M_PatientEmail'];
|
||||
$rows[$k]['M_PatientPhone'] = $enc->decrypt($v['M_PatientPhone_enc'] ?? '') ?: $v['M_PatientPhone'];
|
||||
$rows[$k]['M_PatientPOB'] = $enc->decrypt($v['M_PatientPOB_enc'] ?? '') ?: $v['M_PatientPOB'];
|
||||
$rows[$k]['M_PatientIDNumber'] = $enc->decrypt($v['M_PatientIDNumber_enc'] ?? '') ?: $v['M_PatientIDNumber'];
|
||||
$rows[$k]['M_PatientNIK'] = $enc->decrypt($v['M_PatientNIK_enc'] ?? '') ?: $v['M_PatientNIK'];
|
||||
$rows[$k]['patient_name'] = trim(($v['M_TitleName'] ?? '') . ' ' . $rows[$k]['M_PatientName']);
|
||||
}
|
||||
$result = array("total" => $tot_page, "records" => $rows, "sql"=> $this->db_oneklinik->last_query());
|
||||
$this->sys_ok($result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->sys_error_db("m_patient rows",$this->db_onedev);
|
||||
$this->sys_error_db("m_patient rows",$this->db_oneklinik);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@@ -298,7 +298,88 @@ INSERT INTO `t_samplestation` (`T_SampleStationID`, `T_SampleStationCode`, `T_Sa
|
||||
GROUP BY T_OrderHeaderID
|
||||
HAVING last_status_fo IN (3,5)
|
||||
|
||||
|
||||
UNION
|
||||
|
||||
SELECT
|
||||
orderID AS T_OrderHeaderID,
|
||||
T_OrderHeaderDate,
|
||||
orderNumber AS T_OrderHeaderLabNumber,
|
||||
T_OrderHeaderLabNumberExt,
|
||||
orderQueueNumber AS T_OrderHeaderQueue,
|
||||
T_OrderHeaderM_PatientID,
|
||||
T_OrderHeaderM_CompanyID,
|
||||
T_OrderHeaderM_MouID,
|
||||
orderAge AS T_OrderHeaderM_PatientAge,
|
||||
T_OrderHeaderSenderM_DoctorID,
|
||||
T_OrderHeaderSenderM_DoctorAddressID,
|
||||
T_OrderHeaderPjM_DoctorID,
|
||||
T_OrderHeaderM_LangID,
|
||||
T_OrderHeaderLangIsSI,
|
||||
'N' AS T_OrderHeaderIsCito,
|
||||
T_OrderHeaderNat_CitoID,
|
||||
T_OrderHeaderDiagnose,
|
||||
T_OrderHeaderDoctorNote,
|
||||
T_OrderHeaderVerificationNote,
|
||||
T_OrderHeaderVerificationNoteM_UserID,
|
||||
T_OrderHeaderFoNote,
|
||||
T_OrderHeaderSamplingNote,
|
||||
T_OrderHeaderResultNote,
|
||||
T_OrderHeaderFoNoteM_UserID,
|
||||
T_OrderHeaderSamplingNoteM_UserID,
|
||||
T_OrderHeaderResultNoteM_UserID,
|
||||
T_OrderHeaderReceivedSample,
|
||||
T_OrderHeaderSubTotal,
|
||||
T_OrderHeaderRounding,
|
||||
T_OrderHeaderTotal,
|
||||
T_OrderHeaderCreated,
|
||||
T_OrderHeaderLastUpdated,
|
||||
T_OrderHeaderCreatedUserID,
|
||||
T_OrderHeaderIsActive,
|
||||
m_patient.*,
|
||||
M_SexName,
|
||||
M_TitleName,
|
||||
CONCAT(M_TitleName,' ',M_PatientName) as patient_fullname,
|
||||
'' AS M_CompanyName,
|
||||
fn_sampling_clinic_queue_status_name(orderID, M_LocationT_SampleStationID) as status,
|
||||
|
||||
fn_sampling_clinic_queue_status_id(orderID, M_LocationT_SampleStationID) as statusid,
|
||||
M_LocationT_SampleStationID AS T_SampleStationID,
|
||||
'' AS T_SampleTypeID,
|
||||
M_LocationT_SampleStationID as stationid,
|
||||
NULL AS T_OrderPromiseDateTime,
|
||||
'N' as iscito,
|
||||
3 as last_status_fo,
|
||||
DATE_FORMAT(orderDate,'%d-%m-%Y %H:%i') as order_date,
|
||||
IFNULL(T_OrderHeaderFoNote,'') as fo_note,
|
||||
IFNULL(T_OrderHeaderVerificationNote,'') as fo_ver_note,
|
||||
fn_sampling_reqs(T_OrderHeaderID) as fo_requirements,
|
||||
'' as htmlforeqs,
|
||||
IF(fn_fo_ver_have_reqs(T_OrderHeaderID) = 0,'Y','N') as fo_ver_status_req,
|
||||
fn_fo_reg_have_reqs(T_OrderHeaderID) as fo_reg_status_req,
|
||||
fn_sampling_reqs_status(T_OrderHeaderID) as fo_requirements_status,
|
||||
IF(fn_fo_get_verification_status(T_OrderHeaderID) = 0, 'X','Y') as fo_verification_status,
|
||||
IFNULL(T_OrderHeaderSamplingNote,'') as sampling_note,
|
||||
'N' as status_coming,
|
||||
orderM_LocationID as order_location_id,
|
||||
IFNULL(AntrianSampleStationTime, orderDate) as antri_time,
|
||||
IFNULL(AntrianSampleStationTime, orderDate) as skip_time,
|
||||
'Y' AS is_clinic,
|
||||
'' as flag_antrian
|
||||
FROM one_klinik.order
|
||||
JOIN m_patient
|
||||
ON orderM_PatientID = M_PatientID
|
||||
AND M_PatientIsActive = 'Y'
|
||||
JOIN m_title ON M_PatientM_TitleID = M_TitleID
|
||||
JOIN m_sex ON M_PatientM_SexID = M_SexID
|
||||
JOIN m_location ON orderM_LocationID = M_LocationID
|
||||
LEFT JOIN t_orderheader
|
||||
ON orderT_OrderHeaderID = T_OrderHeaderID
|
||||
AND T_OrderHeaderIsActive = 'Y'
|
||||
LEFT JOIN antrian_samplestation
|
||||
ON orderID = AntrianSampleStationOrderID AND AntrianSampleStationIsActive = 'Y'
|
||||
$sql_where_klinik
|
||||
HAVING last_status_fo IN (3,5)
|
||||
|
||||
) x
|
||||
ORDER BY T_OrderHeaderIsCito DESC, antri_time ASC
|
||||
";
|
||||
@@ -316,6 +397,12 @@ INSERT INTO `t_samplestation` (`T_SampleStationID`, `T_SampleStationCode`, `T_Sa
|
||||
if ($key + 1 != $count_arr) {
|
||||
$rows[$key]['skip_time'] = $rows[$key + 1]['antri_time'];
|
||||
}
|
||||
$enc = $this->ibl_encryptor;
|
||||
$rows[$key]['M_PatientName'] = $enc->decrypt($value['M_PatientName_enc'] ?? '') ?: $value['M_PatientName'];
|
||||
$rows[$key]['M_PatientHP'] = $enc->decrypt($value['M_PatientHP_enc'] ?? '') ?: $value['M_PatientHP'];
|
||||
$rows[$key]['M_PatientEmail'] = $enc->decrypt($value['M_PatientEmail_enc'] ?? '') ?: $value['M_PatientEmail'];
|
||||
$rows[$key]['M_PatientDOB'] = $enc->decrypt($value['M_PatientDOB_enc'] ?? '') ?: $value['M_PatientDOB'];
|
||||
$rows[$key]['patient_fullname'] = trim(($value['M_TitleName'] ?? '') . ' ' . $rows[$key]['M_PatientName']);
|
||||
if($value['is_clinic'] == 'Y'){
|
||||
//print_r($value);
|
||||
$sql = "SELECT ScreeningParameterDisplay as display
|
||||
|
||||
24
catatan_meeting_klinik_internal.md
Normal file
24
catatan_meeting_klinik_internal.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Catatan Meeting Klinik Internal
|
||||
|
||||
## Task List IBL
|
||||
|
||||
### Registrasi Klinik (`klinik/Registrationv3.php`)
|
||||
- [x] Tambah `searchregion` dan `search_countries` (samakan dg `ibl_registration/Patient.php`)
|
||||
- [x] Fix `search()` — hapus kelurahan sub-query, tambah PDP decrypt inline
|
||||
- [x] Fix `getaddress()` — gunakan tabel `regional` via `M_PatientAddressRegionalCd`
|
||||
- [x] Fix `newpatient()` — simpan `M_PatientAddressRegionalCd`, City, State, District, Village, Country, CountryCode, Note
|
||||
- [x] Fix `editpatient()` — terapkan `_mask_dob()` ke `M_PatientDOB`
|
||||
- [x] Tambah `_mask_dob()` — masking DOB sesuai PDP UU No. 27/2022
|
||||
|
||||
### Screening Klinik (`klinik/screening/Screening.php`)
|
||||
- [x] Fix `search()` — hapus kelurahan sub-query, tambah PDP decrypt
|
||||
- [x] Tambah `getsexreg()` — samakan dg Registrationv3
|
||||
|
||||
### Sampling Call (`mockup/doctorclinicv2/Samplingcall.php`)
|
||||
- [x] Tambah UNION SELECT dari `one_klinik.order` agar antrian klinik muncul
|
||||
- [ ] Debug: order klinik masih belum muncul di antrian — cek params `locationid`, `stationid`, `xdate`
|
||||
|
||||
### Pending / Belum Dikerjakan
|
||||
- [ ]
|
||||
- [ ]
|
||||
- [ ]
|
||||
@@ -0,0 +1,5 @@
|
||||
-- Tambah kolom orderM_ClinicUnitID ke one_klinik.order
|
||||
-- Untuk menyimpan poli yang dipilih saat registrasi
|
||||
|
||||
ALTER TABLE one_klinik.`order`
|
||||
ADD COLUMN orderM_ClinicUnitID INT(11) NULL DEFAULT NULL AFTER orderM_LocationID;
|
||||
@@ -0,0 +1,5 @@
|
||||
-- Tambah orderM_CompanyID ke one_klinik.order
|
||||
-- (orderM_MouID sudah ada sebelumnya)
|
||||
|
||||
ALTER TABLE one_klinik.`order`
|
||||
ADD COLUMN orderM_CompanyID INT(11) NULL DEFAULT NULL AFTER orderM_ClinicUnitID;
|
||||
23
sql/manual_changes/2026-06-10-create-m-clinic-unit.sql
Normal file
23
sql/manual_changes/2026-06-10-create-m-clinic-unit.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- Buat tabel m_clinic_unit di one_klinik
|
||||
-- Untuk master poli klinik, bagian dari SATUSEHAT readiness
|
||||
|
||||
CREATE TABLE IF NOT EXISTS one_klinik.m_clinic_unit (
|
||||
M_ClinicUnitID INT(11) NOT NULL AUTO_INCREMENT,
|
||||
M_ClinicUnitCode VARCHAR(30) NOT NULL DEFAULT '',
|
||||
M_ClinicUnitName VARCHAR(100) NOT NULL DEFAULT '',
|
||||
M_ClinicUnitDescription VARCHAR(255) NULL DEFAULT NULL,
|
||||
M_ClinicUnitSatusehatLocationID VARCHAR(64) NULL DEFAULT NULL,
|
||||
M_ClinicUnitIsActive CHAR(1) NOT NULL DEFAULT 'Y',
|
||||
M_ClinicUnitUserID INT(11) NULL DEFAULT NULL,
|
||||
M_ClinicUnitCreated DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
M_ClinicUnitLastUpdated DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (M_ClinicUnitID),
|
||||
UNIQUE KEY M_ClinicUnitCode (M_ClinicUnitCode),
|
||||
KEY M_ClinicUnitIsActive (M_ClinicUnitIsActive)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
INSERT INTO one_klinik.m_clinic_unit (M_ClinicUnitCode, M_ClinicUnitName, M_ClinicUnitDescription, M_ClinicUnitIsActive) VALUES
|
||||
('POLI_UMUM', 'Poli Umum', 'Pelayanan rawat jalan umum', 'Y'),
|
||||
('POLI_VAKSINASI', 'Poli Vaksinasi', 'Pelayanan imunisasi/vaksinasi', 'Y'),
|
||||
('POLI_KHITAN', 'Poli Khitan', 'Pelayanan tindakan khitan', 'Y'),
|
||||
('POLI_MCU', 'Poli MCU', 'Pelayanan medical check-up', 'Y');
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Fix settingM_LocationID di one_klinik.setting
|
||||
-- Sebelumnya 11 (R. AUDIOMETRI), seharusnya 30 (R. PEMERIKSAAN FISIK DOKTER)
|
||||
-- agar orderM_LocationID pada order klinik baru sesuai dengan locationid
|
||||
-- yang dipakai halaman sampling call queue (locationid=30, stationid=7)
|
||||
|
||||
UPDATE one_klinik.setting
|
||||
SET settingM_LocationID = 30
|
||||
WHERE settingID = 9;
|
||||
252
task_refactor_workflow_klinik_satusehat.md
Normal file
252
task_refactor_workflow_klinik_satusehat.md
Normal file
@@ -0,0 +1,252 @@
|
||||
# Task: Refactor Workflow Klinik untuk SATUSEHAT Readiness
|
||||
|
||||
Saat ini alur klinik:
|
||||
|
||||
Registrasi
|
||||
→ Screening
|
||||
→ Pemeriksaan Dokter
|
||||
→ Kasir
|
||||
|
||||
Pada menu dokter terdapat:
|
||||
|
||||
- Anamnesa
|
||||
- Pemeriksaan Tanda Vital
|
||||
- Pemeriksaan Fisik
|
||||
- Pemeriksaan Penunjang
|
||||
- Diagnosis
|
||||
- Tindakan Medis
|
||||
- Resep
|
||||
- Saran
|
||||
|
||||
Target sistem:
|
||||
|
||||
- Klinik Umum
|
||||
- Vaksinasi
|
||||
- Khitan
|
||||
- Integrasi SATUSEHAT
|
||||
|
||||
## Perubahan yang harus dibuat
|
||||
|
||||
### 1. Master Poli
|
||||
|
||||
Buat tabel:
|
||||
|
||||
m_clinic_unit
|
||||
|
||||
Fields:
|
||||
|
||||
- id
|
||||
- code
|
||||
- name
|
||||
- description
|
||||
- satusehat_location_id
|
||||
- is_active
|
||||
|
||||
Data awal:
|
||||
|
||||
- POLI_UMUM
|
||||
- POLI_VAKSINASI
|
||||
- POLI_KHITAN
|
||||
- POLI_MCU
|
||||
|
||||
Registrasi harus memilih poli.
|
||||
|
||||
---
|
||||
|
||||
### 2. Template Screening
|
||||
|
||||
Buat sistem screening dinamis.
|
||||
|
||||
Table:
|
||||
|
||||
m_screening_template
|
||||
- id
|
||||
- code
|
||||
- name
|
||||
|
||||
m_screening_question
|
||||
- id
|
||||
- template_id
|
||||
- question
|
||||
- question_type
|
||||
- sort_order
|
||||
- is_required
|
||||
|
||||
t_screening_answer
|
||||
- id
|
||||
- registration_id
|
||||
- question_id
|
||||
- answer
|
||||
|
||||
Template awal:
|
||||
|
||||
RAWAT_JALAN
|
||||
- Kesadaran
|
||||
- Pernapasan
|
||||
- Nyeri Dada
|
||||
- Skala Nyeri
|
||||
- Risiko Jatuh
|
||||
- Batuk > 2 Minggu
|
||||
|
||||
VAKSINASI
|
||||
- Demam > 38
|
||||
- Sedang sakit akut
|
||||
- Riwayat anafilaksis
|
||||
- Alergi vaksin
|
||||
- Layak vaksin
|
||||
|
||||
KHITAN
|
||||
- Gangguan pembekuan darah
|
||||
- Alergi anestesi
|
||||
- Diabetes
|
||||
- Layak tindakan
|
||||
|
||||
MCU
|
||||
- gunakan template kosong terlebih dahulu
|
||||
|
||||
Poli menentukan template screening yang digunakan.
|
||||
|
||||
---
|
||||
|
||||
### 3. Pisahkan TTV dari Menu Dokter
|
||||
|
||||
Buat modul baru:
|
||||
|
||||
t_vital_sign
|
||||
|
||||
Fields:
|
||||
|
||||
- registration_id
|
||||
- systolic
|
||||
- diastolic
|
||||
- pulse
|
||||
- respiratory_rate
|
||||
- temperature
|
||||
- weight
|
||||
- height
|
||||
- bmi
|
||||
- created_by
|
||||
- created_at
|
||||
|
||||
Workflow:
|
||||
|
||||
Registrasi
|
||||
→ Screening
|
||||
→ TTV
|
||||
→ Dokter
|
||||
|
||||
Dokter hanya membaca hasil TTV.
|
||||
|
||||
---
|
||||
|
||||
### 4. Modul Vaksinasi
|
||||
|
||||
Buat tabel:
|
||||
|
||||
m_vaccine
|
||||
|
||||
- id
|
||||
- code
|
||||
- name
|
||||
- kfa_code
|
||||
- manufacturer
|
||||
|
||||
t_vaccination
|
||||
|
||||
- id
|
||||
- registration_id
|
||||
- vaccine_id
|
||||
- batch_number
|
||||
- expired_date
|
||||
- dose_number
|
||||
- route
|
||||
- injection_site
|
||||
- administered_by
|
||||
- administration_datetime
|
||||
- adverse_event_note
|
||||
|
||||
Data ini nantinya akan menjadi SATUSEHAT Immunization Resource.
|
||||
|
||||
---
|
||||
|
||||
### 5. Tindakan Medis Terstruktur
|
||||
|
||||
Buat:
|
||||
|
||||
m_procedure
|
||||
|
||||
- id
|
||||
- code
|
||||
- name
|
||||
- snomed_code
|
||||
|
||||
t_medical_procedure
|
||||
|
||||
- id
|
||||
- registration_id
|
||||
- procedure_id
|
||||
- performer_id
|
||||
- note
|
||||
|
||||
Contoh master:
|
||||
|
||||
- Khitan Klem
|
||||
- Khitan Laser
|
||||
- Khitan Stapler
|
||||
- Khitan Konvensional
|
||||
|
||||
Data ini nantinya menjadi SATUSEHAT Procedure Resource.
|
||||
|
||||
---
|
||||
|
||||
### 6. Master Tenaga Kesehatan
|
||||
|
||||
Buat:
|
||||
|
||||
m_practitioner
|
||||
|
||||
- id
|
||||
- employee_id
|
||||
- profession
|
||||
- name
|
||||
- satusehat_practitioner_id
|
||||
|
||||
Profesi:
|
||||
|
||||
- Dokter
|
||||
- Perawat
|
||||
- Bidan
|
||||
|
||||
Vaksinasi dan tindakan tidak selalu dilakukan dokter.
|
||||
|
||||
---
|
||||
|
||||
### 7. SATUSEHAT Mapping Preparation
|
||||
|
||||
Tambahkan kolom mapping:
|
||||
|
||||
ICD10
|
||||
SNOMED
|
||||
KFA
|
||||
|
||||
untuk:
|
||||
|
||||
- diagnosis
|
||||
- tindakan
|
||||
- vaksin
|
||||
- obat
|
||||
|
||||
Belum perlu integrasi API SATUSEHAT.
|
||||
Fokus pada kesiapan data terlebih dahulu.
|
||||
|
||||
---
|
||||
|
||||
Output yang diharapkan:
|
||||
|
||||
- Migration SQL
|
||||
- ERD
|
||||
- Repository
|
||||
- Service Layer
|
||||
- API Endpoint
|
||||
- DTO Request/Response
|
||||
- Unit Test
|
||||
Reference in New Issue
Block a user