lgy 6 лет назад
Родитель
Сommit
d4dc7f00cf

+ 44 - 3
application/manage/controller/Doctors.php

@@ -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'];

+ 8 - 1
application/manage/controller/Institution.php

@@ -82,12 +82,19 @@ class Institution extends Base {
         // ID有值,认为是更新
         if (empty($id)) {
             // 无值,认为是添加
-            $data["id"] = UUIDs::uuid16();
+            if(empty($parms['yid'])){
+                $data["id"] = UUIDs::uuid16();
+            }else{
+                $data["id"] = $parms['yid'];
+            }
             $data["createdAt"] = date("Y-m-d H:i:s");
             Db::table("institution")->insert($data);
             echo "insert_ok;" . $data["id"];
             SysLogs::log("institution", "C", json_encode($data));
         } else {
+            if(!empty($parms['yid'])){
+                $data["id"] = $parms['yid'];
+            }
             $data["updatedAt"] = date("Y-m-d H:i:s");
             // 更新
             Db::table("institution")->where("id", $id)->update($data);

+ 6 - 0
application/manage/view/institution/edit.html

@@ -78,6 +78,12 @@
                     <th width="105" height="38" align="right" >属性&nbsp;</th>
                     <th>信息</th>
             </tr>
+            <tr>
+                <th height="32" align="right" >医院ID:</th>
+                <td >
+                    <input name="yid" type="text" class="easyui-textbox" size="25" value="{if  isset($institution) }{$institution.id}{/if}" />
+                </td>
+            </tr>
             <tr>
                     <th height="32" align="right" >名称:</th>
                     <td >

+ 3 - 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php

@@ -2457,6 +2457,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
         $minRow = $rangeStart[1];
         $maxCol = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] -1);
         $maxRow = $rangeEnd[1];
+        $maxRow = 1000;
 
         $maxCol++;
         // Loop through rows
@@ -2493,10 +2494,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
                             );
                         }
                     } else {
+                        continue;
                         // Cell holds a NULL
                         $returnValue[$rRef][$cRef] = $nullValue;
                     }
                 } else {
+                    continue;
                     // Cell doesn't exist
                     $returnValue[$rRef][$cRef] = $nullValue;
                 }