update
This commit is contained in:
@@ -17,7 +17,7 @@ use App\Organisms;
|
||||
use DateTime;
|
||||
use Carbon\Carbon;
|
||||
use Session;
|
||||
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
class ReportController extends Controller
|
||||
{
|
||||
public function index() {
|
||||
@@ -263,6 +263,54 @@ class ReportController extends Controller
|
||||
'cito' => $totals['cito'],
|
||||
];
|
||||
}
|
||||
private $listAntibiotik = [
|
||||
'Oxacillin-OX',
|
||||
'Cefoxitin-FOX',
|
||||
'Benzylpenicillin-P',
|
||||
'Ampicillin-AM',
|
||||
'Azithromycin-AZM',
|
||||
'Erythromycin-ERY',
|
||||
'Cefazolin-CZO',
|
||||
'Cefepime-FEP',
|
||||
'Cefixime-CFM',
|
||||
'Cefotaxime-CTX',
|
||||
'Cefuroxime-CXM',
|
||||
'Ceftazidime-CAZ',
|
||||
'Ceftriaxone-CRO',
|
||||
'Ceftazidime/Avibactam-CZA',
|
||||
'Piperacilin/Tazobactam-TZP',
|
||||
'Ampicillin/Sulbactam-SAM',
|
||||
'Amoxicillin/Clavulanate-AMC',
|
||||
'Cefoperazon/Sulbactam-SCF',
|
||||
'Aztreonam-ATM',
|
||||
'Ceftaroline-CPT',
|
||||
'Ciprofloxacin-CIP',
|
||||
'Levofloxacin-LEV',
|
||||
'Moxifloxacin-MFX',
|
||||
'Clindamycin-CLI',
|
||||
'Colistin-CS',
|
||||
'Tetracyclin-TCY',
|
||||
'Tigecycline-TGC',
|
||||
'Gentamicin-GM',
|
||||
'Amikacin-AN',
|
||||
'Meropenem-MEM',
|
||||
'Imipenem-IPM',
|
||||
'Doripenem-DOR',
|
||||
'Ertapenem-ETP',
|
||||
'Minocycline-MNO',
|
||||
'Doxycycline-DOX',
|
||||
'Spectinomycin-SPT',
|
||||
'Trimethoprim/Sulfamethoxazole-SXT',
|
||||
'Fosfomycin-FOS',
|
||||
'Vancomycin-VAN',
|
||||
'Linezolid-LNZ',
|
||||
'Fluconazole',
|
||||
'Voriconazole',
|
||||
'Caspofungin',
|
||||
'Micafungin',
|
||||
'Amphotericin B',
|
||||
'Flucytosine'
|
||||
];
|
||||
public function report(Request $request) {
|
||||
$bulan = $request->input('bulan');
|
||||
$tahun = $request->input('tahun');
|
||||
@@ -413,141 +461,255 @@ class ReportController extends Controller
|
||||
}
|
||||
}
|
||||
public function genRekapAntibiotik(Request $request) {
|
||||
$data = [];
|
||||
$bulan = $request->input('bulan');
|
||||
$tahun = $request->input('tahun');
|
||||
if ($tahun == '' OR is_null($tahun)){
|
||||
$bulan = $request->input('bulan');
|
||||
$tahun = $request->input('tahun');
|
||||
|
||||
if ($tahun == '' OR is_null($tahun)){
|
||||
$getarray = explode('?', $bulan);
|
||||
$bulan = $getarray[0] ?? date('m');
|
||||
$tahun = $getarray[1] ?? date('Y');
|
||||
$bulan = str_replace('bulan=', '', $bulan);
|
||||
$tahun = str_replace('tahun=', '', $tahun);
|
||||
}
|
||||
if ($bulan == '' OR $bulan == 'ALL' OR $bulan == 'Pick Month') {
|
||||
$orderbydate = Periksa::whereYear('daftar', $tahun)->get();
|
||||
$jsonantibiotik = RekapAntibiotik::whereIn('orderid', $orderbydate->pluck('id'))->get()->groupBy('orderid');
|
||||
} else {
|
||||
$orderbydate = Periksa::whereMonth('daftar', $bulan)->whereYear('daftar', $tahun)->get();
|
||||
$jsonantibiotik = RekapAntibiotik::whereIn('orderid', $orderbydate->pluck('id'))->get()->groupBy('orderid');
|
||||
}
|
||||
return view('admin.rekapantibiotik', compact('orderbydate', 'jsonantibiotik', 'bulan', 'tahun'));
|
||||
}
|
||||
|
||||
$listAntibiotik = $this->getDynamicAntibioticHeaders($bulan, $tahun);
|
||||
|
||||
$query = Periksa::query()->whereYear('daftar', $tahun);
|
||||
if ($bulan != 'ALL' && $bulan != 'Pick Month') {
|
||||
$query->whereMonth('daftar', $bulan);
|
||||
}
|
||||
|
||||
// 3. Pagination (50 Data)
|
||||
$orderbydate = $query->paginate(50);
|
||||
$orderbydate->appends(['bulan' => $bulan, 'tahun' => $tahun]);
|
||||
|
||||
// 4. Mapping Data Antibiotik (Hanya untuk 50 pasien ini)
|
||||
$pageIds = $orderbydate->pluck('id')->toArray();
|
||||
$antibiotikLookup = $this->mapAntibiotikData($pageIds);
|
||||
|
||||
return view('admin.rekapantibiotik', [
|
||||
'orderbydate' => $orderbydate,
|
||||
'antibiotikLookup' => $antibiotikLookup,
|
||||
'listAntibiotik' => $listAntibiotik, // Kirim header dinamis ke View
|
||||
'bulan' => $bulan,
|
||||
'tahun' => $tahun
|
||||
]);
|
||||
}
|
||||
private function mapAntibiotikData($orderIds) {
|
||||
$raw = RekapAntibiotik::whereIn('orderid', $orderIds)->get();
|
||||
|
||||
$lookup = [];
|
||||
foreach($raw as $row) {
|
||||
$lookup[$row->orderid][$row->antibiotic] = $row->interpretation;
|
||||
}
|
||||
return $lookup;
|
||||
}
|
||||
private function getDynamicAntibioticHeaders($bulan, $tahun) {
|
||||
$query = DB::table('rekapantibiotik')
|
||||
->join('periksa', 'rekapantibiotik.orderid', '=', 'periksa.id')
|
||||
->whereYear('periksa.daftar', $tahun);
|
||||
|
||||
if ($bulan != 'ALL' && $bulan != 'Pick Month') {
|
||||
$query->whereMonth('periksa.daftar', $bulan);
|
||||
}
|
||||
|
||||
return $query->distinct()
|
||||
->orderBy('rekapantibiotik.antibiotic', 'ASC')
|
||||
->pluck('rekapantibiotik.antibiotic')
|
||||
->toArray();
|
||||
}
|
||||
public function genGlassReport(Request $request) {
|
||||
$data = [];
|
||||
$bulan = $request->input('bulan');
|
||||
$tahun = $request->input('tahun');
|
||||
if ($tahun == '' OR is_null($tahun)){
|
||||
$bulan = $request->input('bulan');
|
||||
$tahun = $request->input('tahun');
|
||||
|
||||
if ($tahun == '' OR is_null($tahun)){
|
||||
$getarray = explode('?', $bulan);
|
||||
$bulan = $getarray[0] ?? date('m');
|
||||
$tahun = $getarray[1] ?? date('Y');
|
||||
$bulan = str_replace('bulan=', '', $bulan);
|
||||
$tahun = str_replace('tahun=', '', $tahun);
|
||||
}
|
||||
if ($bulan == '' OR $bulan == 'ALL' OR $bulan == 'Pick Month') {
|
||||
$orderbydate = Periksa::whereYear('daftar', $tahun)->get();
|
||||
$jsonantibiotik = array(
|
||||
'Oxacillin-OX',
|
||||
'Cefoxitin-FOX',
|
||||
'Benzylpenicillin-P',
|
||||
'Ampicillin-AM',
|
||||
'Azithromycin-AZM',
|
||||
'Erythromycin-ERY',
|
||||
'Cefazolin-CZO',
|
||||
'Cefepime-FEP',
|
||||
'Cefixime-CFM',
|
||||
'Cefotaxime-CTX',
|
||||
'Cefuroxime-CXM',
|
||||
'Ceftazidime-CAZ',
|
||||
'Ceftriaxone-CRO',
|
||||
'Ceftazidime/Avibactam-CZA',
|
||||
'Piperacilin/Tazobactam-TZP',
|
||||
'Ampicillin/Sulbactam-SAM',
|
||||
'Amoxicillin/Clavulanate-AMC',
|
||||
'Cefoperazon/Sulbactam-SCF',
|
||||
'Aztreonam-ATM',
|
||||
'Ceftaroline-CPT',
|
||||
'Ciprofloxacin-CIP',
|
||||
'Levofloxacin-LEV',
|
||||
'Moxifloxacin-MFX',
|
||||
'Clindamycin-CLI',
|
||||
'Colistin-CS', //tidak ada
|
||||
'Tetracyclin-TCY',
|
||||
'Tigecycline-TGC', //double
|
||||
'Gentamicin-GM',
|
||||
'Amikacin-AN',
|
||||
'Meropenem-MEM',
|
||||
'Imipenem-IPM',
|
||||
'Doripenem-DOR',
|
||||
'Ertapenem-ETP',
|
||||
'Minocycline-MNO',
|
||||
'Doxycycline-DOX',
|
||||
'Spectinomycin-SPT',
|
||||
'Tigecycline-TGC', //sama-ini
|
||||
'Trimethoprim/Sulfamethoxazole-SXT',
|
||||
'Fosfomycin-FOS',
|
||||
'Vancomycin-VAN',
|
||||
'Linezolid-LNZ',
|
||||
'Fluconazole', //tidak ada
|
||||
'Voriconazole', //tidak ada
|
||||
'Caspofungin', //tidak ada
|
||||
'Micafungin', //tidak ada
|
||||
'Amphotericin B', //tidak ada
|
||||
'Flucytosine' //tidak ada
|
||||
);
|
||||
} else {
|
||||
$orderbydate = Periksa::whereMonth('daftar', $bulan)->whereYear('daftar', $tahun)->get();
|
||||
$jsonantibiotik = array(
|
||||
'Oxacillin-OX',
|
||||
'Cefoxitin-FOX',
|
||||
'Benzylpenicillin-P',
|
||||
'Ampicillin-AM',
|
||||
'Azithromycin-AZM',
|
||||
'Erythromycin-ERY',
|
||||
'Cefazolin-CZO',
|
||||
'Cefepime-FEP',
|
||||
'Cefixime-CFM',
|
||||
'Cefotaxime-CTX',
|
||||
'Cefuroxime-CXM',
|
||||
'Ceftazidime-CAZ',
|
||||
'Ceftriaxone-CRO',
|
||||
'Ceftazidime/Avibactam-CZA',
|
||||
'Piperacilin/Tazobactam-TZP',
|
||||
'Ampicillin/Sulbactam-SAM',
|
||||
'Amoxicillin/Clavulanate-AMC',
|
||||
'Cefoperazon/Sulbactam-SCF',
|
||||
'Aztreonam-ATM',
|
||||
'Ceftaroline-CPT',
|
||||
'Ciprofloxacin-CIP',
|
||||
'Levofloxacin-LEV',
|
||||
'Moxifloxacin-MFX',
|
||||
'Clindamycin-CLI',
|
||||
'Colistin-CS',
|
||||
'Tetracyclin-TCY',
|
||||
'Tigecycline-TGC',
|
||||
'Gentamicin-GM',
|
||||
'Amikacin-AN',
|
||||
'Meropenem-MEM',
|
||||
'Imipenem-IPM',
|
||||
'Doripenem-DOR',
|
||||
'Ertapenem-ETP',
|
||||
'Minocycline-MNO',
|
||||
'Doxycycline-DOX',
|
||||
'Spectinomycin-SPT',
|
||||
'Tigecycline-TGC',
|
||||
'Trimethoprim/Sulfamethoxazole-SXT',
|
||||
'Fosfomycin-FOS',
|
||||
'Vancomycin-VAN',
|
||||
'Linezolid-LNZ',
|
||||
'Fluconazole',
|
||||
'Voriconazole',
|
||||
'Caspofungin',
|
||||
'Micafungin',
|
||||
'Amphotericin B',
|
||||
'Flucytosine'
|
||||
);
|
||||
}
|
||||
return view('admin.glassreport', compact('orderbydate', 'jsonantibiotik', 'bulan', 'tahun'));
|
||||
}
|
||||
|
||||
// Query Periksa
|
||||
$query = Periksa::query()->whereYear('daftar', $tahun);
|
||||
if ($bulan != 'ALL' && $bulan != 'Pick Month') {
|
||||
$query->whereMonth('daftar', $bulan);
|
||||
}
|
||||
|
||||
// 1. Ambil Data Pasien (Limit 50 per halaman agar RAM aman)
|
||||
$orderbydate = $query->paginate(50);
|
||||
$orderbydate->appends(['bulan' => $bulan, 'tahun' => $tahun]);
|
||||
|
||||
// 2. Ambil Data Antibiotik HANYA untuk 50 pasien tersebut
|
||||
$pageIds = $orderbydate->pluck('id')->toArray();
|
||||
$antibiotikLookup = $this->mapAntibiotikData($pageIds);
|
||||
|
||||
return view('admin.glassreport', [
|
||||
'orderbydate' => $orderbydate,
|
||||
'antibiotikLookup' => $antibiotikLookup, // Kirim array hasil mapping
|
||||
'jsonantibiotik' => $this->listAntibiotik,
|
||||
'bulan' => $bulan,
|
||||
'tahun' => $tahun
|
||||
]);
|
||||
}
|
||||
public function exportGlassReport(Request $request) {
|
||||
// Set memory limit sementara untuk proses export berat, tapi streaming tetap kuncinya
|
||||
ini_set('memory_limit', '512M');
|
||||
ini_set('max_execution_time', 300); // 5 menit
|
||||
|
||||
$bulan = $request->input('bulan');
|
||||
$tahun = $request->input('tahun');
|
||||
|
||||
// Logic cleaning input...
|
||||
if (strpos($bulan, 'bulan=') !== false) {
|
||||
$parts = explode('?', $bulan);
|
||||
$bulan = str_replace('bulan=', '', $parts[0]);
|
||||
$tahun = str_replace('tahun=', '', $parts[1] ?? date('Y'));
|
||||
}
|
||||
|
||||
$response = new StreamedResponse(function() use ($bulan, $tahun) {
|
||||
$handle = fopen('php://output', 'w');
|
||||
|
||||
// Header CSV
|
||||
$staticHeader = ['ID RS', 'Nama Pasien', 'No RM', 'JK', 'Tgl Lahir', 'Usia', 'Ruang', 'Tgl Masuk', 'Tgl Sample', 'Origin', 'Jenis Spesimen', 'Spesies Bakteri', 'ESBL', 'MRSA'];
|
||||
fputcsv($handle, array_merge($staticHeader, $this->listAntibiotik));
|
||||
|
||||
// Query Tanpa Get() tapi Chunk()
|
||||
$query = Periksa::query()->whereYear('daftar', $tahun);
|
||||
if ($bulan != 'ALL' && $bulan != 'Pick Month') {
|
||||
$query->whereMonth('daftar', $bulan);
|
||||
}
|
||||
|
||||
// Proses per 500 data agar RAM stabil
|
||||
$query->chunk(500, function($rows) use ($handle) {
|
||||
|
||||
// Mapping Antibiotik untuk batch 500 ini saja
|
||||
$chunkIds = $rows->pluck('id')->toArray();
|
||||
$antibiotikLookup = $this->mapAntibiotikData($chunkIds);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$csvRow = [
|
||||
$row->id_rs ?? '', // Sesuaikan nama kolom
|
||||
$row->nmpasien,
|
||||
$row->noregister,
|
||||
$row->jkpasien,
|
||||
$row->tgllahirpasien,
|
||||
$row->usia,
|
||||
$row->asalpasien,
|
||||
$row->mulai,
|
||||
$row->daftar,
|
||||
'', // Origin
|
||||
$row->kd_spesimen,
|
||||
$row->nm_spesimen, // Asumsi nama bakteri disini atau kolom lain
|
||||
$row->id_esbl,
|
||||
$row->id_mrsa
|
||||
];
|
||||
|
||||
foreach ($this->listAntibiotik as $headerAntibiotik) {
|
||||
$nilai = $antibiotikLookup[$row->id][$headerAntibiotik] ?? '';
|
||||
$csvRow[] = $nilai;
|
||||
}
|
||||
|
||||
fputcsv($handle, $csvRow);
|
||||
}
|
||||
});
|
||||
|
||||
fclose($handle);
|
||||
});
|
||||
|
||||
$response->headers->set('Content-Type', 'text/csv');
|
||||
$response->headers->set('Content-Disposition', 'attachment; filename="GlassReport_'.$bulan.'_'.$tahun.'.csv"');
|
||||
|
||||
return $response;
|
||||
}
|
||||
public function exportRekapAntibiotik(Request $request) {
|
||||
ini_set('memory_limit', '512M');
|
||||
ini_set('max_execution_time', 600); // 10 menit jika data besar
|
||||
|
||||
$bulan = $request->input('bulan');
|
||||
$tahun = $request->input('tahun');
|
||||
|
||||
if (strpos($bulan, 'bulan=') !== false) {
|
||||
$parts = explode('?', $bulan);
|
||||
$bulan = str_replace('bulan=', '', $parts[0]);
|
||||
$tahun = str_replace('tahun=', '', $parts[1] ?? date('Y'));
|
||||
}
|
||||
|
||||
// 1. Dapatkan Header Dinamis
|
||||
$listAntibiotik = $this->getDynamicAntibioticHeaders($bulan, $tahun);
|
||||
|
||||
$response = new StreamedResponse(function() use ($bulan, $tahun, $listAntibiotik) {
|
||||
$handle = fopen('php://output', 'w');
|
||||
|
||||
// Header Statis
|
||||
$staticHeaders = [
|
||||
'No', 'Status', 'No.RM', 'Name', 'Order', 'Gender', 'Date',
|
||||
'Urgensi', 'Comming From', 'Code', 'Spesimen', 'Finish',
|
||||
'BHP Media', 'BHP Pot Sputum', 'BHP Pot Urine', 'BHP Oshe',
|
||||
'BHP Obyek Glass', 'BHP Botol BD', 'BHP Parafilm', 'BHP Tips',
|
||||
'BHP Cotton Swab', 'BHP Ab Tambahan', 'ESBL', 'MRSA'
|
||||
];
|
||||
|
||||
// Gabung Header Statis + Header Dinamis dari DB
|
||||
fputcsv($handle, array_merge($staticHeaders, $listAntibiotik));
|
||||
|
||||
// Query Utama (Chunking)
|
||||
$query = Periksa::query()->whereYear('daftar', $tahun);
|
||||
if ($bulan != 'ALL' && $bulan != 'Pick Month') {
|
||||
$query->whereMonth('daftar', $bulan);
|
||||
}
|
||||
|
||||
$query->chunk(500, function($rows) use ($handle, $listAntibiotik) {
|
||||
// Ambil data nilai antibiotik untuk chunk ini
|
||||
$chunkIds = $rows->pluck('id')->toArray();
|
||||
$antibiotikLookup = $this->mapAntibiotikData($chunkIds);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$csvRow = [
|
||||
$row->noloket,
|
||||
$row->status,
|
||||
$row->noregister,
|
||||
$row->nmpasien,
|
||||
$row->reques,
|
||||
$row->jkpasien,
|
||||
$row->daftar,
|
||||
$row->urgensi,
|
||||
$row->asalpasien,
|
||||
$row->kd_spesimen,
|
||||
$row->nm_spesimen,
|
||||
$row->updated_at,
|
||||
$row->bhp_media,
|
||||
$row->bhp_potsputum,
|
||||
$row->bhp_poturine,
|
||||
$row->bhp_oshe,
|
||||
$row->bhp_obyekglass,
|
||||
$row->bhp_botolbd,
|
||||
$row->bhp_parafilm,
|
||||
$row->bhp_tips,
|
||||
$row->bhp_cottonswab,
|
||||
$row->bhp_antibiotiktambahan,
|
||||
$row->id_esbl,
|
||||
$row->id_mrsa
|
||||
];
|
||||
|
||||
// Loop sesuai Header Dinamis
|
||||
foreach ($listAntibiotik as $headerAb) {
|
||||
// Cek apakah pasien ini punya nilai utk antibiotik tsb
|
||||
$val = $antibiotikLookup[$row->id][$headerAb] ?? '';
|
||||
$csvRow[] = $val;
|
||||
}
|
||||
|
||||
fputcsv($handle, $csvRow);
|
||||
}
|
||||
});
|
||||
fclose($handle);
|
||||
});
|
||||
|
||||
$response->headers->set('Content-Type', 'text/csv');
|
||||
$response->headers->set('Content-Disposition', 'attachment; filename="RekapAntibiotik_'.$bulan.'_'.$tahun.'.csv"');
|
||||
|
||||
return $response;
|
||||
}
|
||||
public function genZNreport(Request $request) {
|
||||
$data = [];
|
||||
$bulan = $request->input('bulan');
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
@php
|
||||
use App\RekapAntibiotik;
|
||||
use App\SiraB;
|
||||
$antibiotikData = RekapAntibiotik::whereIn('orderid', $orderbydate->pluck('id'))->get()->keyBy('orderid');
|
||||
$siraBData = SiraB::whereIn('antibiotik', $jsonantibiotik ?? [])->orWhereIn('subantibiotik', $jsonantibiotik ?? [])->get()->keyBy('antibiotik');
|
||||
@endphp
|
||||
|
||||
@extends('base.layout')
|
||||
|
||||
@section('content')
|
||||
<div class="wrapper">
|
||||
<div class="container-fluid">
|
||||
@@ -14,91 +8,53 @@
|
||||
<div class="card-box ribbon-box">
|
||||
<div class="ribbon ribbon-danger">Rekapitulasi Data Bulan {{$bulan}} Tahun {{$tahun}}</div>
|
||||
<p></p>
|
||||
<div class="table-responsive">
|
||||
<button type="button" class="btn btn-primary" id="btnexport"><i class="fa fa-print"></i> Export</button>
|
||||
<div class="mt-3 mb-3">
|
||||
<a href="{{ route('exportGlassReport', ['bulan' => $bulan, 'tahun' => $tahun]) }}" class="btn btn-success">
|
||||
<i class="fa fa-file-excel-o"></i> Download Full Excel (CSV)
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<table id="glassreport" class="table table-bordered display">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered" id="datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID Rumah Sakit</th>
|
||||
<th>Nama Pasien</th>
|
||||
<th>No Rekam Medis</th>
|
||||
<th>Jenis Kelamin</th>
|
||||
<th>Tanggal Lahir</th>
|
||||
<th>Usia</th>
|
||||
<th>Ruang Rawat</th>
|
||||
<th>Tanggal Pasien Masuk</th>
|
||||
<th>Tanggal Pengambilan Sample</th>
|
||||
<th>Specimen Origin (Comunity Origin / Hospital Origin)</th>
|
||||
<th>Jenis Spesimen</th>
|
||||
<th>Nama Spesies Bakteri</th>
|
||||
<th>ESBL</th>
|
||||
<th>MRSA</th>
|
||||
@if(!empty($jsonantibiotik))
|
||||
@foreach($jsonantibiotik as $antibiotic)
|
||||
<th>{{ $antibiotic }}</th>
|
||||
@endforeach
|
||||
@endif
|
||||
<th>No RM</th>
|
||||
<th>Bakteri</th>
|
||||
@foreach($jsonantibiotik as $antibiotic)
|
||||
<th title="{{ $antibiotic }}">{{ $antibiotic }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($orderbydate ?? [] as $data)
|
||||
@forelse($orderbydate as $data)
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>{{ $data->nmpasien }}</td>
|
||||
<td>{{ $data->noregister }}</td>
|
||||
<td>{{ $data->jkpasien }}</td>
|
||||
<td>{{ $data->tgllahirpasien }}</td>
|
||||
<td>{{ $data->usia }}</td>
|
||||
<td>{{ $data->asalpasien }}</td>
|
||||
<td>{{ $data->mulai }}</td>
|
||||
<td>{{ $data->daftar }}</td>
|
||||
<td> </td>
|
||||
<td>{{ $data->kd_spesimen }}</td>
|
||||
<td>{{ $data->nm_spesimen }}</td>
|
||||
<td>{{ $data->id_esbl }}</td>
|
||||
<td>{{ $data->id_mrsa }}</td>
|
||||
@if(!empty($jsonantibiotik))
|
||||
@foreach($jsonantibiotik as $antibiotic)
|
||||
@php
|
||||
$cekapakahada = $antibiotikData[$data->id] ?? null;
|
||||
$intepretasi = $cekapakahada->interpretation ?? '';
|
||||
@endphp
|
||||
<td>{{ $intepretasi }}</td>
|
||||
@endforeach
|
||||
@endif
|
||||
<td>{{ $data->nm_spesimen }}</td> @foreach($jsonantibiotik as $headerAntibiotik)
|
||||
@php
|
||||
// LOGIC UTAMA:
|
||||
// Cek di array lookup: [id_pasien][nama_antibiotik]
|
||||
// Jika ada, ambil nilainya. Jika tidak, kosong.
|
||||
$interpretasi = $antibiotikLookup[$data->id][$headerAntibiotik] ?? '';
|
||||
@endphp
|
||||
<td class="text-center" style="{{ $interpretasi == 'R' ? 'background-color:#ffcccc' : '' }}">
|
||||
{{ $interpretasi }}
|
||||
</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="14" class="text-center">Tidak ada data yang tersedia.</td>
|
||||
<td colspan="{{ count($jsonantibiotik) + 3 }}">Data tidak ditemukan</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="_token" id="token" value="{{ csrf_token() }}">
|
||||
@endsection
|
||||
@push('script')
|
||||
<!-- SIGNATURE PAD -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.getElementById('btnexport').addEventListener('click', function() {
|
||||
var table = document.getElementById('glassreport');
|
||||
if (table) {
|
||||
var wb = XLSX.utils.table_to_book(table, { sheet: "Report" });
|
||||
XLSX.writeFile(wb, "GlassReport_{{$bulan}}_Tahun{{$tahun}}.xlsx");
|
||||
} else {
|
||||
console.error('Tabel dengan ID "tblkeaktifankelas" tidak ditemukan.');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endsection
|
||||
@@ -7,10 +7,17 @@
|
||||
<div class="card-box ribbon-box">
|
||||
<div class="ribbon ribbon-danger">Rekapitulasi Data Bulan {{$bulan}} Tahun {{$tahun}}</div>
|
||||
<p></p>
|
||||
<div class="table-responsive">
|
||||
<button type="button" class="btn btn-primary" id="btnexport"><i class="fa fa-print"></i> Export</button>
|
||||
|
||||
<div class="d-flex justify-content-between mb-2">
|
||||
<a href="{{ route('exportRekapAntibiotik', ['bulan' => $bulan, 'tahun' => $tahun]) }}" class="btn btn-primary">
|
||||
<i class="fa fa-print"></i> Export Excel (CSV)
|
||||
</a>
|
||||
|
||||
<div>Halaman {{ $orderbydate->currentPage() }} dari {{ $orderbydate->lastPage() }}</div>
|
||||
</div>
|
||||
|
||||
<table id="rekapantibiotik" class="table table-bordered display">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-sm table-striped display" id="datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
@@ -25,89 +32,74 @@
|
||||
<th>Code</th>
|
||||
<th>Spesimen</th>
|
||||
<th>Finish</th>
|
||||
<th>bhp_media</th>
|
||||
<th>bhp_potsputum</th>
|
||||
<th>bhp_poturine</th>
|
||||
<th>bhp_oshe</th>
|
||||
<th>bhp_obyekglass</th>
|
||||
<th>bhp_botolbd</th>
|
||||
<th>bhp_parafilm</th>
|
||||
<th>bhp_tips</th>
|
||||
<th>bhp_cottonswab</th>
|
||||
<th>bhp_antibiotiktambahan</th>
|
||||
<th>id_esbl</th>
|
||||
<th>id_mrsa</th>
|
||||
@if(isset($jsonantibiotik) && !empty($jsonantibiotik))
|
||||
@foreach($jsonantibiotik->first() as $antibiotic)
|
||||
<th>{{ $antibiotic->antibiotic }}</th>
|
||||
@endforeach
|
||||
@endif
|
||||
<th>Media</th>
|
||||
<th>Sputum</th>
|
||||
<th>Urine</th>
|
||||
<th>Oshe</th>
|
||||
<th>Glass</th>
|
||||
<th>Botol</th>
|
||||
<th>Paraf</th>
|
||||
<th>Tips</th>
|
||||
<th>Swab</th>
|
||||
<th>Ab+</th>
|
||||
<th>ESBL</th>
|
||||
<th>MRSA</th>
|
||||
|
||||
@foreach($listAntibiotik as $antibiotic)
|
||||
<th>{{ $antibiotic }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if(isset($orderbydate) && !empty($orderbydate))
|
||||
@foreach($orderbydate as $data)
|
||||
<tr>
|
||||
<td>{{ $data->noloket }}</td>
|
||||
<td>{{ $data->status }}</td>
|
||||
<td>{{ $data->noregister }}</td>
|
||||
<td>{{ $data->nmpasien }}</td>
|
||||
<td>{{ $data->reques }}</td>
|
||||
<td>{{ $data->jkpasien }}</td>
|
||||
<td>{{ $data->daftar }}</td>
|
||||
<td>{{ $data->urgensi }}</td>
|
||||
<td>{{ $data->asalpasien }}</td>
|
||||
<td>{{ $data->kd_spesimen }}</td>
|
||||
<td>{{ $data->nm_spesimen }}</td>
|
||||
<td>{{ $data->updated_at }}</td>
|
||||
<td>{{ $data->bhp_media}} </td>
|
||||
<td>{{ $data->bhp_potsputum}} </td>
|
||||
<td>{{ $data->bhp_poturine}} </td>
|
||||
<td>{{ $data->bhp_oshe}} </td>
|
||||
<td>{{ $data->bhp_obyekglass}} </td>
|
||||
<td>{{ $data->bhp_botolbd}} </td>
|
||||
<td>{{ $data->bhp_parafilm}} </td>
|
||||
<td>{{ $data->bhp_tips}} </td>
|
||||
<td>{{ $data->bhp_cottonswab}} </td>
|
||||
<td>{{ $data->bhp_antibiotiktambahan}} </td>
|
||||
<td>{{ $data->id_esbl}} </td>
|
||||
<td>{{ $data->id_mrsa}} </td>
|
||||
@if(isset($jsonantibiotik[$data->id]) && !empty($jsonantibiotik[$data->id]))
|
||||
@foreach($jsonantibiotik[$data->id] as $antibiotic)
|
||||
<td>{{ $antibiotic->interpretation }}</td>
|
||||
@endforeach
|
||||
@else
|
||||
<td> </td>
|
||||
@endif
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
@forelse($orderbydate as $data)
|
||||
<tr>
|
||||
<td>{{ $data->noloket }}</td>
|
||||
<td>{{ $data->status }}</td>
|
||||
<td>{{ $data->noregister }}</td>
|
||||
<td>{{ $data->nmpasien }}</td>
|
||||
<td>{{ $data->reques }}</td>
|
||||
<td>{{ $data->jkpasien }}</td>
|
||||
<td>{{ $data->daftar }}</td>
|
||||
<td>{{ $data->urgensi }}</td>
|
||||
<td>{{ $data->asalpasien }}</td>
|
||||
<td>{{ $data->kd_spesimen }}</td>
|
||||
<td>{{ $data->nm_spesimen }}</td>
|
||||
<td>{{ $data->updated_at }}</td>
|
||||
<td>{{ $data->bhp_media}} </td>
|
||||
<td>{{ $data->bhp_potsputum}} </td>
|
||||
<td>{{ $data->bhp_poturine}} </td>
|
||||
<td>{{ $data->bhp_oshe}} </td>
|
||||
<td>{{ $data->bhp_obyekglass}} </td>
|
||||
<td>{{ $data->bhp_botolbd}} </td>
|
||||
<td>{{ $data->bhp_parafilm}} </td>
|
||||
<td>{{ $data->bhp_tips}} </td>
|
||||
<td>{{ $data->bhp_cottonswab}} </td>
|
||||
<td>{{ $data->bhp_antibiotiktambahan}} </td>
|
||||
<td>{{ $data->id_esbl}} </td>
|
||||
<td>{{ $data->id_mrsa}} </td>
|
||||
|
||||
@foreach($listAntibiotik as $headerAb)
|
||||
@php
|
||||
// Ambil nilai dari Lookup Array
|
||||
// Jika pasien ini tidak tes antibiotik tersebut, tampilkan kosong
|
||||
$val = $antibiotikLookup[$data->id][$headerAb] ?? '';
|
||||
@endphp
|
||||
<td class="text-center">{{ $val }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="{{ 24 + count($listAntibiotik) }}" class="text-center">
|
||||
Tidak ada data tersedia.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="_token" id="token" value="{{ csrf_token() }}">
|
||||
@endsection
|
||||
@push('script')
|
||||
<!-- SIGNATURE PAD -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.getElementById('btnexport').addEventListener('click', function() {
|
||||
var table = document.getElementById('rekapantibiotik');
|
||||
if (table) {
|
||||
var wb = XLSX.utils.table_to_book(table, { sheet: "Report" });
|
||||
XLSX.writeFile(wb, "RekapanAntiBiotik_{{$bulan}}_Tahun{{$tahun}}.xlsx");
|
||||
} else {
|
||||
console.error('Tabel dengan ID "tblkeaktifankelas" tidak ditemukan.');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endsection
|
||||
@@ -126,7 +126,8 @@ Route::group(['middleware' => 'project.ipg'], function() {
|
||||
Route::get('glassreport', [ReportController::class, 'genGlassReport']);
|
||||
Route::get('znreport', [ReportController::class, 'genZNreport']);
|
||||
Route::get('tatreport', [ReportController::class, 'genTATreport']);
|
||||
|
||||
Route::get('/glass-report/export', [ReportController::class, 'exportGlassReport'])->name('exportGlassReport');
|
||||
Route::get('rekap-antibiotik/export', [ReportController::class, 'exportRekapAntibiotik'])->name('exportRekapAntibiotik');
|
||||
Route::get('list', [ListController::class, 'index']);
|
||||
Route::get('list/getlist', [ListController::class, 'getList'])->name('getList');
|
||||
Route::get('list/getlistterjadwal', [ListController::class, 'getListterjadwal'])->name('getListterjadwal');
|
||||
|
||||
Reference in New Issue
Block a user