初始化提交

This commit is contained in:
2023-02-17 17:10:16 +08:00
commit 4ca844f470
152 changed files with 20390 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $area_id 地区编号
* @property string $area_name 名称
* @property int $parent_id 上级编号
* @property string $zip 邮编
* @property int $area_type 类型(1:国家,2:省,3:市,4:区县)
*/
class Area extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'area';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['area_id', 'area_name', 'parent_id', 'zip', 'area_type'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['area_id' => 'integer', 'parent_id' => 'integer', 'area_type' => 'integer'];
protected string $primaryKey = "area_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 $field
* @return Collection|array
*/
public static function getList(array $params = [], array $field = ['*']): Collection|array
{
return self::where($params)->get($field);
}
}
+69
View File
@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $banner_id 主键id
* @property string $banner_name 图片名称
* @property string $banner_path 图片路径
* @property int $app_type 应用程序类型(1:小程序 2:app)
* @property int $client_type 客户端类型(1:患者端 2:医生端 3:药师端)
* @property int $banner_place 展示位置(1:首页)
* @property int $banner_status 状态(0:删除 1:正常 2:禁用)
* @property int $banner_sort 排序值(越大排序越靠前)
* @property string $banner_link 跳转地址
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class Banner extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'banner';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['banner_id', 'banner_name', 'banner_path', 'app_type', 'client_type', 'banner_place', 'banner_status', 'banner_sort', 'banner_link', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['banner_id' => 'integer', 'app_type' => 'integer', 'client_type' => 'integer', 'banner_place' => 'integer', 'banner_status' => 'integer', 'banner_sort' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "banner_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
* @param string $order
* @param string $direction
* @return object|null
*/
public static function getList(array $params, array $fields = ['*'], string $order = "banner_sort", string $direction = 'desc'): object|null
{
return self::where($params)->orderBy($order, $direction)->get($fields);
}
}
+48
View File
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $job_id 主键id
* @property string $job_name 职位名称
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class BasicJob extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'basic_job';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['job_id', 'job_name', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['job_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "job_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);
}
}
+48
View File
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $nation_id 主键id
* @property string $nation_name 民族名称
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class BasicNation extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'basic_nation';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['nation_id', 'nation_name', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['nation_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "nation_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);
}
}
+77
View File
@@ -0,0 +1,77 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $code_log_id 主键id
* @property int $type 类型(1:短信 2:邮件)
* @property int $status 状态(1:发送成功 2:发送失败)
* @property int $scene 场景(1:登陆)
* @property string $phone 手机号
* @property string $code 验证码
* @property string $third_code 第三方编码
* @property string $remarks 备注
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class CodeLog extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'code_log';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['code_log_id', 'type', 'status', 'scene', 'phone', 'code', 'third_code', 'remarks', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['code_log_id' => 'integer', 'type' => 'integer', 'status' => 'integer', 'scene' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "code_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
* @param string $order
* @param string $direction
* @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|CodeLog
*/
public static function addCodeLog(array $data): \Hyperf\Database\Model\Model|CodeLog
{
return self::create($data);
}
}
+77
View File
@@ -0,0 +1,77 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $coupon_id 主键id
* @property string $coupon_name 优惠卷名称
* @property string $coupon_icon 优惠卷图片
* @property int $coupon_client 使用平台(1:小程序)
* @property int $coupon_type 优惠卷类型(1:无门槛 2:满减)
* @property int $coupon_status 状态(1:正常 2:强制失效 3:结束)
* @property int $distribution_object 发放对象(1:新注册用户 2:会员 3:近期消费 4:近期购药)
* @property int $application_scope 适用范围(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药)
* @property int $is_display 是否展示(0:否 1:是)
* @property int $distribution_with_day 发放关联时间(发放对象为近期消费等类型时规定天数)
* @property int $coupon_count 发放数量
* @property int $coupon_take_count 领取数量
* @property int $coupon_ used_count 使用数量
* @property string $coupon_price 优惠卷金额
* @property string $with_amount 符合满减标准金额(优惠卷类型为满减时使用)
* @property int $valid_type 有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效)
* @property int $valid_days 自领取之日起有效天数
* @property string $valid_start_time 开始使用时间
* @property string $valid_end_time 结束使用时间
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class Coupon extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'coupon';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['coupon_id', 'coupon_name', 'coupon_icon', 'coupon_client', 'coupon_type', 'coupon_status', 'distribution_object', 'application_scope', 'is_display', 'distribution_with_day', 'coupon_count', 'coupon_take_count', 'coupon_ used_count', 'coupon_price', 'with_amount', 'valid_type', 'valid_days', 'valid_start_time', 'valid_end_time', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['coupon_id' => 'integer', 'coupon_client' => 'integer', 'coupon_type' => 'integer', 'coupon_status' => 'integer', 'distribution_object' => 'integer', 'application_scope' => 'integer', 'is_display' => 'integer', 'distribution_with_day' => 'integer', 'coupon_count' => 'integer', 'coupon_take_count' => 'integer', 'coupon_ used_count' => 'integer', 'valid_type' => 'integer', 'valid_days' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "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 object|null
*/
public static function getList(array $params, array $fields = ['*']): object|null
{
return self::where($params)->get($fields);
}
}
+77
View File
@@ -0,0 +1,77 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $disease_class_id 主键id
* @property string $disease_class_name 疾病分类名称
* @property int $expertise_id 医生专长id
* @property int $disease_class_status 状态(0:删除 1:正常)
* @property int $disease_class_enable 是否启用(0:否 1:是)
* @property int $icd_id 标准分类id
* @property int $is_hot 是否热门(0:否 1:是)
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class DiseaseClass extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'disease_class';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['disease_class_id', 'disease_class_name', 'expertise_id', 'disease_class_status', 'disease_class_enable', 'icd_id', 'is_hot', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['disease_class_id' => 'integer', 'expertise_id' => 'integer', 'disease_class_status' => 'integer', 'disease_class_enable' => 'integer', 'icd_id' => 'integer', 'is_hot' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "disease_class_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 int|string $limit
* @param array $fields
* @return Collection|array
*/
public static function getLimit(array $params = [],int|string $limit = 5, array $fields = ['*']): Collection|array
{
return self::where($params)->limit($limit)->get($fields);
}
}
+60
View File
@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $expertise_id 主键id
* @property string $expertise_name 专长名称
* @property int $expertise_sort 排序(越大排序越靠前)
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class DiseaseClassExpertise extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'disease_class_expertise';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['expertise_id', 'expertise_name', 'expertise_sort', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['expertise_id' => 'integer', 'expertise_sort' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "expertise_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 array
*/
public static function getOrderList(array $params = [], array $fields = ['*'],): array
{
return self::where($params)->orderBy('expertise_sort','desc')->get($fields)->toArray();
}
}
+103
View File
@@ -0,0 +1,103 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $doctor_expertise_id 主键id
* @property int $doctor_id 医生id
* @property int $expertise_id 专长id
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class DoctorExpertise extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'doctor_expertise';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['doctor_expertise_id', 'doctor_id', 'expertise_id', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['doctor_expertise_id' => 'integer', 'doctor_id' => 'integer', 'expertise_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "doctor_expertise_id";
/**
* 关联专长表
*/
public function DiseaseClassExpertise(): HasOne
{
return $this->hasOne(DiseaseClassExpertise::class, 'expertise_id', 'expertise_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 $fields
* @return Collection|array
*/
public static function getDiseaseClassExpertiseList(array $params, array $fields = ['*']): Collection|array
{
return self::with(['DiseaseClassExpertise'])->where($params)->get($fields);
}
/**
* 删除
* @param array $params
* @return int|mixed
*/
public static function deleteDoctorExpertise(array $params): mixed
{
return self::where($params)->delete();
}
/**
* 新增
* @param array $data
* @return DoctorExpertise|\Hyperf\Database\Model\Model
*/
public static function addDoctorExpertise(array $data): DoctorExpertise|\Hyperf\Database\Model\Model
{
return self::create($data);
}
}
+108
View File
@@ -0,0 +1,108 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $inquiry_config_id 主键id
* @property int $doctor_id 医生id
* @property int $system_inquiry_config_id 系统问诊配置表id
* @property int $inquiry_type 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
* @property int $work_num_day 每日接诊数量
* @property string $inquiry_price 接诊价格(专家问诊-公益问诊)
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
* @property-read SystemInquiryConfig $SystemInquiryConfig
*/
class DoctorInquiryConfig extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'doctor_inquiry_config';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['inquiry_config_id', 'doctor_id', 'system_inquiry_config_id', 'inquiry_type', 'inquiry_mode', 'work_num_day', 'inquiry_price', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['inquiry_config_id' => 'integer', 'doctor_id' => 'integer', 'system_inquiry_config_id' => 'integer', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'work_num_day' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "inquiry_config_id";
/**
* 关联系统问诊配置表
*/
public function SystemInquiryConfig(): HasOne
{
return $this->hasOne(SystemInquiryConfig::class, 'system_inquiry_config_id', 'system_inquiry_config_id');
}
/**
* 获取医生接诊配置信息-单条
* @param array $params
* @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 getInquiryConfigOne(array $params, array $fields = ['*']): object|null
{
return self::with(['SystemInquiryConfig'])->where($params)->first($fields);
}
/**
* 获取医生接诊配置信息-多条
* 在线问诊+专家问诊
* @param array $params
* @param array $fields
* @return object|null
*/
public static function getInquiryConfigList(array $params, array $fields = ['*']): object|null
{
return self::with(['SystemInquiryConfig'])
->where($params)->whereIn("inquiry_type",[1,3])->get($fields);
}
/**
* 创建
* @param array $data
* @return \Hyperf\Database\Model\Model|DoctorInquiryConfig
*/
public static function addInquiryConfig(array $data): \Hyperf\Database\Model\Model|DoctorInquiryConfig
{
return self::create($data);
}
/**
* 修改医生接诊配置
* @param array $params
* @param array $data
* @return int
*/
public static function editInquiryConfig(array $params = [], array $data = []): int
{
return self::where($params)->update($data);
}
}
+60
View File
@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $record_id 主键id
* @property int $doctor_id 医生id
* @property int $inquiry_config_id 接诊配置id
* @property string $old_price 原价格
* @property string $new_price 新价格
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class DoctorInquiryPriceRecord extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'doctor_inquiry_price_record';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['record_id', 'doctor_id', 'inquiry_config_id', 'old_price', 'new_price', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['record_id' => 'integer', 'doctor_id' => 'integer', 'inquiry_config_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "record_id";
/**
* 获取是否存在
* @param array $params
* @return bool
*/
public static function getExists(array $params): bool
{
return self::where($params)->exists();
}
/**
* 获取数量
* @param array $params
* @return int
*/
public static function getCount(array $params): int
{
return self::where($params)->count();
}
}
+85
View File
@@ -0,0 +1,85 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $hospital_id 主键id
* @property string $hospital_name 医院名称
* @property int $hospital_status 状态(0:禁用 1:正常 2:删除)
* @property string $hospital_level_name 医院等级名称
* @property string $post_code 邮政编码
* @property string $tele_phone 电话
* @property int $province_id 省份id
* @property string $province 省份
* @property int $city_id 城市id
* @property string $city 城市
* @property int $county_id 区县id
* @property string $county 区县
* @property string $address 地址
* @property string $lat 纬度
* @property string $lng 经度
* @property string $desc 简介
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class Hospital extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'hospital';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['hospital_id', 'hospital_name', 'hospital_status', 'hospital_level_name', 'post_code', 'tele_phone', 'province_id', 'province', 'city_id', 'city', 'county_id', 'county', 'address', 'lat', 'lng', 'desc', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['hospital_id' => 'integer', 'hospital_status' => 'integer', 'province_id' => 'integer', 'city_id' => 'integer', 'county_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "hospital_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|Hospital
*/
public static function addHospital(array $data): \Hyperf\Database\Model\Model|Hospital
{
return self::create($data);
}
}
+64
View File
@@ -0,0 +1,64 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $department_custom_id 主键id
* @property int $department_id 医院科室-标准id
* @property string $department_custom_name 科室名称-自定义
* @property string $department_name 科室名称-标准
* @property string $department_code 科室编码-标准
* @property int $department_status 状态(1:正常 2:删除)
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class HospitalDepartmentCustom extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'hospital_department_custom';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['department_custom_id', 'department_id', 'department_custom_name', 'department_name', 'department_code', 'department_status', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['department_custom_id' => 'integer', 'department_id' => 'integer', 'department_status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "department_custom_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);
}
}
+88
View File
@@ -0,0 +1,88 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $case_product_id 主键id
* @property int $inquiry_case_id 病例id
* @property int $product_id 商品id
* @property int $case_product_num 药品数量
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
* @property-read Product $Product
*/
class InquiryCaseProduct extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'inquiry_case_product';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['case_product_id', 'inquiry_case_id', 'product_id', 'case_product_num', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['case_product_id' => 'integer', 'inquiry_case_id' => 'integer', 'product_id' => 'integer', 'case_product_num' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "case_product_id";
/**
* 关联商品表
*/
public function Product(): HasOne
{
return $this->hasOne(Product::class, 'product_id', '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 $params
* @param array $fields
* @return Collection|array
*/
public static function getWithProductList(array $params = [], array $fields = ['*']): Collection|array
{
return self::with([
"Product"
])
->where($params)
->get($fields);
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Model;
use Hyperf\DbConnection\Model\Model as BaseModel;
abstract class Model extends BaseModel
{
}
+69
View File
@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $module_id 主键ID
* @property string $module_name 模块名称
* @property string $module_img_path 模块图片
* @property int $app_type 应用程序类型(1:小程序 2:app)
* @property int $client_type 类型(1:患者端 2:医生端 3:药师端)
* @property int $module_place 展示位置(1:首页)
* @property int $module_status 状态(0:删除 1:正常 2:禁用)
* @property int $module_sort 排序值(越大排序越靠前)
* @property string $module_link 跳转地址
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class Module extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'module';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['module_id', 'module_name', 'module_img_path', 'app_type', 'client_type', 'module_place', 'module_status', 'module_sort', 'module_link', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['module_id' => 'integer', 'app_type' => 'integer', 'client_type' => 'integer', 'module_place' => 'integer', 'module_status' => 'integer', 'module_sort' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "module_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
* @param string $order
* @param string $direction
* @return object|null
*/
public static function getList(array $params, array $fields = ['*'], string $order = "module_sort", string $direction = 'desc'): object|null
{
return self::where($params)->orderBy($order, $direction)->get($fields);
}
}
+66
View File
@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $evaluation_id 主键id
* @property int $doctor_id 医生id
* @property int $patient_id 患者id
* @property int $order_inquiry_id 订单-问诊id
* @property string $reply_quality 回复质量(百分制)
* @property string $service_attitude 服务态度(百分制)
* @property string $reply_progress 回复速度(百分制)
* @property string $avg_score 平均得分(百分制)
* @property int $type 类型(1:默认评价 2:主动评价)
* @property string $content 评价内容
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class OrderEvaluation extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'order_evaluation';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['evaluation_id', 'doctor_id', 'patient_id', 'order_inquiry_id', 'reply_quality', 'service_attitude', 'reply_progress', 'avg_score', 'type', 'content', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['evaluation_id' => 'integer', 'doctor_id' => 'integer', 'patient_id' => 'integer', 'order_inquiry_id' => 'integer', 'type' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "evaluation_id";
/**
* 获取评价列表-分页
* @param array $params 条件
* @param array $fields 字段
* @param int|null $page 页码
* @param int|null $per_page 每页个数
* @return array
*/
public static function getPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
{
$raw = self::where($params)->paginate($per_page, $fields, "page", $page);
$data = array();
$data['current_page'] = $raw->currentPage();// 当前页码
$data['total'] = $raw->total();//数据总数
$data['data'] = $raw->items();//数据
$data['per_page'] = $raw->perPage();//每页个数
$data['last_page'] = $raw->lastPage();//最后一页
return $data;
}
}
+105
View File
@@ -0,0 +1,105 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $order_inquiry_id 主键id
* @property int $user_id 用户id-患者
* @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_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:退款关闭)
* @property int $inquiry_pay_channel 支付渠道(1:小程序支付 2:微信扫码支付)
* @property int $inquiry_pay_status 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
* @property int $inquiry_no 订单编号
* @property string $escrow_trade_no 第三方支付流水号
* @property string $amount_total 订单金额
* @property string $payment_amount_total 实际付款金额
* @property string $pay_time 支付时间
* @property string $reception_time 接诊时间(已接诊)
* @property string $complete_time 订单完成时间(问诊完成时间)
* @property string $settlement_amount_total 订单与医生结算金额
* @property int $settlement_status 订单与医生结算状态(0:未结算 1:已结算)
* @property string $settlement_time 订单与医生结算时间
* @property int $cancel_reason 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
* @property string $cancel_remarks 取消订单备注(自动添加)
* @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 修改时间
*/
class OrderInquiry extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'order_inquiry';
/**
* 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', 'payment_amount_total', 'pay_time', 'reception_time', 'complete_time', 'settlement_amount_total', 'settlement_status', 'settlement_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['order_inquiry_id' => 'integer', 'user_id' => 'integer', 'patient_id' => 'integer', 'doctor_id' => 'integer', 'family_id' => 'integer', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'inquiry_status' => 'integer', 'is_delete' => 'integer', 'inquiry_refund_status' => 'integer', 'inquiry_pay_channel' => 'integer', 'inquiry_pay_status' => 'integer', 'inquiry_no' => 'integer', 'settlement_status' => 'integer', 'cancel_reason' => 'integer', 'patient_sex' => 'integer', 'patient_age' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "order_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 $data 新增数据
* @return \Hyperf\Database\Model\Model|OrderInquiry
*/
public static function addUserDoctor(array $data): \Hyperf\Database\Model\Model|OrderInquiry
{
return self::create($data);
}
/**
* 获取信息-多条
* @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 $params
* @return int
*/
public static function getCount(array $params): int
{
return self::where($params)->count();
}
}
+116
View File
@@ -0,0 +1,116 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $inquiry_case_id 主键id
* @property int $inquiry_cases_id 主键id
* @property int $user_id 用户id
* @property int $patient_id 患者id
* @property int $order_inquiry_id 订单-问诊id
* @property int $family_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 $height 身高(cm
* @property string $weight 体重(kg
* @property int $disease_class_id 疾病分类id-系统
* @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\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
* @property-read BasicJob $BasicJob
* @property-read BasicNation $BasicNation
* @property-read OrderInquiry $OrderInquiry
*/
class OrderInquiryCase extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'order_inquiry_case';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['inquiry_case_id', 'inquiry_cases_id', 'user_id', 'patient_id', 'order_inquiry_id', 'family_id', 'relation', 'status', 'name', 'sex', 'age', 'height', 'weight', 'disease_class_id', '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'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['inquiry_case_id' => 'integer', 'inquiry_cases_id' => 'integer', 'user_id' => 'integer', 'patient_id' => 'integer', 'order_inquiry_id' => 'integer', 'family_id' => 'integer', 'relation' => 'integer', 'status' => 'integer', 'sex' => 'integer', 'age' => 'integer', 'disease_class_id' => 'integer', 'is_allergy_history' => 'integer', 'is_family_history' => 'integer', 'is_pregnant' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "inquiry_cases_id";
/**
* 关联问诊订单表
*/
public function OrderInquiry(): HasOne
{
return $this->hasOne(OrderInquiry::class, 'order_inquiry_id', 'order_inquiry_id');
}
/**
* 关联民族表
*/
public function BasicNation(): HasOne
{
return $this->hasOne(BasicNation::class, 'nation_id', 'nation_id');
}
/**
* 关联职位表
*/
public function BasicJob(): HasOne
{
return $this->hasOne(BasicJob::class, 'job_id', 'job_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 $order_inquiry_params
* @param array $fields
* @return object|null
*/
public static function getEndOrderInquiryCaseOne(array $params, array $order_inquiry_params, array $fields = ['*']): object|null
{
return self::with([
"OrderInquiry",
])
->whereHas('OrderInquiry' , function($query) use ($order_inquiry_params){
$query->where($order_inquiry_params);
})
->where($params)
->first($fields);
}
}
+86
View File
@@ -0,0 +1,86 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Contract\LengthAwarePaginatorInterface;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $order_prescription_id 主键id
* @property int $order_inquiry_id 订单-问诊id
* @property int $doctor_id 医生id
* @property int $pharmacist_id 药师id
* @property int $icd_id 疾病id
* @property int $prescription_status 处方状态(1:待审核 3:待使用 4:已失效 5:已使用)
* @property int $prescription_audit_status 处方审核状态(0:审核中 1:审核成功 2:审核驳回)
* @property int $is_delete 是否删除(0:否 1:是)
* @property int $is_pass 处方平台是否审核通过(0:否 1:是)
* @property string $prescription 处方编号
* @property string $not_pass_reason 处方平台审核不通过原因
* @property string $audit_fail_reason 审核驳回原因
* @property string $doctor_name 医生名称
* @property string $patient_name 患者姓名-就诊人
* @property int $patient_sex 患者性别-就诊人(1:男 2:女)
* @property int $patient_age 患者年龄-就诊人
* @property string $drugs_info 药品数据
* @property string $prescription_img 处方图片
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class OrderPrescription extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'order_prescription';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['order_prescription_id', 'order_inquiry_id', 'doctor_id', 'pharmacist_id', 'icd_id', 'prescription_status', 'prescription_audit_status', 'is_delete', 'is_pass', 'prescription', 'not_pass_reason', 'audit_fail_reason', 'doctor_name', 'patient_name', 'patient_sex', 'patient_age', 'drugs_info', 'prescription_img', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['order_prescription_id' => 'integer', 'order_inquiry_id' => 'integer', 'doctor_id' => 'integer', 'pharmacist_id' => 'integer', 'icd_id' => 'integer', 'prescription_status' => 'integer', 'prescription_audit_status' => 'integer', 'is_delete' => 'integer', 'is_pass' => 'integer', 'patient_sex' => 'integer', 'patient_age' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "order_prescription_id";
/**
* 获取是否存在
* @param array $params
* @return bool
*/
public static function getExists(array $params): bool
{
return self::where($params)->exists();
}
/**
* 获取待审核处方列表-分页
* @param array $params 条件
* @param array $fields 字段
* @param int|null $page 页码
* @param int|null $per_page 每页个数
* @return array
*/
public static function getPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
{
$raw = self::where($params)->paginate($per_page, $fields, "page", $page);
$data = array();
$data['current_page'] = $raw->currentPage();// 当前页码
$data['total'] = $raw->total();//数据总数
$data['data'] = $raw->items();//数据
$data['per_page'] = $raw->perPage();//每页个数
$data['last_page'] = $raw->lastPage();//最后一页
return $data;
}
}
+106
View File
@@ -0,0 +1,106 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $family_id 主键id
* @property int $patient_id 患者id
* @property int $relation 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )
* @property int $status 状态(1:正常 2:删除)
* @property int $is_default 是否默认(0:否 1:是)
* @property string $card_name 姓名
* @property string $card_name_mask 姓名(掩码)
* @property string $mobile 电话
* @property string $mobile_mask 电话(掩码)
* @property int $type 身份类型(1:身份证 2:护照 3:港澳通行证 4:台胞证)
* @property string $id_number 证件号码
* @property string $id_number_mask 证件号码(掩码)
* @property int $sex 性别(0:未知 1:男 2:女)
* @property int $age 年龄
* @property int $province_id 省份id
* @property string $province 省份
* @property int $city_id 城市id
* @property string $city 城市
* @property int $county_id 区县id
* @property string $county 区县
* @property string $height 身高(cm
* @property string $weight 体重(kg
* @property int $marital_status 婚姻状况(0:未婚 1:已婚 2:离异)
* @property int $nation_id 民族
* @property string $nation_name 民族名称
* @property int $job_id 职业
* @property string $job_name 职业名称
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class PatientFamily extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'patient_family';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['family_id', 'patient_id', 'relation', 'status', 'is_default', 'card_name', 'card_name_mask', 'mobile', 'mobile_mask', 'type', 'id_number', 'id_number_mask', 'sex', 'age', 'province_id', 'province', 'city_id', 'city', 'county_id', 'county', 'height', 'weight', 'marital_status', 'nation_id', 'nation_name', 'job_id', 'job_name', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['family_id' => 'integer', 'patient_id' => 'integer', 'relation' => 'integer', 'status' => 'integer', 'is_default' => 'integer', 'type' => 'integer', 'sex' => 'integer', 'age' => 'integer', 'province_id' => 'integer', 'city_id' => 'integer', 'county_id' => 'integer', 'marital_status' => 'integer', 'nation_id' => 'integer', 'job_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "family_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 Model|PatientFamily
*/
public static function addPatientFamily(array $data = []): Model|PatientFamily
{
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);
}
}
+48
View File
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $patient_follow_id 主键id
* @property int $patient_id 患者id
* @property int $doctor_id 医生id
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class PatientFollow extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'patient_follow';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['patient_follow_id', 'patient_id', 'doctor_id', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['patient_follow_id' => 'integer', 'patient_id' => 'integer', 'doctor_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "patient_follow_id";
/**
* 获取是否存在
* @param array $params
* @return bool
*/
public static function getExists(array $params): bool
{
return self::where($params)->exists();
}
}
+134
View File
@@ -0,0 +1,134 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\BelongsTo;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Database\Model\Relations\HasOneThrough;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $history_inquiry_id 主键id
* @property int $patient_id 患者id
* @property int $doctor_id 医生id
* @property int $pharmacist_id 药师id
* @property int $order_inquiry_id 订单-问诊id
* @property int $history_status 删除状态(0:否 1:是)
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
* @property-read UserDoctor $UserDoctor
* @property-read Hospital $UserDoctorHospital
*/
class PatientHistoryInquiry extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'patient_history_inquiry';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['history_inquiry_id', 'patient_id', 'doctor_id', 'pharmacist_id', 'order_inquiry_id', 'history_status', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['history_inquiry_id' => 'integer', 'patient_id' => 'integer', 'doctor_id' => 'integer', 'pharmacist_id' => 'integer', 'order_inquiry_id' => 'integer', 'history_status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "history_inquiry_id";
/**
* 关联医生表
*/
public function UserDoctor(): HasOne
{
return $this->hasOne(UserDoctor::class, 'doctor_id','doctor_id');
}
/**
* 远程关联医生表-医院表
* @return HasOneThrough
*/
public function UserDoctorHospital(): HasOneThrough
{
return $this->hasOneThrough(
Hospital::class,
UserDoctor::class,
"doctor_id",
"hospital_id",
"doctor_id",
"hospital_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 $params
* @param array $fields
* @param int $limit
*/
public static function getLimit(array $params, array $fields = ['*'],int $limit = 5): array
{
return self::where($params)->limit($limit)->get($fields)->toArray();
}
/**
* 获取首页用户历史问诊数据
* 关联表:user_doctor
* @param array $params
* @param array $fields
* @param int $limit
* @return Collection|array|\Hyperf\Utils\Collection
*/
public static function getIndexHistoryDoctorLimit(array $params, array $fields = ["*"],int $limit = 5): Collection|array|\Hyperf\Utils\Collection
{
return self::with([
"UserDoctor:doctor_id,user_name,avatar,hospital_id",
"UserDoctor.Hospital:hospital_id,hospital_name"
])
->where($params)
->limit($limit)
->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);
}
}
+61
View File
@@ -0,0 +1,61 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $audit_statistics_id 主键id
* @property int $pharmacist_id 药师id
* @property string $statistics_date 统计日期
* @property int $audit_number 审核数量
* @property int $not_pass_number 审核不通过数量
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class PharmacistAuditStatistic extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'pharmacist_audit_statistics';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['audit_statistics_id', 'pharmacist_id', 'statistics_date', 'audit_number', 'not_pass_number', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['audit_statistics_id' => 'integer', 'pharmacist_id' => 'integer', 'audit_number' => 'integer', 'not_pass_number' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "audit_statistics_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
* @return int
*/
public static function getCount(array $params): int
{
return self::where($params)->count();
}
}
+89
View File
@@ -0,0 +1,89 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $product_id 主键id
* @property int $product_platform_id 处方平台商品id
* @property string $product_name 商品名称
* @property string $common_name 商品通用名
* @property string $product_price 商品价格
* @property string $mnemonic_code 商品助记码(首字母简拼)
* @property int $product_type 药品类型(0:未知 1:中成药 2:西药)
* @property string $product_platform_code 处方平台商品编码
* @property string $product_pharmacy_code 第三方药店商品编码
* @property string $product_cover_img 商品封面图
* @property string $product_spec 商品规格
* @property string $license_number 批准文号
* @property string $manufacturer 生产厂家
* @property string $single_unit 单次剂量(例:1次1包)
* @property string $single_use 单次用法(例:口服)
* @property string $packaging_unit 基本包装单位(例:盒/瓶)
* @property string $frequency_use 使用频率(例:1天3次)
* @property string $available_days 可用天数(3)
* @property string $product_remarks 商品备注
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class Product extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'product';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['product_id', 'product_platform_id', 'product_name', 'common_name', 'product_price', 'mnemonic_code', 'product_type', 'product_platform_code', 'product_pharmacy_code', 'product_cover_img', 'product_spec', 'license_number', 'manufacturer', 'single_unit', 'single_use', 'packaging_unit', 'frequency_use', 'available_days', 'product_remarks', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['product_id' => 'integer', 'product_platform_id' => 'integer', 'product_type' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "product_id";
/**
* 关联库存表
*/
public function ProductPlatformAmount(): HasOne
{
return $this->hasOne(ProductPlatformAmount::class, 'product_platform_id','product_platform_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 getWithAmountOne(array $params, array $fields = ['*']): object|null
{
return self::with([
'ProductPlatformAmount'
])
->where($params)
->first($fields);
}
}
+41
View File
@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $amount_id 主键id
* @property int $product_platform_id 商品id
* @property string $product_platform_code 处方平台商品编码
* @property int $real_stock 实际库存
* @property int $stock 现有库存
* @property int $lock_stock 锁定库存
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class ProductPlatformAmount extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'product_platform_amount';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['amount_id', 'product_platform_id', 'product_platform_code', 'real_stock', 'stock', 'lock_stock', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['amount_id' => 'integer', 'product_platform_id' => 'integer', 'real_stock' => 'integer', 'stock' => 'integer', 'lock_stock' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "amount_id";
}
+67
View File
@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $system_inquiry_config_id 主键id
* @property int $inquiry_type 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
* @property int $max_work_num_day 每日最大接诊数量(为0表示不限制接诊数量)
* @property string $inquiry_price 接诊价格(存在多档次,逗号分隔)
* @property string $min_inquiry_price 最低接诊价格(专家问诊)
* @property string $max_inquiry_price 最高接诊价格(专家问诊)
* @property int $times_number 沟通次数(0为不限制次数)
* @property int $duration 沟通时长(分钟,0为不限制时长)
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class SystemInquiryConfig extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'system_inquiry_config';
/**
* 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'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['system_inquiry_config_id' => 'integer', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'max_work_num_day' => 'integer', 'times_number' => 'integer', 'duration' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "system_inquiry_config_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);
}
}
+77
View File
@@ -0,0 +1,77 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $id id
* @property string $uuid 唯一uuid
* @property string $name 医院名称
* @property int $prov_id 省份id
* @property string $prov_name 省份名称
* @property int $city_id 城市id
* @property string $city_name 城市名称
* @property int $county_id 区县id
* @property string $county_name 区县名称
* @property string $road 街道
* @property string $address 详细地址
* @property string $postcode 邮政编码
* @property string $lat 纬度
* @property string $lng 纬度
* @property string $info 简介
* @property string $legal_person 法人
* @property string $office_phone 电话
* @property int $level 等级(0未知 1三级甲等 2三级医院 3二级医院 4其他)
* @property string $create_date 创建日期
*/
class TbHospitalMy extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'tb_hospital_my';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['id', 'uuid', 'name', 'prov_id', 'prov_name', 'city_id', 'city_name', 'county_id', 'county_name', 'road', 'address', 'postcode', 'lat', 'lng', 'info', 'legal_person', 'office_phone', 'level', 'create_date'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'prov_id' => 'integer', 'city_id' => 'integer', 'county_id' => 'integer', 'level' => 'integer'];
protected string $primaryKey = "id";
/**
* 获取信息-多条
* @param array $params
* @param array $fields
* @param string $order
* @param string $direction
* @return object|null
*/
public static function getList(array $params = [], array $fields = ['*']): object|null
{
return self::where($params)->get($fields);
}
/**
* 获取信息-单条
* @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);
}
}
+82
View File
@@ -0,0 +1,82 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $user_id 主键
* @property string $user_name 用户名称
* @property string $user_account 账号
* @property string $mobile 手机号
* @property string $wx_mobile 微信手机号
* @property string $user_password 密码
* @property string $salt 密码混淆码
* @property int $user_type 用户类型(1:患者 2:医师 3:药师)
* @property int $user_status 状态(0:禁用 1:正常 2:删除)
* @property int $register_method 注册方式(1:微信小程序 )
* @property string $login_ip 登陆ip
* @property string $last_login_at 最后登陆时间
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class User extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'user';
/**
* 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', 'login_ip', 'last_login_at', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['user_id' => 'integer', 'user_type' => 'integer', 'user_status' => 'integer', 'register_method' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "user_id";
/**
* 获取用户信息-单条
* @param array $params
* @param array $fields
* @return object|null
*/
public static function getOne(array $params, array $fields = ['*']): object|null
{
$result = self::where($params)->first($fields);
unset($result->user_password);
unset($result->salt);
return $result;
}
/**
* 新增用户-批量
* @param array $data 新增数据
* @return User|\Hyperf\Database\Model\Model
*/
public static function addUser(array $data): User|\Hyperf\Database\Model\Model
{
return self::create($data);
}
/**
* 修改用户-批量
* @param array $params
* @param array $data
* @return int
*/
public static function editUser(array $params = [], array $data = []) : int
{
return self::where($params)->update($data);
}
}
+91
View File
@@ -0,0 +1,91 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $user_coupon_id 主键id
* @property int $user_id 用户id
* @property int $patient_id 患者id
* @property int $coupon_id 优惠卷id
* @property int $user_coupon_status 状态(0:未使用 1:已使用 3:已过期)
* @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-read Coupon $Coupon
*/
class UserCoupon extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'user_coupon';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['user_coupon_id', 'user_id', 'patient_id', 'coupon_id', 'user_coupon_status', 'coupon_use_date', 'valid_start_time', 'valid_end_time', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['user_coupon_id' => 'integer', 'user_id' => 'integer', 'patient_id' => 'integer', 'coupon_id' => 'integer', 'user_coupon_status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "user_coupon_id";
/**
* 关联医院表
*/
public function Coupon(): HasOne
{
return $this->hasOne(Coupon::class, 'coupon_id', '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 $coupon_params
* @param array $fields
* @return Collection|array
*/
public static function getWithCouponList(array $params,array $coupon_params, array $fields = ['*']): Collection|array
{
return self::with(['Coupon'])
->whereHas('Coupon' , function($query) use ($coupon_params){
$query->where($coupon_params);
})
->where($params)->get($fields);
}
/**
* 新增用户优惠卷
* @param array $data
* @return \Hyperf\Database\Model\Model|UserCoupon
*/
public static function addUserCoupon(array $data): \Hyperf\Database\Model\Model|UserCoupon
{
return self::create($data);
}
}
+282
View File
@@ -0,0 +1,282 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\BelongsTo;
use Hyperf\Database\Model\Relations\HasMany;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Database\Model\Relations\HasOneThrough;
use Hyperf\DbConnection\Db;
use Hyperf\Snowflake\Concern\Snowflake;
use Hyperf\Utils\Arr;
/**
* @property int $doctor_id 主键
* @property int $user_id 用户id
* @property string $user_name 用户名称
* @property string $open_id 微信open_id
* @property string $union_id 微信开放平台唯一标识
* @property string $wx_session_key 微信会话密钥
* @property int $status 状态(0:禁用 1:正常 2:删除)
* @property int $idcard_status 实名认证状态(0:未认证 1:认证通过 2:认证失败)
* @property int $iden_auth_status 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
* @property string $iden_auth_fail_reason 身份认证失败原因
* @property int $multi_point_status 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
* @property string $multi_point_fail_reason 多点执业认证失败原因
* @property int $is_bind_bank 是否已绑定结算银行卡(0:否 1:是)
* @property int $is_recommend 是否首页推荐(0:否 1:是)
* @property string $mobile 电话
* @property int $sex 性别(0:未知 1:男 2:女)
* @property int $age 年龄
* @property string $avatar 头像
* @property int $doctor_title 医生职称(1:执业医师 2:主治医师 3:副主任医师 4:主任医师)
* @property int $department_custom_id 科室id-自定义
* @property string $department_custom_name 科室名称(如未自己输入,填入标准科室名称)
* @property string $department_custom_mobile 科室电话
* @property int $hospital_id 所属医院id
* @property int $served_patients_num 服务患者数量
* @property string $praise_rate 好评率(百分制。订单平均评价中超过4-5分的订单总数 / 总订单数 * 5)
* @property string $avg_response_time 平均响应时间(分钟制)
* @property int $number_of_fans 被关注数量
* @property int $is_online 是否在线(0:不在线 1:在线)
* @property int $is_img_expert_reception 是否参加专家图文接诊(0:否 1:是)
* @property int $is_img_welfare_reception 是否参加公益图文问诊(0:否 1:是)
* @property int $is_img_quick_reception 是否参加快速图文接诊(0:否 1:是)
* @property int $is_platform_deep_cooperation 是否平台深度合作医生(0:否 1:是)
* @property int $is_enterprise_deep_cooperation 是否企业深度合作医生(0:否 1:是)
* @property string $be_good_at 擅长
* @property string $brief_introduction 医生简介
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
* @property-read \Hyperf\Database\Model\Collection|DoctorExpertise[] $DoctorExpertise
* @property-read \Hyperf\Database\Model\Collection|DoctorInquiryConfig[] $DoctorInquiryConfig
* @property-read Hospital $Hospital
* @property-read \Hyperf\Database\Model\Collection|OrderInquiry[] $OrderInquiry
*/
class UserDoctor extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'user_doctor';
/**
* 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_fail_reason', 'multi_point_status', 'multi_point_fail_reason', 'is_bind_bank', 'is_recommend', 'mobile', 'sex', 'age', '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_online', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['doctor_id' => 'integer', 'user_id' => 'integer', 'status' => 'integer', 'idcard_status' => 'integer', 'iden_auth_status' => 'integer', 'multi_point_status' => 'integer', 'is_bind_bank' => 'integer', 'is_recommend' => 'integer', 'sex' => 'integer', 'age' => 'integer', 'doctor_title' => 'integer', 'department_custom_id' => 'integer', 'hospital_id' => 'integer', 'served_patients_num' => 'integer', 'number_of_fans' => 'integer', 'is_online' => 'integer', 'is_img_expert_reception' => 'integer', 'is_img_welfare_reception' => 'integer', 'is_img_quick_reception' => 'integer', 'is_platform_deep_cooperation' => 'integer', 'is_enterprise_deep_cooperation' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "doctor_id";
/**
* 关联医院表
*/
public function Hospital(): HasOne
{
return $this->hasOne(Hospital::class, 'hospital_id', 'hospital_id');
}
/**
* 关联问诊配置表(一对多)
* @return HasMany
*/
public function DoctorInquiryConfig(): HasMany
{
return $this->hasMany(DoctorInquiryConfig::class, "doctor_id", "doctor_id");
}
/**
* 关联医生专长表
* @return HasMany
*/
public function DoctorExpertise(): HasMany
{
return $this->hasMany(DoctorExpertise::class, "doctor_id", "doctor_id");
}
/**
* 关联订单-问诊表表
* @return HasMany
*/
public function OrderInquiry(): HasMany
{
return $this->hasMany(OrderInquiry::class, "doctor_id", "doctor_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 $data 新增数据
* @return \Hyperf\Database\Model\Model|UserDoctor
*/
public static function addUserDoctor(array $data): \Hyperf\Database\Model\Model|UserDoctor
{
return self::create($data);
}
/**
* 修改医生-批量
* @param array $params
* @param array $data
* @return int
*/
public static function editUserDoctor(array $params = [], array $data = []): int
{
return self::where($params)->update($data);
}
/**
* 首页推荐医生
* 推荐规则:
* 1:平台深度合作医生
* 2:接诊量由高到低的医生
* 3:好评率由高到低的医生
* 5:在线
* 65个
* @param int $limit 数量
* @param array $fields
* @return array|Collection|\Hyperf\Utils\Collection
*/
public static function getIndexRecommendDoctorLimit(int $limit = 5, array $fields = ['*']): array|Collection|\Hyperf\Utils\Collection
{
$params = array();
// 状态(0:禁用 1:正常 2:删除)
$params["status"] = 1;
// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
$params["iden_auth_status"] = 1;
// 是否在线(0:不在线 1:在线)
$params["is_online"] = 1;
// 是否参加专家图文接诊(0:否 1:是)
$params["is_img_expert_reception"] = 1;
$datas = self::with([
'Hospital:hospital_id,hospital_name,hospital_level_name',
'DoctorInquiryConfig',
'DoctorInquiryConfig.SystemInquiryConfig'
])
->where($params)
->orderBy("is_platform_deep_cooperation", "desc")
->orderBy("served_patients_num", "desc")
->orderBy("praise_rate", "desc")
->limit($limit)
->get($fields);
return $datas;
}
/**
* 获取问诊医生列表
* 专家问诊-公益问诊共用
* @param array $hospital_params 医院搜索条件
* @param array $doctor_params 医生搜索条件
* @param array $doctor_or_params 医生搜索条件
* @param array $doctor_expertise_params
* @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 = [],string|int $sort_order = 1,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
{
$result = self::with([
"Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id",
"DoctorExpertise" => function($query) use($doctor_expertise_params){
$query->where($doctor_expertise_params);
},
"DoctorExpertise.DiseaseClassExpertise:expertise_id,expertise_name",
"DoctorInquiryConfig" => function($query) use($sort_order){
$params = array();
$params['inquiry_mode'] = 1;// 接诊方式:图文
$query->where($params)->whereIn('inquiry_type',[1,3]);
if ($sort_order == 1){
// 综合
$query->orderBy('inquiry_price','asc');// 价格从低到高
}elseif ($sort_order == 3){
// 价格从低到高
$query->orderBy('inquiry_price','asc');
}elseif ($sort_order == 4){
// 价格从高到低
$query->orderBy('inquiry_price','desc');// 价格从高到低
}
return $query;
},
'DoctorInquiryConfig.SystemInquiryConfig',
])
->where($doctor_params)
->when($keyword,function ($query, $keyword){
$query->where(function($query) use ($keyword){
$query->orwhere("user_name",'like','%' . $keyword . '%');
$query->orwhere("hospital_name",'like','%' . $keyword . '%');
$query->orwhere("department_custom_name",'like','%' . $keyword . '%');
});
})
->when($sort_order,function ($query,$sort_order){
if ($sort_order == 1){
$query->orderBy('is_recommend','desc');// 是否首页推荐(0:否 1:是)
$query->orderBy('avg_response_time','desc');// 响应时间快
$query->orderBy('served_patients_num','desc');// 服务数从多到少
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"),'asc');// 名称排名
}elseif ($sort_order == 2){
// 响应时间快
$query->orderBy('avg_response_time','desc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"),'asc');// 名称排名
}elseif ($sort_order == 3){
// 响应时间快
$query->orderBy('avg_response_time','desc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"),'asc');// 名称排名
}elseif ($sort_order == 4){
// 响应时间快
$query->orderBy('avg_response_time','desc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"),'asc');// 名称排名
}elseif ($sort_order == 5){
// 服务数从多到少
$query->orderBy('served_patients_num','desc');
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"),'asc');// 名称排名
}
return $query;
})
->whereExists(function ($query) use($hospital_params){
$query->select(Db::raw(1))
->from('hospital')
->whereColumn('hospital.hospital_id','user_doctor.hospital_id')
->where($hospital_params);
})
->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;
}
}
+80
View File
@@ -0,0 +1,80 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $doctor_info_id 主键
* @property int $doctor_id 医生id
* @property int $card_type 类型(1:身份证 2:护照 3:港澳通行证 4:台胞证)
* @property string $card_name 证件姓名
* @property string $card_name_mask 证件姓名(掩码)
* @property string $card_num 证件号码
* @property string $card_num_mask 证件号码(掩码)
* @property string $license_cert 医师执业证(逗号分隔)
* @property string $qualification_cert 医师资格证(逗号分隔)
* @property string $qualification_cert_num 医师资格证号(逗号分隔)
* @property string $work_cert 医师工作证(逗号分隔)
* @property string $multi_point_images 多点执业备案信息(逗号分隔)
* @property string $sign_image 签名图片
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class UserDoctorInfo extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'user_doctor_info';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['doctor_info_id', 'doctor_id', 'card_type', 'card_name', 'card_name_mask', 'card_num', 'card_num_mask', 'license_cert', 'qualification_cert', 'qualification_cert_num', 'work_cert', 'multi_point_images', 'sign_image', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['doctor_info_id' => 'integer', 'doctor_id' => 'integer', 'card_type' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "doctor_info_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 $data 新增数据
* @return \Hyperf\Database\Model\Model|UserDoctorInfo
*/
public static function addUserDoctorInfo(array $data): \Hyperf\Database\Model\Model|UserDoctorInfo
{
return self::create($data);
}
/**
* 修改医生详情
* @param array $params
* @param array $data
* @return int
*/
public static function editUserDoctorInfo(array $params = [], array $data = []): int
{
return self::where($params)->update($data);
}
}
+79
View File
@@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $patient_id 主键id
* @property int $user_id 用户id
* @property string $user_name 用户名称
* @property string $open_id 微信open_id
* @property string $union_id 微信开放平台唯一标识
* @property string $wx_session_key 微信会话密钥
* @property int $status 状态(0:禁用 1:正常 2:删除)
* @property int $idcard_status 实名认证状态(0:未认证 1:认证通过 2:认证失败)
* @property string $mobile 手机号
* @property int $sex 性别(0:未知 1:男 2:女)
* @property int $age 年龄
* @property string $avatar 头像
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class UserPatient extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'user_patient';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['patient_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'mobile', 'sex', 'age', 'avatar', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['patient_id' => 'integer', 'user_id' => 'integer', 'status' => 'integer', 'idcard_status' => 'integer', 'sex' => 'integer', 'age' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "patient_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 $data 新增数据
* @return UserPatient|\Hyperf\Database\Model\Model
*/
public static function addUserPatient(array $data): UserPatient|\Hyperf\Database\Model\Model
{
return self::create($data);
}
/**
* 修改患者-批量
* @param array $params
* @param array $data
* @return int
*/
public static function editUserPatient(array $params = [], array $data = []) : int
{
return self::where($params)->update($data);
}
}
+69
View File
@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $pharmacist_id 主键id
* @property int $user_id 用户id
* @property string $user_name 用户名称
* @property string $open_id 微信open_id
* @property string $union_id 微信开放平台唯一标识
* @property string $wx_session_key 微信会话密钥
* @property int $status 状态(0:禁用 1:正常 2:删除)
* @property string $mobile 电话
* @property int $sex 性别(0:未知 1:男 2:女)
* @property int $age 年龄
* @property string $avatar 头像
* @property int $is_online 是否在线(0:不在线 1:在线)
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class UserPharmacist extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'user_pharmacist';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['pharmacist_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'mobile', 'sex', 'age', 'avatar', 'is_online', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['pharmacist_id' => 'integer', 'user_id' => 'integer', 'status' => 'integer', 'sex' => 'integer', 'age' => 'integer', 'is_online' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "pharmacist_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 $data
* @return int
*/
public static function editUserPharmacist(array $params = [], array $data = []) : int
{
return self::where($params)->update($data);
}
}