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.
74 lines
1.9 KiB
PHP
74 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Web;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class ItemController extends Controller
|
|
{
|
|
//医生端网页打开页面获取项目列表
|
|
public function GetList()
|
|
{
|
|
$hospital = request('hospital');
|
|
$sex=request('sex');
|
|
//查询所有可以自选的项目
|
|
$items=DB::table('items')->where(['is_choose'=>1,'status'=>1])->get();
|
|
$search= request('search');
|
|
$list = [];
|
|
$group_arr = [];
|
|
$group_list = [];
|
|
foreach ($items as $item) {
|
|
if($item->sex <> $sex and $item->sex<>0){
|
|
continue;
|
|
}
|
|
$push_type = false;
|
|
if ($search == '') {
|
|
$push_type = true;
|
|
} else {
|
|
$check_name = $item->name;
|
|
if (strpos($check_name, $search) !== false) {
|
|
$push_type = true;
|
|
}
|
|
|
|
$check_py = $item->pinyin;
|
|
if (strpos($check_py, mb_strtoupper($search)) !== false) {
|
|
$push_type = true;
|
|
}
|
|
|
|
$check_group = $item->keshi_name;
|
|
if (strpos($check_group, $search) !== false) {
|
|
$push_type = true;
|
|
}
|
|
}
|
|
if ($push_type) {
|
|
if (!in_array($item->keshi_id, $group_arr)) {
|
|
$group_list["科室{$item->keshi_id}"] = [
|
|
'id' => $item->keshi_id,
|
|
'title' => $item->keshi_name,
|
|
'head_img'=>'/storage/20240822/banner1.png',
|
|
'children' => [],
|
|
];
|
|
$group_arr[] = $item->keshi_id;
|
|
}
|
|
|
|
$group_list["科室{$item->keshi_id}"]['children'][] = [
|
|
'id' => $item->item_id,
|
|
'title' => $item->name,
|
|
'price' =>$item->price,
|
|
'original_price'=>$item->original_price,
|
|
'pinyin' => $item->pinyin,
|
|
'desc'=>$item->jianjie,
|
|
'sex'=>$item->sex,
|
|
'can_qian_hou'=>$item->can_qian_hou
|
|
];
|
|
|
|
|
|
}
|
|
|
|
}
|
|
return \Yz::Return(true,"查询成功",['list'=>$group_list]);
|
|
}
|
|
}
|