修改医生列表接口
This commit is contained in:
parent
6e999256f4
commit
ce28994b6f
@ -219,18 +219,12 @@ class UserDoctor extends Model
|
|||||||
* @param int|null $per_page
|
* @param int|null $per_page
|
||||||
* @return array
|
* @return 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 $is_first_online = 0, 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 = [],array $doctor_inquiry_config_params = [],string|int $is_first_online = 0, string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||||
{
|
{
|
||||||
$query = self::with([
|
$query = self::with([
|
||||||
"Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id",
|
"Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id",
|
||||||
"DoctorExpertise",
|
"DoctorExpertise",
|
||||||
"DoctorInquiryConfig" => function ($query) use ($is_search_welfare_reception) {
|
"DoctorInquiryConfig",
|
||||||
$query->where('inquiry_mode', 1);
|
|
||||||
if (!empty($is_search_welfare_reception)){
|
|
||||||
$query->where('inquiry_type', 3);
|
|
||||||
$query->where('is_enable', 1);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"User:user_id,is_online"
|
"User:user_id,is_online"
|
||||||
])
|
])
|
||||||
->where($doctor_params)
|
->where($doctor_params)
|
||||||
@ -249,18 +243,21 @@ class UserDoctor extends Model
|
|||||||
->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) {
|
->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) {
|
||||||
$query->where($doctor_expertise_params);
|
$query->where($doctor_expertise_params);
|
||||||
})
|
})
|
||||||
->whereHas('DoctorInquiryConfig', function ($query) use ($is_search_welfare_reception) {
|
->whereHas('DoctorInquiryConfig', function ($query) use ($doctor_inquiry_config_params) {
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['inquiry_mode'] = 1;// 接诊方式:图文
|
|
||||||
if (!empty($is_search_welfare_reception)){
|
|
||||||
$params['is_enable'] = 1;
|
$params['is_enable'] = 1;
|
||||||
|
|
||||||
|
if (!empty($doctor_inquiry_config_params)){
|
||||||
|
if (!empty($doctor_inquiry_config_params['inquiry_mode'])){
|
||||||
|
$params['inquiry_mode'] = $doctor_inquiry_config_params['inquiry_mode'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($doctor_inquiry_config_params['inquiry_type'])){
|
||||||
|
$params['inquiry_type'] = $doctor_inquiry_config_params['inquiry_type'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$query->where($params);
|
$query->where($params);
|
||||||
|
|
||||||
if (!empty($is_search_welfare_reception)){
|
|
||||||
$query->where('inquiry_type', 3);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($is_first_online == 1){
|
if ($is_first_online == 1){
|
||||||
@ -328,6 +325,131 @@ class UserDoctor extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 获取问诊医生列表
|
||||||
|
// * 专家问诊-公益问诊共用
|
||||||
|
// * @param string $keyword
|
||||||
|
// * @param array $hospital_params 医院搜索条件
|
||||||
|
// * @param array $doctor_params 医生搜索条件
|
||||||
|
// * @param array $doctor_expertise_params
|
||||||
|
// * @param int $is_search_welfare_reception 是否搜索公益问诊
|
||||||
|
// * @param string|int $is_first_online 是否优先在线(1:是)
|
||||||
|
// * @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 $doctor_inquiry_config_params = [],string|int $is_first_online = 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 ($is_search_welfare_reception) {
|
||||||
|
// $query->where('inquiry_mode', 1);
|
||||||
|
// if (!empty($is_search_welfare_reception)){
|
||||||
|
// $query->where('inquiry_type', 3);
|
||||||
|
// $query->where('is_enable', 1);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// "User:user_id,is_online"
|
||||||
|
// ])
|
||||||
|
// ->where($doctor_params)
|
||||||
|
// ->when($keyword, function ($query, $keyword) {
|
||||||
|
// $query->where(function ($query) use ($keyword) {
|
||||||
|
// $query->orwhere("user_name", 'like', '%' . $keyword . '%');
|
||||||
|
// $query->orwhere("department_custom_name", 'like', '%' . $keyword . '%');
|
||||||
|
// $query->orWhereHas('Hospital', function ($query) use ($keyword) {
|
||||||
|
// $query->where('hospital_name', 'like', '%' . $keyword . '%');
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// })
|
||||||
|
// ->whereHas('Hospital', function ($query) use ($hospital_params) {
|
||||||
|
// $query->where($hospital_params);
|
||||||
|
// })
|
||||||
|
// ->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) {
|
||||||
|
// $query->where($doctor_expertise_params);
|
||||||
|
// })
|
||||||
|
// ->whereHas('DoctorInquiryConfig', function ($query) use ($is_search_welfare_reception) {
|
||||||
|
// $params = array();
|
||||||
|
// $params['inquiry_mode'] = 1;// 接诊方式:图文
|
||||||
|
// if (!empty($is_search_welfare_reception)){
|
||||||
|
// $params['is_enable'] = 1;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// $query->where($params);
|
||||||
|
//
|
||||||
|
// if (!empty($is_search_welfare_reception)){
|
||||||
|
// $query->where('inquiry_type', 3);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// if ($is_first_online == 1){
|
||||||
|
// $query->join('user as u', function ($query) {
|
||||||
|
// $query->on('user_doctor.user_id', '=', 'u.user_id');
|
||||||
|
// })
|
||||||
|
// ->select("user_doctor.*")
|
||||||
|
// ->orderBy('u.is_online', 'desc');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (!empty($sort_order)){
|
||||||
|
// if (in_array($sort_order,[1,3,4])){
|
||||||
|
// $query = $query->join('doctor_inquiry_config', function ($query) {
|
||||||
|
// $query->on('user_doctor.doctor_id', '=', 'doctor_inquiry_config.doctor_id')
|
||||||
|
// ->whereIn('inquiry_type', [1, 3])
|
||||||
|
// ->where('inquiry_mode', 1)
|
||||||
|
// ->orderBy('inquiry_price', 'desc')
|
||||||
|
// ->take(1);
|
||||||
|
// })
|
||||||
|
// ->select("user_doctor.*")
|
||||||
|
// ->groupBy("user_doctor.doctor_id");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if ($sort_order == 1) {
|
||||||
|
// // 综合-价格从低到高
|
||||||
|
// $query->orderBy('is_recommend', 'desc');// 是否首页推荐(0:否 1:是)
|
||||||
|
// $query->orderByRaw('avg_response_time = 0 ASC');
|
||||||
|
// $query->orderBy('avg_response_time');
|
||||||
|
// $query->orderBy('served_patients_num', 'desc');// 服务数从多到少
|
||||||
|
// $query->orderBy(Db::raw("convert(substr(gdxz_user_doctor.user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||||
|
// $query->orderBy('doctor_inquiry_config.inquiry_price', 'asc');
|
||||||
|
// } elseif ($sort_order == 2) {
|
||||||
|
// // 响应时间快
|
||||||
|
// $query->orderByRaw('avg_response_time = 0 ASC');
|
||||||
|
// $query->orderBy('avg_response_time');
|
||||||
|
// $query->orderBy(Db::raw("convert(substr(gdxz_user_doctor.user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||||
|
// } elseif ($sort_order == 3) {
|
||||||
|
// // 价格从低到高
|
||||||
|
// $query->orderBy('doctor_inquiry_config.inquiry_price', 'asc');
|
||||||
|
// $query->orderByRaw('avg_response_time = 0 ASC');
|
||||||
|
// $query->orderBy('avg_response_time');
|
||||||
|
// $query->orderBy(Db::raw("convert(substr(gdxz_user_doctor.user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||||
|
// } elseif ($sort_order == 4) {
|
||||||
|
// // 价格从高到低
|
||||||
|
// $query->orderBy('doctor_inquiry_config.inquiry_price', 'desc');
|
||||||
|
// $query->orderByRaw('avg_response_time = 0 ASC');
|
||||||
|
// $query->orderBy('avg_response_time');
|
||||||
|
// $query->orderBy(Db::raw("convert(substr(gdxz_user_doctor.user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||||
|
// } elseif ($sort_order == 5) {
|
||||||
|
// // 服务数从多到少
|
||||||
|
// $query->orderBy('served_patients_num', 'desc');
|
||||||
|
// $query->orderBy(Db::raw("convert(substr(gdxz_user_doctor.user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// $result = $query->paginate($per_page, $fields, "page", $page);
|
||||||
|
//
|
||||||
|
// $data = array();
|
||||||
|
// $data['current_page'] = $result->currentPage();// 当前页码
|
||||||
|
// $data['total'] = $result->total();//数据总数
|
||||||
|
// $data['data'] = $result->items();//数据
|
||||||
|
// $data['per_page'] = $result->perPage();//每页个数
|
||||||
|
// $data['last_page'] = $result->lastPage();//最后一页
|
||||||
|
//
|
||||||
|
// return $data;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取问诊医生列表
|
* 获取问诊医生列表
|
||||||
* 专家问诊-公益问诊共用
|
* 专家问诊-公益问诊共用
|
||||||
|
|||||||
@ -34,7 +34,9 @@ class PatientDoctorService extends BaseService
|
|||||||
$city_id = $this->request->input('city_id');
|
$city_id = $this->request->input('city_id');
|
||||||
$sort_order = $this->request->input('sort_order',1);
|
$sort_order = $this->request->input('sort_order',1);
|
||||||
$keyword = $this->request->input('keyword',"");
|
$keyword = $this->request->input('keyword',"");
|
||||||
$is_search_welfare_reception = $this->request->input('is_search_welfare_reception',0); // 是否参加公益图文问诊(0:否 1:是)
|
// $is_search_welfare_reception = $this->request->input('is_search_welfare_reception',0); // 是否参加公益图文问诊(0:否 1:是)
|
||||||
|
$inquiry_type = $this->request->input('inquiry_type',0); // 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||||
|
$inquiry_mode = $this->request->input('inquiry_mode',0); // 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊)
|
||||||
$is_first_online = $this->request->input('is_first_online',0); // 是否优先在线(1:是)
|
$is_first_online = $this->request->input('is_first_online',0); // 是否优先在线(1:是)
|
||||||
$page = $this->request->input('page',1);
|
$page = $this->request->input('page',1);
|
||||||
$per_page = $this->request->input('per_page',10);
|
$per_page = $this->request->input('per_page',10);
|
||||||
@ -59,6 +61,13 @@ class PatientDoctorService extends BaseService
|
|||||||
$doctor_expertise_params['expertise_id'] = $expertise_id;
|
$doctor_expertise_params['expertise_id'] = $expertise_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 医生问诊条件
|
||||||
|
$doctor_inquiry_config_params = array();
|
||||||
|
if (!empty($inquiry_type)){
|
||||||
|
$doctor_inquiry_config_params['inquiry_type'] = $inquiry_type;
|
||||||
|
$doctor_inquiry_config_params['inquiry_mode'] = $inquiry_mode;
|
||||||
|
}
|
||||||
|
|
||||||
// 固定医生查询条件
|
// 固定医生查询条件
|
||||||
$doctor_params['status'] = 1; // 状态(0:禁用 1:正常 2:删除)
|
$doctor_params['status'] = 1; // 状态(0:禁用 1:正常 2:删除)
|
||||||
|
|
||||||
@ -84,7 +93,7 @@ class PatientDoctorService extends BaseService
|
|||||||
"be_good_at",
|
"be_good_at",
|
||||||
];
|
];
|
||||||
|
|
||||||
$user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params,$is_search_welfare_reception,$is_first_online, $sort_order, $fields,$page,$per_page);
|
$user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params,$doctor_inquiry_config_params,$is_first_online, $sort_order, $fields,$page,$per_page);
|
||||||
|
|
||||||
if (!empty($user_doctors['data'])) {
|
if (!empty($user_doctors['data'])) {
|
||||||
foreach ($user_doctors['data'] as &$user_doctor) {
|
foreach ($user_doctors['data'] as &$user_doctor) {
|
||||||
@ -100,24 +109,24 @@ class PatientDoctorService extends BaseService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理问诊价格
|
// // 处理问诊价格
|
||||||
$user_doctor['price'] = 0;
|
// $user_doctor['price'] = 0;
|
||||||
$user_doctor['free_clinic_price'] = 0;
|
// $user_doctor['free_clinic_price'] = 0;
|
||||||
$user_doctor['multi_point_enable'] = 0;
|
// $user_doctor['multi_point_enable'] = 0;
|
||||||
if (!empty($user_doctor['DoctorInquiryConfig'])) {
|
// if (!empty($user_doctor['DoctorInquiryConfig'])) {
|
||||||
foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) {
|
// foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) {
|
||||||
if ($doctor_inquiry_config['inquiry_mode'] == 1) {
|
// if ($doctor_inquiry_config['inquiry_mode'] == 1) {
|
||||||
if ($doctor_inquiry_config['inquiry_type'] == 1 && $doctor_inquiry_config['is_enable'] == 1) {
|
// if ($doctor_inquiry_config['inquiry_type'] == 1 && $doctor_inquiry_config['is_enable'] == 1) {
|
||||||
// 专家
|
// // 专家
|
||||||
$user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0;
|
// $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0;
|
||||||
}
|
// }
|
||||||
if ($doctor_inquiry_config['inquiry_type'] == 3 && $doctor_inquiry_config['is_enable'] == 1) {
|
// if ($doctor_inquiry_config['inquiry_type'] == 3 && $doctor_inquiry_config['is_enable'] == 1) {
|
||||||
// 公益
|
// // 公益
|
||||||
$user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price'];
|
// $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price'];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 处理可处方字段
|
// 处理可处方字段
|
||||||
$user_doctor['multi_point_enable'] = 0;
|
$user_doctor['multi_point_enable'] = 0;
|
||||||
@ -137,7 +146,7 @@ class PatientDoctorService extends BaseService
|
|||||||
// 响应时间-超过5个已结束的订单后展示
|
// 响应时间-超过5个已结束的订单后展示
|
||||||
$user_doctor['avg_response_time'] = (float)floor($user_doctor['avg_response_time'] * 10) / 10;
|
$user_doctor['avg_response_time'] = (float)floor($user_doctor['avg_response_time'] * 10) / 10;
|
||||||
|
|
||||||
// 获取医生订单数
|
//
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||||
$params['inquiry_status'] = 6; // 已结束
|
$params['inquiry_status'] = 6; // 已结束
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user