where('id',$person_id)->first(); $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" ]); // return \Yz::Return(true,"",['data'=>$res]); $list = []; $keshi=[ 'A0030090'=>'内科', 'A0030091'=>'妇科', 'A0030102'=>'外科' ]; $keshi_sex_list=[ 'A0030116'=>'2', 'A0030106'=>'1' ]; if(isset($checkup_type) and $checkup_type == '4'){ $keshi_sex_list=[ 'A0030087'=>'1', 'A0030089'=>'2' ]; } if ($res['code'] == '200' && count($res['yisheng']) != 0) { foreach ($res['yisheng'] as $key => $value) { $keshiname=''; $keshi_sex=''; if(isset($keshi[$value['KSID']])){ $keshiname=$keshi[$value['KSID']]; } if(isset($keshi_sex_list[$value['KSID']])){ $keshi_sex=$keshi_sex_list[$value['KSID']]; } if($keshi_sex==$personInfo->sex){ $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'], 'keshiname'=>$keshiname, 'keshi_id'=>$value['KSID'], 'keshi_sex'=>$keshi_sex, ]; } } } $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 and $keshi_sex_list[$value2['KSID']]==$personInfo->sex){ $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]); } }