From b428db8e99bd0a3a7a29e4525b76b755146d1c74 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 31 Mar 2023 17:28:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8D=AF=E5=B8=88=E5=88=86?= =?UTF-8?q?=E9=85=8D=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consumer/AssignPharmacistConsumer.php | 2 +- app/Controller/TestController.php | 27 ++++++-- app/Services/UserDoctorService.php | 62 +++++++++++++++++++ app/Services/UserPharmacistService.php | 12 +++- 4 files changed, 94 insertions(+), 9 deletions(-) diff --git a/app/Amqp/Consumer/AssignPharmacistConsumer.php b/app/Amqp/Consumer/AssignPharmacistConsumer.php index 5f63954..780c0d3 100644 --- a/app/Amqp/Consumer/AssignPharmacistConsumer.php +++ b/app/Amqp/Consumer/AssignPharmacistConsumer.php @@ -52,7 +52,7 @@ class AssignPharmacistConsumer extends ConsumerMessage // 分配药师 $params = array(); - $params['pharmacist_id'] = 3; + $params['pharmacist_id'] = "534534546"; $user_pharmacist = UserPharmacist::getOne($params); if (empty($user_pharmacist)){ Db::rollBack(); diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index a2af6aa..fffab3a 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -36,25 +36,42 @@ class TestController extends AbstractController // $this->test_6(); // $this->test_9(); // $this->test_10(); - $this->test_11(); +// $this->test_11(); // $this->test_5(); + $this->test_1(); } // 获取云证书-首次 public function test_1(){ $ca = new Ca(); +// $data = array(); +// $data['user_id'] = "491925054435950592"; +// $data['card_num'] = "410323199603261241"; +// $result = $ca->getCloudCert($data); +// +// $data = array(); +// $data['user_id'] = "491925054435950592"; +// $data['cert_base64'] = $result['certBase64']; +// $data['cert_chain_p7'] = $result['certP7']; +// $data['cert_serial_number'] = $result['certSerialnumber']; +// $data['ca_pin'] = "491925054435950592"; +// $doctor_pharmacist_cert = DoctorPharmacistCert::addDoctorPharmacistCert($data); +// if (empty($doctor_pharmacist_cert)){ +// return fail(); +// } + $data = array(); - $data['user_id'] = "491925054435950592"; - $data['card_num'] = "410323199603261241"; + $data['user_id'] = "534534546"; + $data['card_num'] = "410323199603261236"; $result = $ca->getCloudCert($data); $data = array(); - $data['user_id'] = "491925054435950592"; + $data['user_id'] = "534534546"; $data['cert_base64'] = $result['certBase64']; $data['cert_chain_p7'] = $result['certP7']; $data['cert_serial_number'] = $result['certSerialnumber']; - $data['ca_pin'] = "491925054435950592"; + $data['ca_pin'] = "534534546"; $doctor_pharmacist_cert = DoctorPharmacistCert::addDoctorPharmacistCert($data); if (empty($doctor_pharmacist_cert)){ return fail(); diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index d8f461e..c154d8a 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1014,6 +1014,14 @@ class UserDoctorService 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,"问诊订单数据为空"); + } + Db::beginTransaction(); try { @@ -1133,6 +1141,33 @@ class UserDoctorService extends BaseService $params['order_prescription_id'] = $order_prescription['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_doctor['user_id'], $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data); + // 加入分配药师队列 $data = array(); $data['order_prescription_id'] = $order_prescription_id; @@ -1328,6 +1363,33 @@ class UserDoctorService extends BaseService $params['order_prescription_id'] = $order_prescription->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_doctor['user_id'], $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data); + // 加入分配药师队列 $data = array(); $data['order_prescription_id'] = $order_prescription['order_prescription_id']; diff --git a/app/Services/UserPharmacistService.php b/app/Services/UserPharmacistService.php index 4e0fbb2..b1fd44b 100644 --- a/app/Services/UserPharmacistService.php +++ b/app/Services/UserPharmacistService.php @@ -209,7 +209,13 @@ class UserPharmacistService extends BaseService OrderPrescription::edit($params,$data); - + // 药师ca签章 + $OrderPrescriptionService = new OrderPrescriptionService(); + $prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription['order_prescription_id'],$user_info['user_id']); + if (empty($prescription_open_result['prescription_img_url']) || empty($prescription_open_result['prescription_pdf_url'])){ + Db::rollBack(); + return fail(HttpEnumCode::SERVER_ERROR, "处方审核失败"); + } // 发送消息 @@ -227,8 +233,8 @@ class UserPharmacistService extends BaseService // 消息内容 $message_content_data = array(); - $message_content_data['message_type'] = 6; - $message_content_data['title'] = "处方审核通过"; + $message_content_data['message_type'] = 7; + $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'];