Add Seeder UpdateTarifLMSSeeder
This commit is contained in:
@@ -132,82 +132,75 @@ class UpdateTarifLMSSeeder extends Seeder
|
||||
// Update Tarif Dokter Umum
|
||||
$updateUmum = [];
|
||||
if ($tarif['walkin_umum'] != null) {
|
||||
$updateUmum[] = ['nBiaya' => $tarif['walkin_umum']];
|
||||
$updateUmum['nBiaya'] = $tarif['walkin_umum'];
|
||||
}
|
||||
if ($tarif['telekonsul_umum'] != null) {
|
||||
$updateUmum[] = ['nBiayaTC' => $tarif['telekonsul_umum']];
|
||||
$updateUmum[] = ['nBiayaATC' => $tarif['telekonsul_umum']];
|
||||
$updateUmum['nBiayaTC'] = $tarif['telekonsul_umum'];
|
||||
$updateUmum['nBiayaATC'] = $tarif['telekonsul_umum'];
|
||||
}
|
||||
if (count($updateUmum)) {
|
||||
$updateUmum['dUpdateOn'] = now();
|
||||
// Updating
|
||||
$dokUmum = JadwalDokter::query()
|
||||
->where('nIDSpesialis', $spesialisUmum->nID)
|
||||
->whereHas('healthcare', function($hc) use ($tarif) {
|
||||
$hc->whereIn('sKodeRS', $tarif['applied_to']);
|
||||
})
|
||||
->update($updateUmum);
|
||||
$this->command->info('Updating : Dokter Umum');
|
||||
}
|
||||
// Updating
|
||||
$dokUmum = JadwalDokter::query()
|
||||
->where('nIDSpesialis', $spesialisUmum->nID)
|
||||
->whereHas('healthcare', function($hc) use ($tarif) {
|
||||
$hc->whereIn('sKodeRS', $tarif['applied_to']);
|
||||
})
|
||||
->update([
|
||||
'nBiaya' => $tarif['walkin_umum'],
|
||||
'nBiayaTC' => $tarif['telekonsul_umum'],
|
||||
'nBiayaATC' => $tarif['telekonsul_umum'],
|
||||
'dUpdateOn' => now()
|
||||
]);
|
||||
$this->command->info('Updating : Dokter Umum');
|
||||
|
||||
// [MARK] : SPESIALIS
|
||||
// Update Tarif Dokter Spesialis
|
||||
$updateSpesialis = [];
|
||||
if ($tarif['walkin_spesialis'] != null) {
|
||||
$updateUmum[] = ['nBiaya' => $tarif['walkin_spesialis']];
|
||||
$updateSpesialis['nBiaya'] = $tarif['walkin_spesialis'];
|
||||
}
|
||||
if ($tarif['telekonsul_spesialis'] != null) {
|
||||
$updateUmum[] = ['nBiayaTC' => $tarif['telekonsul_spesialis']];
|
||||
$updateUmum[] = ['nBiayaATC' => $tarif['telekonsul_spesialis']];
|
||||
$updateSpesialis['nBiayaTC'] = $tarif['telekonsul_spesialis'];
|
||||
$updateSpesialis['nBiayaATC'] = $tarif['telekonsul_spesialis'];
|
||||
}
|
||||
if (count($updateSpesialis)) {
|
||||
$updateSpesialis['dUpdateOn'] = now();
|
||||
// Updating
|
||||
$dokSpesialis = JadwalDokter::query()
|
||||
->whereNot(function ($q) use ($spesialisUmum) {
|
||||
$q->where('nIDSpesialis', $spesialisUmum->nID);
|
||||
})
|
||||
->where('sIsSubSpesialis', 0)
|
||||
->whereHas('healthcare', function($hc) use ($tarif) {
|
||||
$hc->whereIn('sKodeRS', $tarif['applied_to']);
|
||||
})
|
||||
->update($updateSpesialis);
|
||||
$this->command->info('Updating : Dokter Spesialis');
|
||||
}
|
||||
|
||||
// Updating
|
||||
$dokSpesialis = JadwalDokter::query()
|
||||
->whereNot(function ($q) use ($spesialisUmum) {
|
||||
$q->where('nIDSpesialis', $spesialisUmum->nID);
|
||||
})
|
||||
->where('sIsSubSpesialis', 0)
|
||||
->whereHas('healthcare', function($hc) use ($tarif) {
|
||||
$hc->whereIn('sKodeRS', $tarif['applied_to']);
|
||||
})
|
||||
->update([
|
||||
'nBiaya' => $tarif['walkin_spesialis'],
|
||||
'nBiayaTC' => $tarif['telekonsul_spesialis'],
|
||||
'nBiayaATC' => $tarif['telekonsul_spesialis'],
|
||||
'dUpdateOn' => now()
|
||||
]);
|
||||
$this->command->info('Updating : Dokter Spesialis');
|
||||
|
||||
|
||||
// [MARK] : SUBSPESIALIS
|
||||
// Update Tarif Dokter Sub Spesialis
|
||||
$updateSubSpesialis = [];
|
||||
if ($tarif['walkin_subspesialis'] != null) {
|
||||
$updateUmum[] = ['nBiaya' => $tarif['walkin_subspesialis']];
|
||||
$updateSubSpesialis['nBiaya'] = $tarif['walkin_subspesialis'];
|
||||
}
|
||||
if ($tarif['telekonsul_subspesialis'] != null) {
|
||||
$updateUmum[] = ['nBiayaTC' => $tarif['telekonsul_subspesialis']];
|
||||
$updateUmum[] = ['nBiayaATC' => $tarif['telekonsul_subspesialis']];
|
||||
$updateSubSpesialis['nBiayaTC'] = $tarif['telekonsul_subspesialis'];
|
||||
$updateSubSpesialis['nBiayaATC'] = $tarif['telekonsul_subspesialis'];
|
||||
}
|
||||
if (count($updateSubSpesialis)) {
|
||||
$updateSubSpesialis['dUpdateOn'] = now();
|
||||
|
||||
// Updating
|
||||
$dokSubSpesialis = JadwalDokter::query()
|
||||
->whereNot(function ($q) use ($spesialisUmum) {
|
||||
$q->where('nIDSpesialis', $spesialisUmum->nID);
|
||||
})
|
||||
->where('sIsSubSpesialis', 1)
|
||||
->whereHas('healthcare', function($hc) use ($tarif) {
|
||||
$hc->whereIn('sKodeRS', $tarif['applied_to']);
|
||||
})
|
||||
->update([
|
||||
'nBiaya' => $tarif['walkin_subspesialis'],
|
||||
'nBiayaTC' => $tarif['telekonsul_subspesialis'],
|
||||
'nBiayaATC' => $tarif['telekonsul_subspesialis'],
|
||||
'dUpdateOn' => now()
|
||||
]);
|
||||
$this->command->info('Updating : Dokter Sub Spesialis');
|
||||
// Updating
|
||||
$dokSubSpesialis = JadwalDokter::query()
|
||||
->whereNot(function ($q) use ($spesialisUmum) {
|
||||
$q->where('nIDSpesialis', $spesialisUmum->nID);
|
||||
})
|
||||
->where('sIsSubSpesialis', 1)
|
||||
->whereHas('healthcare', function($hc) use ($tarif) {
|
||||
$hc->whereIn('sKodeRS', $tarif['applied_to']);
|
||||
})
|
||||
->update($updateSubSpesialis);
|
||||
$this->command->info('Updating : Dokter Sub Spesialis');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user