|
@@ -339,18 +339,56 @@ class Doctors extends Base {
|
|
|
$excel_array=$obj_PHPExcel->getsheet(0)->toArray(); //转换为数组格式
|
|
|
array_shift($excel_array); //删除第一个数组(标题);
|
|
|
$data = [];
|
|
|
+ $dj = array();
|
|
|
+ $yc = array();
|
|
|
+ $bgqx = array();
|
|
|
+ $bg = array();
|
|
|
foreach($excel_array as $k=>$v) {
|
|
|
+ if(empty($v[2])){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
$data[$k]['id'] = UUIDs::uuid16();
|
|
|
$data[$k]['realname'] = $v[0];
|
|
|
- $data[$k]['doctor_title'] = $v[1];
|
|
|
+ $data[$k]['doctor_title'] = isset($v[1]) ? $v[1] : '';
|
|
|
$data[$k]['phone'] = $v[2];
|
|
|
$data[$k]['username'] = $v[2];
|
|
|
- $data[$k]['department_id'] = $this->getdid($v[3],$v[4]);
|
|
|
+ $data[$k]['department_id'] = $this->getdid(isset($v[3]) ? $v[3] : '',$v[4]);
|
|
|
$data[$k]['institution_id'] = $v[4];
|
|
|
$data[$k]['is_report'] = 0;
|
|
|
$data[$k]['password'] = md5('123456');
|
|
|
+ // 报告权限
|
|
|
+ $bgqx[$k]['doctor_id'] = $data[$k]['id'];
|
|
|
+ $bgqx[$k]['department_id'] = $data[$k]['department_id'];
|
|
|
+ $bgqx[$k]['doctor_class'] = $v[5];
|
|
|
+ $bgqx[$k]['id'] = UUIDs::uuid16();
|
|
|
+ if(!empty($v[6])){
|
|
|
+ // 本地报告权限
|
|
|
+ $bg[$k]['id'] = UUIDs::uuid16();
|
|
|
+ $bg[$k]['doctor_id'] = $data[$k]['id'];
|
|
|
+ $bg[$k]['pass'] = '80ddb7d09ebc44b4';
|
|
|
+ $bg[$k]['type'] = 1;
|
|
|
+ }
|
|
|
+ if(!empty($v[7])){
|
|
|
+ // 登记列表权限
|
|
|
+ $dj[$k]['id'] = UUIDs::uuid16();
|
|
|
+ $dj[$k]['doctor_id'] = $data[$k]['id'];
|
|
|
+ $dj[$k]['pass'] = '0eac42ef01de23ff';
|
|
|
+ $dj[$k]['type'] = 1;
|
|
|
+ }
|
|
|
+ if(!empty($v[8])){
|
|
|
+ // 远程列表权限
|
|
|
+ $yc[$k]['id'] = UUIDs::uuid16();
|
|
|
+ $yc[$k]['doctor_id'] = $data[$k]['id'];
|
|
|
+ $yc[$k]['pass'] = '0aa9d7b2fdf7268e';
|
|
|
+ $yc[$k]['type'] = 1;
|
|
|
+ }
|
|
|
}
|
|
|
- $success=Db::name('doctors')->insertAll($data); //批量插入数据
|
|
|
+ $success=Db::name('doctors')->insertAll($data); //批量插入数据
|
|
|
+ $pbg = DB::table('doctor_class')->insertAll($bgqx); //批评插入报告权限
|
|
|
+ $pyc = DB::table('dr_cla_permission')->insertAll($yc); //批评插入远程列表权限
|
|
|
+ $pdj = DB::table('dr_cla_permission')->insertAll($dj); //批评插入登记列表权限
|
|
|
+ $pbgl = DB::table('dr_cla_permission')->insertAll($bg); //批评插入报告列表权限
|
|
|
+ SysLogs::log("doctors", "c", '导入医生名单并分配权限,');
|
|
|
$this->success($success.'条插入成功');
|
|
|
// $error=$i-$success;
|
|
|
// echo "总{$i}条,成功{$success}条,失败{$error}条。";
|
|
@@ -361,6 +399,9 @@ class Doctors extends Base {
|
|
|
}
|
|
|
// $depa_name 科室名称 $ins_id 医疗机构id
|
|
|
public function getdid($depa_name,$ins_id){
|
|
|
+ if(empty($depa_name)){
|
|
|
+ return '';
|
|
|
+ }
|
|
|
$info = DB::table('department')->where('institution_id',$ins_id)->where('department_name',$depa_name)->find();
|
|
|
if($info){
|
|
|
return $info['id'];
|