|
|
<?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 BaseInfo(){
|
|
|
$openid = request('openid');
|
|
|
$hospital_id = request('hospital_id');
|
|
|
$user = DB::table('web_users')->where(['openid' => $openid, 'is_del' => 0])->first();
|
|
|
if (!$user) return \Yz::echoError1("openid对应用户不存在");
|
|
|
$person = DB::table('web_user_person')->where(['user_id' => $user->id, 'is_del' => 0, 'is_default' => 1])->first();
|
|
|
if (!$person) return \Yz::echoError1("请选择就诊人");
|
|
|
$personCount = DB::table('web_user_person')->where(['user_id' => $user->id, 'is_del' => 0])->count();
|
|
|
$hospital=DB::table('hospitals')->where(['id' => $hospital_id])->first();
|
|
|
if (!$hospital) {
|
|
|
return \Yz::echoError1("医院不存在");
|
|
|
}
|
|
|
$info =[
|
|
|
'person' => [
|
|
|
'name' => $person->name,
|
|
|
'sex' => $person->sex,
|
|
|
'count' => $personCount
|
|
|
],
|
|
|
'hospital' => [
|
|
|
'name' => $hospital->name,
|
|
|
]
|
|
|
] ;
|
|
|
return \Yz::Return(true, '获取成功', $info);
|
|
|
}
|
|
|
|
|
|
// 获取配置更新时间
|
|
|
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/question/choose/choose',
|
|
|
'icon' => '/assets/h5/a_jiankangwenjuan.png'
|
|
|
],
|
|
|
// [
|
|
|
// 'message' => '暂未开放',
|
|
|
// 'name' => '预检咨询',
|
|
|
// 'jump' => '/pages/main/cjwt/cjwt',
|
|
|
// 'icon' => '/assets/h5/changjianwenti.png'
|
|
|
// ],
|
|
|
[
|
|
|
'message' => '',
|
|
|
'name' => '体检注意事项',
|
|
|
'jump' => '/pages/posts/posts/posts?type=2',
|
|
|
'icon' => '/assets/h5/a_tijianzhuyishixiang.png'
|
|
|
], [
|
|
|
'message' => '',
|
|
|
'name' => '体检引导',
|
|
|
'jump' => '/pages/user/pick/pick',
|
|
|
'icon' => '/assets/h5/a_tijianyindao.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/a_jiedubaogao.png'
|
|
|
], [
|
|
|
'message' => '',
|
|
|
'name' => '健康指导',
|
|
|
'jump' => '/pages/posts/posts/posts?type=1',
|
|
|
'icon' => '/assets/h5/a_jiankangzhidao.png'
|
|
|
], [
|
|
|
'message' => '',
|
|
|
'name' => '满意度调查',
|
|
|
'jump' => '/pages/main/questionnaire/index',
|
|
|
// 'jump' => 'https://www.wjx.cn/vm/Q9A0NRI.aspx',
|
|
|
'icon' => '/assets/h5/a_manyidudiaocha.png'
|
|
|
]], [[
|
|
|
'message' => '',
|
|
|
'name' => '报告查询',
|
|
|
'jump' => '/pages/main/bgcx/bgcx',
|
|
|
'icon' => '/assets/h5/a_baogaochaxun.png'
|
|
|
],
|
|
|
[
|
|
|
'message' => '',
|
|
|
'name' => '健康宣教',
|
|
|
'jump' => '/pages/posts/posts/posts?type=4',
|
|
|
'icon' => '/assets/h5/xuanjiao.png'
|
|
|
],
|
|
|
|
|
|
[
|
|
|
'message' => '',
|
|
|
'name' => '我的订单',
|
|
|
'jump' => '/pages/main/order/order',
|
|
|
'icon' => '/assets/h5/a_wodedingdan.png'
|
|
|
]
|
|
|
|
|
|
]
|
|
|
],
|
|
|
'color' => true,
|
|
|
];
|
|
|
return \Yz::Return(true, '获取成功', [
|
|
|
'config' => $config
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
//点击个检获取页面按钮
|
|
|
public function GetGeJianButtonList()
|
|
|
{
|
|
|
$list = [
|
|
|
[
|
|
|
'message' => '',
|
|
|
'name' => '检前健康评估',
|
|
|
'url' => '/pages/main/question/question/question?id=4',
|
|
|
'logo' => '/assets/h5/zhuyishixiang.png'
|
|
|
],
|
|
|
[
|
|
|
'message' => '',
|
|
|
'name' => '套餐预约',
|
|
|
'url' => '/pages/main/combo/combo',
|
|
|
'logo' => '/assets/h5/zhuyishixiang.png'
|
|
|
],
|
|
|
[
|
|
|
'message' => '',
|
|
|
'name' => '项目自选',
|
|
|
'url' => '/pages/main/tj/tjzx',
|
|
|
'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
|
|
|
}
|
|
|
}
|