新增获取医生我的账户数据接口

This commit is contained in:
2023-02-22 18:16:22 +08:00
parent 2f76b0f877
commit c1320cb71e
9 changed files with 355 additions and 18 deletions
+2 -3
View File
@@ -11,10 +11,9 @@ use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $account_id 账户id
* @property int $doctor_id 医生id
* @property string $total_amount 总金额(已完成订单的总金额)
* @property string $total_amount 总金额(已结束订单的总金额)
* @property string $balance_account 账户余额
* @property string $withdrawal_amount 已提现金额
* @property string $undrawn_amount 未提现金额
* @property string $income_tax 所得税金额
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
@@ -31,7 +30,7 @@ class DoctorAccount extends Model
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['account_id', 'doctor_id', 'total_amount', 'balance_account', 'withdrawal_amount', 'undrawn_amount', 'income_tax', 'created_at', 'updated_at'];
protected array $fillable = ['account_id', 'doctor_id', 'total_amount', 'balance_account', 'withdrawal_amount', 'income_tax', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
+74
View File
@@ -0,0 +1,74 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $account_detail_id 主键id
* @property int $doctor_id 医生id
* @property int $year 年(2023
* @property int $month 月(12
* @property int $day 日(01
* @property int $account_month_id 月份账户id
* @property string $total_amount_day 订单总金额-日
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class DoctorAccountDay extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'doctor_account_day';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['account_detail_id', 'doctor_id', 'year', 'month', 'day', 'account_month_id', 'total_amount_day', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['account_detail_id' => 'integer', 'doctor_id' => 'integer', 'year' => 'integer', 'month' => 'integer', 'day' => 'integer', 'account_month_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "account_detail_id";
/**
* 获取信息-单条
* @param array $params
* @param array $fields
* @return object|null
*/
public static function getOne(array $params, array $fields = ['*']): object|null
{
return self::where($params)->first($fields);
}
/**
* 获取信息-多条
* @param array $params
* @param array $fields
* @return object|null
*/
public static function getList(array $params, array $fields = ['*']): object|null
{
return self::where($params)->get($fields);
}
/**
* 获取total_amount_day字段总和
* @param array $params
* @return int|mixed|string
*/
public static function getDoctorSumTotalAmount(array $params): mixed
{
return self::where($params)->sum("total_amount_day");
}
}
+67
View File
@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $account_month_id 主键id
* @property int $account_id 账户id
* @property int $doctor_id 医生id
* @property int $year 年(2023
* @property int $month 月(12
* @property string $month_date 日期(Y-m
* @property string $total_amount 总金额
* @property string $withdrawal_amount 已提现金额
* @property string $undrawn_amount 未提现金额
* @property string $income_tax 已提现所得税
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class DoctorAccountMonth extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'doctor_account_month';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['account_month_id', 'account_id', 'doctor_id', 'year', 'month', 'month_date', 'total_amount', 'withdrawal_amount', 'undrawn_amount', 'income_tax', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['account_month_id' => 'integer', 'account_id' => 'integer', 'doctor_id' => 'integer', 'year' => 'integer', 'month' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "account_month_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);
}
}
+3 -2
View File
@@ -105,14 +105,15 @@ class OrderInquiry extends Model
/**
* 获取医生某天预计收益
* 已完成-已结束
* @param array $params
* @param array $reception_time 接诊时间区间
* @return int|mixed|string
*/
public static function getDoctorOneDayEstimateIncome(array $params,array $reception_time): mixed
public static function getDoctorOneDayAmountTotal(array $params, array $reception_time): mixed
{
return self::where($params)
->whereIn('inquiry_status',[4,5,6])
->whereIn('inquiry_status',[5,6])
->whereBetween('reception_time',$reception_time)
->sum("amount_total");
}