Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵增煜
/
tzt-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f86da17b
authored
Nov 22, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
import
parent
4e715668
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
app/Admin/Extensions/ToolBar/Forms/DrugImportForm.php
+41
-0
No files found.
app/Admin/Extensions/ToolBar/Forms/DrugImportForm.php
View file @
f86da17b
...
@@ -72,6 +72,47 @@ public function handle(array $input): JsonResponse
...
@@ -72,6 +72,47 @@ public function handle(array $input): JsonResponse
return
$return
;
return
$return
;
}
}
/*public function handle(array $input)
{
// 表单参数
$file = $input['import_file'];
$filePath = storage_path('app/'.$file);
// 每1000行数据为一批数据进行读取
$chunkSize = 1000;
Excel::import($filePath)->first()->chunk($chunkSize, function (SheetCollection $collection) {
// 此处的数组下标依然是excel表中数据行的行号
$rows = $collection->toArray();
$arr = [];
foreach ($rows as $row) {
$item = array_map(function ($value) {
return is_string($value) ? trim($value) : $value;
}, $row);
$pinyin = new Pinyin();
$code = strtoupper($pinyin->abbr($item['通用名'])->join(''));
$arr[] = [
'product_id' => $item['君元ID'] ?? 0,
'name' => $item['通用名'],
'product_name' => $item['商品名'],
'spec' => $item['包装规格'],
'preparation_pec' => $item['制剂规格'],
'dosage_form' => $item['剂型'],
'unit' => $item['计量单位'],
'factory' => $item['生产企业'],
'approval_no' => $item['批准文号'],
'mnemonic' => $item['助记码'],
'standard_code' => $item['本位码'],
'category_code' => $item['分类码'],
'category_name' => $item['分类名称'],
'is_foreign' => self::toBool($item['是否进口药']),
'is_rx' => self::toBool($item['是否处方药']),
'is_si' => self::toBool($item['是否医保药']),
'code' => $code,
];
}
DrugModel::insert($arr);
});
}*/
/**
/**
* 构造表单.
* 构造表单.
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment