医生列表备注版本

This commit is contained in:
wucongxing 2023-08-16 16:44:01 +08:00
parent 7663a6512c
commit 83828de325
5 changed files with 81 additions and 51 deletions

View File

@ -16,6 +16,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
* @property int $company_id 合作公司id
* @property string $detection_project_price 检测价格
* @property string $img_path 内容图片地址
* @property string $informed_consent_form 知情同意书
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
@ -31,7 +32,7 @@ class DetectionProject extends Model
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['detection_project_id', 'detection_project_title', 'detection_project_name', 'company_id', 'detection_project_price', 'img_path', 'created_at', 'updated_at'];
protected array $fillable = ['detection_project_id', 'detection_project_title', 'detection_project_name', 'company_id', 'detection_project_price', 'img_path', 'informed_consent_form', 'created_at', 'updated_at'];
protected string $primaryKey = "detection_project_id";

View File

@ -219,24 +219,13 @@ class UserDoctor extends Model
{
$query = self::with([
"Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id",
"DoctorExpertise",
// "DoctorExpertise",
"DoctorInquiryConfig" => function ($query) use ($sort_order) {
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');
}
$query->whereIn('inquiry_type', [1, 3])
->where('inquiry_mode', 1);
},
])
->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 . '%');
@ -246,44 +235,83 @@ class UserDoctor extends Model
});
});
})
->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) {
$query->where($doctor_expertise_params);
->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) {
$params = array();
$params['inquiry_mode'] = 1;// 接诊方式:图文
$query->where($params)->whereIn('inquiry_type', [1, 3]);
})
->when($sort_order, function ($query, $sort_order) {
if ($sort_order == 1) {
$query->orderBy('is_recommend', 'desc');// 是否首页推荐0:否 1:是)
$query->orderBy('avg_response_time', 'desc');// 响应时间快
$query->orderBy('served_patients_num', 'desc');// 服务数从多到少
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
} elseif ($sort_order == 2) {
// 响应时间快
$query->orderBy('avg_response_time', 'asc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
} elseif ($sort_order == 3) {
// 价格从低到高
$query->orderBy('avg_response_time', 'asc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
} elseif ($sort_order == 4) {
// 价格从高到低
$query->orderBy('avg_response_time', 'desc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
} elseif ($sort_order == 5) {
// 服务数从多到少
$query->orderBy('served_patients_num', 'desc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
}
return $query;
})
// ->join('doctor_inquiry_config', 'user_doctor.doctor_id', '=', 'doctor_inquiry_config.doctor_id')
// ->groupBy("user_doctor.doctor_id")
// ->orderBy("doctor_inquiry_config.inquiry_price",'desc')
->select("user_doctor.*");
});
// ->when($sort_order, function ($query, $sort_order) {
// if ($sort_order == 1) {
// $query->orderBy('is_recommend', 'desc');// 是否首页推荐0:否 1:是)
// $query->orderBy('avg_response_time', 'desc');// 响应时间快
// $query->orderBy('served_patients_num', 'desc');// 服务数从多到少
// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
// } elseif ($sort_order == 2) {
// // 响应时间快
// $query->orderBy('avg_response_time', 'asc');
// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
// } elseif ($sort_order == 3) {
// // 价格从低到高
// $query->orderBy('avg_response_time', 'asc');
// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
// } elseif ($sort_order == 4) {
// // 价格从高到低
// $query->orderBy('avg_response_time', 'desc');
// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
// } elseif ($sort_order == 5) {
// // 服务数从多到少
// $query->orderBy('served_patients_num', 'desc');
// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
// }
// return $query;
// });
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->orderBy('avg_response_time', 'asc');// 响应时间快
$query->orderBy('served_patients_num', 'desc');// 服务数从多到少
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
$query->orderBy('doctor_inquiry_config.inquiry_price', 'asc');
} elseif ($sort_order == 2) {
// 响应时间快
$query->orderBy('avg_response_time', 'asc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
} elseif ($sort_order == 3) {
// 价格从低到高
$query->orderBy('doctor_inquiry_config.inquiry_price', 'asc');
$query->orderBy('avg_response_time', 'asc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
} elseif ($sort_order == 4) {
// 价格从高到低
$query->orderBy('doctor_inquiry_config.inquiry_price', 'desc');
$query->orderBy('avg_response_time', 'asc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
} elseif ($sort_order == 5) {
// 服务数从多到少
$query->orderBy('served_patients_num', 'desc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
}
}
$result = $query->paginate($per_page, $fields, "page", $page);
@ -297,6 +325,8 @@ class UserDoctor extends Model
return $data;
}
/**
* 获取是否存在
* @param array $params

View File

@ -37,7 +37,7 @@ return [
Constant::OPTION_MAX_REQUEST => 100000,
Constant::OPTION_SOCKET_BUFFER_SIZE => 2 * 1024 * 1024,
Constant::OPTION_BUFFER_OUTPUT_SIZE => 2 * 1024 * 1024,
Constant::OPTION_PACKAGE_MAX_LENGTH => 5 * 1024 * 1024,
Constant::OPTION_PACKAGE_MAX_LENGTH => 5 * 1024 * 1024, // 接收数据包的最大长度
],
'callbacks' => [
Event::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],

View File

@ -63,6 +63,7 @@ class Base
/**
* 请求封装
* @param string $sign
* @param $path
* @param array $arg 请求参数
* @return array
* @throws GuzzleException
@ -82,9 +83,8 @@ class Base
// 打印使用
$l = $arg;
unset($l['json']['pictureOfDetectionTube']);
dump($l);
Log::getInstance("请求参数")->info(json_encode($arg,JSON_UNESCAPED_UNICODE));
Log::getInstance("请求参数")->info(json_encode($l,JSON_UNESCAPED_UNICODE));
$response = $this->client->post($path, $arg);
if ($response->getStatusCode() != '200'){

View File

@ -179,7 +179,6 @@ class Wy extends Base
$path = $this->request_url . "api/sdInternet/v1/externalData/saveOrder";
try {
$response = $this->httpRequest($sign,$path,$option);
dump($response);
if (empty($response)){
// 返回值错误为空
throw new BusinessException("");