新增药师审核

This commit is contained in:
wucongxing 2023-03-30 09:33:33 +08:00
parent ad40e97d39
commit a6e58a9c17
5 changed files with 103 additions and 51 deletions

View File

@ -175,15 +175,10 @@ class CallBackController extends AbstractController
$message_content_data = array();
$message_content_data['message_type'] = 1;
$message_content_data['title'] = "--等待医生接诊--";
$message_content_data['desc'] = "";
if ($order_inquiry['inquiry_type'] == 1){
$message_content_data['desc'] = "温馨提示当前服务为专家问诊可以在24小时内和医生沟通20个回合。医生均为一线工作还请耐心等待医生接诊会第一时间短信通知您。";
} elseif ($order_inquiry['inquiry_type'] == 2){
$message_content_data['desc'] = "温馨提示:您可继续补充问诊内容,便于更快确认病情,医生均在临床一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
} elseif ($order_inquiry['inquiry_type'] == 3){
$message_content_data['desc'] = "温馨提示当前服务为公益问诊可以在24小时内和医生沟通10个回合。医生均为一线工作还请耐心等待医生接诊会第一时间短信通知您。";
} elseif ($order_inquiry['inquiry_type'] == 4){
}else{
$message_content_data['desc'] = "温馨提示当前服务为公益问诊可以在24小时内和医生沟通10个回合。医生均为一线工作还请耐心等待医生接诊会第一时间短信通知您。";
}

View File

@ -234,10 +234,10 @@ class ImService extends BaseService
* @param string $message_type 消息类型 具体查看https://cloud.tencent.com/document/product/269/2720
* @param array $cloud_custom_data 自定义字段
* @return void
* @throws GuzzleException
*/
public function sendMessage(string $from_user_id, string $to_user_id, array $message_content, string $message_type, array $cloud_custom_data): void
{
try {
if (!empty($from_user_id)){
// 检测并创建发送者资料
$this->setUserProfile($from_user_id);
@ -263,17 +263,16 @@ class ImService extends BaseService
]
];
// 自定义消息
// $cloud_custom_data = array();
// $cloud_custom_data['order_inquiry_id'] = $order_inquiry_id;
// $cloud_custom_data['is_system'] = 1;
// $cloud_custom_data['inquiry_type'] = $inquiry_type;
$arg['CloudCustomData'] = "";
if (!empty($cloud_custom_data)){
$arg['CloudCustomData'] = json_encode($cloud_custom_data,JSON_UNESCAPED_UNICODE);
}
$message->sendMessage($arg);
}catch (\Exception $e){
throw new BusinessException($e->getMessage());
} catch (GuzzleException $e) {
throw new BusinessException($e->getMessage());
}
}
}

View File

@ -31,6 +31,7 @@ use App\Utils\Log;
use App\Utils\Mask;
use App\Utils\PcreMatch;
use Extend\Wechat\WechatPay;
use GuzzleHttp\Exception\GuzzleException;
use Hyperf\Amqp\Producer;
use Hyperf\DbConnection\Db;
use Hyperf\Redis\Redis;
@ -777,7 +778,7 @@ class InquiryService extends BaseService
* @param string $order_inquiry_id
* @param string $refund_reason 退款原因
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws NotFoundExceptionInterface|GuzzleException
*/
public function inquiryRefund(string $order_inquiry_id, string $refund_reason)
{

View File

@ -25,7 +25,7 @@ class OrderPrescriptionService extends BaseService
}
/**
* 获取药师待审核处方-分页-存在问题,需修改
* 获取药师待审核处方-分页
* @param string $pharmacist_id 药师id
* @param int $pharmacist_audit_status 药师审核状态0:审核中 1:审核成功 2:审核驳回)
* @param int $platform_audit_status

View File

@ -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());
}