新增药师审核
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Model\OrderInquiry;
|
||||
use App\Model\OrderPrescription;
|
||||
use App\Model\OrderPrescriptionProduct;
|
||||
use App\Model\User;
|
||||
use App\Model\UserPharmacist;
|
||||
use App\Model\UserPharmacistInfo;
|
||||
@@ -158,11 +160,72 @@ class UserPharmacistService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"处方已审核,请勿重复审核");
|
||||
}
|
||||
|
||||
// 获取处方订单数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (empty($order_inquiry)){
|
||||
return fail(HttpEnumCode::SERVER_ERROR,"问诊订单数据为空");
|
||||
}
|
||||
|
||||
// 获取处方商品数据
|
||||
$params = array();
|
||||
$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 (!empty($product_name)){
|
||||
$product_name = implode('、',$product_name);
|
||||
}
|
||||
}
|
||||
|
||||
Db::beginTransaction();
|
||||
|
||||
try {
|
||||
// 修改处方审核状态
|
||||
$data = array();
|
||||
if ($pharmacist_audit_status == 1){
|
||||
// 审核成功
|
||||
$data['prescription_status'] = 3;
|
||||
$data['pharmacist_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);
|
||||
|
||||
// 发送消息
|
||||
$ImService = new ImService();
|
||||
|
||||
// 发送消息
|
||||
$cloud_custom_data = array();
|
||||
$cloud_custom_data['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
||||
$cloud_custom_data['is_system'] = 1;
|
||||
$cloud_custom_data['inquiry_type'] = $order_inquiry['inquiry_type'];
|
||||
$cloud_custom_data['message_rounds'] = 0;
|
||||
$cloud_custom_data['patient_family_data']['patient_name'] = $order_inquiry['patient_name'];
|
||||
$cloud_custom_data['patient_family_data']['patient_sex'] = $order_inquiry['patient_sex'];
|
||||
$cloud_custom_data['patient_family_data']['patient_age'] = $order_inquiry['patient_age'];
|
||||
|
||||
// 消息内容
|
||||
$message_content_data = array();
|
||||
$message_content_data['message_type'] = 6;
|
||||
$message_content_data['title'] = "处方审核通过";
|
||||
$message_content_data['desc'] = "";
|
||||
$message_content_data['data']['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$message_content_data['data']['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
$message_content_data['data']['product_name'] = $product_name ?? "药品";
|
||||
$message_content_data['data']['pharmacist_verify_time'] = date('Y-m-d H:i:s',time());;
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$ImService->sendMessage($user_info['user_id'], $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
@@ -170,12 +233,6 @@ class UserPharmacistService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage());
|
||||
}
|
||||
|
||||
// 新增商品订单表
|
||||
// 新增商品订单明细表
|
||||
// 新增未支付取消订单队列
|
||||
|
||||
|
||||
|
||||
return success($order_prescription->toArray());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user