Merge branch 'dev'
This commit is contained in:
@@ -31,11 +31,6 @@ class DoctorIdenFail extends Model
|
||||
*/
|
||||
protected array $fillable = ['iden_fail_id', 'doctor_id', 'field_name', 'fail_reason', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['iden_fail_id' => 'integer', 'doctor_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "iden_fail_id";
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $record_id 主键id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property string $avatar 头像
|
||||
* @property string $be_good_at 擅长
|
||||
* @property string $brief_introduction 医生简介
|
||||
* @property string $expertise_ids 专长id,逗号分隔
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DoctorIntroductionRecord extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'doctor_introduction_record';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['record_id', 'doctor_id', 'avatar', 'be_good_at', 'brief_introduction', 'expertise_ids', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "record_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 DoctorIntroductionRecord|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addDoctorIntroductionRecord(array $data): \Hyperf\Database\Model\Model|DoctorIntroductionRecord
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息-单条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getLastOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->latest()->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某种状态的最后一条数据
|
||||
* @param array $params
|
||||
* @param array $introduction_status
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getStatusLastOne(array $params, array $introduction_status,array $fields = ["*"]): object|null
|
||||
{
|
||||
return self::where($params)
|
||||
->whereIn("introduction_status", $introduction_status)
|
||||
->latest()
|
||||
->first($fields);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ namespace App\Model;
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Relations\HasMany;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
@@ -40,6 +41,14 @@ class OrderEvaluation extends Model
|
||||
|
||||
protected string $primaryKey = "evaluation_id";
|
||||
|
||||
/**
|
||||
* 关联问诊订单表
|
||||
*/
|
||||
public function OrderInquiry(): \Hyperf\Database\Model\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(OrderInquiry::class, 'order_inquiry_id','order_inquiry_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评价列表-分页
|
||||
* @param array $params 条件
|
||||
@@ -50,7 +59,10 @@ class OrderEvaluation extends Model
|
||||
*/
|
||||
public static function getPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$raw = self::where($params)->orderBy('created_at','desc')->paginate($per_page, $fields, "page", $page);
|
||||
$raw = self::with(['OrderInquiry'])
|
||||
->where($params)
|
||||
->orderBy('created_at','desc')
|
||||
->paginate($per_page, $fields, "page", $page);
|
||||
$data = array();
|
||||
$data['current_page'] = $raw->currentPage();// 当前页码
|
||||
$data['total'] = $raw->total();//数据总数
|
||||
@@ -72,7 +84,8 @@ class OrderEvaluation extends Model
|
||||
*/
|
||||
public static function getScorePage(array $params, array $avg_score_params,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$raw = self::where($params)
|
||||
$raw = self::with(['OrderInquiry'])
|
||||
->where($params)
|
||||
->whereBetween('avg_score',$avg_score_params)
|
||||
->orderBy('created_at','desc')
|
||||
->paginate($per_page, $fields, "page", $page);
|
||||
|
||||
+89
-13
@@ -17,12 +17,12 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $doctor_id 医生id(未分配时为null)
|
||||
* @property int $family_id 家庭成员id(就诊用户)
|
||||
* @property int $inquiry_type 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
* @property int $inquiry_mode 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
* @property int $inquiry_type 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测)
|
||||
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊 7:附赠)
|
||||
* @property int $inquiry_status 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
* @property int $is_delete 删除状态(0:否 1:是)
|
||||
* @property int $inquiry_refund_status 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
||||
* @property int $inquiry_pay_channel 支付渠道(1:小程序支付 2:微信扫码支付)
|
||||
* @property int $inquiry_pay_channel 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||||
* @property int $inquiry_pay_status 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
* @property string $inquiry_no 系统订单编号
|
||||
* @property string $escrow_trade_no 第三方支付流水号
|
||||
@@ -40,14 +40,16 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $cancel_time 订单取消时间
|
||||
* @property int $cancel_reason 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||||
* @property string $cancel_remarks 取消订单备注(自动添加)
|
||||
* @property int $times_number 沟通次数(0为不限制次数)
|
||||
* @property int $duration 沟通时长(分钟,0为不限制时长)
|
||||
* @property string $patient_name 患者姓名-就诊人
|
||||
* @property string $patient_name_mask 患者姓名-就诊人(掩码)
|
||||
* @property int $patient_sex 患者性别-就诊人(0:未知 1:男 2:女)
|
||||
* @property int $patient_age 患者年龄-就诊人
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property-read OrderInquiryCase $OrderInquiryCase
|
||||
* @property-read UserDoctor $UserDoctor
|
||||
* @property-read OrderInquiryCase|null $OrderInquiryCase
|
||||
* @property-read UserDoctor|null $UserDoctor
|
||||
*/
|
||||
class OrderInquiry extends Model
|
||||
{
|
||||
@@ -61,7 +63,7 @@ class OrderInquiry extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_inquiry_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'inquiry_type', 'inquiry_mode', 'inquiry_status', 'is_delete', 'inquiry_refund_status', 'inquiry_pay_channel', 'inquiry_pay_status', 'inquiry_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'reception_time', 'complete_time', 'finish_time', 'statistics_status', 'statistics_time', 'is_withdrawal', 'withdrawal_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['order_inquiry_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'inquiry_type', 'inquiry_mode', 'inquiry_status', 'is_delete', 'inquiry_refund_status', 'inquiry_pay_channel', 'inquiry_pay_status', 'inquiry_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'reception_time', 'complete_time', 'finish_time', 'statistics_status', 'statistics_time', 'is_withdrawal', 'withdrawal_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'times_number', 'duration', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_inquiry_id";
|
||||
|
||||
@@ -145,8 +147,6 @@ class OrderInquiry extends Model
|
||||
return self::where($params)->orderBy('created_at', 'desc')->first($fields);
|
||||
}
|
||||
|
||||
// public static function
|
||||
|
||||
/**
|
||||
* 获取医生某一时间段接诊订单分页数据
|
||||
* 已结束
|
||||
@@ -180,17 +180,21 @@ class OrderInquiry extends Model
|
||||
* @param array $params
|
||||
* @param array $reception_time 接诊时间区间 ['2023-01','2023-01']
|
||||
* @param array $inquiry_status_params
|
||||
* @param array $inquiry_type_not_params
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getDoctorCreatedDateOrderInquiryPage(array $params, array $reception_time, array $inquiry_status_params,array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
|
||||
public static function getDoctorCreatedDateOrderInquiryPage(array $params, array $reception_time, array $inquiry_status_params,array $inquiry_type_not_params = [],array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
|
||||
{
|
||||
$raw = self::where($params)
|
||||
->when($inquiry_type_not_params, function ($query, $inquiry_type_not_params) {
|
||||
$query->whereNotIn('inquiry_type', $inquiry_type_not_params);
|
||||
})
|
||||
->whereIn('inquiry_status', $inquiry_status_params)
|
||||
->whereBetween('reception_time', $reception_time)
|
||||
->orderBy('reception_time')
|
||||
->orderBy('reception_time','desc')
|
||||
->paginate($per_page, $fields, "page", $page);
|
||||
|
||||
$data = array();
|
||||
@@ -203,18 +207,40 @@ class OrderInquiry extends Model
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生可提现金额-坐班医生
|
||||
* @param array $params
|
||||
* @param array $inquiry_status_params
|
||||
* @param array $inquiry_type_not_params
|
||||
* @param array $fields
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getCooperationDoctorCanWithdrawalInquiryOrder(array $params, array $inquiry_status_params,array $inquiry_type_not_params = [],array $fields = ["*"]): mixed
|
||||
{
|
||||
$data = self::where($params)
|
||||
->when($inquiry_type_not_params, function ($query, $inquiry_type_not_params) {
|
||||
$query->whereNotIn('inquiry_type', $inquiry_type_not_params);
|
||||
})
|
||||
->whereIn('inquiry_status', $inquiry_status_params)
|
||||
->get($fields);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生接诊订单分页数据
|
||||
* 已结束
|
||||
* @param array $params
|
||||
* @param array $inquiry_status_params
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getDoctorOrderInquiryPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
|
||||
public static function getDoctorOrderInquiryPage(array $params, array $inquiry_status_params, array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
|
||||
{
|
||||
$raw = self::where($params)
|
||||
->whereIn('inquiry_status', $inquiry_status_params)
|
||||
->orderBy('finish_time', 'desc')
|
||||
->paginate($per_page, $fields, "page", $page);
|
||||
|
||||
@@ -229,13 +255,44 @@ class OrderInquiry extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生某一时间段,某种状态的订单金额
|
||||
* 获取医生接诊订单分页数据-坐班医生
|
||||
* 已结束
|
||||
* @param array $params
|
||||
* @param array $inquiry_status_params
|
||||
* @param array $inquiry_type_not_params
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getCooperationDoctorOrderInquiryPage(array $params, array $inquiry_status_params,array $inquiry_type_not_params = [], array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
|
||||
{
|
||||
$raw = self::where($params)
|
||||
->whereIn('inquiry_status', $inquiry_status_params)
|
||||
->when($inquiry_type_not_params, function ($query, $inquiry_type_not_params) {
|
||||
$query->whereNotIn('inquiry_type', $inquiry_type_not_params);
|
||||
})
|
||||
->orderBy('finish_time', 'desc')
|
||||
->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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生接诊的订单金额
|
||||
* @param array $params
|
||||
* @param array $reception_time 接诊时间区间
|
||||
* @param array $inquiry_status_params inquiry_status字段搜索条件
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getOrderInquiryBetweenTimeAmountTotalSum(array $params, array $reception_time, array $inquiry_status_params): mixed
|
||||
public static function getDoctorAmountTotal(array $params, array $reception_time, array $inquiry_status_params): mixed
|
||||
{
|
||||
return self::where($params)
|
||||
->whereIn('inquiry_status', $inquiry_status_params)
|
||||
@@ -244,6 +301,25 @@ class OrderInquiry extends Model
|
||||
->sum("amount_total");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生接诊的订单金额-坐班医生
|
||||
* @param array $params
|
||||
* @param array $reception_time 接诊时间区间
|
||||
* @param array $inquiry_status_params inquiry_status字段搜索条件
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getCooperationDoctorAmountTotal(array $params, array $reception_time, array $inquiry_status_params,array $inquiry_type_not_params = []): mixed
|
||||
{
|
||||
return self::where($params)
|
||||
->when($inquiry_type_not_params, function ($query, $inquiry_type_not_params) {
|
||||
$query->whereNotIn('inquiry_type', $inquiry_type_not_params);
|
||||
})
|
||||
->whereIn('inquiry_status', $inquiry_status_params)
|
||||
->whereBetween('reception_time', $reception_time)
|
||||
->orderBy('reception_time')
|
||||
->sum("amount_total");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生某种状态的订单金额
|
||||
* @param array $params
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $records_id 主键id
|
||||
* @property int $order_inquiry_id 问诊订单id
|
||||
* @property string $room_id 房间id
|
||||
* @property int $video_status 视频状态(1:已发起 2:患者进入房间 3:开始通话 4:结束)
|
||||
* @property string $start_video_time 开始视频时间
|
||||
* @property string $stop_video_time 结束视频时间
|
||||
* @property string $vod_path_doctor 医生云点播路径
|
||||
* @property int $vod_status_doctor 医生云点播存储状态(0:未开始存储 1:成功 2:存储失败)
|
||||
* @property string $vod_err_doctor 医生云点播存储失败原因
|
||||
* @property string $vod_path_patient 患者云点播路径
|
||||
* @property int $vod_status_patient 患者云点播存储状态(0:未开始存储 1:成功 2:存储失败)
|
||||
* @property string $vod_err_patient 患者云点播存储失败原因
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderInquiryVideoRecord extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_inquiry_video_record';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['records_id', 'order_inquiry_id', 'room_id', 'video_status', 'start_video_time', 'stop_video_time', 'vod_path_doctor', 'vod_status_doctor', 'vod_err_doctor', 'vod_path_patient', 'vod_status_patient', 'vod_err_patient', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "records_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 \Hyperf\Database\Model\Model|OrderInquiryVideoRecord
|
||||
*/
|
||||
public static function addOrderInquiryVideoRecord(array $data): \Hyperf\Database\Model\Model|OrderInquiryVideoRecord
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息-最后一条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getLastOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->latest()->first($fields);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $reservation_id 主键id
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $patient_user_id 患者用户id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $doctor_user_id 医生用户id
|
||||
* @property int $order_inquiry_id 问诊订单id
|
||||
* @property string $room_id 房间号
|
||||
* @property string $reservation_time 预约时间
|
||||
* @property int $is_send_reservation_notice 是否已发送预约通知(0:否 1:是)
|
||||
* @property int $update_number 修改次数
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderInquiryVideoReservation extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_inquiry_video_reservation';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['reservation_id', 'patient_id', 'patient_user_id', 'doctor_id', 'doctor_user_id', 'order_inquiry_id', 'room_id', 'reservation_time', 'is_send_reservation_notice', 'update_number', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "reservation_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 \Hyperf\Database\Model\Model|OrderInquiryVideoReservation
|
||||
*/
|
||||
public static function addOrderInquiryVideoReservation(array $data): \Hyperf\Database\Model\Model|OrderInquiryVideoReservation
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息-最后一条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getLastOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->latest()->first($fields);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $amount_record_id 主键id
|
||||
* @property int $product_id 商品id
|
||||
* @property int $change_quantity 库存变动的数量
|
||||
* @property int $quantity 变动后库存数量
|
||||
* @property string $change_time 变动时间
|
||||
* @property string $remark 备注
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class ProductAmountRecord extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'product_amount_record';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['amount_record_id', 'product_id', 'change_quantity', 'quantity', 'change_time', 'remark', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "amount_record_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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return \Hyperf\Database\Model\Model|ProductAmountRecord
|
||||
*/
|
||||
public static function addProductAmountRecord(array $data = []): \Hyperf\Database\Model\Model|ProductAmountRecord
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,9 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property string $system_inquiry_config_id 主键id
|
||||
* @property int $inquiry_type 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
* @property int $inquiry_type 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测)
|
||||
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊 7:附赠)
|
||||
* @property int $default_work_num_day 默认每日接诊数量
|
||||
* @property int $max_work_num_day 每日最大接诊数量
|
||||
* @property string $inquiry_price 接诊价格
|
||||
* @property string $min_inquiry_price 最低接诊价格(专家问诊)
|
||||
@@ -34,12 +35,12 @@ class SystemInquiryConfig extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['system_inquiry_config_id', 'inquiry_type', 'inquiry_mode', 'max_work_num_day', 'inquiry_price', 'min_inquiry_price', 'max_inquiry_price', 'times_number', 'duration', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['system_inquiry_config_id', 'inquiry_type', 'inquiry_mode', 'default_work_num_day', 'max_work_num_day', 'inquiry_price', 'min_inquiry_price', 'max_inquiry_price', 'times_number', 'duration', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
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 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', 'default_work_num_day' => 'integer'];
|
||||
|
||||
protected string $primaryKey = "system_inquiry_config_id";
|
||||
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $register_method 注册方式(1:微信小程序 2:后台添加 )
|
||||
* @property int $age 年龄
|
||||
* @property int $sex 性别(0:未知 1:男 2:女)
|
||||
* @property string $email 邮箱
|
||||
* @property string $avatar 头像
|
||||
* @property int $is_online 是否在线(0:不在线 1:在线)
|
||||
* @property string $login_at 小程序登陆时间
|
||||
@@ -43,7 +44,7 @@ class User extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'age', 'sex', 'avatar', 'is_online', 'login_at', 'im_login_at', 'login_ip', 'created_by', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'age', 'sex', 'email', 'avatar', 'is_online', 'login_at', 'im_login_at', 'login_ip', 'created_by', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "user_id";
|
||||
|
||||
|
||||
+85
-35
@@ -29,6 +29,8 @@ use Hyperf\Utils\Arr;
|
||||
* @property int $multi_point_status 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
* @property string $multi_point_time 审核时间
|
||||
* @property string $multi_point_fail_reason 多点执业认证失败原因
|
||||
* @property int $introduction_status 个人简介审核状态(0:未审核 1:审核通过 2:审核中 3:审核失败)
|
||||
* @property string $introduction_time 审核时间
|
||||
* @property int $is_bind_bank 是否已绑定结算银行卡(0:否 1:是)
|
||||
* @property int $is_recommend 是否首页推荐(0:否 1:是)
|
||||
* @property string $avatar 头像
|
||||
@@ -56,6 +58,7 @@ use Hyperf\Utils\Arr;
|
||||
* @property-read \Hyperf\Database\Model\Collection|DoctorInquiryConfig[]|null $DoctorInquiryConfig
|
||||
* @property-read Hospital|null $Hospital
|
||||
* @property-read \Hyperf\Database\Model\Collection|OrderInquiry[]|null $OrderInquiry
|
||||
* @property-read User|null $User
|
||||
*/
|
||||
class UserDoctor extends Model
|
||||
{
|
||||
@@ -69,7 +72,7 @@ class UserDoctor extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_time', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_time', 'multi_point_fail_reason', 'is_bind_bank', 'is_recommend', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'is_sys_diagno_cooperation', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_time', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_time', 'multi_point_fail_reason', 'introduction_status', 'introduction_time', 'is_bind_bank', 'is_recommend', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'is_sys_diagno_cooperation', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "doctor_id";
|
||||
|
||||
@@ -211,26 +214,21 @@ class UserDoctor extends Model
|
||||
* @param array $hospital_params 医院搜索条件
|
||||
* @param array $doctor_params 医生搜索条件
|
||||
* @param array $doctor_expertise_params
|
||||
* @param int $is_search_welfare_reception 是否搜索公益问诊
|
||||
* @param string|int $is_first_online 是否优先在线(1:是)
|
||||
* @param array $inquiry_type
|
||||
* @param array $inquiry_mode
|
||||
* @param string|int $is_first_online 是否优先在线(1:是)
|
||||
* @param string|int $sort_order
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return array
|
||||
*/
|
||||
public static function getInquiryDoctorPage(string $keyword = "", array $hospital_params = [], array $doctor_params = [], array $doctor_expertise_params = [],int $is_search_welfare_reception = 0,string|int $is_first_online = 0, string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
public static function getInquiryDoctorPage(string $keyword = "", array $hospital_params = [], array $doctor_params = [], array $doctor_expertise_params = [],array $inquiry_type = [],array $inquiry_mode = [],string|int $is_first_online = 0, string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$query = self::with([
|
||||
"Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id",
|
||||
"DoctorExpertise",
|
||||
"DoctorInquiryConfig" => function ($query) use ($is_search_welfare_reception) {
|
||||
$query->where('inquiry_mode', 1);
|
||||
if (!empty($is_search_welfare_reception)){
|
||||
$query->where('inquiry_type', 3);
|
||||
$query->where('is_enable', 1);
|
||||
}
|
||||
},
|
||||
"DoctorInquiryConfig",
|
||||
"User:user_id,is_online"
|
||||
])
|
||||
->where($doctor_params)
|
||||
@@ -248,20 +246,42 @@ class UserDoctor extends Model
|
||||
})
|
||||
->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) {
|
||||
$query->where($doctor_expertise_params);
|
||||
})
|
||||
->whereHas('DoctorInquiryConfig', function ($query) use ($is_search_welfare_reception) {
|
||||
$params = array();
|
||||
$params['inquiry_mode'] = 1;// 接诊方式:图文
|
||||
if (!empty($is_search_welfare_reception)){
|
||||
$params['is_enable'] = 1;
|
||||
}
|
||||
|
||||
$query->where($params);
|
||||
|
||||
if (!empty($is_search_welfare_reception)){
|
||||
$query->where('inquiry_type', 3);
|
||||
}
|
||||
});
|
||||
// ->whereHas('DoctorInquiryConfig', function ($query) use ($doctor_inquiry_config_params) {
|
||||
// $params = array();
|
||||
// $params['is_enable'] = 1;
|
||||
//
|
||||
// if (!empty($doctor_inquiry_config_params)){
|
||||
// if (!empty($doctor_inquiry_config_params['inquiry_mode'])){
|
||||
// $params['inquiry_mode'] = $doctor_inquiry_config_params['inquiry_mode'];
|
||||
// }
|
||||
//
|
||||
// if (!empty($doctor_inquiry_config_params['inquiry_type'])){
|
||||
// $params['inquiry_type'] = $doctor_inquiry_config_params['inquiry_type'];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $query->where($params);
|
||||
// });
|
||||
// ->whereHas('DoctorInquiryConfig', function ($query) use ($doctor_inquiry_config_params) {
|
||||
// $params = array();
|
||||
// $params['is_enable'] = 1;
|
||||
//
|
||||
// if (!empty($doctor_inquiry_config_params)){
|
||||
// if (!empty($doctor_inquiry_config_params['inquiry_mode'])){
|
||||
// $inquiry_mode = explode(',',$doctor_inquiry_config_params['inquiry_mode']);
|
||||
// $query->whereIn('inquiry_mode', $inquiry_mode);
|
||||
// }
|
||||
//
|
||||
// if (!empty($doctor_inquiry_config_params['inquiry_type'])){
|
||||
// $inquiry_type = explode(',',$doctor_inquiry_config_params['inquiry_type']);
|
||||
// $query->whereIn('inquiry_type', $inquiry_type);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $query->where($params);
|
||||
// });
|
||||
|
||||
|
||||
if ($is_first_online == 1){
|
||||
$query->join('user as u', function ($query) {
|
||||
@@ -272,16 +292,46 @@ class UserDoctor extends Model
|
||||
}
|
||||
|
||||
if (!empty($sort_order)){
|
||||
// if (in_array($sort_order,[1,3,4])){
|
||||
// $query = $query->join('doctor_inquiry_config', function ($query) {
|
||||
// $query->on('user_doctor.doctor_id', '=', 'doctor_inquiry_config.doctor_id')
|
||||
// ->whereIn('inquiry_type', [1, 3])
|
||||
// ->whereIn('inquiry_mode', [1,2,6,7])
|
||||
// ->orderBy('inquiry_price', 'desc')
|
||||
// ->take(1);
|
||||
// })
|
||||
// ->select("user_doctor.*")
|
||||
// ->groupBy("user_doctor.doctor_id");
|
||||
// }
|
||||
|
||||
// select doctor_id, min(price) price_min from price group by doctor_id
|
||||
if (in_array($sort_order,[1,3,4])){
|
||||
$query = $query->join('doctor_inquiry_config', function ($query) {
|
||||
$query->on('user_doctor.doctor_id', '=', 'doctor_inquiry_config.doctor_id')
|
||||
->whereIn('inquiry_type', [1, 3])
|
||||
->where('inquiry_mode', 1)
|
||||
->orderBy('inquiry_price', 'desc')
|
||||
->take(1);
|
||||
})
|
||||
->select("user_doctor.*")
|
||||
->groupBy("user_doctor.doctor_id");
|
||||
$raw = "inquiry_price as min_inquiry_price";
|
||||
if ($sort_order == 1){
|
||||
// 综合-价格从低到高
|
||||
$raw = "MIN(inquiry_price) as min_inquiry_price";
|
||||
} elseif ($sort_order == 3){
|
||||
// 价格从低到高
|
||||
$raw = "MIN(inquiry_price) as min_inquiry_price";
|
||||
} elseif ($sort_order == 4){
|
||||
// 价格从高到低
|
||||
$raw = "MAX(inquiry_price) as min_inquiry_price";
|
||||
}
|
||||
|
||||
$latestPosts = Db::table('doctor_inquiry_config')
|
||||
->select('doctor_inquiry_config.doctor_id', Db::raw($raw))
|
||||
->where('is_enable', 1);
|
||||
if (!empty($inquiry_type)){
|
||||
$latestPosts = $latestPosts->whereIn('inquiry_type', $inquiry_type)
|
||||
->whereIn('inquiry_mode',$inquiry_mode);
|
||||
}
|
||||
|
||||
$latestPosts = $latestPosts->groupBy(["doctor_inquiry_config.doctor_id"]);
|
||||
|
||||
$query = $query
|
||||
->joinSub($latestPosts, 'doctor_inquiry_config', function($join) {
|
||||
$join->on('user_doctor.doctor_id', '=', 'doctor_inquiry_config.doctor_id');
|
||||
});
|
||||
}
|
||||
|
||||
if ($sort_order == 1) {
|
||||
@@ -291,7 +341,7 @@ class UserDoctor extends Model
|
||||
$query->orderBy('avg_response_time');
|
||||
$query->orderBy('served_patients_num', 'desc');// 服务数从多到少
|
||||
$query->orderBy(Db::raw("convert(substr(gdxz_user_doctor.user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||
$query->orderBy('doctor_inquiry_config.inquiry_price', 'asc');
|
||||
$query->orderBy('doctor_inquiry_config.min_inquiry_price', 'asc');
|
||||
} elseif ($sort_order == 2) {
|
||||
// 响应时间快
|
||||
$query->orderByRaw('avg_response_time = 0 ASC');
|
||||
@@ -305,7 +355,7 @@ class UserDoctor extends Model
|
||||
$query->orderBy(Db::raw("convert(substr(gdxz_user_doctor.user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||
} elseif ($sort_order == 4) {
|
||||
// 价格从高到低
|
||||
$query->orderBy('doctor_inquiry_config.inquiry_price', 'desc');
|
||||
$query->orderBy('doctor_inquiry_config.min_inquiry_price', 'desc');
|
||||
$query->orderByRaw('avg_response_time = 0 ASC');
|
||||
$query->orderBy('avg_response_time');
|
||||
$query->orderBy(Db::raw("convert(substr(gdxz_user_doctor.user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $records_id 主键id
|
||||
* @property int $order_inquiry_id 问诊订单id
|
||||
* @property string $room_id 房间id
|
||||
* @property int $video_status 视频状态(1:已发起 2:患者进入房间 3:开始通话 4:结束)
|
||||
* @property string $start_video_time 开始视频时间
|
||||
* @property string $stop_video_time 结束视频时间
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class VideoRecord extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'video_records';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['records_id', 'order_inquiry_id', 'room_id', 'video_status', 'start_video_time', 'stop_video_time', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "records_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 \Hyperf\Database\Model\Model|VideoRecord
|
||||
*/
|
||||
public static function addVideoRecord(array $data): \Hyperf\Database\Model\Model|VideoRecord
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息-最后一条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getLastOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->latest()->first($fields);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $reservation_id 主键id
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $patient_user_id 患者用户id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $doctor_user_id 医生用户id
|
||||
* @property int $order_inquiry_id 问诊订单id
|
||||
* @property string $room_id 房间号
|
||||
* @property string $reservation_time 预约时间
|
||||
* @property int $is_send_reservation_notice 是否已发送预约通知(0:否 1:是)
|
||||
* @property int $update_number 修改次数
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class VideoReservation extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'video_reservation';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['reservation_id', 'patient_id', 'patient_user_id', 'doctor_id', 'doctor_user_id', 'order_inquiry_id', 'room_id', 'reservation_time', 'is_send_reservation_notice', 'update_number', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "reservation_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 \Hyperf\Database\Model\Model|VideoReservation
|
||||
*/
|
||||
public static function addVideoReservation(array $data): \Hyperf\Database\Model\Model|VideoReservation
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息-最后一条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getLastOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->latest()->first($fields);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user