Update ke Laravel 12 struktur modular

This commit is contained in:
servdal
2025-08-03 18:09:58 +07:00
parent 79da34a3e3
commit 62c2e6bf8e
2 changed files with 36 additions and 43 deletions

View File

@@ -65,4 +65,6 @@ VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
GETPASIEN_API=https://gomed.rssa.my.id/api/account/pasien

View File

@@ -105,48 +105,39 @@ class PasienController extends Controller
]);
} else {
try {
$client = new Client();
$res = $client->request('GET', 'http://10.10.123.51:8000/mr/'.$norm);
$response_data = json_decode($res->getBody()->getContents());
if (isset($response_data[0])) {
$hasil = $response_data[0];
$nama = $hasil->Nama;
$alamat = $hasil->Alamat;
$telpon = $hasil->Telp;
$kota = $hasil->Kota;
$kelamin = $hasil->JenisKelamin;
$tgllahir = $hasil->tanggal_lahir;
$nik = $hasil->nik;
$bpjs = $hasil->bpjs;
if ($kelamin == 'WANITA'){
$kelamin = 'P';
} else { $kelamin = 'L'; }
return response()->json([
'id' => 'new',
'norm' => $norm,
'telpon' => $telpon,
'nama' => $nama,
'tgl_lahir' => $tgllahir,
'jk' => $kelamin,
'alamat' => $alamat,
'kota' => $kota,
'nik' => $nik,
'bpjs' => $bpjs,
]);
} else {
return response()->json([
'id' => '',
'telpon' => '000000000',
'norm' => $norm,
'nama' => '',
'tgl_lahir' => date("d-m-Y"),
'jk' => 'L',
'alamat' => 'Malang',
'kota' => 'Malang',
'nik' => '',
'bpjs' => '',
]);
}
$client = new Client();
$res = $client->request('GET', env('GETPASIEN_API'), ['query' => ['limit' => 10, 'nomedis' => $norm]]);
$response_data = json_decode($res->getBody()->getContents());
if (isset($response_data->response[0])) {
$hasil = $response_data->response[0];
$nama = $hasil->Nama;
$alamat = $hasil->Alamat;
$telpon = $hasil->Telp;
$kota = $hasil->Kota;
$kelamin = $hasil->JenisKelamin;
$tgllahir = $hasil->tanggal_lahir;
return response()->json([
'id' => 'new',
'norm' => $norm,
'telpon' => $telpon,
'nama' => $nama,
'tgl_lahir' => date('d-m-Y', strtotime($tgllahir)),
'jk' => $kelamin,
'alamat' => $alamat,
'kota' => $kota,
]);
} else {
return response()->json([
'id' => '',
'telpon' => '000000000',
'norm' => $norm,
'nama' => '',
'tgl_lahir' => date("d-m-Y"),
'jk' => 'L',
'alamat' => 'Malang',
'kota' => 'Malang',
]);
}
}catch (Exception $e) {
return response()->json([
'id' => '',