Files
streamline-emr/docker/_streamline-src/database/seeders/DrugsTableSeeder.php
T

61 lines
2.4 KiB
PHP
Executable File

<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Streamline\Models\Drug;
class DrugsTableSeeder extends Seeder {
/**
* Run the database seeders.
*
* @return void
*/
public function run() {
$json = File::get('database/data/drugs_kisiizi.json');
$data = json_decode($json);
foreach ($data as $drug_item) {
Drug::firstOrCreate([
'id' => $drug_item->id,
'name' => $drug_item->name,
'cost_price' => $drug_item->cost_price,
'non_insured_price' => $drug_item->non_insured_price,
'insured_price' => 0,
'store_stock' => $drug_item->store_stock,
'reorder_level' => $drug_item->reorder_level,
'description' => $drug_item->description,
'form_id' => $drug_item->form_id,
'unit_id' => $drug_item->unit_id,
'supplier_id' => $drug_item->supplier_id,
'prompt' => $drug_item->prompt,
'info_vernacular' => $drug_item->info_vernacular,
'info_english' => $drug_item->info_english,
'insurance_coverage' => $drug_item->insurance_coverage,
'category_id' => $drug_item->category_id,
'account_id' => 4,
'pharmacy_comment' => $drug_item->pharmacy_comment,
'restricted_prescription' => $drug_item->restricted_prescription,
'long_term' => $drug_item->long_term,
'pharmacy_stock' => $drug_item->pharmacy_stock,
'expiry_date' => $drug_item->expiry_date,
'pricing_factor_adult' => $drug_item->pricing_factor_adult,
'ip_daily_cost_adult' => $drug_item->ip_daily_cost_adult,
'pricing_factor_children' => $drug_item->pricing_factor_children,
'ip_daily_cost_children' => null,
'pricing_factor_infant' => $drug_item->pricing_factor_infant,
'ip_daily_cost_infant' => $drug_item->ip_daily_cost_infant,
'pack' => $drug_item->pack,
'strength' => $drug_item->strength,
'hssip' => $drug_item->hssip,
'reference_areas' => $drug_item->Reference_Areas,
'reference_name' => $drug_item->Reference_Name
]);
}
}
}