1.3版本合并dev并解决冲突
This commit is contained in:
+15
-2
@@ -6,6 +6,7 @@ namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
@@ -37,8 +38,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $reissue_interval_days 确认收货后的再次发放间隔天数(如果设置为 0,则表示不再次发放。当适用范围为商品时生效)
|
||||
* @property int $is_reissuable_after_expire 过期之后是否允许再次发放(0:否 1:是)
|
||||
* @property int $is_popup 是否首页弹窗(0:否 1:是)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class Coupon extends Model
|
||||
{
|
||||
@@ -110,4 +111,16 @@ class Coupon extends Model
|
||||
->whereIn("distribution_object",[1,2])
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取购买服务包的用户可领取的优惠卷列表
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getOrderServicePackageCouponList(): Collection|array
|
||||
{
|
||||
return self::where("coupon_client",1)
|
||||
->where("coupon_status",1)
|
||||
->whereIn("distribution_object",[7])
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,9 +115,10 @@ class DoctorAccountDay extends Model
|
||||
*/
|
||||
public static function getDoctorMonth(array $params,array $fields = ['*']): \Hyperf\Collection\Collection
|
||||
{
|
||||
return self::select(['month',Db::raw('SUM(total_amount) AS `total_amount`')])
|
||||
return self::select(['year','month',Db::raw('SUM(total_amount) AS `total_amount`')])
|
||||
->where($params)
|
||||
->groupBy(['month'])
|
||||
->groupBy(['year','month'])
|
||||
->orderBy('year')
|
||||
->orderBy('month')
|
||||
->get($fields);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $difficult_consultation_id 主键id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property string $service_content 服务内容
|
||||
* @property string $service_process 服务流程
|
||||
* @property int $service_period 服务周期
|
||||
* @property int $service_rounds 服务回合数(0表示不限次)
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DoctorConfigDifficultConsultation extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'doctor_config_difficult_consultation';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['difficult_consultation_id', 'doctor_id', 'service_content', 'service_process', 'service_period', 'service_rounds', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "difficult_consultation_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 DoctorConfigDifficultConsultation|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addDoctorConfigDifficultConsultation(array $data): \Hyperf\Database\Model\Model|DoctorConfigDifficultConsultation
|
||||
{
|
||||
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,78 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $follow_package_id 主键id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $monthly_frequency 每月次数(0表示不限次)
|
||||
* @property int $service_rounds 服务回合数(0表示不限次)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DoctorConfigFollowPackage extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'doctor_config_follow_package';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['follow_package_id', 'doctor_id', 'monthly_frequency', 'service_rounds', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "follow_package_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 DoctorConfigFollowPackage|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addDoctorConfigFollowPackage(array $data): \Hyperf\Database\Model\Model|DoctorConfigFollowPackage
|
||||
{
|
||||
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,89 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $follow_package_item_id 主键id
|
||||
* @property int $follow_package_id 医生随访包id
|
||||
* @property int $service_period 服务周期(天)
|
||||
* @property string $service_price 服务价格
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DoctorConfigFollowPackageItem extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'doctor_config_follow_package_item';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['follow_package_item_id', 'follow_package_id', 'service_period', 'service_price', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "follow_package_item_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 DoctorConfigFollowPackageItem|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addDoctorConfigFollowPackageItem(array $data): \Hyperf\Database\Model\Model|DoctorConfigFollowPackageItem
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param array $params
|
||||
* @return int|mixed
|
||||
*/
|
||||
public static function del(array $params): mixed
|
||||
{
|
||||
return self::where($params)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 多条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getOrderServicePeriodList(array $params, array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->orderBy('service_period')->get($fields);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $health_package_id 主键id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $package_id 健康包配置id
|
||||
* @property string $service_price 服务价格(根据图文问诊价格计算)
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DoctorConfigHealthPackage extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'doctor_config_health_package';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['health_package_id', 'doctor_id', 'package_id', 'service_price', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "health_package_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 DoctorConfigHealthPackage|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addDoctorConfigHealthPackage(array $data): \Hyperf\Database\Model\Model|DoctorConfigHealthPackage
|
||||
{
|
||||
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,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $income_record_id 主键id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $order_id 订单id
|
||||
* @property string $start_time 开始时间
|
||||
* @property string $end_time 结束时间
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DoctorIncomeRecord extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'doctor_income_record';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['income_record_id', 'doctor_id', 'order_id', 'start_time', 'end_time', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "income_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 DoctorIncomeRecord|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addDoctorIncomeRecord(array $data): \Hyperf\Database\Model\Model|DoctorIncomeRecord
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
@@ -17,8 +18,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $service_process 服务流程
|
||||
* @property int $service_period 服务周期
|
||||
* @property int $service_rounds 服务回合数(0表示不限次)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DoctorInquiryConfigService extends Model
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $withdrawal_order_id 主键id
|
||||
* @property int $withdrawal_id 提现表id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $order_id 订单id
|
||||
* @property int $order_inquiry_id 订单-问诊id
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
@@ -28,7 +29,7 @@ class DoctorWithdrawalOrder extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['withdrawal_order_id', 'withdrawal_id', 'doctor_id', 'order_inquiry_id', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['withdrawal_order_id', 'withdrawal_id', 'doctor_id', 'order_id', 'order_inquiry_id', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "withdrawal_order_id";
|
||||
|
||||
@@ -64,4 +65,15 @@ class DoctorWithdrawalOrder extends Model
|
||||
{
|
||||
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,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $package_id 主键id
|
||||
* @property int $service_count 总服务次数
|
||||
* @property int $monthly_frequency 每月次数
|
||||
* @property string $effective_days 服务有效天数
|
||||
* @property string $service_rate 服务费率。100为满值,表示1,正常费率。
|
||||
* @property string $discount_product_total_amount 折扣商品总价格
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class HealthPackage extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'health_package';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['package_id', 'service_count', 'monthly_frequency', 'effective_days', 'service_rate', 'discount_product_total_amount', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "package_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 HealthPackage|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addHealthPackage(array $data): \Hyperf\Database\Model\Model|HealthPackage
|
||||
{
|
||||
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,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $package_product_id 主键id
|
||||
* @property int $package_id 健康包id
|
||||
* @property int $product_id 商品id
|
||||
* @property string $product_name 商品名称
|
||||
* @property int $quantity 数量
|
||||
* @property string $discount_product_price 折扣商品价格
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class HealthPackageProduct extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'health_package_product';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['package_product_id', 'package_id', 'product_id', 'product_name', 'quantity', 'discount_product_price', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "package_product_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 HealthPackageProduct|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addHealthPackageProduct(array $data): \Hyperf\Database\Model\Model|HealthPackageProduct
|
||||
{
|
||||
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,83 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $log_id 主键id
|
||||
* @property string $name 姓名
|
||||
* @property string $card_no 身份证号
|
||||
* @property int $status 认证结果,1-通过 2-不通过(原因见reasonType) 0-待定
|
||||
* @property string $data_id 用户侧唯一标识
|
||||
* @property string $task_id 服务侧唯一标识
|
||||
* @property string $content 返回内容,json格式
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class LogIdCard extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'log_id_card';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['log_id', 'name', 'card_no', 'status', 'data_id', 'task_id', 'content', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "log_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 $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return LogIdCard|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addLogIdCard(array $data): LogIdCard|\Hyperf\Database\Model\Model
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $order_id 主键id
|
||||
* @property int $user_id 用户id-患者
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $doctor_id 医生id(存在为null的情况)
|
||||
* @property int $order_type 订单类型(1:问诊订单 2:药品订单 3:检测订单 4:随访包订单 5:健康包订单)
|
||||
* @property int $is_delete 删除状态(0:否 1:是)
|
||||
* @property int $pay_channel 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||||
* @property int $pay_status 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
* @property string $pay_time 支付时间
|
||||
* @property int $refund_status 订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)
|
||||
* @property string $order_no 系统订单编号
|
||||
* @property string $escrow_trade_no 第三方支付流水号
|
||||
* @property string $amount_total 订单金额
|
||||
* @property string $coupon_amount_total 优惠卷总金额
|
||||
* @property string $payment_amount_total 实际付款金额
|
||||
* @property int $cancel_status 取消状态(0:否 1:是)
|
||||
* @property string $cancel_time 订单取消时间
|
||||
* @property string $cancel_remarks 取消订单备注
|
||||
* @property string $order_remarks 订单备注
|
||||
* @property int $is_withdrawal 是否提现(0:否 1:是 2:提现中 3:无需提现)
|
||||
* @property string $withdrawal_time 提现时间
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property-read OrderInquiry|null $OrderInquiry
|
||||
* @property-read OrderServicePackage|null $OrderServicePackage
|
||||
*/
|
||||
class Order extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_id', 'user_id', 'patient_id', 'doctor_id', 'order_type', 'is_delete', 'pay_channel', 'pay_status', 'pay_time', 'refund_status', 'order_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'cancel_status', 'cancel_time', 'cancel_remarks', 'order_remarks', 'is_withdrawal', 'withdrawal_time', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_id";
|
||||
|
||||
/**
|
||||
* 关联问诊订单表
|
||||
*/
|
||||
public function OrderInquiry(): HasOne
|
||||
{
|
||||
return $this->hasOne(OrderInquiry::class, 'order_id', 'order_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联服务包订单表
|
||||
*/
|
||||
public function OrderServicePackage(): HasOne
|
||||
{
|
||||
return $this->hasOne(OrderServicePackage::class, 'order_id', 'order_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 Order|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addOrder(array $data): \Hyperf\Database\Model\Model|Order
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生某一时间段收益明细分页数据
|
||||
* @param string|int $doctor_id
|
||||
* @param array $date_params 时间区间
|
||||
* @param string|int $is_platform_deep_cooperation
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return array
|
||||
*/
|
||||
public static function getDoctorCreatedDateOrderInquiryPage(string|int $doctor_id, array $date_params,string|int $is_platform_deep_cooperation,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
|
||||
$query = self::with(['OrderInquiry', 'OrderServicePackage'])
|
||||
->whereIn('order_type',[1,4,5])
|
||||
->where($params);
|
||||
|
||||
// 问诊订单
|
||||
$query = $query->where(function ($query) use ($date_params,$is_platform_deep_cooperation,$doctor_id){
|
||||
$query->whereExists(function ($subQuery) use ($date_params,$is_platform_deep_cooperation,$doctor_id){
|
||||
$subQuery->from('order_inquiry');
|
||||
if ($is_platform_deep_cooperation == 1){
|
||||
$subQuery->whereNotIn('inquiry_type', [2,4]);
|
||||
}
|
||||
|
||||
$subQuery->where('doctor_id', $doctor_id)
|
||||
->whereNotIn('inquiry_mode', [7,8,9])
|
||||
->where('doctor_id', $doctor_id)
|
||||
->whereIn('inquiry_status', [6])
|
||||
->whereBetween('reception_time', $date_params)
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_inquiry.order_id');
|
||||
})
|
||||
->orWhereExists(function ($subQuery) use ($date_params,$doctor_id) {
|
||||
$subQuery->from('order_service_package');
|
||||
|
||||
$subQuery->where('doctor_id', $doctor_id)
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_service_package.order_id')
|
||||
->whereIn('order_service_status', [3,4,5])
|
||||
->whereBetween('start_time', $date_params);
|
||||
});
|
||||
});
|
||||
|
||||
$result = $query->orderBy('created_at')->paginate($per_page, $fields, "page", $page);
|
||||
|
||||
$data = array();
|
||||
$data['current_page'] = $result->currentPage();// 当前页码
|
||||
$data['total'] = $result->total();//数据总数
|
||||
$data['data'] = $result->items();//数据
|
||||
$data['per_page'] = $result->perPage();//每页个数
|
||||
$data['last_page'] = $result->lastPage();//最后一页
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生当日预计的订单金额
|
||||
* @param array $params
|
||||
* @param array $date_params 时间区间
|
||||
* @param string|int $is_platform_deep_cooperation
|
||||
* @return int|null|string
|
||||
*/
|
||||
public static function getDoctorDayAmountTotal(array $params, array $date_params,string|int $is_platform_deep_cooperation): int|null|string
|
||||
{
|
||||
$query = self::where($params)
|
||||
->whereIn('order_type',[1,4,5]);
|
||||
|
||||
// 问诊订单
|
||||
$query = $query->where(function ($query) use ($date_params,$is_platform_deep_cooperation){
|
||||
$query->whereExists(function ($subQuery) use ($date_params,$is_platform_deep_cooperation){
|
||||
$subQuery->from('order_inquiry');
|
||||
if ($is_platform_deep_cooperation == 1){
|
||||
$subQuery->whereNotIn('inquiry_type', [2,4]);
|
||||
}
|
||||
|
||||
$subQuery->whereNotIn('inquiry_mode', [7,8,9])
|
||||
->whereIn('inquiry_status', [4,5])
|
||||
->whereBetween('reception_time', $date_params)
|
||||
->where('inquiry_refund_status', 0)
|
||||
->where('inquiry_pay_status', 2)
|
||||
->where('is_withdrawal', 0)
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_inquiry.order_id');
|
||||
})
|
||||
->orWhereExists(function ($subQuery) use ($date_params) {
|
||||
$subQuery->from('order_service_package')
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_service_package.order_id')
|
||||
->whereIn('order_service_status', [3])
|
||||
->whereBetween('start_time', $date_params)
|
||||
->where('refund_status', 0)
|
||||
->where('pay_status', 2);
|
||||
});
|
||||
});
|
||||
|
||||
$result = $query->orderBy('created_at')
|
||||
->sum("amount_total");;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生当日已完成待入帐的订单金额
|
||||
* @param array $params
|
||||
* @param array $date_params 时间区间
|
||||
* @param string|int $is_platform_deep_cooperation
|
||||
* @return int|null|string
|
||||
*/
|
||||
public static function getDoctorDayCompletedAmountTotal(array $params, array $date_params,string|int $is_platform_deep_cooperation): int|null|string
|
||||
{
|
||||
$query = self::where($params)
|
||||
->whereIn('order_type',[1,4,5]);
|
||||
|
||||
// 问诊订单
|
||||
$query = $query->where(function ($query) use ($date_params,$is_platform_deep_cooperation){
|
||||
$query->whereExists(function ($subQuery) use ($date_params,$is_platform_deep_cooperation){
|
||||
$subQuery->from('order_inquiry');
|
||||
if ($is_platform_deep_cooperation == 1){
|
||||
$subQuery->whereNotIn('inquiry_type', [2,4]);
|
||||
}
|
||||
|
||||
$subQuery->whereNotIn('inquiry_mode', [7,8,9])
|
||||
->whereIn('inquiry_status', [5])
|
||||
->whereBetween('reception_time', $date_params)
|
||||
->where('inquiry_refund_status', 0)
|
||||
->where('inquiry_pay_status', 2)
|
||||
->where('is_withdrawal', 0)
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_inquiry.order_id');
|
||||
})
|
||||
->orWhereExists(function ($subQuery) use ($date_params) {
|
||||
$subQuery->from('order_service_package')
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_service_package.order_id')
|
||||
->whereIn('order_service_status', [3])
|
||||
->where('finish_time','>', $date_params[0])
|
||||
->where('refund_status', 0)
|
||||
->where('pay_status', 2);
|
||||
});
|
||||
});
|
||||
|
||||
$result = $query->orderBy('created_at')
|
||||
->sum("amount_total");;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可提现订单列表-分页
|
||||
* @param array $params
|
||||
* @param string|int $is_platform_deep_cooperation
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return array
|
||||
*/
|
||||
public static function getDoctorWithdrawalOrderPage(array $params, string|int $is_platform_deep_cooperation,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$query = self::with(['OrderInquiry', 'OrderServicePackage'])
|
||||
->where($params)
|
||||
->whereIn('order_type',[1,4,5]);
|
||||
|
||||
// 问诊订单
|
||||
$query = $query->where(function ($query) use ($is_platform_deep_cooperation){
|
||||
$query->whereExists(function ($subQuery) use ($is_platform_deep_cooperation){
|
||||
$subQuery->from('order_inquiry');
|
||||
if ($is_platform_deep_cooperation == 1){
|
||||
$subQuery->whereNotIn('inquiry_type', [2,4]);
|
||||
}
|
||||
|
||||
$subQuery->whereNotIn('inquiry_mode', [7,8,9])
|
||||
->whereIn('inquiry_status', [6])
|
||||
->whereIn('inquiry_refund_status', [0,3])
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_inquiry.order_id');
|
||||
})
|
||||
->orWhereExists(function ($subQuery) {
|
||||
$subQuery->from('order_service_package')
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_service_package.order_id')
|
||||
->whereIn('refund_status', [0,3])
|
||||
->where('pay_status', 2)
|
||||
->whereIn('order_service_status', [4,5])
|
||||
->WhereExists(function ($subQuery){
|
||||
$subQuery->from("order_service_package_inquiry")
|
||||
->whereRaw('gdxz_order_service_package.order_service_id = gdxz_order_service_package_inquiry.order_service_id');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$result = $query->orderBy('created_at')
|
||||
->paginate($per_page, $fields, "page", $page);
|
||||
|
||||
$data = array();
|
||||
$data['current_page'] = $result->currentPage();// 当前页码
|
||||
$data['total'] = $result->total();//数据总数
|
||||
$data['data'] = $result->items();//数据
|
||||
$data['per_page'] = $result->perPage();//每页个数
|
||||
$data['last_page'] = $result->lastPage();//最后一页
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可提现订单列表
|
||||
* @param array $params
|
||||
* @param string|int $is_platform_deep_cooperation
|
||||
* @param array $fields
|
||||
* @return array|Collection|\Hyperf\Collection\Collection
|
||||
*/
|
||||
public static function getDoctorWithdrawalOrderList(array $params, string|int $is_platform_deep_cooperation,array $fields = ["*"]): array|Collection|\Hyperf\Collection\Collection
|
||||
{
|
||||
$query = self::with(['OrderInquiry', 'OrderServicePackage'])
|
||||
->where($params)
|
||||
->whereIn('order_type',[1,4,5]);
|
||||
|
||||
// 问诊订单
|
||||
$query = $query->where(function ($query) use ($is_platform_deep_cooperation){
|
||||
$query->whereExists(function ($subQuery) use ($is_platform_deep_cooperation){
|
||||
$subQuery->from('order_inquiry');
|
||||
if ($is_platform_deep_cooperation == 1){
|
||||
$subQuery->whereNotIn('inquiry_type', [2,4]);
|
||||
}
|
||||
|
||||
$subQuery->whereNotIn('inquiry_mode', [7,8,9])
|
||||
->whereIn('inquiry_status', [6])
|
||||
->whereIn('inquiry_refund_status', [0,3])
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_inquiry.order_id');
|
||||
})
|
||||
->orWhereExists(function ($subQuery) {
|
||||
$subQuery->from('order_service_package')
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_service_package.order_id')
|
||||
->whereIn('refund_status', [0,3])
|
||||
->where('pay_status', 2)
|
||||
->whereIn('order_service_status', [4,5])
|
||||
->WhereExists(function ($subQuery){
|
||||
$subQuery->from("order_service_package_inquiry")
|
||||
->whereRaw('gdxz_order_service_package.order_service_id = gdxz_order_service_package_inquiry.order_service_id');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return $query->orderBy('created_at')->get($fields);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $order_coupon_id 主键id
|
||||
* @property int $order_id 订单id
|
||||
* @property int $user_coupon_id 用户优惠卷表id
|
||||
* @property string $coupon_name 优惠卷名称
|
||||
* @property string $coupon_use_price 优惠卷使用金额
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderCoupon extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_coupon';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_coupon_id', 'order_id', 'user_coupon_id', 'coupon_name', 'coupon_use_price', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_coupon_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 OrderCoupon|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addOrderCoupon(array $data): \Hyperf\Database\Model\Model|OrderCoupon
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $order_detection_id 主键id
|
||||
* @property int $order_id 订单id
|
||||
* @property int $user_id 用户id-患者
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $doctor_id 医生id
|
||||
@@ -58,7 +59,7 @@ class OrderDetection extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_detection_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'order_inquiry_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'detection_pic', 'detection_time', 'detection_result_pdf', 'detection_result_date', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['order_detection_id', 'order_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'order_inquiry_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'detection_pic', 'detection_time', 'detection_result_pdf', 'detection_result_date', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_detection_id";
|
||||
|
||||
|
||||
+55
-33
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\Database\Query\Builder;
|
||||
@@ -13,6 +14,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $order_inquiry_id 主键id
|
||||
* @property int $order_id 订单id
|
||||
* @property int $user_id 用户id-患者
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $doctor_id 医生id(未分配时为null)
|
||||
@@ -46,9 +48,9 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @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 UserDoctor|null $UserDoctor
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
* @property-read UserDoctor|null $UserDoctor
|
||||
* @property-read OrderInquiryCase|null $OrderInquiryCase
|
||||
*/
|
||||
class OrderInquiry extends Model
|
||||
@@ -63,7 +65,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', 'times_number', 'duration', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['order_inquiry_id', 'order_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";
|
||||
|
||||
@@ -232,40 +234,13 @@ class OrderInquiry extends Model
|
||||
* 已结束
|
||||
* @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 $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);
|
||||
|
||||
$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 $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
|
||||
public static function getDoctorOrderInquiryPage(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)
|
||||
@@ -290,11 +265,15 @@ class OrderInquiry extends Model
|
||||
* @param array $params
|
||||
* @param array $reception_time 接诊时间区间
|
||||
* @param array $inquiry_status_params inquiry_status字段搜索条件
|
||||
* @param array $inquiry_type_not_params
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getDoctorAmountTotal(array $params, array $reception_time, array $inquiry_status_params): mixed
|
||||
public static function getDoctorAmountTotal(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')
|
||||
@@ -306,6 +285,7 @@ class OrderInquiry extends Model
|
||||
* @param array $params
|
||||
* @param array $reception_time 接诊时间区间
|
||||
* @param array $inquiry_status_params inquiry_status字段搜索条件
|
||||
* @param array $inquiry_type_not_params
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getCooperationDoctorAmountTotal(array $params, array $reception_time, array $inquiry_status_params,array $inquiry_type_not_params = []): mixed
|
||||
@@ -611,4 +591,46 @@ class OrderInquiry extends Model
|
||||
->latest()
|
||||
->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者某一时间段问诊订单-创建时间
|
||||
* @param array $params
|
||||
* @param array $created_at 接诊时间区间
|
||||
* @param array $inquiry_status_params inquiry_status字段搜索条件
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getInquiryWithCreateTime(array $params, array $created_at, array $inquiry_status_params): Collection|array
|
||||
{
|
||||
return self::where($params)
|
||||
->whereIn('inquiry_status', $inquiry_status_params)
|
||||
->whereBetween('created_at', $created_at)
|
||||
->orderBy('created_at')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生每月账单数据
|
||||
* @param array $params
|
||||
* @param string $year
|
||||
* @param string|int $is_platform_deep_cooperation
|
||||
* @param array $fields
|
||||
* @return \Hyperf\Collection\Collection
|
||||
*/
|
||||
public static function getMonthlyGroupBill(array $params, string $year,string|int $is_platform_deep_cooperation,array $fields = ["*"]): \Hyperf\Collection\Collection
|
||||
{
|
||||
$query = self::select([Db::raw('YEAR(reception_time) AS `year`') ,Db::raw('MONTH(reception_time) AS `month`')])
|
||||
->where($params)
|
||||
->whereNotIn('inquiry_mode', [7,8,9])
|
||||
->whereIn('inquiry_status', [6])
|
||||
->where(Db::raw('YEAR(reception_time)'), $year);
|
||||
|
||||
if ($is_platform_deep_cooperation == 1){
|
||||
$query->whereNotIn('inquiry_type', [2,4]);
|
||||
}
|
||||
|
||||
$result = $query->groupBy([Db::raw('YEAR(reception_time)'),Db::raw('MONTH(reception_time)')])
|
||||
->get($fields);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Relations\HasMany;
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
@@ -15,6 +16,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $order_product_id 主键id
|
||||
* @property int $order_inquiry_id 订单-问诊id
|
||||
* @property int $order_prescription_id 订单-处方id
|
||||
* @property int $order_id 订单id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $family_id 家庭成员id(就诊用户)
|
||||
@@ -53,12 +55,12 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $consignee_name_mask 收货人姓名(掩码)
|
||||
* @property string $consignee_tel 收货人电话
|
||||
* @property string $consignee_tel_mask 收货人电话(掩码)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
* @property-read Collection|OrderProductItem[]|null $OrderProductItem
|
||||
* @property-read OrderPrescription|null $OrderPrescription
|
||||
* @property-read \Hyperf\Database\Model\Collection|OrderPrescriptionIcd[]|null $OrderPrescriptionIcd
|
||||
* @property-read \Hyperf\Database\Model\Collection|OrderProductItem[]|null $OrderProductItem
|
||||
* @property-read PatientFamily|null $PatientFamily
|
||||
* @property-read Collection|OrderPrescriptionIcd[]|null $OrderPrescriptionIcd
|
||||
*/
|
||||
class OrderProduct extends Model
|
||||
{
|
||||
@@ -72,7 +74,7 @@ class OrderProduct extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_product_id', 'order_inquiry_id', 'order_prescription_id', 'doctor_id', 'patient_id', 'family_id', 'order_product_no', 'escrow_trade_no', 'order_product_status', 'pay_channel', 'pay_status', 'is_delete', 'cancel_reason', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'logistics_fee', 'logistics_no', 'logistics_company_code', 'sub_logistics_status', 'delivery_time', 'pay_time', 'remarks', 'refund_status', 'cancel_time', 'cancel_remarks', 'report_pre_status', 'report_pre_time', 'report_pre_fail_reason', 'province_id', 'province', 'city_id', 'city', 'county_id', 'county', 'address', 'address_mask', 'consignee_name', 'consignee_name_mask', 'consignee_tel', 'consignee_tel_mask', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['order_product_id', 'order_inquiry_id', 'order_prescription_id', 'order_id', 'doctor_id', 'patient_id', 'family_id', 'order_product_no', 'escrow_trade_no', 'order_product_status', 'pay_channel', 'pay_status', 'is_delete', 'cancel_reason', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'logistics_fee', 'logistics_no', 'logistics_company_code', 'sub_logistics_status', 'delivery_time', 'pay_time', 'remarks', 'refund_status', 'cancel_time', 'cancel_remarks', 'report_pre_status', 'report_pre_time', 'report_pre_fail_reason', 'province_id', 'province', 'city_id', 'city', 'county_id', 'county', 'address', 'address_mask', 'consignee_name', 'consignee_name_mask', 'consignee_tel', 'consignee_tel_mask', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_product_id";
|
||||
|
||||
@@ -238,4 +240,20 @@ class OrderProduct extends Model
|
||||
return self::where($params)->whereIn('order_product_status',$order_product_status)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者某一时间段药品订单-创建时间
|
||||
* @param array $params
|
||||
* @param array $created_at 接诊时间区间
|
||||
* @param array $order_product_status
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getProductWithCreateTime(array $params, array $created_at,array $order_product_status): Collection|array
|
||||
{
|
||||
return self::where($params)
|
||||
->whereIn('order_product_status', $order_product_status)
|
||||
->whereBetween('created_at', $created_at)
|
||||
->orderBy('created_at')
|
||||
->get();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $order_refund_id 主键id
|
||||
* @property int $order_id 订单id
|
||||
* @property int $patient_id 患者id
|
||||
* @property string $order_no 系统订单编号
|
||||
* @property string $refund_no 系统退款编号
|
||||
* @property string $refund_id 第三方退款单号
|
||||
* @property int $refund_status 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
||||
* @property string $refund_total 退款金额
|
||||
* @property string $refund_reason 退款原因
|
||||
* @property string $success_time 退款成功时间
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderRefund extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_refund';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_refund_id', 'order_id', 'patient_id', 'order_no', 'refund_no', 'refund_id', 'refund_status', 'refund_total', 'refund_reason', 'success_time', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_refund_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 OrderRefund|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addOrderRefund(array $data): \Hyperf\Database\Model\Model|OrderRefund
|
||||
{
|
||||
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,239 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $order_service_id 主键id
|
||||
* @property int $order_id 订单id
|
||||
* @property int $user_id 用户id-患者
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $family_id 家庭成员id(就诊用户)
|
||||
* @property int $order_service_type 服务包类型(1:健康包 2:随访包)
|
||||
* @property int $order_service_status 订单状态(1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消)
|
||||
* @property int $is_delete 删除状态(0:否 1:是)
|
||||
* @property int $refund_status 订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)
|
||||
* @property int $pay_channel 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||||
* @property int $pay_status 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
* @property string $order_service_no 系统订单编号
|
||||
* @property string $escrow_trade_no 第三方支付流水号
|
||||
* @property string $amount_total 订单金额
|
||||
* @property string $coupon_amount_total 优惠卷总金额
|
||||
* @property string $payment_amount_total 实际付款金额
|
||||
* @property string $pay_time 支付时间
|
||||
* @property string $start_time 开始服务时间
|
||||
* @property string $finish_time 结束服务时间
|
||||
* @property string $cancel_time 订单取消时间
|
||||
* @property int $cancel_reason 取消订单原因(1:医生未接受服务 2:主动取消 4:客服取消 5:支付超时)
|
||||
* @property string $cancel_remarks 取消订单备注
|
||||
* @property int $add_finish_status 添加完成订单延迟队列状态(0:未添加 1:已添加 2:添加失败)
|
||||
* @property string $add_finish_time 添加完成订单延迟队列时间
|
||||
* @property string $add_finish_fail_reason 添加完成订单延迟队列失败原因
|
||||
* @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 OrderServicePackageCase|null $OrderServicePackageCase
|
||||
*/
|
||||
class OrderServicePackage extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_service_package';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_service_id', 'order_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'order_service_type', 'order_service_status', 'is_delete', 'refund_status', 'pay_channel', 'pay_status', 'order_service_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'start_time', 'finish_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'add_finish_status', 'add_finish_time', 'add_finish_fail_reason', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_service_id";
|
||||
|
||||
/**
|
||||
* 关联服务包病例表
|
||||
*/
|
||||
public function OrderServicePackageCase(): HasOne
|
||||
{
|
||||
return $this->hasOne(OrderServicePackageCase::class, 'order_service_id', 'order_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 Collection|array
|
||||
*/
|
||||
public static function getList(array $params, array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return OrderServicePackage|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addOrderServicePackage(array $data): \Hyperf\Database\Model\Model|OrderServicePackage
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某一状态下的订单-多条
|
||||
* @param array $params
|
||||
* @param array $order_service_status
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getStatusList(array $params = [],array $order_service_status = [], array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->whereIn('order_service_status',$order_service_status)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某一状态下的订单-单条
|
||||
* @param array $params
|
||||
* @param array $order_service_status
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getStatusOne(array $params = [],array $order_service_status = [], array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->whereIn('order_service_status',$order_service_status)->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务包订单-分页
|
||||
* @param array $params
|
||||
* @param array $order_service_status_params
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getPatientOrderServicePage(array $params, array $order_service_status_params, array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
|
||||
{
|
||||
$raw = self::with([
|
||||
'OrderServicePackageCase:order_service_case_id,order_service_id,disease_desc',
|
||||
])
|
||||
->where($params)
|
||||
->when($order_service_status_params, function ($query, $order_service_status_params) {
|
||||
$query->whereIn('order_service_status', $order_service_status_params);
|
||||
})
|
||||
->orderBy('created_at', '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 $order_service_status_params
|
||||
* @param array $finish_time_params 结束时间区间
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getInquiryWithFinishTime(array $params, array $order_service_status_params, array $finish_time_params): Collection|array
|
||||
{
|
||||
return self::where($params)
|
||||
->whereIn('order_service_status',$order_service_status_params)
|
||||
->whereBetween('finish_time', $finish_time_params)
|
||||
->orderBy('finish_time')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生当日的服务包订单
|
||||
* @param array $params
|
||||
* @param array $order_service_status_params
|
||||
* @param array $start_time_params 开始时间区间
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getDoctorDayOrderServiceWithStartTime(array $params, array $order_service_status_params,array $start_time_params): Collection|array
|
||||
{
|
||||
return self::where($params)
|
||||
->whereIn('order_service_status',$order_service_status_params)
|
||||
->whereIn('refund_status',[0,4,5])
|
||||
->whereBetween('start_time', $start_time_params)
|
||||
->orderBy('start_time')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生当日未结束的服务包订单
|
||||
* @param array $params
|
||||
* @param array $order_service_status_params
|
||||
* @param string $finish_time_params 当前时间
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getDoctorDayNoFinishOrderService(array $params, array $order_service_status_params,string $finish_time_params): Collection|array
|
||||
{
|
||||
return self::where($params)
|
||||
->whereIn('order_service_status',$order_service_status_params)
|
||||
->whereIn('refund_status',[0,4,5])
|
||||
->where('finish_time','>', $finish_time_params)
|
||||
->orderBy('start_time')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生每月账单数据
|
||||
* @param array $params
|
||||
* @param string $year
|
||||
* @param array $fields
|
||||
* @return \Hyperf\Collection\Collection
|
||||
*/
|
||||
public static function getMonthlyGroupBill(array $params, string $year,array $fields = ["*"]): \Hyperf\Collection\Collection
|
||||
{
|
||||
return self::select([Db::raw('YEAR(start_time) AS `year`') ,Db::raw('MONTH(start_time) AS `month`')])
|
||||
->where($params)
|
||||
->whereIn('order_service_status', [3,4,5])
|
||||
->where(Db::raw('YEAR(start_time)'), $year)
|
||||
->groupBy([Db::raw('YEAR(start_time)'),Db::raw('MONTH(start_time)')])
|
||||
->get($fields);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $order_service_case_id 主键id
|
||||
* @property int $user_id 用户id
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $order_id 订单id
|
||||
* @property int $order_service_id 订单-服务包id
|
||||
* @property int $family_id 家庭成员id
|
||||
* @property int $disease_class_id 疾病分类id-系统
|
||||
* @property int $relation 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )
|
||||
* @property int $status 状态(1:正常 2:删除)
|
||||
* @property string $name 患者名称
|
||||
* @property int $sex 患者性别(0:未知 1:男 2:女)
|
||||
* @property int $age 患者年龄
|
||||
* @property string $disease_class_name 疾病名称-系统
|
||||
* @property string $diagnosis_date 确诊日期
|
||||
* @property string $disease_desc 病情描述(主诉)
|
||||
* @property string $diagnose_images 复诊凭证(多个使用逗号分隔)
|
||||
* @property int $is_allergy_history 是否存在过敏史(0:否 1:是)
|
||||
* @property string $allergy_history 过敏史描述
|
||||
* @property int $is_family_history 是否存在家族病史(0:否 1:是)
|
||||
* @property string $family_history 家族病史描述
|
||||
* @property int $is_pregnant 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
* @property string $pregnant 备孕、妊娠、哺乳期描述
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderServicePackageCase extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_service_package_case';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_service_case_id', 'user_id', 'patient_id', 'order_id', 'order_service_id', 'family_id', 'disease_class_id', 'relation', 'status', 'name', 'sex', 'age', 'disease_class_name', 'diagnosis_date', 'disease_desc', 'diagnose_images', 'is_allergy_history', 'allergy_history', 'is_family_history', 'family_history', 'is_pregnant', 'pregnant', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_service_case_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 OrderServicePackageCase|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addOrderServicePackageCase(array $data): \Hyperf\Database\Model\Model|OrderServicePackageCase
|
||||
{
|
||||
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,86 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $order_service_detail_id 主键id
|
||||
* @property int $order_service_id 服务包订单id
|
||||
* @property int $order_id 订单id
|
||||
* @property int $package_id 健康包配置id(随访包时为空)
|
||||
* @property string $order_service_no 系统订单编号
|
||||
* @property int $service_period 服务周期(天)
|
||||
* @property int $service_count 总服务次数(0表示不限次)
|
||||
* @property int $monthly_frequency 每月次数(0表示不限次)
|
||||
* @property string $single_inquiry_price 单次图文问诊价格
|
||||
* @property string $service_price 总服务价格
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderServicePackageDetail extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_service_package_detail';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_service_detail_id', 'order_service_id', 'order_id', 'package_id', 'order_service_no', 'service_period', 'service_count', 'monthly_frequency', 'single_inquiry_price', 'service_price', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_service_detail_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 OrderServicePackageDetail|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addOrderServicePackageDetail(array $data): \Hyperf\Database\Model\Model|OrderServicePackageDetail
|
||||
{
|
||||
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,80 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $service_inquiry_id 主键id
|
||||
* @property int $order_service_id 订单-服务包id
|
||||
* @property int $order_inquiry_id 订单-问诊id
|
||||
* @property string $order_service_no 服务包系统订单编号
|
||||
* @property string $inquiry_no 问诊系统订单编号
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderServicePackageInquiry extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_service_package_inquiry';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['service_inquiry_id', 'order_service_id', 'order_inquiry_id', 'order_service_no', 'inquiry_no', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "service_inquiry_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 OrderServicePackageInquiry|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addOrderServicePackageInquiry(array $data): \Hyperf\Database\Model\Model|OrderServicePackageInquiry
|
||||
{
|
||||
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,92 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $service_product_id 主键id
|
||||
* @property int $order_service_id 订单-服务包id
|
||||
* @property int $order_product_id 订单-商品id
|
||||
* @property string $order_product_no 订单-商品系统编号
|
||||
* @property int $product_item_id 订单-商品明细id
|
||||
* @property int $product_id 商品id
|
||||
* @property int $used_quantity 订单使用数量
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderServicePackageProduct extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_service_package_product';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['service_product_id', 'order_service_id', 'order_product_id', 'order_product_no', 'product_item_id', 'product_id', 'used_quantity', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "service_product_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 OrderServicePackageProduct|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addOrderServicePackageProduct(array $data): \Hyperf\Database\Model\Model|OrderServicePackageProduct
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param array $params
|
||||
* @return int|mixed
|
||||
*/
|
||||
public static function deleteOrderServicePackageProduct(array $params): mixed
|
||||
{
|
||||
return self::where($params)->delete();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $service_refund_id 主键id
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $order_service_id 订单-服务包id
|
||||
* @property string $order_service_no 系统订单编号
|
||||
* @property string $service_refund_no 系统退款编号
|
||||
* @property string $refund_id 第三方退款单号
|
||||
* @property int $refund_status 订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)
|
||||
* @property string $refund_total 退款金额
|
||||
* @property string $product_refund_total 药品退款金额
|
||||
* @property string $inquiry_refund_total 问诊退款金额
|
||||
* @property string $refund_reason 退款原因
|
||||
* @property string $success_time 退款成功时间
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderServicePackageRefund extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_service_package_refund';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['service_refund_id', 'patient_id', 'order_service_id', 'order_service_no', 'service_refund_no', 'refund_id', 'refund_status', 'refund_total', 'product_refund_total', 'inquiry_refund_total', 'refund_reason', 'success_time', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "service_refund_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 OrderServicePackageRefund|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addOrderServicePackageRefund(array $data): \Hyperf\Database\Model\Model|OrderServicePackageRefund
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
@@ -29,8 +30,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $report_prescription_int 处方上报次数
|
||||
* @property string $report_prescription_time 处方上报时间
|
||||
* @property string $report_prescription_fail_reason 处方上报失败原因
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class ReportRegulatory extends Model
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊 7:附赠 8:健康包 9:随访包)
|
||||
* @property int $default_work_num_day 默认每日接诊数量
|
||||
* @property int $max_work_num_day 每日最大接诊数量
|
||||
* @property int $min_work_num_day 每日最小接诊数量
|
||||
* @property string $inquiry_price 接诊价格
|
||||
* @property string $min_inquiry_price 最低接诊价格(专家问诊)
|
||||
* @property string $max_inquiry_price 最高接诊价格(专家问诊)
|
||||
@@ -35,12 +36,12 @@ class SystemInquiryConfig extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
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'];
|
||||
protected array $fillable = ['system_inquiry_config_id', 'inquiry_type', 'inquiry_mode', 'default_work_num_day', 'max_work_num_day', 'min_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', 'default_work_num_day' => 'integer'];
|
||||
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', 'min_work_num_day' => 'integer'];
|
||||
|
||||
protected string $primaryKey = "system_inquiry_config_id";
|
||||
|
||||
|
||||
+51
-10
@@ -6,6 +6,7 @@ namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
@@ -19,8 +20,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $coupon_use_date 使用时间
|
||||
* @property string $valid_start_time 开始使用时间
|
||||
* @property string $valid_end_time 过期使用时间
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
* @property-read Coupon $Coupon
|
||||
*/
|
||||
class UserCoupon extends Model
|
||||
@@ -61,7 +62,6 @@ class UserCoupon extends Model
|
||||
/**
|
||||
* 获取优惠卷信息-多条
|
||||
* @param array $params
|
||||
* @param array $coupon_params
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
@@ -132,7 +132,7 @@ class UserCoupon extends Model
|
||||
* @param array $fields 字段
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getUserProductUsableCoupon(string|int $user_id,array $coupon_product_datas,array $fields = ['*']): Collection|array
|
||||
public static function getUserProductUsableCoupon(string|int $user_id,array $coupon_product_datas = [],array $fields = ['*']): Collection|array
|
||||
{
|
||||
$params = array();
|
||||
$params[] = ['user_id', '=', $user_id];
|
||||
@@ -144,12 +144,12 @@ class UserCoupon extends Model
|
||||
->whereHas('Coupon', function ($query) use ($coupon_product_datas) {
|
||||
$query->where("coupon_client",1)
|
||||
->where("coupon_status",1)
|
||||
->whereIn("application_scope",[1,3,4,5])
|
||||
->where(function ($query) use ($coupon_product_datas) {
|
||||
foreach ($coupon_product_datas as $coupon_product_data){
|
||||
$query->orwhere("product_id","like",'%' . $coupon_product_data['product_id'] . '%');
|
||||
}
|
||||
});
|
||||
->whereIn("application_scope",[1,3,4,5,6]);
|
||||
// ->when(function ($query) use ($coupon_product_datas) {
|
||||
// foreach ($coupon_product_datas as $coupon_product_data){
|
||||
// $query->orwhere("product_id","=",$coupon_product_data['product_id']);
|
||||
// }
|
||||
// });
|
||||
})
|
||||
->where($params)
|
||||
->groupBy("coupon_id")
|
||||
@@ -184,4 +184,45 @@ class UserCoupon extends Model
|
||||
->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者某一类型下的全部优惠卷
|
||||
* @param string|int $user_id
|
||||
* @param int $distribution_object
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getUserAllObjectTypeCoupon(string|int $user_id,int $distribution_object,array $fields = ['*']): Collection|array
|
||||
{
|
||||
$params = array();
|
||||
$params[] = ['user_id', '=', $user_id];
|
||||
$params[] = ['valid_start_time', '<', date('Y-m-d H:i:s', time())]; // 有效使用时间
|
||||
$params[] = ['valid_end_time', '>', date('Y-m-d H:i:s', time())]; // 过期使用时间
|
||||
|
||||
return self::with(['Coupon'])
|
||||
->whereHas('Coupon', function ($query) use ($distribution_object) {
|
||||
$query->where("coupon_client",1)
|
||||
->where("coupon_status",1)
|
||||
->where(function ($query) use ($distribution_object) {
|
||||
$query->orwhere("distribution_object",$distribution_object);
|
||||
});
|
||||
})
|
||||
->where($params)
|
||||
->groupBy("coupon_id")
|
||||
->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者今日过期优惠卷
|
||||
* @param array $params
|
||||
* @param array $valid_end_time
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getUserTodayExpiredCoupon(array $params,array $valid_end_time,array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)
|
||||
// ->where('valid_start_time',">=","2024-05-01 00:00:00") // 此处是为了区分于1.3版本上线前的优惠卷
|
||||
->whereBetween('valid_end_time', $valid_end_time)
|
||||
->get($fields);
|
||||
}
|
||||
}
|
||||
|
||||
+31
-43
@@ -282,7 +282,6 @@ class UserDoctor extends Model
|
||||
// $query->where($params);
|
||||
// });
|
||||
|
||||
|
||||
if ($is_first_online == 1){
|
||||
$query->join('user as u', function ($query) {
|
||||
$query->on('user_doctor.user_id', '=', 'u.user_id');
|
||||
@@ -291,49 +290,38 @@ class UserDoctor extends Model
|
||||
->orderBy('u.is_online', 'desc');
|
||||
}
|
||||
|
||||
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])){
|
||||
$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');
|
||||
});
|
||||
// 问诊服务搜索
|
||||
// select doctor_id, min(price) price_min from price group by doctor_id
|
||||
$raw = "inquiry_price as min_inquiry_price";
|
||||
if (!empty($sort_order) && in_array($sort_order,[1,3,4])){
|
||||
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 (!empty($sort_order)){
|
||||
if ($sort_order == 1) {
|
||||
// 综合-价格从低到高
|
||||
$query->orderBy('is_recommend', 'desc');// 是否首页推荐(0:否 1:是)
|
||||
@@ -403,7 +391,7 @@ class UserDoctor extends Model
|
||||
->get();
|
||||
|
||||
dump($doctors->toArray());
|
||||
return $doctors;
|
||||
return array();
|
||||
|
||||
// $query = self::orderBy('served_patients_num', 'desc');
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user