迁移并合并医生问诊评价接口
This commit is contained in:
@@ -5,15 +5,19 @@ namespace App\Services;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Exception\BusinessException;
|
||||
use App\Model\BasicBank;
|
||||
use App\Model\BasicWord;
|
||||
use App\Model\DiseaseClassExpertise;
|
||||
use App\Model\DiseaseClassIcd;
|
||||
use App\Model\DoctorAccount;
|
||||
use App\Model\DoctorBankCard;
|
||||
use App\Model\DoctorExpertise;
|
||||
use App\Model\DoctorInquiryConfig;
|
||||
use App\Model\DoctorWord;
|
||||
use App\Model\OrderEvaluation;
|
||||
use App\Model\OrderInquiry;
|
||||
use App\Model\OrderInquiryCase;
|
||||
use App\Model\OrderPrescription;
|
||||
use App\Model\User;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Model\UserDoctorInfo;
|
||||
use App\Utils\Mask;
|
||||
@@ -57,7 +61,6 @@ class UserDoctorService extends BaseService
|
||||
return success($disease_class_expertise);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取医生已选择专长
|
||||
* @param string $doctor_id
|
||||
@@ -513,6 +516,133 @@ class UserDoctorService extends BaseService
|
||||
return success($user_doctor);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常用语列表
|
||||
* @return array
|
||||
*/
|
||||
public function getDoctorWords(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$words_type = $this->request->input('words_type');
|
||||
|
||||
$result = array();
|
||||
|
||||
// 获取系统常用语
|
||||
$params = array();
|
||||
$params['basics_words_type'] = $words_type;
|
||||
$params['basics_words_status'] = 1;
|
||||
$basic_words = BasicWord::getList($params);
|
||||
if (!empty($basic_words)){
|
||||
foreach ($basic_words as $item){
|
||||
$data = array();
|
||||
$data['words'] = $item['basics_words'];
|
||||
|
||||
$result[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取医生自定义常用语
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$params['words_type'] = $words_type;
|
||||
$params['words_status'] = 1;
|
||||
$doctor_words = DoctorWord::getList($params);
|
||||
if (!empty($doctor_words)){
|
||||
foreach ($doctor_words as $item){
|
||||
$data = array();
|
||||
$data['words'] = $item['words'];
|
||||
|
||||
$result[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常用语列表
|
||||
* @return array
|
||||
*/
|
||||
public function addDoctorWords(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$words = $this->request->input('words');
|
||||
$words_type = $this->request->input('words_type');
|
||||
|
||||
// 查询是否重复
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$params['words_type'] = $words_type;
|
||||
$params['words'] = $words;
|
||||
$doctor_words = DoctorWord::getOne($params);
|
||||
if (!empty($doctor_words)){
|
||||
if ($doctor_words['words_status'] == 0){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"此常用语已被禁用");
|
||||
}else{
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"请勿重复添加");
|
||||
}
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['doctor_id'] = $user_info['client_user_id'];
|
||||
$data['words_type'] = $words_type;
|
||||
$data['words_status'] = 1;
|
||||
$data['sort'] = 0;
|
||||
$data['words'] = $words;
|
||||
|
||||
$doctor_words = DoctorWord::addDoctorWord($data);
|
||||
if (empty($doctor_words)){
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生评价
|
||||
* @return array
|
||||
*/
|
||||
public function getDoctorEvaluationList(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$doctor_id = $this->request->input('doctor_id');
|
||||
$evaluation_type = $this->request->input('evaluation_type',1);
|
||||
$page = $this->request->input('page',1);
|
||||
$per_page = $this->request->input('per_page',10);
|
||||
|
||||
if (empty($user_info)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
|
||||
// 4-5分为好评、3分为中评、2-1分为差评
|
||||
if ($evaluation_type == 1){
|
||||
// 全部
|
||||
$avg_score_params = [0,100];
|
||||
}elseif ($evaluation_type == 2){
|
||||
// 好评
|
||||
$avg_score_params = [80,100];
|
||||
}elseif ($evaluation_type == 3){
|
||||
// 中/差评
|
||||
$avg_score_params = [0,80];
|
||||
}else{
|
||||
return fail();
|
||||
}
|
||||
|
||||
$order_evaluation = OrderEvaluation::getScorePage($params,$avg_score_params);
|
||||
if (!empty($order_evaluation['data'])){
|
||||
foreach ($order_evaluation['data'] as &$item){
|
||||
$item['avg_score'] = floor($item['avg_score'] * 0.05);
|
||||
}
|
||||
}
|
||||
|
||||
return success($order_evaluation);
|
||||
}
|
||||
/**
|
||||
* 检测医生身份认证
|
||||
* @param object|array $user_doctor 医生表数据
|
||||
|
||||
Reference in New Issue
Block a user