Update improvement client portal daily monitoring
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Modules\Client\Transformers\AlarmCenter;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Models\Icd;
|
||||
use DB;
|
||||
|
||||
class DataServiceMonitoring extends JsonResource
|
||||
{
|
||||
@@ -22,17 +23,22 @@ class DataServiceMonitoring extends JsonResource
|
||||
$filesFinalLogKondisi = [];
|
||||
if (count($this->files)>0){
|
||||
foreach ($this->files as $key => $value) {
|
||||
if($value->type == 'final-log-result'){
|
||||
/*
|
||||
Sementara di buat satu dulu, jangan di hapus..
|
||||
karena suka labil client nya, tiba2 hide tiba2 munculin fitur :D
|
||||
*/
|
||||
|
||||
// if($value->type == 'final-log-result'){
|
||||
array_push($filesFinalLogResult, $value);
|
||||
};
|
||||
// };
|
||||
|
||||
if($value->type == 'final-log-diagnosis'){
|
||||
array_push($filesFinalLogDiagnosis, $value);
|
||||
}
|
||||
// if($value->type == 'final-log-diagnosis'){
|
||||
// array_push($filesFinalLogDiagnosis, $value);
|
||||
// }
|
||||
|
||||
if($value->type == 'final-log-kondisi'){
|
||||
array_push($filesFinalLogKondisi, $value);
|
||||
}
|
||||
// if($value->type == 'final-log-kondisi'){
|
||||
// array_push($filesFinalLogKondisi, $value);
|
||||
// }
|
||||
}
|
||||
|
||||
$files = [
|
||||
@@ -77,7 +83,6 @@ class DataServiceMonitoring extends JsonResource
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'companyName' => $this->member->currentCorporate->name ?? null,
|
||||
'serviceCode' => $this->service_code ?? null,
|
||||
@@ -111,6 +116,23 @@ class DataServiceMonitoring extends JsonResource
|
||||
->map(function ($groupedItems) {
|
||||
return collect($groupedItems)
|
||||
->map(function ($requestLogDailyMonitoring) {
|
||||
$arr_document = [];
|
||||
$document = DB::table('files')
|
||||
->where(['fileable_type' => 'App\Models\LaboratoriumResult', 'fileable_id' => $requestLogDailyMonitoring->id])
|
||||
->whereIn('type', ['medical-action-letter', 'confirmation-medical-letter'])
|
||||
->get();
|
||||
if ($document){
|
||||
foreach($document as $d){
|
||||
$arr_document[]= [
|
||||
'path' => env('APP_URL') . '/storage/lab_result/' . $d->original_name,
|
||||
'type' => $d->type,
|
||||
'original_name' => $d->original_name,
|
||||
'name' => $d->name,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return [
|
||||
'time' => $requestLogDailyMonitoring->created_at->format('H:i') ?? null,
|
||||
'status' => 'Done' ?? null,
|
||||
@@ -130,6 +152,7 @@ class DataServiceMonitoring extends JsonResource
|
||||
})
|
||||
->sortBy('type')
|
||||
->all()) ?? null,
|
||||
'files' => $arr_document
|
||||
];
|
||||
})
|
||||
->sortByDesc(function ($item) {
|
||||
@@ -148,11 +171,27 @@ class DataServiceMonitoring extends JsonResource
|
||||
->map(function ($groupedItems) {
|
||||
return collect($groupedItems)
|
||||
->map(function ($requestLogDailyMonitoring) {
|
||||
$arr_document = [];
|
||||
$document = DB::table('files')
|
||||
->where(['fileable_type' => 'App\Models\LaboratoriumResult', 'fileable_id' => $requestLogDailyMonitoring->id])
|
||||
->whereIn('type', ['laboratorium-result'])
|
||||
->get();
|
||||
if ($document){
|
||||
foreach($document as $d){
|
||||
$arr_document[]= [
|
||||
'path' => env('APP_URL') . '/storage/lab_result/' . $d->original_name,
|
||||
'type' => $d->type,
|
||||
'original_name' => $d->original_name,
|
||||
'name' => $d->name,
|
||||
];
|
||||
}
|
||||
}
|
||||
return [
|
||||
'code' => $requestLogDailyMonitoring->code,
|
||||
'date' => Carbon::parse($requestLogDailyMonitoring->lab_date)->format('d M Y') ?? null,
|
||||
'examination' => $requestLogDailyMonitoring->examination ?? null,
|
||||
'location' => $requestLogDailyMonitoring->provider ?? null,
|
||||
'files' => $arr_document
|
||||
];
|
||||
})
|
||||
->sortByDesc(function ($item) {
|
||||
|
||||
Reference in New Issue
Block a user