修改医生列表
This commit is contained in:
parent
19ae7e6bff
commit
205d59726b
@ -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 . '%');
|
||||
|
||||
@ -101,7 +101,7 @@ class UserDoctorRequest extends FormRequest
|
||||
'province_id' => 'required|required_with:city_id,county_id',
|
||||
'city_id' => 'required|required_with:county_id',
|
||||
'county_id' => 'required',
|
||||
'pharmacist_audit_status' => 'required|integer|min:0|max:3',
|
||||
'pharmacist_audit_status' => 'required|integer|min:0|max:2',
|
||||
'words_type' => 'required|integer|min:1|max:3',
|
||||
'words' => 'required',
|
||||
'doctor_id' => 'required',
|
||||
|
||||
@ -38,7 +38,24 @@ class PatientDoctorService extends BaseService
|
||||
$per_page = $this->request->input('per_page',10);
|
||||
|
||||
// 组合条件
|
||||
$hospital_params = array();// 医院搜索
|
||||
$doctor_params = array();// 医生搜索
|
||||
$doctor_expertise_params = array();// 医生专长搜索
|
||||
|
||||
// 省市区
|
||||
if (!empty($province_id)) {
|
||||
if (empty($city_id)) {
|
||||
// 省份存在时需和城市在一块
|
||||
return fail(HttpEnumCode::CLIENT_HTTP_ERROR);
|
||||
}
|
||||
$hospital_params[] = ['province_id', '=', $province_id];
|
||||
$hospital_params[] = ['city_id', '=', $city_id];
|
||||
}
|
||||
|
||||
// 医生专长
|
||||
if (!empty($expertise_id)) {
|
||||
$doctor_expertise_params['expertise_id'] = $expertise_id;
|
||||
}
|
||||
|
||||
// 固定医生查询条件
|
||||
$doctor_params['status'] = 1; // 状态(0:禁用 1:正常 2:删除)
|
||||
@ -73,7 +90,7 @@ class PatientDoctorService extends BaseService
|
||||
"be_good_at",
|
||||
];
|
||||
|
||||
$user_doctors = UserDoctor::getInquiryDoctorPage($keyword, $doctor_params, $sort_order, $fields,$page,$per_page);
|
||||
$user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params, $sort_order, $fields,$page,$per_page);
|
||||
|
||||
// 处理数据
|
||||
if (!empty($user_doctors['data'])) {
|
||||
|
||||
@ -484,9 +484,14 @@ class UserDoctorService extends BaseService
|
||||
// 获取处方数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$params['prescription_status'] = 1;
|
||||
$params['pharmacist_audit_status'] = $pharmacist_audit_status;
|
||||
$params['is_delete'] = 0;
|
||||
|
||||
if ($pharmacist_audit_status == 1){
|
||||
// 审核通过
|
||||
$params['platform_audit_status'] = 1;
|
||||
}
|
||||
|
||||
$order_prescriptions = OrderPrescription::getWithIcdPage($params,['*'],$page,$per_page);
|
||||
if (empty($order_prescriptions)) {
|
||||
return success($order_prescriptions);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user