合并dev
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
|
||||
/**
|
||||
* @property int $company_id 主键id
|
||||
* @property string $company_name 公司名称
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class BasicCompany extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'basic_company';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['company_id', 'company_name', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "company_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|BasicCompany
|
||||
*/
|
||||
public static function addBasicCompany(array $data): \Hyperf\Database\Model\Model|BasicCompany
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改-批量
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function editBasicCompany(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $detection_organ_id 主键id
|
||||
* @property int $company_id 合作公司id
|
||||
* @property string $detection_organ_name 检测机构名称
|
||||
* @property string $app_id key
|
||||
* @property string $app_secret 秘钥
|
||||
* @property int $status 状态(1:正常 2:删除)
|
||||
* @property string $request_dev_url 测试请求地址
|
||||
* @property string $request_prod_url 正式请求地址
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class BasicDetectionOrgan extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'basic_detection_organ';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['detection_organ_id', 'company_id', 'detection_organ_name', 'app_id', 'app_secret', 'status', 'request_dev_url', 'request_prod_url', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "detection_organ_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|BasicDetectionOrgan
|
||||
*/
|
||||
public static function add(array $data): \Hyperf\Database\Model\Model|BasicDetectionOrgan
|
||||
{
|
||||
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,82 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $detection_project_id 主键id
|
||||
* @property string $detection_project_title 检测项目标题
|
||||
* @property string $detection_project_name 检测项目名称
|
||||
* @property int $company_id 合作公司id
|
||||
* @property string $detection_project_price 检测价格
|
||||
* @property int $detection_time 检测时间(小时)
|
||||
* @property string $img_path 内容图片地址
|
||||
* @property string $informed_consent_form 知情同意书
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DetectionProject extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'detection_project';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['detection_project_id', 'detection_project_title', 'detection_project_name', 'company_id', 'detection_project_price', 'detection_time', 'img_path', 'informed_consent_form', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "detection_project_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|DetectionProject
|
||||
*/
|
||||
public static function addBasicCompany(array $data): \Hyperf\Database\Model\Model|DetectionProject
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改-批量
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function editBasicCompany(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $purpose_id 主键id
|
||||
* @property int $detection_project_id 检测项目id
|
||||
* @property string $purpose_name 用途名称
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DetectionProjectPurpose extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'detection_project_purpose';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['purpose_id', 'detection_project_id', 'purpose_name', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "purpose_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|DetectionProjectPurpose
|
||||
*/
|
||||
public static function addDetectionProjectPurpose(array $data): \Hyperf\Database\Model\Model|DetectionProjectPurpose
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改-批量
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function editDetectionProjectPurpose(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $id 主键id
|
||||
* @property int $detection_project_id 检测项目id
|
||||
* @property string $name 疾病分类名称
|
||||
* @property int $status 状态(1:正常 2:删除)
|
||||
* @property int $enable 是否启用(1:是 2:否)
|
||||
* @property int $sort 排序值(越小排序越往前)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DiseaseClassDetection extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'disease_class_detection';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['id', 'detection_project_id', 'name', 'status', 'enable', 'sort', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "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|DiseaseClassDetection
|
||||
*/
|
||||
public static function addDiseaseClassDetection(array $data): \Hyperf\Database\Model\Model|DiseaseClassDetection
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改-批量
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function editDiseaseClassDetection(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $doctor_id 医生id
|
||||
* @property int $inquiry_type 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
* @property int $is_enable 是否启用(0:否 1:是)
|
||||
* @property int $last_enable_method 最后开启方式(1:自己 2:后台)
|
||||
* @property int $work_num_day 每日接诊数量
|
||||
* @property string $inquiry_price 接诊价格(专家问诊-公益问诊)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
@@ -31,12 +33,12 @@ class DoctorInquiryConfig extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['inquiry_config_id', 'doctor_id', 'inquiry_type', 'inquiry_mode', 'work_num_day', 'inquiry_price', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['inquiry_config_id', 'doctor_id', 'inquiry_type', 'inquiry_mode', 'is_enable', 'last_enable_method', 'work_num_day', 'inquiry_price', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['inquiry_config_id' => 'string', 'doctor_id' => 'string', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'work_num_day' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
protected array $casts = ['inquiry_config_id' => 'string', 'doctor_id' => 'string', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'work_num_day' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'is_enable' => 'integer', 'last_enable_method' => 'integer'];
|
||||
|
||||
protected string $primaryKey = "inquiry_config_id";
|
||||
|
||||
@@ -52,14 +54,14 @@ class DoctorInquiryConfig extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生接诊配置信息-单条
|
||||
* 获取医生接诊配置信息
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getInquiryConfigOne(array $params, array $fields = ['*']): object|null
|
||||
public static function getInquiryConfigList(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->first($fields);
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +72,7 @@ class DoctorInquiryConfig extends Model
|
||||
* @param array $inquiry_type_in_params
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getInquiryConfigList(array $params, array $fields = ['*'] , array $inquiry_type_in_params = [1,3]): object|null
|
||||
public static function getInquiryConfigListByInquiryType(array $params, array $fields = ['*'] , array $inquiry_type_in_params = [1,3]): object|null
|
||||
{
|
||||
return self::where($params)->whereIn("inquiry_type",$inquiry_type_in_params)->get($fields);
|
||||
}
|
||||
|
||||
@@ -6,11 +6,10 @@ namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Model;
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
/**
|
||||
* @property int $inquiry_time_id 主键id
|
||||
@@ -114,4 +113,30 @@ class DoctorInquiryTime extends Model
|
||||
->get($fields);
|
||||
}
|
||||
|
||||
public static function add(array $data): \Hyperf\Database\Model\Model|DoctorInquiryTime
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取坐班时间包含某时间的平台深度合作医生
|
||||
* @param array $params
|
||||
* @param array $user_doctor_params
|
||||
* @param array $user_doctor_not_in_params
|
||||
* @param array $doctor_inquiry_config_params
|
||||
* @param array $fields
|
||||
* @return array|\Hyperf\Collection\Collection|Collection
|
||||
*/
|
||||
public static function getMinPlatDeepCooperationDoctor(array $params = [],array $user_doctor_params = [], array $user_doctor_not_in_params = [],array $doctor_inquiry_config_params = [], array $fields = ['*']): Collection|array|\Hyperf\Collection\Collection
|
||||
{
|
||||
$doctor_ids = Db::table('doctor_inquiry_config')->where($doctor_inquiry_config_params)->select("doctor_id");
|
||||
|
||||
$result = self::whereHas('UserDoctor' , function($query) use ($user_doctor_params,$user_doctor_not_in_params){
|
||||
$query->where($user_doctor_params)->whereNotIn('doctor_id',$user_doctor_not_in_params);
|
||||
})
|
||||
->where($params)
|
||||
->whereIn("doctor_id",$doctor_ids)
|
||||
->get($fields);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $order_detection_id 主键id
|
||||
* @property int $user_id 用户id-患者
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $family_id 家庭成员id(就诊用户)
|
||||
* @property int $detection_project_id 检测项目id
|
||||
* @property int $purpose_id 检测项目用途id
|
||||
* @property int $detection_organ_id 检测机构id
|
||||
* @property int $order_inquiry_id 问诊-订单id(检测完成后,会生成此字段)
|
||||
* @property int $detection_status 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消)
|
||||
* @property int $is_delete 删除状态(0:否 1:是)
|
||||
* @property int $detection_refund_status 检测订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
||||
* @property int $detection_pay_channel 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||||
* @property int $detection_pay_status 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
* @property string $detection_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 $cancel_time 订单取消时间
|
||||
* @property int $cancel_reason 取消订单原因(1:主动取消 2:客服取消 3:支付超时)
|
||||
* @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 string $detection_bar_code 检测条码
|
||||
* @property string $detection_pic 检测管图片(逗号分隔)
|
||||
* @property string $detection_time 上传检测时间
|
||||
* @property string $detection_result_pdf 检测结果
|
||||
* @property string $detection_result_date 检测结果时间
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderDetection extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_detection';
|
||||
|
||||
/**
|
||||
* 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 string $primaryKey = "order_detection_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 getLastOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->latest()->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|OrderDetection
|
||||
*/
|
||||
public static function addOrderDetection(array $data): \Hyperf\Database\Model\Model|OrderDetection
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改-批量
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function editOrderDetection(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取未完成订单
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getNotFinishedOrderDetectionOne(array $params,array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->whereIn('detection_status',[1,2,3])->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取问诊订单分页
|
||||
* 已结束
|
||||
* @param array $params
|
||||
* @param array $detection_status_params
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return array
|
||||
*/
|
||||
public static function getPatientOrderDetectionPage(array $params, array $detection_status_params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$raw = self::where($params)
|
||||
->when($detection_status_params, function ($query, $detection_status_params) {
|
||||
$query->whereIn('detection_status', $detection_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
|
||||
* @return int
|
||||
*/
|
||||
public static function getCount(array $params): int
|
||||
{
|
||||
return self::where($params)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $detection_case_id 主键id
|
||||
* @property int $order_detection_id 订单-检测id
|
||||
* @property int $family_id 家庭成员id
|
||||
* @property int $doctor_id 医生id(检测医生)
|
||||
* @property int $relation 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )
|
||||
* @property string $name 患者名称
|
||||
* @property int $sex 患者性别(0:未知 1:男 2:女)
|
||||
* @property int $age 患者年龄
|
||||
* @property int $nation_id 民族
|
||||
* @property string $nation_name 民族名称
|
||||
* @property string $detection_disease_class_ids 疾病id-检测-逗号分隔
|
||||
* @property string $detection_disease_class_names 疾病名称-检测-逗号分隔
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderDetectionCase extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_detection_case';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['detection_case_id', 'order_detection_id', 'family_id', 'doctor_id', 'relation', 'name', 'sex', 'age', 'nation_id', 'nation_name', 'detection_disease_class_ids', 'detection_disease_class_names', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "detection_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 \Hyperf\Database\Model\Model|OrderDetectionCase
|
||||
*/
|
||||
public static function addOrderDetectionCase(array $data): \Hyperf\Database\Model\Model|OrderDetectionCase
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改-批量
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function editOrderDetectionCase(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $detection_refund_id 主键id
|
||||
* @property int $order_detection_id 订单-检测id
|
||||
* @property int $patient_id 患者id
|
||||
* @property string $detection_no 系统订单编号
|
||||
* @property string $detection_refund_no 系统退款编号
|
||||
* @property string $refund_id 第三方退款单号
|
||||
* @property int $detection_refund_status 检测订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
||||
* @property string $refund_total 退款金额
|
||||
* @property string $refund_reason 退款原因
|
||||
* @property string $success_time 退款成功时间
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderDetectionRefund extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_detection_refund';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['detection_refund_id', 'order_detection_id', 'patient_id', 'detection_no', 'detection_refund_no', 'refund_id', 'detection_refund_status', 'refund_total', 'refund_reason', 'success_time', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "detection_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 \Hyperf\Database\Model\Model|OrderDetectionRefund
|
||||
*/
|
||||
public static function add(array $data): \Hyperf\Database\Model\Model|OrderDetectionRefund
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace App\Model;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\Database\Query\Builder;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
@@ -434,4 +435,102 @@ class OrderInquiry extends Model
|
||||
->limit($limit)
|
||||
->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取问诊结束会话列表-分页
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return array
|
||||
*/
|
||||
public static function getInquiryEndPage(array $params, int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
// 参考sql
|
||||
// SELECT t1.* FROM test t1 INNER JOIN (
|
||||
// SELECT user_id, MAX(create_at) AS max_create_at FROM test GROUP BY user_id
|
||||
// ) t2 ON t1.user_id = t2.user_id AND t1.create_at = t2.max_create_at;
|
||||
$subQuery = self::select(["user_id","family_id",Db::raw('max(reception_time) as at')])
|
||||
->whereNotIn('user_id', function ($query) use ($params){
|
||||
$query->select('user_id')
|
||||
->from('order_inquiry')
|
||||
->whereIn('inquiry_status', [1,2,3,4])
|
||||
->where($params)
|
||||
->groupBy(["user_id"]);
|
||||
})
|
||||
->where($params)
|
||||
->groupBy(["user_id","family_id"]);
|
||||
|
||||
|
||||
$query = self:: joinSub($subQuery, 'sub_query', function($join) {
|
||||
$join->on('order_inquiry.user_id', '=', 'sub_query.user_id')
|
||||
->on('order_inquiry.family_id', '=', 'sub_query.family_id')
|
||||
->on('order_inquiry.reception_time', '=', 'sub_query.at');
|
||||
})
|
||||
->whereIn('inquiry_status', [5,6])
|
||||
->where($params)
|
||||
->orderBy("sub_query.at",'desc');
|
||||
|
||||
|
||||
$fields = [
|
||||
'order_inquiry.order_inquiry_id',
|
||||
'order_inquiry.user_id',
|
||||
'order_inquiry.patient_id',
|
||||
'order_inquiry.doctor_id',
|
||||
'order_inquiry.family_id',
|
||||
'order_inquiry.inquiry_type',
|
||||
'order_inquiry.inquiry_mode',
|
||||
'order_inquiry.inquiry_status',
|
||||
'order_inquiry.inquiry_no',
|
||||
'order_inquiry.reception_time',
|
||||
'order_inquiry.complete_time',
|
||||
'order_inquiry.finish_time',
|
||||
'order_inquiry.cancel_time',
|
||||
'order_inquiry.cancel_reason',
|
||||
'order_inquiry.cancel_remarks',
|
||||
'order_inquiry.patient_name',
|
||||
'order_inquiry.patient_sex',
|
||||
'order_inquiry.patient_age',
|
||||
'order_inquiry.created_at',
|
||||
];
|
||||
|
||||
$result = $query->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 $inquiry_status_params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getInquiryStatusLastOne(array $params, array $inquiry_status_params,array $fields = ["*"]): object|null
|
||||
{
|
||||
return self::where($params)
|
||||
->whereIn("inquiry_status", $inquiry_status_params)
|
||||
->latest()
|
||||
->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最后一条订单
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getInquiryLastOne(array $params,array $fields = ["*"]): object|null
|
||||
{
|
||||
return self::where($params)
|
||||
->latest()
|
||||
->first($fields);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,12 +32,14 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $family_history 家族病史描述
|
||||
* @property int $is_pregnant 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
* @property string $pregnant 备孕、妊娠、哺乳期描述
|
||||
* @property int $is_taboo 是否存在禁忌药物(0:否 1:是)问诊购药时存在
|
||||
* @property int $is_taboo 是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在
|
||||
* @property int $nation_id 民族
|
||||
* @property string $nation_name 民族名称
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property-read BasicJob $BasicJob
|
||||
* @property-read BasicNation $BasicNation
|
||||
* @property-read OrderInquiry $OrderInquiry
|
||||
* @property-read BasicJob|null $BasicJob
|
||||
* @property-read BasicNation|null $BasicNation
|
||||
* @property-read OrderInquiry|null $OrderInquiry
|
||||
*/
|
||||
class OrderInquiryCase extends Model
|
||||
{
|
||||
@@ -51,7 +53,7 @@ class OrderInquiryCase extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['inquiry_case_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', 'is_taboo', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['inquiry_case_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', 'is_taboo', 'nation_id', 'nation_name', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "inquiry_case_id";
|
||||
|
||||
@@ -119,4 +121,15 @@ class OrderInquiryCase 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,82 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $system_id 主键id
|
||||
* @property string $system_name 配置名称
|
||||
* @property string $system_remarks 配置备注
|
||||
* @property int $system_status 配置状态(1:开启 2:关闭)
|
||||
* @property string $system_permission 事件标识
|
||||
* @property int $is_sms 是否需要短信通知(0:否 1:是)
|
||||
* @property string $sms_mobile 短信通知手机号
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderSystem extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_system';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['system_id', 'system_name', 'system_remarks', 'system_status', 'system_permission', 'is_sms', 'sms_mobile', 'created_at', 'updated_at'];
|
||||
|
||||
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 \Hyperf\Database\Model\Model|OrderSystem
|
||||
*/
|
||||
public static function addOrderSystem(array $data = []): \Hyperf\Database\Model\Model|OrderSystem
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -159,6 +159,39 @@ class Product extends Model
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表-分页
|
||||
* @param array $params 条件
|
||||
* @param string $keyword 搜索条件
|
||||
* @param array $fields 字段
|
||||
* @param int|null $page 页码
|
||||
* @param int|null $per_page 每页个数
|
||||
* @return array
|
||||
*/
|
||||
public static function getWithAmountPage(array $params,string $keyword, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$raw = self::with([
|
||||
'ProductPlatformAmount:amount_id,product_platform_id,stock'
|
||||
])
|
||||
->when($keyword, function ($query, $keyword) {
|
||||
$query->where(function ($query) use ($keyword) {
|
||||
$query->orwhere("product_name", 'like', '%' . $keyword . '%');
|
||||
$query->orwhere("common_name", 'like', '%' . $keyword . '%');
|
||||
$query->orwhere("mnemonic_code", 'like', '%' . $keyword . '%');
|
||||
});
|
||||
})
|
||||
->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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
|
||||
+7
-5
@@ -9,20 +9,22 @@ use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property string $user_id 主键
|
||||
* @property int $user_id 主键
|
||||
* @property string $user_name 用户名称
|
||||
* @property string $user_account 账号
|
||||
* @property string $mobile 手机号
|
||||
* @property int $sex 性别(0:未知 1:男 2:女)
|
||||
* @property string $avatar 头像
|
||||
* @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 int $register_method 注册方式(1:微信小程序 2:后台添加 )
|
||||
* @property int $age 年龄
|
||||
* @property int $sex 性别(0:未知 1:男 2:女)
|
||||
* @property string $avatar 头像
|
||||
* @property string $login_ip 登陆ip
|
||||
* @property string $last_login_at 最后登陆时间
|
||||
* @property string $created_by 创建者id(后台用户表id null:自己注册)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
@@ -38,7 +40,7 @@ class User extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'sex', 'avatar', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'login_ip', 'last_login_at', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'age', 'sex', 'avatar', 'login_ip', 'last_login_at', 'created_by', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "user_id";
|
||||
|
||||
|
||||
+203
-48
@@ -183,12 +183,12 @@ class UserDoctor extends Model
|
||||
// 是否在线(0:不在线 1:在线)
|
||||
$params["is_online"] = 1;
|
||||
|
||||
// 是否参加专家图文接诊(0:否 1:是)
|
||||
$params["is_img_expert_reception"] = 1;
|
||||
// // 是否参加专家图文接诊(0:否 1:是)
|
||||
// $params["is_img_expert_reception"] = 1;
|
||||
|
||||
$datas = self::with([
|
||||
'Hospital:hospital_id,hospital_name,hospital_level_name',
|
||||
'DoctorInquiryConfig',
|
||||
"DoctorInquiryConfig",
|
||||
])
|
||||
->where($params)
|
||||
->orderBy("is_recommend", "desc")
|
||||
@@ -202,6 +202,108 @@ class UserDoctor extends Model
|
||||
return $datas;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取问诊医生列表
|
||||
// * 专家问诊-公益问诊共用
|
||||
// * @param string $keyword
|
||||
// * @param array $hospital_params 医院搜索条件
|
||||
// * @param array $doctor_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
|
||||
// {
|
||||
// $query = self::with([
|
||||
// "Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id",
|
||||
// "DoctorExpertise",
|
||||
// "DoctorInquiryConfig" => function ($query) use ($sort_order) {
|
||||
// $query->whereIn('inquiry_type', [1, 3])
|
||||
// ->where('inquiry_mode', 1);
|
||||
// },
|
||||
// ])
|
||||
// ->where($doctor_params)
|
||||
// ->when($keyword, function ($query, $keyword) {
|
||||
// $query->where(function ($query) use ($keyword) {
|
||||
// $query->orwhere("user_name", 'like', '%' . $keyword . '%');
|
||||
// $query->orwhere("department_custom_name", 'like', '%' . $keyword . '%');
|
||||
// $query->orWhereHas('Hospital', function ($query) use ($keyword) {
|
||||
// $query->where('hospital_name', 'like', '%' . $keyword . '%');
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// ->whereHas('Hospital', function ($query) use ($hospital_params) {
|
||||
// $query->where($hospital_params);
|
||||
// })
|
||||
// ->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) {
|
||||
// $query->where($doctor_expertise_params);
|
||||
// })
|
||||
// ->whereHas('DoctorInquiryConfig', function ($query) {
|
||||
// $params = array();
|
||||
// $params['inquiry_mode'] = 1;// 接诊方式:图文
|
||||
// $query->where($params)->whereIn('inquiry_type', [1, 3]);
|
||||
// });
|
||||
//
|
||||
// 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])
|
||||
// ->where('inquiry_mode', 1)
|
||||
// ->orderBy('inquiry_price', 'desc')
|
||||
// ->take(1);
|
||||
// })
|
||||
// ->select("user_doctor.*")
|
||||
// ->groupBy("user_doctor.doctor_id");
|
||||
// }
|
||||
//
|
||||
// if ($sort_order == 1) {
|
||||
// // 综合-价格从低到高
|
||||
// $query->orderBy('is_recommend', 'desc');// 是否首页推荐(0:否 1:是)
|
||||
// $query->orderByRaw('avg_response_time = 0 ASC');
|
||||
// $query->orderBy('avg_response_time');
|
||||
// $query->orderBy('served_patients_num', 'desc');// 服务数从多到少
|
||||
// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||
// $query->orderBy('doctor_inquiry_config.inquiry_price', 'asc');
|
||||
// } elseif ($sort_order == 2) {
|
||||
// // 响应时间快
|
||||
// $query->orderByRaw('avg_response_time = 0 ASC');
|
||||
// $query->orderBy('avg_response_time');
|
||||
// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||
// } elseif ($sort_order == 3) {
|
||||
// // 价格从低到高
|
||||
// $query->orderBy('doctor_inquiry_config.inquiry_price', 'asc');
|
||||
// $query->orderByRaw('avg_response_time = 0 ASC');
|
||||
// $query->orderBy('avg_response_time');
|
||||
// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||
// } elseif ($sort_order == 4) {
|
||||
// // 价格从高到低
|
||||
// $query->orderBy('doctor_inquiry_config.inquiry_price', 'desc');
|
||||
// $query->orderByRaw('avg_response_time = 0 ASC');
|
||||
// $query->orderBy('avg_response_time');
|
||||
// $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');// 名称排名
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $result = $query->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;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取问诊医生列表
|
||||
* 专家问诊-公益问诊共用
|
||||
@@ -209,40 +311,24 @@ class UserDoctor extends Model
|
||||
* @param array $hospital_params 医院搜索条件
|
||||
* @param array $doctor_params 医生搜索条件
|
||||
* @param array $doctor_expertise_params
|
||||
* @param array $inquiry_type
|
||||
* @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 $doctor_params = [], string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
public static function getInquiryDoctorPage(string $keyword = "", array $hospital_params = [], array $doctor_params = [], array $doctor_expertise_params = [],array $inquiry_type = [1,3], string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$query = self::with([
|
||||
"Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id",
|
||||
"DoctorExpertise",
|
||||
"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" => function ($query) use ($inquiry_type) {
|
||||
$query->whereIn('inquiry_type', $inquiry_type)
|
||||
->where('inquiry_mode', 1);
|
||||
},
|
||||
])
|
||||
->where($doctor_params)
|
||||
// ->whereHas('Hospital', function ($query) use ($hospital_params) {
|
||||
// $query->where($hospital_params);
|
||||
// })
|
||||
->when($keyword, function ($query, $keyword) {
|
||||
$query->where(function ($query) use ($keyword) {
|
||||
$query->orwhere("user_name", 'like', '%' . $keyword . '%');
|
||||
@@ -252,32 +338,63 @@ class UserDoctor extends Model
|
||||
});
|
||||
});
|
||||
})
|
||||
->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;
|
||||
->whereHas('Hospital', function ($query) use ($hospital_params) {
|
||||
$query->where($hospital_params);
|
||||
})
|
||||
->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) {
|
||||
$query->where($doctor_expertise_params);
|
||||
})
|
||||
->whereHas('DoctorInquiryConfig', function ($query) use ($inquiry_type) {
|
||||
$params = array();
|
||||
$params['inquiry_mode'] = 1;// 接诊方式:图文
|
||||
$query->where($params)->whereIn('inquiry_type', $inquiry_type);
|
||||
});
|
||||
|
||||
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])
|
||||
->where('inquiry_mode', 1)
|
||||
->orderBy('inquiry_price', 'desc')
|
||||
->take(1);
|
||||
})
|
||||
->select("user_doctor.*")
|
||||
->groupBy("user_doctor.doctor_id");
|
||||
}
|
||||
|
||||
if ($sort_order == 1) {
|
||||
// 综合-价格从低到高
|
||||
$query->orderBy('is_recommend', 'desc');// 是否首页推荐(0:否 1:是)
|
||||
$query->orderByRaw('avg_response_time = 0 ASC');
|
||||
$query->orderBy('avg_response_time');
|
||||
$query->orderBy('served_patients_num', 'desc');// 服务数从多到少
|
||||
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||
$query->orderBy('doctor_inquiry_config.inquiry_price', 'asc');
|
||||
} elseif ($sort_order == 2) {
|
||||
// 响应时间快
|
||||
$query->orderByRaw('avg_response_time = 0 ASC');
|
||||
$query->orderBy('avg_response_time');
|
||||
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||
} elseif ($sort_order == 3) {
|
||||
// 价格从低到高
|
||||
$query->orderBy('doctor_inquiry_config.inquiry_price', 'asc');
|
||||
$query->orderByRaw('avg_response_time = 0 ASC');
|
||||
$query->orderBy('avg_response_time');
|
||||
$query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名
|
||||
} elseif ($sort_order == 4) {
|
||||
// 价格从高到低
|
||||
$query->orderBy('doctor_inquiry_config.inquiry_price', 'desc');
|
||||
$query->orderByRaw('avg_response_time = 0 ASC');
|
||||
$query->orderBy('avg_response_time');
|
||||
$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');// 名称排名
|
||||
}
|
||||
}
|
||||
|
||||
$result = $query->paginate($per_page, $fields, "page", $page);
|
||||
|
||||
$data = array();
|
||||
@@ -290,6 +407,7 @@ class UserDoctor extends Model
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取是否存在
|
||||
* @param array $params
|
||||
@@ -363,4 +481,41 @@ class UserDoctor extends Model
|
||||
{
|
||||
return self::where($params)->decrement($field,$numeral);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取先思达合作医生列表
|
||||
* @param array $params
|
||||
* @param array $hospital_params
|
||||
* @param array $fields
|
||||
* @return array|Collection
|
||||
*/
|
||||
public static function getDiagnoCoopDoctorList(array $params,array $hospital_params,array $fields = ['*']): array|Collection
|
||||
{
|
||||
return self::with([
|
||||
"Hospital:hospital_id,hospital_name,hospital_level_name"
|
||||
])
|
||||
->whereHas('Hospital', function ($query) use ($hospital_params) {
|
||||
$query->where($hospital_params);
|
||||
})
|
||||
->where($params)
|
||||
->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生数据-医生配置
|
||||
* @param array $params
|
||||
* @param array $not_in_params
|
||||
* @param array $doctor_inquiry_config_params
|
||||
* @param array $fields
|
||||
* @return Collection|array|\Hyperf\Utils\Collection
|
||||
*/
|
||||
public static function getListWithConfig(array $params = [], array $not_in_params = [],array $doctor_inquiry_config_params = [],array $fields = ['*']): Collection|array|\Hyperf\Utils\Collection
|
||||
{
|
||||
$doctor_ids = Db::table('doctor_inquiry_config')->where($doctor_inquiry_config_params)->select("doctor_id");
|
||||
|
||||
return self::where($params)
|
||||
->whereNotIn('doctor_id',$not_in_params)
|
||||
->whereIn("doctor_id",$doctor_ids)
|
||||
->get($fields);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $user_location_id 主键id
|
||||
* @property int $user_id 用户id
|
||||
* @property string $lon 经度,范围为 -180~180,负数表示西经
|
||||
* @property string $lat 纬度,范围为 -90~90,负数表示南纬
|
||||
* @property string $province 省份
|
||||
* @property string $city 城市
|
||||
* @property string $county 区县
|
||||
* @property string $address 详细地址
|
||||
* @property string $create_time 创建时间
|
||||
* @property string $update_time 更新时间
|
||||
*/
|
||||
class UserLocation extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'user_location';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['user_location_id', 'user_id', 'lon', 'lat', 'province', 'city', 'county', 'address', 'create_time', 'update_time'];
|
||||
|
||||
protected string $primaryKey = "user_location_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|UserLocation
|
||||
*/
|
||||
public static function addUserLocation(array $data): \Hyperf\Database\Model\Model|UserLocation
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改-批量
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function editUserLocation(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $user_system_id 主键id
|
||||
* @property int $user_id 用户id
|
||||
* @property int $is_accept_im_message_push 是否接受im消息推送(0:否 1:是)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class UserSystem extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'user_system';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['user_system_id', 'user_id', 'is_accept_im_message_push', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "user_system_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
|
||||
* @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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return \Hyperf\Database\Model\Model|UserSystem
|
||||
*/
|
||||
public static function addUserSystem(array $data): \Hyperf\Database\Model\Model|UserSystem
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user