迁移我的医生服务类,新增获取问诊医生列表
This commit is contained in:
@@ -145,14 +145,16 @@ class IndexService extends BaseService
|
||||
$params["module_status"] = 1;
|
||||
$module = ModuleModel::getList($params);
|
||||
|
||||
$PatientDoctorService = new PatientDoctorService();
|
||||
|
||||
// 我的医生
|
||||
$my_doctor = [];
|
||||
if (!empty($user_info)) {
|
||||
$my_doctor = $this->getIndexPatientDoctor($user_info['client_user_id']);
|
||||
$my_doctor = $PatientDoctorService->getIndexPatientDoctorLimit($user_info['client_user_id']);
|
||||
}
|
||||
|
||||
// 推荐医生
|
||||
$recommend_doctor = $this->getIndexRecommendDoctor();
|
||||
$recommend_doctor = $PatientDoctorService->getIndexRecommendDoctorLimit();
|
||||
|
||||
$result = array();
|
||||
$result["banner"] = $banner ?? [];// banner
|
||||
@@ -220,117 +222,7 @@ class IndexService extends BaseService
|
||||
|
||||
return success($data);
|
||||
}
|
||||
/**
|
||||
* 患者端-首页-我的医生-限制条数
|
||||
* @param string $patient_id
|
||||
* @return array
|
||||
*/
|
||||
protected function getIndexPatientDoctor(string $patient_id): array
|
||||
{
|
||||
$results = array();
|
||||
|
||||
$params = array();
|
||||
$params['patient_id'] = $patient_id;
|
||||
$params['history_status'] = 1;
|
||||
$patient_history_doctors = PatientHistoryInquiryModel::getIndexHistoryDoctorLimit($params);
|
||||
if (!empty($patient_history_doctors)) {
|
||||
foreach ($patient_history_doctors as $patient_history_doctor) {
|
||||
if (empty($patient_history_doctor['userDoctor'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 组合数据
|
||||
$data = array();
|
||||
$data['doctor_id'] = $patient_history_doctor['userDoctor']['doctor_id'];
|
||||
$data['user_name'] = $patient_history_doctor['userDoctor']['user_name'];
|
||||
$data['avatar'] = addAliyunOssWebsite($patient_history_doctor['userDoctor']['avatar']);
|
||||
$data['hospital_name'] = "";
|
||||
if (!empty($patient_history_doctor['userDoctor']['Hospital'])) {
|
||||
$data['hospital_name'] = $patient_history_doctor['userDoctor']['Hospital']['hospital_name'];
|
||||
}
|
||||
|
||||
// 按照天来计算,当日为1,前一天为2 未服务过为0
|
||||
if (empty($patient_history_doctor['created_at'])) {
|
||||
$data['days'] = 0;
|
||||
} else {
|
||||
$data['days'] = ceil((strtotime(date('Y-m-d', strtotime('+1 day'))) - strtotime($patient_history_doctor['created_at'])) / 86400);
|
||||
}
|
||||
|
||||
$results[] = $data;
|
||||
|
||||
unset($data);
|
||||
}
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 患者端-首页-推荐医生-限制条数
|
||||
* @return array
|
||||
*/
|
||||
protected function getIndexRecommendDoctor(): array
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// 推荐医生
|
||||
$fields = [
|
||||
"doctor_id",
|
||||
"user_id",
|
||||
"user_name",
|
||||
"status",
|
||||
"multi_point_status",
|
||||
"avatar",
|
||||
"doctor_title",
|
||||
"department_custom_name",
|
||||
"hospital_id",
|
||||
"is_online",
|
||||
"is_img_expert_reception",
|
||||
"is_img_welfare_reception",
|
||||
"be_good_at",
|
||||
];
|
||||
|
||||
$recommend_doctors = UserDoctorModel::getIndexRecommendDoctorLimit(5, $fields);
|
||||
if (empty($recommend_doctors)) {
|
||||
return success();
|
||||
}
|
||||
|
||||
foreach ($recommend_doctors as $recommend_doctor) {
|
||||
$data = array();
|
||||
$data['doctor_id'] = $recommend_doctor['doctor_id'];
|
||||
$data['user_id'] = $recommend_doctor['user_id'];
|
||||
$data['user_name'] = $recommend_doctor['user_name'];
|
||||
$data['status'] = $recommend_doctor['status'];
|
||||
$data['multi_point_status'] = $recommend_doctor['multi_point_status']; // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
$data['avatar'] = addAliyunOssWebsite($recommend_doctor['avatar']);
|
||||
$data['doctor_title'] = empty($recommend_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($recommend_doctor['doctor_title']);
|
||||
$data['department_custom_name'] = $recommend_doctor['department_custom_name'];
|
||||
$data['is_online'] = $recommend_doctor['is_online'];
|
||||
$data['is_img_welfare_reception'] = $recommend_doctor['is_img_welfare_reception'];
|
||||
$data['be_good_at'] = $recommend_doctor['be_good_at'];
|
||||
$data['hospital_name'] = $recommend_doctor['Hospital']['hospital_name'];
|
||||
$data['hospital_level_name'] = $recommend_doctor['Hospital']['hospital_level_name'];
|
||||
|
||||
// 处理接诊价格
|
||||
$data['price'] = 0;
|
||||
$data['free_clinic_price'] = 0;
|
||||
foreach ($recommend_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) {
|
||||
if ($doctor_inquiry_config['inquiry_mode'] == 1){
|
||||
if ($doctor_inquiry_config['inquiry_type'] == 1) {
|
||||
// 专家问诊
|
||||
$data['price'] = $doctor_inquiry_config['inquiry_price'];
|
||||
}
|
||||
|
||||
if ($doctor_inquiry_config['inquiry_type'] == 3) {
|
||||
// 公益
|
||||
$data['free_clinic_price'] = $doctor_inquiry_config['inquiry_price'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$results[] = $data;
|
||||
|
||||
unset($data);
|
||||
}
|
||||
return success($results);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user