diff --git a/app/Amqp/Consumer/SendStationMessageConsumer.php b/app/Amqp/Consumer/SendStationMessageConsumer.php index 845b28d..41fa573 100644 --- a/app/Amqp/Consumer/SendStationMessageConsumer.php +++ b/app/Amqp/Consumer/SendStationMessageConsumer.php @@ -38,31 +38,32 @@ class SendStationMessageConsumer extends ConsumerMessage } try { + // 发送消息 + $ImService = new ImService(); + + // 自定义消息 + $cloud_custom_data = array(); + $cloud_custom_data['order_inquiry_id'] = ""; + $cloud_custom_data['is_system'] = 1; + $cloud_custom_data['inquiry_type'] = ""; + $cloud_custom_data['message_rounds'] = ""; + + // 消息内容 + $message_content_data = array(); + $message_content_data['message_type'] = 1; + $message_content_data['content'] = "--等待医生接诊--"; + $message_content_data['desc'] = "温馨提示:您可继续补充问诊内容,便于更快确认病情,医生均在临床一线工作,还请耐心等待,医生接诊会第一时间短信通知您。"; + $message_content = [ + 'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE), + ]; + } catch (\Exception $e) { Log::getInstance()->error("站内消息推送执行失败:" . $e->getMessage()); } - // 处理推送参数 - $ImService = new ImService(); - // 发送消息 - // 自定义消息 - $cloud_custom_data = array(); - $cloud_custom_data['order_inquiry_id'] = "494837308861095936"; - $cloud_custom_data['is_system'] = 1; - $cloud_custom_data['inquiry_type'] = 1; - // 消息内容 - $message_content_data = array(); - $message_content_data['message_type'] = 1; - $message_content_data['content'] = "--测试--"; - $message_content_data['desc'] = "温馨提示:您可继续补充问诊内容,便于更快确认病情,医生均在临床一线工作,还请耐心等待,医生接诊会第一时间短信通知您。"; - $message_content = [ - 'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE), - ]; - - $ImService->sendMessage("491925054435950592", "492404831991414785", $message_content, "TIMCustomElem", $cloud_custom_data); Log::getInstance()->info("站内消息推送成功"); return Result::ACK; diff --git a/app/Controller/UserDoctorController.php b/app/Controller/UserDoctorController.php index 839b593..254cbd1 100644 --- a/app/Controller/UserDoctorController.php +++ b/app/Controller/UserDoctorController.php @@ -4,6 +4,8 @@ namespace App\Controller; use App\Amqp\Producer\PrescriptionDistributePhProducer; use App\Constants\HttpEnumCode; +use App\Model\OrderPrescriptionIcd; +use App\Model\OrderPrescriptionProduct; use App\Request\DoctorAuthRequest; use App\Request\UserDoctorRequest; use App\Services\DoctorAuthService; @@ -13,6 +15,7 @@ use App\Services\UserDoctorService; use Extend\TencentIm\Account; use Hyperf\Amqp\Producer; use Hyperf\DbConnection\Db; +use Hyperf\Snowflake\IdGeneratorInterface; use Hyperf\Utils\ApplicationContext; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; @@ -289,6 +292,25 @@ class UserDoctorController extends AbstractController */ public function addPrescription(): ResponseInterface { + +// $data = array(); +// $data['order_prescription_id'] = "498883041773666305"; +// $data['icd_id'] = 111; +// $order_prescription_icd = OrderPrescriptionIcd::addOrderPrescriptionIcd($data); +// if (empty($order_prescription_icd)) { +// dump(111); +// } +// die; +// $data = array(); +// $data['order_prescription_id'] = "498883041773666305"; +// $data['product_id'] = 2; +// $data['prescription_product_num'] = 1; +// $order_prescription_product = OrderPrescriptionProduct::addOrderPrescriptionProduct($data); +// if (empty($order_prescription_product)) { +// dump(111); +// } +// dump(222);die; + $request = $this->container->get(UserDoctorRequest::class); $request->scene('addPrescription')->validateResolved(); diff --git a/app/Model/OrderPrescriptionProduct.php b/app/Model/OrderPrescriptionProduct.php index b436f99..452865c 100644 --- a/app/Model/OrderPrescriptionProduct.php +++ b/app/Model/OrderPrescriptionProduct.php @@ -9,7 +9,6 @@ namespace App\Model; use Hyperf\Database\Model\Collection; use Hyperf\Database\Model\Model; use Hyperf\Database\Model\Relations\HasOne; -use Hyperf\Snowflake\Concern\Snowflake; /** * @property int $prescription_product_id 主键id @@ -28,12 +27,9 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property int $available_days 可用天数(3) * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 - * @property-read Product $Product */ class OrderPrescriptionProduct extends Model { - use Snowflake; - /** * The table associated with the model. */ diff --git a/app/Request/UserDoctorRequest.php b/app/Request/UserDoctorRequest.php index dd8d8c3..754e693 100644 --- a/app/Request/UserDoctorRequest.php +++ b/app/Request/UserDoctorRequest.php @@ -98,7 +98,7 @@ class UserDoctorRequest extends FormRequest 'province_id' => 'required|required_with:city_id,county_id', 'city_id' => 'required|required_with:county_id', 'county_id' => 'required', - 'pharmacist_audit_status' => 'required|integer|min:0|max:2', + 'pharmacist_audit_status' => 'required|integer|min:0|max:3', 'words_type' => 'required|integer|min:1|max:3', 'words' => 'required', 'doctor_id' => 'required', diff --git a/app/Services/ImService.php b/app/Services/ImService.php index 7b7cfbb..aa732d2 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -278,7 +278,7 @@ class ImService extends BaseService } // 发送自定义消息 - public function sendCustomMessage(string $from_user_id,string $to_user_id,string $content,string $order_inquiry_id,int $inquiry_type): void + public function sendCustomMessage(string $from_user_id,string $to_user_id,string $content,string $order_inquiry_id,int $inquiry_type, array $cloud_custom_data): void { if (!empty($from_user_id)){ // 检测并创建发送者资料 @@ -295,7 +295,7 @@ class ImService extends BaseService $arg['From_Account'] = $from_user_id; // 发送方user_id 如系统发送,无需填写 } $arg['To_Account'] = $to_user_id; // 接收方user_id - $arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback']; + $arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback','ForbidAfterSendMsgCallback']; $arg['SendMsgControl'] = ['NoUnread']; $arg['MsgBody'] = [ @@ -308,12 +308,10 @@ 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'] = json_encode($cloud_custom_data,JSON_UNESCAPED_UNICODE); + $arg['CloudCustomData'] = ""; + if (!empty($cloud_custom_data)){ + $arg['CloudCustomData'] = json_encode($cloud_custom_data,JSON_UNESCAPED_UNICODE); + } $message->sendMessage($arg); } diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 8488f73..af7c109 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -468,6 +468,8 @@ class UserDoctorService extends BaseService foreach ($order_prescriptions['data'] as $order_prescription) { $data = array(); + $data['order_prescription_id'] = $order_prescription['order_prescription_id']; + $data['order_inquiry_id'] = $order_prescription['order_inquiry_id']; $data['patient_name'] = $order_prescription['patient_name']; $data['patient_sex'] = $order_prescription['patient_sex']; $data['patient_age'] = $order_prescription['patient_age']; @@ -979,13 +981,7 @@ class UserDoctorService extends BaseService $params = array(); $params['doctor_id'] = $user_info['client_user_id']; - $fields = [ - 'doctor_id', - 'iden_auth_status', - 'idcard_status', - 'multi_point_status', - ]; - $user_doctor = UserDoctor::getOne($params, $fields); + $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)) { return fail(HttpEnumCode::HTTP_ERROR, "非法医生"); } @@ -1181,7 +1177,7 @@ class UserDoctorService extends BaseService // 检测处方是否重复开具 $params = array(); - $params['order_prescription_id'] = $order_inquiry['order_inquiry_id']; + $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; $params['doctor_id'] = $user_info['client_user_id']; $order_prescription = OrderPrescription::getOne($params); if (!empty($order_prescription)) {