获取我的账户数据-获取医生服务包每月账单数据

This commit is contained in:
2024-05-07 18:13:03 +08:00
parent cef772f53c
commit 1a164b7cea
4 changed files with 123 additions and 34 deletions
+18
View File
@@ -9,6 +9,7 @@ namespace App\Model;
use Carbon\Carbon;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\DbConnection\Db;
use Hyperf\Snowflake\Concern\Snowflake;
/**
@@ -215,4 +216,21 @@ class OrderServicePackage extends Model
->orderBy('start_time')
->get();
}
/**
* 获取医生每月账单数据
* @param array $params
* @param string $year
* @param array $fields
* @return \Hyperf\Collection\Collection
*/
public static function getMonthlyGroupBill(array $params, string $year,array $fields = ["*"]): \Hyperf\Collection\Collection
{
return self::select([Db::raw('YEAR(start_time) AS `year`') ,Db::raw('MONTH(start_time) AS `month`')])
->where($params)
->whereIn('order_service_status', [3,4,5])
->where(Db::raw('YEAR(start_time)'), $year)
->groupBy([Db::raw('YEAR(start_time)'),Db::raw('MONTH(start_time)')])
->get($fields);
}
}