审查视图

app/index/model/CollocationModel.php 1.3 KB
王晓刚 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/27
 * Time: 16:34
 */

namespace app\index\model;


use think\Model;

class CollocationModel extends Model
{
    //保单总数
    public function collocationCount($where){
        $where['delete_time'] = ['eq',0];
        $data = $this->where($where)->count();
        return $data;
    }
    //被保人数
    public function peopleCount($where){
        $where['delete_time'] = ['eq',0];
        $data = $this->where($where)->group('insurer')->count();
        return $data;
    }
    //本年保险支出
    public function totalSum($where){
王晓刚 authored
30
        $where['delete_time'] = ['=',0];
王晓刚 authored
31
//        $where['expire_time'] = ['>',time()];//判断保单是否还在缴费期限内
王晓刚 authored
32
        $data= $this->where($where)->sum('pay_method_price');
王晓刚 authored
33 34 35
        return $data;
    }
    //获取全部被保人
王晓刚 authored
36
    public function insurerData($where,$group = null){
王晓刚 authored
37
        $where['delete_time'] = ['eq',0];
王晓刚 authored
38
        $data = $this->where($where)->group($group)->select()->toArray();
王晓刚 authored
39 40
        return $data;
    }
王晓刚 authored
41
    public function findData($where){
王晓刚 authored
42 43 44
        $data = $this
            ->alias('c')
            ->field('c.*,i_c.insurance_company_name')
王晓刚 authored
45
            ->join('cmf_insurance_company i_c','i_c.id = c.insurance_company_id')
王晓刚 authored
46
            ->where($where)->find();
王晓刚 authored
47 48
        return $data;
    }
王晓刚 authored
49
}