argument('type'); $file_path = $this->argument('filepath'); //路径相对于项目根目录即 /public if(empty($type) || empty($file_path)){ dd('请输入完整参数'); } //医生信息导入 if($type == 'docter'){ $this->makeDocter($file_path); } if($type == 'organization'){ $this->makeOrganization($file_path); } // if($type == 'docter_organization'){ // $this->makeDocterOrganization($file_path); // } if($type == 'organization_office'){ $this->makeOrganizationOffice($file_path); } } /* * 导入医生要分为3个步骤 * 1.先导入机构模块 * 2.先导入医生模块 * 3.再导入医生机构模块 * */ //医生模块 public function makeDocter($file_path) { $this->imports($file_path); } public function imports($filePath) { $filePath = './public/import/' . $filePath . '.xlsx'; Excel::import(new DocterInfo(), $filePath); } // //医生机构模块 // public function makeDocterOrganization($file_path) // { // $this->importsDocterOrganization($file_path); // } // public function importsDocterOrganization($filePath) // { // $filePath = './public/import/' . $filePath . '.xlsx'; // // Excel::import(new DocterOrganizationInfo(), $filePath); // } //机构模块 public function makeOrganization($file_path) { $this->importsOrganization($file_path); } public function importsOrganization($filePath) { $filePath = './public/import/' . $filePath . '.xlsx'; Excel::import(new OrganizationInfo(), $filePath); } //机构科室模块 public function makeOrganizationOffice($file_path) { $this->importsOrganizationOffice($file_path); } public function importsOrganizationOffice($filePath) { $filePath = './public/import/' . $filePath . '.xls'; Excel::import(new OrganizationOffice(), $filePath); } }