迁移并合并医生问诊评价接口
This commit is contained in:
parent
d944b04536
commit
c128a3724d
@ -3,7 +3,9 @@
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Request\BasicDataRequest;
|
||||
use App\Request\DiseaseRequest;
|
||||
use App\Services\BasicDataService;
|
||||
use App\Services\DiseaseService;
|
||||
use App\Services\SafeService;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
@ -73,4 +75,42 @@ class BasicDataController extends AbstractController
|
||||
$data = $BasicDataService->getOperationManualInfo();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索疾病分类
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getDiseaseSearch(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(BasicDataRequest::class);
|
||||
$request->scene('getDiseaseSearch')->validateResolved();
|
||||
|
||||
$BasicDataService = new BasicDataService();
|
||||
$data = $BasicDataService->getDiseaseSearch();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常见疾病分类
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getDiseaseHot(): ResponseInterface
|
||||
{
|
||||
$BasicDataService = new BasicDataService();
|
||||
$data = $BasicDataService->getDiseaseHot();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 专长列表
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getDiseaseExpertiseList(): ResponseInterface
|
||||
{
|
||||
$BasicDataService = new BasicDataService();
|
||||
$data = $BasicDataService->getDiseaseExpertiseList();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Request\DiseaseRequest;
|
||||
use App\Services\DiseaseService;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class DiseaseController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* 专长列表
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getDiseaseExpertiseList(): ResponseInterface
|
||||
{
|
||||
$DiseaseService = new DiseaseService();
|
||||
$data = $DiseaseService->getDiseaseExpertiseList();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索疾病分类
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getDiseaseSearch(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(DiseaseRequest::class);
|
||||
$request->scene('getDiseaseSearch')->validateResolved();
|
||||
|
||||
$DiseaseService = new DiseaseService();
|
||||
$data = $DiseaseService->getDiseaseSearch();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常见疾病分类
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getDiseaseHot(): ResponseInterface
|
||||
{
|
||||
$DiseaseService = new DiseaseService();
|
||||
$data = $DiseaseService->getDiseaseHot();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -42,17 +42,6 @@ class PatientDoctorController extends AbstractController
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生评价
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getDoctorEvaluationList(): ResponseInterface
|
||||
{
|
||||
$PatientDoctorService = new PatientDoctorService();
|
||||
$data = $PatientDoctorService->getDoctorEvaluationList();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 医生详情简介-详情中的简介
|
||||
* @return ResponseInterface
|
||||
|
||||
@ -154,5 +154,51 @@ class UserDoctorController extends AbstractController
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常用语列表
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getDoctorWords(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(UserDoctorRequest::class);
|
||||
$request->scene('getDoctorWords')->validateResolved();
|
||||
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$data = $UserDoctorService->getDoctorWords();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常用语列表
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function addDoctorWords(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(UserDoctorRequest::class);
|
||||
$request->scene('addDoctorWords')->validateResolved();
|
||||
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$data = $UserDoctorService->addDoctorWords();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生评价
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getDoctorEvaluationList(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(UserDoctorRequest::class);
|
||||
$request->scene('getDoctorEvaluationList')->validateResolved();
|
||||
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$data = $UserDoctorService->getDoctorEvaluationList();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -6,16 +6,18 @@ namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $basics_words_id 主键id
|
||||
* @property string $basics_words_id 主键id
|
||||
* @property int $basics_words_type 类型(1:图文问诊 2:开具处方 3:问诊结束)
|
||||
* @property int $basics_words_status 状态(0:禁用 1:正常)
|
||||
* @property int $sort 排序值(越大排序越靠前)
|
||||
* @property string $basics_words 回复语
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class BasicWord extends Model
|
||||
{
|
||||
@ -34,5 +36,29 @@ class BasicWord extends Model
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['basics_words_id' => 'integer', 'basics_words_type' => 'integer', 'basics_words_status' => 'integer', 'sort' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
protected array $casts = ['basics_words_id' => 'string', 'basics_words_type' => 'integer', 'basics_words_status' => 'integer', 'sort' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "basics_words_id";
|
||||
|
||||
/**
|
||||
* 获取信息-单条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息-多条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getList(array $params, array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->orderBy('sort','desc')->get($fields);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,10 @@ namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $doctor_words_id 主键id
|
||||
* @property int $doctor_id 医生id
|
||||
@ -13,11 +17,13 @@ namespace App\Model;
|
||||
* @property int $words_status 状态(0:禁用 1:启用)
|
||||
* @property int $sort 排序值(越大排序越靠前)
|
||||
* @property string $words 常用语
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DoctorWord extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
@ -31,5 +37,39 @@ class DoctorWord extends Model
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['doctor_words_id' => 'integer', 'doctor_id' => 'integer', 'words_type' => 'integer', 'words_status' => 'integer', 'sort' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
protected array $casts = ['doctor_words_id' => 'string', 'doctor_id' => 'integer', 'words_type' => 'integer', 'words_status' => 'integer', 'sort' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "doctor_words_id";
|
||||
|
||||
/**
|
||||
* 获取信息-单条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息-多条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getList(array $params, array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->orderBy('sort','desc')->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return \Hyperf\Database\Model\Model|DoctorWord
|
||||
*/
|
||||
public static function addDoctorWord(array $data): \Hyperf\Database\Model\Model|DoctorWord
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,4 +63,28 @@ class OrderEvaluation extends Model
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评分区间列表-分页
|
||||
* @param array $params 条件
|
||||
* @param array $avg_score_params 评分区间 [0.100]
|
||||
* @param array $fields 字段
|
||||
* @param int|null $page 页码
|
||||
* @param int|null $per_page 每页个数
|
||||
* @return array
|
||||
*/
|
||||
public static function getScorePage(array $params, array $avg_score_params,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$raw = self::where($params)
|
||||
->whereBetween('avg_score',$avg_score_params)
|
||||
->paginate($per_page, $fields, "page", $page);
|
||||
$data = array();
|
||||
$data['current_page'] = $raw->currentPage();// 当前页码
|
||||
$data['total'] = $raw->total();//数据总数
|
||||
$data['data'] = $raw->items();//数据
|
||||
$data['per_page'] = $raw->perPage();//每页个数
|
||||
$data['last_page'] = $raw->lastPage();//最后一页
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,9 @@ class BasicDataRequest extends FormRequest
|
||||
'city_id',
|
||||
'county_id',
|
||||
],
|
||||
'getDiseaseSearch' => [ // 搜索疾病分类
|
||||
'disease_class_name',
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
@ -33,6 +36,7 @@ class BasicDataRequest extends FormRequest
|
||||
return [
|
||||
'province_id' => 'required_with:city_id,county_id',
|
||||
'city_id' => 'required_with:county_id',
|
||||
'disease_class_name' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
@ -44,6 +48,7 @@ class BasicDataRequest extends FormRequest
|
||||
return [
|
||||
'province_id.required_with' => "请选择省份",
|
||||
'city_id.required_with' => "请选择城市",
|
||||
'disease_class_name.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class DiseaseRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'getDiseaseSearch' => [ // 搜索疾病分类
|
||||
'disease_class_name',
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'disease_class_name' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'disease_class_name.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -43,6 +43,17 @@ class UserDoctorRequest extends FormRequest
|
||||
'getPrescriptionList' => [ // 获取处方列表
|
||||
'prescription_status' // 处方审核状态(0:审核中 1:审核成功 2:审核驳回)
|
||||
],
|
||||
'getDoctorWords' => [ // 获取常用语列表
|
||||
'words_type'
|
||||
],
|
||||
'addDoctorWords' => [ // 新增常用语列表
|
||||
'words',
|
||||
'words_type'
|
||||
],
|
||||
'getDoctorEvaluationList' => [ // 获取医生评价
|
||||
'doctor_id',
|
||||
'evaluation_type',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
@ -70,6 +81,10 @@ class UserDoctorRequest extends FormRequest
|
||||
'city_id' => 'required|required_with:county_id',
|
||||
'county_id' => 'required',
|
||||
'prescription_status' => 'required|integer|min:0|max:2',
|
||||
'words_type' => 'required|integer|min:1|max:3',
|
||||
'words' => 'required',
|
||||
'doctor_id' => 'required',
|
||||
'evaluation_type' => 'required|integer|min:1|max:3',
|
||||
];
|
||||
}
|
||||
|
||||
@ -107,6 +122,16 @@ class UserDoctorRequest extends FormRequest
|
||||
'prescription_status.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'prescription_status.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'prescription_status.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'words_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'words_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'words_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'words_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'words.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'doctor_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'evaluation_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'evaluation_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'evaluation_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'evaluation_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Model\BasicBank;
|
||||
use App\Model\DiseaseClass;
|
||||
use App\Model\DiseaseClassExpertise;
|
||||
use App\Model\Hospital;
|
||||
use App\Model\HospitalDepartmentCustom;
|
||||
use App\Model\OperationManual;
|
||||
@ -126,4 +128,46 @@ class BasicDataService extends BaseService
|
||||
|
||||
return success($operation_manual->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索疾病分类
|
||||
* @return array
|
||||
*/
|
||||
public function getDiseaseSearch(): array
|
||||
{
|
||||
$disease_class_name = $this->request->input('disease_class_name');
|
||||
|
||||
$params = array();
|
||||
$params[] = ["disease_class_status",1];
|
||||
$params[] = ["disease_class_enable",1];
|
||||
$params[] = ['disease_class_name', 'like', '%' . $disease_class_name . '%'];
|
||||
$disease_class = DiseaseClass::getList($params);
|
||||
|
||||
return empty($disease_class) ? success() : success($disease_class->toArray()) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常见疾病分类
|
||||
* @return array
|
||||
*/
|
||||
public function getDiseaseHot(): array
|
||||
{
|
||||
$params = array();
|
||||
$params[] = ["disease_class_status",1];
|
||||
$params[] = ["disease_class_enable",1];
|
||||
$params[] = ['is_hot', 1];
|
||||
$disease_class = DiseaseClass::getLimit($params,10);
|
||||
|
||||
return empty($disease_class) ? success() : success($disease_class->toArray()) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 专长列表
|
||||
* @return array
|
||||
*/
|
||||
public function getDiseaseExpertiseList(): array
|
||||
{
|
||||
$disease_class_expertise = DiseaseClassExpertise::getOrderList();
|
||||
return success($disease_class_expertise);
|
||||
}
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Model\DiseaseClass;
|
||||
use App\Model\DiseaseClassExpertise;
|
||||
use App\Request\DiseaseRequest;
|
||||
use App\Request\PatientFamilyRequest;
|
||||
|
||||
class DiseaseService extends BaseService
|
||||
{
|
||||
/**
|
||||
* 专长列表
|
||||
* @return array
|
||||
*/
|
||||
public function getDiseaseExpertiseList(): array
|
||||
{
|
||||
$disease_class_expertise = DiseaseClassExpertise::getOrderList();
|
||||
return success($disease_class_expertise);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索疾病分类
|
||||
* @return array
|
||||
*/
|
||||
public function getDiseaseSearch(): array
|
||||
{
|
||||
$disease_class_name = $this->request->input('disease_class_name');
|
||||
|
||||
$params = array();
|
||||
$params[] = ["disease_class_status",1];
|
||||
$params[] = ["disease_class_enable",1];
|
||||
$params[] = ['disease_class_name', 'like', '%' . $disease_class_name . '%'];
|
||||
$disease_class = DiseaseClass::getList($params);
|
||||
|
||||
return empty($disease_class) ? success() : success($disease_class->toArray()) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常见疾病分类
|
||||
* @return array
|
||||
*/
|
||||
public function getDiseaseHot(): array
|
||||
{
|
||||
$params = array();
|
||||
$params[] = ["disease_class_status",1];
|
||||
$params[] = ["disease_class_enable",1];
|
||||
$params[] = ['is_hot', 1];
|
||||
$disease_class = DiseaseClass::getLimit($params,10);
|
||||
|
||||
return empty($disease_class) ? success() : success($disease_class->toArray()) ;
|
||||
}
|
||||
}
|
||||
@ -273,43 +273,6 @@ class PatientDoctorService extends BaseService
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生评价
|
||||
* @return array
|
||||
*/
|
||||
public function getDoctorEvaluationList(): array
|
||||
{
|
||||
$doctor_id = $this->request->input('doctor_id');
|
||||
$page = $this->request->input('page', 1);
|
||||
$per_page = $this->request->input('per_page', 10);
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$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);
|
||||
if (empty($user_doctor)){
|
||||
return fail(HttpEnumCode::CLIENT_HTTP_ERROR);
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$order_evaluation = OrderEvaluation::getPage($params);
|
||||
|
||||
if (!empty($order_evaluation['data'])){
|
||||
foreach ($order_evaluation['data'] as &$data){
|
||||
// 处理综合评分
|
||||
if ($data['avg_score'] != 0){
|
||||
$data['avg_score'] = ceil($data['avg_score'] * 0.05 * 100) / 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return success($order_evaluation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 医生详情简介-详情中的简介
|
||||
* @return array
|
||||
|
||||
@ -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 医生表数据
|
||||
|
||||
@ -34,7 +34,7 @@ return [
|
||||
'commands' => [
|
||||
'gen:model' => [
|
||||
'path' => 'app/Model', //模型路径
|
||||
'force_casts' => true, //是否强制重置 casts 参数
|
||||
'force_casts' => false, //是否强制重置 casts 参数
|
||||
'inheritance' => 'Model', //父类
|
||||
'uses' => '', //配合 inheritance 使用
|
||||
'refresh_fillable' => true, //是否刷新 fillable 参数
|
||||
|
||||
@ -131,6 +131,16 @@ Router::addGroup('/doctor', function () {
|
||||
Router::get('', [UserDoctorController::class, 'getPrescriptionList']);
|
||||
});
|
||||
|
||||
// 常用语
|
||||
Router::addGroup('/words', function () {
|
||||
// 获取常用语列表
|
||||
Router::get('', [UserDoctorController::class, 'getDoctorWords']);
|
||||
|
||||
// 新增常用语列表
|
||||
Router::post('', [UserDoctorController::class, 'addDoctorWords']);
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
@ -169,9 +179,6 @@ Router::addGroup('/patient', function () {
|
||||
|
||||
// 医生数据
|
||||
Router::addGroup('/doctor', function () {
|
||||
// 获取医生评价
|
||||
Router::get('/evaluation', [PatientDoctorController::class, 'getDoctorEvaluationList']);
|
||||
|
||||
// 医生详情简介-详情中的简介
|
||||
Router::get('/profile/{doctor_id:\d+}', [PatientDoctorController::class, 'getDoctorProfile']);
|
||||
});
|
||||
@ -185,15 +192,6 @@ Router::addGroup('/patient', function () {
|
||||
Router::post('', [PatientFamilyController::class, 'addFamily']);
|
||||
});
|
||||
|
||||
// 疾病分类
|
||||
Router::addGroup('/disease', function () {
|
||||
// 搜索疾病分类
|
||||
Router::get('/search', [DiseaseController::class, 'getDiseaseSearch']);
|
||||
|
||||
// 获取常见疾病分类
|
||||
Router::get('/hot', [DiseaseController::class, 'getDiseaseHot']);
|
||||
});
|
||||
|
||||
// 病例
|
||||
Router::addGroup('/case', function () {
|
||||
// 获取患者最后一份问诊病例
|
||||
@ -226,11 +224,6 @@ Router::addGroup('/code', function () {
|
||||
Router::post('/phone', [CodeController::class, 'getPhoneCode']);
|
||||
});
|
||||
|
||||
// 疾病分类api
|
||||
Router::addGroup('/disease', function () {
|
||||
// 疾病专长列表-搜索使用
|
||||
Router::get('/expertise', [DiseaseController::class, 'getDiseaseExpertiseList']);
|
||||
});
|
||||
|
||||
// 省市区
|
||||
Router::addGroup('/area', function () {
|
||||
@ -266,5 +259,20 @@ Router::addGroup('/basic', function () {
|
||||
|
||||
// 获取操作手册详情
|
||||
Router::get('/operation/manual/{manual_id:\d+}', [BasicDataController::class, 'getOperationManualInfo']);
|
||||
|
||||
// 自定义疾病分类
|
||||
Router::addGroup('/disease', function () {
|
||||
// 搜索疾病分类
|
||||
Router::get('/search', [BasicDataController::class, 'getDiseaseSearch']);
|
||||
|
||||
// 获取常见疾病分类
|
||||
Router::get('/hot', [BasicDataController::class, 'getDiseaseHot']);
|
||||
|
||||
// 获取疾病专长列表
|
||||
// 搜索使用
|
||||
Router::get('/expertise', [BasicDataController::class, 'getDiseaseExpertiseList']);
|
||||
});
|
||||
});
|
||||
|
||||
// 获取医生评价
|
||||
Router::get('/evaluation', [UserDoctorController::class, 'getDoctorEvaluationList']);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user