Add Corporate Specialities
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('specialities', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code')->nullable();
|
||||
$table->string('name')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->unsignedBigInteger('created_by')->nullable()->index();
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->index();
|
||||
$table->unsignedBigInteger('deleted_by')->nullable()->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('specialities');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('corporate_service_specialities', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('corporate_service_id');
|
||||
$table->foreignId('speciality_id');
|
||||
$table->string('status')->default('active');
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreignId('created_by')->nullable();
|
||||
$table->foreignId('updated_by')->nullable();
|
||||
$table->foreignId('deleted_by')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('corporate_service_specialities');
|
||||
}
|
||||
};
|
||||
@@ -50,7 +50,7 @@ class IcdSeeder extends Seeder
|
||||
$chunks[] = $row_data;
|
||||
}
|
||||
|
||||
if ($chunks && count($chunks) == 1000) {
|
||||
if ($chunks && count($chunks) == 100) {
|
||||
Icd::insert($chunks);
|
||||
$chunks = [];
|
||||
}
|
||||
|
||||
234
database/seeders/SpecialitiesSeeder.php
Normal file
234
database/seeders/SpecialitiesSeeder.php
Normal file
@@ -0,0 +1,234 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Speciality;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SpecialitiesSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$specialities = array(
|
||||
array(
|
||||
'code' => '1',
|
||||
'name' => 'Akupunktur',
|
||||
'image' => 'image/specialities/akupunktur.png',
|
||||
),
|
||||
array(
|
||||
'code' => '2',
|
||||
'name' => 'Anak',
|
||||
'image' => 'image/specialities/anak.png',
|
||||
),
|
||||
array(
|
||||
'code' => '3',
|
||||
'name' => 'Andrologi',
|
||||
'image' => 'image/specialities/andrologi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '4',
|
||||
'name' => 'Anestesi',
|
||||
'image' => 'image/specialities/anestesi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '5',
|
||||
'name' => 'Bedah Anak',
|
||||
'image' => 'image/specialities/bedah_anak.png',
|
||||
),
|
||||
array(
|
||||
'code' => '6',
|
||||
'name' => 'Bedah Digestif',
|
||||
'image' => 'image/specialities/bedah_digestif.png',
|
||||
),
|
||||
array(
|
||||
'code' => '7',
|
||||
'name' => 'Bedah Mulut',
|
||||
'image' => 'image/specialities/bedah_mulut.png',
|
||||
),
|
||||
array(
|
||||
'code' => '8',
|
||||
'name' => 'Bedah Onkologi',
|
||||
'image' => 'image/specialities/bedah_onkologi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '9',
|
||||
'name' => 'Bedah Orthopedi',
|
||||
'image' => 'image/specialities/bedah_orthopedi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '10',
|
||||
'name' => 'Bedah Plastik & Rekonstruksi',
|
||||
'image' => 'image/specialities/bedah_plastik_dan_rekonstruksi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '11',
|
||||
'name' => 'Bedah Saraf',
|
||||
'image' => 'image/specialities/bedah_saraf.png',
|
||||
),
|
||||
array(
|
||||
'code' => '12',
|
||||
'name' => 'Bedah Thorak & Kardiovaskuler',
|
||||
'image' => 'image/specialities/bedah_thorak_dan_kardiovaskuler.png',
|
||||
),
|
||||
array(
|
||||
'code' => '13',
|
||||
'name' => 'Bedah Umum',
|
||||
'image' => 'image/specialities/bedah_umum.png',
|
||||
),
|
||||
array(
|
||||
'code' => '14',
|
||||
'name' => 'Bedah Vaskuler',
|
||||
'image' => 'image/specialities/bedah_vaskuler.png',
|
||||
),
|
||||
array(
|
||||
'code' => '15',
|
||||
'name' => 'Dokter Gigi',
|
||||
'image' => 'image/specialities/dokter_gigi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '16',
|
||||
'name' => 'Fisik & Rehabilitasi',
|
||||
'image' => 'image/specialities/fisik_dan_rehabilitasi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '17',
|
||||
'name' => 'Gastroenterologi Hepatologi',
|
||||
'image' => 'image/specialities/gastroenterologi_hepatologi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '18',
|
||||
'name' => 'Ginjal Hipertensi',
|
||||
'image' => 'image/specialities/ginjal_hipertensi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '19',
|
||||
'name' => 'Gizi Klinik',
|
||||
'image' => 'image/specialities/gizi_klinik.png',
|
||||
),
|
||||
array(
|
||||
'code' => '20',
|
||||
'name' => 'Hematologi Onkologi',
|
||||
'image' => 'image/specialities/hematologi_onkologi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '21',
|
||||
'name' => 'Jantung & Pembuluh Darah',
|
||||
'image' => 'image/specialities/jantung_dan_pembuluh_darah.png',
|
||||
),
|
||||
array(
|
||||
'code' => '22',
|
||||
'name' => 'Kardio Vaskuler',
|
||||
'image' => 'image/specialities/kardio_vaskuler.png',
|
||||
),
|
||||
array(
|
||||
'code' => '23',
|
||||
'name' => 'Kebidanan & Kandungan',
|
||||
'image' => 'image/specialities/kebidanan_dan_kandungan.png',
|
||||
),
|
||||
array(
|
||||
'code' => '24',
|
||||
'name' => 'Kesehatan Jiwa',
|
||||
'image' => 'image/specialities/kesehatan_jiwa.png',
|
||||
),
|
||||
array(
|
||||
'code' => '25',
|
||||
'name' => 'Kulit & Kelamin',
|
||||
'image' => 'image/specialities/kulit_dan_kelamin.png',
|
||||
),
|
||||
array(
|
||||
'code' => '26',
|
||||
'name' => 'Laboratorium',
|
||||
'image' => 'image/specialities/laboratorium.png',
|
||||
),
|
||||
array(
|
||||
'code' => '27',
|
||||
'name' => 'Mata',
|
||||
'image' => 'image/specialities/mata.png',
|
||||
),
|
||||
array(
|
||||
'code' => '28',
|
||||
'name' => 'Okupasi',
|
||||
'image' => 'image/specialities/okupasi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '29',
|
||||
'name' => 'Paru',
|
||||
'image' => 'image/specialities/paru.png',
|
||||
),
|
||||
array(
|
||||
'code' => '30',
|
||||
'name' => 'Patologi Klinik',
|
||||
'image' => 'image/specialities/patologi_klinik.png',
|
||||
),
|
||||
array(
|
||||
'code' => '31',
|
||||
'name' => 'Penyakit Dalam',
|
||||
'image' => 'image/specialities/penyakit_dalam.png',
|
||||
),
|
||||
array(
|
||||
'code' => '32',
|
||||
'name' => 'Psikolog',
|
||||
'image' => 'image/specialities/psikolog.png',
|
||||
),
|
||||
array(
|
||||
'code' => '33',
|
||||
'name' => 'Radiolog',
|
||||
'image' => 'image/specialities/radiolog.png',
|
||||
),
|
||||
array(
|
||||
'code' => '34',
|
||||
'name' => 'Rehabilitasi Medik',
|
||||
'image' => 'image/specialities/rehabilitasi_medik.png',
|
||||
),
|
||||
array(
|
||||
'code' => '35',
|
||||
'name' => 'Rheumatologi',
|
||||
'image' => 'image/specialities/rheumatologi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '36',
|
||||
'name' => 'Saraf',
|
||||
'image' => 'image/specialities/saraf.png',
|
||||
),
|
||||
array(
|
||||
'code' => '37',
|
||||
'name' => 'THT',
|
||||
'image' => 'image/specialities/tht.png',
|
||||
),
|
||||
array(
|
||||
'code' => '38',
|
||||
'name' => 'Umum',
|
||||
'image' => 'image/specialities/umum.png',
|
||||
),
|
||||
array(
|
||||
'code' => '39',
|
||||
'name' => 'Urologi',
|
||||
'image' => 'image/specialities/urologi.png',
|
||||
),
|
||||
array(
|
||||
'code' => '40',
|
||||
'name' => 'Lain-Lain',
|
||||
'image' => 'image/specialities/lain_lain.png',
|
||||
),
|
||||
);
|
||||
|
||||
// Speciality::truncate();
|
||||
|
||||
foreach ($specialities as $speciality) {
|
||||
$speciality['code'] = "SP".str_pad($speciality['code'], 4, 0, STR_PAD_LEFT);
|
||||
unset($speciality['image']);
|
||||
Speciality::updateOrCreate(
|
||||
[
|
||||
'code' => $speciality['code'],
|
||||
],
|
||||
$speciality
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user