|
|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
namespace App\Http\Controllers\API\H5;
|
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use DateTime;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
|
|
@ -36,7 +37,36 @@ class PlanController extends Controller
|
|
|
|
|
}
|
|
|
|
|
$list=$list->select('date', DB::raw('COUNT(*) as count'));
|
|
|
|
|
$list=$list->groupBy('date')->get();
|
|
|
|
|
return \Yz::Return(true,"查询完成",['list'=>$list]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取整月日期
|
|
|
|
|
// 获取当月的第一天
|
|
|
|
|
$firstDay = date("Y-m-d", strtotime($month . "-01"));
|
|
|
|
|
// 获取当月的最后一天
|
|
|
|
|
$lastDay = date("Y-m-t", strtotime($month));
|
|
|
|
|
$dates = array();
|
|
|
|
|
$k=0;
|
|
|
|
|
for ($i = $firstDay; $i <= $lastDay; $i = date("Y-m-d", strtotime($i . " +1 day"))) {
|
|
|
|
|
$xingqi=\App\Lib\Tools::GetWeekName($i);
|
|
|
|
|
$dates[]=[
|
|
|
|
|
'date'=>$i,
|
|
|
|
|
'xingqi'=>$xingqi,
|
|
|
|
|
'count'=>0
|
|
|
|
|
];
|
|
|
|
|
foreach ($list as $item) {
|
|
|
|
|
if($item->date == $i){
|
|
|
|
|
$dates[$k]=[
|
|
|
|
|
'date'=>$i,
|
|
|
|
|
'xingqi'=>$xingqi,
|
|
|
|
|
'count'=>$item->count
|
|
|
|
|
];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$k++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return \Yz::Return(true,"查询完成",['list'=>$dates]);
|
|
|
|
|
}
|
|
|
|
|
//获取某日号源列表
|
|
|
|
|
public function GetDayPlanList()
|
|
|
|
|
@ -61,7 +91,54 @@ class PlanController extends Controller
|
|
|
|
|
$list=$list->where(['amount_limit2'=>0])->orWhere('amount_limit2','>=',$amount);
|
|
|
|
|
}
|
|
|
|
|
$list=$list->get();
|
|
|
|
|
return \Yz::Return(true,"查询完成",['list'=>$list]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取前后各三天的日期
|
|
|
|
|
$dateTime = new DateTime($date);
|
|
|
|
|
$days7=[];
|
|
|
|
|
for ($i = -3; $i <= 3; $i++) {
|
|
|
|
|
$dateTimeClone = clone $dateTime; // 克隆对象以避免修改原对象
|
|
|
|
|
$dateTimeClone->modify("$i days"); // 修改日期
|
|
|
|
|
$days7[] = $dateTimeClone->format('Y-m-d'); // 按照需要的格式添加到结果数组
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$weeklist=DB::table('plans')
|
|
|
|
|
->whereBetween('date',[$days7[0],$days7[6]])->whereIn('status',[1])
|
|
|
|
|
->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [$checkup_type_id])
|
|
|
|
|
->where(['hospital_id'=>$hospital_id,'type'=>1])
|
|
|
|
|
->whereIn('use_type',[0,$use_type]);
|
|
|
|
|
if($use_type==1){
|
|
|
|
|
$weeklist=$weeklist->where(['amount_limit1'=>0])->orWhere('amount_limit1','>=',$amount);
|
|
|
|
|
}
|
|
|
|
|
if($use_type==2){
|
|
|
|
|
$weeklist=$weeklist->where(['amount_limit2'=>0])->orWhere('amount_limit2','>=',$amount);
|
|
|
|
|
}
|
|
|
|
|
$weeklist=$weeklist->select('date', DB::raw('COUNT(*) as count'));
|
|
|
|
|
$weeklist=$weeklist->groupBy('date')->get();
|
|
|
|
|
$week7=[];
|
|
|
|
|
$k=0;
|
|
|
|
|
foreach ($days7 as $date) {
|
|
|
|
|
$xingqi=\App\Lib\Tools::GetWeekName($date);
|
|
|
|
|
$week7[]=[
|
|
|
|
|
'date'=>$date,
|
|
|
|
|
'count'=>0,
|
|
|
|
|
'xingqi'=>$xingqi
|
|
|
|
|
];
|
|
|
|
|
foreach ($weeklist as $plan) {
|
|
|
|
|
if($plan->date == $date){
|
|
|
|
|
$week7[$k]=[
|
|
|
|
|
'date'=>$date,
|
|
|
|
|
'xingqi'=>$xingqi,
|
|
|
|
|
'count'=>$plan->count
|
|
|
|
|
];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$k++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return \Yz::Return(true,"查询完成",['list'=>$list,'weeklist'=>$week7]);
|
|
|
|
|
}
|
|
|
|
|
//检查号源是否可用
|
|
|
|
|
public function CheckPlan($plan_id,$hospital_id,$type,$sex,$price,$checkup_type_id)
|
|
|
|
|
|