[WIP] Update Dashboard Claim Final LOG

This commit is contained in:
R
2023-03-08 01:53:16 +07:00
parent ed96878dda
commit b587178c85
14 changed files with 1138 additions and 288 deletions

View File

@@ -7,11 +7,13 @@ use App\Models\Benefit;
use App\Models\Claim;
use App\Models\Icd;
use App\Models\Member;
use App\Models\Organization;
use App\Services\ClaimService;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Modules\Internal\Transformers\ClaimShowResource;
use PDF;
class ClaimController extends Controller
{
@@ -23,9 +25,14 @@ class ClaimController extends Controller
{
$claims = Claim::with([
'member',
'diagnosis',
'diagnoses' => function ($diagnosis) {
return $diagnosis->where('type', 'primary');
},
'diagnoses.icd',
'plan',
'benefit'
'benefit',
'claimRequest',
'claimRequest.service'
])
->latest()
->paginate(10);
@@ -229,4 +236,35 @@ class ClaimController extends Controller
return Helper::responseJson($claim, message: "Claim berhasil di approve");
}
public function downloadFinalLog($id)
{
$claim = Claim::findOrFail($id);
// TODO Fix this tipu tipu
$hospital = Organization::where('code', 'ORG000D')->first();
// TODO Fix this tipu tipu
$inpationBenefit = $claim->member->currentPlan->benefits()->first();
$pdf = PDF::loadView('pdf.final_log', [
'claim' => $claim,
'member' => $claim->member,
'dateOfAdmission' => now(),
'hospital' => $hospital,
'inpationBenefit' => $inpationBenefit
]);
return $pdf->download('invoice.pdf');
$view = view('pdf.final_log', [
'claim' => $claim,
'member' => $claim->member,
'dateOfAdmission' => now(),
'hospital' => $hospital,
'inpationBenefit' => $inpationBenefit
]);
return $view;
}
}

View File

@@ -149,4 +149,6 @@ Route::prefix('internal')->group(function () {
Route::get('district', [DistrictController::class, 'index']);
Route::get('village', [VillageController::class, 'index']);
Route::get('options', [OptionController::class, 'index']);
Route::get('final-log/{id}', [ClaimController::class, 'downloadFinalLog'])->name('claim.download-final-log');
});

View File

@@ -18,4 +18,9 @@ class ClaimDiagnosis extends Model
'note',
'description',
];
public function icd()
{
return $this->belongsTo(Icd::class, 'diagnosis_id', 'id');
}
}

View File

@@ -31,6 +31,9 @@ import { LaravelPaginatedData, LaravelPaginatedDataDefault } from '../../@types/
import DataTable from '../../components/LaravelTable';
import { fCurrency } from '../../utils/formatNumber';
import EditRoundedIcon from '@mui/icons-material/EditRounded';
import { Chip } from '@mui/material';
import Iconify from '@/components/Iconify';
import { enqueueSnackbar } from 'notistack';
export default function List() {
const [searchParams, setSearchParams] = useSearchParams();
@@ -76,69 +79,12 @@ export default function List() {
// IMPORT
// Create Button Menu
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
const createMenu = Boolean(anchorEl);
const importForm = useRef<HTMLInputElement>(null);
const [currentImportFileName, setCurrentImportFileName] = useState(null);
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};
const handleImportButton = () => {
if (importForm?.current) {
handleClose();
importForm.current ? importForm.current.click() : console.log('No File selected');
} else {
alert('No file selected');
}
};
const handleCancelImportButton = () => {
importForm.current.value = '';
importForm.current.dispatchEvent(new Event('change', { bubbles: true }));
};
const handleImportChange = (event: any) => {
if (event.target.files[0]) {
setCurrentImportFileName(event.target.files[0].name);
} else {
setCurrentImportFileName(null);
}
};
const handleUpload = () => {
if (importForm.current?.files.length) {
const formData = new FormData();
formData.append('file', importForm.current?.files[0]);
axios
.post(`corporates/${corporate_id}/import-plan-benefit`, formData)
.then((response) => {
handleCancelImportButton();
loadDataTableData();
setImportResult(response.data);
// alert('Succesfully read '+ response.data.total_successed_row + ' with ' + response.data.total_failed_row + ' failed rows');
})
.catch((response) => {
enqueueSnackbar(
'Looks like something went wrong. Please check your data and try again. ' +
response.message,
{ variant: 'error' }
);
});
} else {
enqueueSnackbar('No File Selected', { variant: 'warning' });
}
};
return (
<div>
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
<SearchInput onSearch={applyFilter} />
<Button
{/* <Button
variant="outlined"
startIcon={<AddIcon />}
sx={{ p: 1.8 }}
@@ -147,7 +93,7 @@ export default function List() {
}}
>
Create
</Button>
</Button> */}
</Stack>
</div>
);
@@ -213,35 +159,43 @@ export default function List() {
<TableCell align="left">{row.code}</TableCell>
<TableCell align="left">{row.member?.full_name}</TableCell>
<TableCell align="left">{row.plan?.code}</TableCell>
<TableCell align="left">{row.benefit?.code}</TableCell>
<TableCell align="left">{row.claim_request?.service?.name}</TableCell>
<TableCell align="left">
({row.diagnosis?.code}) {row.diagnosis?.name}
({row.diagnoses[0]?.icd?.code}) {row.diagnoses[0]?.icd?.name}
</TableCell>
<TableCell align="left">{fCurrency(row.total_claim)}</TableCell>
{ (row.status == 'approved' && (
<TableCell align="left">Approved</TableCell>
)) }
{ (row.status == 'postpone' && (
<TableCell align="left">Postponed</TableCell>
)) }
<TableCell align="center">
{row.status == 'draft' && (<Chip label='Draft' color="default" variant="outlined" />)}
{row.status == 'requested' && (<Chip label='Requested' color="primary" />)}
{row.status == 'received' && (<Chip label='Received' color="success" variant='outlined' />)}
{row.status == 'approved' && (<Chip label='Approved' color="success" />)}
{row.status == 'postpone' && (<Chip label='Postpone' color="primary" variant="outlined" />)}
{row.status == 'paid' && (<Chip label='Paid' color="warning" />)}
{row.status == 'declined' && (<Chip label='Declined' color="error" />)}
</TableCell>
<TableCell align="right">
<EditRoundedIcon
onClick={(e) => {
{['approved', 'paid'].includes(row.status) && (
<Iconify icon="eva:eye-fill" onClick={(e) => {
navigate('/claims/' + row.id);
}}
/>
}}></Iconify>
)}
{!['approved', 'paid'].includes(row.status) && (
<Iconify icon="eva:edit-outline" onClick={(e) => {
navigate('/claims/' + row.id);
}}></Iconify>
)}
</TableCell>
</TableRow>
{/* COLLAPSIBLE ROW */}
<TableRow>
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={99}>
<Collapse in={open} timeout="auto" unmountOnExit>
<Box sx={{ borderBottom: 1 }}>
{/* <Box sx={{ borderBottom: 1 }}>
<Typography variant="body2" gutterBottom component="div">
Description : {row.description}
</Typography>
</Box>
</Box> */}
</Collapse>
</TableCell>
</TableRow>

View File

@@ -174,10 +174,49 @@ export default function ClaimsCreateUpdate() {
});
};
const handleDownloadFinalLog = () => {
enqueueSnackbar("Gagal Download Final LOG", { variant: 'error' })
// ---------------------------------------------------------------
// Initial LOG
const [loadingLog, setLoadingLog] = useState(false)
const handleDownloadLog = (claim_id) => {
setLoadingLog(true);
axios
.post(`generate-log/${claim_id}`, {
responseType: 'blob',
})
.then((response) => {
window.open(URL.createObjectURL(response.data));
setLoadingLog(false);
setOpenDialog(false);
})
.catch((response) => {
enqueueSnackbar(response.message, { variant: 'error' });
setLoadingLog(false);
});
}
// -------------------------------------------------
// Final LOG
const [loadingFinalLog, setLoadingFinalLog] = useState(false)
const handleDownloadFinalLog = (claim_id) => {
setLoadingFinalLog(true);
axios
.get(`final-log/${claim_id}`, {
responseType: 'blob',
})
.then((response) => {
window.open(URL.createObjectURL(response.data));
setLoadingFinalLog(false);
})
.catch((response) => {
enqueueSnackbar(response.message, { variant: 'error' });
setLoadingFinalLog(false);
});
}
useEffect(() => {
axios.get('/claims/' + id).then(({ data }) => {
const claim = data.data;
@@ -247,14 +286,14 @@ export default function ClaimsCreateUpdate() {
</Stack>
<Paper variant="outlined" sx={{ background: '#f4f6f8', p: 2, marginY: 2 }}>
<Stack direction="row" justifyContent="space-between">
<Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography>Status : {currentClaim?.status}</Typography>
{ currentClaim?.status == 'approved' && (
<LoadingButton
loading={false}
loading={loadingFinalLog}
variant="contained"
onClick={() => {
handleDownloadFinalLog();
handleDownloadFinalLog(currentClaim.id);
}}
>
Download Final LOG

View File

@@ -1,29 +1,31 @@
{
"private": true,
"scripts": {
"start": "cd frontend && pnpm run start",
"build": "cd frontend && pnpm run build",
"dev": "npm run development",
"development": "mix",
"development": "vite",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
"production": "vite build"
},
"devDependencies": {
"autoprefixer": "^10.4.13",
"axios": "^0.25.0",
"laravel-mix": "^6.0.43",
"lodash": "^4.17.21",
"postcss": "^8.4.14"
"postcss": "^8.4.21",
"tailwindcss": "^3.2.7"
},
"dependencies": {
"@mui/icons-material": "^5.8.0",
"@mui/material": "^5.8.1",
"apexcharts": "^3.35.3",
"laravel-vite-plugin": "^0.7.4",
"numeral": "^2.0.6",
"react": "^18.1.0",
"react-apexcharts": "^1.4.0",
"react-dom": "^18.1.0"
"react-dom": "^18.1.0",
"vite": "^4.1.4"
}
}

876
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
@tailwind base;@tailwind components;@tailwind utilities;

View File

@@ -0,0 +1 @@
require("./bootstrap");

View File

@@ -0,0 +1,12 @@
{
"resources/css/app.css": {
"file": "assets/app-179954eb.css",
"isEntry": true,
"src": "resources/css/app.css"
},
"resources/js/app.js": {
"file": "assets/app-c3828592.js",
"isEntry": true,
"src": "resources/js/app.js"
}
}

View File

@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

View File

@@ -0,0 +1,296 @@
<?php
use App\Helpers\Helper;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Surat Jaminan Akhir - {{ $claim->code }}</title>
{{-- <link rel="stylesheet" href="{{ public_path('css/app.css') }}"> --}}
{{-- @vite('resources/css/app.css') --}}
{{----}}
<?php ob_start(); ?>
@vite('resources/css/app.css')
<?php
$viteString = ob_get_contents();
$publicPath = str_replace(env('APP_URL'),"/var/www/aso/public",$viteString);
echo $publicPath;
ob_end_clean();
?>
{{----}}
{{-- <link rel="stylesheet" href="/var/www/html/aso/public/build/assets/app-179954eb.css"> --}}
<style>
/* @font-face {
font-family: Public Sans;
src: url('{{asset('fonts/PublicSans-Medium.ttf')}}');
src: url('{{asset('fonts/PublicSans-Medium.ttf')}}') format('truetype');
} */
@page {
size: A4;
margin: 0;
}
html, body {
width: 210mm;
height: 297mm;
font-size: 12px !important;
}
@media print {
html, body {
width: 210mm;
height: 297mm;
}
/* ... the rest of the rules ... */
}
body {
font-family: 'Public Sans';
color: #404040;
font-size: 20px;
}
td {
padding: 3px;
vertical-align: top;
}
#member-detail{
}
#member-detail td {
width: 50%;
padding: 10px 0px;
}
#member-detail td>div{
margin-bottom: 5px;
}
.benefit-table-wrapper {
border: 1px solid #E0E0E0;
border-radius: 5px;
overflow: hidden;
}
#benefit-table {
width: 100%;
border-collapse: collapse;
}
#benefit-table th, #benefit-table th {
width: 50%;
}
#benefit-table th{
font-size: 20px;
font-weight: 400;
padding: 15px;
text-align: left;
}
#benefit-table tr:first-child {
background: #F5F5F5;
border-bottom: 1px solid #E0E0E0;
}
#benefit-table td {
padding: 15px;
font-size: 20px;
}
</style>
</head>
<body>
<table style="width: 100%">
<tr><td colspan="99" style="text-align: center">SURAT JAMINAN AKHIR</td></tr>
<tr>
<td style="width: 25%">Kepada</td>
<td style="width: 25%">: {{ $hospital->name }}</td>
<td style="width: 25%">GOP Tanggal</td>
<td style="width: 25%">: {{ $claim->created_at->format('d-M-y, H:i') }}</td>
</tr>
<tr>
<td>Alamat</td>
<td>: {{ $hospital->currentAddress->text ?? '' }}</td>
<td style="width: 25%">GOP Nomor</td>
<td style="width: 25%">: {{ $claim->code }}</td>
</tr>
<tr>
<td>No Telpon / Fax</td>
<td>: </td>
</tr>
<tr>
<td>Email</td>
<td>: </td>
</tr>
</table>
<p>Dengan ini jaminan diberikan kepada pasien yang juga meruopakan tertanggung/peserta yang diasuransikan "Pasien" dengan data sebagai berikut</p>
<table style="width: 100%">
<tr><td colspan="99" style="background: red; padding-left: 30px; color: white">A. Identitas Pasien</td></tr>
<tr>
<td style="width: 25%">1. Nama Pasien</td>
<td style="width: 25%">: {{ $member->full_name }}</td>
<td style="width: 25%">7. Hak Kelas Kamar</td>
<td style="width: 25%">: {{ $inpatienBenefit->room_class_coverage ?? '' }}</td>
</tr>
<tr>
<td>2. Tanggal Lahir</td>
<td>: {{ $member->birth_date }}</td>
<td>8. Hak Kamar ICU</td>
<td>: </td>
</tr>
<tr>
<td>3. Jenis Kelamin</td>
<td>: {{ ($member->gender ?
($member->gender == 'female' ? 'Perempuan'
: ($gender->gender == 'male' ? 'Laki-Laki'
: $member->gender)
) : '') }}</td>
<td>9. No Polis</td>
<td>: {{ $member->currentPolicy->code }}</td>
</tr>
<tr>
<td>4. Nomor e-KTP</td>
<td>: {{ $member->nric }}</td>
<td>10. Nama PH / Perusahaan</td>
<td>: {{ $member->currentCorporate->name }}</td>
</tr>
<tr>
<td>5. Manfaat</td>
<td>: {{ $claim->claimRequest->service->name }}</td>
<td>11. Periode Polis</td>
<td>: {{ Carbon\Carbon::parse($member->currentPolicy->end)->format('d-M-Y') }}</td>
</tr>
<tr>
<td>6. Status Polis</td>
<td>: {{ $member->currentPolicy->status }}</td>
<td>12. Mata Uang</td>
<td>: {{ $member->currency ?? 'IDR' }}</td>
</tr>
<tr><td colspan="99" style="background: red; padding-left: 30px; color: white">B. Informasi Perawatan</td></tr>
<tr>
<td style="width: 25%">1. Tanggal Masuk</td>
<td style="width: 25%">: {{ '' }}</td>
<td style="width: 25%">7. Lama Perawatan</td>
<td style="width: 25%">: {{ '' }}</td>
</tr>
<tr>
<td>2. Tanggal Keluar</td>
<td>: {{ '' }}</td>
<td>8. Kamar Perawatan</td>
<td>: </td>
</tr>
<tr>
<td>3. Nama Rumah Sakit</td>
<td>: {{ $hospital->name }}</td>
<td>9. Jumlah Tempat Tidur</td>
<td>: {{ '' }}</td>
</tr>
<tr>
<td>4. Dokter yang Merawat</td>
<td>: {{ '' }}</td>
<td>10. Estimasi Biaya Rawat Inap</td>
<td>: {{ '' }}</td>
</tr>
<tr>
<td>5. No. Rekam Medis</td>
<td>: {{ '' }}</td>
<td>11. Diagnosa</td>
<td>: {{ $claim->diagnosis->icd->code }}/{{ $claim->diagnosis->icd->name }}</td>
</tr>
<tr><td colspan="99" style="background: red; padding-left: 30px; color: white">C. Nilai Jaminan</td></tr>
<tr>
<td colspan="99">
<table style="width: 100%">
<tr>
<th>Manfaat Polis</th>
<th>Biaya Diajukan</th>
<th>Biaya Dijamin</th>
<th>Biaya Tidak Dijamin</th>
</tr>
@foreach ($claim->items as $item)
<tr>
<td style="text-align:left">{{ $item->claim_itemable->description }}</td>
<td style="text-align:center">{{ Helper::currencyIdrFormat($item->nominal_ditagihkan)}}</td>
<td style="text-align:center">{{ Helper::currencyIdrFormat($item->nominal_dicover) }}</td>
<td style="text-align:center">{{ Helper::currencyIdrFormat($item->nominal_ditagihkan - $item->nominal_dicover) }}</td>
</tr>
@endforeach
</table>
<p>Tidak Dijamin : Full Cover</p>
<p>* Bila pasien menempati kamar perawatan di atas manfaat yang imiliki maka pasien wajib membayar selisih yang timbul dan biaya yang tidak dijamin setelah menjalani perawatan Rumah Sakit</p>
</td>
</tr>
<tr><td colspan="99" style="background: red; padding-left: 30px; color: white">D. Otorisasi Surat Jaminan</td></tr>
<tr><td colspan="99">Surat Jaminan ini diotorisasi oleh PMN</td></tr>
<tr>
<td colspan="99">
<table style="width: 100%;">
<tr>
<td style="max-width: {{1/3}}%; overflow: visible; text-align: center">
Hormat Kami
<br>
<br>
<br>
<br>
<br>
(PRUMedical Network)
</td>
<td style="max-width: {{1/3}}%; overflow: visible; text-align: center">
Staff Administrasi Rumah Sakit
<br>
<br>
<br>
<br>
<br>
(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)
</td>
<td style="max-width: {{1/3}}%; overflow: visible; text-align: center">
PH/Pasien/Keluarga
<br>
<br>
<br>
<br>
<br>
({{ $member->full_name }})
</td>
</tr>
</table>
</td>
</tr>
</table>
<div>
<p><strong>*) Surat ini tidak memerlukan tanda tangan karena dicetak secara komputerisasi</strong></p>
</div>
<div style="width: 100%; text-align: right; font-size: 10px; color: #777; margin-top: 20px;"><span style="padding: 15px;">Generated by Primecenter Linksehat at {{ now() }}</span></div>
</body>
</html>

11
tailwind.config.js Normal file
View File

@@ -0,0 +1,11 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./resources/**/*.blade.php",
"./resources/**/*.js",
],
theme: {
extend: {},
},
plugins: [],
}

14
vite.config.js Normal file
View File

@@ -0,0 +1,14 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: [
'resources/js/app.js',
'resources/css/app.css'
],
refresh: true,
}),
],
});