新增系统问诊时间模型、修正问诊配置
This commit is contained in:
parent
d44a591e84
commit
8a87298095
@ -10,16 +10,14 @@ use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $inquiry_config_id 主键id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $system_inquiry_config_id 系统问诊配置表id
|
||||
* @property string $inquiry_config_id 主键id
|
||||
* @property string $doctor_id 医生id
|
||||
* @property int $inquiry_type 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
* @property int $work_num_day 每日接诊数量
|
||||
* @property string $inquiry_price 接诊价格(专家问诊-公益问诊)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property-read SystemInquiryConfig $SystemInquiryConfig
|
||||
*/
|
||||
class DoctorInquiryConfig extends Model
|
||||
{
|
||||
@ -33,23 +31,15 @@ class DoctorInquiryConfig extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['inquiry_config_id', 'doctor_id', 'system_inquiry_config_id', 'inquiry_type', 'inquiry_mode', 'work_num_day', 'inquiry_price', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['inquiry_config_id', 'doctor_id', 'inquiry_type', 'inquiry_mode', 'work_num_day', 'inquiry_price', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['inquiry_config_id' => 'integer', 'doctor_id' => 'integer', 'system_inquiry_config_id' => 'integer', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'work_num_day' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
protected array $casts = ['inquiry_config_id' => 'string', 'doctor_id' => 'string', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'work_num_day' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "inquiry_config_id";
|
||||
|
||||
/**
|
||||
* 关联系统问诊配置表
|
||||
*/
|
||||
public function SystemInquiryConfig(): HasOne
|
||||
{
|
||||
return $this->hasOne(SystemInquiryConfig::class, 'system_inquiry_config_id', 'system_inquiry_config_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生接诊配置信息-单条
|
||||
* @param array $params
|
||||
@ -69,7 +59,7 @@ class DoctorInquiryConfig extends Model
|
||||
*/
|
||||
public static function getInquiryConfigOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::with(['SystemInquiryConfig'])->where($params)->first($fields);
|
||||
return self::where($params)->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,8 +71,7 @@ class DoctorInquiryConfig extends Model
|
||||
*/
|
||||
public static function getInquiryConfigList(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::with(['SystemInquiryConfig'])
|
||||
->where($params)->whereIn("inquiry_type",[1,3])->get($fields);
|
||||
return self::where($params)->whereIn("inquiry_type",[1,3])->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -13,8 +13,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $system_inquiry_config_id 主键id
|
||||
* @property int $inquiry_type 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
* @property int $max_work_num_day 每日最大接诊数量(为0表示不限制接诊数量)
|
||||
* @property string $inquiry_price 接诊价格(存在多档次,逗号分隔)
|
||||
* @property int $max_work_num_day 每日最大接诊数量
|
||||
* @property string $inquiry_price 接诊价格
|
||||
* @property string $min_inquiry_price 最低接诊价格(专家问诊)
|
||||
* @property string $max_inquiry_price 最高接诊价格(专家问诊)
|
||||
* @property int $times_number 沟通次数(0为不限制次数)
|
||||
@ -39,7 +39,7 @@ class SystemInquiryConfig extends Model
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['system_inquiry_config_id' => 'integer', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'max_work_num_day' => 'integer', 'times_number' => 'integer', 'duration' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
protected array $casts = ['system_inquiry_config_id' => 'string', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'max_work_num_day' => 'integer', 'times_number' => 'integer', 'duration' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "system_inquiry_config_id";
|
||||
|
||||
|
||||
63
app/Model/SystemInquiryTime.php
Normal file
63
app/Model/SystemInquiryTime.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $inquiry_time_id 主键id
|
||||
* @property int $system_inquiry_config_id 系统配置主键id
|
||||
* @property string $start_time 开始时间
|
||||
* @property string $end_time 结束时间
|
||||
* @property string $time_interval 时段(上午、中午、下午、夜间、全天)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class SystemInquiryTime extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'system_inquiry_time';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['inquiry_time_id', 'system_inquiry_config_id', 'start_time', 'end_time', 'time_interval', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['inquiry_time_id' => 'integer', 'system_inquiry_config_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "inquiry_time_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)->get($fields);
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ class DoctorAccountService extends BaseService
|
||||
if (!empty($doctor_account_days)) {
|
||||
foreach ($doctor_account_days as $doctor_account_day) {
|
||||
$data = array();
|
||||
$data['total_amount'] = $doctor_account_day['total_amount'] * 0.75;
|
||||
$data['total_amount'] = ceil($doctor_account_day['total_amount'] * 0.75 * 100) / 100;
|
||||
$data['month'] = $doctor_account_day['month'];
|
||||
$data['day'] = $doctor_account_day['day'];
|
||||
$bill[] = $data;
|
||||
|
||||
@ -404,19 +404,32 @@ class DoctorInquiryService extends BaseService
|
||||
throw new BusinessException();
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$params['inquiry_type'] = $inquiry_type;
|
||||
$params['inquiry_mode'] = $inquiry_mode;
|
||||
$doctor_inquiry_config = DoctorInquiryConfig::getInquiryConfigOne($params);
|
||||
if (empty($doctor_inquiry_config)){
|
||||
throw new BusinessException( "当前医生未开通对应服务,请重新选择",HttpEnumCode::HTTP_ERROR);
|
||||
}
|
||||
// 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊)
|
||||
if ($inquiry_type == 1 || $inquiry_type == 3){
|
||||
// 专家-公益
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$params['inquiry_type'] = $inquiry_type;
|
||||
$params['inquiry_mode'] = $inquiry_mode;
|
||||
$doctor_inquiry_config = DoctorInquiryConfig::getOne($params);
|
||||
if (empty($doctor_inquiry_config)){
|
||||
throw new BusinessException( "当前医生未开通对应服务,请重新选择",HttpEnumCode::HTTP_ERROR);
|
||||
}
|
||||
|
||||
$inquiry_price = $doctor_inquiry_config['inquiry_price'] ?: 0;
|
||||
$inquiry_price = $doctor_inquiry_config['inquiry_price'] ?: 0;
|
||||
}elseif($inquiry_type == 2 || $inquiry_type == 4){
|
||||
// 快速-购药
|
||||
$params = array();
|
||||
$params['inquiry_type'] = $inquiry_type;
|
||||
$params['inquiry_mode'] = $inquiry_mode;
|
||||
$system_inquiry_config = SystemInquiryConfig::getOne($params);
|
||||
if (empty($system_inquiry_config)){
|
||||
throw new BusinessException();
|
||||
}
|
||||
|
||||
if ($inquiry_type == 2){
|
||||
$inquiry_price = $doctor_inquiry_config['SystemInquiryConfig']['inquiry_price'];
|
||||
$inquiry_price = $system_inquiry_config['inquiry_price'] ?: 0;
|
||||
}else{
|
||||
throw new BusinessException();
|
||||
}
|
||||
|
||||
return $inquiry_price;
|
||||
|
||||
@ -249,8 +249,6 @@ class PatientDoctorService extends BaseService
|
||||
$params[] = ['inquiry_status','=',3];
|
||||
$params[] = ['inquiry_refund_status','=',0];
|
||||
$value['order_inquiry_count'] = OrderInquiry::getCount($params);
|
||||
|
||||
unset($value['SystemInquiryConfig']);
|
||||
}
|
||||
$result['doctor_inquiry_config'] = $doctor_inquiry_config;
|
||||
}
|
||||
|
||||
@ -383,16 +383,6 @@ class UserDoctorService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先完成多点执业认证");
|
||||
}
|
||||
|
||||
// 获取医生问诊价格
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$params['inquiry_type'] = 1;
|
||||
$params['inquiry_mode'] = 1;
|
||||
$doctor_inquiry_config = DoctorInquiryConfig::getInquiryConfigOne($params);
|
||||
if (empty($doctor_inquiry_config)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先设置在线问诊价格");
|
||||
}
|
||||
|
||||
// 获取处方数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
|
||||
@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
|
||||
use App\Controller\AreaController;
|
||||
use App\Controller\BasicDataController;
|
||||
use App\Controller\DiseaseController;
|
||||
use App\Controller\DoctorAccountController;
|
||||
use App\Controller\DoctorAuthController;
|
||||
use App\Controller\IndexController;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user