修改医生列表

This commit is contained in:
2023-08-15 16:22:33 +08:00
parent 19ae7e6bff
commit 205d59726b
4 changed files with 42 additions and 19 deletions
+17 -16
View File
@@ -215,34 +215,35 @@ class UserDoctor extends Model
* @param int|null $per_page
* @return array
*/
public static function getInquiryDoctorPage(string $keyword = "", array $doctor_params = [], 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 = [], 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",
"DoctorExpertise.DiseaseClassExpertise:expertise_id,expertise_name",
"DoctorExpertise" => function ($query) use ($doctor_expertise_params) {
$query->where($doctor_expertise_params);
},
"DoctorInquiryConfig" => function ($query) use ($sort_order) {
$params = array();
$params['inquiry_mode'] = 1;// 接诊方式:图文
$query->where($params)->whereIn('inquiry_type', [1, 3]);
// if ($sort_order == 1) {
// // 综合
// $query->orderBy('inquiry_price', 'asc');// 价格从低到高
// } elseif ($sort_order == 3) {
// // 价格从低到高
// $query->orderBy('inquiry_price', 'asc');
// } elseif ($sort_order == 4) {
// // 价格从高到低
// $query->orderBy('inquiry_price', 'desc');// 价格从高到低
// }
if ($sort_order == 1) {
// 综合-价格从低到高
$query->orderBy('inquiry_price', 'asc');
} elseif ($sort_order == 3) {
// 价格从低到高
$query->orderBy('inquiry_price', 'asc');
} elseif ($sort_order == 4) {
// 价格从高到低
$query->orderBy('inquiry_price', 'desc');
}
return $query;
},
])
->where($doctor_params)
// ->whereHas('Hospital', function ($query) use ($hospital_params) {
// $query->where($hospital_params);
// })
->whereHas('Hospital', function ($query) use ($hospital_params) {
$query->where($hospital_params);
})
->when($keyword, function ($query, $keyword) {
$query->where(function ($query) use ($keyword) {
$query->orwhere("user_name", 'like', '%' . $keyword . '%');