Update
This commit is contained in:
No files matched your search
@@ -22,7 +22,7 @@ class ProcessAstmMessages extends Command
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
// Ambil data dari DataListener
|
// Ambil data dari DataListener
|
||||||
$dataListener = DataListiner::whereNull('processed')->get();
|
$dataListener = DataListiner::where('processed', '0')->orderBy('created_at', 'DESC')->get();
|
||||||
if ($dataListener) {
|
if ($dataListener) {
|
||||||
$jumlah = count($dataListener);
|
$jumlah = count($dataListener);
|
||||||
$pesan = $this->astmMessageService->processAstmMessages($dataListener);
|
$pesan = $this->astmMessageService->processAstmMessages($dataListener);
|
||||||
|
|||||||
@@ -1080,6 +1080,7 @@ class DokterController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$jsondata = json_decode($jsondata, true);
|
||||||
if(is_array($jsondata) && count($jsondata) > 0){
|
if(is_array($jsondata) && count($jsondata) > 0){
|
||||||
foreach ($jsondata as $item){
|
foreach ($jsondata as $item){
|
||||||
RekapAntibiotik::updateOrCreate(
|
RekapAntibiotik::updateOrCreate(
|
||||||
@@ -1102,9 +1103,9 @@ class DokterController extends Controller
|
|||||||
$gentabel = RekapAntibiotik::where('orderid', $orderid)->get();
|
$gentabel = RekapAntibiotik::where('orderid', $orderid)->get();
|
||||||
if (!empty($gentabel)){
|
if (!empty($gentabel)){
|
||||||
$nomor = 1;
|
$nomor = 1;
|
||||||
$isidata = '<table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><td width="5%"><strong>No</strong></td><td width="65%"><strong>Antibiotik</strong></td><td width="15%"><strong>Value</strong></td><td width="15%"><strong>S/I/R</strong></td></tr>';
|
$isidata = $isidata.'<br /><table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><td width="5%"><strong>No</strong></td><td width="65%"><strong>Antibiotik</strong></td><td width="15%"><strong>Value</strong></td><td width="15%"><strong>S/I/R</strong></td></tr>';
|
||||||
foreach($gentabel as $rtabel){
|
foreach($gentabel as $rtabel){
|
||||||
$isidata = $isidata.'<tr><td>'.$nomor.'</td><td>'.$rtabel->antibiotic.'</td<td>'.$rtabel->value.'</td><td>'.$rtabel->interpretation.'</td></tr>';
|
$isidata = $isidata.'<tr><td>'.$nomor.'</td><td>'.$rtabel->resistance.'</td><td>'.$rtabel->value.'</td><td>'.$rtabel->interpretation.'</td></tr>';
|
||||||
$nomor++;
|
$nomor++;
|
||||||
}
|
}
|
||||||
$isidata = $isidata.'</table>';
|
$isidata = $isidata.'</table>';
|
||||||
@@ -1328,10 +1329,10 @@ class DokterController extends Controller
|
|||||||
$setval = $batasbawah;
|
$setval = $batasbawah;
|
||||||
}
|
}
|
||||||
if ($nomor == 1){
|
if ($nomor == 1){
|
||||||
$tabel = '<table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><td width="5%"><strong>No</strong></td><td width="20%"><strong>Antibiotik</strong></td><td width="20%"><strong>Sub</strong></td><td width="10%"><strong>Disc Content</strong></td><td width="5%"><strong>S/I/R</strong></td></tr><tr><td>'.$nomor.'</td><td>'.$getdata->antibiotik.'</td><td>'.$getdata->subantibiotik.'</td><td>'.$getdata->diskcontent.'</td><td>'.$setnilai.'</td></tr></table>';
|
$tabel = '<table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><td width="5%"><strong>No</strong></td><td width="20%"><strong>Antibiotik</strong></td><td width="20%"><strong>Sub</strong></td><td width="10%"><strong>Disc Content</strong></td><td width="5%"><strong>S/I/R</strong></td></tr><tr><td>'.$nomor.'</td><td>'.$getdata->antibiotik.' '.$getdata->subantibiotik.'</td><td>'.$getdata->diskcontent.'</td><td>'.$setnilai.'</td></tr></table>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$baris = '<tr><td>'.$nomor.'</td><td>'.$getdata->antibiotik.'</td><td>'.$getdata->subantibiotik.'</td><td>'.$getdata->diskcontent.'</td><td>'.$setnilai.'</td></tr>';
|
$baris = '<tr><td>'.$nomor.'</td><td>'.$getdata->antibiotik.' '.$getdata->subantibiotik.'</td><td>'.$getdata->diskcontent.'</td><td>'.$setnilai.'</td></tr>';
|
||||||
$tabel = str_replace('</table>', $baris, $tabelawal);
|
$tabel = str_replace('</table>', $baris, $tabelawal);
|
||||||
$tabel = $tabel.'</table>';
|
$tabel = $tabel.'</table>';
|
||||||
}
|
}
|
||||||
@@ -1730,6 +1731,36 @@ class DokterController extends Controller
|
|||||||
'antibiotikall' => $antibiotikall,
|
'antibiotikall' => $antibiotikall,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
$getsirab = SiraB::orderBy('family', 'ASC')->orderBy('spesies', 'ASC')->where('cek', '1')->get();
|
||||||
|
foreach($getsirab as $row){
|
||||||
|
$family = $row->family;
|
||||||
|
$spesies= $row->spesies;
|
||||||
|
$getallantibiotik = SiraB::where('family', $family)->where('spesies', $spesies)->get();
|
||||||
|
foreach ($getallantibiotik as $row2){
|
||||||
|
SiraB::updateOrCreate(
|
||||||
|
[
|
||||||
|
'family' => $row->family,
|
||||||
|
'spesies' => $row->spesies,
|
||||||
|
'antibiotik' => $row2->antibiotik,
|
||||||
|
'subantibiotik' => $row2->subantibiotik,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'diskcontent' => $row2->diskcontent,
|
||||||
|
'batasatas' => $row2->batasatas,
|
||||||
|
'midrange' => $row2->midrange,
|
||||||
|
'batasbawah' => $row2->batasbawah,
|
||||||
|
'sumber' => $row2->sumber,
|
||||||
|
'kodedok' => $row2->kodedok,
|
||||||
|
'atu' => $row2->atu,
|
||||||
|
'kelompok' => $row2->kelompok,
|
||||||
|
'glassreportname' => trim($row2->glassreportname),
|
||||||
|
'cek' => '0',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
echo json_encode($arrayfiles);
|
echo json_encode($arrayfiles);
|
||||||
} else if ($idpasien == 'Bakteri'){
|
} else if ($idpasien == 'Bakteri'){
|
||||||
$getsirab = Organisms::where('kelompok', 'biakankultur')->orderBy('category', 'ASC')->orderBy('name', 'ASC')->get();
|
$getsirab = Organisms::where('kelompok', 'biakankultur')->orderBy('category', 'ASC')->orderBy('name', 'ASC')->get();
|
||||||
|
|||||||
@@ -762,6 +762,27 @@ class FrontpageController extends Controller
|
|||||||
'orderid' => $notransaksi,
|
'orderid' => $notransaksi,
|
||||||
]);
|
]);
|
||||||
$pesan = $nofoto;
|
$pesan = $nofoto;
|
||||||
|
DB::table('paslab')->insert([
|
||||||
|
'rnoreg' => $nofoto,
|
||||||
|
'nama' => $nama,
|
||||||
|
'norm' => $noregister,
|
||||||
|
'rtglast' => $mulai,
|
||||||
|
'alamat' => $alamat,
|
||||||
|
'rjenis' => $jk,
|
||||||
|
'umur' => $usia,
|
||||||
|
'namadok' => $klinisi,
|
||||||
|
'ruangan' => 'Mikrobiologi',
|
||||||
|
'tes' => $rekues,
|
||||||
|
'alat' => 'ALL',
|
||||||
|
'kd_spesimen' => $kd_spesimen,
|
||||||
|
'nm_spesimen' => $nm_spesimen,
|
||||||
|
'tgllahir' => $tgllahir,
|
||||||
|
'flg_vitek1' => false,
|
||||||
|
'flg_vitek2' => false,
|
||||||
|
'flg_bd1' => false,
|
||||||
|
'flg_bd2' => false,
|
||||||
|
'flg_gxp' => false,
|
||||||
|
]);
|
||||||
if ($kd_spesimen != '' AND $nm_spesimen != ''){
|
if ($kd_spesimen != '' AND $nm_spesimen != ''){
|
||||||
PendaftaranOnListiner::updateOrCreate(
|
PendaftaranOnListiner::updateOrCreate(
|
||||||
[
|
[
|
||||||
@@ -786,16 +807,7 @@ class FrontpageController extends Controller
|
|||||||
'nm_spesimen' => $nm_spesimen,
|
'nm_spesimen' => $nm_spesimen,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$dataForLis = [
|
|
||||||
'nama' => $nama,
|
|
||||||
'noregister' => $noregister,
|
|
||||||
'nofoto' => $nofoto,
|
|
||||||
'kd_spesimen' => $kd_spesimen,
|
|
||||||
'nm_spesimen' => $nm_spesimen,
|
|
||||||
'tgllahir' => $tgllahir,
|
|
||||||
'jk' => $jk,
|
|
||||||
];
|
|
||||||
$this->sendRegistrationToLis($dataForLis);
|
|
||||||
}
|
}
|
||||||
if ($pesan != ''){
|
if ($pesan != ''){
|
||||||
return response()->json(['status' => 'Sukses', 'message' => $pesan], 201);
|
return response()->json(['status' => 'Sukses', 'message' => $pesan], 201);
|
||||||
@@ -999,6 +1011,7 @@ class FrontpageController extends Controller
|
|||||||
'flg_vitek2' => false,
|
'flg_vitek2' => false,
|
||||||
'flg_bd1' => false,
|
'flg_bd1' => false,
|
||||||
'flg_bd2' => false,
|
'flg_bd2' => false,
|
||||||
|
'flg_gxp' => false,
|
||||||
]);
|
]);
|
||||||
if ($kd_spesimen != '' AND $nm_spesimen != ''){
|
if ($kd_spesimen != '' AND $nm_spesimen != ''){
|
||||||
PendaftaranOnListiner::updateOrCreate(
|
PendaftaranOnListiner::updateOrCreate(
|
||||||
@@ -1398,6 +1411,30 @@ class FrontpageController extends Controller
|
|||||||
'kd_spesimen' => $kd_spesimen,
|
'kd_spesimen' => $kd_spesimen,
|
||||||
'nm_spesimen' => $nm_spesimen,
|
'nm_spesimen' => $nm_spesimen,
|
||||||
]);
|
]);
|
||||||
|
$ceksudah = DB::table('paslab')->where('rnoreg', $nofoto)->count();
|
||||||
|
if ($ceksudah == 0){
|
||||||
|
DB::table('paslab')->insert([
|
||||||
|
'rnoreg' => $nofoto,
|
||||||
|
'nama' => $nama,
|
||||||
|
'norm' => $noregister,
|
||||||
|
'rtglast' => $mulai,
|
||||||
|
'alamat' => $alamat,
|
||||||
|
'rjenis' => $jk,
|
||||||
|
'umur' => $usia,
|
||||||
|
'namadok' => $getdata->dokter ?? 'Unkown',
|
||||||
|
'ruangan' => 'Mikrobiologi',
|
||||||
|
'tes' => $rekues,
|
||||||
|
'alat' => 'ALL',
|
||||||
|
'kd_spesimen' => $kd_spesimen,
|
||||||
|
'nm_spesimen' => $nm_spesimen,
|
||||||
|
'tgllahir' => $tgllahir,
|
||||||
|
'flg_vitek1' => false,
|
||||||
|
'flg_vitek2' => false,
|
||||||
|
'flg_bd1' => false,
|
||||||
|
'flg_bd2' => false,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$pesan = $pesan.' Data Berhasil di Update';
|
$pesan = $pesan.' Data Berhasil di Update';
|
||||||
if ($kd_spesimen != '' AND $nm_spesimen != ''){
|
if ($kd_spesimen != '' AND $nm_spesimen != ''){
|
||||||
PendaftaranOnListiner::updateOrCreate(
|
PendaftaranOnListiner::updateOrCreate(
|
||||||
@@ -1423,6 +1460,7 @@ class FrontpageController extends Controller
|
|||||||
'nm_spesimen' => $nm_spesimen,
|
'nm_spesimen' => $nm_spesimen,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
/*
|
||||||
$dataForLis = [
|
$dataForLis = [
|
||||||
'nama' => $nama,
|
'nama' => $nama,
|
||||||
'noregister' => $noregister,
|
'noregister' => $noregister,
|
||||||
@@ -1433,6 +1471,7 @@ class FrontpageController extends Controller
|
|||||||
'jk' => $jk,
|
'jk' => $jk,
|
||||||
];
|
];
|
||||||
$this->sendRegistrationToLis($dataForLis);
|
$this->sendRegistrationToLis($dataForLis);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
if ($pesan != ''){
|
if ($pesan != ''){
|
||||||
if ($file != '' AND $jenisgambar != ''){
|
if ($file != '' AND $jenisgambar != ''){
|
||||||
@@ -1479,19 +1518,28 @@ class FrontpageController extends Controller
|
|||||||
'nmexcutor' => Session('nama'),
|
'nmexcutor' => Session('nama'),
|
||||||
]);
|
]);
|
||||||
try {
|
try {
|
||||||
if ($modality == 'genexpert01' OR $modality == 'genexpert02' OR $modality == 'genexpert03'){
|
$ceksudah = DB::table('paslab')->where('rnoreg', $nofoto)->count();
|
||||||
$dataForLis = [
|
if ($ceksudah == 0){
|
||||||
'nama' => $cekdata->nmpasien,
|
DB::table('paslab')->insert([
|
||||||
'noregister' => $cekdata->noregister,
|
'rnoreg' => $nofoto,
|
||||||
'nofoto' => $cekdata->nofoto,
|
'nama' => $nama,
|
||||||
'kd_spesimen' => $cekdata->kd_spesimen,
|
'norm' => $cekdata->noregister,
|
||||||
'nm_spesimen' => $cekdata->nm_spesimen,
|
'rtglast' => $cekdata->mulai,
|
||||||
'tgllahir' => $cekdata->tgllahirpasien,
|
'alamat' => $alamat,
|
||||||
'jk' => $cekdata->jkpasien,
|
'rjenis' => $jk,
|
||||||
];
|
'umur' => $cekdata->usia,
|
||||||
$this->sendRegistrationToLis($dataForLis);
|
'namadok' => $getdata->dokter ?? 'Unkown',
|
||||||
} else {
|
'ruangan' => 'Mikrobiologi',
|
||||||
$pesan = 'Cannot send on Serial Port From Server';
|
'tes' => $cekdata->reques,
|
||||||
|
'alat' => 'ALL',
|
||||||
|
'kd_spesimen' => $cekdata->kd_spesimen,
|
||||||
|
'nm_spesimen' => $cekdata->nm_spesimen,
|
||||||
|
'tgllahir' => $cekdata->tgllahirpasien,
|
||||||
|
'flg_vitek1' => false,
|
||||||
|
'flg_vitek2' => false,
|
||||||
|
'flg_bd1' => false,
|
||||||
|
'flg_bd2' => false,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}catch (Exception $e) {
|
}catch (Exception $e) {
|
||||||
$pesan = $e->getMessage();
|
$pesan = $e->getMessage();
|
||||||
|
|||||||
@@ -308,25 +308,34 @@ class ReportController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function genRekapAntibiotik(Request $request) {
|
public function genRekapAntibiotik(Request $request) {
|
||||||
$data = [];
|
$data = [];
|
||||||
$bulan = $request->input('bulan');
|
$bulan = $request->input('bulan');
|
||||||
$tahun = $request->input('tahun');
|
$tahun = $request->input('tahun');
|
||||||
if ($tahun == '' OR is_null($tahun)){
|
if ($tahun == '' OR is_null($tahun)){
|
||||||
$getarray = explode('?', $bulan);
|
$getarray = explode('?', $bulan);
|
||||||
$bulan = $getarray[0] ?? date('m');
|
$bulan = $getarray[0] ?? date('m');
|
||||||
$tahun = $getarray[1] ?? date('Y');
|
$tahun = $getarray[1] ?? date('Y');
|
||||||
$bulan = str_replace('bulan=', '', $bulan);
|
$bulan = str_replace('bulan=', '', $bulan);
|
||||||
$tahun = str_replace('tahun=', '', $tahun);
|
$tahun = str_replace('tahun=', '', $tahun);
|
||||||
}
|
}
|
||||||
if ($bulan == '' OR $bulan == 'ALL' OR $bulan == 'Pick Month') {
|
if ($bulan == '' OR $bulan == 'ALL' OR $bulan == 'Pick Month') {
|
||||||
$orderbydate = Periksa::whereYear('daftar', $tahun)->get();
|
$orderbydate = Periksa::whereYear('daftar', $tahun)->orderBy('daftar', 'asc')->get();
|
||||||
$jsonantibiotik = RekapAntibiotik::whereIn('orderid', $orderbydate->pluck('id'))->get()->groupBy('orderid');
|
|
||||||
} else {
|
} else {
|
||||||
$orderbydate = Periksa::whereMonth('daftar', $bulan)->whereYear('daftar', $tahun)->get();
|
$orderbydate = Periksa::whereMonth('daftar', $bulan)->whereYear('daftar', $tahun)->orderBy('daftar', 'asc')->get();
|
||||||
$jsonantibiotik = RekapAntibiotik::whereIn('orderid', $orderbydate->pluck('id'))->get()->groupBy('orderid');
|
|
||||||
}
|
}
|
||||||
return view('admin.rekapantibiotik', compact('orderbydate', 'jsonantibiotik', 'bulan', 'tahun'));
|
|
||||||
}
|
$orderIds = $orderbydate->pluck('id');
|
||||||
|
|
||||||
|
$allAntibiotics = RekapAntibiotik::whereIn('orderid', $orderIds)->get();
|
||||||
|
|
||||||
|
$masterAntibioticList = $allAntibiotics->pluck('resistance')->unique()->sort()->values();
|
||||||
|
|
||||||
|
$jsonantibiotik = $allAntibiotics->groupBy('orderid')->map(function ($items) {
|
||||||
|
return $items->pluck('interpretation', 'resistance');
|
||||||
|
});
|
||||||
|
|
||||||
|
return view('admin.rekapantibiotik', compact('orderbydate', 'jsonantibiotik', 'bulan', 'tahun', 'masterAntibioticList'));
|
||||||
|
}
|
||||||
public function genGlassReport(Request $request) {
|
public function genGlassReport(Request $request) {
|
||||||
$data = [];
|
$data = [];
|
||||||
$bulan = $request->input('bulan');
|
$bulan = $request->input('bulan');
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ResultOnListiner extends Model
|
||||||
|
{
|
||||||
|
protected $connection = 'mysqllistener';
|
||||||
|
protected $primaryKey = "urut";
|
||||||
|
protected $table = "lis_phoenix";
|
||||||
|
public $timestamps = false;
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
}
|
||||||
@@ -231,110 +231,80 @@ class AstmMessageService
|
|||||||
return response()->json(['message' => 'Data berhasil diproses dan disimpan.']);
|
return response()->json(['message' => 'Data berhasil diproses dan disimpan.']);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!empty($mltrData)){
|
if (!empty($mltrData)) {
|
||||||
Log::info("Trying parser MTRSL :", $mltrData);
|
Log::info("Trying robust parser for MTRSL:", $mltrData);
|
||||||
$parsedData = [];
|
|
||||||
$parsedData['antibiotics'] = [];
|
$resultSample = new ResultSample();
|
||||||
$antibiotic = '';
|
$antibioticResults = [];
|
||||||
$resistance = '';
|
$currentAntibiotic = [];
|
||||||
$value = '';
|
|
||||||
$interpretation = '';
|
foreach ($mltrData as $field) {
|
||||||
$mulaikirim = 0;
|
if (strlen($field) < 2) continue; // Lewati field kosong
|
||||||
$resultSample = new ResultSample();
|
|
||||||
foreach ($mltrData as $index => $field) {
|
// 1. Identifikasi TAG dan VALUE dari setiap field
|
||||||
if ($field == 'ra'){
|
$tag = substr($field, 0, 2);
|
||||||
if ($antibiotic != ''){
|
$value = substr($field, 2);
|
||||||
$parsedData['antibiotics'][] = [
|
|
||||||
'antibiotic' => $antibiotic, // Antibiotik
|
// 2. Gunakan SWITCH pada TAG, bukan pada INDEX
|
||||||
'resistance' => $resistance, // Hasil Resistansi
|
switch ($tag) {
|
||||||
'value' => $value, // Nilai
|
// == Data Pasien & Sampel ==
|
||||||
'interpretation'=> $interpretation // Interpretasi
|
case 'pi': $resultSample->patient_id = $value; break;
|
||||||
];
|
case 'pn':
|
||||||
$antibiotic = '';
|
$patientNames = explode(',', $value ?? null);
|
||||||
$resistance = '';
|
$resultSample->patient_name_last = trim($patientNames[0] ?? '');
|
||||||
$value = '';
|
$resultSample->patient_name_first = trim($patientNames[1] ?? '');
|
||||||
$interpretation = '';
|
$resultSample->patient_name_middle = trim($patientNames[2] ?? '');
|
||||||
} else {
|
break;
|
||||||
$mulaikirim = 1;
|
case 'pl': $resultSample->address_street = $value; break;
|
||||||
}
|
case 'ci': $resultSample->accession_number = substr($value, 6); break;
|
||||||
} else {
|
case 'o2': $resultSample->organism = $value; break;
|
||||||
if ($mulaikirim == 1){
|
|
||||||
$antibiotic = substr($field, 2);
|
// Tanggal bisa memiliki tag s1, s3, dll. Sesuaikan jika perlu
|
||||||
$mulaikirim++;
|
case 's3':
|
||||||
} else if ($mulaikirim == 2){
|
try {
|
||||||
$resistance = substr($field, 2);
|
// Contoh parsing tanggal dari format Vitek: 08/25/2025
|
||||||
$mulaikirim++;
|
$resultSample->test_complete_datetime = Carbon::createFromFormat('m/d/Y', $value)->format('Y-m-d H:i:s');
|
||||||
} else if ($mulaikirim == 3){
|
} catch (Exception $e) {
|
||||||
$value = substr($field, 2);
|
$resultSample->test_complete_datetime = now();
|
||||||
$mulaikirim++;
|
|
||||||
} else if ($mulaikirim == 4){
|
|
||||||
$interpretation = substr($field, 2);
|
|
||||||
$mulaikirim++;
|
|
||||||
} else {
|
|
||||||
$field = substr($field, 2);
|
|
||||||
switch ($index) {
|
|
||||||
case 0:
|
|
||||||
$resultSample->sender_name = $alat;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
$resultSample->version_number = $field; // iiV2
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$resultSample->isolate_number = $field; // is000015F278BD
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
$resultSample->patient_id = $field; // pi12009427
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
$patientNames = explode(',', $field ?? null);
|
|
||||||
if (count($patientNames) > 0) {
|
|
||||||
$resultSample->patient_name_last = trim($patientNames[0]); // Last name
|
|
||||||
}
|
|
||||||
if (count($patientNames) > 1) {
|
|
||||||
$resultSample->patient_name_first = trim($patientNames[1]); // First name
|
|
||||||
}
|
|
||||||
if (count($patientNames) > 2) {
|
|
||||||
$resultSample->patient_name_middle = trim($patientNames[2]); // Middle name
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
$resultSample->address_street = $field; // plMANINJAU
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
try {
|
|
||||||
$resultSample->message_datetime = Carbon::parse($field)->format('Y-m-d') ?? null;
|
|
||||||
}catch (Exception $e) {
|
|
||||||
$resultSample->message_datetime = date('Y-m-d');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
try {
|
|
||||||
$resultSample->test_complete_datetime = Carbon::parse($field)->format('Y-m-d') ?? null;
|
|
||||||
}catch (Exception $e) {
|
|
||||||
$resultSample->test_complete_datetime = date('Y-m-d');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 14:
|
|
||||||
$resultSample->accession_number = substr($field, 6); // ci30112024.26859
|
|
||||||
break;
|
|
||||||
case 23:
|
|
||||||
$resultSample->organism = $field; // o2Staphylococcus haemolyticus
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
|
||||||
|
// == Logika Cerdas untuk Blok Antibiotik ==
|
||||||
|
case 'ra':
|
||||||
|
// 'ra' adalah sinyal bahwa blok antibiotik SEBELUMNYA sudah selesai.
|
||||||
|
// Jika $currentAntibiotic tidak kosong, simpan ke hasil utama.
|
||||||
|
if (!empty($currentAntibiotic)) {
|
||||||
|
$antibioticResults[] = $currentAntibiotic;
|
||||||
|
}
|
||||||
|
// Reset untuk menampung data antibiotik yang baru.
|
||||||
|
$currentAntibiotic = [];
|
||||||
|
break;
|
||||||
|
case 'a1': $currentAntibiotic['antibiotic'] = $value; break; // Kode Antibiotik
|
||||||
|
case 'a2': $currentAntibiotic['resistance'] = $value; break; // Nama Antibiotik
|
||||||
|
case 'a3': $currentAntibiotic['value'] = $value; break; // Nilai MIC
|
||||||
|
case 'a4': $currentAntibiotic['interpretation'] = $value; break; // Interpretasi
|
||||||
|
case 'an':
|
||||||
|
// Jika 'an' ada, ini adalah interpretasi final, timpa yang sebelumnya.
|
||||||
|
$currentAntibiotic['interpretation'] = $value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// == Metadata Lainnya (opsional) ==
|
||||||
|
case 'ii': $resultSample->version_number = $value; break;
|
||||||
|
case 'is': $resultSample->isolate_number = $value; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//$resultSample->specimen_type = $parsedData['specimen_type'] ?? null; // Could be inferred
|
|
||||||
//$resultSample->test_id = $parsedData['test_id'] ?? null;
|
|
||||||
|
|
||||||
// Result Record
|
// Penting: Simpan blok antibiotik TERAKHIR setelah loop selesai
|
||||||
|
if (!empty($currentAntibiotic)) {
|
||||||
$resultSample->additional_result = json_encode($parsedData['antibiotics']);
|
$antibioticResults[] = $currentAntibiotic;
|
||||||
|
}
|
||||||
|
|
||||||
|
$resultSample->sender_name = $alat ?? 'VITEK'; // Pastikan var $alat ada
|
||||||
|
$resultSample->additional_result = json_encode($antibioticResults);
|
||||||
|
|
||||||
// Menyimpan data yang sudah diparse
|
// Menyimpan data yang sudah diparse
|
||||||
$resultSample->save();
|
$resultSample->save();
|
||||||
Log::info("Data MTRL Berhasil di Parse dan di simpan ", $resultSample->toArray());
|
Log::info("Data MTRSL successfully parsed and saved.", $resultSample->toArray());
|
||||||
return response()->json(['message' => 'Data berhasil diproses dan disimpan.']);
|
return response()->json(['message' => 'Data berhasil diproses dan disimpan.']);
|
||||||
} else {
|
} else {
|
||||||
$headerData = explode("|", $response);
|
$headerData = explode("|", $response);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ return new class extends Migration
|
|||||||
$table->string('nmanalis', 250)->nullable();
|
$table->string('nmanalis', 250)->nullable();
|
||||||
$table->string('nmexcutor', 250)->nullable();
|
$table->string('nmexcutor', 250)->nullable();
|
||||||
$table->string('klinisi', 250)->nullable();
|
$table->string('klinisi', 250)->nullable();
|
||||||
$table->string('klinis', 250)->nullable();
|
$table->mediumText('klinis')->nullable();
|
||||||
$table->integer('poli_id')->nullable();
|
$table->integer('poli_id')->nullable();
|
||||||
$table->text('keterangan')->nullable();
|
$table->text('keterangan')->nullable();
|
||||||
$table->text('kesimpulan')->nullable();
|
$table->text('kesimpulan')->nullable();
|
||||||
|
|||||||
@@ -37,9 +37,9 @@
|
|||||||
<th>bhp_antibiotiktambahan</th>
|
<th>bhp_antibiotiktambahan</th>
|
||||||
<th>id_esbl</th>
|
<th>id_esbl</th>
|
||||||
<th>id_mrsa</th>
|
<th>id_mrsa</th>
|
||||||
@if(isset($jsonantibiotik) && !empty($jsonantibiotik))
|
@if(isset($masterAntibioticList))
|
||||||
@foreach($jsonantibiotik->first() as $antibiotic)
|
@foreach($masterAntibioticList as $antibioticName)
|
||||||
<th>{{ $antibiotic->antibiotic }}</th>
|
<th>{{ strtoupper($antibioticName) }}</th>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
@@ -72,12 +72,16 @@
|
|||||||
<td>{{ $data->bhp_antibiotiktambahan}} </td>
|
<td>{{ $data->bhp_antibiotiktambahan}} </td>
|
||||||
<td>{{ $data->id_esbl}} </td>
|
<td>{{ $data->id_esbl}} </td>
|
||||||
<td>{{ $data->id_mrsa}} </td>
|
<td>{{ $data->id_mrsa}} </td>
|
||||||
@if(isset($jsonantibiotik[$data->id]) && !empty($jsonantibiotik[$data->id]))
|
@php
|
||||||
@foreach($jsonantibiotik[$data->id] as $antibiotic)
|
$patientResults = $jsonantibiotik->get($data->id);
|
||||||
<td>{{ $antibiotic->interpretation }}</td>
|
@endphp
|
||||||
|
|
||||||
|
@if(isset($masterAntibioticList))
|
||||||
|
@foreach($masterAntibioticList as $antibioticName)
|
||||||
|
<td>
|
||||||
|
{{ $patientResults[$antibioticName] ?? '-' }}
|
||||||
|
</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
@else
|
|
||||||
<td> </td>
|
|
||||||
@endif
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
@@ -2069,6 +2069,7 @@
|
|||||||
|
|
||||||
@push('script')
|
@push('script')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var hakaksess = '{{ Session("previlage") }}';
|
||||||
function openlamanekpertise( jQuery ){
|
function openlamanekpertise( jQuery ){
|
||||||
var dlp = document.getElementById('dlp').value;
|
var dlp = document.getElementById('dlp').value;
|
||||||
var nofoto = document.getElementById('nofoto').value;
|
var nofoto = document.getElementById('nofoto').value;
|
||||||
@@ -2662,18 +2663,10 @@
|
|||||||
type : 'warning',
|
type : 'warning',
|
||||||
})
|
})
|
||||||
} else if (statuse == 'Selesai' || statuse == 'Arsip') {
|
} else if (statuse == 'Selesai' || statuse == 'Arsip') {
|
||||||
if (hakaksess == 'supervisor'){
|
$('#divreadonly').hide();
|
||||||
$('#divreadonly').hide();
|
$('#divperiksa').show();
|
||||||
$('#divperiksa').show();
|
$('#divawal').hide();
|
||||||
$('#divawal').hide();
|
openlamanekpertise();
|
||||||
openlamanekpertise();
|
|
||||||
} else {
|
|
||||||
swal({
|
|
||||||
title : 'Ekspertise Final',
|
|
||||||
text : 'Hanya Akun SPV yang diperkenankan mengubah data Arsip',
|
|
||||||
type : 'warning',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$('#divreadonly').hide();
|
$('#divreadonly').hide();
|
||||||
$('#divperiksa').show();
|
$('#divperiksa').show();
|
||||||
|
|||||||
@@ -2136,6 +2136,8 @@
|
|||||||
@endsection
|
@endsection
|
||||||
@push('script')
|
@push('script')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var hakaksess = '{{ Session("previlage") }}';
|
||||||
|
|
||||||
function openlamanekpertise( jQuery ){
|
function openlamanekpertise( jQuery ){
|
||||||
var dlp = document.getElementById('dlp').value;
|
var dlp = document.getElementById('dlp').value;
|
||||||
var nofoto = document.getElementById('nofoto').value;
|
var nofoto = document.getElementById('nofoto').value;
|
||||||
@@ -2729,18 +2731,10 @@
|
|||||||
type : 'warning',
|
type : 'warning',
|
||||||
})
|
})
|
||||||
} else if (statuse == 'Selesai' || statuse == 'Arsip') {
|
} else if (statuse == 'Selesai' || statuse == 'Arsip') {
|
||||||
if (hakaksess == 'supervisor'){
|
$('#divreadonly').hide();
|
||||||
$('#divreadonly').hide();
|
$('#divperiksa').show();
|
||||||
$('#divperiksa').show();
|
$('#divawal').hide();
|
||||||
$('#divawal').hide();
|
openlamanekpertise();
|
||||||
openlamanekpertise();
|
|
||||||
} else {
|
|
||||||
swal({
|
|
||||||
title : 'Ekspertise Final',
|
|
||||||
text : 'Hanya Akun SPV yang diperkenankan mengubah data Arsip',
|
|
||||||
type : 'warning',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$('#divreadonly').hide();
|
$('#divreadonly').hide();
|
||||||
$('#divperiksa').show();
|
$('#divperiksa').show();
|
||||||
|
|||||||
Reference in New Issue
Block a user