新增医生问诊配置相关接口
This commit is contained in:
parent
4d5db7760a
commit
b53b0204cf
110
app/Controller/DoctorInquiryConfigController.php
Normal file
110
app/Controller/DoctorInquiryConfigController.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
// 医生问诊配置
|
||||
use App\Request\DoctorInquiryConfigRequest;
|
||||
use App\Request\UserDoctorRequest;
|
||||
use App\Services\DoctorInquiryService;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class DoctorInquiryConfigController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* 获取医生问诊配置
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getInquiryConfig(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(DoctorInquiryConfigRequest::class);
|
||||
$request->scene('getInquiryConfig')->validateResolved();
|
||||
|
||||
$DoctorInquiryService = new DoctorInquiryService();
|
||||
$data = $DoctorInquiryService->getInquiryConfig();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 医生问诊开关
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function putInquiryOpen(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(DoctorInquiryConfigRequest::class);
|
||||
$request->scene('putInquiryOpen')->validateResolved();
|
||||
|
||||
$DoctorInquiryService = new DoctorInquiryService();
|
||||
$data = $DoctorInquiryService->putInquiryOpen();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改医生问诊配置
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function putInquiryConfig(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(DoctorInquiryConfigRequest::class);
|
||||
$request->scene('putInquiryConfig')->validateResolved();
|
||||
|
||||
$DoctorInquiryService = new DoctorInquiryService();
|
||||
$data = $DoctorInquiryService->putInquiryConfig();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生问诊配置-服务设置
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getInquiryServiceConfig(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(DoctorInquiryConfigRequest::class);
|
||||
$request->scene('getInquiryServiceConfig')->validateResolved();
|
||||
|
||||
$DoctorInquiryService = new DoctorInquiryService();
|
||||
$data = $DoctorInquiryService->getInquiryServiceConfig();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增医生问诊配置-服务设置
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function addInquiryServiceConfig(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(DoctorInquiryConfigRequest::class);
|
||||
$request->scene('addInquiryServiceConfig')->validateResolved();
|
||||
|
||||
$DoctorInquiryService = new DoctorInquiryService();
|
||||
$data = $DoctorInquiryService->addInquiryServiceConfig();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改医生问诊配置-服务设置
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function putInquiryServiceConfig(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(DoctorInquiryConfigRequest::class);
|
||||
$request->scene('putInquiryServiceConfig')->validateResolved();
|
||||
|
||||
$DoctorInquiryService = new DoctorInquiryService();
|
||||
$data = $DoctorInquiryService->putInquiryServiceConfig();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -40,54 +40,6 @@ class UserDoctorController extends AbstractController
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生问诊配置
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getInquiryConfig(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(UserDoctorRequest::class);
|
||||
$request->scene('getInquiryConfig')->validateResolved();
|
||||
|
||||
$DoctorInquiryService = new DoctorInquiryService();
|
||||
$data = $DoctorInquiryService->getInquiryConfig();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 医生问诊开关
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function putInquiryOpen(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(UserDoctorRequest::class);
|
||||
$request->scene('putInquiryOpen')->validateResolved();
|
||||
|
||||
$DoctorInquiryService = new DoctorInquiryService();
|
||||
$data = $DoctorInquiryService->putInquiryOpen();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改医生问诊配置
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function putInquiryConfig(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(UserDoctorRequest::class);
|
||||
$request->scene('putInquiryConfig')->validateResolved();
|
||||
|
||||
$DoctorInquiryService = new DoctorInquiryService();
|
||||
$data = $DoctorInquiryService->putInquiryConfig();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生银行卡
|
||||
* @return ResponseInterface
|
||||
|
||||
81
app/Model/DoctorInquiryConfigService.php
Normal file
81
app/Model/DoctorInquiryConfigService.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $config_service_id 主键id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $inquiry_type 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
* @property string $service_content 服务内容
|
||||
* @property string $service_process 服务流程
|
||||
* @property int $service_period 服务周期
|
||||
* @property int $service_rounds 服务回合数
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DoctorInquiryConfigService extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'doctor_inquiry_config_service';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['config_service_id', 'doctor_id', 'inquiry_type', 'inquiry_mode', 'service_content', 'service_process', 'service_period', 'service_rounds', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "config_service_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 object|null
|
||||
*/
|
||||
public static function getList(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return DoctorInquiryConfigService|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addDoctorInquiryConfigService(array $data): \Hyperf\Database\Model\Model|DoctorInquiryConfigService
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
108
app/Request/DoctorInquiryConfigRequest.php
Normal file
108
app/Request/DoctorInquiryConfigRequest.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
use Hyperf\Validation\Rule;
|
||||
|
||||
class DoctorInquiryConfigRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'getInquiryConfig' => [ // 获取医生问诊配置
|
||||
'inquiry_type',
|
||||
'inquiry_mode',
|
||||
],
|
||||
'putInquiryOpen' => [ // 医生问诊开关
|
||||
'inquiry_type',
|
||||
'inquiry_mode',
|
||||
'is_open',
|
||||
],
|
||||
'putInquiryConfig' => [ // 修改医生问诊配置
|
||||
'inquiry_type',
|
||||
'inquiry_mode',
|
||||
'inquiry_price',
|
||||
'work_num_day',
|
||||
],
|
||||
'getInquiryServiceConfig' => [ // 获取医生问诊配置-服务设置
|
||||
'inquiry_type',
|
||||
'inquiry_mode',
|
||||
],
|
||||
'addInquiryServiceConfig' => [ // 新增医生问诊配置-服务设置
|
||||
'service_content',
|
||||
'service_process',
|
||||
'service_period',
|
||||
'service_rounds',
|
||||
],
|
||||
'putInquiryServiceConfig' => [ // 修改医生问诊配置-服务设置
|
||||
'service_content',
|
||||
'service_process',
|
||||
'service_period',
|
||||
'service_rounds',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
'inquiry_type' => 'required|integer|min:1|max:3',
|
||||
'inquiry_mode' => 'required|integer|min:1|max:6',
|
||||
'is_open' => "required|boolean",
|
||||
'inquiry_price' => "required|min:0|numeric",
|
||||
'work_num_day' => "required|min:0|numeric",
|
||||
'service_content' => "required",
|
||||
'service_process' => "required",
|
||||
'service_period' => "required|min:2|max:30|numeric",
|
||||
'service_rounds' => "required|min:0|max:300|numeric",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'inquiry_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_mode.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_mode.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_mode.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_mode.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_open.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_open.boolean' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_price.required' => "请填写价格",
|
||||
'inquiry_price.min' => "价格填写错误",
|
||||
'inquiry_price.numeric' => "价格填写错误",
|
||||
'inquiry_mode.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_num_day.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_num_day.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_num_day.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'service_content.required' => "请填写服务内容",
|
||||
'service_process.required' => "请填写服务流程",
|
||||
'service_period.required' => "请填写服务周期",
|
||||
'service_period.min' => "服务周期最小值不可低于2",
|
||||
'service_period.max' => "服务周期最大值不可超过30",
|
||||
'service_period.numeric' => "服务周期填写错误",
|
||||
'service_rounds.required' => "请填写服务回合数",
|
||||
'service_rounds.min' => "服务回合数最小值不可低于0",
|
||||
'service_rounds.max' => "服务回合数最大值不可超过300",
|
||||
'service_rounds.numeric' => "服务回合数填写错误",
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -11,21 +11,6 @@ use Hyperf\Validation\Rule;
|
||||
class UserDoctorRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'getInquiryConfig' => [ // 获取医生问诊配置
|
||||
'inquiry_type',
|
||||
'inquiry_mode',
|
||||
],
|
||||
'putInquiryOpen' => [ // 医生问诊开关
|
||||
'inquiry_type',
|
||||
'inquiry_mode',
|
||||
'is_open',
|
||||
],
|
||||
'putInquiryConfig' => [ // 修改医生问诊配置
|
||||
'inquiry_type',
|
||||
'inquiry_mode',
|
||||
'inquiry_price',
|
||||
'work_num_day',
|
||||
],
|
||||
'addDoctorBankCard' => [ // 新增绑定医生银行卡
|
||||
'bank_id',
|
||||
'bank_card_code',
|
||||
@ -92,10 +77,7 @@ class UserDoctorRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
'inquiry_type' => 'required|integer|min:1|max:3',
|
||||
'inquiry_mode' => 'required|integer|min:1|max:5',
|
||||
'is_open' => "required|boolean",
|
||||
'inquiry_price' => "required|min:0|numeric",
|
||||
'work_num_day' => "required|min:0|numeric",
|
||||
'inquiry_mode' => 'required|integer|min:1|max:6',
|
||||
'bank_id' => "required",
|
||||
'bank_card_code' => ['required'],
|
||||
'province_id' => 'required|required_with:city_id,county_id',
|
||||
@ -130,16 +112,7 @@ class UserDoctorRequest extends FormRequest
|
||||
'inquiry_mode.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_mode.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_mode.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_open.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_open.boolean' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_price.required' => "请填写价格",
|
||||
'inquiry_price.min' => "价格填写错误",
|
||||
'inquiry_price.numeric' => "价格填写错误",
|
||||
'inquiry_mode.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_num_day.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_num_day.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_num_day.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
|
||||
'bank_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'bank_card_code.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'bank_card_code.regex' => "银行卡号填写错误",
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Services;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Exception\BusinessException;
|
||||
use App\Model\DoctorInquiryConfig;
|
||||
use App\Model\DoctorInquiryConfigService;
|
||||
use App\Model\DoctorInquiryPriceRecord;
|
||||
use App\Model\SystemInquiryConfig;
|
||||
use App\Model\UserDoctor;
|
||||
@ -24,11 +25,7 @@ class DoctorInquiryService extends BaseService
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$inquiry_type = $this->request->input('inquiry_type');// 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊)
|
||||
$inquiry_mode = $this->request->input('inquiry_mode');// 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
|
||||
$result = array();
|
||||
$result['info'] = array(); // 配置信息
|
||||
$result['config'] = array(); // 系统配置
|
||||
$inquiry_mode = $this->request->input('inquiry_mode');// 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊)
|
||||
|
||||
// 获取医生信息
|
||||
$params = array();
|
||||
@ -50,14 +47,19 @@ class DoctorInquiryService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行绑定结算银行卡");
|
||||
}
|
||||
|
||||
// 返回数据
|
||||
$result = array();
|
||||
$info = array();
|
||||
$config = array();
|
||||
|
||||
// 接诊开关
|
||||
$is_open = 0;
|
||||
|
||||
// 接诊价格
|
||||
$result['info']['inquiry_price'] = 0;
|
||||
$info['inquiry_price'] = 0;
|
||||
|
||||
// 接诊人数
|
||||
$result['info']['work_num_day'] = 30;
|
||||
$info['work_num_day'] = 30;
|
||||
|
||||
// 系统问诊配置表
|
||||
$params = array();
|
||||
@ -76,22 +78,22 @@ class DoctorInquiryService extends BaseService
|
||||
$doctor_inquiry_config = DoctorInquiryConfig::getOne($params);
|
||||
if (empty($doctor_inquiry_config)) {
|
||||
// 接诊价格
|
||||
$result['info']['inquiry_price'] = $system_inquiry_config['inquiry_price'] ?: 0;
|
||||
$info['inquiry_price'] = $system_inquiry_config['inquiry_price'] ?: 0;
|
||||
if ($inquiry_type == 3) {
|
||||
// 公益问诊,存在价格档次,默认第一档
|
||||
$inquiry_price = explode(',', $system_inquiry_config['inquiry_price']);
|
||||
|
||||
$result['info']['inquiry_price'] = $inquiry_price[0];
|
||||
$info['inquiry_price'] = $inquiry_price[0];
|
||||
}
|
||||
} else {
|
||||
// 接诊价格
|
||||
$result['info']['inquiry_price'] = $doctor_inquiry_config['inquiry_price'] ?: 0;
|
||||
$info['inquiry_price'] = $doctor_inquiry_config['inquiry_price'] ?: 0;
|
||||
if ($inquiry_type == 2) {
|
||||
// 快速-系统配置
|
||||
$result['info']['inquiry_price'] = $system_inquiry_config['inquiry_price'];
|
||||
$info['inquiry_price'] = $system_inquiry_config['inquiry_price'];
|
||||
}
|
||||
|
||||
$result['info']['work_num_day'] = $doctor_inquiry_config['work_num_day'] ?: 0;
|
||||
$info['work_num_day'] = $doctor_inquiry_config['work_num_day'] ?: 0;
|
||||
|
||||
// 接诊开关
|
||||
if ($doctor_inquiry_config['is_enable'] == 1){
|
||||
@ -100,32 +102,35 @@ class DoctorInquiryService extends BaseService
|
||||
}
|
||||
|
||||
// 接诊开关
|
||||
$result['info']['is_open'] = $is_open;
|
||||
$info['is_open'] = $is_open;
|
||||
|
||||
// 每日最大接诊数量
|
||||
$result['config']['max_work_num_day'] = $system_inquiry_config['max_work_num_day'];
|
||||
$config['max_work_num_day'] = $system_inquiry_config['max_work_num_day'];
|
||||
|
||||
// 最低接诊价格(专家问诊)
|
||||
$result['config']['min_inquiry_price'] = $system_inquiry_config['min_inquiry_price'] ?: 0;
|
||||
$config['min_inquiry_price'] = $system_inquiry_config['min_inquiry_price'] ?: 0;
|
||||
|
||||
// 最高接诊价格(专家问诊)
|
||||
$result['config']['max_inquiry_price'] = $system_inquiry_config['max_inquiry_price'] ?: 0;
|
||||
$config['max_inquiry_price'] = $system_inquiry_config['max_inquiry_price'] ?: 0;
|
||||
|
||||
// 默认价格
|
||||
$result['config']['default_inquiry_price'] = $system_inquiry_config['max_inquiry_price'] ?: 0;
|
||||
$config['default_inquiry_price'] = $system_inquiry_config['max_inquiry_price'] ?: 0;
|
||||
|
||||
// 沟通次数(0为不限制次数)
|
||||
$result['config']['times_number'] = $system_inquiry_config['times_number'];
|
||||
$config['times_number'] = $system_inquiry_config['times_number'];
|
||||
|
||||
// 沟通时长(分钟,0为不限制时长)
|
||||
$result['config']['duration'] = $system_inquiry_config['duration'];
|
||||
$config['duration'] = $system_inquiry_config['duration'];
|
||||
|
||||
// 系统价格(公益问诊)
|
||||
$result['config']['system_inquiry_price'] = [];
|
||||
$config['system_inquiry_price'] = [];
|
||||
if ($inquiry_type == 3) {
|
||||
$result['config']['system_inquiry_price'] = explode(',', $system_inquiry_config['inquiry_price']);
|
||||
$config['system_inquiry_price'] = explode(',', $system_inquiry_config['inquiry_price']);
|
||||
}
|
||||
|
||||
$result['info'] = $info;
|
||||
$result['config'] = $config;
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
@ -420,4 +425,181 @@ class DoctorInquiryService extends BaseService
|
||||
|
||||
return $inquiry_price;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生问诊配置-服务设置
|
||||
* @return array
|
||||
*/
|
||||
public function getInquiryServiceConfig(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$inquiry_type = $this->request->input('inquiry_type');// 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊)
|
||||
$inquiry_mode = $this->request->input('inquiry_mode');// 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊)
|
||||
|
||||
if ($inquiry_mode != 6){
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 获取医生信息
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$doctor = UserDoctor::getOne($params);
|
||||
if (empty($doctor)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "未知医生");
|
||||
}
|
||||
|
||||
if ($doctor['idcard_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行实名认证");
|
||||
}
|
||||
|
||||
if ($doctor['iden_auth_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行身份认证");
|
||||
}
|
||||
|
||||
if ($doctor['is_bind_bank'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行绑定结算银行卡");
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$params['inquiry_type'] = $inquiry_type;
|
||||
$params['inquiry_mode'] = $inquiry_mode;
|
||||
$doctor_inquiry_config_service = DoctorInquiryConfigService::getOne($params);
|
||||
if (empty($doctor_inquiry_config_service)){
|
||||
return success(null);
|
||||
}else{
|
||||
return success($doctor_inquiry_config_service->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增医生问诊配置-服务设置
|
||||
* @return array
|
||||
*/
|
||||
public function addInquiryServiceConfig(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$service_content = $this->request->input('service_content');
|
||||
$service_process = $this->request->input('service_process');
|
||||
$service_period = $this->request->input('service_period');
|
||||
$service_rounds = $this->request->input('service_rounds');
|
||||
|
||||
// 获取医生信息
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$doctor = UserDoctor::getOne($params);
|
||||
if (empty($doctor)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "未知医生");
|
||||
}
|
||||
|
||||
if ($doctor['idcard_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行实名认证");
|
||||
}
|
||||
|
||||
if ($doctor['iden_auth_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行身份认证");
|
||||
}
|
||||
|
||||
if ($doctor['is_bind_bank'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行绑定结算银行卡");
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$params['inquiry_type'] = 1;
|
||||
$params['inquiry_mode'] = 6;
|
||||
$doctor_inquiry_config_service = DoctorInquiryConfigService::getOne($params);
|
||||
if (!empty($doctor_inquiry_config_service)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "已存在服务设置,请勿重复设置");
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['doctor_id'] = $doctor['doctor_id'];
|
||||
$data['inquiry_type'] = 1;
|
||||
$data['inquiry_mode'] = 6;
|
||||
$data['service_content'] = $service_content;
|
||||
$data['service_process'] =$service_process;
|
||||
$data['service_period'] =$service_period;
|
||||
$data['service_rounds'] =$service_rounds;
|
||||
$doctor_inquiry_config_service = DoctorInquiryConfigService::addDoctorInquiryConfigService($data);
|
||||
if (empty($doctor_inquiry_config_service)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改医生问诊配置-服务设置
|
||||
* @return array
|
||||
*/
|
||||
public function putInquiryServiceConfig(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$config_service_id = $this->request->route('config_service_id');
|
||||
|
||||
$service_content = $this->request->input('service_content');
|
||||
$service_process = $this->request->input('service_process');
|
||||
$service_period = $this->request->input('service_period');
|
||||
$service_rounds = $this->request->input('service_rounds');
|
||||
|
||||
// 获取医生信息
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$doctor = UserDoctor::getOne($params);
|
||||
if (empty($doctor)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "未知医生");
|
||||
}
|
||||
|
||||
if ($doctor['idcard_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行实名认证");
|
||||
}
|
||||
|
||||
if ($doctor['iden_auth_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行身份认证");
|
||||
}
|
||||
|
||||
if ($doctor['is_bind_bank'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行绑定结算银行卡");
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['config_service_id'] = $config_service_id;
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$doctor_inquiry_config_service = DoctorInquiryConfigService::getOne($params);
|
||||
if (empty($doctor_inquiry_config_service)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
$data = array();
|
||||
if ($doctor_inquiry_config_service['service_content'] != $service_content){
|
||||
$data['service_content'] = $service_content;
|
||||
}
|
||||
|
||||
if ($doctor_inquiry_config_service['service_process'] != $service_process){
|
||||
$data['service_process'] = $service_process;
|
||||
}
|
||||
|
||||
if ($doctor_inquiry_config_service['service_period'] != $service_period){
|
||||
$data['service_period'] = $service_period;
|
||||
}
|
||||
|
||||
if ($doctor_inquiry_config_service['service_rounds'] != $service_rounds){
|
||||
$data['service_rounds'] = $service_rounds;
|
||||
}
|
||||
|
||||
if (!empty($data)){
|
||||
$params = array();
|
||||
$params['config_service_id'] = $doctor_inquiry_config_service['config_service_id'];
|
||||
$res = DoctorInquiryConfigService::edit($params,$data);
|
||||
if (!$res){
|
||||
return fail();
|
||||
}
|
||||
}
|
||||
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,7 @@ use App\Controller\CallBackController;
|
||||
use App\Controller\DetectionController;
|
||||
use App\Controller\DoctorAccountController;
|
||||
use App\Controller\DoctorAuthController;
|
||||
use App\Controller\DoctorInquiryConfigController;
|
||||
use App\Controller\IndexController;
|
||||
use App\Controller\InquiryController;
|
||||
use App\Controller\LoginController;
|
||||
@ -72,14 +73,26 @@ Router::addGroup('/doctor', function () {
|
||||
|
||||
// 问诊
|
||||
Router::addGroup('/inquiry', function () {
|
||||
// 获取医生问诊配置
|
||||
Router::get('/config', [UserDoctorController::class, 'getInquiryConfig']);
|
||||
// 问诊配置
|
||||
Router::addGroup('/config', function () {
|
||||
// 获取医生问诊配置
|
||||
Router::get('', [DoctorInquiryConfigController::class, 'getInquiryConfig']);
|
||||
|
||||
// 医生问诊开关
|
||||
Router::put('/open', [UserDoctorController::class, 'putInquiryOpen']);
|
||||
// 修改医生问诊配置
|
||||
Router::put('', [DoctorInquiryConfigController::class, 'putInquiryConfig']);
|
||||
|
||||
// 修改医生问诊配置
|
||||
Router::put('/config', [UserDoctorController::class, 'putInquiryConfig']);
|
||||
// 医生问诊开关
|
||||
Router::put('/open', [DoctorInquiryConfigController::class, 'putInquiryOpen']);
|
||||
|
||||
// 获取医生问诊配置-服务设置
|
||||
Router::get('/service', [DoctorInquiryConfigController::class, 'getInquiryServiceConfig']);
|
||||
|
||||
// 新增医生问诊配置-服务设置
|
||||
Router::post('/service', [DoctorInquiryConfigController::class, 'addInquiryServiceConfig']);
|
||||
|
||||
// 修改医生问诊配置-服务设置
|
||||
Router::put('/service/{config_service_id:\d+}', [DoctorInquiryConfigController::class, 'putInquiryServiceConfig']);
|
||||
});
|
||||
|
||||
// 获取医生问诊消息列表
|
||||
Router::get('/message', [UserDoctorController::class, 'getDoctorMessageList']);
|
||||
@ -92,6 +105,12 @@ Router::addGroup('/doctor', function () {
|
||||
|
||||
// 结束问诊会话列表
|
||||
Router::get('/finish/message', [InquiryController::class, 'getDoctorFinishMessageList']);
|
||||
|
||||
// 服务设置
|
||||
Router::addGroup('/service', function () {
|
||||
// 获取医生问诊配置-服务设置
|
||||
Router::get('', [DoctorInquiryConfigController::class, 'getInquiryServiceConfig']);
|
||||
});
|
||||
});
|
||||
|
||||
//银行卡
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user