|
|
|
|
@ -7,6 +7,7 @@ use Illuminate\Database\Schema\Blueprint;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
|
use App\Services\OrderService;
|
|
|
|
|
|
|
|
|
|
class FenzhenController extends Controller
|
|
|
|
|
{
|
|
|
|
|
@ -33,30 +34,70 @@ class FenzhenController extends Controller
|
|
|
|
|
$info = DB::table('orders')->where(['id' => $id])->whereIn('status', [2, 4])->first();
|
|
|
|
|
if (!$info) return \Yz::echoError1("查询就诊人订单失败");
|
|
|
|
|
$end_time = date('H:i', strtotime($info->appointment_date . ' ' . $info->appointment_time) + (60 * 60 * 0.54));
|
|
|
|
|
$clinics = [];
|
|
|
|
|
$order = new OrderService();
|
|
|
|
|
$order_data = $order->DepartmentItemCount($info->id);
|
|
|
|
|
$clinics = $order_data['department_list'];
|
|
|
|
|
$report_day = $order_data['wait_day'];
|
|
|
|
|
$res = self::fz('time', [
|
|
|
|
|
'exam_id' => $info->tj_number ?? '??????????',
|
|
|
|
|
'start_time' => date('H:i', strtotime($info->appointment_date . ' ' . $info->appointment_time)),
|
|
|
|
|
'clinics' => [[
|
|
|
|
|
"name" => "外科诊室",
|
|
|
|
|
"count" => 3
|
|
|
|
|
], [
|
|
|
|
|
"name" => "内科诊室",
|
|
|
|
|
"count" => 3
|
|
|
|
|
]]
|
|
|
|
|
'clinics' => $clinics
|
|
|
|
|
]);
|
|
|
|
|
if (!!$res) {
|
|
|
|
|
$time_line = $res['data']['time_line'];
|
|
|
|
|
$clinic_map = [];
|
|
|
|
|
foreach ($time_line as $key => $item) {
|
|
|
|
|
$clinic_map[] = $item['name'];
|
|
|
|
|
}
|
|
|
|
|
$last_time = strtotime('2024-10-10 ' . $time_line[count($time_line) - 1]['time'] . ':00');
|
|
|
|
|
$push_end = false;
|
|
|
|
|
foreach ($clinics as $key => $item) {
|
|
|
|
|
if (!in_array($item['name'], $clinic_map)) {
|
|
|
|
|
$push_end = true;
|
|
|
|
|
$item_count = $item['count'];
|
|
|
|
|
$in_time = date('H:i', $last_time);
|
|
|
|
|
$time_line = array_merge(array_splice($time_line, 0, count($time_line) - 1), [
|
|
|
|
|
[
|
|
|
|
|
"desc" => "预计 $in_time 进入队列",
|
|
|
|
|
"more" => 0,
|
|
|
|
|
"name" => $item['name'],
|
|
|
|
|
"status" => 1,
|
|
|
|
|
"time" => "$in_time",
|
|
|
|
|
"tip" => "剩余{$item_count}项正在排队中,"
|
|
|
|
|
]
|
|
|
|
|
], [$time_line[count($time_line) - 1]]);
|
|
|
|
|
$last_time = $last_time + (60 * 5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($push_end) {
|
|
|
|
|
$in_time = date('H:i', $last_time);
|
|
|
|
|
$time_line = array_merge(array_splice($time_line, 0, count($time_line) - 1), [
|
|
|
|
|
[
|
|
|
|
|
"desc" => "结束时间 $in_time",
|
|
|
|
|
"more" => 0,
|
|
|
|
|
"name" => "体检结束",
|
|
|
|
|
"status" => -1,
|
|
|
|
|
"time" => "$in_time",
|
|
|
|
|
"tip" => ""
|
|
|
|
|
]
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
$check_report_status = -1;
|
|
|
|
|
if (!!$res['data']['report']) {
|
|
|
|
|
$report_time = date('m月d日', strtotime($res['data']['report'] . ' 00:00:00') + (60 * 60 * 24 * 5));
|
|
|
|
|
$report_time = strtotime($res['data']['report'] . ' 00:00:00') + (60 * 60 * 24 * $report_day);
|
|
|
|
|
$report_time_show = date('m月d日', $report_time);
|
|
|
|
|
$report_status = false;
|
|
|
|
|
// 这里补充 获取 出具报告 时间的逻辑
|
|
|
|
|
if (strtotime($report_time) < time()) {
|
|
|
|
|
$report_status = true;
|
|
|
|
|
}
|
|
|
|
|
if (!$report_status) {
|
|
|
|
|
$time_line[] = [
|
|
|
|
|
'time' => '',
|
|
|
|
|
'name' => '出具报告',
|
|
|
|
|
'status' => -1,
|
|
|
|
|
'desc' => "预计 $report_time 出具体检报告",
|
|
|
|
|
'desc' => "预计 $report_time_show 出具体检报告",
|
|
|
|
|
'tip' => '',
|
|
|
|
|
'more' => 0
|
|
|
|
|
];
|
|
|
|
|
@ -65,24 +106,36 @@ class FenzhenController extends Controller
|
|
|
|
|
'time' => '',
|
|
|
|
|
'name' => '出具报告',
|
|
|
|
|
'status' => -1,
|
|
|
|
|
'desc' => "已出具体检报告 $report_status",
|
|
|
|
|
'desc' => "已出具体检报告 $report_time_show",
|
|
|
|
|
'tip' => '',
|
|
|
|
|
'more' => 0
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
$check_report_time = $report_time + (60 * 60 * 24);
|
|
|
|
|
$check_report_status = 0;
|
|
|
|
|
// $check_report_status = '2024年10月11日';
|
|
|
|
|
// 这里补充 获取 报告解读 时间的逻辑
|
|
|
|
|
if ($check_report_status == 0) {
|
|
|
|
|
$check_report_time = date('m月d日', strtotime($res['data']['report'] . ' 00:00:00') + (60 * 60 * 24 * 6));
|
|
|
|
|
if (!$check_report_status) {
|
|
|
|
|
if ($check_report_time < time()) {
|
|
|
|
|
$time_line[] = [
|
|
|
|
|
'time' => '',
|
|
|
|
|
'name' => '报告解读',
|
|
|
|
|
'status' => -1,
|
|
|
|
|
'desc' => "预计 $check_report_time 可以预约报告解读",
|
|
|
|
|
'desc' => "可以预约报告解读",
|
|
|
|
|
'tip' => '',
|
|
|
|
|
'more' => 0
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
$check_report_time_show = date('m月d日', $check_report_time);
|
|
|
|
|
$time_line[] = [
|
|
|
|
|
'time' => '',
|
|
|
|
|
'name' => '报告解读',
|
|
|
|
|
'status' => -1,
|
|
|
|
|
'desc' => "预计 $check_report_time_show 可以预约报告解读",
|
|
|
|
|
'tip' => '',
|
|
|
|
|
'more' => 0
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$show_date = explode('年', $check_report_status)[1];
|
|
|
|
|
$time_line[] = [
|
|
|
|
|
@ -95,6 +148,7 @@ class FenzhenController extends Controller
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$res['data']['end_time'] = date('H:i', $last_time);
|
|
|
|
|
return \Yz::Return(true, "获取成功", [
|
|
|
|
|
'info' => [
|
|
|
|
|
'name' => $info->name,
|
|
|
|
|
@ -107,7 +161,7 @@ class FenzhenController extends Controller
|
|
|
|
|
'code' => $info->appointment_number,
|
|
|
|
|
],
|
|
|
|
|
'list' => $time_line,
|
|
|
|
|
'report' => $check_report_status,
|
|
|
|
|
'report' => $check_report_status
|
|
|
|
|
]);
|
|
|
|
|
} else {
|
|
|
|
|
return \Yz::Return(true, "获取成功", [
|
|
|
|
|
|