|
|
|
|
@ -139,13 +139,20 @@ select combo_id as c_id,count(*) as count from orders where status in(2,4) group
|
|
|
|
|
if(json_decode($combo->duo_xuan_yi)){
|
|
|
|
|
$N1=json_decode($combo->duo_xuan_yi);
|
|
|
|
|
foreach ($N1 as $k=>$v){
|
|
|
|
|
$duo_xuan_yi[$k][]=[
|
|
|
|
|
'zu_name'=>$v->组名称,
|
|
|
|
|
'item_list'=>[]
|
|
|
|
|
];
|
|
|
|
|
foreach ($v->包含项目 as $k2=>$v2){
|
|
|
|
|
|
|
|
|
|
$duo_xuan_yi[$k][]=[
|
|
|
|
|
$duo_xuan_yi[$k]['item_list'][]=
|
|
|
|
|
[
|
|
|
|
|
'item_id' =>$v2->Id,
|
|
|
|
|
'item_name' => $v2->名称,
|
|
|
|
|
'price'=>$v2->价格
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -208,6 +215,7 @@ select combo_id as c_id,count(*) as count from orders where status in(2,4) group
|
|
|
|
|
$hospital_id = request('hospital');
|
|
|
|
|
$combo_id = request('combo_id'); //购买的套餐id
|
|
|
|
|
$item_ids = request('item_ids'); //自选项目ids
|
|
|
|
|
$duo_xuan_yi = request('duo_xuan_yi'); //多选1
|
|
|
|
|
$group_id = request('group_id'); //团检登记id
|
|
|
|
|
if (!isset($hospital_id)) return \Yz::echoError1("医院id不能为空");
|
|
|
|
|
$hospital = DB::table('hospitals')->where(['id' => 1, 'status' => 1, 'is_del' => 0])->first();
|
|
|
|
|
@ -216,6 +224,7 @@ select combo_id as c_id,count(*) as count from orders where status in(2,4) group
|
|
|
|
|
$all_original_price = 0;
|
|
|
|
|
$true_price = 0;
|
|
|
|
|
$nmr_list=[];
|
|
|
|
|
|
|
|
|
|
if (isset($combo_id) and $combo_id != 0) {
|
|
|
|
|
// $combo=DB::table('combos')->where(['hospital_id'=>$hospital_id,'combo_id'=>$combo_id,'status'=>1])->first();
|
|
|
|
|
$combo = DB::select("select a.*,b.*,c.name as crowd_name from combos as a LEFT JOIN (
|
|
|
|
|
@ -223,7 +232,32 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
|
|
|
|
|
) as b on a.combo_id=b.c_id left join combo_crowd as c on a.crowd_id=c.id where a.combo_id=? and a.status=1 ", [$combo_id]);
|
|
|
|
|
|
|
|
|
|
if (!$combo) return \Yz::echoError1("套餐不存在");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$combo = $combo[0];
|
|
|
|
|
//构建多选一数据
|
|
|
|
|
$Nx1_arrInfo=[];
|
|
|
|
|
if(isset($duo_xuan_yi) and !empty($duo_xuan_yi)){
|
|
|
|
|
$combo_Nx1=json_decode($combo->duo_xuan_yi,true);
|
|
|
|
|
foreach ($duo_xuan_yi as $r_k=>$r_v){
|
|
|
|
|
foreach ($combo_Nx1 as $k=> $n1v){
|
|
|
|
|
if($r_v['zu_name'] == $n1v['组名称']){
|
|
|
|
|
foreach ($n1v['包含项目'] as $k2 => $v2){
|
|
|
|
|
if($v2['Id'] == $r_v['item_id']){
|
|
|
|
|
$Nx1_arrInfo[] = [
|
|
|
|
|
'id' => $v2['Id'],
|
|
|
|
|
'name' => $v2['名称'],
|
|
|
|
|
'desc' => $v2['简介'],
|
|
|
|
|
'keshi_name' => $v2['科室名称'],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$combo_info['hospital_name'] = $hospital->name;
|
|
|
|
|
$combo_info['combo_name'] = $combo->name;
|
|
|
|
|
$combo_info['crowd_name'] = $combo->crowd_name;
|
|
|
|
|
@ -249,6 +283,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
|
|
|
|
|
$combo_info['original_price'] = $combo->original_price;
|
|
|
|
|
$all_original_price += $combo_info['original_price'];
|
|
|
|
|
$combo_items = json_decode($combo->items, true);
|
|
|
|
|
$combo_items=array_merge($combo_items,$Nx1_arrInfo); //合并多选一
|
|
|
|
|
$groupedData = [];
|
|
|
|
|
foreach ($combo_items as $item) {
|
|
|
|
|
$keshiName = $item['keshi_name'];
|
|
|
|
|
|