123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- namespace app\common\model;
- /**
- * 员工信息表
- * Class StaffModel
- * @package app\common\model
- */
- class DoctorModel extends BaseModel
- {
- protected $table = 'doctor';
- /**
- *添加医生
- *@param array 医院信息
- *@return int 医院id
- */
- public function doctor_add($params){
- return $this->kuyun_insert($params,'');
- }
- /**
- *查询医生单条信息
- *@param array 查询条件
- *@return array 医生信息
- */
- public function doctor_find($where){
- return $this->kuyun_find($where,'','');
- }
- /**
- *查询所有的医生
- *@param array 联合查询
- *@param string 查询字段
- *@param int 页码
- *@param bull 是否查数量
- *@return array 医生信息
- */
- public function doctor_select($join,$field,$page,$is_count){
- return $this->kuyun_select('',$join,'',$field,'',$page,$is_count);
- }
- /**
- *编辑医生
- *@param array 添加的数据
- *@param array 条件
- *@return int
- */
- public function doctor_edit($data,$where){
- return $this->kuyun_insert($data,$where);
- }
- /**
- *删除医生
- *@param array 删除条件
- *@return int 返回删除id
- */
- public function doctor_delete($where){
- return $this->kuyun_delete($where);
- }
- public function getDoctorPage($page,$pageSize,$condition=[],$is_count = false,$order=''){
- $join=[
- ['hospital h','doctor.hospital_id=h.hospital_id','LEFT'],
- ['department d','doctor.department_id = d.department_id','LEFT']
- ];
- $this->alias('doctor');
- $field=['doctor.*,h.name as hospital_name,d.department_name'];
- if($is_count){
- $res=$this->where($condition)->page($page,$pageSize)->count();
- }else{
- if($order){
- $this->order($order);
- }
- if(empty($condition)){
- $this->where($condition);
- }
- $res=$this->join($join)->where($condition)->page($page,$pageSize)->column($field);
- }
- return $res;
- }
- }
|