Ejemplo n.º 1
0
 public function get_allbookdatetime_data_by_date($date, $doctor_id = 0)
 {
     $am_book_datetime = date_time_joint($date, $this->sys_configs['bh_am_start'], $this->sys_configs['bh_am_end'], $this->sys_configs['am_time_interval']);
     $pm_book_datetime = date_time_joint($date, $this->sys_configs['bh_pm_start'], $this->sys_configs['bh_pm_end'], $this->sys_configs['pm_time_interval']);
     $all_book_datetime = array_merge($am_book_datetime, $pm_book_datetime);
     if ($doctor_id) {
         $where['doctor_id'] = $doctor_id;
     }
     $data = array();
     foreach ($all_book_datetime as $key => $datetime) {
         $where['book_date'] = $datetime;
         $this->db->select('appointment.*,doctor.name as doctor_name');
         $this->db->join('doctor', 'doctor.id = appointment.doctor_id');
         $query = $this->get_query_by_where($where);
         if ($query->num_rows()) {
             $data[] = $query->row_array();
         } else {
             foreach ($this->table_fields as $key => $filed) {
                 $row[$filed] = $filed == 'book_date' ? trans_date_format($datetime, 'Y-m-d H:i:s') : '';
                 if ($filed == 'is_show') {
                     $row[$filed] = 1;
                 }
             }
             $data[] = $row;
         }
     }
     return $data;
 }
Ejemplo n.º 2
0
 public function index()
 {
     checkPermission('book_view');
     $this->data['name'] = $q = $this->input->get_post('q');
     //预约人姓名
     $this->data['book_date'] = $book_date = $this->input->get_post('book_date') ? $this->input->get_post('book_date') : date('Y-m-d');
     //预约人时间
     $this->data['doctor_id'] = $doctor_id = $this->input->get_post('doctor_id');
     //预约医生
     $this->data['start'] = $start = $this->input->get_post('page') ? $this->input->get_post('page') : 1;
     $this->data['pageSize'] = $pageSize = $this->input->get_post('pageSize') ? $this->input->get_post('pageSize') : 20;
     $like = array();
     $where = array();
     if ($q) {
         $like['appointment.name'] = $q;
     } else {
         if ($book_date) {
             $book_date = trans_date_format($book_date, 'Y-m-d');
             $this->data['book_date'] = $book_date;
             $where['book_date >'] = $book_date;
             $where['book_date <'] = date('Y-m-d', strtotime('+1 day', strtotime($book_date)));
         }
     }
     if ($doctor_id) {
         $where['doctor_id'] = $doctor_id;
     }
     //查询数据的总量,计算出页数
     $this->db->where($where);
     $this->db->or_like($like);
     $query = $this->general_mdl->get_query();
     $this->data['total'] = $query->num_rows();
     $page = ceil($query->num_rows() / $pageSize);
     $this->data['page'] = $page;
     //取出当前面数据
     $this->db->select('appointment.*,doctor.name as doctor_name');
     $this->db->join('doctor', 'doctor.id = appointment.doctor_id');
     $this->db->where($where);
     $this->db->or_like($like);
     $query = $this->general_mdl->get_query(($start - 1) * $pageSize, $pageSize, 'book_date ASC');
     $book_data = $query->result_array();
     $this->data['current_page'] = $start;
     $prev_link = $this->data['controller_url'] . '?page=' . ($start - 1);
     $prev_link .= $q ? '&q=' . $q : '';
     $next_link = $this->data['controller_url'] . '?page=' . ($start + 1);
     $next_link .= $q ? '&q=' . $q : '';
     $this->data['prev_link'] = $prev_link;
     $this->data['next_link'] = $next_link;
     $page_link = array();
     for ($i = 1; $i <= $page; $i++) {
         $page_link[$i] = $this->data['controller_url'] . '?page=' . $i;
         $page_link[$i] .= $q ? '&q=' . $q : '';
         $page_link[$i] .= $book_date ? '&book_date=' . $book_date : '';
     }
     $this->data['page_links'] = $page_link;
     $this->data['result'] = $book_data;
     $this->data['title'] = '预约管理';
     $this->load->view('admin_book/list', $this->data);
 }
Ejemplo n.º 3
0
 public function book_list()
 {
     $book_date = $this->input->get_post('book_date') ? $this->input->get_post('book_date') : date('Y-m-d');
     $doctor_id = $this->input->get_post('doctor_id');
     $book_data = trans_date_format($book_date, 'Y-m-d');
     $this->data['cn_book_date'] = trans_date_format($book_data, 'Y年m月d日');
     $this->data['doctor'] = '';
     if ($doctor_id) {
         $doctor = $this->db->where('id', $doctor_id)->get('doctor')->row();
         $this->data['doctor'] = $doctor->name;
     }
     $book_data = $this->book_mdl->get_allbookdatetime_data_by_date($book_data, $doctor_id);
     $this->data['result'] = $book_data;
     $this->load->view('front/book_list', $this->data);
 }
Ejemplo n.º 4
0
function getBorrowList($parm = array(), $countonly = false)
{
    if (empty($parm['map'])) {
        return;
    }
    $map = $parm['map'];
    $orderby = $parm['orderby'];
    //$map = array_merge($map,$search);
    if ($countonly) {
        return M('borrow_info b')->where($map)->count('b.id');
    }
    if ($parm['pagesize']) {
        //分页处理
        import("ORG.Util.Page");
        $count = M('borrow_info b')->where($map)->count('b.id');
        $p = new Page($count, $parm['pagesize']);
        $page = $p->show();
        $Lsql = "{$p->firstRow},{$p->listRows}";
        //分页处理
    } else {
        $page = "";
        $Lsql = "{$parm['limit']}";
    }
    $pre = C('DB_PREFIX');
    $suffix = C("URL_HTML_SUFFIX");
    $field = "b.id,b.borrow_name,b.borrow_type,b.reward_type,b.borrow_times,b.borrow_status,b.borrow_money,b.borrow_use,b.repayment_type,b.borrow_interest_rate,b.borrow_duration,b.collect_time,b.province,b.has_borrow,b.has_vouch,b.city,b.area,b.reward_type,b.reward_num,b.password,b.borrow_info,m.user_name,m.id as uid,m.credits,m.customer_name,b.is_tuijian,b.pro_provide,b.first_verify_time,b.schedular_time";
    if ($parm['hotest']) {
        $field .= ",IFNULL(b.`full_time`,0)-IFNULL(bv.`deal_time`,0) finish_time";
        $list = M('borrow_info')->alias("b")->field($field)->join("{$pre}members m ON m.id=b.borrow_uid")->join("{$pre}borrow_verify bv ON b.id=bv.borrow_id")->where($map)->order($orderby)->limit($Lsql)->select();
    } else {
        $list = M('borrow_info')->alias("b")->field($field)->join("{$pre}members m ON m.id=b.borrow_uid")->where($map)->order($orderby)->limit($Lsql)->select();
    }
    $areaList = getArea();
    foreach ($list as $key => $v) {
        $list[$key]['location'] = $areaList[$v['province']] . $areaList[$v['city']];
        $list[$key]['biao'] = $v['borrow_times'];
        $list[$key]['need'] = $v['borrow_money'] - $v['has_borrow'];
        $list[$key]['leftdays'] = getLeftTime($v['collect_time']);
        $list[$key]['progress'] = getFloatValue($v['has_borrow'] / $v['borrow_money'] * 100, 2);
        $list[$key]['vouch_progress'] = getFloatValue($v['has_vouch'] / $v['borrow_money'] * 100, 2);
        $list[$key]['burl'] = MU("Home/invest", "invest", array("id" => $v['id'], "suffix" => $suffix));
        $list[$key]['schedular_time'] = trans_date_format($v['schedular_time'], 'Y-m-d');
    }
    $row = array();
    $row['list'] = $list;
    $row['page'] = $page;
    return $row;
}
Ejemplo n.º 5
0
    ?>
</td>
                        <td>
                            <?php 
    if (!$row['id'] && $row['is_show'] == 1) {
        ?>
                            <button data-toggle="modal" data-target="#myModal" onclick="book_dialog('<?php 
        echo $row['book_date'];
        ?>
')" class="btn btn-success btn-lg" type="button">预约</button>
                            <?php 
    }
    ?>
                        </td>
                        <td><?php 
    echo trans_date_format($row['book_date'], "Y-m-d H:i");
    ?>
</td>
                        <?php 
    if ($row['is_show'] == 1) {
        ?>
                        <td <?php 
        echo $row['name'] ? '' : 'class="text-danger"';
        ?>
 ><?php 
        echo $row['name'] ? str_pad(substr_ext($row['name'], 0, 1), 5, '*', STR_PAD_RIGHT) : '无预约';
        ?>
</td>
                        <td <?php 
        echo $row['name'] ? '' : 'class="text-danger"';
        ?>