新增自动完成订单,处理处方数据,修改获取问诊评价返回内容
This commit is contained in:
@@ -538,7 +538,7 @@ class InquiryService extends BaseService
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (empty($order_inquiry)) {
|
||||
return success();
|
||||
return success(null);
|
||||
}
|
||||
|
||||
// 检测是否评价过
|
||||
@@ -548,7 +548,7 @@ class InquiryService extends BaseService
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;;
|
||||
$order_evaluation = OrderEvaluation::getOne($params);
|
||||
if (empty($order_evaluation)) {
|
||||
return success();
|
||||
return success(null);
|
||||
}
|
||||
|
||||
$order_evaluation = $order_evaluation->toArray();
|
||||
|
||||
@@ -564,7 +564,7 @@ class OrderPrescriptionService extends BaseService
|
||||
}
|
||||
|
||||
// 上报处方平台
|
||||
public function reportPrescription(array $order_inquiry, array $order_prescription, array $order_prescription_product, array $order_product)
|
||||
public function reportPrescription(array $order_inquiry, array $order_prescription, array $order_prescription_product, array $order_product): array
|
||||
{
|
||||
$wg = new WaitGroup();
|
||||
$wg->add(8);
|
||||
@@ -810,4 +810,5 @@ class OrderPrescriptionService extends BaseService
|
||||
|
||||
return $arg;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1023,6 +1023,22 @@ class UserDoctorService extends BaseService
|
||||
return fail(HttpEnumCode::SERVER_ERROR,"问诊订单数据为空");
|
||||
}
|
||||
|
||||
if ($order_inquiry['inquiry_status'] == 5){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"问诊已完成,无法重开处方");
|
||||
}
|
||||
|
||||
if ($order_inquiry['inquiry_status'] == 6){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"问诊已结束,无法重开处方");
|
||||
}
|
||||
|
||||
if ($order_inquiry['inquiry_status'] == 7){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"问诊已取消,无法重开处方");
|
||||
}
|
||||
|
||||
if ($order_inquiry['inquiry_status'] != 4){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"问诊状态错误,无法重开处方");
|
||||
}
|
||||
|
||||
Db::beginTransaction();
|
||||
|
||||
try {
|
||||
@@ -1670,7 +1686,7 @@ class UserDoctorService extends BaseService
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (!empty($order_prescription)){
|
||||
if ($order_prescription['prescription_status'] == 1){
|
||||
if ($order_prescription['prescription_status'] == 1 && $order_prescription['pharmacist_audit_status'] == 0){
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "处方正在开具中,请您耐心等待,稍后取消");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Amqp\Consumer\PrescriptionExpiredDelayDirectConsumer;
|
||||
use App\Amqp\Producer\AutoFinishInquiryDelayDirectProducer;
|
||||
use App\Amqp\Producer\PrescriptionExpiredDelayDirectProducer;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Model\OrderInquiry;
|
||||
use App\Model\OrderPrescription;
|
||||
@@ -11,7 +14,10 @@ use App\Model\UserDoctor;
|
||||
use App\Model\UserDoctorInfo;
|
||||
use App\Model\UserPharmacist;
|
||||
use App\Model\UserPharmacistInfo;
|
||||
use Hyperf\Amqp\Producer;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* 药师
|
||||
@@ -123,6 +129,8 @@ class UserPharmacistService extends BaseService
|
||||
/**
|
||||
* 审核处方
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function putPrescriptionVerify(): array
|
||||
{
|
||||
@@ -181,6 +189,7 @@ class UserPharmacistService extends BaseService
|
||||
}
|
||||
|
||||
// 获取处方商品数据
|
||||
$product_name = "";
|
||||
$params = array();
|
||||
$params['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
$order_prescription_product = OrderPrescriptionProduct::getList($params);
|
||||
@@ -241,6 +250,19 @@ class UserPharmacistService extends BaseService
|
||||
// 发送目标不同,重新实例化
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->prescriptionVerifySuccess();
|
||||
|
||||
// 添加处方过期队列
|
||||
$data = array();
|
||||
$data['order_prescription_id'] = (string)$order_prescription['order_prescription_id'];
|
||||
|
||||
$message = new PrescriptionExpiredDelayDirectProducer($data);
|
||||
$message->setDelayMs(1000 * 60 * 60 * 24 * 3);
|
||||
$producer = $this->container->get(Producer::class);
|
||||
$res = $producer->produce($message);
|
||||
if (!$res) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败");
|
||||
}
|
||||
}else{
|
||||
// 站内、订阅失败发送短信-医生开具的处方审核未通过
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
|
||||
Reference in New Issue
Block a user