Compare commits
7
Commits
ee4129aec4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
335f2b6c5a | ||
|
|
1875b6cab1 | ||
|
|
9f7f55c98d | ||
|
|
64aa3480a0 | ||
|
|
fc9b4f5761 | ||
|
|
89e533aa44 | ||
|
|
9745454134 |
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
require_once "lib/PostgresDb.php";
|
||||
|
||||
header("Content-Type: application/json");
|
||||
|
||||
$db = new PostgresDb();
|
||||
|
||||
$action = $_GET['action'] ?? '';
|
||||
$q = '';
|
||||
if (isset($_GET['q'])) {
|
||||
$q = $_GET['q'];
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case "searchDPJP":
|
||||
searchDPJP($db, $q);
|
||||
break;
|
||||
case "searchDokterAnestesi":
|
||||
searchDokterAnestesi($db, $q);
|
||||
break;
|
||||
case "searchTindakan":
|
||||
searchTindakan($db, $q);
|
||||
break;
|
||||
case "postLaporanOperasi":
|
||||
postLaporanOperasi($db, $_POST);
|
||||
break;
|
||||
default :
|
||||
echo json_encode([
|
||||
"error" => "invalid action"
|
||||
]);
|
||||
}
|
||||
|
||||
function searchDPJP(PostgresDb $db, string $q) {
|
||||
$query = "SELECT kddokter, namadokter, kdsmf, kode_dpjp, nip FROM public.m_dokter WHERE kdsmf LIKE '%BEDAH%'";
|
||||
|
||||
if ($q != '') {
|
||||
$query .= " AND (namadokter ILIKE '%$q%' OR kode_dpjp ILIKE '%$q%')";
|
||||
}
|
||||
|
||||
$query .= " LIMIT 10";
|
||||
|
||||
$sql_dokter_bedah = $db->query($query);
|
||||
|
||||
$arr_dokter_bedah = array();
|
||||
foreach ($sql_dokter_bedah->fetchAll() as $ds) {
|
||||
array_push($arr_dokter_bedah, $ds);
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
"message" => "success get dokter",
|
||||
"data" => $arr_dokter_bedah
|
||||
]);
|
||||
}
|
||||
|
||||
function searchDokterAnestesi(PostgresDb $db, string $q) {
|
||||
$query = "SELECT kddokter, namadokter, kdsmf, kode_dpjp FROM public.m_dokter WHERE kdsmf LIKE '%ANESTHESI%'";
|
||||
|
||||
if ($q != '') {
|
||||
$query .= " AND (namadokter ILIKE '%$q%' OR kode_dpjp ILIKE '%$q%')";
|
||||
}
|
||||
|
||||
$query .= " LIMIT 10";
|
||||
|
||||
$sql_dokter_anestesi = $db->query($query);
|
||||
|
||||
$arr_dokter_anestesi = array();
|
||||
foreach ($sql_dokter_anestesi->fetchAll() as $ds) {
|
||||
array_push($arr_dokter_anestesi, $ds);
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
"message" => "success get dokter",
|
||||
"data" => $arr_dokter_anestesi
|
||||
]);
|
||||
}
|
||||
|
||||
function searchTindakan(PostgresDb $db, string $q) {
|
||||
$query = "SELECT kode as code, keterangan as str from icd_cm";
|
||||
if ($q != '') {
|
||||
$query .= " where kode ilike '$q%' OR keterangan ilike '%$q%'";
|
||||
}
|
||||
|
||||
$query .= " LIMIT 10";
|
||||
|
||||
$sql_tindakan = $db->query($query);
|
||||
|
||||
$result = array();
|
||||
foreach($sql_tindakan->fetchAll() as $t) {
|
||||
array_push($result, $t);
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
"message" => "success get tindakan",
|
||||
"data" => $result
|
||||
]);
|
||||
}
|
||||
|
||||
function postLaporanOperasi(PostgresDb $db, $data) {
|
||||
$query = "INSERT into t_operasi (tanggal, jammulai, jamselesai, diagnosa, tindakan, jenisanastesi,
|
||||
nip, dokteroperator, dokter_bedah, kode_dokteroperator, dokteranastesi, kode_dokteranastesi,
|
||||
asistenoperator, perawatinstrumen, pembedahan, jaringan, jnsoperasi, lama_operasi,
|
||||
diagnosa_prabedah, kd_billing, sistem_operasi, pembiusan_mulai, pembiusan_selesai, lama_pembiusan,
|
||||
operasi_ke, ket_lahir, ket_tempat_lahir, berat_badan, jumlah_pendarahan, ket_saat_lahir,
|
||||
merek, nama_implant, stiker, nama_pendamping, specimen, jnsdarahmasuk, uraian_operasi,
|
||||
jenis_laporan, ruang_tindakan) VALUES
|
||||
( ".$data["tgl_bedah"].", ".$data["tgl_bedah"].") ";
|
||||
echo json_encode([
|
||||
"message" => "success post laporan operasi",
|
||||
"data" => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
class PostgresDb
|
||||
{
|
||||
private $pdo;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$host = "10.10.123.238";
|
||||
$port = "5432";
|
||||
$dbname = "simrs";
|
||||
$user = "brawijaya";
|
||||
$password = "ub*2025";
|
||||
|
||||
$dsn = "pgsql:host=$host;port=$port;dbname=$dbname";
|
||||
|
||||
try {
|
||||
|
||||
$this->pdo = new PDO($dsn, $user, $password, [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
|
||||
]);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
|
||||
die("Database connection failed: " . $e->getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function query($sql, $params = [])
|
||||
{
|
||||
$stmt = $this->pdo->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
|
||||
public function fetchAll($sql, $params = [])
|
||||
{
|
||||
return $this->query($sql, $params)->fetchAll();
|
||||
}
|
||||
|
||||
|
||||
public function fetch($sql, $params = [])
|
||||
{
|
||||
return $this->query($sql, $params)->fetch();
|
||||
}
|
||||
|
||||
|
||||
public function lastInsertId()
|
||||
{
|
||||
return $this->pdo->lastInsertId();
|
||||
}
|
||||
}
|
||||
+1
File diff suppressed because one or more lines are too long
Vendored
+2
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user