diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index ff6b0c7..d38f166 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -311,21 +311,29 @@ class UserDoctor extends Model * @param array $hospital_params 医院搜索条件 * @param array $doctor_params 医生搜索条件 * @param array $doctor_expertise_params - * @param array $inquiry_type + * @param int $is_search_welfare_reception 是否搜索公益问诊 * @param string|int $sort_order * @param array $fields * @param int|null $page * @param int|null $per_page * @return array */ - public static function getInquiryDoctorPage(string $keyword = "", array $hospital_params = [], array $doctor_params = [], array $doctor_expertise_params = [],array $inquiry_type = [1,3], string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array + public static function getInquiryDoctorPage(string $keyword = "", array $hospital_params = [], array $doctor_params = [], array $doctor_expertise_params = [],int $is_search_welfare_reception = 0, string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array { $query = self::with([ "Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id", "DoctorExpertise", - "DoctorInquiryConfig" => function ($query) use ($inquiry_type) { + "DoctorInquiryConfig" => function ($query) use ($is_search_welfare_reception) { + $inquiry_type = [1,3,4]; + $is_enable = 0; + if (!empty($is_search_welfare_reception)){ + $inquiry_type = [3,4]; + $is_enable = 1; + } + $query->whereIn('inquiry_type', $inquiry_type) - ->where('inquiry_mode', 1); + ->where('inquiry_mode', 1) + ->where('is_enable', $is_enable); }, ]) ->where($doctor_params) @@ -344,9 +352,17 @@ class UserDoctor extends Model ->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) { $query->where($doctor_expertise_params); }) - ->whereHas('DoctorInquiryConfig', function ($query) use ($inquiry_type) { + ->whereHas('DoctorInquiryConfig', function ($query) use ($is_search_welfare_reception) { + $inquiry_type = [1,3,4]; + $is_enable = 0; + if (!empty($is_search_welfare_reception)){ + $inquiry_type = [3,4]; + $is_enable = 1; + } + $params = array(); $params['inquiry_mode'] = 1;// 接诊方式:图文 + $params['is_enable'] = $is_enable; $query->where($params)->whereIn('inquiry_type', $inquiry_type); }); diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index ec2d6f4..64b5153 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -212,7 +212,7 @@ class PatientDoctorService extends BaseService "be_good_at", ]; - $user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params,$inquiry_type, $sort_order, $fields,$page,$per_page); + $user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params,$is_search_welfare_reception, $sort_order, $fields,$page,$per_page); if (!empty($user_doctors['data'])) { foreach ($user_doctors['data'] as &$user_doctor) {