|
|
<?php
|
|
|
|
|
|
namespace App\Http\Controllers\API\H5;
|
|
|
|
|
|
use App\Http\Controllers\API\AspNetZhuanController;
|
|
|
use App\Http\Controllers\Controller;
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
class DoctorController extends Controller
|
|
|
{
|
|
|
//获取体检医生列表
|
|
|
public function GetList()
|
|
|
{
|
|
|
$date = request('date');
|
|
|
$hospital = request('hospital');
|
|
|
$month = request('month');
|
|
|
$doctor_id = request('doctor_id');
|
|
|
|
|
|
$hospital_map = [
|
|
|
'h1' => '6',
|
|
|
'h4' => '2',
|
|
|
];
|
|
|
$datesArray = [];
|
|
|
if (isset($date)) {
|
|
|
$datesArray[] = $date;
|
|
|
}
|
|
|
if (isset($month) and $month == 'all') {
|
|
|
// 循环30次,每次获取一天后的日期
|
|
|
for ($i = 0; $i < 31; $i++) {
|
|
|
// 使用strtotime函数计算$i天后的日期,然后用date函数格式化日期
|
|
|
$datesArray[] = date('Y-m-d', strtotime("+$i days"));
|
|
|
}
|
|
|
}
|
|
|
if (isset($month) and (strlen($month) == 7 or strlen($month) == 6)) {
|
|
|
$firstDay = strtotime($month . '-01');
|
|
|
// 获取该月的最后一天
|
|
|
$lastDay = strtotime('+1 month', $firstDay) - 86400; // 减去一天的秒数(86400秒),得到最后一天
|
|
|
// 从第一天到最后一天,逐天添加到数组中
|
|
|
$currentDay = $firstDay;
|
|
|
while ($currentDay <= $lastDay) {
|
|
|
$datesArray[] = date('Y-m-d', $currentDay);
|
|
|
$currentDay = strtotime('+1 day', $currentDay);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (empty($datesArray)) return \Yz::Return(false,"参数错误");
|
|
|
$dnet = new AspNetZhuanController();
|
|
|
$res = $dnet->GetDoctorDateList([
|
|
|
"yyid" => $hospital_map["h$hospital"],
|
|
|
"data" => $datesArray,
|
|
|
"action" => "1"
|
|
|
]);
|
|
|
$list = [];
|
|
|
if ($res['code'] == '200' && count($res['yisheng']) != 0) {
|
|
|
foreach ($res['yisheng'] as $key => $value) {
|
|
|
$list[] = [
|
|
|
'head_img' => 'data:image/jpeg;base64,' . $value['U_IMG'],
|
|
|
'name' => $value['U_NAME'],
|
|
|
'id' => $value['U_ID'],
|
|
|
'level' => $value['ZC_NAME'],
|
|
|
'hospital' => '',
|
|
|
'time' => $value['U_GDPB'],
|
|
|
'desc' => $value['U_JIANJIE'],
|
|
|
];
|
|
|
}
|
|
|
}
|
|
|
$paiban=[];
|
|
|
$dates=[];
|
|
|
if(isset($month) and (strlen($month) == 7 or strlen($month) == 6) and isset($doctor_id)){
|
|
|
$k=0;
|
|
|
|
|
|
foreach ($res['paiban'] as $key => $date_value) {
|
|
|
foreach ($date_value as $key2 => $value2) {
|
|
|
if($value2['YSID']==$doctor_id){
|
|
|
$paiban[]=$value2;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
$firstDay = date("Y-m-d", strtotime($month . "-01"));
|
|
|
// 获取当月的最后一天
|
|
|
$lastDay = date("Y-m-t", strtotime($month));
|
|
|
for ($i = $firstDay; $i <= $lastDay; $i = date("Y-m-d", strtotime($i . " +1 day"))) {
|
|
|
|
|
|
foreach ($paiban as $key => $value) {
|
|
|
if(date('Y-m-d', strtotime($value['PBRQ']))==$i){
|
|
|
$dates[]=[
|
|
|
'date'=>$i,
|
|
|
'paiban'=>$value,
|
|
|
];
|
|
|
}
|
|
|
}
|
|
|
$k++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
return \Yz::Return(true, "查询完成", ['list' => $list, 'paiban' => $dates]);
|
|
|
}
|
|
|
|
|
|
}
|