model = new \app\admin\model\remote\Remote; } /** * 查看 */ public function index() { //设置过滤方法 $this->request->filter(['strip_tags']); if ($this->request->isAjax()) { //如果发送的来源是Selectpage,则转发到Selectpage if ($this->request->request('keyField')) { return $this->selectpage(); } list($where, $sort, $order, $offset, $limit) = $this->buildparams(); $field = [ 'id','name','sex','age','local_institution_id','local_institution_name','req_date_time', 'remote_institution_id','remote_institution_name','req_doctor_id','req_doctor_name','report_status', 'remote_doctor_id','remote_doctor_name' ]; // 过滤机构 $childInsIds = $this->auth->getMyInsId(); if($childInsIds == false){ $more = false; } else { $c_ids = implode(',', $childInsIds); $more = "(`local_institution_id` IN ($c_ids) OR `remote_institution_id` IN ($c_ids))"; } $total = $this->model ->where($where) ->where(($more)) ->where('status','0') ->order($sort, $order) ->count(); $list = $this->model ->where($where) ->where($more) ->where('status','0') ->order($sort, $order) ->limit($offset, $limit) ->field($field) ->select(); $list = collection($list)->toArray(); $result = array("total" => $total, "rows" => $list); return json($result); } return $this->view->fetch(); } public function schedule($ids) { $field = [ 'remote.*','order.updatedAt as pay_time','order.order_money', 'report.report_doctor_name','report.report_datetime','report.review_datetime','report.review_doctor_name', 'exams.exam_status' ]; $remote = $this->model->alias('remote') ->join('remote_order order','remote.id = order.application_id', 'LEFT') ->join('report','remote.id = report.remote_application_id', 'LEFT') ->join('exams','remote.exam_id = exams.id', 'LEFT') ->where('remote.id', $ids) ->field($field) ->find(); $status = $remote['report_status']; $schedule = 1; switch ($status){ case '4': case '5': $schedule = 1; break; case '6': $schedule = 3; break; case '7': $schedule = 4; break; case '8': $schedule = 5; break; case '9': $schedule = 6; break; default; } if($status == '11' || $status == '12'){ if(!empty($remote['review_doctor_name'])){ $schedule = 5; } elseif (!empty($remote['report_doctor_name'])) { $schedule = 4; } else{ $schedule = 3; } } if($remote['exam_status'] == '9'){ $schedule = 7; } $this->view->assign('schedule',$schedule); $this->view->assign('remote', $remote); return $this->view->fetch(); } }