修改患者端医生列表

This commit is contained in:
2023-05-11 13:52:36 +08:00
parent 562163ea36
commit 31726f1903
2 changed files with 35 additions and 42 deletions
+27 -2
View File
@@ -203,9 +203,34 @@ 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 $doctor_params = [], string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
{
$query = self::where($doctor_params)
$query = self::with([
"Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id",
"DoctorExpertise",
"DoctorExpertise.DiseaseClassExpertise:expertise_id,expertise_name",
"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');// 价格从高到低
// }
return $query;
},
])
->where($doctor_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 . '%');