From 62d5dce772996138be7fdcf66b0a3254444f9345 Mon Sep 17 00:00:00 2001 From: Muhammad Fajar Date: Sun, 14 Jan 2024 11:35:44 +0700 Subject: [PATCH] [Clien Portal] Alarm Center - Service Monitoring --- .../Api/CorporateMemberController.php | 44 +- .../AlarmCenter/DataServiceMonitoring.php | 130 +-- app/Models/Member.php | 28 +- app/Models/RequestLog.php | 5 - app/Models/RequestLogBenefit.php | 2 +- app/Models/RequestLogDailyMonitoring.php | 10 + app/Models/RequestLogMedicalPlan.php | 2 + app/Providers/AppServiceProvider.php | 6 +- .../pages/AlarmCenter/ServiceMonitoring.tsx | 927 +++++++++++------- 9 files changed, 698 insertions(+), 456 deletions(-) diff --git a/Modules/Client/Http/Controllers/Api/CorporateMemberController.php b/Modules/Client/Http/Controllers/Api/CorporateMemberController.php index 82ab4529..cfc54a63 100644 --- a/Modules/Client/Http/Controllers/Api/CorporateMemberController.php +++ b/Modules/Client/Http/Controllers/Api/CorporateMemberController.php @@ -201,15 +201,45 @@ class CorporateMemberController extends Controller public function serviceMonitoring(int $corporate_id, int $request_log_id) { - // $data = Claim::where('id', $claim_id)->first(); - - // return $request_log_id; - $data = RequestLog::query() - ->with(['member' => ['currentCorporate', 'person'], 'organization', 'requestLogBenefits' => ['benefit'], 'requestLogDailyMonitorings' => ['requestLogMedicalPlans'],]) - ->find($request_log_id); + ->with([ + 'member:id,member_id,person_id,birth_date,email,name_prefix,name,name_suffix' => [ + 'currentCorporate', + 'person:id,email,name_prefix,name,name_suffix,phone' + ], + 'organization:id,name', + 'requestLogBenefits:id,request_log_id,benefit_id,amount_incurred,amount_approved,amount_not_approved,excess_paid,keterangan' => [ + 'benefit' + ], + 'requestLogDailyMonitorings:id,request_log_id,created_at,subject,body_temperature,sistole,diastole,respiration_rate,analysis,lab_date,provider,examination' => [ + 'requestLogMedicalPlans:request_log_daily_monitoring_id,plan,type' + ], + 'service:code,name', + ]) + ->find($request_log_id, ['id', 'submission_date', 'discharge_date', 'member_id', 'service_code', 'organization_id']); + + $dataBenefit = []; + if (count($data->requestLogBenefits) > 0) { + $totalIncurred = 0; + $totalApprove = 0; + $totalNotApporve = 0; + $totalExcess = 0; + + foreach ($data->requestLogBenefits as $itemBenefit) { + $totalIncurred += $itemBenefit->amount_incurred; + $totalApprove += $itemBenefit->amount_approved; + $totalNotApporve += $itemBenefit->amount_not_approved; + $totalExcess += $itemBenefit->excess_paid; + } + + $dataBenefit['totalIncurred'] = $totalIncurred; + $dataBenefit['totalApprove'] = $totalApprove; + $dataBenefit['totalNotApprove'] = $totalNotApporve; + $dataBenefit['totalExcess'] = $totalExcess; + } + + $data->benefitTotal = $dataBenefit; - // return $data; return Helper::responseJson(DataServiceMonitoring::make($data)); } } diff --git a/Modules/Client/Transformers/AlarmCenter/DataServiceMonitoring.php b/Modules/Client/Transformers/AlarmCenter/DataServiceMonitoring.php index b43ee94a..30bbf193 100644 --- a/Modules/Client/Transformers/AlarmCenter/DataServiceMonitoring.php +++ b/Modules/Client/Transformers/AlarmCenter/DataServiceMonitoring.php @@ -2,9 +2,8 @@ namespace Modules\Client\Transformers\AlarmCenter; -use App\Helpers\Helper; -use App\Models\Service; use Illuminate\Http\Resources\Json\JsonResource; +use Illuminate\Support\Carbon; class DataServiceMonitoring extends JsonResource { @@ -16,70 +15,89 @@ class DataServiceMonitoring extends JsonResource */ public function toArray($request) { - $serviceData = Service::where('code', $this->service_code)->first(); - if ($serviceData) { - $serviceName = $serviceData->name; - } else { - $serviceName = $this->service_cod; - } - - $itemBenefits = $this->requestLogBenefits; - $dataBenefit = []; - if (count($itemBenefits)> 0){ - $totalIncurred = 0; - $totalApprove = 0; - $totalNotApporve = 0; - $totalExcess = 0; - foreach($itemBenefits as $itemBenefit){ - $totalIncurred += $itemBenefit->amount_incurred; - $totalApprove += $itemBenefit->amount_approved; - $totalNotApporve += $itemBenefit->amount_not_approved; - $totalExcess += $itemBenefit->excess_paid; - - } - // array_push($dataBenefit, $itemBenefits); - - $dataBenefit['total_incurred'] = $totalIncurred; - $dataBenefit['total_approve'] = $totalApprove; - $dataBenefit['total_not_approve'] = $totalNotApporve; - $dataBenefit['total_excess'] = $totalExcess; - - } - return [ 'companyName' => $this->member->currentCorporate->name ?? null, + 'serviceCode' => $this->service_code ?? null, 'memberId' => $this->member->member_id ?? null, 'fullName' => $this->member->full_name ?? null, 'dateOfBirth' => $this->member->birth_date ?? null, - 'dateOfBirth' => $this->member->birth_date ?? null, 'phoneNumber' => $this->person->phone ?? null, 'email' => $this->member->email ?? ($this->member->person->email ?? null), - 'serviceName' => $serviceName, - 'benefitName' => $this->requestLogBenefit->benefit->description ?? null, - 'benefit' => $itemBenefits ?? null, - 'benefitTotal' => $dataBenefit ?? null, + 'serviceName' => $this->service->name ?? ($this->service_code ?? null), + 'benefits' => collect($this->requestLogBenefits)->map(function ($requestLogBenefit) { + return [ + 'amountIncurred' => $requestLogBenefit->amount_incurred, + 'amountApproved' => $requestLogBenefit->amount_approved, + 'amountNotAprroved' => $requestLogBenefit->amount_not_approved, + 'excessPaid' => $requestLogBenefit->excess_paid, + 'description' => $requestLogBenefit->keterangan, + 'name' => $requestLogBenefit->benefit->description, + ]; + })->all() ?? null, + 'benefitTotal' => $this->benefitTotal ?? null, 'hospital' => $this->organization->name ?? null, 'admissionDate' => $this->submission_date ?? null, 'dischargeDate' => $this->discharge_date ?? null, - 'dailyMonitorings' => $this->when($this->service_code === 'IP', collect($this->requesLogDailyMonitorings)->map(function ($requesLogDailyMonitoring) { - return [ - 'date' => Helper::formatDateOnly($requesLogDailyMonitoring->created_at) ?? null, - 'time' => Helper::formatTimeOnly($requesLogDailyMonitoring->created_at) ?? null, - 'status' => 'Done' ?? null, - 'subject' => $requesLogDailyMonitoring->subject ?? null, - 'bodyTemperature' => $requesLogDailyMonitoring->body_temperature ?? null, - 'sistole' => $requesLogDailyMonitoring->sistole . 'mm[Hg]' ?? null, - 'diastole' => $requesLogDailyMonitoring->diastole . 'mm[Hg]' ?? null, - 'respirationRate' => $requesLogDailyMonitoring->respiration_rate . '/min' ?? null, - 'analysis' => $requesLogDailyMonitoring->analysis ?? null, - 'plan' => collect($requesLogDailyMonitoring->requestLogMedicalPlans)->map(function ($requestLogMedicalPlan) { - return $requestLogMedicalPlan->type == 1 ? $requestLogMedicalPlan->plan : null; - })->all(), - ]; - })->all()), - // 'laboratoriumResults' => collect($this->dailyMonitorings)->map(function ($dailyMonitoring) { - // $data['date'][Helper::formatDateOnly($dailyMonitoring->created_at)] - // })->all() ?? null + 'dailyMonitorings' => $this->when($this->service_code === 'IP', collect($this->requestLogDailyMonitorings) + ->groupBy(function ($requestLogDailyMonitoring) { + return $requestLogDailyMonitoring->created_at->format('d M Y'); + }) + ->map(function ($groupedItems) { + return collect($groupedItems) + ->map(function ($requestLogDailyMonitoring) { + return [ + 'time' => $requestLogDailyMonitoring->created_at->format('H:i') ?? null, + 'status' => 'Done' ?? null, + 'subject' => $requestLogDailyMonitoring->subject ?? null, + 'bodyTemperature' => $requestLogDailyMonitoring->body_temperature ?? null, + 'sistole' => $requestLogDailyMonitoring->sistole . 'mm[Hg]' ?? null, + 'diastole' => $requestLogDailyMonitoring->diastole . 'mm[Hg]' ?? null, + 'respirationRate' => $requestLogDailyMonitoring->respiration_rate . '/min' ?? null, + 'analysis' => $requestLogDailyMonitoring->analysis ?? null, + 'complaints' => $requestLogDailyMonitoring->complaints ?? null, + 'plans' => $this->when($requestLogDailyMonitoring->requestLogMedicalPlans, collect($requestLogDailyMonitoring->requestLogMedicalPlans) + ->map(function ($requestLogMedicalPlan) { + return [ + 'type' => $requestLogMedicalPlan->type, + 'plan' => $requestLogMedicalPlan->plan + ]; + }) + ->sortBy('type') + ->all()) ?? null, + ]; + }) + ->sortByDesc(function ($item) { + return $item['time']; + }) + ->values(); + }) + ->sortByDesc(function ($groupedItems, $date) { + return Carbon::createFromFormat('d M Y', $date)->format('Y-m-d'); + }) + ->all()) ?? null, + 'laboratoriumResults' => $this->whenLoaded('requestLogDailyMonitorings', collect($this->requestLogDailyMonitorings) + ->groupBy(function ($requestLogDailyMonitoring) { + return Carbon::parse($requestLogDailyMonitoring->lab_date)->format('d M Y'); + }) + ->map(function ($groupedItems) { + return collect($groupedItems) + ->map(function ($requestLogDailyMonitoring) { + return [ + 'code' => $requestLogDailyMonitoring->code, + 'date' => Carbon::parse($requestLogDailyMonitoring->lab_date)->format('d M Y') ?? null, + 'examination' => $requestLogDailyMonitoring->examination ?? null, + 'location' => $requestLogDailyMonitoring->provider ?? null, + ]; + }) + ->sortByDesc(function ($item) { + return $item['code']; + }) + ->values(); + }) + ->sortByDesc(function ($groupedItems, $date) { + return Carbon::createFromFormat('d M Y', $date)->format('Y-m-d'); + }) + ->all()) ?? null ]; } } diff --git a/app/Models/Member.php b/app/Models/Member.php index f6c347ce..9062f38c 100644 --- a/app/Models/Member.php +++ b/app/Models/Member.php @@ -394,22 +394,22 @@ class Member extends Model // ); // } - protected function corporateLogo(): Attribute - { - $avatar = null; + // protected function corporateLogo(): Attribute + // { + // $avatar = null; - if ($this->relationLoaded('currentPolicy')) { - $corporateId = $this->currentPolicy->corporate->id; - $avatar = File::where(['type' => 'avatar', 'fileable_id' => $corporateId]) - ->orderBy('id', 'desc') - ->first(); - } + // if ($this->relationLoaded('currentPolicy')) { + // $corporateId = $this->currentPolicy->corporate->id; + // $avatar = File::where(['type' => 'avatar', 'fileable_id' => $corporateId]) + // ->orderBy('id', 'desc') + // ->first(); + // } - $path = $avatar ? $_ENV['LMS_APP_STORAGE'] . $avatar->path : ''; + // $path = $avatar ? $_ENV['LMS_APP_STORAGE'] . $avatar->path : ''; - return Attribute::make( - get: fn () => $path - ); - } + // return Attribute::make( + // get: fn () => $path + // ); + // } /* -------------------------------------------------------------------------- */ } diff --git a/app/Models/RequestLog.php b/app/Models/RequestLog.php index b3dc56d7..e567d34f 100644 --- a/app/Models/RequestLog.php +++ b/app/Models/RequestLog.php @@ -241,11 +241,6 @@ class RequestLog extends Model return $this->belongsTo(Service::class, 'service_code', 'code'); } - public function requestLogBenefit() - { - return $this->hasOne(RequestLogBenefit::class, 'request_log_id'); - } - public function requestLogBenefits() { return $this->hasMany(RequestLogBenefit::class, 'request_log_id'); diff --git a/app/Models/RequestLogBenefit.php b/app/Models/RequestLogBenefit.php index 2fe837bc..e0b4c7aa 100644 --- a/app/Models/RequestLogBenefit.php +++ b/app/Models/RequestLogBenefit.php @@ -31,6 +31,6 @@ class RequestLogBenefit extends Model public function requestLog() { - return $this->belongsTo(RequestLog::class, 'aa'); + return $this->belongsTo(RequestLog::class); } } diff --git a/app/Models/RequestLogDailyMonitoring.php b/app/Models/RequestLogDailyMonitoring.php index 84f818cf..2eacfb50 100644 --- a/app/Models/RequestLogDailyMonitoring.php +++ b/app/Models/RequestLogDailyMonitoring.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -18,4 +19,13 @@ class RequestLogDailyMonitoring extends Model { return $this->hasMany(RequestLogMedicalPlan::class); } + + /* -------------------------------------------------------------------------- */ + + protected function code(): Attribute + { + return Attribute::make( + get: fn ($value, $attributes) => 'RE-' . str_pad($attributes['id'], 3, '0', STR_PAD_LEFT), + ); + } } diff --git a/app/Models/RequestLogMedicalPlan.php b/app/Models/RequestLogMedicalPlan.php index 4a0a6508..5ab25a9d 100644 --- a/app/Models/RequestLogMedicalPlan.php +++ b/app/Models/RequestLogMedicalPlan.php @@ -9,6 +9,8 @@ class RequestLogMedicalPlan extends Model { use HasFactory; + protected $table = 'request_log_medical_plan'; + public function requestLogDailyMonitoring() { return $this->belongsTo(RequestLogDailyMonitoring::class); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index abebd0f1..0b675b83 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -48,7 +48,7 @@ class AppServiceProvider extends ServiceProvider { Schema::defaultStringLength(191); - Str::macro('initials', fn($value, $sep = ' ', $glue = '') => trim(collect(explode($sep, $value))->map(function ($segment) { + Str::macro('initials', fn ($value, $sep = ' ', $glue = '') => trim(collect(explode($sep, $value))->map(function ($segment) { return $segment[0] ?? ''; })->join($glue))); @@ -87,7 +87,7 @@ class AppServiceProvider extends ServiceProvider //Hospital CorporateHospital::updated(function ($model) { - + $this->logAuditTrail($model, 'updated'); }); @@ -179,8 +179,6 @@ class AppServiceProvider extends ServiceProvider }); Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class); - - } private function logAuditTrail($model, $action) diff --git a/frontend/client-portal/src/pages/AlarmCenter/ServiceMonitoring.tsx b/frontend/client-portal/src/pages/AlarmCenter/ServiceMonitoring.tsx index f1d4597a..900bd811 100644 --- a/frontend/client-portal/src/pages/AlarmCenter/ServiceMonitoring.tsx +++ b/frontend/client-portal/src/pages/AlarmCenter/ServiceMonitoring.tsx @@ -14,9 +14,15 @@ import { TableRow, MenuItem, Skeleton, + List, + ListSubheader, + ListItem, + ListItemText, + ListItemButton, + Divider, } from '@mui/material'; import { styled } from '@mui/material/styles'; -import DownloadIcon from '@mui/icons-material/Download'; +import { Download as DownloadIcon, Circle as CircleIcon } from '@mui/icons-material'; // components import Page from '../../components/Page'; // utils @@ -55,11 +61,7 @@ function TabPanel(props: TabPanelProps) { aria-labelledby={`simple-tab-${index}`} {...other} > - {value === index && ( - - {children} - - )} + {value === index && children} ); } @@ -115,6 +117,7 @@ const StyledTab = styled((props: StyledTabProps) => + >; + laboratoriumResults: Record< + string, + Array<{ + code: string; + date: string; + examination: string; + location: string; + }> + >; }; export default function ServiceMonitoring() { const navigate = useNavigate(); + const controller = new AbortController(); const [value, setValue] = useState(0); + const [loading, setLoading] = useState(false); const handleChange = (event: SyntheticEvent, newValue: number) => { setValue(newValue); }; @@ -146,26 +185,35 @@ export default function ServiceMonitoring() { useEffect(() => { (async () => { - const response = await axios.get(`${corporateValue}/service-monitoring/${requestLogId}`); - setData(response.data.data); - })(); - }, [corporateValue]); + try { + setLoading(true); - function handleDownloadClick(fileUrl: string) { - const tempLink = document.createElement('a'); - tempLink.href = fileUrl; - tempLink.setAttribute('download', 'nama-file-yang-diunduh.pdf'); // Ganti 'nama-file-yang-diunduh.pdf' sesuai kebutuhan - tempLink.style.display = 'none'; - document.body.appendChild(tempLink); - tempLink.click(); - document.body.removeChild(tempLink); - } + const response = await axios.get(`${corporateValue}/service-monitoring/${requestLogId}`, { + signal: controller.signal, + }); + + setData(response.data.data); + + if (response.data.data.serviceCode !== 'IP') { + setValue(1); + } + } catch (error: any) { + console.error('Error fetching data:', error.message); + } finally { + setLoading(false); + } + })(); + + return () => { + controller.abort(); + }; + }, [corporateValue]); return ( - + navigate(`/alarm-center/member/${memberId}}`)} sx={{ cursor: 'pointer' }} @@ -182,26 +230,24 @@ export default function ServiceMonitoring() { - {data ? 'Employee Profile' : } + {loading ? : 'Employee Profile'} - {data ? 'Company Name' : } + {loading ? : 'Company Name'} - {data ? ( - data.companyName ? ( - data.companyName - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.companyName ? ( + data.companyName + ) : ( + '-' )} @@ -209,19 +255,17 @@ export default function ServiceMonitoring() { - {data ? 'Member ID' : } + {loading ? : 'Member ID'} - {data ? ( - data.memberId ? ( - data.memberId - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.memberId ? ( + data.memberId + ) : ( + '-' )} @@ -229,19 +273,17 @@ export default function ServiceMonitoring() { - {data ? 'Full Name' : } + {loading ? : 'Full Name'} - {data ? ( - data.fullName ? ( - data.fullName - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.fullName ? ( + data.fullName + ) : ( + '-' )} @@ -249,19 +291,17 @@ export default function ServiceMonitoring() { - {data ? 'Date of Birth' : } + {loading ? : 'Date of Birth'} - {data ? ( - data.dateOfBirth ? ( - fDateBirth(data.dateOfBirth) - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.dateOfBirth ? ( + fDateBirth(data.dateOfBirth) + ) : ( + '-' )} @@ -269,19 +309,17 @@ export default function ServiceMonitoring() { - {data ? 'Phone Number' : } + {loading ? : 'Phone Number'} - {data ? ( - data.phoneNumber ? ( - data.phoneNumber - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.phoneNumber ? ( + data.phoneNumber + ) : ( + '-' )} @@ -289,19 +327,17 @@ export default function ServiceMonitoring() { - {data ? 'Date of Birth' : } + {loading ? : 'Email'} - {data ? ( - data.email ? ( - data.email - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.email ? ( + data.email + ) : ( + '-' )} @@ -311,31 +347,29 @@ export default function ServiceMonitoring() { - + - {data ? 'Diagnose Summary' : } + {loading ? : 'Diagnose Summary'} - {data ? 'Symptoms' : } + {loading ? : 'Symptoms'} - {data ? ( - data.symptoms ? ( - data.symptoms - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.symptoms ? ( + data.symptoms + ) : ( + '-' )} @@ -343,19 +377,17 @@ export default function ServiceMonitoring() { - {data ? 'Sign' : } + {loading ? : 'Sign'} - {data ? ( - data.sign ? ( - data.sign - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.sign ? ( + data.sign + ) : ( + '-' )} @@ -363,19 +395,17 @@ export default function ServiceMonitoring() { - {data ? 'Main Diagnose' : } + {loading ? : 'Main Diagnose'} - {data ? ( - data.mainDiagnose ? ( - data.mainDiagnose - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.mainDiagnose ? ( + data.mainDiagnose + ) : ( + '-' )} @@ -383,23 +413,21 @@ export default function ServiceMonitoring() { - {data ? ( - 'Comparative Diagnosis' - ) : ( + {loading ? ( + ) : ( + 'Comparative Diagnosis' )} - {data ? ( - data.comparativeDiagnosis ? ( - data.comparativeDiagnosis - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.comparativeDiagnosis ? ( + data.comparativeDiagnosis + ) : ( + '-' )} @@ -408,31 +436,154 @@ export default function ServiceMonitoring() { - + - {data ? 'Services' : } + {loading ? : 'Services'} - {data ? 'Service Name' : } + {loading ? : 'Service Name'} - {data ? ( - data.serviceName ? ( - data.serviceName - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.serviceName ? ( + data.serviceName + ) : ( + '-' + )} + + + + + + + {loading ? : 'Benefits'} + + + + + {loading ? ( + + ) : data && data.benefits && data.benefits.length > 0 ? ( + data.benefits.map((benefitValue, benefitIndex) => ( + + + {benefitIndex + 1 + `. ` + benefitValue.name} + + + } + key={benefitIndex} + > + + + + + Amount Incurred : {benefitValue.amountApproved} + + + + + + + + Amount Approved : {benefitValue.amountApproved} + + + + + + + + Amount Not Approved : {benefitValue.amountNotAprroved} + + + + + + + + Excess Paid : {benefitValue.excessPaid} + + + + + + + + Description : {benefitValue.description} + + + + + )) + ) : ( + + - + + )} + + + + + + + {loading ? : 'Hospital'} + + + + + {loading ? ( + + ) : data && data.hospital ? ( + data.hospital + ) : ( + '-' )} @@ -440,19 +591,17 @@ export default function ServiceMonitoring() { - {data ? 'Benefit Name' : } + {loading ? : 'Admission Date'} - {data ? ( - data.benefitName ? ( - data.benefitName - ) : ( - '-' - ) - ) : ( + {loading ? ( + ) : data && data.admissionDate ? ( + fDateSuffix(data.admissionDate) + ) : ( + '-' )} @@ -460,59 +609,17 @@ export default function ServiceMonitoring() { - {data ? 'Hospital' : } + {loading ? : 'Discharge Date'} - {data ? ( - data.hospital ? ( - data.hospital - ) : ( - '-' - ) - ) : ( + {loading ? ( - )} - - - - - - - {data ? 'Admission Date' : } - - - - - {data ? ( - data.admissionDate ? ( - fDateSuffix(data.admissionDate) - ) : ( - '-' - ) + ) : data && data.dischargeDate ? ( + fDateSuffix(data.dischargeDate) ) : ( - - )} - - - - - - - {data ? 'Discharge Date' : } - - - - - {data ? ( - data.dischargeDate ? ( - fDateSuffix(data.dischargeDate) - ) : ( - '-' - ) - ) : ( - + '-' )} @@ -523,242 +630,324 @@ export default function ServiceMonitoring() { - - - - - - - - + {loading ? ( + - - - {/* {data?.dialy_monitoring.length > 0 ? ( - data?.dialy_monitoring.map((row, index) => ( - - - - - - - - {' '} - {row.date ? fDateSuffix(row.date) : '-'} - - - - - - -
- - - - Subject - {row.subject_title} - - - - - - Objektif - - - - - - Body Temperature - - - - - - {row.body_temperature} - - - - - - - - Sistole - - - - - {row.sistole} - - - - - - - Diastole - - - - - {row.diastole} - - - - - - - Respiration Rate - - - - - - {row.respiration_rate} - - - - - - - Analysis - - - - - - - {row.analisis_title} - - - - - - - Perencanaan - - - - - -
    - {row.Perencanaan.length > 0 ? ( - row.Perencanaan.map((r, index) => ( -
  • {r}
  • - )) - ) : ( -
  • -
  • - )} -
-
-
-
-
-
-
-
-
- )) - ) : ( - No Data Found - )} */} - No Data Found -
+ + + + + + + +
-
+
+ ) : ( + + + + + + + + + + {data && data.dailyMonitorings ? ( + + {data && + data.dailyMonitorings && + Object.keys(data.dailyMonitorings).length > 0 && + Object.keys(data.dailyMonitorings).map((date, dateIndex) => ( + + + + + + + + {date ? date : '-'} + + {data.dailyMonitorings[date].map( + (dailyMonitoring, dailyMonitoringIndex) => ( + + + + + + + + + + Subject + + {dailyMonitoring.subject + ? dailyMonitoring.subject + : '-'} + + + + + + + Objektif + + + + + + + Body Temperature + + + + + + + {dailyMonitoring.bodyTemperature + ? dailyMonitoring.bodyTemperature + : '-'} + + + + + + + + Sistole + + + + + + {dailyMonitoring.sistole + ? dailyMonitoring.sistole + : '-'} + + + + + + + + Diastole + + + + + + {dailyMonitoring.diastole + ? dailyMonitoring.diastole + : '-'} + + + + + + + + + Respiration Rate + + + + + + + {dailyMonitoring.respirationRate + ? dailyMonitoring.respirationRate + : '-'} + + + + + + + + Complaints + + + + + + {dailyMonitoring.complaints + ? dailyMonitoring.complaints + : '-'} + + + + + + + Analysis + + + + + + + {dailyMonitoring.analysis + ? dailyMonitoring.analysis + : '-'} + + + + + + + Perencanaan + + + + + + {data.dailyMonitorings ? ( +
    + {dailyMonitoring.plans.length > 0 && + dailyMonitoring.plans.map((plan, planIndex) => ( +
  • {plan.plan}
  • + ))} +
+ ) : ( + '-' + )} +
+
+
+
+
+
+ ) + )} +
+
+ ))} +
+ ) : ( + + No Data Found + + )} +
+
- - - - {/* {data?.laboratorium_result.length > 0 ? ( - data?.laboratorium_result.map((row, index) => ( - - - - {row[index]?.datetime ? fDateSuffix(row[index].datetime) : ''} - - {row.length > 0 ? ( - row.map((list, i) => ( - - + + + {data && + data.laboratoriumResults && + Object.keys(data.laboratoriumResults).length > 0 ? ( + Object.keys(data.dailyMonitorings).map((date, dateIndex) => ( + + + {date ? date : '-'} + {data.laboratoriumResults[date].map( + (laboratoriumResult, laboratoriumResultIndex) => ( + + Date Examination Location - + {/* */} - {list.examination} - {list.location} - + {laboratoriumResult.examination + ? laboratoriumResult.examination + : '-'} + + + {laboratoriumResult.location + ? laboratoriumResult.location + : '-'} + + {/* handleDownloadClick(list.file)} + onClick={() => handleDownloadClick(laboratoriumResult.file)} > Download } - /> + /> */}
- )) - ) : ( - Data Not Found + ) )}
)) ) : ( Data Not Found - )} */} - Data Not Found + )}
-
-
-
+ +
+ )}