新增 获取患者问诊订单列表 接口
This commit is contained in:
@@ -1538,6 +1538,114 @@ class PatientOrderService extends BaseService
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者检测订单列表
|
||||
* @return array
|
||||
*/
|
||||
public function getPatientDetectionOrderList(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$detection_status = $this->request->input('detection_status', 0);
|
||||
$family_id = $this->request->input('family_id');
|
||||
$page = $this->request->input('page', 1);
|
||||
$per_page = $this->request->input('per_page', 10);
|
||||
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
if (!empty($family_id)) {
|
||||
$params['family_id'] = $family_id;
|
||||
}
|
||||
|
||||
$detection_status_params = [];
|
||||
if (!empty($detection_status) && $detection_status != 0) {
|
||||
// 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消)
|
||||
$detection_status_params = [$detection_status];
|
||||
}
|
||||
|
||||
$params['is_delete'] = 0;
|
||||
|
||||
$fields = [
|
||||
'order_detection_id',
|
||||
'patient_id',
|
||||
'doctor_id',
|
||||
'family_id',
|
||||
'detection_status',
|
||||
'is_delete',
|
||||
'detection_refund_status',
|
||||
'detection_pay_channel',
|
||||
'detection_pay_status',
|
||||
'detection_no',
|
||||
'escrow_trade_no',
|
||||
'amount_total',
|
||||
'payment_amount_total',
|
||||
'patient_name',
|
||||
'patient_name_mask',
|
||||
'patient_sex',
|
||||
'patient_age',
|
||||
'created_at',
|
||||
];
|
||||
dump($params);
|
||||
dump($detection_status_params);
|
||||
dump($fields);
|
||||
$order_detection = OrderDetection::getPatientOrderDetectionPage($params, $detection_status_params, $fields, $page, $per_page);
|
||||
if (empty($order_detection['data'])) {
|
||||
return success($order_detection);
|
||||
}
|
||||
|
||||
foreach ($order_detection['data'] as &$item) {
|
||||
// 获取医生数据
|
||||
$item['user_doctor'] = [];
|
||||
if (!empty($item['doctor_id'])) {
|
||||
$fields = [
|
||||
'doctor_id',
|
||||
'user_name',
|
||||
'doctor_title',
|
||||
'hospital_id',
|
||||
"avatar"
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $item['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params, $fields);
|
||||
if (empty($user_doctor)) {
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// 转换医生职称
|
||||
$user_doctor['doctor_title'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']);
|
||||
|
||||
// 获取医生医院名称
|
||||
$user_doctor['hospital_name'] = "";
|
||||
$user_doctor['hospital_level_name'] = "";
|
||||
|
||||
// 医生头像
|
||||
$user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']);
|
||||
|
||||
$fields = [
|
||||
'hospital_id',
|
||||
'hospital_name',
|
||||
'hospital_level_name',
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['hospital_id'] = $user_doctor['hospital_id'];
|
||||
$hospital = Hospital::getOne($params, $fields);
|
||||
if (!empty($hospital)) {
|
||||
$user_doctor['hospital_name'] = $hospital['hospital_name'];
|
||||
$user_doctor['hospital_level_name'] = $hospital['hospital_level_name'];
|
||||
}
|
||||
|
||||
$item['user_doctor'] = $user_doctor;
|
||||
unset($hospital);
|
||||
unset($user_doctor);
|
||||
}
|
||||
}
|
||||
|
||||
return success($order_detection);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取患者未完成订单
|
||||
* @param string $patient_id
|
||||
|
||||
Reference in New Issue
Block a user