更新 体检引导

main
鹿和sa0ChunLuyu 1 year ago
parent 7ddedbf5c2
commit e9b587280a

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

@ -188,10 +188,10 @@
</view> </view>
</view> </view>
<view v-if="fenzhen_list.report !== -1" class="report_wrapper"> <view v-if="fenzhen_list.report !== -1" class="report_wrapper">
<view v-if="fenzhen_list.report !== 0" class="report_tip_wrapper"> <view v-if="fenzhen_list.report !== 0 && fenzhen_list.report !== 1" class="report_tip_wrapper">
已预约 {{ fenzhen_list.report }} 报告解读 已预约 {{ fenzhen_list.report }} 报告解读
</view> </view>
<view v-else @click="toReport()" class="report_button_wrapper"> <view v-else-if="fenzhen_list.report === 1" @click="toReport()" class="report_button_wrapper">
预约解读 预约解读
</view> </view>
</view> </view>
@ -323,6 +323,9 @@
line-height: 40rpx; line-height: 40rpx;
height: 40rpx; height: 40rpx;
margin-left: 22rpx; margin-left: 22rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
.time_line_item_flex_wrapper { .time_line_item_flex_wrapper {

Loading…
Cancel
Save