患者个人中心,检测订单数量

This commit is contained in:
wucongxing 2023-08-28 16:40:39 +08:00
parent bb74835431
commit 962ed9b7b3
3 changed files with 29 additions and 0 deletions

View File

@ -155,4 +155,14 @@ class OrderDetection extends Model
return $data;
}
/**
* 获取数量
* @param array $params
* @return int
*/
public static function getCount(array $params): int
{
return self::where($params)->count();
}
}

View File

@ -953,4 +953,18 @@ class DetectionService extends BaseService
$params['order_detection_id'] = $order_detection['order_detection_id'];
OrderDetection::editOrderDetection($params, $data);
}
/**
* 获取患者某一状态下的检测订单数量
* @param string $patient_id 患者id
* @param int $detection_status 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消)
* @return int
*/
public function getPatientDetectionWithStatus(string $patient_id,int $detection_status): int
{
$params = array();
$params['patient_id'] = $patient_id;
$params['detection_status'] = $detection_status;
return OrderDetection::getCount($params);
}
}

View File

@ -59,6 +59,10 @@ class UserPatientService extends BaseService
$OrderProductService = new OrderProductService();
$order_product_count = $OrderProductService->getPatientProductWithStatus($user_patient['patient_id'],1);
// 获取检测数量-待支付
$detectionService = new DetectionService();
$order_detection_count = $detectionService->getPatientDetectionWithStatus($user_patient['patient_id'],1);
// 处理头像
$user_patient['avatar'] = addAliyunOssWebsite($user_patient['avatar']);
@ -70,6 +74,7 @@ class UserPatientService extends BaseService
$result['order_inquiry_count'] = $order_inquiry_count;
$result['order_prescription_count'] = $order_prescription_count;
$result['order_product_count'] = $order_product_count;
$result['order_detection_count'] = $order_detection_count;
return success($result);
}