拆分医生详情接口,
This commit is contained in:
parent
b53b0204cf
commit
6342f28467
@ -31,17 +31,6 @@ class PatientDoctorController extends AbstractController
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取问诊医生详情
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getInquiryDoctorInfo(): ResponseInterface
|
||||
{
|
||||
$PatientDoctorService = new PatientDoctorService();
|
||||
$data = $PatientDoctorService->getInquiryDoctorInfo();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 医生详情简介-详情中的简介
|
||||
* @return ResponseInterface
|
||||
|
||||
@ -10,6 +10,7 @@ use App\Request\UserDoctorRequest;
|
||||
use App\Services\DoctorAuthService;
|
||||
use App\Services\DoctorInquiryService;
|
||||
use App\Services\ImService;
|
||||
use App\Services\PatientDoctorService;
|
||||
use App\Services\UserDoctorService;
|
||||
use Extend\TencentIm\Account;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
@ -338,4 +339,26 @@ class UserDoctorController extends AbstractController
|
||||
$data = $UserDoctorService->addDoctorInquiry();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生详情-问诊
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getDoctorInfoInquiry(): ResponseInterface
|
||||
{
|
||||
$userDoctorService = new UserDoctorService();
|
||||
$data = $userDoctorService->getDoctorInfoInquiry();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生开启的服务
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getDoctorOpenInquiryService(): ResponseInterface
|
||||
{
|
||||
$userDoctorService = new UserDoctorService();
|
||||
$data = $userDoctorService->getDoctorOpenInquiryService();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -12,7 +12,7 @@ use App\Model\UserDoctor;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
/**
|
||||
* 医生问诊
|
||||
* 医生问诊配置
|
||||
*/
|
||||
class DoctorInquiryService extends BaseService
|
||||
{
|
||||
|
||||
@ -155,177 +155,6 @@ class PatientDoctorService extends BaseService
|
||||
return success($user_doctors);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取问诊医生详情
|
||||
* @return array
|
||||
*/
|
||||
public function getInquiryDoctorInfo(): array
|
||||
{
|
||||
$doctor_id = $this->request->route('doctor_id');
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$result = array();
|
||||
$result['hospital'] = [];
|
||||
$result['days'] = 0;
|
||||
$result['doctor_inquiry_config'] = [];
|
||||
|
||||
$fields = [
|
||||
"doctor_id",
|
||||
"user_id",
|
||||
"user_name",
|
||||
"iden_auth_status",
|
||||
"multi_point_status",
|
||||
"avatar",
|
||||
"doctor_title",
|
||||
"department_custom_id",
|
||||
"department_custom_name",
|
||||
"hospital_id",
|
||||
"served_patients_num",
|
||||
"praise_rate",
|
||||
"avg_response_time",
|
||||
"number_of_fans",
|
||||
"be_good_at",
|
||||
"brief_introduction",
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$params['status'] = 1; // 状态(0:禁用 1:正常 2:删除)
|
||||
$params["iden_auth_status"] = 1;// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
$user_doctor = UserDoctor::getOne($params, $fields);
|
||||
if (empty($user_doctor)) {
|
||||
return fail(HttpEnumCode::HTTP_SUCCESS, "医生错误");
|
||||
}
|
||||
|
||||
$result = $user_doctor->toArray();
|
||||
|
||||
$result['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']);
|
||||
|
||||
$result['hospital'] = [];
|
||||
$result['days'] = 0;
|
||||
$result['doctor_inquiry_config'] = 0;
|
||||
$result['is_online'] = 0;
|
||||
|
||||
// 获取医生医院数据
|
||||
$fields = [
|
||||
'hospital_id',
|
||||
'hospital_name',
|
||||
'hospital_level_name',
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['hospital_id'] = $user_doctor['hospital_id'];
|
||||
$hospital = Hospital::getOne($params, $fields);
|
||||
if (!empty($hospital)) {
|
||||
$result['hospital'] = $hospital;
|
||||
}
|
||||
|
||||
// 获取服务天数
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$params['history_status'] = 1;
|
||||
$patient_history_doctor = PatientHistoryInquiryModel::getOrderOne($params);
|
||||
// 按照天来计算,当日为1,前一天为2 未服务过为0
|
||||
if (!empty($patient_history_doctor['created_at'])) {
|
||||
$result['days'] = ceil((strtotime(date('Y-m-d', strtotime('+1 day'))) - strtotime($patient_history_doctor['created_at'])) / 86400);
|
||||
}
|
||||
|
||||
// 获取关注状态
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$result['follow'] = PatientFollow::getExists($params);
|
||||
|
||||
// 获取医生问诊配置-问诊购药
|
||||
$result['multi_point_enable'] = 0;
|
||||
|
||||
// 获取问诊价格
|
||||
// 专家-公益
|
||||
$params = array();
|
||||
$params[] = ['doctor_id', '=', $doctor_id];
|
||||
$params[] = ['inquiry_mode', '=', 1];// 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
$doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*'],[1,3,4]);
|
||||
if (!empty($doctor_inquiry_config)) {
|
||||
foreach ($doctor_inquiry_config as &$value) {
|
||||
// 获取医生当日的全部订单
|
||||
$params = array();
|
||||
$params[] = ['doctor_id', '=', $doctor_id];
|
||||
$params[] = ['inquiry_type', '=', $value['inquiry_type']];
|
||||
$params[] = ['inquiry_mode', '=', 1];
|
||||
$params[] = ['inquiry_refund_status', '=', 0];
|
||||
|
||||
// 获取当天开始时间
|
||||
$start_date = date('Y-m-d 00:00:00', time());
|
||||
|
||||
// 获取当天结束时间
|
||||
$end_date = date('Y-m-d 23:59:59', time());
|
||||
|
||||
$created_at = [$start_date, $end_date];
|
||||
|
||||
$value['order_inquiry_count'] = OrderInquiry::getDateCount($params,$created_at);
|
||||
|
||||
// 获取系统问诊配置
|
||||
$fields = [
|
||||
'system_inquiry_config_id',
|
||||
'times_number',
|
||||
'duration',
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['inquiry_type'] = $value['inquiry_type'];
|
||||
$params['inquiry_mode'] = $value['inquiry_mode'];
|
||||
$system_inquiry_config = SystemInquiryConfig::getOne($params,$fields);
|
||||
if (empty($system_inquiry_config)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
$value['times_number'] = $system_inquiry_config['times_number'];
|
||||
$value['duration'] = $system_inquiry_config['duration'];
|
||||
|
||||
if ($value['is_enable'] == 1 && $value['inquiry_type'] == 4 && $value['inquiry_mode'] == 1){
|
||||
$result['multi_point_enable'] = 1;
|
||||
}
|
||||
unset($system_inquiry_config);
|
||||
}
|
||||
$result['doctor_inquiry_config'] = $doctor_inquiry_config;
|
||||
}
|
||||
|
||||
// 获取医生已选择专长
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$result['doctor_expertise'] = $UserDoctorService->getDoctorSelectedExpertise($user_doctor['doctor_id']);
|
||||
|
||||
// 好评率-超过5个已结束的订单后展示
|
||||
$result['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100;
|
||||
|
||||
// 响应时间-超过5个已结束的订单后展示
|
||||
$result['avg_response_time'] = floor($user_doctor['avg_response_time'] * 10) / 10;
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
$params['inquiry_status'] = 6; // 已结束
|
||||
$inquiry_order_count = OrderInquiry::getCount($params);
|
||||
if (empty($inquiry_order_count) || $inquiry_order_count == 0) {
|
||||
$result['is_display_score'] = false;
|
||||
} else {
|
||||
$result['is_display_score'] = true;
|
||||
}
|
||||
|
||||
// 头像
|
||||
$result['avatar'] = addAliyunOssWebsite($user_doctor['avatar']);
|
||||
|
||||
// 获取用户数据
|
||||
$params = array();
|
||||
$params['user_id'] = $user_doctor['user_id'];
|
||||
$user = User::getOne($params);
|
||||
if (!empty($user)){
|
||||
$result['is_online'] = $user['is_online'];
|
||||
}
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 医生详情简介-详情中的简介
|
||||
* @return array
|
||||
|
||||
@ -17,6 +17,8 @@ use App\Model\DoctorAccount;
|
||||
use App\Model\DoctorBankCard;
|
||||
use App\Model\DoctorExpertise;
|
||||
use App\Model\DoctorInquiryConfig;
|
||||
use App\Model\DoctorInquiryConfig as DoctorInquiryConfigModel;
|
||||
use App\Model\DoctorInquiryConfigService;
|
||||
use App\Model\DoctorInquiryTime;
|
||||
use App\Model\DoctorWord;
|
||||
use App\Model\Hospital;
|
||||
@ -29,7 +31,9 @@ use App\Model\OrderPrescriptionFile;
|
||||
use App\Model\OrderPrescriptionIcd;
|
||||
use App\Model\OrderPrescriptionProduct;
|
||||
use App\Model\OrderProductItem;
|
||||
use App\Model\PatientFollow;
|
||||
use App\Model\PatientHistoryInquiry;
|
||||
use App\Model\PatientHistoryInquiry as PatientHistoryInquiryModel;
|
||||
use App\Model\Popup;
|
||||
use App\Model\Product;
|
||||
use App\Model\ProductPlatformAmount;
|
||||
@ -1885,6 +1889,407 @@ class UserDoctorService extends BaseService
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生问诊详情
|
||||
* @return array
|
||||
*/
|
||||
public function getDoctorInquiryInfo(): array
|
||||
{
|
||||
$doctor_id = $this->request->route('doctor_id');
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
if (empty($user_info)){
|
||||
return fail(HttpEnumCode::HTTP_SUCCESS, "请登录");
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result['hospital'] = [];
|
||||
$result['days'] = 0;
|
||||
$result['doctor_inquiry_config'] = [];
|
||||
$result['is_online'] = 0;
|
||||
|
||||
$fields = [
|
||||
"doctor_id",
|
||||
"user_id",
|
||||
"user_name",
|
||||
"iden_auth_status",
|
||||
"multi_point_status",
|
||||
"avatar",
|
||||
"doctor_title",
|
||||
"department_custom_id",
|
||||
"department_custom_name",
|
||||
"hospital_id",
|
||||
"served_patients_num",
|
||||
"praise_rate",
|
||||
"avg_response_time",
|
||||
"number_of_fans",
|
||||
"be_good_at",
|
||||
"brief_introduction",
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$params['status'] = 1; // 状态(0:禁用 1:正常 2:删除)
|
||||
$params["iden_auth_status"] = 1;// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
$user_doctor = UserDoctor::getOne($params, $fields);
|
||||
if (empty($user_doctor)) {
|
||||
return fail(HttpEnumCode::HTTP_SUCCESS, "医生错误");
|
||||
}
|
||||
|
||||
$result = $user_doctor->toArray();
|
||||
|
||||
$result['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']);
|
||||
|
||||
// 获取医生医院数据
|
||||
$fields = [
|
||||
'hospital_id',
|
||||
'hospital_name',
|
||||
'hospital_level_name',
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['hospital_id'] = $user_doctor['hospital_id'];
|
||||
$hospital = Hospital::getOne($params, $fields);
|
||||
if (!empty($hospital)) {
|
||||
$result['hospital'] = $hospital;
|
||||
}
|
||||
|
||||
// 患者
|
||||
if ($user_info['user_type'] == 1){
|
||||
// 获取服务天数
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$params['history_status'] = 1;
|
||||
$patient_history_doctor = PatientHistoryInquiryModel::getOrderOne($params);
|
||||
// 按照天来计算,当日为1,前一天为2 未服务过为0
|
||||
if (!empty($patient_history_doctor['created_at'])) {
|
||||
$result['days'] = ceil((strtotime(date('Y-m-d', strtotime('+1 day'))) - strtotime($patient_history_doctor['created_at'])) / 86400);
|
||||
}
|
||||
|
||||
// 获取关注状态
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$result['follow'] = PatientFollow::getExists($params);
|
||||
}
|
||||
|
||||
// 获取医生问诊配置-问诊购药
|
||||
$result['multi_point_enable'] = 0;
|
||||
|
||||
// 获取问诊价格
|
||||
// 专家-公益
|
||||
$params = array();
|
||||
$params[] = ['doctor_id', '=', $doctor_id];
|
||||
$params[] = ['inquiry_mode', '=', 1];// 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
$doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*'],[1,3,4]);
|
||||
if (!empty($doctor_inquiry_config)) {
|
||||
foreach ($doctor_inquiry_config as &$value) {
|
||||
// 获取医生当日的全部订单
|
||||
$params = array();
|
||||
$params[] = ['doctor_id', '=', $doctor_id];
|
||||
$params[] = ['inquiry_type', '=', $value['inquiry_type']];
|
||||
$params[] = ['inquiry_mode', '=', 1];
|
||||
$params[] = ['inquiry_refund_status', '=', 0];
|
||||
|
||||
// 获取当天开始时间
|
||||
$start_date = date('Y-m-d 00:00:00', time());
|
||||
|
||||
// 获取当天结束时间
|
||||
$end_date = date('Y-m-d 23:59:59', time());
|
||||
|
||||
$created_at = [$start_date, $end_date];
|
||||
|
||||
$value['order_inquiry_count'] = OrderInquiry::getDateCount($params,$created_at);
|
||||
|
||||
// 获取系统问诊配置
|
||||
$fields = [
|
||||
'system_inquiry_config_id',
|
||||
'times_number',
|
||||
'duration',
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['inquiry_type'] = $value['inquiry_type'];
|
||||
$params['inquiry_mode'] = $value['inquiry_mode'];
|
||||
$system_inquiry_config = SystemInquiryConfig::getOne($params,$fields);
|
||||
if (empty($system_inquiry_config)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
$value['times_number'] = $system_inquiry_config['times_number'];
|
||||
$value['duration'] = $system_inquiry_config['duration'];
|
||||
|
||||
if ($value['is_enable'] == 1 && $value['inquiry_type'] == 4 && $value['inquiry_mode'] == 1){
|
||||
$result['multi_point_enable'] = 1;
|
||||
}
|
||||
unset($system_inquiry_config);
|
||||
}
|
||||
$result['doctor_inquiry_config'] = $doctor_inquiry_config;
|
||||
}
|
||||
|
||||
// 获取医生已选择专长
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$result['doctor_expertise'] = $UserDoctorService->getDoctorSelectedExpertise($user_doctor['doctor_id']);
|
||||
|
||||
// 好评率-超过5个已结束的订单后展示
|
||||
$result['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100;
|
||||
|
||||
// 响应时间-超过5个已结束的订单后展示
|
||||
$result['avg_response_time'] = floor($user_doctor['avg_response_time'] * 10) / 10;
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
$params['inquiry_status'] = 6; // 已结束
|
||||
$inquiry_order_count = OrderInquiry::getCount($params);
|
||||
if (empty($inquiry_order_count) || $inquiry_order_count == 0) {
|
||||
$result['is_display_score'] = false;
|
||||
} else {
|
||||
$result['is_display_score'] = true;
|
||||
}
|
||||
|
||||
// 头像
|
||||
$result['avatar'] = addAliyunOssWebsite($user_doctor['avatar']);
|
||||
|
||||
// 获取用户数据
|
||||
$params = array();
|
||||
$params['user_id'] = $user_doctor['user_id'];
|
||||
$user = User::getOne($params);
|
||||
if (!empty($user)){
|
||||
$result['is_online'] = $user['is_online'];
|
||||
}
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生详情-问诊
|
||||
* @return array
|
||||
*/
|
||||
public function getDoctorInfoInquiry(): array
|
||||
{
|
||||
$doctor_id = $this->request->route('doctor_id');
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
if (empty($user_info)){
|
||||
return fail(HttpEnumCode::HTTP_SUCCESS, "请登录");
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result['hospital'] = [];
|
||||
$result['days'] = 0;
|
||||
$result['doctor_inquiry_config'] = [];
|
||||
$result['is_online'] = 0;
|
||||
|
||||
$fields = [
|
||||
"doctor_id",
|
||||
"user_id",
|
||||
"user_name",
|
||||
"iden_auth_status",
|
||||
"multi_point_status",
|
||||
"avatar",
|
||||
"doctor_title",
|
||||
"department_custom_id",
|
||||
"department_custom_name",
|
||||
"hospital_id",
|
||||
"served_patients_num",
|
||||
"praise_rate",
|
||||
"avg_response_time",
|
||||
"number_of_fans",
|
||||
"be_good_at",
|
||||
"brief_introduction",
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$params['status'] = 1; // 状态(0:禁用 1:正常 2:删除)
|
||||
$params["iden_auth_status"] = 1;// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
$user_doctor = UserDoctor::getOne($params, $fields);
|
||||
if (empty($user_doctor)) {
|
||||
return fail(HttpEnumCode::HTTP_SUCCESS, "医生错误");
|
||||
}
|
||||
|
||||
$result = $user_doctor->toArray();
|
||||
|
||||
$result['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']);
|
||||
|
||||
// 获取医生医院数据
|
||||
$fields = [
|
||||
'hospital_id',
|
||||
'hospital_name',
|
||||
'hospital_level_name',
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['hospital_id'] = $user_doctor['hospital_id'];
|
||||
$hospital = Hospital::getOne($params, $fields);
|
||||
if (!empty($hospital)) {
|
||||
$result['hospital'] = $hospital;
|
||||
}
|
||||
|
||||
// 患者
|
||||
if ($user_info['user_type'] == 1){
|
||||
// 获取服务天数
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$params['history_status'] = 1;
|
||||
$patient_history_doctor = PatientHistoryInquiryModel::getOrderOne($params);
|
||||
// 按照天来计算,当日为1,前一天为2 未服务过为0
|
||||
if (!empty($patient_history_doctor['created_at'])) {
|
||||
$result['days'] = ceil((strtotime(date('Y-m-d', strtotime('+1 day'))) - strtotime($patient_history_doctor['created_at'])) / 86400);
|
||||
}
|
||||
|
||||
// 获取关注状态
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$result['follow'] = PatientFollow::getExists($params);
|
||||
}
|
||||
|
||||
// 获取医生已选择专长
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$result['doctor_expertise'] = $UserDoctorService->getDoctorSelectedExpertise($user_doctor['doctor_id']);
|
||||
|
||||
// 好评率-超过5个已结束的订单后展示
|
||||
$result['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100;
|
||||
|
||||
// 响应时间-超过5个已结束的订单后展示
|
||||
$result['avg_response_time'] = floor($user_doctor['avg_response_time'] * 10) / 10;
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
$params['inquiry_status'] = 6; // 已结束
|
||||
$inquiry_order_count = OrderInquiry::getCount($params);
|
||||
if (empty($inquiry_order_count) || $inquiry_order_count == 0) {
|
||||
$result['is_display_score'] = false;
|
||||
} else {
|
||||
$result['is_display_score'] = true;
|
||||
}
|
||||
|
||||
// 头像
|
||||
$result['avatar'] = addAliyunOssWebsite($user_doctor['avatar']);
|
||||
|
||||
// 获取用户数据
|
||||
$params = array();
|
||||
$params['user_id'] = $user_doctor['user_id'];
|
||||
$user = User::getOne($params);
|
||||
if (!empty($user)){
|
||||
$result['is_online'] = $user['is_online'];
|
||||
}
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生开启的服务
|
||||
* @return array
|
||||
*/
|
||||
public function getDoctorOpenInquiryService(): array
|
||||
{
|
||||
$doctor_id = $this->request->route('doctor_id');
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
if (empty($user_info)){
|
||||
return fail(HttpEnumCode::HTTP_SUCCESS, "请登录");
|
||||
}
|
||||
|
||||
$fields = [
|
||||
"doctor_id",
|
||||
"user_id",
|
||||
"user_name",
|
||||
"iden_auth_status",
|
||||
"multi_point_status",
|
||||
"avatar",
|
||||
"doctor_title",
|
||||
"department_custom_id",
|
||||
"department_custom_name",
|
||||
"hospital_id",
|
||||
"served_patients_num",
|
||||
"praise_rate",
|
||||
"avg_response_time",
|
||||
"number_of_fans",
|
||||
"be_good_at",
|
||||
"brief_introduction",
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$params['status'] = 1; // 状态(0:禁用 1:正常 2:删除)
|
||||
$params["iden_auth_status"] = 1;// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
$user_doctor = UserDoctor::getOne($params, $fields);
|
||||
if (empty($user_doctor)) {
|
||||
return fail(HttpEnumCode::HTTP_SUCCESS, "医生错误");
|
||||
}
|
||||
|
||||
// 获取问诊配置
|
||||
$params = array();
|
||||
$params[] = ['doctor_id', '=', $doctor_id];
|
||||
$doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*'],[1,3,4]);
|
||||
if (!empty($doctor_inquiry_config)) {
|
||||
foreach ($doctor_inquiry_config as &$value) {
|
||||
// 获取医生当日的全部订单
|
||||
$params = array();
|
||||
$params[] = ['doctor_id', '=', $doctor_id];
|
||||
$params[] = ['inquiry_type', '=', $value['inquiry_type']];
|
||||
$params[] = ['inquiry_mode', '=', 1];
|
||||
$params[] = ['inquiry_refund_status', '=', 0];
|
||||
|
||||
// 获取当天开始时间
|
||||
$start_date = date('Y-m-d 00:00:00', time());
|
||||
|
||||
// 获取当天结束时间
|
||||
$end_date = date('Y-m-d 23:59:59', time());
|
||||
|
||||
$created_at = [$start_date, $end_date];
|
||||
|
||||
$value['order_inquiry_count'] = OrderInquiry::getDateCount($params,$created_at);
|
||||
|
||||
// 获取回合数以及问诊时间
|
||||
if ($value['inquiry_mode'] == 6){
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$params['inquiry_type'] = $value['inquiry_type'];
|
||||
$params['inquiry_mode'] = $value['inquiry_mode'];
|
||||
$doctor_inquiry_config_service = DoctorInquiryConfigService::getOne($params);
|
||||
if (empty($doctor_inquiry_config_service)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
$value['times_number'] = $doctor_inquiry_config_service['service_period']; // 服务回合数(0表示不限次)
|
||||
$value['duration'] = $doctor_inquiry_config_service['duration']; // 服务周期(天,不存在0的情况)
|
||||
|
||||
unset($doctor_inquiry_config_service);
|
||||
}else{
|
||||
// 获取系统问诊配置
|
||||
$fields = [
|
||||
'system_inquiry_config_id',
|
||||
'times_number',
|
||||
'duration',
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['inquiry_type'] = $value['inquiry_type'];
|
||||
$params['inquiry_mode'] = $value['inquiry_mode'];
|
||||
$system_inquiry_config = SystemInquiryConfig::getOne($params,$fields);
|
||||
if (empty($system_inquiry_config)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
$value['times_number'] = $system_inquiry_config['times_number'];// 沟通次数(0为不限制次数)
|
||||
$value['duration'] = $system_inquiry_config['duration'];// 沟通时长(分钟,0为不限制时长)
|
||||
|
||||
unset($system_inquiry_config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return success($doctor_inquiry_config->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测医生身份认证
|
||||
* @param object|array $user_doctor 医生表数据
|
||||
|
||||
@ -212,6 +212,7 @@ Router::addGroup('/doctor', function () {
|
||||
// 获取医生名片
|
||||
Router::get('/card', [UserDoctorController::class, 'getDoctorInfoCard']);
|
||||
|
||||
// 个人简介
|
||||
Router::addGroup('/brief', function () {
|
||||
// 获取医生个人简介数据
|
||||
Router::get('', [UserDoctorController::class, 'getDoctorBrief']);
|
||||
@ -831,4 +832,16 @@ Router::addGroup('/pathography', function () {
|
||||
|
||||
// 删除家庭成员病情记录
|
||||
Router::delete('/{pathography_id:\d+}', [PatientPathographyController::class, 'deleteFamilyPathography']);
|
||||
});
|
||||
|
||||
// 医生数据
|
||||
Router::addGroup('/doctor', function () {
|
||||
// 详情
|
||||
Router::addGroup('/info', function () {
|
||||
// 获取医生详情-问诊
|
||||
Router::get('/inquiry/{doctor_id:\d+}', [UserDoctorController::class, 'getDoctorInfoInquiry']);
|
||||
});
|
||||
|
||||
// 获取医生开启的服务列表
|
||||
Router::get('/inquiry/service/{doctor_id:\d+}', [UserDoctorController::class, 'getDoctorOpenInquiryService']);
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user