修改分配规则
This commit is contained in:
parent
22e6f174ab
commit
ed4e8cd7df
@ -120,33 +120,36 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
||||
$params['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
$order_prescription_product = OrderPrescriptionProduct::getList($params);
|
||||
if (!empty($order_prescription_product)){
|
||||
$product_name = array_column($order_prescription_product->toArray(),'product_name');
|
||||
if (count($product_name) > 1){
|
||||
$product_name = implode('、',$product_name);
|
||||
$product_name_array = array_column($order_prescription_product->toArray(),'product_name');
|
||||
if (count($product_name_array) > 1){
|
||||
$product_name = implode('、',$product_name_array);
|
||||
}else{
|
||||
$product_name = $product_name[0];
|
||||
$product_name = $product_name_array[0];
|
||||
}
|
||||
}
|
||||
|
||||
// 订单-处方
|
||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
||||
|
||||
// 下载医生签章文件
|
||||
Db::beginTransaction();
|
||||
try {
|
||||
Log::getInstance("queue-AutoPharmacistCaVerify")->info("检测执行次数");
|
||||
|
||||
// 检测执行次数
|
||||
$res = $this->checkHandleNumber($data['prescription_file_id']);
|
||||
if (!$res) {
|
||||
// 超出最大执行次数或检测错误
|
||||
// 自动驳回
|
||||
$OrderPrescriptionService->rejectPrescription(
|
||||
$data['order_prescription_id'],
|
||||
$user_doctor['user_id'],
|
||||
$user_patient['user_id'],
|
||||
$order_prescription['order_inquiry_id'],
|
||||
"请联系平台客服,请勿重开处方"
|
||||
);
|
||||
Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:超出最大执行次数或检测错误");
|
||||
|
||||
// 修改处方表为未通过
|
||||
$this->modifyOrderPrescription($data['prescription_file_id'],2,"请联系平台客服,请勿重开处方");
|
||||
|
||||
// 医生-开具的处方审核未通过
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'], $order_prescription['order_inquiry_id']);
|
||||
$MessagePush->prescriptionVerifyFail($data['order_prescription_id']);
|
||||
|
||||
// 患者-处方审核未通过
|
||||
$MessagePush = new MessagePush($user_patient['user_id'], $order_prescription['order_inquiry_id']);
|
||||
$MessagePush->patientPrescriptionVerifyFail();
|
||||
|
||||
Db::commit();
|
||||
return Result::ACK;
|
||||
}
|
||||
|
||||
@ -169,6 +172,8 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
||||
return Result::REQUEUE;
|
||||
}
|
||||
|
||||
Log::getInstance("queue-AutoPharmacistCaVerify")->info("下载医生的签章pdf并上传至oss");
|
||||
|
||||
// 下载医生的签章pdf并上传至oss
|
||||
$prescription_pdf_oss_path = $this->downCaPdfToOss($order_prescription, $user_doctor['user_id'],2,$order_prescription_file['doctor_ca_file_id']);
|
||||
if (!$prescription_pdf_oss_path) {
|
||||
@ -197,6 +202,9 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
||||
// 修改处方文件表,添加prescription_pdf_oss_path字段
|
||||
$this->modifyOrderPrescriptionFile($data['prescription_file_id'],$prescription_pdf_oss_path,$prescription_open_result['file_id']);
|
||||
|
||||
// 修改处方表为通过
|
||||
$this->modifyOrderPrescription($data['prescription_file_id'],1);
|
||||
|
||||
Db::commit();
|
||||
Log::getInstance("queue-AutoPharmacistCaVerify")->info("成功");
|
||||
} catch (\Exception $e) {
|
||||
@ -413,4 +421,31 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改处方表
|
||||
* @param string $order_prescription_id 处方id
|
||||
* @param int $status 审核状态 1:成功 2:驳回
|
||||
* @param string $pharmacist_fail_reason 驳回理由
|
||||
* @return void
|
||||
*/
|
||||
protected function modifyOrderPrescription(string $order_prescription_id,int $status,string $pharmacist_fail_reason = ""): void
|
||||
{
|
||||
// 修改处方审核状态
|
||||
$data = array();
|
||||
if ($status == 1){
|
||||
// 审核成功
|
||||
$data['prescription_status'] = 2;
|
||||
$data['pharmacist_audit_status'] = 1;
|
||||
$data['platform_audit_status'] = 1;
|
||||
}else{
|
||||
$data['pharmacist_audit_status'] = 2;
|
||||
$data['pharmacist_fail_reason'] = $pharmacist_fail_reason;
|
||||
}
|
||||
$data['pharmacist_verify_time'] = date('Y-m-d H:i:s',time());
|
||||
|
||||
$params = array();
|
||||
$params['order_prescription_id'] = $order_prescription_id;
|
||||
|
||||
OrderPrescription::edit($params,$data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,6 +106,7 @@ class OrderInquiryCase extends Model
|
||||
$query->where($order_inquiry_params);
|
||||
})
|
||||
->where($params)
|
||||
->orderBy('finish_time','desc')
|
||||
->first($fields);
|
||||
}
|
||||
|
||||
|
||||
@ -1260,7 +1260,7 @@ class MessagePush extends BaseService
|
||||
// 短信
|
||||
$sms_data = array();
|
||||
$sms_data['template_code'] = "SMS_272120097";
|
||||
$sms_data['scene_desc'] = "医生开具的处方审核通过";
|
||||
$sms_data['scene_desc'] = "您为${$this->order_inquiry['patient_name']}患者开具的电子处方药师已审核通过,尽快和患者完成交流并提醒患者购药。请前往微信小程序“问诊消息”进行操作。";
|
||||
$sms_data['phone'] = $this->user['mobile'];
|
||||
$sms_data['user_id'] = $this->user['user_id'];
|
||||
|
||||
@ -1319,7 +1319,7 @@ class MessagePush extends BaseService
|
||||
// 短信
|
||||
$sms_data = array();
|
||||
$sms_data['template_code'] = "SMS_271905264";
|
||||
$sms_data['scene_desc'] = "医生开具的处方审核未通过";
|
||||
$sms_data['scene_desc'] = "您为${$this->order_inquiry['patient_name']}患者开具的电子处方药师审核不通过,请尽快前往微信小程序“处方管理”中查看原因,并重开处方。模版code:SMS_271905264";
|
||||
$sms_data['phone'] = $this->user['mobile'];
|
||||
$sms_data['user_id'] = $this->user['user_id'];
|
||||
|
||||
|
||||
@ -480,7 +480,7 @@ class OrderPrescriptionService extends BaseService
|
||||
}
|
||||
|
||||
/**
|
||||
* 药师驳回处方
|
||||
* 驳回处方-修改处方表
|
||||
* @param string $order_prescription_id 处方id
|
||||
* @param string $doctor_user_id 医生user_id
|
||||
* @param string $patient_user_id 患者user_id
|
||||
|
||||
@ -1418,7 +1418,7 @@ class UserDoctorService extends BaseService
|
||||
if ($system_config['is_auto_phar_verify_prescription'] == 1){
|
||||
// 添加药师自动签章审核队列
|
||||
$data = array();
|
||||
$data['prescription_file_id'] = $prescription_open_result['file_id'];
|
||||
$data['prescription_file_id'] = (string)$order_prescription_file->prescription_file_id;
|
||||
$data['order_prescription_id'] = (string)$order_prescription->order_prescription_id;
|
||||
|
||||
$message = new AutoPharmacistCaVerifyDelayDirectProducer($data);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user