新增 创建检测订单 接口
This commit is contained in:
@@ -7,6 +7,7 @@ namespace App\Model;
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $detection_project_id 主键id
|
||||
@@ -19,6 +20,8 @@ use Hyperf\Database\Model\Collection;
|
||||
*/
|
||||
class DetectionProject extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace App\Model;
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $purpose_id 主键id
|
||||
@@ -17,6 +18,8 @@ use Hyperf\Database\Model\Collection;
|
||||
*/
|
||||
class DetectionProjectPurpose extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace App\Model;
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $id 主键id
|
||||
@@ -20,6 +21,8 @@ use Hyperf\Database\Model\Collection;
|
||||
*/
|
||||
class DiseaseClassDetection extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
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 $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 \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', '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', '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 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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -379,15 +379,6 @@ class UserDoctor extends Model
|
||||
->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 . '%');
|
||||
// $query->orwhere("department_custom_name", 'like', '%' . $keyword . '%');
|
||||
// $query->orWhereHas('Hospital', function ($query) use ($keyword) {
|
||||
// $query->where('hospital_name', 'like', '%' . $keyword . '%');
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
->where($params)
|
||||
->get($fields);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user