CollocationModel.php 1.3 KB
<?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){
        $where['delete_time'] = ['=',0];
//        $where['expire_time'] = ['>',time()];//判断保单是否还在缴费期限内
        $data= $this->where($where)->sum('insurance_price');
        return $data;
    }
    //获取全部被保人
    public function insurerData($where,$group = null){
        $where['delete_time'] = ['eq',0];
        $data = $this->where($where)->group($group)->select()->toArray();
        return $data;
    }
    public function findData($where){
        $data = $this
            ->alias('c')
            ->field('c.*,i_c.insurance_company_name')
            ->join('cmf_insurance_company i_c','i_c.id = c.insurance_company_id')
            ->where($where)->find();
        return $data;
    }
}