You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?php
|
|
namespace App\Services\Admin\YeWu;
|
|
use Illuminate\Support\Facades\DB;
|
|
class AppointmentService
|
|
{
|
|
//获取体检记录列表
|
|
public function GetAppointmentList($arr){
|
|
$sql=' where 1=1';
|
|
$canshu=array();
|
|
if($arr['searchInfo']['status']){
|
|
$sql=$sql .' and a.status = ? ';
|
|
array_push($canshu, $arr['searchInfo']['status']);
|
|
}
|
|
if($arr['searchInfo']['calendarId']){
|
|
$sql=$sql .' and a.calendar_id = ? ';
|
|
array_push($canshu, $arr['searchInfo']['calendarId']);
|
|
}
|
|
|
|
|
|
if($arr['searchInfo']['dateRange']){
|
|
|
|
$sql=$sql . ' and a.date>=? and a.date<=? ';
|
|
array_push($canshu,$arr['searchInfo']['dateRange'][0],$arr['searchInfo']['dateRange'][1]);
|
|
}
|
|
|
|
|
|
if($arr['group']==7){
|
|
$cha=DB::table('medical_institution')->where(['link_user_id'=>$arr['userid']])->get();
|
|
$sql=$sql .' and a.org_id=?';
|
|
array_push($canshu, $cha[0]->id);
|
|
}else{
|
|
if($arr['searchInfo']['orgId']){
|
|
|
|
$sql=$sql .' and a.org_id=?';
|
|
array_push($canshu, $arr['searchInfo']['orgId']);
|
|
}
|
|
|
|
}
|
|
|
|
array_push($canshu,($arr['page']-1)*$arr['pageSize'],$arr['pageSize']);
|
|
|
|
$query=DB::select("select a.*,b.org_name from appointment_record as a LEFT JOIN
|
|
medical_institution as b on a.org_id=b.id ".$sql." order by a.id desc limit ?,?",$canshu);
|
|
|
|
$count=DB::select("select count(*) as c from appointment_record as a ".$sql,$canshu);
|
|
return \Yz::Return(true,'',['list'=>$query,'count'=>$count[0]->c]);
|
|
|
|
}
|
|
}
|