1.3版本合并dev并解决冲突
This commit is contained in:
+55
-33
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\Database\Query\Builder;
|
||||
@@ -13,6 +14,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $order_inquiry_id 主键id
|
||||
* @property int $order_id 订单id
|
||||
* @property int $user_id 用户id-患者
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $doctor_id 医生id(未分配时为null)
|
||||
@@ -46,9 +48,9 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $patient_name_mask 患者姓名-就诊人(掩码)
|
||||
* @property int $patient_sex 患者性别-就诊人(0:未知 1:男 2:女)
|
||||
* @property int $patient_age 患者年龄-就诊人
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property-read UserDoctor|null $UserDoctor
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
* @property-read UserDoctor|null $UserDoctor
|
||||
* @property-read OrderInquiryCase|null $OrderInquiryCase
|
||||
*/
|
||||
class OrderInquiry extends Model
|
||||
@@ -63,7 +65,7 @@ class OrderInquiry extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_inquiry_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'inquiry_type', 'inquiry_mode', 'inquiry_status', 'is_delete', 'inquiry_refund_status', 'inquiry_pay_channel', 'inquiry_pay_status', 'inquiry_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'reception_time', 'complete_time', 'finish_time', 'statistics_status', 'statistics_time', 'is_withdrawal', 'withdrawal_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'times_number', 'duration', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['order_inquiry_id', 'order_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'inquiry_type', 'inquiry_mode', 'inquiry_status', 'is_delete', 'inquiry_refund_status', 'inquiry_pay_channel', 'inquiry_pay_status', 'inquiry_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'reception_time', 'complete_time', 'finish_time', 'statistics_status', 'statistics_time', 'is_withdrawal', 'withdrawal_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'times_number', 'duration', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_inquiry_id";
|
||||
|
||||
@@ -232,40 +234,13 @@ class OrderInquiry extends Model
|
||||
* 已结束
|
||||
* @param array $params
|
||||
* @param array $inquiry_status_params
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getDoctorOrderInquiryPage(array $params, array $inquiry_status_params, array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
|
||||
{
|
||||
$raw = self::where($params)
|
||||
->whereIn('inquiry_status', $inquiry_status_params)
|
||||
->orderBy('finish_time', 'desc')
|
||||
->paginate($per_page, $fields, "page", $page);
|
||||
|
||||
$data = array();
|
||||
$data['current_page'] = $raw->currentPage();// 当前页码
|
||||
$data['total'] = $raw->total();//数据总数
|
||||
$data['data'] = $raw->items();//数据
|
||||
$data['per_page'] = $raw->perPage();//每页个数
|
||||
$data['last_page'] = $raw->lastPage();//最后一页
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生接诊订单分页数据-坐班医生
|
||||
* 已结束
|
||||
* @param array $params
|
||||
* @param array $inquiry_status_params
|
||||
* @param array $inquiry_type_not_params
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getCooperationDoctorOrderInquiryPage(array $params, array $inquiry_status_params,array $inquiry_type_not_params = [], array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
|
||||
public static function getDoctorOrderInquiryPage(array $params, array $inquiry_status_params,array $inquiry_type_not_params = [], array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
|
||||
{
|
||||
$raw = self::where($params)
|
||||
->whereIn('inquiry_status', $inquiry_status_params)
|
||||
@@ -290,11 +265,15 @@ class OrderInquiry extends Model
|
||||
* @param array $params
|
||||
* @param array $reception_time 接诊时间区间
|
||||
* @param array $inquiry_status_params inquiry_status字段搜索条件
|
||||
* @param array $inquiry_type_not_params
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getDoctorAmountTotal(array $params, array $reception_time, array $inquiry_status_params): mixed
|
||||
public static function getDoctorAmountTotal(array $params, array $reception_time, array $inquiry_status_params,array $inquiry_type_not_params = []): mixed
|
||||
{
|
||||
return self::where($params)
|
||||
->when($inquiry_type_not_params, function ($query, $inquiry_type_not_params) {
|
||||
$query->whereNotIn('inquiry_type', $inquiry_type_not_params);
|
||||
})
|
||||
->whereIn('inquiry_status', $inquiry_status_params)
|
||||
->whereBetween('reception_time', $reception_time)
|
||||
->orderBy('reception_time')
|
||||
@@ -306,6 +285,7 @@ class OrderInquiry extends Model
|
||||
* @param array $params
|
||||
* @param array $reception_time 接诊时间区间
|
||||
* @param array $inquiry_status_params inquiry_status字段搜索条件
|
||||
* @param array $inquiry_type_not_params
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getCooperationDoctorAmountTotal(array $params, array $reception_time, array $inquiry_status_params,array $inquiry_type_not_params = []): mixed
|
||||
@@ -611,4 +591,46 @@ class OrderInquiry extends Model
|
||||
->latest()
|
||||
->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者某一时间段问诊订单-创建时间
|
||||
* @param array $params
|
||||
* @param array $created_at 接诊时间区间
|
||||
* @param array $inquiry_status_params inquiry_status字段搜索条件
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getInquiryWithCreateTime(array $params, array $created_at, array $inquiry_status_params): Collection|array
|
||||
{
|
||||
return self::where($params)
|
||||
->whereIn('inquiry_status', $inquiry_status_params)
|
||||
->whereBetween('created_at', $created_at)
|
||||
->orderBy('created_at')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生每月账单数据
|
||||
* @param array $params
|
||||
* @param string $year
|
||||
* @param string|int $is_platform_deep_cooperation
|
||||
* @param array $fields
|
||||
* @return \Hyperf\Collection\Collection
|
||||
*/
|
||||
public static function getMonthlyGroupBill(array $params, string $year,string|int $is_platform_deep_cooperation,array $fields = ["*"]): \Hyperf\Collection\Collection
|
||||
{
|
||||
$query = self::select([Db::raw('YEAR(reception_time) AS `year`') ,Db::raw('MONTH(reception_time) AS `month`')])
|
||||
->where($params)
|
||||
->whereNotIn('inquiry_mode', [7,8,9])
|
||||
->whereIn('inquiry_status', [6])
|
||||
->where(Db::raw('YEAR(reception_time)'), $year);
|
||||
|
||||
if ($is_platform_deep_cooperation == 1){
|
||||
$query->whereNotIn('inquiry_type', [2,4]);
|
||||
}
|
||||
|
||||
$result = $query->groupBy([Db::raw('YEAR(reception_time)'),Db::raw('MONTH(reception_time)')])
|
||||
->get($fields);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user