penyesuaian report livechat
This commit is contained in:
@@ -74,8 +74,8 @@ class LivechatController extends Controller
|
|||||||
return $this->exportMonthly($startDate, $endDate);
|
return $this->exportMonthly($startDate, $endDate);
|
||||||
} else {
|
} else {
|
||||||
$liveChats = Livechat::with('userInsurance',
|
$liveChats = Livechat::with('userInsurance',
|
||||||
'user:nID,sFirstName,sLastName,sEmail,sPhone,nIDUser,nIDHubunganKeluarga',
|
'user:nID,sFirstName,sLastName,sEmail,sPhone,nIDUser,nIDHubunganKeluarga', 'user.detail:dTanggalLahir,nIDJenisKelamin',
|
||||||
'doctor:nID,nIDSpesialis,nIDUser', 'doctor.user:nID,sFirstName,sLastName',
|
'doctor:nID,nIDSpesialis,nIDUser', 'doctor.user:nID,sFirstName,sLastName',
|
||||||
'appointment:nID,sPaymentStatus,sPaymentMethod',
|
'appointment:nID,sPaymentStatus,sPaymentMethod',
|
||||||
'appointment.appointmentDetail:nID,nIDAppointment,dTanggalAppointment,tTimeAppointment',
|
'appointment.appointmentDetail:nID,nIDAppointment,dTanggalAppointment,tTimeAppointment',
|
||||||
'healthCare:nID,sHealthCare',
|
'healthCare:nID,sHealthCare',
|
||||||
@@ -164,6 +164,11 @@ class LivechatController extends Controller
|
|||||||
|
|
||||||
$startFrom = 3;
|
$startFrom = 3;
|
||||||
foreach ($liveChats as $indexLiveChat => $liveChat) {
|
foreach ($liveChats as $indexLiveChat => $liveChat) {
|
||||||
|
if ( $liveChat->user->nID == 109370 || $liveChat->nIDDokter == 100120) {
|
||||||
|
continue; // user testing / dokter testing
|
||||||
|
}
|
||||||
|
$summary = $liveChat->summary;
|
||||||
|
$user = $liveChat->user;
|
||||||
$phone = $liveChat->user->sPhone ?? '-';
|
$phone = $liveChat->user->sPhone ?? '-';
|
||||||
$status = $liveChat->sStatus;
|
$status = $liveChat->sStatus;
|
||||||
$nIDUser = $liveChat->user->nIDUser ?? 0; // Principal or Dependent
|
$nIDUser = $liveChat->user->nIDUser ?? 0; // Principal or Dependent
|
||||||
@@ -237,22 +242,31 @@ class LivechatController extends Controller
|
|||||||
$chatTime = $chatTimeDiff;
|
$chatTime = $chatTimeDiff;
|
||||||
|
|
||||||
|
|
||||||
|
// $diagnosa = '-';
|
||||||
|
// $diagnosaCode = '-';
|
||||||
|
// if($liveChat->summary){
|
||||||
|
// $diagnosis = explode(', ', $liveChat->summary->sAssessment);
|
||||||
|
|
||||||
|
// if ($diagnosis) {
|
||||||
|
// $diagnosaArray = [];
|
||||||
|
// $diagnosaCodeArray = [];
|
||||||
|
// foreach($diagnosis as $data){
|
||||||
|
// $diagnosaArray[] = Helper::diagnosisName($data); // Tambahkan diagnosis ke array
|
||||||
|
// $diagnosaCodeArray[] = $data; // Tambahkan diagnosis ke array
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma
|
||||||
|
// $diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
$diagnosa = '-';
|
$diagnosa = '-';
|
||||||
$diagnosaCode = '-';
|
$diagnosaCode = '-';
|
||||||
if($liveChat->summary){
|
if ($summary && $summary->sAssessment) {
|
||||||
$diagnosis = explode(', ', $liveChat->summary->sAssessment);
|
$diagnosisCodes = explode(', ', $summary->sAssessment);
|
||||||
|
$diagnosaArray = array_map(fn($code) => Helper::diagnosisName($code), $diagnosisCodes);
|
||||||
if ($diagnosis) {
|
$diagnosa = implode('; ', $diagnosaArray);
|
||||||
$diagnosaArray = [];
|
$diagnosaCode = implode('; ', $diagnosisCodes);
|
||||||
$diagnosaCodeArray = [];
|
|
||||||
foreach($diagnosis as $data){
|
|
||||||
$diagnosaArray[] = Helper::diagnosisName($data); // Tambahkan diagnosis ke array
|
|
||||||
$diagnosaCodeArray[] = $data; // Tambahkan diagnosis ke array
|
|
||||||
}
|
|
||||||
|
|
||||||
$diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma
|
|
||||||
$diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tebusResep = 'Belum Ditebus';
|
$tebusResep = 'Belum Ditebus';
|
||||||
@@ -283,23 +297,15 @@ class LivechatController extends Controller
|
|||||||
$tebusResep = '-';
|
$tebusResep = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($liveChat->user->nIDHubunganKeluarga) {
|
// switc
|
||||||
case 9:
|
|
||||||
$nIDHubunganKeluarga = "Peserta"; // Parent
|
$nIDHubunganKeluarga = match($user->nIDHubunganKeluarga) {
|
||||||
break;
|
9 => "Peserta",
|
||||||
case 4:
|
4 => "Istri",
|
||||||
$nIDHubunganKeluarga = 'Istri'; // Spouse
|
5 => "Anak",
|
||||||
break;
|
3 => "Suami",
|
||||||
case 5:
|
default => $user->relation->sHubunganKeluarga ?? '-'
|
||||||
$nIDHubunganKeluarga = 'Anak'; // Child
|
};
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
$nIDHubunganKeluarga = 'Suami'; // Husband
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$nIDHubunganKeluarga = '-'; // No need to set $nIDHubunganKeluarga as it's already set to default value
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($liveChat->user->relation && $nIDHubunganKeluarga == '-'){
|
if ($liveChat->user->relation && $nIDHubunganKeluarga == '-'){
|
||||||
$nIDHubunganKeluarga = $liveChat->user->relation->sHubunganKeluarga;
|
$nIDHubunganKeluarga = $liveChat->user->relation->sHubunganKeluarga;
|
||||||
@@ -397,7 +403,7 @@ class LivechatController extends Controller
|
|||||||
{
|
{
|
||||||
$liveChats = Livechat::with('userInsurance',
|
$liveChats = Livechat::with('userInsurance',
|
||||||
'user:nID,sFirstName,sLastName,sEmail,sPhone,nIDUser,nIDHubunganKeluarga',
|
'user:nID,sFirstName,sLastName,sEmail,sPhone,nIDUser,nIDHubunganKeluarga',
|
||||||
'doctor:nID,nIDSpesialis,nIDUser', 'doctor.user:nID,sFirstName,sLastName',
|
'doctor:nID,nIDSpesialis,nIDUser', 'doctor.user:nID,sFirstName,sLastName',
|
||||||
'appointment:nID,sPaymentStatus,sPaymentMethod',
|
'appointment:nID,sPaymentStatus,sPaymentMethod',
|
||||||
'appointment.appointmentDetail:nID,nIDAppointment,dTanggalAppointment,tTimeAppointment',
|
'appointment.appointmentDetail:nID,nIDAppointment,dTanggalAppointment,tTimeAppointment',
|
||||||
'healthCare:nID,sHealthCare',
|
'healthCare:nID,sHealthCare',
|
||||||
@@ -447,13 +453,14 @@ class LivechatController extends Controller
|
|||||||
['value' => 'Nama Dokter', 'cell' => 'V1', 'mergeCell' => false, 'mergeToCell' => ''],
|
['value' => 'Nama Dokter', 'cell' => 'V1', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||||
['value' => 'Jenis Dokter', 'cell' => 'W1', 'mergeCell' => false, 'mergeToCell' => ''],
|
['value' => 'Jenis Dokter', 'cell' => 'W1', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||||
['value' => 'Rujuk (Ya/Tidak)', 'cell' => 'X1', 'mergeCell' => false, 'mergeToCell' => ''],
|
['value' => 'Rujuk (Ya/Tidak)', 'cell' => 'X1', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||||
['value' => 'Poli', 'cell' => 'Y1', 'mergeCell' => false, 'mergeToCell' => ''],
|
['value' => 'Provider Rujukan', 'cell' => 'Y1', 'mergeCell' => true, 'mergeToCell' => ''],
|
||||||
['value' => 'Total', 'cell' => 'Z1', 'mergeCell' => false, 'mergeToCell' => ''],
|
['value' => 'Poli', 'cell' => 'Z1', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||||
['value' => 'Obat', 'cell' => 'AA1', 'mergeCell' => false, 'mergeToCell' => ''],
|
['value' => 'Total', 'cell' => 'AA1', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||||
['value' => 'Apotek', 'cell' => 'AB1', 'mergeCell' => false, 'mergeToCell' => ''],
|
['value' => 'Obat', 'cell' => 'AB1', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||||
['value' => 'Nama Obat', 'cell' => 'AC1', 'mergeCell' => false, 'mergeToCell' => ''],
|
['value' => 'Apotek', 'cell' => 'AC1', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||||
['value' => 'Jumlah Obat', 'cell' => 'AD1', 'mergeCell' => false, 'mergeToCell' => ''],
|
['value' => 'Nama Obat', 'cell' => 'AD1', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||||
['value' => 'By', 'cell' => 'AE1', 'mergeCell' => false, 'mergeToCell' => ''],
|
['value' => 'Jumlah Obat', 'cell' => 'AE1', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||||
|
['value' => 'By', 'cell' => 'AF1', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||||
];
|
];
|
||||||
|
|
||||||
$spreadsheet = new Spreadsheet();
|
$spreadsheet = new Spreadsheet();
|
||||||
@@ -479,29 +486,34 @@ class LivechatController extends Controller
|
|||||||
|
|
||||||
$startFromSheet1 = 2;
|
$startFromSheet1 = 2;
|
||||||
$startFromSheet2 = 2;
|
$startFromSheet2 = 2;
|
||||||
|
$apotekList = Organization::pluck('name', 'id'); // Ambil semua nama apotek dulu (1 query)
|
||||||
|
// dd('test');
|
||||||
foreach ($liveChats as $indexLiveChat => $liveChat) {
|
foreach ($liveChats as $indexLiveChat => $liveChat) {
|
||||||
//###################### SHEET 1 ##########
|
//###################### SHEET 1 ##########
|
||||||
$phone = $liveChat->user->sPhone ?? '-';
|
$phone = $liveChat->user->sPhone ?? '-';
|
||||||
$status = $liveChat->sStatus;
|
$status = $liveChat->sStatus;
|
||||||
$nIDUser = $liveChat->user->nIDUser ?? 0; // Principal or Dependent
|
$nIDUser = $liveChat->user->nIDUser ?? 0; // Principal or Dependent
|
||||||
$paymentMethod = $liveChat->appointment ? Helper::sPaymentMethod($liveChat->appointment->sPaymentMethod) : 'N/A';
|
$paymentMethod = $liveChat->appointment ? Helper::sPaymentMethod($liveChat->appointment->sPaymentMethod) : 'N/A';
|
||||||
|
$summary = $liveChat->summary;
|
||||||
|
$user = $liveChat->user;
|
||||||
|
|
||||||
$fullNameDoctor = '-';
|
$fullNameDoctor = '-';
|
||||||
if (!empty($liveChat->doctor->user)) {
|
if (!empty($liveChat->doctor->user)) {
|
||||||
$fullNameDoctor = '';
|
$fullNameDoctor = 'dr. ';
|
||||||
|
|
||||||
if ($liveChat->doctor->user->detail !== null) {
|
// if ($liveChat->doctor->user->detail !== null) {
|
||||||
if ($liveChat->doctor->user->detail->sTitlePrefix !== null) {
|
// if ($liveChat->doctor->user->detail->sTitlePrefix !== null) {
|
||||||
$fullNameDoctor .= $liveChat->doctor->user->detail->sTitlePrefix . '. ';
|
// $fullNameDoctor .= $liveChat->doctor->user->detail->sTitlePrefix . '. ';
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($liveChat->doctor->user->full_name !== null) {
|
if ($liveChat->doctor->user->full_name !== null) {
|
||||||
$fullNameDoctor .= $liveChat->doctor->user->full_name . ' ';
|
$fullNameDoctor .= $liveChat->doctor->user->full_name . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($liveChat->doctor->user->detail->sTitleSuffix !== null) {
|
// if ($liveChat->doctor->user->detail->sTitleSuffix !== null) {
|
||||||
$fullNameDoctor .= $liveChat->doctor->user->detail->sTitleSuffix;
|
// $fullNameDoctor .= $liveChat->doctor->user->detail->sTitleSuffix;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
$recordType = 'P';
|
$recordType = 'P';
|
||||||
@@ -554,22 +566,31 @@ class LivechatController extends Controller
|
|||||||
$chatTime = $chatTimeDiff;
|
$chatTime = $chatTimeDiff;
|
||||||
|
|
||||||
|
|
||||||
|
// $diagnosa = '-';
|
||||||
|
// $diagnosaCode = '-';
|
||||||
|
// if($liveChat->summary){
|
||||||
|
// $diagnosis = explode(', ', $liveChat->summary->sAssessment);
|
||||||
|
|
||||||
|
// if ($diagnosis) {
|
||||||
|
// $diagnosaArray = [];
|
||||||
|
// $diagnosaCodeArray = [];
|
||||||
|
// foreach($diagnosis as $data){
|
||||||
|
// $diagnosaArray[] = Helper::diagnosisName($data); // Tambahkan diagnosis ke array
|
||||||
|
// $diagnosaCodeArray[] = $data; // Tambahkan diagnosis ke array
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma
|
||||||
|
// $diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
$diagnosa = '-';
|
$diagnosa = '-';
|
||||||
$diagnosaCode = '-';
|
$diagnosaCode = '-';
|
||||||
if($liveChat->summary){
|
if ($summary && $summary->sAssessment) {
|
||||||
$diagnosis = explode(', ', $liveChat->summary->sAssessment);
|
$diagnosisCodes = explode(', ', $summary->sAssessment);
|
||||||
|
$diagnosaArray = array_map(fn($code) => Helper::diagnosisName($code), $diagnosisCodes);
|
||||||
if ($diagnosis) {
|
$diagnosa = implode('; ', $diagnosaArray);
|
||||||
$diagnosaArray = [];
|
$diagnosaCode = implode('; ', $diagnosisCodes);
|
||||||
$diagnosaCodeArray = [];
|
|
||||||
foreach($diagnosis as $data){
|
|
||||||
$diagnosaArray[] = Helper::diagnosisName($data); // Tambahkan diagnosis ke array
|
|
||||||
$diagnosaCodeArray[] = $data; // Tambahkan diagnosis ke array
|
|
||||||
}
|
|
||||||
|
|
||||||
$diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma
|
|
||||||
$diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tebusResep = 'Belum Ditebus';
|
$tebusResep = 'Belum Ditebus';
|
||||||
@@ -597,12 +618,14 @@ class LivechatController extends Controller
|
|||||||
}
|
}
|
||||||
if($liveChat->prescription->payment){
|
if($liveChat->prescription->payment){
|
||||||
$tebusResep = 'Online';
|
$tebusResep = 'Online';
|
||||||
$apotek = Organization::where('code', $liveChat->prescription->payment->nIDApotek)->first();
|
// $apotek = Organization::where('code', $liveChat->prescription->payment->nIDApotek)->first();
|
||||||
if ($apotek){
|
// if ($apotek){
|
||||||
$apotek = $apotek->name;
|
// $apotek = $apotek->name;
|
||||||
} else {
|
// } else {
|
||||||
$apotek = '-';
|
// $apotek = '-';
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
$apotek = $apotekList[$liveChat->prescription->payment->nIDApotek] ?? '-';
|
||||||
|
|
||||||
if ($liveChat->prescription->payment->sPaymentStatus == 'paid'){
|
if ($liveChat->prescription->payment->sPaymentStatus == 'paid'){
|
||||||
$paymentTebus = Carbon::parse($liveChat->prescription->payment->dCreateOn)->format('d-m-Y H:i:s');
|
$paymentTebus = Carbon::parse($liveChat->prescription->payment->dCreateOn)->format('d-m-Y H:i:s');
|
||||||
@@ -626,38 +649,29 @@ class LivechatController extends Controller
|
|||||||
$tebusResep = '-';
|
$tebusResep = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($liveChat->user->nIDHubunganKeluarga) {
|
$nIDHubunganKeluarga = match($user->nIDHubunganKeluarga) {
|
||||||
case 9:
|
9 => "Peserta",
|
||||||
$nIDHubunganKeluarga = "Peserta"; // Parent
|
4 => "Istri",
|
||||||
break;
|
5 => "Anak",
|
||||||
case 4:
|
3 => "Suami",
|
||||||
$nIDHubunganKeluarga = 'Istri'; // Spouse
|
default => $user->relation->sHubunganKeluarga ?? '-'
|
||||||
break;
|
};
|
||||||
case 5:
|
|
||||||
$nIDHubunganKeluarga = 'Anak'; // Child
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
$nIDHubunganKeluarga = 'Suami'; // Husband
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$nIDHubunganKeluarga = '-'; // No need to set $nIDHubunganKeluarga as it's already set to default value
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($liveChat->user->relation && $nIDHubunganKeluarga == '-'){
|
if ($liveChat->user->relation && $nIDHubunganKeluarga == '-'){
|
||||||
$nIDHubunganKeluarga = $liveChat->user->relation->sHubunganKeluarga;
|
$nIDHubunganKeluarga = $liveChat->user->relation->sHubunganKeluarga;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sheet->setCellValue('A' . $startFromSheet1, $liveChat->nID ?? '-');
|
$sheet->setCellValue('A' . $startFromSheet1, $liveChat->nID ?? '-');
|
||||||
$sheet->setCellValue('B' . $startFromSheet1, $liveChat->sNoSpj ?? '-');
|
$sheet->setCellValue('B' . $startFromSheet1, $liveChat->sNoSpj ?? '-');
|
||||||
$sheet->setCellValue('C' . $startFromSheet1, (string)($liveChat->userInsurance->sCorporateCode ?? '-'));
|
$sheet->setCellValue('C' . $startFromSheet1, (string)($liveChat->userInsurance->sCorporateCode ?? '-'));
|
||||||
$sheet->setCellValue('D' . $startFromSheet1, (string)($liveChat->userInsurance->sCorporateName ?? '-'));
|
$sheet->setCellValue('D' . $startFromSheet1, (string)($liveChat->userInsurance->sCorporateName ?? '-'));
|
||||||
$sheet->setCellValue('E' . $startFromSheet1, (string)($liveChat->userInsurance->sNoPolis ?? '-'));
|
$sheet->setCellValue('E' . $startFromSheet1, (string)($liveChat->userInsurance->sNoPolis ?? '-'));
|
||||||
$sheet->setCellValue('F' . $startFromSheet1, $liveChat->user->full_name ?? '-');
|
$sheet->setCellValue('F' . $startFromSheet1, $liveChat->user->full_name ?? '-');
|
||||||
$sheet->setCellValue('G' . $startFromSheet1, $liveChat->user->detail->dTanggalLahir ?? '-');
|
$sheet->setCellValue('G' . $startFromSheet1, $liveChat->user->detail->nIDJenisKelamin == 1 ? 'Laki-laki' : 'Wanita');
|
||||||
$sheet->setCellValue('H' . $startFromSheet1, $liveChat->user->detail->nIDJenisKelamin == 1 ? 'Laki-laki' : 'Wanita');
|
$sheet->setCellValue('H' . $startFromSheet1, $liveChat->user->detail->dTanggalLahir ?? '-');
|
||||||
$sheet->setCellValue('I' . $startFromSheet1, Helper::calculateAge($liveChat->user->detail->dTanggalLahir) ?? '-');
|
$sheet->setCellValue('I' . $startFromSheet1, Helper::calculateAge($liveChat->user->detail->dTanggalLahir, true) ?? '-'); $sheet->setCellValue('J' . $startFromSheet1, (string)($liveChat->userInsurance->sProductCode ?? '-'));
|
||||||
$sheet->setCellValue('J' . $startFromSheet1, (string)($liveChat->userInsurance->sProductCode ?? '-'));
|
|
||||||
$sheet->setCellValue('K' . $startFromSheet1, (string)($liveChat->userInsurance->sPlanCode ?? '-'));
|
$sheet->setCellValue('K' . $startFromSheet1, (string)($liveChat->userInsurance->sPlanCode ?? '-'));
|
||||||
$sheet->setCellValue('L' . $startFromSheet1, $nIDHubunganKeluarga ?? '-');
|
$sheet->setCellValue('L' . $startFromSheet1, $nIDHubunganKeluarga ?? '-');
|
||||||
$sheet->setCellValue('M' . $startFromSheet1, $requestTime->format('Y-m-d'));
|
$sheet->setCellValue('M' . $startFromSheet1, $requestTime->format('Y-m-d'));
|
||||||
@@ -675,15 +689,16 @@ class LivechatController extends Controller
|
|||||||
$sheet->setCellValue('V' . $startFromSheet1, $fullNameDoctor);
|
$sheet->setCellValue('V' . $startFromSheet1, $fullNameDoctor);
|
||||||
$sheet->setCellValue('W' . $startFromSheet1, $liveChat->doctor->speciality->sSpesialis ?? '-');
|
$sheet->setCellValue('W' . $startFromSheet1, $liveChat->doctor->speciality->sSpesialis ?? '-');
|
||||||
$sheet->setCellValue('X' . $startFromSheet1, $liveChat->rujukan ? 'Ya' : 'Tidak');
|
$sheet->setCellValue('X' . $startFromSheet1, $liveChat->rujukan ? 'Ya' : 'Tidak');
|
||||||
$sheet->setCellValue('Y' . $startFromSheet1, $liveChat->rujukan->sDepartement ?? '-' );
|
$sheet->setCellValue('Y' . $startFromSheet1, $liveChat->rujukan->nIDHealthcare ?? '-');
|
||||||
|
$sheet->setCellValue('Z' . $startFromSheet1, $liveChat->rujukan->sDepartement ?? '-' );
|
||||||
|
|
||||||
$sheet->setCellValue('Z' . $startFromSheet1, $qtyTotal);
|
$sheet->setCellValue('AA' . $startFromSheet1, $qtyTotal);
|
||||||
$sheet->setCellValue('AA' . $startFromSheet1, $tebusResep);
|
$sheet->setCellValue('AB' . $startFromSheet1, $tebusResep);
|
||||||
|
|
||||||
$sheet->setCellValue('AB' . $startFromSheet1, $apotek);
|
$sheet->setCellValue('AC' . $startFromSheet1, $apotek);
|
||||||
$sheet->setCellValue('AC' . $startFromSheet1, $obat);
|
$sheet->setCellValue('AD' . $startFromSheet1, $obat);
|
||||||
$sheet->setCellValue('AD' . $startFromSheet1, $obatQty);
|
$sheet->setCellValue('AE' . $startFromSheet1, $obatQty);
|
||||||
$sheet->setCellValue('AE' . $startFromSheet1, 'LMS');
|
$sheet->setCellValue('AF' . $startFromSheet1, 'LMS');
|
||||||
// $sheet->setCellValue('AC' . $startFrom, $liveChat->prescription->dCreateOn ?? '-');
|
// $sheet->setCellValue('AC' . $startFrom, $liveChat->prescription->dCreateOn ?? '-');
|
||||||
// $sheet->setCellValue('AD' . $startFrom, $obat);
|
// $sheet->setCellValue('AD' . $startFrom, $obat);
|
||||||
// $sheet->setCellValue('AE' . $startFrom, $tebusResep);
|
// $sheet->setCellValue('AE' . $startFrom, $tebusResep);
|
||||||
@@ -695,8 +710,8 @@ class LivechatController extends Controller
|
|||||||
// $sheet->setCellValue('AJ' . $startFrom, $liveChat->sNoSpj ?? '-');
|
// $sheet->setCellValue('AJ' . $startFrom, $liveChat->sNoSpj ?? '-');
|
||||||
$startFromSheet1++;
|
$startFromSheet1++;
|
||||||
//###################### END SHEET 1 ##########
|
//###################### END SHEET 1 ##########
|
||||||
if (!$liveChat->prescription) {
|
if (!$liveChat->prescription || !$liveChat->prescription->items) {
|
||||||
|
continue;
|
||||||
} else {
|
} else {
|
||||||
if ($liveChat->prescription->items){
|
if ($liveChat->prescription->items){
|
||||||
$obatArray = [];
|
$obatArray = [];
|
||||||
@@ -730,7 +745,6 @@ class LivechatController extends Controller
|
|||||||
$recordType = 'D';
|
$recordType = 'D';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch ($status) {
|
switch ($status) {
|
||||||
case 0:
|
case 0:
|
||||||
$statusLivechat = "Request TC";
|
$statusLivechat = "Request TC";
|
||||||
@@ -777,23 +791,32 @@ class LivechatController extends Controller
|
|||||||
$chatTime = $chatTimeDiff;
|
$chatTime = $chatTimeDiff;
|
||||||
|
|
||||||
|
|
||||||
|
// $diagnosa = '-';
|
||||||
|
// $diagnosaCode = '-';
|
||||||
|
|
||||||
|
// if($liveChat->summary){
|
||||||
|
// $diagnosis = explode(', ', $liveChat->summary->sAssessment);
|
||||||
|
|
||||||
|
// if ($diagnosis) {
|
||||||
|
// $diagnosaArray = [];
|
||||||
|
// $diagnosaCodeArray = [];
|
||||||
|
// foreach($diagnosis as $dataDiagnosa){
|
||||||
|
// $diagnosaArray[] = Helper::diagnosisName($dataDiagnosa); // Tambahkan diagnosis ke array
|
||||||
|
// $diagnosaCodeArray[] = $dataDiagnosa; // Tambahkan diagnosis ke array
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma
|
||||||
|
// $diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
$diagnosa = '-';
|
$diagnosa = '-';
|
||||||
$diagnosaCode = '-';
|
$diagnosaCode = '-';
|
||||||
|
if ($summary && $summary->sAssessment) {
|
||||||
if($liveChat->summary){
|
$diagnosisCodes = explode(', ', $summary->sAssessment);
|
||||||
$diagnosis = explode(', ', $liveChat->summary->sAssessment);
|
$diagnosaArray = array_map(fn($code) => Helper::diagnosisName($code), $diagnosisCodes);
|
||||||
|
$diagnosa = implode('; ', $diagnosaArray);
|
||||||
if ($diagnosis) {
|
$diagnosaCode = implode('; ', $diagnosisCodes);
|
||||||
$diagnosaArray = [];
|
|
||||||
$diagnosaCodeArray = [];
|
|
||||||
foreach($diagnosis as $dataDiagnosa){
|
|
||||||
$diagnosaArray[] = Helper::diagnosisName($dataDiagnosa); // Tambahkan diagnosis ke array
|
|
||||||
$diagnosaCodeArray[] = $dataDiagnosa; // Tambahkan diagnosis ke array
|
|
||||||
}
|
|
||||||
|
|
||||||
$diagnosa = implode('; ', $diagnosaArray); // Gabungkan array dengan tanda koma
|
|
||||||
$diagnosaCode = implode('; ', $diagnosaCodeArray); // Gabungkan array dengan tanda koma
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -817,12 +840,13 @@ class LivechatController extends Controller
|
|||||||
}
|
}
|
||||||
if($liveChat->prescription->payment){
|
if($liveChat->prescription->payment){
|
||||||
$tebusResep = 'Online';
|
$tebusResep = 'Online';
|
||||||
$apotek = Organization::where('id', $liveChat->prescription->payment->nIDApotek)->first();
|
// $apotek = Organization::where('id', $liveChat->prescription->payment->nIDApotek)->first();
|
||||||
if ($apotek){
|
// if ($apotek){
|
||||||
$apotek = $apotek->name;
|
// $apotek = $apotek->name;
|
||||||
} else {
|
// } else {
|
||||||
$apotek = '-';
|
// $apotek = '-';
|
||||||
}
|
// }
|
||||||
|
$apotek = $apotekList[$liveChat->prescription->payment->nIDApotek] ?? '-';
|
||||||
|
|
||||||
if ($liveChat->prescription->payment->sPaymentStatus == 'paid'){
|
if ($liveChat->prescription->payment->sPaymentStatus == 'paid'){
|
||||||
$paymentTebus = Carbon::parse($liveChat->prescription->payment->dCreateOn)->format('d-m-Y H:i:s');
|
$paymentTebus = Carbon::parse($liveChat->prescription->payment->dCreateOn)->format('d-m-Y H:i:s');
|
||||||
@@ -832,23 +856,31 @@ class LivechatController extends Controller
|
|||||||
$tebusResep = '-';
|
$tebusResep = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($liveChat->user->nIDHubunganKeluarga) {
|
// switch ($liveChat->user->nIDHubunganKeluarga) {
|
||||||
case 9:
|
// case 9:
|
||||||
$nIDHubunganKeluarga = "Peserta"; // Parent
|
// $nIDHubunganKeluarga = "Peserta"; // Parent
|
||||||
break;
|
// break;
|
||||||
case 4:
|
// case 4:
|
||||||
$nIDHubunganKeluarga = 'Istri'; // Spouse
|
// $nIDHubunganKeluarga = 'Istri'; // Spouse
|
||||||
break;
|
// break;
|
||||||
case 5:
|
// case 5:
|
||||||
$nIDHubunganKeluarga = 'Anak'; // Child
|
// $nIDHubunganKeluarga = 'Anak'; // Child
|
||||||
break;
|
// break;
|
||||||
case 3:
|
// case 3:
|
||||||
$nIDHubunganKeluarga = 'Suami'; // Husband
|
// $nIDHubunganKeluarga = 'Suami'; // Husband
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
$nIDHubunganKeluarga = '-'; // No need to set $nIDHubunganKeluarga as it's already set to default value
|
// $nIDHubunganKeluarga = '-'; // No need to set $nIDHubunganKeluarga as it's already set to default value
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
$nIDHubunganKeluarga = match($user->nIDHubunganKeluarga) {
|
||||||
|
9 => "Peserta",
|
||||||
|
4 => "Istri",
|
||||||
|
5 => "Anak",
|
||||||
|
3 => "Suami",
|
||||||
|
default => $user->relation->sHubunganKeluarga ?? '-'
|
||||||
|
};
|
||||||
|
|
||||||
if ($liveChat->user->relation && $nIDHubunganKeluarga == '-'){
|
if ($liveChat->user->relation && $nIDHubunganKeluarga == '-'){
|
||||||
$nIDHubunganKeluarga = $liveChat->user->relation->sHubunganKeluarga;
|
$nIDHubunganKeluarga = $liveChat->user->relation->sHubunganKeluarga;
|
||||||
@@ -885,15 +917,16 @@ class LivechatController extends Controller
|
|||||||
$sheet2->setCellValue('V' . $startFromSheet2, $fullNameDoctor);
|
$sheet2->setCellValue('V' . $startFromSheet2, $fullNameDoctor);
|
||||||
$sheet2->setCellValue('W' . $startFromSheet2, $liveChat->doctor->speciality->sSpesialis ?? '-');
|
$sheet2->setCellValue('W' . $startFromSheet2, $liveChat->doctor->speciality->sSpesialis ?? '-');
|
||||||
$sheet2->setCellValue('X' . $startFromSheet2, $liveChat->rujukan ? 'Ya' : 'Tidak');
|
$sheet2->setCellValue('X' . $startFromSheet2, $liveChat->rujukan ? 'Ya' : 'Tidak');
|
||||||
$sheet2->setCellValue('Y' . $startFromSheet2, $liveChat->rujukan->sDepartement ?? '-' );
|
$sheet2->setCellValue('Y' . $startFromSheet2, $liveChat->rujukan->nIDHealthcare ?? '-' );
|
||||||
|
$sheet2->setCellValue('Z' . $startFromSheet2, $liveChat->rujukan->sDepartement ?? '-' );
|
||||||
|
|
||||||
$sheet2->setCellValue('Z' . $startFromSheet2, '-');
|
$sheet2->setCellValue('AA' . $startFromSheet2, '-');
|
||||||
$sheet2->setCellValue('AA' . $startFromSheet2, $tebusResep);
|
$sheet2->setCellValue('AB' . $startFromSheet2, $tebusResep);
|
||||||
|
|
||||||
$sheet2->setCellValue('AB' . $startFromSheet2, $apotek );
|
$sheet2->setCellValue('AC' . $startFromSheet2, $apotek );
|
||||||
$sheet2->setCellValue('AC' . $startFromSheet2, $obat);
|
$sheet2->setCellValue('AD' . $startFromSheet2, $obat);
|
||||||
$sheet2->setCellValue('AD' . $startFromSheet2, $obatQty);
|
$sheet2->setCellValue('AE' . $startFromSheet2, $obatQty);
|
||||||
$sheet2->setCellValue('AE' . $startFromSheet2, 'LMS');
|
$sheet2->setCellValue('AF' . $startFromSheet2, 'LMS');
|
||||||
// $sheet->setCellValue('AC' . $startFromSheet2, $liveChat->prescription->dCreateOn ?? '-');
|
// $sheet->setCellValue('AC' . $startFromSheet2, $liveChat->prescription->dCreateOn ?? '-');
|
||||||
// $sheet->setCellValue('AD' . $startFromSheet2, $obat);
|
// $sheet->setCellValue('AD' . $startFromSheet2, $obat);
|
||||||
// $sheet->setCellValue('AE' . $startFromSheet2, $tebusResep);
|
// $sheet->setCellValue('AE' . $startFromSheet2, $tebusResep);
|
||||||
@@ -909,7 +942,7 @@ class LivechatController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J','K', 'L', 'M', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', 'AD'] as $header) {
|
foreach (['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J','K', 'L', 'M', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF'] as $header) {
|
||||||
// if ($header === 'A') {
|
// if ($header === 'A') {
|
||||||
// $spreadsheet->getActiveSheet()->getColumnDimension($header)->setWidth(35, 'px');
|
// $spreadsheet->getActiveSheet()->getColumnDimension($header)->setWidth(35, 'px');
|
||||||
// } elseif ($header === 'H' || $header === 'I') {
|
// } elseif ($header === 'H' || $header === 'I') {
|
||||||
|
|||||||
Reference in New Issue
Block a user