You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

152 lines
4.7 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
namespace App\Http\Controllers\API\H5;
use App\Http\Controllers\Controller;
use App\Services\ConfigService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class HomeController extends Controller
{
// 获取配置更新时间
public function config_version()
{
$version = DB::table('configs')->where(['label' => 'H5配置版本'])->first();
$version = $version->value;
return \Yz::Return(true, '获取成功', [
'version' => $version
]);
}
// 获取配置更新时间
public function config()
{
$hospitals = DB::table('hospitals')
->select("id", "name", "latitude", "longitude", "logo","address")
->where(['status' => 1, 'is_del' => 0])->get();
if (count($hospitals) < 1) return \Yz::echoError1('暂无可用医院信息');
$db_config = DB::table('configs')->whereIn('label', ['首页欢迎词', '首页banner'])->get();
$config = [
'hospital' => $hospitals,
// [[
// 'id' => 1,
// 'name' => '秀英院区',
// 'latitude' => '39.867671',
// 'longitude' => '119.514223',
// ]]
'tip' => $this->getValueByLabel($db_config, '首页欢迎词'),
'logo' => $hospitals[0]->logo,
'banner' => [
'image' => $this->getValueByLabel($db_config, '首页banner'),
'jump' => 'https://www.hnxd.org/list-jkglzx.html',
],
'order' => [[
'message' => '',
'name' => '个人体检预约',
'jump' => '/pages/buy/choose/choose?url=api://CheckUpTypeGetList',
'icon' => '/assets/h5/gejianyuyue.png'
], [
'message' => '',
'name' => '单位体检预约',
'jump' => '/pages/main/tj/choose',
'icon' => '/assets/h5/tuanjianyuyue.png'
]],
'button' => [[[
'message' => '暂未开放',
'name' => '健康问卷',
'jump' => '/pages/main/cjwt/cjwt',
'icon' => '/assets/h5/changjianwenti.png'
],
// [
// 'message' => '暂未开放',
// 'name' => '预检咨询',
// 'jump' => '/pages/main/cjwt/cjwt',
// 'icon' => '/assets/h5/changjianwenti.png'
// ],
[
'message' => '暂未开放',
'name' => '体检注意事项',
'jump' => '/pages/main/zysx/zysx',
'icon' => '/assets/h5/zhuyishixiang.png'
], [
'message' => '暂未开放',
'name' => '体检引导',
'jump' => '/pages/main/cjwt/cjwt',
'icon' => '/assets/h5/changjianwenti.png'
]], [[
'message' => '',
'name' => '解读报告',
'jump' => 'XCX/pages/other/entry/index?path=/pages/outpatient/doctor-appointment/index&scene=1035&hospitalAreaId=6&departmentCode=A0030077&subDepartmentCode=4773794195699464904',
'icon' => '/assets/h5/changjianwenti.png'
], [
'message' => '暂未开放',
'name' => '健康指导',
'jump' => '/pages/main/cjwt/cjwt',
'icon' => '/assets/h5/changjianwenti.png'
], [
'message' => '暂未开放',
'name' => '满意度调查',
'jump' => '/pages/main/myddc/myddc',
'icon' => '/assets/h5/manyidudiaocha.png'
]], [[
'message' => '暂未开放',
'name' => '报告查询',
'jump' => '/pages/main/cjwt/cjwt',
'icon' => '/assets/h5/changjianwenti.png'
], [
'message' => '暂未开放',
'name' => '检后复查',
'jump' => '/pages/main/cjwt/cjwt',
'icon' => '/assets/h5/changjianwenti.png'
], [
'message' => '',
'name' => '我的订单',
'jump' => '/pages/main/order/order',
'icon' => '/assets/h5/changjianwenti.png'
]]
],
'color' => true,
];
return \Yz::Return(true, '获取成功', [
'config' => $config
]);
}
//点击个检获取页面按钮
public function GetGeJianButtonList()
{
$list = [
[
'message' => '暂未开放',
'name' => '检前健康评估',
'url' => '/pages/main/order/order',
'logo' => '/assets/h5/zhuyishixiang.png'
],
[
'message' => '暂未开放',
'name' => '套餐预约',
'url' => '/pages/main/combo/combo',
'logo' => '/assets/h5/zhuyishixiang.png'
],
[
'message' => '暂未开放',
'name' => '项目自选',
'url' => '/pages/main/optionalProject/optionalProject',
'logo' => '/assets/h5/zhuyishixiang.png'
]
];
return \Yz::Return(true, "查询完成", ['list' => $list]);
}
function getValueByLabel($items, $label)
{
foreach ($items as $item) {
if ($item->label === $label) {
return $item->value;
}
}
return null; // 如果没有找到匹配的 label则返回 null
}
}