|
|
|
|
@ -39,7 +39,7 @@ class ComboController extends Controller
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
foreach ($combos as $c_key => $combo) {
|
|
|
|
|
$sixin_combo_item_ids=[];//思信套餐内项目ids
|
|
|
|
|
$sixin_combo_item_ids = [];//思信套餐内项目ids
|
|
|
|
|
|
|
|
|
|
$item = [];
|
|
|
|
|
$comboDetail = $peis::Post('套餐详情查询', $hospital_id, ['套餐Id' => $combo['Id']], false);
|
|
|
|
|
@ -47,7 +47,7 @@ class ComboController extends Controller
|
|
|
|
|
|
|
|
|
|
$comboDetail_list = $comboDetail['data'][0]['包含项目'];
|
|
|
|
|
foreach ($comboDetail_list as $key => $v) {
|
|
|
|
|
$sixin_combo_item_ids[]=$v['Id'];
|
|
|
|
|
$sixin_combo_item_ids[] = $v['Id'];
|
|
|
|
|
//在独立表中缓存一份套餐对应的项目信息
|
|
|
|
|
$item_sex = null;
|
|
|
|
|
if (isset($v['性别限制'])) {
|
|
|
|
|
@ -55,16 +55,16 @@ class ComboController extends Controller
|
|
|
|
|
$item_sex = $item_sex_array[$combo['性别限制']] >= 0 ? $item_sex_array[$combo['性别限制']] : null;
|
|
|
|
|
}
|
|
|
|
|
$item_date = [
|
|
|
|
|
'combo_id'=>$combo['Id'],
|
|
|
|
|
'item_id'=>$v['Id'],
|
|
|
|
|
'name'=>$v['名称'],
|
|
|
|
|
'combo_id' => $combo['Id'],
|
|
|
|
|
'item_id' => $v['Id'],
|
|
|
|
|
'name' => $v['名称'],
|
|
|
|
|
'desc' => $v['简介'],
|
|
|
|
|
'keshi_id' => $v['科室Id'],
|
|
|
|
|
'keshi_name' => $v['科室名称'],
|
|
|
|
|
'price'=> $v['价格'],
|
|
|
|
|
'sex'=>$item_sex,
|
|
|
|
|
'can_qian_hou'=>$v['餐前餐后'],
|
|
|
|
|
'status'=>1
|
|
|
|
|
'price' => $v['价格'],
|
|
|
|
|
'sex' => $item_sex,
|
|
|
|
|
'can_qian_hou' => $v['餐前餐后'],
|
|
|
|
|
'status' => 1
|
|
|
|
|
];
|
|
|
|
|
$db_combo_item = DB::table('combo_items')->where(['item_id' => $v['Id'], 'combo_id' => $combo['Id']])->first();
|
|
|
|
|
if (!!$db_combo_item) {
|
|
|
|
|
@ -86,12 +86,12 @@ class ComboController extends Controller
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询当前套餐缓存的套餐项目ids
|
|
|
|
|
$db_combo_item_ids=DB::table('combo_items')
|
|
|
|
|
$db_combo_item_ids = DB::table('combo_items')
|
|
|
|
|
->where(['combo_id' => $combo['Id']])->pluck('item_id')->toArray();
|
|
|
|
|
// 查询在库里缓存但思信已经没有的项目ids,标注为弃用0
|
|
|
|
|
$k_ids = array_diff($db_combo_item_ids, $sixin_combo_item_ids);
|
|
|
|
|
if(count($k_ids)>0){
|
|
|
|
|
DB::table('combo_items')->where(['combo_id'=>$combo['Id']])->whereIn('item_id',$k_ids)->delete();
|
|
|
|
|
if (count($k_ids) > 0) {
|
|
|
|
|
DB::table('combo_items')->where(['combo_id' => $combo['Id']])->whereIn('item_id', $k_ids)->delete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -113,7 +113,7 @@ class ComboController extends Controller
|
|
|
|
|
'price' => $combo['价格'],
|
|
|
|
|
'items' => $item,
|
|
|
|
|
'item_count' => $comboDetail['data'][0]['项目数量'],
|
|
|
|
|
'duo_xuan_yi'=>json_encode($combo['包含多选一组'], JSON_UNESCAPED_UNICODE),
|
|
|
|
|
'duo_xuan_yi' => json_encode($combo['包含多选一组'], JSON_UNESCAPED_UNICODE),
|
|
|
|
|
'keyue_start_time' => $combo['可约开始时间'],
|
|
|
|
|
'keyue_end_time' => $combo['可约截止时间'],
|
|
|
|
|
'status' => 1,
|
|
|
|
|
@ -156,7 +156,7 @@ class ComboController extends Controller
|
|
|
|
|
$page = request('page');
|
|
|
|
|
$pageSize = request('pageSize');
|
|
|
|
|
$searchInfo = request('searchInfo');
|
|
|
|
|
$type=request('type');
|
|
|
|
|
$type = request('type');
|
|
|
|
|
$list = DB::table('combos')
|
|
|
|
|
->select('combos.*', 'hospitals.name as hospital_name', 'combo_type.name as combo_type_name', 'combo_crowd.name as combo_crowd_name')
|
|
|
|
|
->leftJoin('hospitals', 'hospitals.id', '=', 'combos.hospital_id')
|
|
|
|
|
@ -166,13 +166,13 @@ class ComboController extends Controller
|
|
|
|
|
|
|
|
|
|
$list = $list->where('combos.name', 'like', '%' . $searchInfo['name'] . '%');
|
|
|
|
|
}
|
|
|
|
|
$list=$list->where(['combos.status'=>1]);
|
|
|
|
|
$list = $list->where(['combos.status' => 1]);
|
|
|
|
|
$count = $list->count();
|
|
|
|
|
|
|
|
|
|
if(isset($type) and $type=='all'){
|
|
|
|
|
$list = $list->orderBy('combos.order','asc')->get();
|
|
|
|
|
}else{
|
|
|
|
|
$list = $list->orderBy('combos.order','asc')
|
|
|
|
|
if (isset($type) and $type == 'all') {
|
|
|
|
|
$list = $list->orderBy('combos.order', 'asc')->get();
|
|
|
|
|
} else {
|
|
|
|
|
$list = $list->orderBy('combos.order', 'asc')
|
|
|
|
|
->skip(($page - 1) * $pageSize) // 跳过前9999条记录
|
|
|
|
|
->take($pageSize)->get();
|
|
|
|
|
}
|
|
|
|
|
@ -180,11 +180,13 @@ class ComboController extends Controller
|
|
|
|
|
|
|
|
|
|
return \Yz::Return(true, "查询完成", ['list' => $list, 'count' => $count]);
|
|
|
|
|
}
|
|
|
|
|
public function GetAllList(){
|
|
|
|
|
|
|
|
|
|
public function GetAllList()
|
|
|
|
|
{
|
|
|
|
|
$status = request('status');
|
|
|
|
|
$list = DB::table('combos');
|
|
|
|
|
if(isset($status) and $status=='enable'){
|
|
|
|
|
$list = $list->where(['status'=>1]);
|
|
|
|
|
if (isset($status) and $status == 'enable') {
|
|
|
|
|
$list = $list->where(['status' => 1]);
|
|
|
|
|
}
|
|
|
|
|
$list = $list->get();
|
|
|
|
|
return \Yz::Return(true, "查询完成", ['list' => $list]);
|
|
|
|
|
@ -208,6 +210,7 @@ class ComboController extends Controller
|
|
|
|
|
public function Save()
|
|
|
|
|
{
|
|
|
|
|
$Info = request('Info');
|
|
|
|
|
$type = request('Type');
|
|
|
|
|
$combo = DB::table('combos')->where(['id' => $Info['id']])->first();
|
|
|
|
|
|
|
|
|
|
if (!$combo) {
|
|
|
|
|
@ -217,6 +220,7 @@ class ComboController extends Controller
|
|
|
|
|
$oldOrder = $combo->order;
|
|
|
|
|
$newOrder = $Info['order'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果排序发生了变化
|
|
|
|
|
if ($oldOrder != $newOrder) {
|
|
|
|
|
if ($newOrder > $oldOrder) {
|
|
|
|
|
@ -232,8 +236,9 @@ class ComboController extends Controller
|
|
|
|
|
->where('order', '<', $oldOrder)
|
|
|
|
|
->increment('order');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$u = DB::table('combos')->where(['id' => $Info['id']])->update([
|
|
|
|
|
$data=[
|
|
|
|
|
'checkup_type_id' => $Info['checkup_type_id'],
|
|
|
|
|
'type_id' => $Info['type_id'],
|
|
|
|
|
'crowd_id' => $Info['crowd_id'],
|
|
|
|
|
@ -243,22 +248,29 @@ class ComboController extends Controller
|
|
|
|
|
'intro' => $Info['intro'],
|
|
|
|
|
'sub_intro' => $Info['sub_intro'],
|
|
|
|
|
'desc' => $Info['desc'],
|
|
|
|
|
'order' =>$newOrder,
|
|
|
|
|
'order' => $newOrder,
|
|
|
|
|
'sale_count' => $Info['sale_count'],
|
|
|
|
|
'is_hot' => isset($Info['is_hot'])?$Info['is_hot']:0,
|
|
|
|
|
]);
|
|
|
|
|
'is_hot' => isset($Info['is_hot']) ? $Info['is_hot'] : 0,
|
|
|
|
|
];
|
|
|
|
|
if ($type === 'onlyPaixu') {
|
|
|
|
|
$data=['order' => $newOrder,];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$u = DB::table('combos')->where(['id' => $Info['id']])->update($data);
|
|
|
|
|
if ($u) {
|
|
|
|
|
return \Yz::Return(true, "更新完成", []);
|
|
|
|
|
} else {
|
|
|
|
|
return \Yz::echoError1("没有数据更新");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//保存排序
|
|
|
|
|
public function SaveOrder(){
|
|
|
|
|
public function SaveOrder()
|
|
|
|
|
{
|
|
|
|
|
$order_list = request('order_list');
|
|
|
|
|
$count=0;
|
|
|
|
|
$count = 0;
|
|
|
|
|
foreach ($order_list as $order) {
|
|
|
|
|
$u=DB::table('combos')->where(['id' => $order['id']])->update(['order' => $order['order']]);
|
|
|
|
|
$u = DB::table('combos')->where(['id' => $order['id']])->update(['order' => $order['order']]);
|
|
|
|
|
if ($u) {
|
|
|
|
|
$count++;
|
|
|
|
|
}
|
|
|
|
|
|