|
|
|
|
@ -35,18 +35,21 @@ class PlanController extends Controller
|
|
|
|
|
->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [json_encode($checkup_type_id)])
|
|
|
|
|
->where(['hospital_id' => $hospital_id, 'type' => 1, 'is_del' => 0])
|
|
|
|
|
->where('is_vip', '<>', 1)
|
|
|
|
|
->whereIn('use_type',[0,$use_type])
|
|
|
|
|
->whereIn('use_type', [0, $use_type]);
|
|
|
|
|
|
|
|
|
|
if (!empty($danwei_id)) {
|
|
|
|
|
$cha_bind_danwei = DB::table('plan_type')->WhereRaw('JSON_CONTAINS(bind_units, ?)', [json_encode($danwei_id)])->where(['is_del' => 0])->get();
|
|
|
|
|
if (count($cha_bind_danwei) > 0) {
|
|
|
|
|
$list = $list->WhereRaw('JSON_CONTAINS(bind_work_unit_id, ?)', [json_encode($danwei_id)]);
|
|
|
|
|
} else {
|
|
|
|
|
$list = $list
|
|
|
|
|
->where(function ($query) use ($danwei_id) {
|
|
|
|
|
// 检查 bind_work_unit_id 为 NULL 或空字符串
|
|
|
|
|
$query->whereNull('bind_work_unit_id')
|
|
|
|
|
->orWhere('bind_work_unit_id', '=', '');
|
|
|
|
|
|
|
|
|
|
// 如果 $danwei_id 不为空,则添加额外的条件
|
|
|
|
|
if (!empty($danwei_id)) {
|
|
|
|
|
$query->orWhereRaw('JSON_CONTAINS(bind_work_unit_id, ?)', [json_encode($danwei_id)]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isset($person_id)) {
|
|
|
|
|
$personInfo = DB::table('web_user_person')->where(['id' => $person_id])->first();
|
|
|
|
|
if (!!$personInfo) {
|
|
|
|
|
@ -108,6 +111,7 @@ class PlanController extends Controller
|
|
|
|
|
|
|
|
|
|
return \Yz::Return(true, "查询完成", ['list' => $dates]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取某日号源列表
|
|
|
|
|
public function GetDayPlanList()
|
|
|
|
|
{
|
|
|
|
|
@ -137,18 +141,20 @@ class PlanController extends Controller
|
|
|
|
|
->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [$checkup_type_id])
|
|
|
|
|
->where(['hospital_id' => $hospital_id, 'type' => 1, 'is_del' => 0])
|
|
|
|
|
->where('is_vip', '<>', 1)
|
|
|
|
|
->whereIn('use_type',[0,$use_type])
|
|
|
|
|
->whereIn('use_type', [0, $use_type]);
|
|
|
|
|
if (!empty($danwei_id)) {
|
|
|
|
|
$cha_bind_danwei = DB::table('plan_type')->WhereRaw('JSON_CONTAINS(bind_units, ?)', [json_encode($danwei_id)])->where(['is_del' => 0])->get();
|
|
|
|
|
if (count($cha_bind_danwei) > 0) {
|
|
|
|
|
$list = $list->WhereRaw('JSON_CONTAINS(bind_work_unit_id, ?)', [json_encode($danwei_id)]);
|
|
|
|
|
} else {
|
|
|
|
|
$list = $list
|
|
|
|
|
->where(function ($query) use ($danwei_id) {
|
|
|
|
|
// 检查 bind_work_unit_id 为 NULL 或空字符串
|
|
|
|
|
$query->whereNull('bind_work_unit_id')
|
|
|
|
|
->orWhere('bind_work_unit_id', '=', '');
|
|
|
|
|
|
|
|
|
|
// 如果 $danwei_id 不为空,则添加额外的条件
|
|
|
|
|
if (!empty($danwei_id)) {
|
|
|
|
|
$query->orWhereRaw('JSON_CONTAINS(bind_work_unit_id, ?)', [json_encode($danwei_id)]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$comboItemsNmr = [];
|
|
|
|
|
@ -215,18 +221,20 @@ class PlanController extends Controller
|
|
|
|
|
->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [$checkup_type_id])
|
|
|
|
|
->where(['hospital_id' => $hospital_id, 'type' => 1, 'is_del' => 0])
|
|
|
|
|
->where('is_vip', '<>', 1)
|
|
|
|
|
->whereIn('use_type',[0,$use_type])
|
|
|
|
|
->whereIn('use_type', [0, $use_type]);
|
|
|
|
|
if (!empty($danwei_id)) {
|
|
|
|
|
$cha_bind_danwei = DB::table('plan_type')->WhereRaw('JSON_CONTAINS(bind_units, ?)', [json_encode($danwei_id)])->where(['is_del' => 0])->get();
|
|
|
|
|
if (count($cha_bind_danwei) > 0) {
|
|
|
|
|
$weeklist = $weeklist->WhereRaw('JSON_CONTAINS(bind_work_unit_id, ?)', [json_encode($danwei_id)]);
|
|
|
|
|
} else {
|
|
|
|
|
$weeklist = $weeklist
|
|
|
|
|
->where(function ($query) use ($danwei_id) {
|
|
|
|
|
// 检查 bind_work_unit_id 为 NULL 或空字符串
|
|
|
|
|
$query->whereNull('bind_work_unit_id')
|
|
|
|
|
->orWhere('bind_work_unit_id', '=', '');
|
|
|
|
|
|
|
|
|
|
// 如果 $danwei_id 不为空,则添加额外的条件
|
|
|
|
|
if (!empty($danwei_id)) {
|
|
|
|
|
$query->orWhereRaw('JSON_CONTAINS(bind_work_unit_id, ?)', [json_encode($danwei_id)]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (count($comboItemsNmr) > 0 or count($ItemsNmr) > 0 or !empty($er_xian_info)) {
|
|
|
|
|
@ -296,6 +304,7 @@ class PlanController extends Controller
|
|
|
|
|
|
|
|
|
|
return \Yz::Return(true, "查询完成", ['list' => $list, 'weeklist' => $week7]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//检查号源是否可用
|
|
|
|
|
public function CheckPlan($plan_id, $hospital_id, $type, $sex, $price, $checkup_type_id)
|
|
|
|
|
{
|
|
|
|
|
|