Update
This commit is contained in:
@@ -739,59 +739,64 @@ class DokterController extends Controller
|
||||
}
|
||||
$cekdatanmaddendum = Periksa::where('nofoto', $nofoto)->first();
|
||||
$tgldaftarpasangan = $cekdatanmaddendum->daftar ?? '';
|
||||
$nmadendum = $cekdatanmaddendum->nmadendum ?? '';
|
||||
/*
|
||||
$getdatapasangannya = Periksa::whereNotNull('nmadendum')->where('dlp', '!=', $ruangan)->where('daftar', $tgldaftarpasangan)->where('nofoto', '!=', $nofoto)->get();
|
||||
foreach ($getdatapasangannya as $item){
|
||||
$datayangperludicloning = KomponenJawaban::where('accnumber', $item->nofoto)->get();
|
||||
foreach ($datayangperludicloning as $rclone){
|
||||
$ceksudahcloning = KomponenJawaban::where('accnumber', $nofoto)
|
||||
->where('komponen', $rclone->komponen)
|
||||
->where('template', $ruangan)->count();
|
||||
if ($ceksudahcloning == 0){
|
||||
$komponen = '';
|
||||
if ($rclone->komponen == 'lsg_selepitel'){
|
||||
$komponen = 'id_selepitel';
|
||||
sudah OK tinggal di uncoment saja klo perlu cloning data dari pasangan
|
||||
if ($nmadendum != ''){
|
||||
$getdatapasangannya = Periksa::where('nmadendum', $nmadendum)->where('nm_spesimen', 'SPUTUM')->where('nofoto', '!=', $nofoto)->get();
|
||||
foreach ($getdatapasangannya as $item){
|
||||
$datayangperludicloning = KomponenJawaban::where('accnumber', $item->nofoto)->get();
|
||||
foreach ($datayangperludicloning as $rclone){
|
||||
$ceksudahcloning = KomponenJawaban::where('accnumber', $nofoto)
|
||||
->where('komponen', $rclone->komponen)
|
||||
->where('template', $ruangan)->count();
|
||||
if ($ceksudahcloning == 0){
|
||||
$komponen = '';
|
||||
if ($rclone->komponen == 'lsg_selepitel'){
|
||||
$komponen = 'id_selepitel';
|
||||
}
|
||||
if ($rclone->komponen == 'id_selepitel'){
|
||||
$komponen = 'lsg_selepitel';
|
||||
}
|
||||
if ($rclone->komponen == 'lsg_selradang'){
|
||||
$komponen = 'id_selradang';
|
||||
}
|
||||
if ($rclone->komponen == 'id_selradang'){
|
||||
$komponen = 'lsg_selradang';
|
||||
}
|
||||
if ($rclone->komponen == 'lsg_mikroorganisme'){
|
||||
$komponen = 'id_mikroorganisme';
|
||||
}
|
||||
if ($rclone->komponen == 'id_mikroorganisme'){
|
||||
$komponen = 'lsg_mikroorganisme';
|
||||
}
|
||||
if ($rclone->komponen == 'lsg_mikroorganismeoptional'){
|
||||
$komponen = 'id_mikroorganismeoptional';
|
||||
}
|
||||
if ($rclone->komponen == 'id_mikroorganismeoptional'){
|
||||
$komponen = 'lsg_mikroorganismeoptional';
|
||||
}
|
||||
if ($rclone->komponen == 'lsg_mikroorganismeoptional'){
|
||||
$komponen = 'id_mikroorganismeoptional';
|
||||
}
|
||||
if ($rclone->komponen == 'id_mikroorganismeoptional'){
|
||||
$komponen = 'lsg_mikroorganismeoptional';
|
||||
}
|
||||
if ($komponen != ''){
|
||||
KomponenJawaban::create([
|
||||
'accnumber' => $nofoto,
|
||||
'template' => $ruangan,
|
||||
'komponen' => $komponen,
|
||||
'isidata' => $rclone->isidata,
|
||||
'created_by' => Session('nama')
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
if ($rclone->komponen == 'id_selepitel'){
|
||||
$komponen = 'lsg_selepitel';
|
||||
}
|
||||
if ($rclone->komponen == 'lsg_selradang'){
|
||||
$komponen = 'id_selradang';
|
||||
}
|
||||
if ($rclone->komponen == 'id_selradang'){
|
||||
$komponen = 'lsg_selradang';
|
||||
}
|
||||
if ($rclone->komponen == 'lsg_mikroorganisme'){
|
||||
$komponen = 'id_mikroorganisme';
|
||||
}
|
||||
if ($rclone->komponen == 'id_mikroorganisme'){
|
||||
$komponen = 'lsg_mikroorganisme';
|
||||
}
|
||||
if ($rclone->komponen == 'lsg_mikroorganismeoptional'){
|
||||
$komponen = 'id_mikroorganismeoptional';
|
||||
}
|
||||
if ($rclone->komponen == 'id_mikroorganismeoptional'){
|
||||
$komponen = 'lsg_mikroorganismeoptional';
|
||||
}
|
||||
if ($rclone->komponen == 'lsg_mikroorganismeoptional'){
|
||||
$komponen = 'id_mikroorganismeoptional';
|
||||
}
|
||||
if ($rclone->komponen == 'id_mikroorganismeoptional'){
|
||||
$komponen = 'lsg_mikroorganismeoptional';
|
||||
}
|
||||
if ($komponen != ''){
|
||||
KomponenJawaban::create([
|
||||
'accnumber' => $nofoto,
|
||||
'template' => $ruangan,
|
||||
'komponen' => $komponen,
|
||||
'isidata' => $rclone->isidata,
|
||||
'created_by' => Session('nama')
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
KomponenJawaban::where('accnumber', $nofoto)->where('komponen', 'bakteri')->update([
|
||||
'template' => $ruangan,
|
||||
@@ -1016,10 +1021,44 @@ class DokterController extends Controller
|
||||
}
|
||||
return $pesan;
|
||||
} else if ($worklist == 'arsipkan'){
|
||||
$isi = $request->input('isi');
|
||||
if ($isi == ''){
|
||||
$pesan = 'Rentang tanggal tidak boleh kosong';
|
||||
return $pesan;
|
||||
}
|
||||
try {
|
||||
Periksa::where('created_at', 'LIKE', $request->input('isi').'%')->update([
|
||||
'status'=> 'Arsip'
|
||||
Periksa::where('created_at', '<', $request->input('isi').'%')->where('status', '!=', 'Selesai')->update([
|
||||
'status'=> 'Dibatalkan (Arsip)'
|
||||
]);
|
||||
/*
|
||||
$getperiksa = Periksa::where('created_at', 'LIKE', $request->input('isi').'%')->get();
|
||||
foreach ($getperiksa as $item){
|
||||
$cekriwayat = Riwayat::where('nofoto', $item->nofoto)->where('keterangan', 'Expertise')->where('verifikasi', 'Accepted')->count();
|
||||
if ($cekriwayat > 0){
|
||||
Periksa::where('id', $item->id)->update([
|
||||
'status'=> 'Selesai'
|
||||
]);
|
||||
} else {
|
||||
$getlastriwayat = Riwayat::where('nofoto', $item->nofoto)->orderBy('id', 'DESC')->first();
|
||||
if (isset($getlastriwayat->id)){
|
||||
Periksa::where('id', $item->id)->update([
|
||||
'status'=> 'Proses Analisis Sampel'
|
||||
]);
|
||||
} else {
|
||||
$cekdataraw = ResultSample::where('accession_number',$item->nofoto)->first();
|
||||
if (!isset($cekdataraw->id)){
|
||||
Periksa::where('id', $item->id)->update([
|
||||
'status'=> 'Data Vitek di Terima'
|
||||
]);
|
||||
} else {
|
||||
Periksa::where('id', $item->id)->update([
|
||||
'status'=> null
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
$pesan = 'Sejumlah data di rentang '.$request->input('isi').' Berhasil di arsipkan';
|
||||
} catch (Exception $e) {
|
||||
$pesan = $e->getMessage();
|
||||
@@ -1207,9 +1246,7 @@ class DokterController extends Controller
|
||||
return response()->json(['icon' => 'success', 'warna' => '#1dcbbd', 'status' => 'Success', 'message' => 'Data Kuman Manual Dihapus']);
|
||||
} else {
|
||||
$jumlah = 0;
|
||||
$cekdulu = RekapAntibiotik::where('orderid', $idperiksa)->where('kuman', $kuman)->count();
|
||||
if ($cekdulu == 0){
|
||||
$jsonantibiotikmanual = array(
|
||||
$jsonantibiotikmanual = array(
|
||||
'Amoxycillin',
|
||||
'Amoxycillin and Clavulanic Acid',
|
||||
'Ampicillin',
|
||||
@@ -1252,15 +1289,14 @@ class DokterController extends Controller
|
||||
'Amphothericin B',
|
||||
'Caspofungin',
|
||||
'Flucytosine'
|
||||
);
|
||||
foreach($jsonantibiotikmanual as $antibiotic_name){
|
||||
RekapAntibiotik::updateOrCreate(
|
||||
[
|
||||
);
|
||||
foreach($jsonantibiotikmanual as $antibiotic_name){
|
||||
$ceksudah = RekapAntibiotik::where('orderid', $idperiksa)->where('kuman', $kuman)->where('antibiotic', $antibiotic_name)->count();
|
||||
if ($ceksudah == 0){
|
||||
RekapAntibiotik::create([
|
||||
'orderid' => $idperiksa,
|
||||
'kuman' => $kuman,
|
||||
'antibiotic' => $antibiotic_name,
|
||||
],
|
||||
[
|
||||
'resistance' => null,
|
||||
'value' => null,
|
||||
'interpretation' => null,
|
||||
@@ -1274,6 +1310,15 @@ class DokterController extends Controller
|
||||
$jumlah++;
|
||||
}
|
||||
}
|
||||
if ($jumlah != 0){
|
||||
$update = Riwayat::create([
|
||||
'nofoto' => $nofoto,
|
||||
'jawaban' => $kuman,
|
||||
'inputor' => Session('nama'),
|
||||
'keterangan'=> 'Input Kuman Manual ('.$kuman.') dengan '.$jumlah.' Antibiotik',
|
||||
'verifikasi'=> '',
|
||||
]);
|
||||
}
|
||||
return response()->json(['icon' => 'success', 'warna' => '#1dcbbd', 'status' => 'Success', 'message' => 'Data Kuman Manual Disimpan dengan '.$jumlah.' Antibiotik']);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
@@ -1671,6 +1716,13 @@ class DokterController extends Controller
|
||||
$setnilai = $request->input('setnilai');
|
||||
$getdataawal = Periksa::where('nofoto', $nofoto)->first();
|
||||
$orderid = $getdataawal->id ?? 0;
|
||||
$kuman = '';
|
||||
$cekada = ResultSample::where('accession_number', 'LIKE', $nofoto.'%')->get();
|
||||
if (!empty($cekada)){
|
||||
foreach($cekada as $rows){
|
||||
$kuman = $rows->organism;
|
||||
}
|
||||
}
|
||||
$getdata = SiraB::where('id', $idtabel)->first();
|
||||
if (isset($getdata->id)){
|
||||
$batasatas = $getdata->batasatas;
|
||||
@@ -1694,6 +1746,7 @@ class DokterController extends Controller
|
||||
[
|
||||
'orderid' => $orderid,
|
||||
'antibiotic' => $antibiotik,
|
||||
'kuman' => $kuman,
|
||||
],
|
||||
[
|
||||
'resistance' => $getdata->diskcontent,
|
||||
|
||||
@@ -35,30 +35,47 @@ class JsonTransferController extends Controller
|
||||
|
||||
public function generate()
|
||||
{
|
||||
//POSTGRESS
|
||||
|
||||
$tables = DB::select("SELECT tablename FROM pg_tables WHERE schemaname = 'public'");
|
||||
$exportPath = base_path($this->exportPath);
|
||||
if (!is_dir($exportPath)) {
|
||||
mkdir($exportPath, 0777, true);
|
||||
}
|
||||
|
||||
$tables = DB::select("SELECT tablename FROM pg_tables WHERE schemaname = 'public'");
|
||||
$tableNames = array_map(fn($t) => $t->tablename, $tables);
|
||||
|
||||
//MYSQL
|
||||
//$tables = DB::select('SHOW TABLES');
|
||||
//$tableNames = array_map('current', $tables);
|
||||
|
||||
foreach ($tableNames as $table) {
|
||||
try {
|
||||
$data = DB::table($table)->get();
|
||||
$json = json_encode($data, JSON_PRETTY_PRINT);
|
||||
file_put_contents(base_path($this->exportPath . $table . '.json'), $json);
|
||||
$filePath = $exportPath . $table . '.json';
|
||||
$handle = fopen($filePath, 'w');
|
||||
|
||||
fwrite($handle, "[\n");
|
||||
|
||||
$first = true;
|
||||
|
||||
foreach (DB::table($table)->cursor() as $row) {
|
||||
$jsonRow = json_encode($row, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
if (!$first) {
|
||||
fwrite($handle, ",\n");
|
||||
} else {
|
||||
$first = false;
|
||||
}
|
||||
|
||||
fwrite($handle, $jsonRow);
|
||||
}
|
||||
|
||||
fwrite($handle, "\n]");
|
||||
fclose($handle);
|
||||
} catch (\Exception $e) {
|
||||
// Bisa log error-nya atau skip tabel ini
|
||||
\Log::warning("Gagal ekspor tabel $table: " . $e->getMessage());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->back()->with('success', 'Semua tabel berhasil diekspor.');
|
||||
return redirect()->back()->with('success', 'Semua tabel berhasil diekspor tanpa kehabisan memori.');
|
||||
}
|
||||
|
||||
|
||||
public function downloadTable($table)
|
||||
{
|
||||
$file = base_path($this->exportPath . $table . '.json');
|
||||
@@ -89,30 +106,21 @@ class JsonTransferController extends Controller
|
||||
public function importTable($table)
|
||||
{
|
||||
$path = base_path($this->exportPath . $table . '.json');
|
||||
|
||||
if (!file_exists($path)) {
|
||||
return redirect()->back()->with('error', "File JSON untuk tabel $table tidak ditemukan.");
|
||||
}
|
||||
|
||||
$json = file_get_contents($path);
|
||||
$data = json_decode($json, true);
|
||||
|
||||
if (!is_array($data)) {
|
||||
return redirect()->back()->with('error', "File JSON untuk tabel $table tidak valid.");
|
||||
}
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
// Kosongkan tabel sebelum import (opsional, hati-hati!)
|
||||
DB::table($table)->truncate();
|
||||
|
||||
$chunks = array_chunk($data, 200); // ubah 1000 sesuai kemampuan server
|
||||
|
||||
$chunks = array_chunk($data, 200);
|
||||
foreach ($chunks as $chunk) {
|
||||
DB::table($table)->insert($chunk);
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return redirect()->back()->with('success', "Data untuk tabel $table berhasil di-import.");
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -264,6 +264,7 @@ class ListController extends Controller
|
||||
|
||||
DB::raw("CASE
|
||||
WHEN status IS NULL THEN '<span class=\"badge badge-danger\">NEW</span>'
|
||||
WHEN status = '' THEN '<span class=\"badge badge-danger\">NEW</span>'
|
||||
WHEN status LIKE '%Dibatalkan%' THEN '<font color=grey>Batal</font>'
|
||||
WHEN status LIKE '%Pemeriksaan Sampel%' THEN '<font color=green>Pemeriksaan Sampel</font>'
|
||||
WHEN status LIKE '%Proses Analisis Sampel%' THEN '<strong>Diperiksa</strong>'
|
||||
@@ -273,8 +274,7 @@ class ListController extends Controller
|
||||
WHEN status LIKE '%Selesai%' THEN '<span class=\"badge badge-success\">Selesai</span>'
|
||||
WHEN status LIKE '%Arsip%' THEN '<span class=\"badge badge-primary\">Arsip</span>'
|
||||
WHEN status LIKE '%Data Vitek di Terima%' THEN '<span class=\"badge badge-warning\">Data Vitek di Terima</span>'
|
||||
WHEN status LIKE '%Data BD di Terima%' THEN '<span class=\"badge badge-info\">Data BD di Terima</span>'
|
||||
ELSE CONCAT('<span class=\"badge badge-secondary\">', status::text, '</span>')
|
||||
ELSE CONCAT('<span class=\"badge badge-info\">', status::text, '</span>')
|
||||
END AS tlsstatus"),
|
||||
|
||||
DB::raw("CASE
|
||||
|
||||
Reference in New Issue
Block a user