修正返回值bigint被转义问题
This commit is contained in:
parent
ebf34e28e7
commit
27288a9dd9
@ -45,4 +45,15 @@ class DoctorAccountController extends AbstractController
|
|||||||
$data = $DoctorAccountService->getDoctorAccountInfo();
|
$data = $DoctorAccountService->getDoctorAccountInfo();
|
||||||
return $this->response->json($data);
|
return $this->response->json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取提现数据
|
||||||
|
* @return ResponseInterface
|
||||||
|
*/
|
||||||
|
public function getDoctorWithdrawal(): ResponseInterface
|
||||||
|
{
|
||||||
|
$DoctorAccountService = new DoctorAccountService();
|
||||||
|
$data = $DoctorAccountService->getDoctorWithdrawal();
|
||||||
|
return $this->response->json($data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -153,4 +153,6 @@ class UserDoctorController extends AbstractController
|
|||||||
$data = $UserDoctorService->getDoctorCenter();
|
$data = $UserDoctorService->getDoctorCenter();
|
||||||
return $this->response->json($data);
|
return $this->response->json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ class BasicBank extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
*/
|
*/
|
||||||
protected array $casts = ['bank_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
protected array $casts = ['bank_id' => 'string', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||||
|
|
||||||
protected string $primaryKey = "bank_id";
|
protected string $primaryKey = "bank_id";
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
|||||||
* @property int $year 年(2023)
|
* @property int $year 年(2023)
|
||||||
* @property int $month 月(12)
|
* @property int $month 月(12)
|
||||||
* @property int $day 日(01)
|
* @property int $day 日(01)
|
||||||
* @property int $account_month_id 月份账户id
|
* @property string $date 日期(2022-01-01)
|
||||||
* @property string $total_amount_day 订单总金额-日
|
* @property string $total_amount_day 订单总金额-日
|
||||||
* @property \Carbon\Carbon $created_at 创建时间
|
* @property \Carbon\Carbon $created_at 创建时间
|
||||||
* @property \Carbon\Carbon $updated_at 修改时间
|
* @property \Carbon\Carbon $updated_at 修改时间
|
||||||
@ -31,12 +31,12 @@ class DoctorAccountDay extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* 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'];
|
protected array $fillable = ['account_detail_id', 'doctor_id', 'year', 'month', 'day', 'date', 'total_amount_day', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* 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 array $casts = ['account_detail_id' => 'integer', 'doctor_id' => 'integer', 'year' => 'integer', 'month' => 'integer', 'day' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||||
|
|
||||||
protected string $primaryKey = "account_detail_id";
|
protected string $primaryKey = "account_detail_id";
|
||||||
|
|
||||||
|
|||||||
@ -10,14 +10,11 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $account_month_id 主键id
|
* @property int $account_month_id 主键id
|
||||||
* @property int $account_id 账户id
|
|
||||||
* @property int $doctor_id 医生id
|
* @property int $doctor_id 医生id
|
||||||
* @property int $year 年(2023)
|
* @property int $year 年(2023)
|
||||||
* @property int $month 月(12)
|
* @property int $month 月(12)
|
||||||
* @property string $month_date 日期(Y-m)
|
|
||||||
* @property string $total_amount 总金额
|
* @property string $total_amount 总金额
|
||||||
* @property string $withdrawal_amount 已提现金额
|
* @property string $withdrawal_amount 已提现金额
|
||||||
* @property string $undrawn_amount 未提现金额
|
|
||||||
* @property string $income_tax 已提现所得税
|
* @property string $income_tax 已提现所得税
|
||||||
* @property \Carbon\Carbon $created_at 创建时间
|
* @property \Carbon\Carbon $created_at 创建时间
|
||||||
* @property \Carbon\Carbon $updated_at 修改时间
|
* @property \Carbon\Carbon $updated_at 修改时间
|
||||||
@ -34,12 +31,12 @@ class DoctorAccountMonth extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* 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'];
|
protected array $fillable = ['account_month_id', 'doctor_id', 'year', 'month', 'total_amount', 'withdrawal_amount', 'income_tax', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* 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 array $casts = ['account_month_id' => 'integer', 'doctor_id' => 'integer', 'year' => 'integer', 'month' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||||
|
|
||||||
protected string $primaryKey = "account_month_id";
|
protected string $primaryKey = "account_month_id";
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class Hospital extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
*/
|
*/
|
||||||
protected array $casts = ['hospital_id' => 'integer', 'hospital_status' => 'integer', 'province_id' => 'integer', 'city_id' => 'integer', 'county_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
protected array $casts = ['hospital_id' => 'string', 'hospital_status' => 'integer', 'province_id' => 'integer', 'city_id' => 'integer', 'county_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||||
|
|
||||||
protected string $primaryKey = "hospital_id";
|
protected string $primaryKey = "hospital_id";
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class HospitalDepartmentCustom extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
*/
|
*/
|
||||||
protected array $casts = ['department_custom_id' => 'integer', 'department_id' => 'integer', 'department_status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
protected array $casts = ['department_custom_id' => 'string', 'department_id' => 'integer', 'department_status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||||
|
|
||||||
protected string $primaryKey = "department_custom_id";
|
protected string $primaryKey = "department_custom_id";
|
||||||
|
|
||||||
|
|||||||
@ -28,9 +28,11 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
|||||||
* @property string $pay_time 支付时间
|
* @property string $pay_time 支付时间
|
||||||
* @property string $reception_time 接诊时间(已接诊)
|
* @property string $reception_time 接诊时间(已接诊)
|
||||||
* @property string $complete_time 订单完成时间(问诊完成时间)
|
* @property string $complete_time 订单完成时间(问诊完成时间)
|
||||||
|
* @property string $finish_time 订单结束时间
|
||||||
* @property string $settlement_amount_total 订单与医生结算金额
|
* @property string $settlement_amount_total 订单与医生结算金额
|
||||||
* @property int $settlement_status 订单与医生结算状态(0:未结算 1:已结算)
|
* @property int $settlement_status 订单与医生结算状态(0:未结算 1:已结算)
|
||||||
* @property string $settlement_time 订单与医生结算时间
|
* @property string $settlement_time 订单与医生结算时间
|
||||||
|
* @property string $cancel_time 订单取消时间
|
||||||
* @property int $cancel_reason 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
* @property int $cancel_reason 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||||||
* @property string $cancel_remarks 取消订单备注(自动添加)
|
* @property string $cancel_remarks 取消订单备注(自动添加)
|
||||||
* @property string $patient_name 患者姓名-就诊人
|
* @property string $patient_name 患者姓名-就诊人
|
||||||
@ -52,7 +54,7 @@ class OrderInquiry extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* 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', 'payment_amount_total', 'pay_time', 'reception_time', 'complete_time', 'settlement_amount_total', 'settlement_status', 'settlement_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
|
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', 'payment_amount_total', 'pay_time', 'reception_time', 'complete_time', 'finish_time', 'settlement_amount_total', 'settlement_status', 'settlement_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
@ -104,8 +106,11 @@ class OrderInquiry extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取医生接诊列表
|
* 获取医生接诊订单列表
|
||||||
* 已完成-已结束
|
* 已结束-已取消
|
||||||
|
* inquiry_status:问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||||
|
* inquiry_refund_status:问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
||||||
|
* cancel_reason:取消订单原因(0:默认 1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||||||
* @param array $params
|
* @param array $params
|
||||||
* @param array $reception_time 接诊时间区间 ['2023-01-02','2023-01-03']
|
* @param array $reception_time 接诊时间区间 ['2023-01-02','2023-01-03']
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
@ -116,8 +121,12 @@ class OrderInquiry extends Model
|
|||||||
public static function getDoctorAccountInfoPage(array $params, array $reception_time,array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
|
public static function getDoctorAccountInfoPage(array $params, array $reception_time,array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
|
||||||
{
|
{
|
||||||
$raw = self::where($params)
|
$raw = self::where($params)
|
||||||
->whereIn('inquiry_status',[5,6])
|
->whereIn('inquiry_status',[6,7])
|
||||||
->whereBetween('reception_time',$reception_time)
|
->whereIn('inquiry_refund_status',[0,3])
|
||||||
|
->whereIn('cancel_reason',[0,4])
|
||||||
|
->whereBetween('finish_time',$reception_time)
|
||||||
|
->orderBy('finish_time')
|
||||||
|
->orderBy('cancel_time')
|
||||||
->paginate($per_page, $fields, "page", $page);
|
->paginate($per_page, $fields, "page", $page);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
@ -129,4 +138,20 @@ class OrderInquiry extends Model
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取医生某一时间段,某种状态的订单金额
|
||||||
|
* @param array $params
|
||||||
|
* @param array $reception_time 接诊时间区间
|
||||||
|
* @param array $inquiry_status_params inquiry_status字段搜索条件
|
||||||
|
* @return int|mixed|string
|
||||||
|
*/
|
||||||
|
public static function getOrderInquiryAmountTotalSum(array $params, array $reception_time,array $inquiry_status_params): mixed
|
||||||
|
{
|
||||||
|
return self::where($params)
|
||||||
|
->whereIn('inquiry_status',$inquiry_status_params)
|
||||||
|
->whereBetween('reception_time',$reception_time)
|
||||||
|
->orderBy('reception_time')
|
||||||
|
->sum("amount_total");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Constants\HttpEnumCode;
|
||||||
use App\Model\DoctorAccount;
|
use App\Model\DoctorAccount;
|
||||||
use App\Model\DoctorAccountDay;
|
use App\Model\DoctorAccountDay;
|
||||||
use App\Model\DoctorAccountMonth;
|
use App\Model\DoctorAccountMonth;
|
||||||
|
use App\Model\DoctorBankCard;
|
||||||
use App\Model\OrderInquiry;
|
use App\Model\OrderInquiry;
|
||||||
|
use App\Model\UserDoctor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 医生账户
|
* 医生账户
|
||||||
@ -24,8 +27,11 @@ class DoctorAccountService extends BaseService
|
|||||||
|
|
||||||
// 获取医生账户余额
|
// 获取医生账户余额
|
||||||
$balance_account = $this->getDoctorBalanceAccount($user_info['client_user_id']);
|
$balance_account = $this->getDoctorBalanceAccount($user_info['client_user_id']);
|
||||||
|
if ($balance_account > 0){
|
||||||
|
$balance_account = $balance_account * 0.75;
|
||||||
|
}
|
||||||
|
|
||||||
// 月预计收益
|
// 月余额-已结束订单
|
||||||
$amount_total_month = 0;
|
$amount_total_month = 0;
|
||||||
|
|
||||||
// 月已提现金额
|
// 月已提现金额
|
||||||
@ -38,7 +44,10 @@ class DoctorAccountService extends BaseService
|
|||||||
$params['month'] = date('m',strtotime($date));
|
$params['month'] = date('m',strtotime($date));
|
||||||
$doctor_account_month = DoctorAccountMonth::getOne($params);
|
$doctor_account_month = DoctorAccountMonth::getOne($params);
|
||||||
if (!empty($doctor_account_month)){
|
if (!empty($doctor_account_month)){
|
||||||
$amount_total_month = $doctor_account_month['total_amount'] ?: 0;
|
if (!empty($doctor_account_month['total_amount'])){
|
||||||
|
$amount_total_month = $doctor_account_month['total_amount'] * 0.75;
|
||||||
|
}
|
||||||
|
|
||||||
$withdrawal_amount_month = $doctor_account_month['withdrawal_amount'] ?: 0;
|
$withdrawal_amount_month = $doctor_account_month['withdrawal_amount'] ?: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +78,7 @@ class DoctorAccountService extends BaseService
|
|||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$result['balance_account'] = $balance_account; // 账户余额
|
$result['balance_account'] = $balance_account; // 账户余额
|
||||||
$result['amount_total_month'] = $amount_total_month * 0.75; // 月预计收益
|
$result['amount_total_month'] = $amount_total_month; // 月余额
|
||||||
$result['withdrawal_amount_month'] = $withdrawal_amount_month; // 月已提现金额
|
$result['withdrawal_amount_month'] = $withdrawal_amount_month; // 月已提现金额
|
||||||
$result['bill'] = $bill; // 账单
|
$result['bill'] = $bill; // 账单
|
||||||
|
|
||||||
@ -114,8 +123,7 @@ class DoctorAccountService extends BaseService
|
|||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['doctor_id'] = $user_info['client_user_id'];
|
$params['doctor_id'] = $user_info['client_user_id'];
|
||||||
$params['inquiry_refund_status'] = 0; // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
// $params['cancel_reason'] = ;
|
||||||
$params['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
|
||||||
|
|
||||||
$order_inquiry = OrderInquiry::getDoctorAccountInfoPage($params,$reception_time,$fields);
|
$order_inquiry = OrderInquiry::getDoctorAccountInfoPage($params,$reception_time,$fields);
|
||||||
if (!empty($order_inquiry['data'])){
|
if (!empty($order_inquiry['data'])){
|
||||||
@ -127,6 +135,64 @@ class DoctorAccountService extends BaseService
|
|||||||
return success($order_inquiry);
|
return success($order_inquiry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取提现数据
|
||||||
|
public function getDoctorWithdrawal(){
|
||||||
|
|
||||||
|
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||||
|
|
||||||
|
// 获取医生信息
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $user_info['client_user_id'];
|
||||||
|
|
||||||
|
$fields = [
|
||||||
|
'doctor_id',
|
||||||
|
'user_name',
|
||||||
|
'iden_auth_status',
|
||||||
|
'idcard_status',
|
||||||
|
'multi_point_status',
|
||||||
|
'avatar',
|
||||||
|
'is_bind_bank',
|
||||||
|
];
|
||||||
|
$user_doctor = UserDoctor::getOne($params, $fields);
|
||||||
|
if (empty($user_doctor)) {
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "非法医生");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测医生身份认证
|
||||||
|
$UserDoctorService = new UserDoctorService();
|
||||||
|
$res = $UserDoctorService->checkDoctorAuth($user_doctor);
|
||||||
|
if ($res !== true){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user_doctor['is_bind_bank'] != 1){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "未绑定结算银行卡");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取医生结算银行卡
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $user_info['client_user_id'];
|
||||||
|
$doctor_bank_card = DoctorBankCard::getWithBankOne($params);
|
||||||
|
if (empty($doctor_bank_card)) {
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
$result['bank_card_id'] = $doctor_bank_card['bank_card_id'];
|
||||||
|
$result['bank_img_path'] = $doctor_bank_card['BasicBank']['bank_img_path'];
|
||||||
|
$result['bank_name'] = $doctor_bank_card['BasicBank']['bank_name'];
|
||||||
|
$result['bank_card_code_mask'] = $doctor_bank_card['bank_card_code_mask'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 获取医生账户余额
|
||||||
|
$balance_account = $this->getDoctorBalanceAccount($user_info['client_user_id']);
|
||||||
|
|
||||||
|
// 计算医生个人所得税
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取医生账户余额
|
* 获取医生账户余额
|
||||||
* @param string $doctor_id
|
* @param string $doctor_id
|
||||||
@ -140,31 +206,37 @@ class DoctorAccountService extends BaseService
|
|||||||
if (empty($doctor_account)){
|
if (empty($doctor_account)){
|
||||||
$balance_account = 0;
|
$balance_account = 0;
|
||||||
}else{
|
}else{
|
||||||
$balance_account = $doctor_account['balance_account'] * 0.75;
|
$balance_account = $doctor_account['balance_account'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $balance_account;
|
return $balance_account;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 获取医生账户某日预计收益
|
// * 获取医生账户某日预计收益
|
||||||
* @param string $doctor_id 医生id
|
// * @param string $doctor_id 医生id
|
||||||
* @param string $day 日期 Ymd形式
|
// * @param string $day 日期 Ymd形式
|
||||||
* @return float|int|mixed|string
|
// * @return float|int|mixed|string
|
||||||
*/
|
// */
|
||||||
public function getDoctorDayAmountTotal(string $doctor_id, string $day): mixed
|
// public function getDoctorDayAmountTotal(string $doctor_id, string $day): mixed
|
||||||
{
|
// {
|
||||||
$params = array();
|
// $params = array();
|
||||||
$params['doctor_id'] = $doctor_id;
|
// $params['doctor_id'] = $doctor_id;
|
||||||
$params['year'] = date('Y',strtotime($day));
|
// $params['year'] = date('Y',strtotime($day));
|
||||||
$params['month'] = date('m',strtotime($day));
|
// $params['month'] = date('m',strtotime($day));
|
||||||
$params['day'] = date('d',strtotime($day));
|
// $params['day'] = date('d',strtotime($day));
|
||||||
$total_amount_day = DoctorAccountDay::getDoctorSumTotalAmount($params);
|
// $total_amount_day = DoctorAccountDay::getDoctorSumTotalAmount($params);
|
||||||
if (!empty($total_amount_day)){
|
// if (!empty($total_amount_day)){
|
||||||
$total_amount_day = $total_amount_day * 0.75;
|
// $total_amount_day = $total_amount_day * 0.75;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
// return $total_amount_day ?: 0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 计算个人所得税
|
||||||
|
protected function computeIndividualIncomeTax(){
|
||||||
|
|
||||||
return $total_amount_day ?: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -63,6 +63,37 @@ class OrderInquiryService extends BaseService
|
|||||||
return $accepting_inquiry_num;
|
return $accepting_inquiry_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取医生当日接诊的订单金额
|
||||||
|
* 状态:已接诊-已完成
|
||||||
|
* @param string $doctor_id
|
||||||
|
* @param string $date
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getDoctorDayAmountTotal(string $doctor_id,string $date): float
|
||||||
|
{
|
||||||
|
// 获取当天开始时间
|
||||||
|
$start_date = date('Y-m-d 00:00:00',strtotime($date));
|
||||||
|
|
||||||
|
// 获取当天结束时间
|
||||||
|
$end_date = date('Y-m-d 23:59:59',strtotime($date));
|
||||||
|
|
||||||
|
// 获取医生当日接诊订单金额
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $doctor_id;
|
||||||
|
$params['inquiry_refund_status'] = 0; // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
||||||
|
$params['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||||
|
$params['settlement_status'] = 0; // 订单与医生结算状态(0:未结算 1:已结算)
|
||||||
|
|
||||||
|
$reception_time = [$start_date,$end_date];
|
||||||
|
|
||||||
|
$inquiry_status_params = [4,5]; // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||||
|
|
||||||
|
$amount_total_sum = OrderInquiry::getOrderInquiryAmountTotalSum($params,$reception_time,$inquiry_status_params);
|
||||||
|
|
||||||
|
return $amount_total_sum ?: 0;
|
||||||
|
}
|
||||||
|
|
||||||
// 创建问诊订单
|
// 创建问诊订单
|
||||||
public function addInquiryOrder(){
|
public function addInquiryOrder(){
|
||||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||||
|
|||||||
@ -496,13 +496,54 @@ class UserDoctorService extends BaseService
|
|||||||
// 获取医生账户余额-未提现金额
|
// 获取医生账户余额-未提现金额
|
||||||
$DoctorAccountService = new DoctorAccountService();
|
$DoctorAccountService = new DoctorAccountService();
|
||||||
$balance_account = $DoctorAccountService->getDoctorBalanceAccount($user_info['client_user_id']);
|
$balance_account = $DoctorAccountService->getDoctorBalanceAccount($user_info['client_user_id']);
|
||||||
|
if ($balance_account > 0){
|
||||||
|
$balance_account = $balance_account * 0.75;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取当日预计收益 当日接诊的订单金额
|
// 获取医生当日接诊的订单金额
|
||||||
$estimate_income = $DoctorAccountService->getDoctorDayAmountTotal($user_info['client_user_id'],date('Y-m-d',time()));
|
$OrderInquiryService = new OrderInquiryService();
|
||||||
|
$estimate_income = $OrderInquiryService->getDoctorDayAmountTotal($user_info['client_user_id'],date('Y-m-d',time()));
|
||||||
|
if (!empty($estimate_income)){
|
||||||
|
$estimate_income = $estimate_income * 0.75;
|
||||||
|
}
|
||||||
|
|
||||||
$user_doctor['balance_account'] = $balance_account ?? 0;
|
$user_doctor['balance_account'] = $balance_account;
|
||||||
$user_doctor['estimate_income'] = $estimate_income;
|
$user_doctor['estimate_income'] = $estimate_income;
|
||||||
|
|
||||||
return success($user_doctor);
|
return success($user_doctor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测医生身份认证
|
||||||
|
* @param object|array $user_doctor 医生表数据
|
||||||
|
* @return bool|string string:错误信息 bool:通过
|
||||||
|
*/
|
||||||
|
public function checkDoctorAuth(object|array $user_doctor): bool|string
|
||||||
|
{
|
||||||
|
if (empty($user_doctor)){
|
||||||
|
throw new BusinessException();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($user_doctor['iden_auth_status'])){
|
||||||
|
if ($user_doctor['iden_auth_status'] != 1) {
|
||||||
|
return "请先完成身份认证";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($user_doctor['idcard_status'])){
|
||||||
|
if ($user_doctor['idcard_status'] != 1) {
|
||||||
|
return "请先完成实名认证";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($user_doctor['multi_point_status'])){
|
||||||
|
if ($user_doctor['multi_point_status'] != 1) {
|
||||||
|
return "请先完成多点执业认证";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -96,8 +96,6 @@ Router::addGroup('/doctor', function () {
|
|||||||
Router::addGroup('/center', function () {
|
Router::addGroup('/center', function () {
|
||||||
// 获取医生个人中心数据
|
// 获取医生个人中心数据
|
||||||
Router::get('', [UserDoctorController::class, 'getDoctorCenter']);
|
Router::get('', [UserDoctorController::class, 'getDoctorCenter']);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 我的账户
|
// 我的账户
|
||||||
@ -109,6 +107,12 @@ Router::addGroup('/doctor', function () {
|
|||||||
Router::get('/info', [DoctorAccountController::class, 'getDoctorAccountInfo']);
|
Router::get('/info', [DoctorAccountController::class, 'getDoctorAccountInfo']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 提现
|
||||||
|
Router::addGroup('/withdrawal', function () {
|
||||||
|
// 获取提现数据
|
||||||
|
Router::get('', [DoctorAccountController::class, 'getDoctorWithdrawal']);
|
||||||
|
});
|
||||||
|
|
||||||
// 处方
|
// 处方
|
||||||
Router::addGroup('/prescription', function () {
|
Router::addGroup('/prescription', function () {
|
||||||
// 获取处方列表
|
// 获取处方列表
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user