ImportLessonSchedules.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Imports\Lab;
  3. use App\Repositories\Enums\ModelStatusEnum;
  4. use App\Repositories\Models\TCM\Drug;
  5. use App\Repositories\Models\TCM\Prescription;
  6. use Maatwebsite\Excel\Concerns\OnEachRow;
  7. use Maatwebsite\Excel\Row;
  8. use Overtrue\LaravelPinyin\Facades\Pinyin;
  9. class ImportLessonSchedules implements OnEachRow
  10. {
  11. public function onRow(Row $row)
  12. {
  13. // if ($row->getIndex() <= 2) return false;
  14. // if (empty($row[1])) return false;
  15. //
  16. // $type = Prescription::DRUG_TYPE_YP;
  17. //
  18. // switch ($row[2]) {
  19. // case '颗粒':
  20. // $type = Prescription::DRUG_TYPE_KL;
  21. // break;
  22. // }
  23. //
  24. // $letter = Pinyin::abbr($row[1]);
  25. // $initial = substr($letter, 1);
  26. //
  27. // $data = [
  28. // 'name' => $row[1],
  29. // 'type' => $type,
  30. // 'area' => $row[3],
  31. // 'unit' => $row[4],
  32. // 'letter' => $letter,
  33. // 'initial' => $initial,
  34. // 'admin_id' => login_admin_id(),
  35. // 'status' => ModelStatusEnum::OK,
  36. // ];
  37. // if (Drug::query()->where('name', $row[1])->exists()) return false;
  38. // Drug::create($data);
  39. dd($row->toArray());
  40. // return true;
  41. }
  42. }