处理医生服务患者数量,处理医生好评率
This commit is contained in:
@@ -118,6 +118,12 @@ class AutoFinishInquiryDelayDirectConsumer extends ConsumerMessage
|
||||
// 处理回写患者病例-回写失败不做处理
|
||||
$this->handleOrderInquiryCase($order_inquiry);
|
||||
|
||||
// 处理医生服务患者数量
|
||||
$this->handleDoctorServedPatientsNum($order_inquiry['doctor_id']);
|
||||
|
||||
// 处理医生好评率
|
||||
$this->handleDoctorPraiseRate($order_inquiry['doctor_id']);
|
||||
|
||||
Db::commit();
|
||||
Log::getInstance()->info("自动结束问诊订单队列执行成功");
|
||||
return Result::ACK;
|
||||
@@ -383,5 +389,44 @@ class AutoFinishInquiryDelayDirectConsumer extends ConsumerMessage
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理医生服务患者数量
|
||||
* @param string $doctor_id
|
||||
* @return void
|
||||
*/
|
||||
protected function handleDoctorServedPatientsNum(string $doctor_id): void
|
||||
{
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
UserDoctor::inc($params,'served_patients_num');
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理医生好评率
|
||||
* @param string $doctor_id
|
||||
* @return float|int
|
||||
*/
|
||||
protected function handleDoctorPraiseRate(string $doctor_id): float|int
|
||||
{
|
||||
// 获取该医生全部问诊评价总数
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$order_evaluation_count = OrderEvaluation::getCount($params);
|
||||
if ($order_evaluation_count == 0){
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 获取该医生好评的评价总数
|
||||
$avg_score_params = [80, 100];
|
||||
$good_quantity = OrderEvaluation::getScoreCount($params, $avg_score_params);
|
||||
|
||||
$praise_rate = floor(($good_quantity / $order_evaluation_count) * 100) / 100;
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
|
||||
$data = array();
|
||||
$data['praise_rate'] = $praise_rate;
|
||||
UserDoctor::editUserDoctor($params,$data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user