新增获取医生个人中心数据
This commit is contained in:
parent
5132a57752
commit
2f76b0f877
@ -106,12 +106,14 @@ class OrderInquiry extends Model
|
|||||||
/**
|
/**
|
||||||
* 获取医生某天预计收益
|
* 获取医生某天预计收益
|
||||||
* @param array $params
|
* @param array $params
|
||||||
|
* @param array $reception_time 接诊时间区间
|
||||||
* @return int|mixed|string
|
* @return int|mixed|string
|
||||||
*/
|
*/
|
||||||
public static function getDoctorOneDayEstimateIncome(array $params): mixed
|
public static function getDoctorOneDayEstimateIncome(array $params,array $reception_time): mixed
|
||||||
{
|
{
|
||||||
return self::where($params)
|
return self::where($params)
|
||||||
->whereIn('inquiry_status',[4,5,6])
|
->whereIn('inquiry_status',[4,5,6])
|
||||||
|
->whereBetween('reception_time',$reception_time)
|
||||||
->sum("amount_total");
|
->sum("amount_total");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
use App\Constants\HttpEnumCode;
|
use App\Constants\HttpEnumCode;
|
||||||
|
use App\Exception\BusinessException;
|
||||||
use App\Model\DoctorInquiryConfig;
|
use App\Model\DoctorInquiryConfig;
|
||||||
use App\Model\DoctorInquiryPriceRecord;
|
use App\Model\DoctorInquiryPriceRecord;
|
||||||
use App\Model\SystemInquiryConfig;
|
use App\Model\SystemInquiryConfig;
|
||||||
@ -382,4 +383,35 @@ class DoctorInquiryService extends BaseService
|
|||||||
|
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取医生问诊价格
|
||||||
|
* @param string|int $inquiry_type 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||||
|
* @param string|int $inquiry_mode 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||||
|
* @param string|int $doctor_id 医生id
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getDoctorInquiryPrice(string|int $inquiry_type, string|int $inquiry_mode,string|int $doctor_id): int
|
||||||
|
{
|
||||||
|
if (empty($doctor_id)){
|
||||||
|
throw new BusinessException();
|
||||||
|
}
|
||||||
|
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $doctor_id;
|
||||||
|
$params['inquiry_type'] = $inquiry_type;
|
||||||
|
$params['inquiry_mode'] = $inquiry_mode;
|
||||||
|
$doctor_inquiry_config = DoctorInquiryConfig::getInquiryConfigOne($params);
|
||||||
|
if (empty($doctor_inquiry_config)){
|
||||||
|
throw new BusinessException( "当前医生未开通对应服务,请重新选择",HttpEnumCode::HTTP_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$inquiry_price = $doctor_inquiry_config['inquiry_price'] ?: 0;
|
||||||
|
|
||||||
|
if ($inquiry_type == 2){
|
||||||
|
$inquiry_price = $doctor_inquiry_config['SystemInquiryConfig']['inquiry_price'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $inquiry_price;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ class LoginService extends BaseService
|
|||||||
if (empty($phone_info) || empty($phone_info['phone_info']) || empty($phone_info['phone_info']['purePhoneNumber'])){
|
if (empty($phone_info) || empty($phone_info['phone_info']) || empty($phone_info['phone_info']['purePhoneNumber'])){
|
||||||
return fail(HttpEnumCode::GET_WX_ERROR);
|
return fail(HttpEnumCode::GET_WX_ERROR);
|
||||||
}
|
}
|
||||||
// $phone_info['phone_info']['purePhoneNumber'] = "18221234161";
|
// $phone_info['phone_info']['purePhoneNumber'] = "18221234162";
|
||||||
|
|
||||||
// 获取用户openid
|
// 获取用户openid
|
||||||
$wx_info_data = $weChat->codeToSession($wx_code);
|
$wx_info_data = $weChat->codeToSession($wx_code);
|
||||||
|
|||||||
@ -159,7 +159,8 @@ class OrderInquiryService extends BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取问诊价格
|
// 获取问诊价格
|
||||||
$inquiry_price = $this->getDoctorInquiryPrice($request_params['inquiry_type'],$request_params['inquiry_mode'],$request_params['doctor_id'] ?? "");
|
$DoctorInquiryService = new DoctorInquiryService();
|
||||||
|
$inquiry_price = $DoctorInquiryService->getDoctorInquiryPrice($request_params['inquiry_type'],$request_params['inquiry_mode'],$request_params['doctor_id'] ?? "");
|
||||||
|
|
||||||
// 获取可用优惠卷
|
// 获取可用优惠卷
|
||||||
$CouponService = new CouponService();
|
$CouponService = new CouponService();
|
||||||
@ -223,35 +224,4 @@ class OrderInquiryService extends BaseService
|
|||||||
// 添加至具体队列
|
// 添加至具体队列
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取问诊价格
|
|
||||||
* @param string|int $inquiry_type 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
|
||||||
* @param string|int $inquiry_mode 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
|
||||||
* @param string|int $doctor_id 医生id
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getDoctorInquiryPrice(string|int $inquiry_type, string|int $inquiry_mode,string|int $doctor_id): int
|
|
||||||
{
|
|
||||||
if (empty($doctor_id)){
|
|
||||||
throw new BusinessException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = array();
|
|
||||||
$params['doctor_id'] = $doctor_id;
|
|
||||||
$params['inquiry_type'] = $inquiry_type;
|
|
||||||
$params['inquiry_mode'] = $inquiry_mode;
|
|
||||||
$doctor_inquiry_config = DoctorInquiryConfig::getInquiryConfigOne($params);
|
|
||||||
if (empty($doctor_inquiry_config)){
|
|
||||||
throw new BusinessException( "当前医生未开通对应服务,请重新选择",HttpEnumCode::HTTP_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
$inquiry_price = $doctor_inquiry_config['inquiry_price'] ?: 0;
|
|
||||||
|
|
||||||
if ($inquiry_type == 2){
|
|
||||||
$inquiry_price = $doctor_inquiry_config['SystemInquiryConfig']['inquiry_price'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $inquiry_price;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -454,8 +454,12 @@ class UserDoctorService extends BaseService
|
|||||||
return success($order_prescriptions);
|
return success($order_prescriptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取医生个人中心数据
|
/**
|
||||||
public function getDoctorCenter(){
|
* 获取医生个人中心数据
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getDoctorCenter(): array
|
||||||
|
{
|
||||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||||
|
|
||||||
// 获取医生信息
|
// 获取医生信息
|
||||||
@ -487,6 +491,8 @@ class UserDoctorService extends BaseService
|
|||||||
return fail(HttpEnumCode::HTTP_ERROR, "请先完成多点执业认证");
|
return fail(HttpEnumCode::HTTP_ERROR, "请先完成多点执业认证");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user_doctor = $user_doctor->toArray();
|
||||||
|
|
||||||
// 获取账户余额
|
// 获取账户余额
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['doctor_id'] = $user_info['client_user_id'];
|
$params['doctor_id'] = $user_info['client_user_id'];
|
||||||
@ -496,22 +502,40 @@ class UserDoctorService extends BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取当日预计收益 当日接诊的订单金额*0.75
|
// 获取当日预计收益 当日接诊的订单金额*0.75
|
||||||
|
$estimate_income = $this->getDoctorOneDayEstimateIncome($user_info['client_user_id'],date('Y-m-d',time()));
|
||||||
|
|
||||||
|
$user_doctor['balance_account'] = $balance_account ?? 0;
|
||||||
|
$user_doctor['estimate_income'] = $estimate_income;
|
||||||
|
|
||||||
|
return success($user_doctor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取医生某天预计收益
|
/**
|
||||||
// 当日接诊的订单金额*0.75
|
* 获取医生某天预计收益
|
||||||
protected function getDoctorOneDayEstimateIncome(string $doctor_id,string $date){
|
* 当日接诊的订单金额*0.75
|
||||||
|
* @param string $doctor_id
|
||||||
|
* @param string $date
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
protected function getDoctorOneDayEstimateIncome(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 = array();
|
||||||
$params['doctor_id'] = $doctor_id;
|
$params['doctor_id'] = $doctor_id;
|
||||||
$params['inquiry_refund_status'] = 0; // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
$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['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||||
$params['settlement_status'] = 0; // 订单与医生结算状态(0:未结算 1:已结算)
|
$params['settlement_status'] = 0; // 订单与医生结算状态(0:未结算 1:已结算)
|
||||||
$params[] = ['reception_time','>' ,$date]; // 接诊时间(已接诊)
|
|
||||||
|
|
||||||
|
$reception_time = [$start_date,$end_date];
|
||||||
|
|
||||||
|
$amount_total_sum = OrderInquiry::getDoctorOneDayEstimateIncome($params,$reception_time);
|
||||||
|
|
||||||
|
return $amount_total_sum * 0.75;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user