Update Database Stuktur

This commit is contained in:
servdal
2025-09-02 20:02:03 +07:00
parent 9979ce3335
commit caf54a9dd7
4 changed files with 40 additions and 6 deletions
@@ -1709,7 +1709,38 @@ class DokterController extends Controller
$idpasien = $request->input('val01');
$arrayfiles = [];
if ($idpasien == 'sirab'){
$getsirab = SiraB::orderBy('family', 'ASC')->orderBy('spesies', 'ASC')->get();
$jumlah = 0;
$getklonin = SiraB::orderBy('family', 'ASC')->orderBy('spesies', 'ASC')->whereNull('cek')->get();
foreach($getklonin as $row){
$family = $row->family;
$spesies = $row->spesies;
$getallantibiotik = SiraB::where('family', $family)->get();
foreach($getallantibiotik as $rowa){
SiraB::updateOrCreate(
[
'family' => $family,
'spesies' => $spesies,
'antibiotik' => $rowa->antibiotik,
'subantibiotik' => $rowa->subantibiotik,
],
[
'diskcontent' => $row->diskcontent,
'batasatas' => $row->batasatas,
'midrange' => $row->midrange,
'batasbawah' => $row->batasbawah,
'sumber' => $row->sumber,
'kodedok' => $row->kodedok,
'atu' => $row->atu,
'kelompok' => $row->kelompok,
'cek' => '1',
]
);
$jumlah++;
}
}
echo $jumlah;
/*
$getsirab = SiraB::orderBy('family', 'ASC')->orderBy('spesies', 'ASC')->get();
foreach($getsirab as $row){
if ($row->subantibiotik !== null && $row->subantibiotik != ''){
$antibiotikall = $row->subantibiotik;
@@ -1734,6 +1765,7 @@ class DokterController extends Controller
);
}
echo json_encode($arrayfiles);
*/
} else if ($idpasien == 'Bakteri'){
$getsirab = Organisms::where('kelompok', 'biakankultur')->orderBy('category', 'ASC')->orderBy('name', 'ASC')->get();
echo json_encode($getsirab);