新增医生账户模型,修改省市区接口返回结构
This commit is contained in:
parent
5fe99b1c24
commit
5132a57752
@ -142,4 +142,15 @@ class UserDoctorController extends AbstractController
|
||||
$data = $UserDoctorService->getPrescriptionList();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生个人中心数据
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getDoctorCenter(): ResponseInterface
|
||||
{
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$data = $UserDoctorService->getDoctorCenter();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
64
app/Model/DoctorAccount.php
Normal file
64
app/Model/DoctorAccount.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $account_id 账户id
|
||||
* @property int $doctor_id 医生id
|
||||
* @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 修改时间
|
||||
*/
|
||||
class DoctorAccount extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'doctor_account';
|
||||
|
||||
/**
|
||||
* 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'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['account_id' => 'integer', 'doctor_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "account_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);
|
||||
}
|
||||
}
|
||||
@ -77,7 +77,7 @@ class OrderInquiry extends Model
|
||||
* @param array $data 新增数据
|
||||
* @return \Hyperf\Database\Model\Model|OrderInquiry
|
||||
*/
|
||||
public static function addUserDoctor(array $data): \Hyperf\Database\Model\Model|OrderInquiry
|
||||
public static function addOrderInquiry(array $data): \Hyperf\Database\Model\Model|OrderInquiry
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
@ -102,4 +102,16 @@ class OrderInquiry extends Model
|
||||
{
|
||||
return self::where($params)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生某天预计收益
|
||||
* @param array $params
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getDoctorOneDayEstimateIncome(array $params): mixed
|
||||
{
|
||||
return self::where($params)
|
||||
->whereIn('inquiry_status',[4,5,6])
|
||||
->sum("amount_total");
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,7 +113,8 @@ class AreaService extends BaseService
|
||||
public function getCity(): array
|
||||
{
|
||||
$area_id = $this->request->input('area_id');
|
||||
return $this->getAreaByParentId($area_id);
|
||||
$city = $this->getAreaByParentId($area_id);
|
||||
return success($city);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,7 +124,8 @@ class AreaService extends BaseService
|
||||
public function getCounty(): array
|
||||
{
|
||||
$area_id = $this->request->input('area_id');
|
||||
return $this->getAreaByParentId($area_id);
|
||||
$county = $this->getAreaByParentId($area_id);
|
||||
return success($county);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -185,7 +185,7 @@ class OrderInquiryService extends BaseService
|
||||
$data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码)
|
||||
$data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女)
|
||||
$data['patient_age'] = $patient_family['age'];// 患者年龄-就诊人
|
||||
$order_inquiry = OrderInquiry::addUserDoctor($data);
|
||||
$order_inquiry = OrderInquiry::addOrderInquiry($data);
|
||||
if (empty($order_inquiry)){
|
||||
return fail(HttpEnumCode::SERVER_ERROR,"订单创建失败");
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ use App\Exception\BusinessException;
|
||||
use App\Model\BasicBank;
|
||||
use App\Model\DiseaseClassExpertise;
|
||||
use App\Model\DiseaseClassIcd;
|
||||
use App\Model\DoctorAccount;
|
||||
use App\Model\DoctorBankCard;
|
||||
use App\Model\DoctorExpertise;
|
||||
use App\Model\DoctorInquiryConfig;
|
||||
@ -452,4 +453,65 @@ class UserDoctorService extends BaseService
|
||||
|
||||
return success($order_prescriptions);
|
||||
}
|
||||
|
||||
// 获取医生个人中心数据
|
||||
public function getDoctorCenter(){
|
||||
$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',
|
||||
];
|
||||
$user_doctor = UserDoctor::getOne($params, $fields);
|
||||
if (empty($user_doctor)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "非法医生");
|
||||
}
|
||||
|
||||
if ($user_doctor['iden_auth_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先完成身份认证");
|
||||
}
|
||||
|
||||
if ($user_doctor['idcard_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先完成实名认证");
|
||||
}
|
||||
|
||||
if ($user_doctor['multi_point_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先完成多点执业认证");
|
||||
}
|
||||
|
||||
// 获取账户余额
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$doctor_account = DoctorAccount::getOne($params);
|
||||
if (!empty($doctor_account)){
|
||||
$balance_account = $doctor_account['balance_account'];
|
||||
}
|
||||
|
||||
// 获取当日预计收益 当日接诊的订单金额*0.75
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 获取医生某天预计收益
|
||||
// 当日接诊的订单金额*0.75
|
||||
protected function getDoctorOneDayEstimateIncome(string $doctor_id,string $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:已结算)
|
||||
$params[] = ['reception_time','>' ,$date]; // 接诊时间(已接诊)
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -91,6 +91,12 @@ Router::addGroup('/doctor', function () {
|
||||
Router::put('/{bank_card_id:\d+}', [UserDoctorController::class, 'putDoctorBankCard']);
|
||||
});
|
||||
|
||||
// 个人中心
|
||||
Router::addGroup('/center', function () {
|
||||
// 获取医生个人中心数据
|
||||
Router::get('', [UserDoctorController::class, 'getDoctorCenter']);
|
||||
});
|
||||
|
||||
// 处方
|
||||
Router::addGroup('/prescription', function () {
|
||||
// 获取处方列表
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user