From 4ff12d600e754d0210fc5c9e6f23d648730b9de9 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 19 Jul 2023 13:37:38 +0800 Subject: [PATCH 001/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=9A=E7=82=B9?= =?UTF-8?q?=E6=9C=AA=E5=A4=84=E7=90=86=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/TestController.php | 19 ++++++++----------- app/Services/DoctorAuthService.php | 2 +- extend/Wechat/Wechat.php | 12 ++++++------ 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 098f35c..5618ad6 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -377,26 +377,23 @@ class TestController extends AbstractController } $options = [ - "jump_wxa" => [ - "path" => "pages/expertDetail/expertDetail", + 'json' => [ + "path" => "pages/index/index", "query" => "doctor_id=539452507563012096", + "expire_type" => 1, + "expire_interval" => 1, "env_version" => $env_version, - ], - - "expire_type" => 1, - "expire_interval" => 1, - + ] ]; - $Wechat = new Wechat(1); - $result = $Wechat->createUrlScheme($options); + $result = $Wechat->createUrlLink($options); dump($result); $options = [ - "scheme" => $result['openlink'] + "url_link" => $result['url_link'] ]; - $result = $Wechat->getUrlScheme($options); + $result = $Wechat->getUrlLink($options); dump($result); } } \ No newline at end of file diff --git a/app/Services/DoctorAuthService.php b/app/Services/DoctorAuthService.php index 3104839..990ab29 100644 --- a/app/Services/DoctorAuthService.php +++ b/app/Services/DoctorAuthService.php @@ -722,7 +722,7 @@ class DoctorAuthService extends BaseService } if (empty($doctor_info_data)) { - return success(); + return fail(HttpEnumCode::HTTP_ERROR,"请您修改后再提交"); } Db::beginTransaction(); diff --git a/extend/Wechat/Wechat.php b/extend/Wechat/Wechat.php index d995513..1ee160e 100644 --- a/extend/Wechat/Wechat.php +++ b/extend/Wechat/Wechat.php @@ -344,7 +344,7 @@ class Wechat } /** - * 生成UrlScheme + * 生成UrlLink * @throws NotFoundExceptionInterface * @throws RedirectionExceptionInterface * @throws ContainerExceptionInterface @@ -353,14 +353,14 @@ class Wechat * @throws TransportExceptionInterface * @throws ServerExceptionInterface */ - public function createUrlScheme(array $options): array|string + public function createUrlLink(array $options): array|string { try { $this->createApp($this->config['app_id'], $this->config['secret']); $client = $this->createClient($this->config['app_id'], $this->config['secret']); - $response = $client->postJson('wxa/generatescheme', $options); + $response = $client->postJson('wxa/generate_urllink', $options); if ($response->isFailed()) { // 出错了,处理异常 @@ -382,7 +382,7 @@ class Wechat } /** - * 获取UrlScheme + * 获取UrlLink * @throws NotFoundExceptionInterface * @throws RedirectionExceptionInterface * @throws ContainerExceptionInterface @@ -391,14 +391,14 @@ class Wechat * @throws TransportExceptionInterface * @throws ServerExceptionInterface */ - public function getUrlScheme(array $options): array|string + public function getUrlLink(array $options): array|string { try { $this->createApp($this->config['app_id'], $this->config['secret']); $client = $this->createClient($this->config['app_id'], $this->config['secret']); - $response = $client->postJson('/wxa/queryscheme', $options); + $response = $client->postJson('wxa/query_urllink', $options); if ($response->isFailed()) { // 出错了,处理异常 From 98b442ca610232426ad266839451fe363443f836 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 26 Jul 2023 11:32:37 +0800 Subject: [PATCH 002/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B7=AF=E7=94=B1=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E7=94=A8=E6=88=B7=E5=9C=B0=E5=9D=80=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/UserController.php | 210 +----------------------------- app/Model/UserLocation.php | 79 +++++++++++ app/Services/SystemService.php | 1 - app/Services/UserService.php | 67 ++++++++++ config/config.php | 5 + config/routes.php | 43 ++++++ extend/Tencent/map/Location.php | 98 ++++++++++++++ 7 files changed, 298 insertions(+), 205 deletions(-) create mode 100644 app/Model/UserLocation.php create mode 100644 extend/Tencent/map/Location.php diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index 82a0825..b1a680b 100644 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -168,209 +168,11 @@ class UserController extends AbstractController return $this->response->json($data); } - // 支付测试 - public function testpay(){ - // 发起支付 - $out_trade_no = $this->request->input('out_trade_no'); -// $generator = $this->container->get(IdGeneratorInterface::class); -// -// $WechatPay = new WechatPay(1,2); -// -// // 获取预支付交易会话标识 -// $total = 0.01 * 100; -// $prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"omgU35DlE-rxTAGgcBjOuc4xdcX8"); -// if (empty($prepay)){ -// return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败"); -// } -// -// // 获取小程序支付配置 -// $pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']); -// return $this->response->json($pay_config); - - // 发起退款 -// $WechatPay = new WechatPay(1,2); -// -// $params = array(); -// $params['order_inquiry_id'] = 1; -// $order_inquiry = OrderInquiry::getOne($params); -// -// -// $options = array(); -// $options['transaction_id'] = "4200001756202303145016495897"; -// $options['out_refund_no'] = "123456"; -// $options['reason'] = "退款原因"; -// $options['amount'] = [ -// 'refund' => (int)1, -// 'total' => (int)1, -// 'currency' => "CNY", -// ]; -// -// $result = $WechatPay->refund($options); -// dump($result); - - // 创建账号 - $account = new Account(); - $profile = new Profile(); - $group = new Group(); - $friend = new Friend(); - $message = new Message(); -// $result = $account->createAccount(10009,'测试患者9',"https://img.applets.igandanyiyuan.com/applet/doctor/avatar/03dc8df2-e7c0-4ad9-b87e-5133e40e0f76.jpg"); - - // 查询账号导入状态 -// $result = $account->checkAccountStatus("123456"); - - // 设置账户资料 -// $arg = array(); -// $arg['Tag_Profile_IM_Gender'] = "Gender_Type_Male"; -// $arg['Tag_Profile_IM_BirthDay'] = 19961007; -// $arg['Tag_Profile_Custom_Hname'] = "协和医院"; -// $arg['Tag_Profile_Custom_Title'] = "主任医师"; -// $result = $profile->setProfile("123456",$arg); - - // 添加用户好友分组 -// $result = $group->addUserGroup('123456'); - - // 获取用户好友分组 -// $result = $group->getUserGroup('123456'); - - // 添加好友 -// $result = $friend->addFriend("123456",'1234567',"快速问诊"); - - // 发送消息 -// $arg = array(); -//// $arg['From_Account'] = "10000"; // 发送方user_id 如系统发送,无需填写 -// $arg['To_Account'] = "10000"; // 接收方user_id -//// $arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback']; -//// $arg['SendMsgControl'] = []; -// -// $arg['MsgBody'] = [ -//// [ -//// "MsgType" => "TIMTextElem", -//// "MsgContent" => [ -//// "Text" => "ceshi", -//// ], -//// ] -// [ -// "MsgType" => "TIMCustomElem", -// "MsgContent" => [ -// "Data" => "{\"message_type\":1,\"content\":\"\"}", -// "Desc" => "自定义消息", -// "Ext" => "url", -// "Sound" => "dingdong.aiff", -// ], -// ] -// ]; -// -// // 自定义消息 -// $cloud_custom_data = array(); -// $cloud_custom_data['order_inquiry_id'] = 1; -// $cloud_custom_data['is_system'] = 0; -// $cloud_custom_data['inquiry_type'] = 2; -// -// $arg['CloudCustomData'] = json_encode($cloud_custom_data,JSON_UNESCAPED_UNICODE); -// -// $result = $message->sendMessage($arg); -// -//// $result = $profile->getOneAccountPortraitList("123456"); -// -// dump($result); - - - // 专家-公益,发送im消息 -// $ImService = new ImService(); -// -// // 获取订单医生数据 -// $params = array(); -// $params['doctor_id'] = "491925054779883520"; -// $user_doctor = UserDoctor::getOne($params); -// if (empty($user_doctor)){ -// Log::getInstance()->info("医生数据错误"); -// } -// -// // 发送消息 -// $ImService->sendMessage($user_doctor['user_id'],"491923510680424449","等待医生接诊",491937904055369728); - -// -// $data = array(); -// $data['order_inquiry_id'] = 4; -// $data['to_user_id'] = 10004; -// $data['patient_name'] = "用户4"; -// $data['patient_sex'] = 2; -// $data['patient_age'] = 19; -// $data['inquiry_status'] = 1; -// $data['message_send_time'] = 1678112190; -// $data['message_seq'] = 101; -// $data['message_type'] = "TIMTextElem"; -// $data['last_message_content']['Text'] = "测试消息4"; -// -// $imService = new ImService(); -// $imService->addRecentContactRecordCache("491925054779883520", 2, 10004, $data); - - // 银行卡三要素认证 -// $BankCard = new BankCard(); -// -// $params = array(); -// $params['bankCardNo'] = "6217000010175646317"; -// $params['name'] = "吴从兴"; -// $params['idCardNo'] = "372929199610075412"; -// $res = $BankCard->checkBankCard($params); -// if (!empty($res)) { -// return fail(HttpEnumCode::HTTP_ERROR, $res); -// } - - // 对接处方平台 -// $Prescription = new Prescription(); -// $token = $Prescription->getProd(); -// dump($token); - - // 创建im账号 -// $account = new Account(); - // 创建单个账号 -// $account->createAccount("111295","测试患者1",""); -// $profile = new Profile(); -// $result = $profile->getOneAccountPortraitList("111295"); -// dump($result); -// $arg = array(); -// $arg['Tag_Profile_IM_Image'] = "https://img.applets.igandanyiyuan.com/applet/doctor/avatar/03dc8df2-e7c0-4ad9-b87e-5133e40e0f76.jpg"; -// $profile->setProfile("111295",$arg); - -// $ImService = new ImService(); -// $ImService->setUserProfile("491925054435950592"); - -// $Prescription = new Prescription(); -// $token = $Prescription->getLogisticsFee(); -// dump($token); - - -// $ImService = new ImService(); -// -// // 发送消息 -// $ImService->sendMessage("491925054435950592","492404831991414785","等待医生接诊","494837308861095936",1); - - - -// $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); -// -// $RecentContact = new RecentContact(); -// $result = $RecentContact->getRecentContactPage(); - - + // 上报用户地址 + public function postLocation(): ResponseInterface + { + $UserService = new UserService(); + $data = $UserService->postLocation(); + return $this->response->json($data); } } \ No newline at end of file diff --git a/app/Model/UserLocation.php b/app/Model/UserLocation.php new file mode 100644 index 0000000..5717387 --- /dev/null +++ b/app/Model/UserLocation.php @@ -0,0 +1,79 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增-批量 + * @param array $data 新增数据 + * @return \Hyperf\Database\Model\Model|UserLocation + */ + public static function addUserLocation(array $data): \Hyperf\Database\Model\Model|UserLocation + { + return self::create($data); + } + + /** + * 修改-批量 + * @param array $params + * @param array $data + * @return int + */ + public static function editUserLocation(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } +} diff --git a/app/Services/SystemService.php b/app/Services/SystemService.php index c6d7d60..8a30d61 100644 --- a/app/Services/SystemService.php +++ b/app/Services/SystemService.php @@ -47,7 +47,6 @@ class SystemService extends BaseService return fail(); } - dump($system_inquiry_time->toArray()); $time = []; foreach ($system_inquiry_time as $item){ $start_hour = substr($item['start_time'], 0, 1); diff --git a/app/Services/UserService.php b/app/Services/UserService.php index f597bed..17f3604 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -9,10 +9,12 @@ use App\Model\User; use App\Model\User as UserModel; use App\Model\UserDoctor; use App\Model\UserDoctorInfo; +use App\Model\UserLocation; use App\Model\UserPatient; use App\Model\UserShipAddress; use App\Utils\Mask; use App\Utils\PcreMatch; +use Extend\Tencent\map\Location; use Extend\TencentIm\Profile; use Extend\Wechat\Wechat; use GuzzleHttp\Exception\GuzzleException; @@ -553,6 +555,71 @@ class UserService extends BaseService return success($popup->toArray()); } + /** + * 上报用户地址 + * @return array + */ + public function postLocation(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + $request_params = $this->request->all(); + + if (empty($request_params['lon']) || empty($request_params['lat'])){ + return success(); + } + + // 处理地址逆解析 + try { + $location = new Location(); + $result = $location->getLocation($request_params['lon'],$request_params['lat']); + if (empty($result)){ + return success(); + } + + if (empty($result['address_component'])){ + return success(); + } + + if (empty($result['address_component']['province']) || empty($result['address_component']['city'])){ + return success(); + } + + // 处理需修改/新增数据 + $data = array(); + $data['lon'] = $request_params['lon']; + $data['lat'] = $request_params['lat']; + $data['province'] = $result['address_component']['province']; + $data['city'] = $result['address_component']['city']; + $data['county'] = $result['address_component']['district'] ?: ""; + $data['address'] = $result['address_component']['street_number'] ?: ""; + + // 获取用户地理位置 + $params = array(); + $params['user_id'] = $user_info['user_id']; + $user_location = UserLocation::getOne($params); + if (empty($user_location)){ + // 新增 + $data['user_id'] = $user_info['user_id']; + $user_location = UserLocation::addUserLocation($data); + if (empty($user_location)){ + return success(); + } + }else{ + // 修改 + $params = array(); + $params['user_id'] = $user_info['user_id']; + $res = UserLocation::editUserLocation($params,$data); + if (!$res){ + return success(); + } + } + }catch (\Exception $e){ + return success(); + } + + return success(); + } + /** * 通过user_id获取用户openid * @param string|int $user_id diff --git a/config/config.php b/config/config.php index 3197055..8b0ae64 100644 --- a/config/config.php +++ b/config/config.php @@ -11,6 +11,7 @@ declare(strict_types=1); */ use Hyperf\Contract\StdoutLoggerInterface; use Psr\Log\LogLevel; +use function Hyperf\Support\env; return [ 'app_name' => env('APP_NAME', 'gdxz'), @@ -109,4 +110,8 @@ return [ "api_url" => env('LOGISTICS_APP_URL', 'https://poll.kuaidi100.com/poll/query.do'), "salt" => env('LOGISTICS_SALT', 'gdxz2023.d'), ], + 'tencent_map' => [ // 腾讯地图 + "secret" => env('TENCENT_MAP_SECRET', 'RDQBZ-SDQ6Z-GKRX5-TG7P5-R2LN5-BWFCH'), + "key" => env('TENCENT_MAP_KEY', '6tZo4VootrcGOuYqRX9aoGdtAmuSNXd4') + ], ]; diff --git a/config/routes.php b/config/routes.php index 47dd9f2..9f66210 100644 --- a/config/routes.php +++ b/config/routes.php @@ -265,6 +265,15 @@ Router::addGroup('/patient', function () { Router::get('/lowest-price', [InquiryController::class, 'getInquiryLowestPrice']); }); + // 检测 + Router::addGroup('/detection', function () { + // 创建检测订单 + Router::post('', [InquiryController::class, 'addDetectionOrder']); + + // 获取检测机构合作医生列表 + Router::get('/doctor', [InquiryController::class, 'getDetectionDoctor']); + }); + // 医生数据 Router::addGroup('/doctor', function () { // 获取医生列表-问诊 @@ -410,6 +419,24 @@ Router::addGroup('/patient', function () { Router::delete('/{order_prescription_id:\d+}', [PatientOrderController::class, 'deletePatientPrescriptionOrder']); }); + // 检测订单 + Router::addGroup('/detection', function () { + // 获取患者检测订单列表 + Router::get('', [PatientOrderController::class, 'getPatientDetectionOrderList']); + + // 获取患者检测订单详情 + Router::get('/{order_detection_id:\d+}', [PatientOrderController::class, 'getPatientDetectionOrderInfo']); + + // 删除检测订单 + Router::delete('/{order_detection_id:\d+}', [PatientOrderController::class, 'deletePatientDetectionOrder']); + + // 取消检测订单 + Router::put('/cancel/{order_detection_id:\d+}', [PatientOrderController::class, 'putCancelPatientDetectionOrder']); + + // 检测订单取消支付 + Router::put('/cancel-pay/{order_detection_id:\d+}', [PatientOrderController::class, 'putPatientDetectionOrderCancelPay']); + }); + // 获取患者订单支付数据 Router::get('/pay', [PatientOrderController::class, 'getPatientOrderPayInfo']); @@ -552,6 +579,9 @@ Router::addGroup('/basic', function () { // 获取热门搜索关键词 Router::get('/keyword/search', [BasicDataController::class, 'getHotSearchKeyword']); + + // 获取检测疾病分类列表 + Router::get('/detection/disease', [BasicDataController::class, 'getDetectionDisease']); }); // 获取医生评价 @@ -578,6 +608,7 @@ Router::addGroup('/callback', function () { // 退款回调 Router::post('/refund', [CallBackController::class, 'wxPayInquiryRefundCallBack']); }); + // 药品 Router::addGroup('/product', function () { // 支付成功回调 @@ -586,6 +617,15 @@ Router::addGroup('/callback', function () { // 退款回调 Router::post('/refund', [CallBackController::class, 'wxPayProductRefundCallBack']); }); + + // 检测 + Router::addGroup('/detection', function () { + // 支付成功回调 + Router::post('/success', [CallBackController::class, 'wxPayDetectionSuccessCallBack']); + + // 退款回调 + Router::post('/refund', [CallBackController::class, 'wxPayDetectionRefundCallBack']); + }); }); // im回调 @@ -611,6 +651,9 @@ Router::addGroup('/user', function () { // 退出登陆 Router::put('/loginout', [UserController::class, 'putLoginout']); + + // 上报用户地址 + Router::post('/location', [UserController::class, 'postLocation']); }); // 获取患者问诊病例 diff --git a/extend/Tencent/map/Location.php b/extend/Tencent/map/Location.php new file mode 100644 index 0000000..d8b8838 --- /dev/null +++ b/extend/Tencent/map/Location.php @@ -0,0 +1,98 @@ +container = ApplicationContext::getContainer(); + $this->client = $this->container->get(Client::class); + } + + /** + * 计算签名 + * @param string $path + * @param array $query + * @return string + */ + private function getSign(string $path,array $query): string + { + ksort($query); + + // 拼接请求参数 + $queryString = urldecode(http_build_query($query)); + + // 拼接签名字符串 + $signatureStr = $path . '?' . $queryString . config("tencent_map.key"); + + // 计算签名,取MD5的小写形式 + $sig = md5($signatureStr); + + // 将签名添加到参数中 + $query['sig'] = $sig; + return $path . '?' . http_build_query($query); + } + /** + * 逆地址解析-根据经纬度获取地址 + * @param string $lon 经度,范围为 -180~180,负数表示西经 + * @param string $lat 纬度,范围为 -90~90,负数表示南纬 + * @return array + */ + public function getLocation(string $lon,string $lat): array + { + $query = [ + "key" => config("tencent_map.secret"), + "location" => $lon . "," . $lat, + ]; + + $path = "https://apis.map.qq.com" . $this->getSign("/ws/geocoder/v1",$query); + try { + $response = $this->client->get($path); + if ($response->getStatusCode() != '200') { + // 请求失败 + throw new BusinessException($response->getBody()->getContents()); + } + $body = json_decode($response->getBody(), true); + if (empty($body)) { + // 返回值为空 + throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR)); + } + + if ($body['status'] != 0){ + throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR)); + } + + if (empty($body['result'])){ + return []; + } + + return $body['result']; + } catch (GuzzleException $e) { + throw new BusinessException($e->getMessage()); + } + } +} \ No newline at end of file From d7adc01b8437d29d1c628fcb92419417919e1819 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 26 Jul 2023 15:50:46 +0800 Subject: [PATCH 003/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=90=88=E4=BD=9C=E5=85=AC=E5=8F=B8=E6=A3=80=E6=B5=8B=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/DetectionController.php | 28 ++++++++++ app/Model/BasicCompany.php | 73 +++++++++++++++++++++++++ app/Model/DetectionProject.php | 76 ++++++++++++++++++++++++++ app/Request/DetectionRequest.php | 46 ++++++++++++++++ app/Services/DetectionService.php | 42 ++++++++++++++ config/routes.php | 4 ++ 6 files changed, 269 insertions(+) create mode 100644 app/Controller/DetectionController.php create mode 100644 app/Model/BasicCompany.php create mode 100644 app/Model/DetectionProject.php create mode 100644 app/Request/DetectionRequest.php create mode 100644 app/Services/DetectionService.php diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php new file mode 100644 index 0000000..b0f990c --- /dev/null +++ b/app/Controller/DetectionController.php @@ -0,0 +1,28 @@ +container->get(DetectionRequest::class); + $request->scene('getDetectionProjectList')->validateResolved(); + + $detectionService = new DetectionService(); + $data = $detectionService->getDetectionProjectList(); + return $this->response->json($data); + } +} \ No newline at end of file diff --git a/app/Model/BasicCompany.php b/app/Model/BasicCompany.php new file mode 100644 index 0000000..df2e14b --- /dev/null +++ b/app/Model/BasicCompany.php @@ -0,0 +1,73 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增-批量 + * @param array $data 新增数据 + * @return \Hyperf\Database\Model\Model|BasicCompany + */ + public static function addBasicCompany(array $data): \Hyperf\Database\Model\Model|BasicCompany + { + return self::create($data); + } + + /** + * 修改-批量 + * @param array $params + * @param array $data + * @return int + */ + public static function editBasicCompany(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } +} diff --git a/app/Model/DetectionProject.php b/app/Model/DetectionProject.php new file mode 100644 index 0000000..e295e0e --- /dev/null +++ b/app/Model/DetectionProject.php @@ -0,0 +1,76 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增-批量 + * @param array $data 新增数据 + * @return \Hyperf\Database\Model\Model|DetectionProject + */ + public static function addBasicCompany(array $data): \Hyperf\Database\Model\Model|DetectionProject + { + return self::create($data); + } + + /** + * 修改-批量 + * @param array $params + * @param array $data + * @return int + */ + public static function editBasicCompany(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } +} diff --git a/app/Request/DetectionRequest.php b/app/Request/DetectionRequest.php new file mode 100644 index 0000000..39d736a --- /dev/null +++ b/app/Request/DetectionRequest.php @@ -0,0 +1,46 @@ + [ // 获取合作公司检测项目列表 + 'company_id', + ], + ]; + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } + + /** + * Get the validation rules that apply to the request. + */ + public function rules(): array + { + return [ + 'company_id' => 'required', + 'detection_project_id' => 'required', + ]; + } + + /** + * 获取已定义验证规则的错误消息. + */ + public function messages(): array + { + return [ + 'company_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + ]; + } +} diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php new file mode 100644 index 0000000..282c4f0 --- /dev/null +++ b/app/Services/DetectionService.php @@ -0,0 +1,42 @@ +request->getAttribute("userInfo") ?? []; + $company_id = $this->request->input("company_id",1); +// $detection_project_id = $this->request->input("detection_project_id",1); + + // 获取合作公司数据 + $params = array(); + $params['company_id'] = $company_id; + $basic_company = BasicCompany::getOne($params); + if (empty($basic_company)){ + return fail(); + } + + // 获取项目数据 + $params = array(); + $params['company_id'] = $company_id; + $detection_project = DetectionProject::getList($params); + if (empty($detection_project)){ + return fail(); + } + + foreach ($detection_project as &$value){ + $value['img_path'] = addAliyunOssWebsite($value['img_path']); + } + + return success($detection_project->toArray()); + } +} \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index 9f66210..32163a4 100644 --- a/config/routes.php +++ b/config/routes.php @@ -13,6 +13,7 @@ declare(strict_types=1); use App\Controller\AreaController; use App\Controller\BasicDataController; use App\Controller\CallBackController; +use App\Controller\DetectionController; use App\Controller\DoctorAccountController; use App\Controller\DoctorAuthController; use App\Controller\IndexController; @@ -272,6 +273,9 @@ Router::addGroup('/patient', function () { // 获取检测机构合作医生列表 Router::get('/doctor', [InquiryController::class, 'getDetectionDoctor']); + + // 获取合作公司检测项目列表 + Router::get('/project', [DetectionController::class, 'getDetectionProjectList']); }); // 医生数据 From 822756c39c4f6876e4e0c776c62388c4a47e13b4 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 26 Jul 2023 16:00:05 +0800 Subject: [PATCH 004/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=90=88=E4=BD=9C=E5=85=AC=E5=8F=B8=E6=A3=80=E6=B5=8B=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/DetectionController.php | 13 +++++++++ app/Services/DetectionService.php | 40 ++++++++++++++++++++++---- config/routes.php | 3 ++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php index b0f990c..20a3644 100644 --- a/app/Controller/DetectionController.php +++ b/app/Controller/DetectionController.php @@ -25,4 +25,17 @@ class DetectionController extends AbstractController $data = $detectionService->getDetectionProjectList(); return $this->response->json($data); } + + /** + * 获取合作公司检测项目 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function getDetectionProject(): ResponseInterface + { + $detectionService = new DetectionService(); + $data = $detectionService->getDetectionProject(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 282c4f0..2556027 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -13,9 +13,7 @@ class DetectionService extends BaseService */ public function getDetectionProjectList(): array { - $user_info = $this->request->getAttribute("userInfo") ?? []; $company_id = $this->request->input("company_id",1); -// $detection_project_id = $this->request->input("detection_project_id",1); // 获取合作公司数据 $params = array(); @@ -28,14 +26,44 @@ class DetectionService extends BaseService // 获取项目数据 $params = array(); $params['company_id'] = $company_id; - $detection_project = DetectionProject::getList($params); + $detection_projects = DetectionProject::getList($params); + if (empty($detection_projects)){ + return fail(); + } + + foreach ($detection_projects as &$value){ + $value['img_path'] = addAliyunOssWebsite($value['img_path']); + } + + return success($detection_projects->toArray()); + } + + /** + * 获取合作公司检测项目 + * @return array + */ + public function getDetectionProject(): array + { + $company_id = $this->request->input("company_id",1); + $detection_project_id = $this->request->route('detection_project_id',1); + + // 获取合作公司数据 + $params = array(); + $params['company_id'] = $company_id; + $basic_company = BasicCompany::getOne($params); + if (empty($basic_company)){ + return fail(); + } + + // 获取项目数据 + $params = array(); + $params['detection_project_id'] = $detection_project_id; + $detection_project = DetectionProject::getOne($params); if (empty($detection_project)){ return fail(); } - foreach ($detection_project as &$value){ - $value['img_path'] = addAliyunOssWebsite($value['img_path']); - } + $detection_project['img_path'] = addAliyunOssWebsite($detection_project['img_path']); return success($detection_project->toArray()); } diff --git a/config/routes.php b/config/routes.php index 32163a4..659cb03 100644 --- a/config/routes.php +++ b/config/routes.php @@ -276,6 +276,9 @@ Router::addGroup('/patient', function () { // 获取合作公司检测项目列表 Router::get('/project', [DetectionController::class, 'getDetectionProjectList']); + + // 获取合作公司检测项目列表 + Router::get('/project/{detection_project_id:\d+}', [DetectionController::class, 'getDetectionProject']); }); // 医生数据 From 174770cdb3a24db2d90d27a768d0fa017c99e2be Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 27 Jul 2023 09:11:26 +0800 Subject: [PATCH 005/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E7=96=BE=E7=97=85=E5=88=86=E7=B1=BB=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/BasicDataController.php | 16 ++++++ app/Controller/DetectionController.php | 4 +- app/Model/DiseaseClassDetection.php | 77 ++++++++++++++++++++++++++ app/Request/BasicDataRequest.php | 5 ++ app/Services/BasicDataService.php | 21 +++++++ app/Services/DetectionService.php | 2 +- config/routes.php | 4 +- 7 files changed, 123 insertions(+), 6 deletions(-) create mode 100644 app/Model/DiseaseClassDetection.php diff --git a/app/Controller/BasicDataController.php b/app/Controller/BasicDataController.php index a1ef98b..52bf0ea 100644 --- a/app/Controller/BasicDataController.php +++ b/app/Controller/BasicDataController.php @@ -204,4 +204,20 @@ class BasicDataController extends AbstractController $data = $BasicDataService->getHotSearchKeyword(); return $this->response->json($data); } + + /** + * 获取检测疾病分类列表 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function getDetectionDiseaseList(): ResponseInterface + { + $request = $this->container->get(BasicDataRequest::class); + $request->scene('getDetectionDiseaseList')->validateResolved(); + + $BasicDataService = new BasicDataService(); + $data = $BasicDataService->getDetectionDiseaseList(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php index 20a3644..e832871 100644 --- a/app/Controller/DetectionController.php +++ b/app/Controller/DetectionController.php @@ -27,10 +27,8 @@ class DetectionController extends AbstractController } /** - * 获取合作公司检测项目 + * 获取合作公司检测项目详情 * @return ResponseInterface - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface */ public function getDetectionProject(): ResponseInterface { diff --git a/app/Model/DiseaseClassDetection.php b/app/Model/DiseaseClassDetection.php new file mode 100644 index 0000000..0202e68 --- /dev/null +++ b/app/Model/DiseaseClassDetection.php @@ -0,0 +1,77 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增-批量 + * @param array $data 新增数据 + * @return \Hyperf\Database\Model\Model|DiseaseClassDetection + */ + public static function addDiseaseClassDetection(array $data): \Hyperf\Database\Model\Model|DiseaseClassDetection + { + return self::create($data); + } + + /** + * 修改-批量 + * @param array $params + * @param array $data + * @return int + */ + public static function editDiseaseClassDetection(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } +} diff --git a/app/Request/BasicDataRequest.php b/app/Request/BasicDataRequest.php index af81eae..513a55c 100644 --- a/app/Request/BasicDataRequest.php +++ b/app/Request/BasicDataRequest.php @@ -28,6 +28,9 @@ class BasicDataRequest extends FormRequest 'client_type', 'keyword_place', ], + 'getDetectionDiseaseList' => [ // 获取检测疾病分类列表 + 'detection_project_id', + ], ]; /** @@ -49,6 +52,7 @@ class BasicDataRequest extends FormRequest 'disease_class_name' => 'required', 'client_type' => 'required|integer|min:1|max:1', 'keyword_place' => 'required|integer|min:1|max:1', + 'detection_project_id' => 'required', ]; } @@ -69,6 +73,7 @@ class BasicDataRequest extends FormRequest 'keyword_place.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'keyword_place.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'keyword_place.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'detection_project_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), ]; } } diff --git a/app/Services/BasicDataService.php b/app/Services/BasicDataService.php index 21b12b9..74bd041 100644 --- a/app/Services/BasicDataService.php +++ b/app/Services/BasicDataService.php @@ -8,6 +8,7 @@ use App\Model\BasicDoctorTitle; use App\Model\BasicJob; use App\Model\BasicNation; use App\Model\DiseaseClass; +use App\Model\DiseaseClassDetection; use App\Model\DiseaseClassExpertise; use App\Model\DiseaseClassIcd; use App\Model\Hospital; @@ -394,4 +395,24 @@ class BasicDataService extends BaseService return success($hot_search_keyword->toArray()); } + + /** + * 获取检测疾病分类列表 + * @return array + */ + public function getDetectionDiseaseList(): array + { + $detection_project_id = $this->request->route('detection_project_id',1); + + $params = array(); + $params['detection_project_id'] = $detection_project_id; + $params['status'] = 1; + $params['enable'] = 1; + $disease_class_detections = DiseaseClassDetection::getList($params); + if (empty($disease_class_detections)){ + return success(); + } + + return success($disease_class_detections->toArray()); + } } \ No newline at end of file diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 2556027..bbaf9ef 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -39,7 +39,7 @@ class DetectionService extends BaseService } /** - * 获取合作公司检测项目 + * 获取合作公司检测项目详情 * @return array */ public function getDetectionProject(): array diff --git a/config/routes.php b/config/routes.php index 659cb03..19c8f15 100644 --- a/config/routes.php +++ b/config/routes.php @@ -277,7 +277,7 @@ Router::addGroup('/patient', function () { // 获取合作公司检测项目列表 Router::get('/project', [DetectionController::class, 'getDetectionProjectList']); - // 获取合作公司检测项目列表 + // 获取合作公司检测项目详情 Router::get('/project/{detection_project_id:\d+}', [DetectionController::class, 'getDetectionProject']); }); @@ -588,7 +588,7 @@ Router::addGroup('/basic', function () { Router::get('/keyword/search', [BasicDataController::class, 'getHotSearchKeyword']); // 获取检测疾病分类列表 - Router::get('/detection/disease', [BasicDataController::class, 'getDetectionDisease']); + Router::get('/detection/disease', [BasicDataController::class, 'getDetectionDiseaseList']); }); // 获取医生评价 From 8d9498371465ff889cdb76220c26887143355693 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 27 Jul 2023 10:00:46 +0800 Subject: [PATCH 006/176] 1 --- Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index baaf62fcb..7f62de7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,10 +49,6 @@ WORKDIR /opt/www COPY . /opt/www -#RUN apk add --no-cache $PHPIZE_DEPS \ -# && pecl8 install imagick \ -# && echo "extension=imagick.so" > /etc/php8/conf.d/imagick.ini - RUN composer install --no-dev -o && php bin/hyperf.php EXPOSE 9501 From d9552cfb2a6a8d0383471bd7983e900fc4c28bbe Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 27 Jul 2023 10:43:12 +0800 Subject: [PATCH 007/176] 1 --- composer.lock | 263 +++++++++++++++++++++++++------------------------- 1 file changed, 133 insertions(+), 130 deletions(-) diff --git a/composer.lock b/composer.lock index 9794d00..91a63b4 100644 --- a/composer.lock +++ b/composer.lock @@ -1367,8 +1367,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/async-queue/v3.0.18", - "reference": "075b9a68e927f92586e6fecd627aa81987b15ab8", - "shasum": "075b9a68e927f92586e6fecd627aa81987b15ab8" + "reference": "d8fd56d9643a2f8f7406cc05306531aec4b95de0", + "shasum": "d8fd56d9643a2f8f7406cc05306531aec4b95de0" }, "require": { "hyperf/codec": "~3.0.0", @@ -1424,12 +1424,12 @@ }, { "name": "hyperf/cache", - "version": "v3.0.18", + "version": "v3.0.26", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/cache/v3.0.18", - "reference": "2fea543251e0534966b46da801d5cd1e44634234", - "shasum": "2fea543251e0534966b46da801d5cd1e44634234" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/cache/v3.0.26", + "reference": "db83b8a49202aa391a8bc23b7bfd450a27283061", + "shasum": "db83b8a49202aa391a8bc23b7bfd450a27283061" }, "require": { "hyperf/codec": "~3.0.0", @@ -1486,8 +1486,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/code-parser/v3.0.18", - "reference": "5998a7e6e2a524f9455f72d371e354ea9de7aea1", - "shasum": "5998a7e6e2a524f9455f72d371e354ea9de7aea1" + "reference": "09cf5238ff84284c3200d7faff552adfc14a6ebf", + "shasum": "09cf5238ff84284c3200d7faff552adfc14a6ebf" }, "require": { "hyperf/collection": "~3.0.0", @@ -1534,12 +1534,12 @@ }, { "name": "hyperf/codec", - "version": "v3.0.1", + "version": "v3.0.30", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/codec/v3.0.1", - "reference": "cf8faab62e202497f7b0617b9da94989928f03a6", - "shasum": "cf8faab62e202497f7b0617b9da94989928f03a6" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/codec/v3.0.30", + "reference": "b9424b52cfca296fc819d785fff30c7eea36cd3b", + "shasum": "b9424b52cfca296fc819d785fff30c7eea36cd3b" }, "require": { "ext-json": "*", @@ -1547,6 +1547,9 @@ "hyperf/contract": "~3.0.0", "php": ">=8.0" }, + "suggest": { + "ext-igbinary": "Required to use IgbinarySerializerPacker." + }, "type": "library", "extra": { "branch-alias": { @@ -1582,12 +1585,12 @@ }, { "name": "hyperf/collection", - "version": "v3.0.21", + "version": "v3.0.29", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/collection/v3.0.21", - "reference": "68c966f9abdb1e8f45d7f2da4d51c98adca0bf40", - "shasum": "68c966f9abdb1e8f45d7f2da4d51c98adca0bf40" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/collection/v3.0.29", + "reference": "455aa584f4b5277c46b4c2a3e76b03417054a3e6", + "shasum": "455aa584f4b5277c46b4c2a3e76b03417054a3e6" }, "require": { "hyperf/contract": "~3.0.0", @@ -1632,12 +1635,12 @@ }, { "name": "hyperf/command", - "version": "v3.0.23", + "version": "v3.0.27", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/command/v3.0.23", - "reference": "6d2f6f1c47a6fcde4942c55b3187af553d26ef34", - "shasum": "6d2f6f1c47a6fcde4942c55b3187af553d26ef34" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/command/v3.0.27", + "reference": "73d3160c752913676d8ada632d498ec423fe425b", + "shasum": "73d3160c752913676d8ada632d498ec423fe425b" }, "require": { "hyperf/support": "~3.0.0", @@ -1682,8 +1685,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/conditionable/v3.0.0", - "reference": "ccf122831ec2de36ca5ebb9bd4af4250dcc23faf", - "shasum": "ccf122831ec2de36ca5ebb9bd4af4250dcc23faf" + "reference": "acf1854ba2beadaa7a2248e46f44841bf4e57c67", + "shasum": "acf1854ba2beadaa7a2248e46f44841bf4e57c67" }, "require": { "php": ">=7.4" @@ -1727,8 +1730,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/config/v3.0.20", - "reference": "ef3b89a6a18de66ad53fafab56ad8e6672eab992", - "shasum": "ef3b89a6a18de66ad53fafab56ad8e6672eab992" + "reference": "44d1e4636661f0572512a94169fd2a2bfbbc8b2d", + "shasum": "44d1e4636661f0572512a94169fd2a2bfbbc8b2d" }, "require": { "hyperf/collection": "~3.0.0", @@ -1791,8 +1794,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/constants/v3.0.18", - "reference": "8c0ed1b3dfa609a860c6d2d5fcd0eb1c0b8721e2", - "shasum": "8c0ed1b3dfa609a860c6d2d5fcd0eb1c0b8721e2" + "reference": "714b07a448671f5c09b907a8d3bcd570bb1396a9", + "shasum": "714b07a448671f5c09b907a8d3bcd570bb1396a9" }, "require": { "hyperf/di": "~3.0.0", @@ -1844,8 +1847,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/context/v3.0.18", - "reference": "a0cc2890dcca459103077f5d87ba2717765adff7", - "shasum": "a0cc2890dcca459103077f5d87ba2717765adff7" + "reference": "79de6266d5c0603d545362a0657856e13e357a46", + "shasum": "79de6266d5c0603d545362a0657856e13e357a46" }, "require": { "hyperf/engine": "^1.2|^2.0", @@ -1890,8 +1893,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/contract/v3.0.10", - "reference": "38be2f4fbfaea03cb50a0bab6d67f2d2067bf95a", - "shasum": "38be2f4fbfaea03cb50a0bab6d67f2d2067bf95a" + "reference": "6f5eb5e3d979e1fabbc7e1bd7e80c98121a5d14a", + "shasum": "6f5eb5e3d979e1fabbc7e1bd7e80c98121a5d14a" }, "require": { "php": ">=8.0" @@ -1929,8 +1932,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/coordinator/v3.0.22", - "reference": "f049e6b73a90f056201aa9805c06693b5e35de7b", - "shasum": "f049e6b73a90f056201aa9805c06693b5e35de7b" + "reference": "614412a4502ad06b31f628711444bd56f1e3ee22", + "shasum": "614412a4502ad06b31f628711444bd56f1e3ee22" }, "require": { "hyperf/engine": "^1.2|^2.0", @@ -1975,8 +1978,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/coroutine/v3.0.16", - "reference": "06b3b38fc2e8095b37a4feabbcf345907069c40a", - "shasum": "06b3b38fc2e8095b37a4feabbcf345907069c40a" + "reference": "7f1d81bba50f1af8f6b909b771c3e9269619fa29", + "shasum": "7f1d81bba50f1af8f6b909b771c3e9269619fa29" }, "require": { "hyperf/context": "~3.0.0", @@ -2073,18 +2076,18 @@ }, { "name": "hyperf/database", - "version": "v3.0.23", + "version": "v3.0.30", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/database/v3.0.23", - "reference": "6aa54f1716838ea676527c0994131765ace1615c", - "shasum": "6aa54f1716838ea676527c0994131765ace1615c" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/database/v3.0.30", + "reference": "0d56e81769593fa693de44ab80ac9882eb905b38", + "shasum": "0d56e81769593fa693de44ab80ac9882eb905b38" }, "require": { "hyperf/code-parser": "~3.0.0", "hyperf/collection": "~3.0.0", "hyperf/macroable": "~3.0.0", - "hyperf/support": "~3.0.0", + "hyperf/support": "~3.0.24", "hyperf/tappable": "~3.0.0", "hyperf/utils": "~3.0.0", "nesbot/carbon": "^2.0", @@ -2187,12 +2190,12 @@ }, { "name": "hyperf/di", - "version": "v3.0.18", + "version": "v3.0.24", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/di/v3.0.18", - "reference": "66d5e92683cfaa9927cb22b8716c3f419c5d27c5", - "shasum": "66d5e92683cfaa9927cb22b8716c3f419c5d27c5" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/di/v3.0.24", + "reference": "53969f159a586b7256927fab837f0675db777a3e", + "shasum": "53969f159a586b7256927fab837f0675db777a3e" }, "require": { "doctrine/instantiator": "^1.0", @@ -2249,18 +2252,18 @@ }, { "name": "hyperf/dispatcher", - "version": "v3.0.16", + "version": "v3.0.24", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/dispatcher/v3.0.16", - "reference": "84352950c76ff1ef0307dd39758abaaf47baa5f6", - "shasum": "84352950c76ff1ef0307dd39758abaaf47baa5f6" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/dispatcher/v3.0.24", + "reference": "eca5620db1a71a5b9b485ae22a5fcd2f62260258", + "shasum": "eca5620db1a71a5b9b485ae22a5fcd2f62260258" }, "require": { "hyperf/contract": "~3.0.0", "php": ">=8.0", "psr/container": "^1.0|^2.0", - "psr/http-message": "^1.0", + "psr/http-message": "^1.0|^2.0", "psr/http-server-middleware": "^1.0" }, "type": "library", @@ -2358,8 +2361,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/event/v3.0.0", - "reference": "408040612e36cd93ae9c362ce29e6962c42c3fa1", - "shasum": "408040612e36cd93ae9c362ce29e6962c42c3fa1" + "reference": "687743ca1f3643276f19bd232180221814431ee1", + "shasum": "687743ca1f3643276f19bd232180221814431ee1" }, "require": { "hyperf/contract": "~3.0.0", @@ -2407,12 +2410,12 @@ }, { "name": "hyperf/exception-handler", - "version": "v3.0.18", + "version": "v3.0.24", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/exception-handler/v3.0.18", - "reference": "af8fb12072a02bc27d68f2c60eaded462ed04f37", - "shasum": "af8fb12072a02bc27d68f2c60eaded462ed04f37" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/exception-handler/v3.0.24", + "reference": "6c024d3021cf0c115c3ac80eb8c92e365cb1c2c7", + "shasum": "6c024d3021cf0c115c3ac80eb8c92e365cb1c2c7" }, "require": { "hyperf/contract": "~3.0.0", @@ -2421,7 +2424,7 @@ "hyperf/utils": "~3.0.0", "php": ">=8.0", "psr/container": "^1.0|^2.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0|^2.0" }, "type": "library", "extra": { @@ -2464,8 +2467,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/framework/v3.0.23", - "reference": "099520f283efa109b2f83f7a7b0bfddc2c1109ba", - "shasum": "099520f283efa109b2f83f7a7b0bfddc2c1109ba" + "reference": "990cc53e7230d165ef94d06faa31837b196e9dcd", + "shasum": "990cc53e7230d165ef94d06faa31837b196e9dcd" }, "require": { "fig/http-message-util": "^1.1.2", @@ -2524,18 +2527,18 @@ }, { "name": "hyperf/guzzle", - "version": "v3.0.18", + "version": "v3.0.24", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/guzzle/v3.0.18", - "reference": "aa0e36ce1d78cc402ea449def1409ed827e53381", - "shasum": "aa0e36ce1d78cc402ea449def1409ed827e53381" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/guzzle/v3.0.24", + "reference": "ede3ea8aca5fa88163ad706ba0e2234a4e9e73cd", + "shasum": "ede3ea8aca5fa88163ad706ba0e2234a4e9e73cd" }, "require": { "guzzlehttp/guzzle": "^6.3|^7.0", "php": ">=8.0", "psr/container": "^1.0|^2.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0|^2.0" }, "suggest": { "ext-curl": "Required for CURL handler support", @@ -2577,8 +2580,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/http-message/v3.0.18", - "reference": "f3798dee017f6008762aedac9013dff2d28adc83", - "shasum": "f3798dee017f6008762aedac9013dff2d28adc83" + "reference": "1fed954be30f9ff185360efe5f6f4b774e70194b", + "shasum": "1fed954be30f9ff185360efe5f6f4b774e70194b" }, "require": { "hyperf/codec": "~3.0.0", @@ -2624,12 +2627,12 @@ }, { "name": "hyperf/http-server", - "version": "v3.0.21", + "version": "v3.0.24", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/http-server/v3.0.21", - "reference": "7f774afe695e67be93928f5da53cf42d5f1e9280", - "shasum": "7f774afe695e67be93928f5da53cf42d5f1e9280" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/http-server/v3.0.24", + "reference": "23bf6fd698b22177dfe8a7595c6956becb04c9d9", + "shasum": "23bf6fd698b22177dfe8a7595c6956becb04c9d9" }, "require": { "hyperf/codec": "~3.0.0", @@ -2695,8 +2698,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/logger/v3.0.20", - "reference": "efcddc1c332416bca5066e8c5a7788124247ab6f", - "shasum": "efcddc1c332416bca5066e8c5a7788124247ab6f" + "reference": "b41374876dbf782bc330223b1b0c3df2c51337e4", + "shasum": "b41374876dbf782bc330223b1b0c3df2c51337e4" }, "require": { "hyperf/contract": "~3.0.0", @@ -2748,8 +2751,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/macroable/v3.0.0", - "reference": "d0f1abc8761af3c8a4884c04ff5234cc8524da20", - "shasum": "d0f1abc8761af3c8a4884c04ff5234cc8524da20" + "reference": "b76659a7708e3508b84a7cc8a0b99d4e0a6119e3", + "shasum": "b76659a7708e3508b84a7cc8a0b99d4e0a6119e3" }, "require": { "php": ">=7.4" @@ -2837,8 +2840,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/model-listener/v3.0.18", - "reference": "2d85b84b58c6f1492c47230f86f03323e574aa41", - "shasum": "2d85b84b58c6f1492c47230f86f03323e574aa41" + "reference": "15a7741288efc696f88abba7683e74a0413a41db", + "shasum": "15a7741288efc696f88abba7683e74a0413a41db" }, "require": { "hyperf/contract": "~3.0.0", @@ -2943,8 +2946,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/pipeline/v3.0.16", - "reference": "86393ceaed5d20a5585e82e4295839b201593bd3", - "shasum": "86393ceaed5d20a5585e82e4295839b201593bd3" + "reference": "351149a128c9be0e8388f5c77baab1464a391253", + "shasum": "351149a128c9be0e8388f5c77baab1464a391253" }, "require": { "php": ">=8.0", @@ -2989,8 +2992,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/pool/v3.0.18", - "reference": "5e2d307bc3bb2ac9a5b9acb669a58bb8f46627b6", - "shasum": "5e2d307bc3bb2ac9a5b9acb669a58bb8f46627b6" + "reference": "a51177e8c498d2231151593fcb95e92d168c5ebc", + "shasum": "a51177e8c498d2231151593fcb95e92d168c5ebc" }, "require": { "hyperf/contract": "~3.0.0", @@ -3041,8 +3044,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/process/v3.0.22", - "reference": "2d3d44e56c0f4a4b89a2b438f66fe7100f9bfaee", - "shasum": "2d3d44e56c0f4a4b89a2b438f66fe7100f9bfaee" + "reference": "06ea5fa5b3267eb2685715b7679b69f968e61986", + "shasum": "06ea5fa5b3267eb2685715b7679b69f968e61986" }, "require": { "hyperf/contract": "~3.0.0", @@ -3098,8 +3101,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/redis/v3.0.21", - "reference": "e024c702a0a172833d5fb76ba70cf934d0c450cb", - "shasum": "e024c702a0a172833d5fb76ba70cf934d0c450cb" + "reference": "21510bbfa31387643ae7ac138368b58b93e61cf6", + "shasum": "21510bbfa31387643ae7ac138368b58b93e61cf6" }, "require": { "ext-redis": "*", @@ -3157,8 +3160,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/serializer/v3.0.0", - "reference": "ba5813f2442362aced81765b5f76fadadc6df86c", - "shasum": "ba5813f2442362aced81765b5f76fadadc6df86c" + "reference": "ba7659a4f9928aa6f46c47649d1b9fa2fed379c8", + "shasum": "ba7659a4f9928aa6f46c47649d1b9fa2fed379c8" }, "require": { "hyperf/contract": "~3.0.0", @@ -3207,12 +3210,12 @@ }, { "name": "hyperf/server", - "version": "v3.0.20", + "version": "v3.0.24", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/server/v3.0.20", - "reference": "f66c6b9e8789666582a943f446ccf124f8b4f7b2", - "shasum": "f66c6b9e8789666582a943f446ccf124f8b4f7b2" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/server/v3.0.24", + "reference": "8129ef965778acb97b0977d751e9a7b17c85ba21", + "shasum": "8129ef965778acb97b0977d751e9a7b17c85ba21" }, "require": { "hyperf/contract": "~3.0.0", @@ -3316,12 +3319,12 @@ }, { "name": "hyperf/stringable", - "version": "v3.0.18", + "version": "v3.0.27", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/stringable/v3.0.18", - "reference": "b8dfc08254ec0385a7361f82720c8995091a3d83", - "shasum": "b8dfc08254ec0385a7361f82720c8995091a3d83" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/stringable/v3.0.27", + "reference": "17cf616de2698100364d0381861fc18fd64a3f07", + "shasum": "17cf616de2698100364d0381861fc18fd64a3f07" }, "require": { "hyperf/collection": "~3.0.0", @@ -3373,12 +3376,12 @@ }, { "name": "hyperf/support", - "version": "v3.0.1", + "version": "v3.0.24", "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/support/v3.0.1", - "reference": "c0baef1766969c3deb18a52a6065555e6f44b721", - "shasum": "c0baef1766969c3deb18a52a6065555e6f44b721" + "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/support/v3.0.24", + "reference": "2f30401ef07803829376334b2afdaa05a17af358", + "shasum": "2f30401ef07803829376334b2afdaa05a17af358" }, "require": { "hyperf/collection": "~3.0.0", @@ -3434,8 +3437,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/tappable/v3.0.0", - "reference": "4953925063af0d335eede9b1357403e9a0ad9340", - "shasum": "4953925063af0d335eede9b1357403e9a0ad9340" + "reference": "5833fabfe5b6161265d9debce5be422cab854b52", + "shasum": "5833fabfe5b6161265d9debce5be422cab854b52" }, "require": { "php": ">=7.4" @@ -3530,8 +3533,8 @@ "dist": { "type": "zip", "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/utils/v3.0.18", - "reference": "459bcaf608c2c748f9736bff64bd1df7090c5a12", - "shasum": "459bcaf608c2c748f9736bff64bd1df7090c5a12" + "reference": "52a46ef030af6351ec6634987a71d15ba36f6d76", + "shasum": "52a46ef030af6351ec6634987a71d15ba36f6d76" }, "require": { "doctrine/inflector": "^2.0", @@ -3978,16 +3981,16 @@ }, { "name": "nesbot/carbon", - "version": "2.67.0", + "version": "2.68.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "c1001b3bc75039b07f38a79db5237c4c529e04c8" + "reference": "4f991ed2a403c85efbc4f23eb4030063fdbe01da" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/nesbot/carbon/2.67.0/nesbot-carbon-2.67.0.zip", - "reference": "c1001b3bc75039b07f38a79db5237c4c529e04c8", + "url": "https://mirrors.huaweicloud.com/repository/php/nesbot/carbon/2.68.1/nesbot-carbon-2.68.1.zip", + "reference": "4f991ed2a403c85efbc4f23eb4030063fdbe01da", "shasum": "" }, "require": { @@ -4070,7 +4073,7 @@ "type": "tidelift" } ], - "time": "2023-05-25T22:09:47+00:00" + "time": "2023-06-20T18:29:04+00:00" }, { "name": "nikic/fast-route", @@ -4119,16 +4122,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.5", + "version": "v4.16.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e" + "reference": "19526a33fb561ef417e822e85f08a00db4059c17" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/nikic/php-parser/v4.15.5/nikic-php-parser-v4.15.5.zip", - "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e", + "url": "https://mirrors.huaweicloud.com/repository/php/nikic/php-parser/v4.16.0/nikic-php-parser-v4.16.0.zip", + "reference": "19526a33fb561ef417e822e85f08a00db4059c17", "shasum": "" }, "require": { @@ -4166,7 +4169,7 @@ "parser", "php" ], - "time": "2023-05-19T20:20:00+00:00" + "time": "2023-06-25T14:52:30+00:00" }, { "name": "nyholm/psr7", @@ -4477,16 +4480,16 @@ }, { "name": "php-amqplib/php-amqplib", - "version": "v3.5.3", + "version": "v3.5.4", "source": { "type": "git", "url": "https://github.com/php-amqplib/php-amqplib.git", - "reference": "bccaaf8ef8bcf18b4ab41e645e92537752b887bd" + "reference": "1aecbd182b35eb039667c50d7d92d71f105be779" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/php-amqplib/php-amqplib/v3.5.3/php-amqplib-php-amqplib-v3.5.3.zip", - "reference": "bccaaf8ef8bcf18b4ab41e645e92537752b887bd", + "url": "https://mirrors.huaweicloud.com/repository/php/php-amqplib/php-amqplib/v3.5.4/php-amqplib-php-amqplib-v3.5.4.zip", + "reference": "1aecbd182b35eb039667c50d7d92d71f105be779", "shasum": "" }, "require": { @@ -4549,7 +4552,7 @@ "queue", "rabbitmq" ], - "time": "2023-04-03T18:25:49+00:00" + "time": "2023-07-01T11:25:08+00:00" }, { "name": "php-di/phpdoc-reader", @@ -4660,16 +4663,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.20", + "version": "3.0.21", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "543a1da81111a0bfd6ae7bbc2865c5e89ed3fc67" + "reference": "4580645d3fc05c189024eb3b834c6c1e4f0f30a1" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/phpseclib/phpseclib/3.0.20/phpseclib-phpseclib-3.0.20.zip", - "reference": "543a1da81111a0bfd6ae7bbc2865c5e89ed3fc67", + "url": "https://mirrors.huaweicloud.com/repository/php/phpseclib/phpseclib/3.0.21/phpseclib-phpseclib-3.0.21.zip", + "reference": "4580645d3fc05c189024eb3b834c6c1e4f0f30a1", "shasum": "" }, "require": { @@ -4761,7 +4764,7 @@ "type": "tidelift" } ], - "time": "2023-06-13T06:30:34+00:00" + "time": "2023-07-09T15:24:48+00:00" }, { "name": "psr/cache", @@ -8139,16 +8142,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.26", + "version": "9.2.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/phpunit/php-code-coverage/9.2.26/phpunit-php-code-coverage-9.2.26.zip", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "url": "https://mirrors.huaweicloud.com/repository/php/phpunit/php-code-coverage/9.2.27/phpunit-php-code-coverage-9.2.27.zip", + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", "shasum": "" }, "require": { @@ -8207,7 +8210,7 @@ "type": "github" } ], - "time": "2023-03-06T12:58:08+00:00" + "time": "2023-07-26T13:44:30+00:00" }, { "name": "phpunit/php-file-iterator", @@ -8432,16 +8435,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.9", + "version": "9.6.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a9aceaf20a682aeacf28d582654a1670d8826778" + "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/phpunit/phpunit/9.6.9/phpunit-phpunit-9.6.9.zip", - "reference": "a9aceaf20a682aeacf28d582654a1670d8826778", + "url": "https://mirrors.huaweicloud.com/repository/php/phpunit/phpunit/9.6.10/phpunit-phpunit-9.6.10.zip", + "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328", "shasum": "" }, "require": { @@ -8525,7 +8528,7 @@ "type": "tidelift" } ], - "time": "2023-06-11T06:13:56+00:00" + "time": "2023-07-10T04:04:23+00:00" }, { "name": "sebastian/cli-parser", From 4b68edfc28aa9678dba779efac0746bc9012ee97 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 27 Jul 2023 14:07:45 +0800 Subject: [PATCH 008/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=9C=BA=E6=9E=84=E5=90=88=E4=BD=9C=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E5=88=97=E8=A1=A8=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/DetectionController.php | 16 ++++ app/Model/UserDoctor.php | 28 ++++++ app/Request/DetectionRequest.php | 3 + app/Services/DetectionService.php | 118 +++++++++++++++++++++++++ config/routes.php | 2 +- 5 files changed, 166 insertions(+), 1 deletion(-) diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php index e832871..ce55016 100644 --- a/app/Controller/DetectionController.php +++ b/app/Controller/DetectionController.php @@ -36,4 +36,20 @@ class DetectionController extends AbstractController $data = $detectionService->getDetectionProject(); return $this->response->json($data); } + + /** + * 获取检测机构合作医生列表 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function getDetectionDoctorList(): ResponseInterface + { + $request = $this->container->get(DetectionRequest::class); + $request->scene('getDetectionDoctorList')->validateResolved(); + + $detectionService = new DetectionService(); + $data = $detectionService->getDetectionDoctorList(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index c7a505e..7cca6e2 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -363,4 +363,32 @@ class UserDoctor extends Model { return self::where($params)->decrement($field,$numeral); } + + /** + * 获取先思达合作医生列表 + * @param array $params + * @param array $hospital_params + * @param array $fields + * @return array|Collection + */ + public static function getDiagnoCoopDoctorList(array $params,array $hospital_params,array $fields = ['*']): array|Collection + { + return self::with([ + "Hospital:hospital_id,hospital_name,hospital_level_name" + ]) + ->whereHas('Hospital', function ($query) use ($hospital_params) { + $query->where($hospital_params); + }) +// ->when($keyword, function ($query, $keyword) { +// $query->where(function ($query) use ($keyword) { +// $query->orwhere("user_name", 'like', '%' . $keyword . '%'); +// $query->orwhere("department_custom_name", 'like', '%' . $keyword . '%'); +// $query->orWhereHas('Hospital', function ($query) use ($keyword) { +// $query->where('hospital_name', 'like', '%' . $keyword . '%'); +// }); +// }); +// }) + ->where($params) + ->get($fields); + } } diff --git a/app/Request/DetectionRequest.php b/app/Request/DetectionRequest.php index 39d736a..db33471 100644 --- a/app/Request/DetectionRequest.php +++ b/app/Request/DetectionRequest.php @@ -13,6 +13,9 @@ class DetectionRequest extends FormRequest 'getDetectionProjectList' => [ // 获取合作公司检测项目列表 'company_id', ], + 'getDetectionDoctorList' => [ // 获取检测机构合作医生列表 + 'company_id', + ], ]; /** diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index bbaf9ef..08d3b3f 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -2,8 +2,11 @@ namespace App\Services; +use App\Model\Area; use App\Model\BasicCompany; use App\Model\DetectionProject; +use App\Model\UserDoctor; +use App\Model\UserLocation; class DetectionService extends BaseService { @@ -67,4 +70,119 @@ class DetectionService extends BaseService return success($detection_project->toArray()); } + + /** + * 获取检测机构合作医生列表 + * @return array + */ + public function getDetectionDoctorList(): array + { + $company_id = $this->request->input("company_id",1); + $user_info = $this->request->getAttribute("userInfo") ?? []; + + // 获取合作公司数据 + $params = array(); + $params['company_id'] = $company_id; + $basic_company = BasicCompany::getOne($params); + if (empty($basic_company)){ + return fail(); + } + + // 返回数据 + $response_data = array( + "area" => [ + "province_id" => "", + "province" => "", + "city_id" => "", + "city" => "", + "county_id" => "", + "county" => "", + ], + "doctors" => [], + ); + + // 搜索数据 + $hospital_params = array(); + + // 获取用户定位地址数据 + $params = array(); + $params['user_id'] = $user_info['user_id']; + $user_location = UserLocation::getOne($params); + if (!empty($user_location)){ + // 处理省市区对应 + if (!empty($user_location['province']) && !empty($user_location['city'])){ + $params = array(); + $params['area_name'] = $user_location['province']; + $params['area_type'] = 2; + $area_province = Area::getOne($params); + if (!empty($area_province)){ + $response_data['area']['province_id'] = $area_province['area_id']; + $response_data['area']['province'] = $area_province['area_name']; + + // 搜索条件 + $hospital_params['province_id'] = $area_province['area_id']; + } + + if (!empty($response_data['area']['province_id'])){ + $params = array(); + $params['area_name'] = $user_location['city']; + $params['parent_id'] = $response_data['area']['province_id']; + $params['area_type'] = 3; + $area_city = Area::getOne($params); + if (!empty($area_city)){ + $response_data['area']['city_id'] = $area_city['area_id']; + $response_data['area']['city'] = $area_city['area_name']; + + // 搜索条件 + $hospital_params['city_id'] = $area_city['area_id']; + } + } + } + + if (!empty($response_data['area']['city_id']) && !empty($user_location['county'])){ + $params = array(); + $params['area_name'] = $user_location['county']; + $params['parent_id'] = $response_data['area']['city_id']; + $params['area_type'] = 4; + $area_county = Area::getOne($params); + if (!empty($area_county)){ + $response_data['area']['county_id'] = $area_county['area_id']; + $response_data['area']['county'] = $area_county['area_name']; + + // 搜索条件 + $hospital_params['county_id'] = $area_county['area_id']; + } + } + } + + // 获取医生 + $params = array(); + $params['status'] = 1; + $params['idcard_status'] = 1; + $params['iden_auth_status'] = 1; + $params['is_sys_diagno_cooperation'] = 1; + + $fields = [ + "doctor_id", + "user_id", + "user_name", + "avatar", + "doctor_title", + ]; + $user_doctors = UserDoctor::getDiagnoCoopDoctorList($params,$hospital_params,$fields); + if (!empty($user_doctors)){ + foreach ($user_doctors as &$value){ + $doctor = array(); + if (!empty($value['Hospital'])){ + $doctor['hospital_name'] = $value['Hospital']['hospital_name']; + } + + unset($value['Hospital']); + } + + $response_data['doctors'] = $user_doctors->toArray(); + } + + return success($response_data); + } } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index 19c8f15..dc9c6ab 100644 --- a/config/routes.php +++ b/config/routes.php @@ -272,7 +272,7 @@ Router::addGroup('/patient', function () { Router::post('', [InquiryController::class, 'addDetectionOrder']); // 获取检测机构合作医生列表 - Router::get('/doctor', [InquiryController::class, 'getDetectionDoctor']); + Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']); // 获取合作公司检测项目列表 Router::get('/project', [DetectionController::class, 'getDetectionProjectList']); From 548e0cb9803f501b358c90d6c244677a837dae39 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 27 Jul 2023 14:10:01 +0800 Subject: [PATCH 009/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=9C=BA=E6=9E=84=E5=90=88=E4=BD=9C=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E5=88=97=E8=A1=A8=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DetectionService.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 08d3b3f..4e2a6e8 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -178,6 +178,8 @@ class DetectionService extends BaseService } unset($value['Hospital']); + + $value['avatar'] = addAliyunOssWebsite($value['avatar']); } $response_data['doctors'] = $user_doctors->toArray(); From 33c7cb98c5bd8e5088e3e6cb2879e6203bf3dfc4 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 27 Jul 2023 14:44:55 +0800 Subject: [PATCH 010/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=9C=BA=E6=9E=84=E5=90=88=E4=BD=9C=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E5=88=97=E8=A1=A8=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DetectionService.php | 96 +++++++++++++++++++++++-------- 1 file changed, 73 insertions(+), 23 deletions(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 4e2a6e8..322e3a3 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -77,8 +77,12 @@ class DetectionService extends BaseService */ public function getDetectionDoctorList(): array { - $company_id = $this->request->input("company_id",1); $user_info = $this->request->getAttribute("userInfo") ?? []; + $company_id = $this->request->input("company_id",1); + $province_id = $this->request->input("province_id"); + $city_id = $this->request->input("city_id"); + $county_id = $this->request->input("county_id"); + // 获取合作公司数据 $params = array(); @@ -104,15 +108,61 @@ class DetectionService extends BaseService // 搜索数据 $hospital_params = array(); - // 获取用户定位地址数据 - $params = array(); - $params['user_id'] = $user_info['user_id']; - $user_location = UserLocation::getOne($params); - if (!empty($user_location)){ - // 处理省市区对应 - if (!empty($user_location['province']) && !empty($user_location['city'])){ + if (empty($province_id) && empty($city_id) && empty($county_id)){ + // 获取用户定位地址数据 + $params = array(); + $params['user_id'] = $user_info['user_id']; + $user_location = UserLocation::getOne($params); + if (!empty($user_location)){ + // 处理省市区对应 + if (!empty($user_location['province']) && !empty($user_location['city'])){ + $params = array(); + $params['area_name'] = $user_location['province']; + $params['area_type'] = 2; + $area_province = Area::getOne($params); + if (!empty($area_province)){ + $response_data['area']['province_id'] = $area_province['area_id']; + $response_data['area']['province'] = $area_province['area_name']; + + // 搜索条件 + $hospital_params['province_id'] = $area_province['area_id']; + } + + if (!empty($response_data['area']['province_id'])){ + $params = array(); + $params['area_name'] = $user_location['city']; + $params['parent_id'] = $response_data['area']['province_id']; + $params['area_type'] = 3; + $area_city = Area::getOne($params); + if (!empty($area_city)){ + $response_data['area']['city_id'] = $area_city['area_id']; + $response_data['area']['city'] = $area_city['area_name']; + + // 搜索条件 + $hospital_params['city_id'] = $area_city['area_id']; + } + } + } + + if (!empty($response_data['area']['city_id']) && !empty($user_location['county'])){ + $params = array(); + $params['area_name'] = $user_location['county']; + $params['parent_id'] = $response_data['area']['city_id']; + $params['area_type'] = 4; + $area_county = Area::getOne($params); + if (!empty($area_county)){ + $response_data['area']['county_id'] = $area_county['area_id']; + $response_data['area']['county'] = $area_county['area_name']; + + // 搜索条件 + $hospital_params['county_id'] = $area_county['area_id']; + } + } + } + } else{ + if (!empty($province_id)){ $params = array(); - $params['area_name'] = $user_location['province']; + $params['area_id'] = $province_id; $params['area_type'] = 2; $area_province = Area::getOne($params); if (!empty($area_province)){ @@ -122,26 +172,26 @@ class DetectionService extends BaseService // 搜索条件 $hospital_params['province_id'] = $area_province['area_id']; } + } - if (!empty($response_data['area']['province_id'])){ - $params = array(); - $params['area_name'] = $user_location['city']; - $params['parent_id'] = $response_data['area']['province_id']; - $params['area_type'] = 3; - $area_city = Area::getOne($params); - if (!empty($area_city)){ - $response_data['area']['city_id'] = $area_city['area_id']; - $response_data['area']['city'] = $area_city['area_name']; + if (!empty($response_data['area']['province_id']) && !empty($city_id)){ + $params = array(); + $params['area_id'] = $city_id; + $params['parent_id'] = $response_data['area']['province_id']; + $params['area_type'] = 3; + $area_city = Area::getOne($params); + if (!empty($area_city)){ + $response_data['area']['city_id'] = $area_city['area_id']; + $response_data['area']['city'] = $area_city['area_name']; - // 搜索条件 - $hospital_params['city_id'] = $area_city['area_id']; - } + // 搜索条件 + $hospital_params['city_id'] = $area_city['area_id']; } } - if (!empty($response_data['area']['city_id']) && !empty($user_location['county'])){ + if (!empty($response_data['area']['city_id']) && !empty($county_id)){ $params = array(); - $params['area_name'] = $user_location['county']; + $params['area_id'] = $county_id; $params['parent_id'] = $response_data['area']['city_id']; $params['area_type'] = 4; $area_county = Area::getOne($params); From b3d05760134b741f64d14609ae86b85c7b7690b1 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 27 Jul 2023 16:34:33 +0800 Subject: [PATCH 011/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E9=A1=B9=E7=9B=AE=E7=94=A8=E9=80=94=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/DetectionController.php | 27 +++++++--- app/Model/DetectionProjectPurpose.php | 74 ++++++++++++++++++++++++++ app/Request/DetectionRequest.php | 10 ++-- app/Services/DetectionService.php | 20 +++++++ config/routes.php | 16 ++++-- 5 files changed, 129 insertions(+), 18 deletions(-) create mode 100644 app/Model/DetectionProjectPurpose.php diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php index ce55016..a9ebedc 100644 --- a/app/Controller/DetectionController.php +++ b/app/Controller/DetectionController.php @@ -13,14 +13,9 @@ class DetectionController extends AbstractController /** * 获取合作公司检测项目列表 * @return ResponseInterface - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface */ public function getDetectionProjectList(): ResponseInterface { - $request = $this->container->get(DetectionRequest::class); - $request->scene('getDetectionProjectList')->validateResolved(); - $detectionService = new DetectionService(); $data = $detectionService->getDetectionProjectList(); return $this->response->json($data); @@ -40,13 +35,29 @@ class DetectionController extends AbstractController /** * 获取检测机构合作医生列表 * @return ResponseInterface - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface */ public function getDetectionDoctorList(): ResponseInterface { + $detectionService = new DetectionService(); + $data = $detectionService->getDetectionDoctorList(); + return $this->response->json($data); + } + + /** + * 获取检测项目用途列表 + * @return ResponseInterface + */ + public function getDetectionProjectPurposeList(): ResponseInterface + { + $detectionService = new DetectionService(); + $data = $detectionService->getDetectionProjectPurposeList(); + return $this->response->json($data); + } + + // 创建检测订单 + public function addDetectionOrder(){ $request = $this->container->get(DetectionRequest::class); - $request->scene('getDetectionDoctorList')->validateResolved(); + $request->scene('addDetectionOrder')->validateResolved(); $detectionService = new DetectionService(); $data = $detectionService->getDetectionDoctorList(); diff --git a/app/Model/DetectionProjectPurpose.php b/app/Model/DetectionProjectPurpose.php new file mode 100644 index 0000000..1045708 --- /dev/null +++ b/app/Model/DetectionProjectPurpose.php @@ -0,0 +1,74 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增-批量 + * @param array $data 新增数据 + * @return \Hyperf\Database\Model\Model|DetectionProjectPurpose + */ + public static function addDetectionProjectPurpose(array $data): \Hyperf\Database\Model\Model|DetectionProjectPurpose + { + return self::create($data); + } + + /** + * 修改-批量 + * @param array $params + * @param array $data + * @return int + */ + public static function editDetectionProjectPurpose(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } +} diff --git a/app/Request/DetectionRequest.php b/app/Request/DetectionRequest.php index db33471..2a4b8e8 100644 --- a/app/Request/DetectionRequest.php +++ b/app/Request/DetectionRequest.php @@ -10,11 +10,12 @@ use Hyperf\Validation\Request\FormRequest; class DetectionRequest extends FormRequest { protected array $scenes = [ - 'getDetectionProjectList' => [ // 获取合作公司检测项目列表 - 'company_id', - ], - 'getDetectionDoctorList' => [ // 获取检测机构合作医生列表 + 'addDetectionOrder' => [ // 创建检测订单 'company_id', + 'patient_id', + 'family_id', + 'nation_id', + 'detection_disease_class_ids', ], ]; @@ -32,7 +33,6 @@ class DetectionRequest extends FormRequest public function rules(): array { return [ - 'company_id' => 'required', 'detection_project_id' => 'required', ]; } diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 322e3a3..6752838 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -5,6 +5,7 @@ namespace App\Services; use App\Model\Area; use App\Model\BasicCompany; use App\Model\DetectionProject; +use App\Model\DetectionProjectPurpose; use App\Model\UserDoctor; use App\Model\UserLocation; @@ -237,4 +238,23 @@ class DetectionService extends BaseService return success($response_data); } + + /** + * 获取检测项目用途列表 + * @return array + */ + public function getDetectionProjectPurposeList(): array + { + $detection_project_id = $this->request->input("detection_project_id",1); + + // 获取项目数据 + $params = array(); + $params['detection_project_id'] = $detection_project_id; + $detection_project_purpose = DetectionProjectPurpose::getList($params); + if (empty($detection_project_purpose)){ + return fail(); + } + + return success($detection_project_purpose->toArray()); + } } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index dc9c6ab..5e5e2fa 100644 --- a/config/routes.php +++ b/config/routes.php @@ -269,16 +269,22 @@ Router::addGroup('/patient', function () { // 检测 Router::addGroup('/detection', function () { // 创建检测订单 - Router::post('', [InquiryController::class, 'addDetectionOrder']); + Router::post('', [DetectionController::class, 'addDetectionOrder']); // 获取检测机构合作医生列表 Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']); - // 获取合作公司检测项目列表 - Router::get('/project', [DetectionController::class, 'getDetectionProjectList']); + // 检测项目 + Router::addGroup('/project', function () { + // 获取合作公司检测项目列表 + Router::get('', [DetectionController::class, 'getDetectionProjectList']); - // 获取合作公司检测项目详情 - Router::get('/project/{detection_project_id:\d+}', [DetectionController::class, 'getDetectionProject']); + // 获取合作公司检测项目详情 + Router::get('/{detection_project_id:\d+}', [DetectionController::class, 'getDetectionProject']); + + // 获取检测项目用途列表 + Router::get('/purpose', [DetectionController::class, 'getDetectionProjectPurposeList']); + }); }); // 医生数据 From ff5d62211091798ab51b0a1f4dd48ecf43cd05dd Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 28 Jul 2023 14:35:25 +0800 Subject: [PATCH 012/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E8=AE=A2=E5=8D=95=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/DetectionController.php | 5 +- app/Model/DetectionProject.php | 3 + app/Model/DetectionProjectPurpose.php | 3 + app/Model/DiseaseClassDetection.php | 3 + app/Model/OrderDetection.php | 112 +++++++++++++ app/Model/OrderDetectionCase.php | 87 ++++++++++ app/Model/UserDoctor.php | 9 -- app/Request/DetectionRequest.php | 21 ++- app/Services/DetectionService.php | 210 +++++++++++++++++++++++++ 9 files changed, 441 insertions(+), 12 deletions(-) create mode 100644 app/Model/OrderDetection.php create mode 100644 app/Model/OrderDetectionCase.php diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php index a9ebedc..47538d1 100644 --- a/app/Controller/DetectionController.php +++ b/app/Controller/DetectionController.php @@ -55,12 +55,13 @@ class DetectionController extends AbstractController } // 创建检测订单 - public function addDetectionOrder(){ + public function addDetectionOrder(): ResponseInterface + { $request = $this->container->get(DetectionRequest::class); $request->scene('addDetectionOrder')->validateResolved(); $detectionService = new DetectionService(); - $data = $detectionService->getDetectionDoctorList(); + $data = $detectionService->addDetectionOrder(); return $this->response->json($data); } } \ No newline at end of file diff --git a/app/Model/DetectionProject.php b/app/Model/DetectionProject.php index e295e0e..fc98473 100644 --- a/app/Model/DetectionProject.php +++ b/app/Model/DetectionProject.php @@ -7,6 +7,7 @@ namespace App\Model; use Hyperf\Database\Model\Collection; +use Hyperf\Snowflake\Concern\Snowflake; /** * @property int $detection_project_id 主键id @@ -19,6 +20,8 @@ use Hyperf\Database\Model\Collection; */ class DetectionProject extends Model { + use Snowflake; + /** * The table associated with the model. */ diff --git a/app/Model/DetectionProjectPurpose.php b/app/Model/DetectionProjectPurpose.php index 1045708..bb8bb2c 100644 --- a/app/Model/DetectionProjectPurpose.php +++ b/app/Model/DetectionProjectPurpose.php @@ -7,6 +7,7 @@ namespace App\Model; use Hyperf\Database\Model\Collection; +use Hyperf\Snowflake\Concern\Snowflake; /** * @property int $purpose_id 主键id @@ -17,6 +18,8 @@ use Hyperf\Database\Model\Collection; */ class DetectionProjectPurpose extends Model { + use Snowflake; + /** * The table associated with the model. */ diff --git a/app/Model/DiseaseClassDetection.php b/app/Model/DiseaseClassDetection.php index 0202e68..f430aef 100644 --- a/app/Model/DiseaseClassDetection.php +++ b/app/Model/DiseaseClassDetection.php @@ -7,6 +7,7 @@ namespace App\Model; use Hyperf\Database\Model\Collection; +use Hyperf\Snowflake\Concern\Snowflake; /** * @property int $id 主键id @@ -20,6 +21,8 @@ use Hyperf\Database\Model\Collection; */ class DiseaseClassDetection extends Model { + use Snowflake; + /** * The table associated with the model. */ diff --git a/app/Model/OrderDetection.php b/app/Model/OrderDetection.php new file mode 100644 index 0000000..2ab58dc --- /dev/null +++ b/app/Model/OrderDetection.php @@ -0,0 +1,112 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增-批量 + * @param array $data 新增数据 + * @return \Hyperf\Database\Model\Model|OrderDetection + */ + public static function addOrderDetection(array $data): \Hyperf\Database\Model\Model|OrderDetection + { + return self::create($data); + } + + /** + * 修改-批量 + * @param array $params + * @param array $data + * @return int + */ + public static function editOrderDetection(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } + + /** + * 获取未完成订单 + * @param array $params + * @param array $fields + * @return object|null + */ + public static function getNotFinishedOrderDetectionOne(array $params,array $fields = ['*']): object|null + { + return self::where($params)->whereIn('detection_status',[1,2,3])->first($fields); + } +} diff --git a/app/Model/OrderDetectionCase.php b/app/Model/OrderDetectionCase.php new file mode 100644 index 0000000..e233fbb --- /dev/null +++ b/app/Model/OrderDetectionCase.php @@ -0,0 +1,87 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增-批量 + * @param array $data 新增数据 + * @return \Hyperf\Database\Model\Model|OrderDetectionCase + */ + public static function addOrderDetectionCase(array $data): \Hyperf\Database\Model\Model|OrderDetectionCase + { + return self::create($data); + } + + /** + * 修改-批量 + * @param array $params + * @param array $data + * @return int + */ + public static function editOrderDetectionCase(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } + +} diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index 7cca6e2..9e19a4e 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -379,15 +379,6 @@ class UserDoctor extends Model ->whereHas('Hospital', function ($query) use ($hospital_params) { $query->where($hospital_params); }) -// ->when($keyword, function ($query, $keyword) { -// $query->where(function ($query) use ($keyword) { -// $query->orwhere("user_name", 'like', '%' . $keyword . '%'); -// $query->orwhere("department_custom_name", 'like', '%' . $keyword . '%'); -// $query->orWhereHas('Hospital', function ($query) use ($keyword) { -// $query->where('hospital_name', 'like', '%' . $keyword . '%'); -// }); -// }); -// }) ->where($params) ->get($fields); } diff --git a/app/Request/DetectionRequest.php b/app/Request/DetectionRequest.php index 2a4b8e8..eccc0d4 100644 --- a/app/Request/DetectionRequest.php +++ b/app/Request/DetectionRequest.php @@ -16,6 +16,10 @@ class DetectionRequest extends FormRequest 'family_id', 'nation_id', 'detection_disease_class_ids', + 'detection_project_id', // 检测项目id + 'purpose_id', // 检测项目用途id + 'doctor_id', // 医生id + 'client_type', // 客户端类型(1:手机 2:电脑) ], ]; @@ -33,7 +37,13 @@ class DetectionRequest extends FormRequest public function rules(): array { return [ + 'patient_id' => 'required', + 'family_id' => 'required', + 'nation_id' => 'required', + 'detection_disease_class_ids' => 'required', 'detection_project_id' => 'required', + 'doctor_id' => 'required', + 'client_type' => 'required|integer|min:1|max:2', ]; } @@ -43,7 +53,16 @@ class DetectionRequest extends FormRequest public function messages(): array { return [ - 'company_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'patient_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'family_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'nation_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'detection_disease_class_ids.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'detection_project_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'doctor_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'client_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'client_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'client_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'client_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), ]; } } diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 6752838..e50d2ee 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -2,12 +2,25 @@ namespace App\Services; +use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer; +use App\Constants\HttpEnumCode; use App\Model\Area; use App\Model\BasicCompany; +use App\Model\BasicNation; use App\Model\DetectionProject; use App\Model\DetectionProjectPurpose; +use App\Model\DiseaseClassDetection; +use App\Model\OrderDetection; +use App\Model\OrderDetectionCase; +use App\Model\PatientFamily; use App\Model\UserDoctor; use App\Model\UserLocation; +use App\Utils\Log; +use Hyperf\Amqp\Producer; +use Hyperf\DbConnection\Db; +use Hyperf\Snowflake\IdGeneratorInterface; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; class DetectionService extends BaseService { @@ -257,4 +270,201 @@ class DetectionService extends BaseService return success($detection_project_purpose->toArray()); } + + /** + * 创建检测订单 + * @return array + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function addDetectionOrder(): array + { + $result = array(); + $result['status'] = 1; + $result['message'] = "成功"; + $result['data'] = [ + "inquiry_no" => "", + "order_detection_id" => "", + ]; + + $user_info = $this->request->getAttribute("userInfo") ?? []; + $request_params = $this->request->all(); + + // 检测家庭成员是否存在 + $params = array(); + $params['family_id'] = $request_params['family_id']; + $params['patient_id'] = $user_info['client_user_id']; + $params['status'] = 1; + $patient_family = PatientFamily::getOne($params); + if (empty($patient_family)) { + return fail(HttpEnumCode::HTTP_ERROR, "患者信息错误"); + } + + // 检测是否存在同类型未完成的检测订单 + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['family_id'] = $request_params['family_id']; + $params['detection_project_id'] = $request_params['detection_project_id']; + $order_detection = OrderDetection::getNotFinishedOrderDetectionOne($params); + if (!empty($order_detection)){ + $result['status'] = 2; + $result['message'] = "当前患者存在未完成的检测订单"; + $result['data']['order_detection_id'] = $order_detection['order_detection_id']; + return success($result); + } + + // 检测民族 + $params = array(); + $params['nation_id'] = $request_params['nation_id']; + $nation = BasicNation::getOne($params); + if (empty($nation)){ + return fail(HttpEnumCode::HTTP_ERROR,"民族选择错误"); + } + + // 检测疾病分类 + $detection_disease_class_ids = explode(',',$request_params['detection_disease_class_ids']); + if (count($detection_disease_class_ids) > 3){ + return fail(HttpEnumCode::HTTP_ERROR,"既往病史最多可选三项"); + } + + $detection_disease_class_names = ""; + + foreach ($detection_disease_class_ids as $value){ + $params = array(); + $params['id'] = $value; + $disease_class_detection = DiseaseClassDetection::getOne($params); + if (empty($disease_class_detection)){ + return fail(HttpEnumCode::HTTP_ERROR,"既往病史错误"); + } + + if ($disease_class_detection['status'] != 1){ + return fail(HttpEnumCode::HTTP_ERROR,"既往病史错误"); + } + + if ($disease_class_detection['enable'] != 1){ + return fail(HttpEnumCode::HTTP_ERROR,"既往病史错误"); + } + + if (empty($detection_disease_class_names)){ + $detection_disease_class_names = $disease_class_detection['name']; + }else{ + $detection_disease_class_names = $detection_disease_class_names . ',' . $disease_class_detection['name']; + } + } + + // 检测项目 + $params = array(); + $params['detection_project_id'] = $request_params['detection_project_id']; + $detection_project = DetectionProject::getOne($params); + if (empty($detection_project)){ + return fail(HttpEnumCode::HTTP_ERROR,"检测项目错误"); + } + + if ($detection_project['detection_project_price'] <= 0){ + return fail(HttpEnumCode::HTTP_ERROR,"订单金额错误"); + } + + // 检测用途 + $params = array(); + $params['purpose_id'] = $request_params['purpose_id']; + $params['detection_project_id'] = $request_params['detection_project_id']; + $detection_project_purpose = DetectionProjectPurpose::getOne($params); + if (empty($detection_project_purpose)){ + return fail(); + } + + // 检测医生 + $params = array(); + $params['doctor_id'] = $request_params['doctor_id']; + $user_doctor = UserDoctor::getOne($params); + if (empty($user_doctor)){ + return fail(HttpEnumCode::HTTP_ERROR,"医生错误"); + } + + if ($user_doctor['is_sys_diagno_cooperation'] != 1){ + return fail(HttpEnumCode::HTTP_ERROR,"医生错误"); + } + + // 确定支付渠道 + // 支付渠道(1:小程序支付 2:微信扫码支付) + if ($request_params['client_type'] == 1) { + $detection_pay_channel = 1; + } elseif ($request_params['client_type'] == 2) { + $detection_pay_channel = 2; + } + + // 处理订单金额 + + + Db::beginTransaction(); + + $generator = $this->container->get(IdGeneratorInterface::class); + + try { + // 新增检测订单 + $data = array(); + $data['user_id'] = $user_info['user_id']; + $data['patient_id'] = $user_info['client_user_id']; + $data['doctor_id'] = $user_doctor['doctor_id']; + $data['family_id'] = $patient_family['family_id']; + $data['detection_project_id'] = $detection_project['detection_project_id']; + $data['purpose_id'] = $detection_project_purpose['purpose_id']; + $data['detection_status'] = 1; // 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + $data['detection_pay_channel'] = $detection_pay_channel; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) + $data['detection_no'] = "D" . $generator->generate(); // 系统订单编号 + $data['amount_total'] = $detection_project['detection_project_price']; // 订单金额 + $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 + $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) + $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) + $data['patient_age'] = $patient_family['age'];// 患者年龄-就诊人 + $order_detection = OrderDetection::addOrderDetection($data); + if (empty($order_detection)){ + Db::rollBack(); + return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败"); + } + + // 新增检测订单病例 + $data = array(); + $data['order_detection_id'] = $order_detection['order_detection_id']; + $data['family_id'] = $patient_family['family_id']; + $data['doctor_id'] = $user_doctor['doctor_id']; + $data['relation'] = $patient_family['relation']; // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) + $data['name'] = $patient_family['card_name']; // 患者名称 + $data['sex'] = $patient_family['sex'] ?? 0; // 患者性别(0:未知 1:男 2:女) + $data['age'] = $patient_family['age'] ?? null; // 患者年龄 + $data['nation_id'] = $nation['nation_id'] ?? null; // 民族 + $data['nation_name'] = $nation['nation_name'] ?? null; // 民族名称 + $data['detection_disease_class_ids'] = $request_params['detection_disease_class_ids']; // 疾病id-检测-逗号分隔 + $data['detection_disease_class_names'] = $detection_disease_class_names; // 疾病名称-检测-逗号分隔 + $order_detection_case = OrderDetectionCase::addOrderDetectionCase($data); + if (empty($order_detection_case)){ + Db::rollBack(); + return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败"); + } + + // 增加至未支付取消订单延迟队列 +// $data = array(); +// $data['order_no'] = $order_detection['detection_no']; +// $data['order_type'] = 3; +// +// $message = new CancelUnpayOrdersDelayDirectProducer($data); +// $message->setDelayMs(1000 * 60 * 30); +// $producer = $this->container->get(Producer::class); +// $res = $producer->produce($message); +// if (!$res) { +// Db::rollBack(); +// return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败"); +// } + + Db::commit(); + }catch (\Exception $e){ + Db::rollBack(); + return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage()); + } + + $result['status'] = 1; + $result['data']['order_detection_id'] = (string)$order_detection['order_detection_id']; // 订单主键id + $result['data']['inquiry_no'] = (string)$order_detection['detection_no']; // 订单编号 + return success($result); + } } \ No newline at end of file From 22620a3eb97df30df1901f15e093360461704a7f Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 28 Jul 2023 18:22:15 +0800 Subject: [PATCH 013/176] 1 --- app/Services/DetectionService.php | 74 ++ app/Services/OrderPrescriptionService_1.php | 911 -------------------- config/routes.php | 3 + 3 files changed, 77 insertions(+), 911 deletions(-) delete mode 100644 app/Services/OrderPrescriptionService_1.php diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index e50d2ee..2974159 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -467,4 +467,78 @@ class DetectionService extends BaseService $result['data']['inquiry_no'] = (string)$order_detection['detection_no']; // 订单编号 return success($result); } + + // 取消未支付检测订单 + public function cancelUnpayDetectionOrder(string|int $order_no, string|int $cancel_reason, string|int $cancel_remarks){ + $result = array(); + $result['status'] = 1; + $result['message'] = "成功"; + + // 获取检测订单数据 + $params = array(); + $params['detection_no'] = $order_no; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)){ + $result['status'] = 0; + $result['message'] = "取消未支付的检测订单失败:未查询到对应订单数据"; + return $result; + } + + // 检测订单状态 + if ($order_detection['detection_status'] == 5) { + // 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + $result['status'] = 2; + $result['message'] = "取消未支付的检测订单:订单已取消"; + return $result; + } + + if ($order_detection['detection_status'] != 1) { + // 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + $result['status'] = 0; + $result['message'] = "取消未支付的检测订单:订单状态为" . $order_detection['detection_status'] . "无法执行"; + return $result; + } + + // 检测订单退款状态 + if (!in_array($order_detection['detection_refund_status'], [0, 4, 5])) { + // 检测订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) + $result['status'] = 0; + $result['message'] = "取消未支付的检测订单:订单正在退款中"; + return $result; + } + + // 检测订单支付状态 + if ($order_detection['detection_pay_status'] == 2) { + // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) + $result['status'] = 2; + $result['message'] = "取消未支付的检测订单:订单已支付"; + return $result; + } + + // 检测订单删除状态 + if ($order_detection['is_delete'] == 1) { + // 删除状态(0:否 1:是) + $result['status'] = 2; + $result['message'] = "取消未支付的检测订单:订单已被删除"; + return $result; + } + + // 取消检测订单 + $data = array(); + $data['detection_status'] = 5; // 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + if ($cancel_reason == 3){ + $data['detection_pay_status'] = 5; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) + } + + $data['cancel_time'] = date("Y-m-d H:i:s", time()); + $data['cancel_reason'] = $cancel_reason; // 取消订单原因(1:主动取消 2:客服取消 3:支付超时) + $data['cancel_remarks'] = $cancel_remarks; // 取消订单备注 + $data['updated_at'] = date("Y-m-d H:i:s", time()); + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params,$data); + + return $result; + } } \ No newline at end of file diff --git a/app/Services/OrderPrescriptionService_1.php b/app/Services/OrderPrescriptionService_1.php deleted file mode 100644 index b3a03e9..0000000 --- a/app/Services/OrderPrescriptionService_1.php +++ /dev/null @@ -1,911 +0,0 @@ -add(4); - - // 获取处方关联疾病名称 - $icd_name = ""; - co(function () use ($wg,$channel,&$icd_name,$order_prescription_id) { - defer(function() use ($wg) { - $wg->done(); - }); - - $params = array(); - $params['order_prescription_id'] = $order_prescription_id; - $order_prescription_icd = OrderPrescriptionIcd::getList($params); - if (empty($order_prescription_icd)) { - $channel->push('处方疾病数据错误'); - return; - } - - $icd_name = array_column($order_prescription_icd->toArray(), 'icd_name'); - if (!empty($icd_name)) { - if (count($icd_name) > 1) { - $icd_name = implode(';', $icd_name); - } else { - $icd_name = $icd_name[0]; - } - } - }); - - // 获取处方关联商品数据 - $order_prescription_product = []; - co(function () use ($wg,$channel,&$order_prescription_product,$order_prescription_id) { - defer(function() use ($wg) { - $wg->done(); - }); - - $params = array(); - $params['order_prescription_id'] = $order_prescription_id; - $order_prescription_product = OrderPrescriptionProduct::getList($params); - if (empty($order_prescription_product)) { - $channel->push('处方药品数据错误'); - return; - } - }); - - // 获取医生自定义科室数据 - $hospital_department_custom = []; - $doctor_id = $order_prescription['doctor_id']; - co(function () use ($wg,$channel,&$hospital_department_custom,$doctor_id) { - defer(function() use ($wg) { - $wg->done(); - }); - - // 获取医生数据 - $params = array(); - $params['doctor_id'] = $doctor_id; - $user_doctor = UserDoctor::getOne($params); - if (empty($user_doctor)) { - $channel->push('医生数据错误'); - return; - } - - // 获取医生自定义科室数据 - $params = array(); - $params['department_custom_id'] = $user_doctor['department_custom_id']; - $hospital_department_custom = HospitalDepartmentCustom::getOne($params); - if (empty($hospital_department_custom)) { - $channel->push('医生自定义数据错误'); - return; - } - }); - - // 获取处方关联病例数据 - $order_inquiry_case = []; - $order_inquiry_id = $order_prescription['order_inquiry_id']; - co(function () use ($wg,$channel,&$order_inquiry_case,$order_inquiry_id) { - defer(function() use ($wg) { - $wg->done(); - }); - - $params = array(); - $params['order_inquiry_id'] = $order_inquiry_id; - $order_inquiry_case = OrderInquiryCase::getOne($params); - if (empty($order_inquiry_case)) { - $channel->push('处方病例数据错误'); - return; - } - }); - - // 结束 - $wg->wait(); - - // 判断通道是否存在异常数据 - $res = $channel->isEmpty(); - if ($res){ - // 读取通道数据 - $data = $channel->pop(); - - // 关闭channel通道 - $channel->close(); - - throw new BusinessException($data); - }else{ - // 关闭channel通道 - $channel->close(); - } - - $CaOnline = new CaOnline(); - - // 获取云证书签名 - $data = array(); - $data['created_at'] = $order_prescription['doctor_created_time']; - $data['department_custom_name'] = $hospital_department_custom['department_name'] ?: ""; - $data['user_name'] = $order_prescription['patient_name']; - $data['sex'] = sexToStringSex($order_prescription['patient_sex']); - $data['age'] = $order_prescription['patient_age']; - $data['allergy_history'] = $order_inquiry_case['allergy_history'] ?: "无"; - $data['icd_name'] = $icd_name; - $data['doctor_advice'] = $order_prescription['doctor_advice'] ?: "无"; - - // 商品数据 - $data['product'] = array(); - foreach ($order_prescription_product as $item) { - $product = array(); - $product['product_name'] = $item['product_name'] . "(" . $item['product_spec'] . ")"; // 商品名称+商品规格 - $product['single_unit'] = $item['single_unit'] ?: ""; // 单次剂量(例:1次1包) - $product['frequency_use'] = $item['frequency_use'] ?: ""; // 使用频率(例:1天3次) - $product['single_use'] = $item['single_use'] ?: ""; // 单次用法(例:口服) - $product['prescription_product_num'] = $item['prescription_product_num'] . $item['packaging_unit']; // 商品数量 + 基本包装单位(例:盒/瓶) - $data['product'][] = $product; - } - - dump("获取用户云证书签名"); - $cert_sign_result = $CaOnline->getCertSign($user_entity_id, $user_entity_id, $data); - dump("获取用户云证书签名成功"); - - // 验证云证书签名-验证无需处理,只要不返回错误即可 - dump("验证用户云证书签名"); - $CaOnline->verifyPkcs7($cert_sign_result['signP7'], $data); - dump("验证用户云证书签名成功"); - - if ($user['user_type'] == 3) { - dump("获取医院云证书签名"); - unset($cert_sign_result); - $cert_sign_result = $CaOnline->getCertSign($hospital_entity_id, $hospital_entity_id, $data); - dump("获取医院云证书签名成功"); - - // 验证云证书签名-验证无需处理,只要不返回错误即可 - dump("验证医院云证书签名"); - $CaOnline->verifyPkcs7($cert_sign_result['signP7'], $data); - dump("验证医院云证书签名成功"); - } - - $oss = new Oss(); - // 医生 - if ($user['user_type'] == 2) { - // 下载基础处方图片 - $prescription_basic_filename = "basic/file/prescription.jpg"; - $prescription_image = $oss->getObjectToRAM($prescription_basic_filename); - - dump("下载基础处方图片成功"); - - $manager = new ImageManager(); - - $image = $manager->make($prescription_image); - - $fontPath = './extend/Ca/msyh.ttf'; - - // 处方号 - $image->text($order_prescription['prescription_code'], 1480, 540, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 日期 - $image->text(date('Y-m-d', strtotime($order_prescription['doctor_created_time'])), 354, 675, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 科室 - $image->text($hospital_department_custom['department_name'] ?: "", 1385, 675, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 姓名 - $image->text($order_prescription['patient_name'], 354, 795, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 性别 - $image->text(sexToStringSex($order_prescription['patient_sex']), 1385, 790, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 年龄 - $image->text($order_prescription['patient_age'], 354, 900, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 过敏史 - $image->text($order_inquiry_case['allergy_history'] ?: "无", 405, 1030, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 初步诊断 - $image->text($icd_name, 445, 1145, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 医生建议 - $image->text($order_prescription['doctor_advice'] ?: "无", 445, 1252, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(60); - $font->align('left'); - }); - - // 商品数据 - foreach ($order_prescription_product as $key => $item) { - $x_axis = 229; - $y_axis = 1600 + $key * 250; - $x_axis_num = 1900;// 数量使用 - - // 商品名称 - $image->text($item['product_name'], $x_axis, $y_axis, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(50); - $font->align('left'); - }); - - $image->text("X" . $item['prescription_product_num'] . $item['packaging_unit'], $x_axis_num, $y_axis, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(50); - $font->align('left'); - }); - - // 用量 - $image->text("用量:" . $item['single_unit'] . " " . $item['frequency_use'], $x_axis, $y_axis + 70, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(50); - $font->align('left'); - }); - - // 用法 - $image->text("用法:" . $item['single_use'], $x_axis, $y_axis + 140, function ($font) use ($fontPath) { - $font->file($fontPath); - $font->size(50); - $font->align('left'); - }); - } - - // 生成图片 - $img_result = (string)$image->encode('png', 75); - dump("处方图片生成成功"); - - // 上传处方图片至oss - $prescription_img_oss_filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'jpg'; - $prescription_img_url = $oss->putObject($prescription_img_oss_filename, $img_result); - $prescription_img_url = '/' . $prescription_img_url; - dump("处方图片上传oss成功"); - - // 图片生成pdf - $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false); - - $pdf->AddPage(); - $pdf->Image('@' . $img_result, 10, 10, 0, 0, '', '', '', false, 300, '', false, false, 0, false, false, false); - - $prescription_pdf_local_filename = $order_prescription['order_prescription_id'] . '.' . 'pdf'; - - // 图片生成的处方pdf存储为本地文件 - $pdf->Output(dirname(__DIR__, 2) . "/" . $prescription_pdf_local_filename, "F"); - - dump("处方图片生成pdf成功"); - } - - // 药师 - if ($user['user_type'] == 3) { - // 下载医生开具的处方pdf - // 去除第一个/ oss不识别 - $prescription_pdf_path = substr($order_prescription['prescription_pdf'], 1, strlen($order_prescription['prescription_pdf']) - 1); - - $local = "./runtime/" . $order_prescription['order_prescription_id'] . '.' . 'pdf'; - - $oss->getObjectToLocal($prescription_pdf_path, $local); - dump("下载医生开具的处方pdf成功"); - } - - // 下载签名图片 - $style = "image/resize,m_lfit,w_100,h_350"; - $sign_image = $oss->getCusTomObjectToRAM($sign_image_path, $style); - $sign_image = base64_encode($sign_image); - if (!$sign_image) { - throw new BusinessException("签名图片下载失败"); - } - - dump("下载签名图片成功"); - - if ($user['user_type'] == 2) { - $sign_param = [ - [ // 医生端 - "llx" => "120", // 左边底部X坐标 - "lly" => "190", // 左边底部Y坐标 - "urx" => "190", // 右边上部x坐标 - "ury" => "140", // 右边上部y坐标 - "pageList" => [1], - "sealImg" => $sign_image - ], - ]; - } else { - $sign_param = [ - [ // 药师端 - "llx" => "350", // 左边底部X坐标 - "lly" => "190", // 左边底部Y坐标 - "urx" => "440", // 右边上部x坐标 - "ury" => "140", // 右边上部y坐标 - "pageList" => [1], - "sealImg" => $sign_image - ] - ]; - } - - // 打开处方pdf文件 - $pdf_file = fopen("./runtime/" . $order_prescription['order_prescription_id'] . ".pdf", 'r'); - if (!$pdf_file) { - throw new BusinessException("处方图片打开失败"); - } - - - // 处方pdf进行签章 - $data = array(); - $data['sign_param'] = json_encode($sign_param); - $data['pdf_file'] = $pdf_file; - $sign_pdf_result = $CaOnline->addSignPdf($user_entity_id, $data); - if (empty($sign_pdf_result[0]['fileId'])) { - throw new BusinessException("处方签章失败"); - } - - dump("处方pdf进行签章成功"); - - // 下载处方签章文件 - $file_id = $sign_pdf_result[0]['fileId']; - $prescription_pdf_result = $CaOnline->getSignedFile($user_entity_id, $file_id); - - if (empty($prescription_pdf_result)) { - throw new BusinessException("下载处方签章文件失败"); - } - - dump("下载处方签章文件成功"); - - // 上传oss - $filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf'; - $prescription_pdf_url = $oss->putObject($filename, $prescription_pdf_result); - dump("处方pdf上传pss成功"); - - if ($user['user_type'] == 3) { - // 药师端时,需要进行系统签章 - // 把药师签章的pdf存储至本地文件 - $file = fopen("./runtime/" . $order_prescription['order_prescription_id'] . '.' . 'pdf', "w"); - fwrite($file, $prescription_pdf_result); - fclose($file); - - // 下载医院签名图片 - $style = "image/resize,w_300,h_300"; - $sign_image = $oss->getCusTomObjectToRAM($hospital_sign_image_path, $style); - $sign_image = base64_encode($sign_image); - if (!$sign_image) { - throw new BusinessException("医院签名图片下载失败"); - } - - $sign_param = [ - [ // 医院签章 - "llx" => "370", // 左边底部X坐标 控制左右(越小越左) - "lly" => "210", // 左边底部Y坐标 控制上下(越小越下) - "urx" => "520", // 右边上部x坐标 - "ury" => "360", // 右边上部y坐标 - "pageList" => [1], - "sealImg" => $sign_image - ], - ]; - - // 打开处方pdf文件 - unset($pdf_file); - $pdf_file = fopen("./runtime/" . $order_prescription['order_prescription_id'] . ".pdf", 'r'); - - // 处方pdf进行签章 - $data = array(); - $data['sign_param'] = json_encode($sign_param); - $data['pdf_file'] = $pdf_file; - $hospital_sign_pdf_result = $CaOnline->addSignPdf($hospital_entity_id, $data); - if (empty($hospital_sign_pdf_result[0]['fileId'])) { - throw new BusinessException("处方签章失败"); - } - - dump("处方pdf进行医院签章成功"); - - // 下载处方签章文件 - unset($prescription_pdf_result); - $file_id = $hospital_sign_pdf_result[0]['fileId']; - $prescription_pdf_result = $CaOnline->getSignedFile($hospital_entity_id, $file_id); - - if (empty($prescription_pdf_result)) { - throw new BusinessException("下载处方签章文件失败"); - } - - dump("下载医院处方签章文件成功"); - - // 上传oss - $hospital_filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf'; - $prescription_pdf_url = $oss->putObject($hospital_filename, $prescription_pdf_result); - dump("上传医院处方签章文件成功"); - } - - $result = array(); - $result['prescription_img_url'] = $prescription_img_url ?? $order_prescription['prescription_img']; - $result['prescription_pdf_url'] = '/' . $prescription_pdf_url ?: ""; - return $result; - - } catch (\Exception $e) { - throw new BusinessException($e->getMessage()); - } - } - - /** - * 上报处方平台 - * @param string $order_product_id 商品订单id - * @return bool - */ - public function reportPrescription(string $order_product_id): bool - { - // 获取商品订单数据 - $params = array(); - $params['order_product_id'] = $order_product_id; - $order_product = OrderProduct::getOne($params); - if (empty($order_product)) { - throw new BusinessException("上报处方平台失败:商品订单数据错误"); - } - - // 获取处方数据 - $params = array(); - $params['order_prescription_id'] = $order_product['order_prescription_id']; - $order_prescription = OrderPrescription::getOne($params); - if (empty($order_prescription)) { - throw new BusinessException("上报处方平台失败:处方数据错误"); - } - - // 获取问诊订单数据 - $params = array(); - $params['order_inquiry_id'] = $order_prescription['order_inquiry_id']; - $order_inquiry = OrderInquiry::getOne($params); - if (empty($order_inquiry)) { - throw new BusinessException("上报处方平台失败:问诊订单数据错误"); - } - - // 获取商品订单列表数据 - $params = array(); - $params['order_product_id'] = $order_product['order_product_id']; - $order_product_item = OrderProductItem::getList($params); - if (empty($order_product_item)) { - throw new BusinessException("上报处方平台失败:商品订单列表数据错误"); - } - - $wg = new WaitGroup(); - $wg->add(8); - - $user = []; // 就诊患者用户数据 - $patient_family = []; // 家庭成员-基本信息 - $order_prescription_icd = []; // 处方关联疾病数据 - $user_doctor = []; // 医生数据 - $user_doctor_info = []; // 医生详情数据 - $user_pharmacist = []; // 药师数据 - $user_pharmacist_info = []; // 药师详数据 - $order_inquiry_case = []; // 病例数据 - - $user_id = $order_inquiry['user_id']; - $doctor_id = $order_prescription['doctor_id']; - $family_id = $order_inquiry['family_id']; - $pharmacist_id = $order_prescription['pharmacist_id']; - $order_inquiry_id = $order_inquiry['order_inquiry_id']; - - // 获取就诊患者用户数据 - co(function () use ($wg, &$user, $user_id) { - $params = array(); - $params['user_id'] = $user_id; - $user = User::getOne($params)->toArray(); - // 计数器减一 - $wg->done(); - }); - - // 获取家庭成员-基本信息 - co(function () use ($wg, &$patient_family, $family_id) { - $params = array(); - $params['family_id'] = $family_id; - $patient_family = PatientFamily::getOne($params); - - // 计数器减一 - $wg->done(); - }); - - // 获取处方关联疾病数据 - $order_prescription_id = $order_prescription['order_prescription_id']; - co(function () use ($wg, &$order_prescription_icd, $order_prescription_id) { - $params = array(); - $params['order_prescription_id'] = $order_prescription_id; - $order_prescription_icd = OrderPrescriptionIcd::getList($params); - - // 计数器减一 - $wg->done(); - }); - - // 获取医生数据 - co(function () use ($wg, &$user_doctor, $doctor_id) { - $params = array(); - $params['doctor_id'] = $doctor_id; - $user_doctor = UserDoctor::getOne($params); - - // 计数器减一 - $wg->done(); - }); - - // 获取医生详情数据 - co(function () use ($wg, &$user_doctor_info, $doctor_id) { - $params = array(); - $params['doctor_id'] = $doctor_id; - $user_doctor_info = UserDoctorInfo::getOne($params); - - // 计数器减一 - $wg->done(); - }); - - // 获取药师数据 - co(function () use ($wg, &$user_pharmacist, $pharmacist_id) { - $params = array(); - $params['pharmacist_id'] = $pharmacist_id; - $user_pharmacist = UserPharmacist::getOne($params); - - // 计数器减一 - $wg->done(); - }); - - // 获取药师详情数据 - co(function () use ($wg, &$user_pharmacist_info, $pharmacist_id) { - $params = array(); - $params['pharmacist_id'] = $pharmacist_id; - $user_pharmacist_info = UserPharmacistInfo::getOne($params); - - // 计数器减一 - $wg->done(); - }); - - // 获取病例数据 - co(function () use ($wg, &$order_inquiry_case, $order_inquiry_id) { - $params = array(); - $params['order_inquiry_id'] = $order_inquiry_id; - $params['status'] = 1; - $order_inquiry_case = OrderInquiryCase::getOne($params); - - // 计数器减一 - $wg->done(); - }); - - $wg->wait(); - - if (empty($user)) { - throw new BusinessException("用户数据错误"); - } - if (empty($patient_family)) { - throw new BusinessException("用户家庭成员错误"); - } - if (empty($order_prescription_icd)) { - throw new BusinessException("处方疾病数据错误"); - } - if (empty($user_doctor)) { - throw new BusinessException("医生数据错误"); - } - if (empty($user_doctor_info)) { - throw new BusinessException("医生详情数据错误"); - } - if (empty($user_pharmacist)) { - throw new BusinessException("药师数据错误"); - } - if (empty($user_pharmacist_info)) { - throw new BusinessException("药师详情数据错误"); - } - if (empty($order_inquiry_case)) { - throw new BusinessException("病例数据错误"); - } - - // 处理疾病数据 - $icd_name = array_column($order_prescription_icd->toArray(), 'icd_name'); - if (!empty($icd_name)) { - if (count($icd_name) > 1) { - $icd_name = implode(';', $icd_name); - } else { - $icd_name = $icd_name[0]; - } - } else { - $icd_name = ""; - } - - // 获取医生科室 - $params = array(); - $params['department_custom_id'] = $user_doctor['department_custom_id']; - $hospital_department_custom = HospitalDepartmentCustom::getOne($params); - if (empty($hospital_department_custom)) { - throw new BusinessException("医生科室数据错误"); - } - - $arg = array(); - $arg['terminalCode'] = "ZD-10003"; - $arg['orderNo'] = $order_product['order_product_no']; // 订单编号 - $arg['transactNo'] = $order_product['escrow_trade_no']; // 流水单号 - $arg['payDate'] = $order_product['pay_time']; // 支付时间 - $arg['money'] = $order_product['payment_amount_total']; // 订单金额 - $arg['freight'] = $order_product['logistics_fee']; // 运费(单位:元) - $arg['takeTypeCode'] = 2; // 取货方式 1 自提 2 快递,目前只支持快递,传固定值 2 - $arg['buyerName'] = $order_product['consignee_name'];// 收货人姓名 - $arg['buyerPhone'] = $order_product['consignee_tel'];// 收货人联系方式 - $arg['buyerAddress'] = $order_product['address'];// 收货人地址 - $arg['provinceCode'] = $order_product['province_id']; // 收货地址(省) 编码 - $arg['provinceName'] = $order_product['province']; // 收货地址(省) 名称 - $arg['cityCode'] = $order_product['city_id']; // 收货地址(市) 编码 - $arg['cityName'] = $order_product['city']; // 收货地址(市) 名称 - $arg['districtCode'] = $order_product['county_id']; // 收货地址(区 县)编码 - $arg['districtName'] = $order_product['county']; // 收货地址(区 县)名称 - - $arg['presList'][0]['prescriptionNo'] = $order_prescription['prescription_code']; // 处方编号 - $arg['presList'][0]['prescriptionSubType'] = 1; // 处方类型 0:无类型 1:普 通处方 2:儿科处 方 - $arg['presList'][0]['patientName'] = $order_prescription['patient_name']; // 就诊人姓名 - $arg['presList'][0]['patientPhone'] = $user['mobile']; // 就诊人联系方式 - $arg['presList'][0]['idCard'] = $patient_family['id_number']; // 身份证号 - $arg['presList'][0]['advice'] = $order_prescription['doctor_advice'] ?: ""; // 医嘱 - $arg['presList'][0]['diagnosisName'] = $icd_name ?: ""; // 诊断 - $arg['presList'][0]['thirdDoctorName'] = $user_doctor['user_name']; // 开方医生姓名 - $arg['presList'][0]['thirdDeptName'] = $hospital_department_custom['department_name'] ?: ""; // 开方科室名称 - $arg['presList'][0]['thirdDoctorNameImg'] = addAliyunOssWebsite($user_doctor_info['sign_image']); // 开方医生签名链接 - $arg['presList'][0]['prescriptionTime'] = $order_prescription['doctor_created_time']; // 开方时间 - $arg['presList'][0]['thirdFirstPharmacist'] = $user_pharmacist['user_name']; // 初审药师姓名 - $arg['presList'][0]['thirdFirstPharmacistImg'] = addAliyunOssWebsite($user_pharmacist_info['sign_image']); // 初审药师签名链接 - $arg['presList'][0]['thirdFirstTime'] = $order_prescription['pharmacist_verify_time']; // 初审时间 - $arg['presList'][0]['thirdLastPharmacist'] = $user_pharmacist['user_name']; // 终审药师姓名 - $arg['presList'][0]['thirdLastPharmacistImg'] = addAliyunOssWebsite($user_pharmacist_info['sign_image']); // 终审药师签名 链接 - $arg['presList'][0]['ThirdLastTime'] = $order_prescription['pharmacist_verify_time']; // 终审时间 - $arg['presList'][0]['thirdSignImg'] = addAliyunOssWebsite("/basic/file/hospital_signature.png"); // 处方签章链接 - $arg['presList'][0]['referenceCharge'] = $order_product['amount_total']; // 处方费用(不包含运费) - $arg['presList'][0]['chiefComplaint'] = $order_inquiry_case['disease_desc'] ?: ""; // 主诉 - $arg['presList'][0]['historyPresent'] = $order_inquiry_case['disease_class_name'] ?: ""; // 现病史 - $arg['presList'][0]['pastHistory'] = $order_inquiry_case['family_history'] ?: "无"; // 既往史 - $arg['presList'][0]['physicalExamination'] = "无"; // 体格检查 - $arg['presList'][0]['supplementaryExamination'] = "无"; // 辅助检查 - $arg['presList'][0]['allergicHistory'] = $order_inquiry_case['allergy_history'] ?: "无"; // 过敏史 - - // 药品数据 - foreach ($order_product_item as $key => $item) { - // 获取商品数据 - $params = array(); - $params['product_id'] = $item['product_id']; - $product = Product::getOne($params); - if (empty($product)) { - throw new BusinessException("药品数据错误"); - } - - $arg['presList'][0]['drugList'][$key]['drugCode'] = $product['product_platform_code']; // 药品编码 - $arg['presList'][0]['drugList'][$key]['approvalNumber'] = $product['license_number']; // 批准文号 - $arg['presList'][0]['drugList'][$key]['drugName'] = $product['product_name']; // 药品名称 - $arg['presList'][0]['drugList'][$key]['specifications'] = $product['product_spec']; // 药品规格 - $arg['presList'][0]['drugList'][$key]['price'] = $product['product_price']; // 药品单价 - $arg['presList'][0]['drugList'][$key]['packingCount'] = $item['amount']; // 药品数量 - $arg['presList'][0]['drugList'][$key]['surplusPackingCount'] = 0; // 处方药品剩余使用数量 - $arg['presList'][0]['drugList'][$key]['packingUnit'] = $product['packaging_unit']; // 药品单位 - $arg['presList'][0]['drugList'][$key]['singleDosage'] = 1; // 单次用量 - $arg['presList'][0]['drugList'][$key]['singleDosageUnit'] = "片"; // 单次用量单位 - $arg['presList'][0]['drugList'][$key]['useName'] = $product['single_use']; // 用法名称 - $arg['presList'][0]['drugList'][$key]['frequencyName'] = $product['frequency_use']; // 频次名称 - $arg['presList'][0]['drugList'][$key]['useDays'] = $product['available_days']; // 使用天数 - - $arg['presList'][0]['orderDrugList'][$key]['drugCode'] = $product['product_platform_code']; // 药品编码 - $arg['presList'][0]['orderDrugList'][$key]['approvalNumber'] = $product['license_number']; // 批准文号 - $arg['presList'][0]['orderDrugList'][$key]['drugName'] = $product['product_name']; // 药品名称 - $arg['presList'][0]['orderDrugList'][$key]['specifications'] = $product['product_spec']; // 药品规格 - $arg['presList'][0]['orderDrugList'][$key]['price'] = $product['product_price']; // 药品单价 - $arg['presList'][0]['orderDrugList'][$key]['drugCount'] = $item['amount']; // 药品数量 - $arg['presList'][0]['orderDrugList'][$key]['packingUnit'] = $product['packaging_unit']; // 药品单位 - } - - $Prescription = new Prescription(); - $result = $Prescription->reportPrescription($arg); - if ($result['resultCode'] != "1000"){ - if(!empty($result['resultDesc'])){ - throw new BusinessException("上报处方平台失败:" .$result['resultDesc']); - } - - throw new BusinessException("上报处方平台失败:操作编码:" . $result['resultCode']); - } - - return true; - } - -} \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index 5e5e2fa..fc5717b 100644 --- a/config/routes.php +++ b/config/routes.php @@ -274,6 +274,9 @@ Router::addGroup('/patient', function () { // 获取检测机构合作医生列表 Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']); + // 获取患者进行中的订单 + Router::get('/progress-order', [DetectionController::class, 'getDetectionDoctorList']); + // 检测项目 Router::addGroup('/project', function () { // 获取合作公司检测项目列表 From ac9c3dee38a33c6492efd557034c6bf00ca2b081 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 1 Aug 2023 09:53:31 +0800 Subject: [PATCH 014/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CancelUnpayOrdersDelayDirectConsumer.php | 17 ++++++--- app/Services/DetectionService.php | 38 ++++++++++--------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/app/Amqp/Consumer/CancelUnpayOrdersDelayDirectConsumer.php b/app/Amqp/Consumer/CancelUnpayOrdersDelayDirectConsumer.php index 5daa9e1..b945f92 100644 --- a/app/Amqp/Consumer/CancelUnpayOrdersDelayDirectConsumer.php +++ b/app/Amqp/Consumer/CancelUnpayOrdersDelayDirectConsumer.php @@ -13,6 +13,7 @@ use App\Model\OrderProductItem; use App\Model\Product; use App\Model\ProductPlatformAmount; use App\Model\UserCoupon; +use App\Services\DetectionService; use App\Services\InquiryService; use App\Services\OrderProductService; use App\Utils\Log; @@ -48,7 +49,7 @@ class CancelUnpayOrdersDelayDirectConsumer extends ConsumerMessage public function consumeMessage($data, AMQPMessage $message): string { - Log::getInstance()->error("开始执行 取消未支付订单 队列:" . json_encode($data, JSON_UNESCAPED_UNICODE)); + Log::getInstance("queue-CancelUnpayOrders")->error("开始执行 取消未支付订单 队列:" . json_encode($data, JSON_UNESCAPED_UNICODE)); Db::beginTransaction(); @@ -63,27 +64,31 @@ class CancelUnpayOrdersDelayDirectConsumer extends ConsumerMessage $OrderProductService = new OrderProductService(); $result = $OrderProductService->cancelUnpayProductOrder($data['order_no'], 3, "支付超时"); + } elseif ($data['order_type'] == 3) { + // 检测订单取消 + $DetectionService = new DetectionService(); + $result = $DetectionService->cancelUnpayDetectionOrder($data['order_no'], 3, "支付超时"); } else { - Log::getInstance()->error("取消未支付订单失败:order_type类型错误"); + Log::getInstance("queue-CancelUnpayOrders")->error("取消未支付订单失败:order_type类型错误"); return Result::DROP;// 销毁 } if ($result['status'] == 0) { Db::rollBack(); - Log::getInstance()->error("取消未支付订单失败:" . $result['message']); + Log::getInstance("queue-CancelUnpayOrders")->error("取消未支付订单失败:" . $result['message']); return Result::DROP;// 销毁 } elseif ($result['status'] == 2) { Db::rollBack(); - Log::getInstance()->info("取消未支付订单成功:" . $result['message']); + Log::getInstance("queue-CancelUnpayOrders")->info("取消未支付订单成功:" . $result['message']); return Result::ACK;// 销毁 } Db::commit(); - Log::getInstance()->info("取消未支付订单 队列执行成功"); + Log::getInstance("queue-CancelUnpayOrders")->info("取消未支付订单 队列执行成功"); return Result::ACK; } catch (\Exception $e) { Db::rollBack(); - Log::getInstance()->error("取消未支付订单执行失败:" . $e->getMessage()); + Log::getInstance("queue-CancelUnpayOrders")->error("取消未支付订单执行失败:" . $e->getMessage()); return Result::ACK; // 重回队列 } } diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 2974159..d27fd4e 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -393,9 +393,6 @@ class DetectionService extends BaseService $detection_pay_channel = 2; } - // 处理订单金额 - - Db::beginTransaction(); $generator = $this->container->get(IdGeneratorInterface::class); @@ -443,18 +440,18 @@ class DetectionService extends BaseService } // 增加至未支付取消订单延迟队列 -// $data = array(); -// $data['order_no'] = $order_detection['detection_no']; -// $data['order_type'] = 3; -// -// $message = new CancelUnpayOrdersDelayDirectProducer($data); -// $message->setDelayMs(1000 * 60 * 30); -// $producer = $this->container->get(Producer::class); -// $res = $producer->produce($message); -// if (!$res) { -// Db::rollBack(); -// return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败"); -// } + $data = array(); + $data['order_no'] = $order_detection['detection_no']; + $data['order_type'] = 3; + + $message = new CancelUnpayOrdersDelayDirectProducer($data); + $message->setDelayMs(1000 * 60 * 30); + $producer = $this->container->get(Producer::class); + $res = $producer->produce($message); + if (!$res) { + Db::rollBack(); + return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败"); + } Db::commit(); }catch (\Exception $e){ @@ -468,8 +465,15 @@ class DetectionService extends BaseService return success($result); } - // 取消未支付检测订单 - public function cancelUnpayDetectionOrder(string|int $order_no, string|int $cancel_reason, string|int $cancel_remarks){ + /** + * 取消未支付检测订单 + * @param string|int $order_no 订单编号 + * @param string|int $cancel_reason 取消订单原因(1:主动取消 2:客服取消 3:支付超时) + * @param string|int $cancel_remarks 取消备注 + * @return array + */ + public function cancelUnpayDetectionOrder(string|int $order_no, string|int $cancel_reason, string|int $cancel_remarks): array + { $result = array(); $result['status'] = 1; $result['message'] = "成功"; From a1b0d6556cabc224122a517fd56e5f2e9a2aa992 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 1 Aug 2023 11:18:20 +0800 Subject: [PATCH 015/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E7=B1=BB=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E8=AE=A2=E5=8D=95=E8=8E=B7=E5=8F=96=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientOrderService.php | 96 +++++++++++++++++++++++----- config/config.php | 2 + extend/Wechat/WechatPay.php | 14 ++-- 3 files changed, 91 insertions(+), 21 deletions(-) diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index b89c71a..4b9aef4 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -8,6 +8,7 @@ use App\Constants\DoctorTitleCode; use App\Constants\HttpEnumCode; use App\Model\BasicLogisticsCompany; use App\Model\Hospital; +use App\Model\OrderDetection; use App\Model\OrderInquiry; use App\Model\OrderInquiryCase; use App\Model\OrderInquiryCoupon; @@ -683,7 +684,7 @@ class PatientOrderService extends BaseService $result['order_no'] = $order_no; // 订单编号 $result['order_id'] = ""; // 订单主键id(问诊订单:order_inquiry_id 药品订单:order_product_id) $result['created_at'] = ""; // 创建时间 - $result['inquiry_type'] = 0; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) + $result['inquiry_type'] = 0; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) $result['pay_config'] = []; // 小程序支付配置 if ($order_type == 1) { @@ -699,17 +700,18 @@ class PatientOrderService extends BaseService // 验证订单状态 if ($order_inquiry['inquiry_status'] != 1) { $return_result['message'] = "订单状态错误"; - $return_result['data']['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - $return_result['data']['inquiry_status'] = $order_inquiry['inquiry_status']; - $return_result['data']['inquiry_pay_status'] = $order_inquiry['inquiry_pay_status']; + $return_result['data']['order_id'] = $order_inquiry['order_inquiry_id']; + $return_result['data']['order_status'] = $order_inquiry['inquiry_status']; + $return_result['data']['order_pay_status'] = $order_inquiry['inquiry_pay_status']; + return success($return_result); } // 验证订单支付状态 if ($order_inquiry['inquiry_pay_status'] != 1) { $return_result['message'] = "订单支付状态错误"; - $return_result['data']['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - $return_result['data']['inquiry_status'] = $order_inquiry['inquiry_status']; - $return_result['data']['inquiry_pay_status'] = $order_inquiry['inquiry_pay_status']; + $return_result['data']['order_id'] = $order_inquiry['order_inquiry_id']; + $return_result['data']['order_status'] = $order_inquiry['inquiry_status']; + $return_result['data']['order_pay_status'] = $order_inquiry['inquiry_pay_status']; return success($return_result); } @@ -717,9 +719,9 @@ class PatientOrderService extends BaseService $diff_time = (strtotime($order_inquiry['created_at']) - time()) / 60; if ($diff_time >= 30){ $return_result['message'] = "订单已过期"; - $return_result['data']['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - $return_result['data']['inquiry_status'] = $order_inquiry['inquiry_status']; - $return_result['data']['inquiry_pay_status'] = $order_inquiry['inquiry_pay_status']; + $return_result['data']['order_id'] = $order_inquiry['order_inquiry_id']; + $return_result['data']['order_status'] = $order_inquiry['inquiry_status']; + $return_result['data']['order_pay_status'] = $order_inquiry['inquiry_pay_status']; return success($return_result); } @@ -738,7 +740,7 @@ class PatientOrderService extends BaseService // 获取预支付交易会话标识 - $prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_inquiry['payment_amount_total'] * 100), $user_info['open_id']); + $prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_inquiry['payment_amount_total'] * 100), $user_info['open_id'],"问诊服务"); if (empty($prepay)) { return fail(HttpEnumCode::SERVER_ERROR); } @@ -759,9 +761,9 @@ class PatientOrderService extends BaseService // 验证订单状态 if ($order_product['order_product_status'] != 1) { $return_result['message'] = "订单状态错误"; - $return_result['data']['order_product_id'] = $order_product['order_product_id']; - $return_result['data']['order_product_status'] = $order_product['order_product_status']; - $return_result['data']['pay_status'] = $order_product['pay_status']; + $return_result['data']['order_id'] = $order_product['order_product_id']; + $return_result['data']['order_status'] = $order_product['order_product_status']; + $return_result['data']['order_pay_status'] = $order_product['pay_status']; return success($return_result); } @@ -770,7 +772,7 @@ class PatientOrderService extends BaseService $return_result['message'] = "订单支付状态错误"; $return_result['data']['order_product_id'] = $order_product['order_product_id']; $return_result['data']['order_product_status'] = $order_product['order_product_status']; - $return_result['data']['pay_status'] = $order_product['pay_status']; + $return_result['data']['order_pay_status'] = $order_product['pay_status']; return success($return_result); } @@ -780,7 +782,7 @@ class PatientOrderService extends BaseService $return_result['message'] = "订单已过期"; $return_result['data']['order_product_id'] = $order_product['order_product_id']; $return_result['data']['order_product_status'] = $order_product['order_product_status']; - $return_result['data']['pay_status'] = $order_product['pay_status']; + $return_result['data']['order_pay_status'] = $order_product['pay_status']; return success($return_result); } @@ -797,7 +799,67 @@ class PatientOrderService extends BaseService $WechatPay = new WechatPay(1,2); // 获取预支付交易会话标识 - $prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_product['payment_amount_total'] * 100), $user_info['open_id']); + $prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_product['payment_amount_total'] * 100), $user_info['open_id'],"问诊服务"); + if (empty($prepay)) { + return fail(HttpEnumCode::SERVER_ERROR); + } + + // 获取小程序支付配置 + $pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']); + } + } elseif ($order_type == 3) { + // 检测订单 + // 获取检测订单数据 + $params = array(); + $params['detection_no'] = $order_no; + $params['patient_id'] = $user_info['client_user_id']; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + return fail(HttpEnumCode::HTTP_ERROR, "非法订单"); + } + + // 验证订单状态 + if ($order_detection['detection_status'] != 1) { + $return_result['message'] = "订单状态错误"; + $return_result['data']['order_id'] = $order_detection['order_detection_id']; + $return_result['data']['order_status'] = $order_detection['detection_status']; + $return_result['data']['order_pay_status'] = $order_detection['detection_pay_status']; + return success($return_result); + } + + // 验证订单支付状态 + if ($order_detection['inquiry_pay_status'] != 1) { + $return_result['message'] = "订单支付状态错误"; + $return_result['data']['order_id'] = $order_detection['order_detection_id']; + $return_result['data']['order_status'] = $order_detection['detection_status']; + $return_result['data']['order_pay_status'] = $order_detection['detection_pay_status']; + return success($return_result); + } + + // 验证订单过期支付时间 + $diff_time = (strtotime($order_detection['created_at']) - time()) / 60; + if ($diff_time >= 30){ + $return_result['message'] = "订单已过期"; + $return_result['data']['order_id'] = $order_detection['order_detection_id']; + $return_result['data']['order_status'] = $order_detection['detection_status']; + $return_result['data']['order_pay_status'] = $order_detection['detection_pay_status']; + return success($return_result); + } + + $result['order_id'] = $order_detection['order_detection_id']; + $result['created_at'] = $order_detection['created_at']; + + // 获取订单金额 + $result['amount_total'] = $order_detection['amount_total']; // 订单金额 + $result['payment_amount_total'] = $order_detection['amount_total']; // 实际订单金额 + $result['coupon_amount_total'] = 0; // 优惠金额 + + if ($order_detection['payment_amount_total'] > 0 ){ + // 发起支付 + $WechatPay = new WechatPay(1,3); + + // 获取预支付交易会话标识 + $prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_detection['payment_amount_total'] * 100), $user_info['open_id'],"检测服务"); if (empty($prepay)) { return fail(HttpEnumCode::SERVER_ERROR); } diff --git a/config/config.php b/config/config.php index 8b0ae64..f412388 100644 --- a/config/config.php +++ b/config/config.php @@ -46,6 +46,8 @@ return [ "inquiry_refund_notify_url" => env('PATIENT_WECHAT_INQUIRY_REFUND_NOTIFY_URL', 'callback/wxpay/inquiry/refund'), "product_pay_notify_url" => env('PATIENT_WECHAT_PRODUCT_PAY_NOTIFY_URL', 'callback/wxpay/product/success'), "product_refund_notify_url" => env('PATIENT_WECHAT_PRODUCT_REFUND_NOTIFY_URL', 'callback/wxpay/product/refund'), + "detection_pay_notify_url" => env('PATIENT_WECHAT_DETECTION_PAY_NOTIFY_URL', 'callback/wxpay/detection/success'), + "detection_refund_notify_url" => env('PATIENT_WECHAT_DETECTION_REFUND_NOTIFY_URL', 'callback/wxpay/detection/refund'), ], "pharmacist" => [ "app_id" => env('DOCTOR_WECHAT_APP_ID', 'wxc83296720404aa7b'), diff --git a/extend/Wechat/WechatPay.php b/extend/Wechat/WechatPay.php index 0cea2a6..897f07d 100644 --- a/extend/Wechat/WechatPay.php +++ b/extend/Wechat/WechatPay.php @@ -28,7 +28,7 @@ class WechatPay /** * @param string $user_type 用户类型(1:患者端 2:专家端 3:药师端) - * @param int $order_type 订单类型(1:问诊订单 2:药品订单) + * @param int $order_type 订单类型(1:问诊订单 2:药品订单 3:检测订单) */ public function __construct(string $user_type,int $order_type) { @@ -46,7 +46,7 @@ class WechatPay throw new BusinessException("系统配置错误", HttpEnumCode::SERVER_ERROR); } - if (!in_array($order_type,[1,2])){ + if (!in_array($order_type,[1,2,3])){ throw new BusinessException("订单类型错误", HttpEnumCode::SERVER_ERROR); } @@ -60,6 +60,11 @@ class WechatPay $this->refund_notify_url = $this->config['product_refund_notify_url']; } + if ($order_type == 3){ + $this->pay_notify_url = $this->config['detection_pay_notify_url']; + $this->refund_notify_url = $this->config['detection_refund_notify_url']; + } + $app_env = config('app_env','dev'); if ($app_env == "prod"){ $this->domain_name = env('DOMAIN_NAME_PROD','https://prod.hospital.applets.igandanyiyuan.com/'); @@ -122,11 +127,12 @@ class WechatPay * @param string $out_trade_no 商户系统内部订单号 * @param int $total 支付金额(实际金额x100) * @param string $openid + * @param string $description 备注 * @return array * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function getJsapiPrepayId(string $out_trade_no,int $total,string $openid): array + public function getJsapiPrepayId(string $out_trade_no,int $total,string $openid,string $description): array { $app = $this->createApp(); @@ -134,7 +140,7 @@ class WechatPay "mchid" => $this->pay_config['mch_id'], // <---- 商户号 "out_trade_no" => $out_trade_no, // 商户系统内部订单号 "appid" => $this->config['app_id'], - "description" => "问诊服务", + "description" => $description, "notify_url" => $this->domain_name . $this->pay_notify_url, "amount" => [ "total" => $total,//订单总金额,单位为分。 From 20680191459da4ce4901a9e013fba63aef7ab2a6 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 1 Aug 2023 13:31:06 +0800 Subject: [PATCH 016/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=9B=9E=E8=B0=83=EF=BC=8C=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 208 +++++++++++++++++++++++++- app/Model/OrderDetectionRefund.php | 84 +++++++++++ 2 files changed, 290 insertions(+), 2 deletions(-) create mode 100644 app/Model/OrderDetectionRefund.php diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 188ff6b..bdc4146 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -9,6 +9,8 @@ use App\Exception\BusinessException; use App\Model\BasicLogisticsCompany; use App\Model\Hospital; use App\Model\MessageIm; +use App\Model\OrderDetection; +use App\Model\OrderDetectionRefund; use App\Model\OrderInquiry; use App\Model\OrderInquiryCoupon; use App\Model\OrderInquiryRefund; @@ -247,7 +249,7 @@ class CallBackController extends AbstractController // 验证订单支付状态 if (in_array($order_inquiry['inquiry_pay_status'], [1, 3, 4, 5, 6, 7])) { // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) - Log::getInstance()->error("队列执行失败原因:订单未支付"); + Log::getInstance()->info("订单支付状态错误:当前为" . $order_inquiry['inquiry_pay_status']); return $server->serve(); } @@ -265,7 +267,7 @@ class CallBackController extends AbstractController if (empty($inquiry_refund_status)) { // 错误,无退款状态 - Log::getInstance()->error("队列执行失败原因:订单未支付"); + Log::getInstance()->info("订单支付状态错误:未接收到退款状态"); return $this->wxPayErrorReturn("退款状态错误"); } @@ -1102,4 +1104,206 @@ class CallBackController extends AbstractController ); } + /** + * 患者端检测支付回调 + * @return ResponseInterface + * @throws \Throwable + */ + public function wxPayDetectionSuccessCallBack(): ResponseInterface + { + try { + // 处理支付结果事件 + $WechatPay = new WechatPay(1, 3); + $app = $WechatPay->createApp(); + $server = $app->getServer(); + + $message = $server->getRequestMessage(); + if (empty($message)) { + return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => "问诊微信支付回调数据为空"], JSON_UNESCAPED_UNICODE)))); + } + + // 验证推送消息签名 + $app->getValidator()->validate($app->getRequest()); + + Log::getInstance()->info("检测微信支付回调数据:" . json_encode($message->toArray(), JSON_UNESCAPED_UNICODE)); + + if (empty($message['out_trade_no'])) { + Log::getInstance()->info("检测微信支付回调数据处理失败,缺少外部订单号"); + return $server->serve(); + } + + // 查询订单 + $params = array(); + $params['detection_no'] = $message['out_trade_no']; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + Log::getInstance()->info("检测微信支付回调数据处理失败,无订单数据"); + return $server->serve(); + } + + // 验证订单状态 + if ($order_detection['detection_status'] != 1) { + // 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + Log::getInstance()->info("检测微信支付回调数据处理失败,订单状态当前为" . $order_detection['detection_status']); + return $server->serve(); + } + + // 支付状态无需验证,如第一次支付失败,会修改支付状态,再次支付时,会出现验证不通过的情况 + + // 修改支付状态 + $data = array(); + if ($message['trade_state'] == "SUCCESS") { + // 支付成功 + $data['detection_pay_status'] = 2; + $data['pay_time'] = date('Y-m-d H:i:s', strtotime($message['success_time']));// 支付时间 + $data['detection_status'] = 2;// 2:待绑定 + if (empty($message['amount'])){ + Log::getInstance()->error("检测微信支付回调数据处理失败:无支付金额"); + return $this->wxPayErrorReturn("检测微信支付回调数据处理失败:无支付金额"); + } + + // 实际付款金额 + $data['payment_amount_total'] = $message['amount']['payer_total']; + } elseif ($message['trade_state'] == "CLOSED") { + // 已关闭 + $data['detection_pay_status'] = 6; + } elseif ($message['trade_state'] == "REVOKED") { + // 已撤销(付款码支付) + $data['detection_pay_status'] = 7; + } elseif ($message['trade_state'] == "USERPAYING") { + // 用户支付中(付款码支付) + $data['detection_pay_status'] = 3; + } elseif ($message['trade_state'] == "PAYERROR") { + // 支付失败(其他原因,如银行返回失败) + $data['detection_pay_status'] = 4; + } + + $data['escrow_trade_no'] = $message['transaction_id']; + $data['updated_at'] = date('Y-m-d H:i:s', time()); + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params, $data); + } catch (\Exception $e) { + // 验证失败 + Log::getInstance()->error("问诊微信支付回调数据处理失败:" . $e->getMessage()); + return $this->wxPayErrorReturn($e->getMessage()); + } + + Log::getInstance()->info("检测微信支付回调处理成功"); + + return $server->serve(); + } + + /** + * 微信检测退款回调 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + * @throws \Throwable + */ + public function wxPayDetectionRefundCallBack(): ResponseInterface + { + Db::beginTransaction(); + + try { + // 处理支付结果事件 + $WechatPay = new WechatPay(1, 1); + $app = $WechatPay->createApp(); + $server = $app->getServer(); + + $message = $server->getRequestMessage(); + if (empty($message)) { + Db::rollBack(); + return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => "回调数据为空"], JSON_UNESCAPED_UNICODE)))); + } + + // 验证推送消息签名 + $app->getValidator()->validate($app->getRequest()); + + Log::getInstance()->info("微信退款回调数据:" . json_encode($message->toArray(), JSON_UNESCAPED_UNICODE)); + + if (empty($message['out_trade_no'])) { + Log::getInstance()->info("微信退款回调数据错误"); + return $server->serve(); + } + + // 验证订单数据 + $params = array(); + $params['detection_no'] = $message['out_trade_no']; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + Log::getInstance()->info("非法订单"); + return $server->serve(); + } + + // 验证订单状态 + if ($order_detection['detection_status'] == 1) { + // 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + Log::getInstance()->info("订单状态错误:当前为" . $order_detection['detection_status']); + return $server->serve(); + } + + // 验证订单退款状态 + if ($order_detection['detection_refund_status'] == 3) { + // 检测订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) + Log::getInstance()->info("订单退款状态错误:当前为" . $order_detection['detection_refund_status']); + return $server->serve(); + } + + // 验证订单支付状态 + if (in_array($order_detection['detection_pay_status'], [1, 3, 4, 5, 6, 7])) { + // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) + Log::getInstance()->info("订单支付状态错误:当前为" . $order_detection['detection_pay_status']); + return $server->serve(); + } + + // 退款状态 + if ($message['refund_status'] == "SUCCESS") { + // 退款成功 + $detection_refund_status = 3; + } elseif ($message['refund_status'] == "CLOSED") { + // 退款关闭 + $detection_refund_status = 5; + } elseif ($message['refund_status'] == "ABNORMAL") { + // 退款异常 + $detection_refund_status = 6; + } + + if (empty($detection_refund_status)) { + // 错误,无退款状态 + Log::getInstance()->error("队列执行失败原因:订单未支付"); + return $this->wxPayErrorReturn("退款状态错误"); + } + + // 修改订单 + $data = array(); + $data['detection_refund_status'] = $detection_refund_status; + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params, $data); + + // 修改退款订单 + $data = array(); + $data['detection_refund_status'] = $detection_refund_status; + $data['success_time'] = $message['success_time']; + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetectionRefund::edit($params, $data); + + Db::commit(); + } catch (\Exception $e) { + // 验证失败 + Db::rollBack(); + Log::getInstance()->error("微信支付回调数据验证失败:" . $e->getMessage()); + return $this->wxPayErrorReturn($e->getMessage()); + } + + Log::getInstance()->info("微信退款回调处理成功"); + + return $server->serve(); + } + } \ No newline at end of file diff --git a/app/Model/OrderDetectionRefund.php b/app/Model/OrderDetectionRefund.php new file mode 100644 index 0000000..4b5b5cb --- /dev/null +++ b/app/Model/OrderDetectionRefund.php @@ -0,0 +1,84 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增-批量 + * @param array $data 新增数据 + * @return \Hyperf\Database\Model\Model|OrderDetectionRefund + */ + public static function add(array $data): \Hyperf\Database\Model\Model|OrderDetectionRefund + { + return self::create($data); + } + + /** + * 修改-批量 + * @param array $params + * @param array $data + * @return int + */ + public static function edit(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } +} From 15738f0c5ac03bc2aad5dcafdd832a9c8c4f1b15 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 1 Aug 2023 15:45:52 +0800 Subject: [PATCH 017/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=82=A3=E8=80=85=E9=97=AE=E8=AF=8A=E8=AE=A2=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/PatientOrderController.php | 17 ++++ app/Model/OrderDetection.php | 29 ++++++ app/Request/PatientOrderRequest.php | 9 ++ app/Services/PatientOrderService.php | 108 ++++++++++++++++++++++ 4 files changed, 163 insertions(+) diff --git a/app/Controller/PatientOrderController.php b/app/Controller/PatientOrderController.php index 67e5afc..5c68fe8 100644 --- a/app/Controller/PatientOrderController.php +++ b/app/Controller/PatientOrderController.php @@ -236,4 +236,21 @@ class PatientOrderController extends AbstractController $data = $PatientOrderService->deletePatientPrescriptionOrder(); return $this->response->json($data); } + + /** + * 获取患者检测订单列表 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function getPatientDetectionOrderList(): ResponseInterface + { + $request = $this->container->get(PatientOrderRequest::class); + $request->scene('getPatientDetectionOrderList')->validateResolved(); + + $PatientOrderService = new PatientOrderService(); + $data = $PatientOrderService->getPatientDetectionOrderList(); + return $this->response->json($data); + } + } \ No newline at end of file diff --git a/app/Model/OrderDetection.php b/app/Model/OrderDetection.php index 2ab58dc..cac8b2d 100644 --- a/app/Model/OrderDetection.php +++ b/app/Model/OrderDetection.php @@ -109,4 +109,33 @@ class OrderDetection extends Model { return self::where($params)->whereIn('detection_status',[1,2,3])->first($fields); } + + /** + * 获取问诊订单分页 + * 已结束 + * @param array $params + * @param array $detection_status_params + * @param array $fields + * @param int|null $page + * @param int|null $per_page + * @return array + */ + public static function getPatientOrderDetectionPage(array $params, array $detection_status_params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array + { + $raw = self::where($params) + ->when($detection_status_params, function ($query, $detection_status_params) { + $query->whereIn('detection_status', $detection_status_params); + }) + ->orderBy('created_at', 'desc') + ->paginate($per_page, $fields, "page", $page); + + $data = array(); + $data['current_page'] = $raw->currentPage();// 当前页码 + $data['total'] = $raw->total();//数据总数 + $data['data'] = $raw->items();//数据 + $data['per_page'] = $raw->perPage();//每页个数 + $data['last_page'] = $raw->lastPage();//最后一页 + + return $data; + } } diff --git a/app/Request/PatientOrderRequest.php b/app/Request/PatientOrderRequest.php index 18a5879..81760cf 100644 --- a/app/Request/PatientOrderRequest.php +++ b/app/Request/PatientOrderRequest.php @@ -33,6 +33,10 @@ class PatientOrderRequest extends FormRequest ], 'getPatientPrescriptionOrderList' => [ // 获取处方订单列表 ], + 'getPatientDetectionOrderList' => [ // 获取患者检测订单列表 + 'detection_status',// 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + 'family_id',// 家庭成员id(就诊用户) + ], ]; /** @@ -75,6 +79,7 @@ class PatientOrderRequest extends FormRequest 'order_prescription_id' => 'required', 'address_id' => 'required', 'product_ids' => 'required|array|min:1', + 'detection_status' => 'required|integer|min:0|max:5', ]; } @@ -127,6 +132,10 @@ class PatientOrderRequest extends FormRequest 'product_ids.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'product_ids.array' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'product_ids.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'detection_status.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'detection_status.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'detection_status.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'detection_status.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), ]; } } diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 4b9aef4..c8fde72 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1538,6 +1538,114 @@ class PatientOrderService extends BaseService return success(); } + /** + * 获取患者检测订单列表 + * @return array + */ + public function getPatientDetectionOrderList(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $detection_status = $this->request->input('detection_status', 0); + $family_id = $this->request->input('family_id'); + $page = $this->request->input('page', 1); + $per_page = $this->request->input('per_page', 10); + + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + if (!empty($family_id)) { + $params['family_id'] = $family_id; + } + + $detection_status_params = []; + if (!empty($detection_status) && $detection_status != 0) { + // 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + $detection_status_params = [$detection_status]; + } + + $params['is_delete'] = 0; + + $fields = [ + 'order_detection_id', + 'patient_id', + 'doctor_id', + 'family_id', + 'detection_status', + 'is_delete', + 'detection_refund_status', + 'detection_pay_channel', + 'detection_pay_status', + 'detection_no', + 'escrow_trade_no', + 'amount_total', + 'payment_amount_total', + 'patient_name', + 'patient_name_mask', + 'patient_sex', + 'patient_age', + 'created_at', + ]; + dump($params); + dump($detection_status_params); + dump($fields); + $order_detection = OrderDetection::getPatientOrderDetectionPage($params, $detection_status_params, $fields, $page, $per_page); + if (empty($order_detection['data'])) { + return success($order_detection); + } + + foreach ($order_detection['data'] as &$item) { + // 获取医生数据 + $item['user_doctor'] = []; + if (!empty($item['doctor_id'])) { + $fields = [ + 'doctor_id', + 'user_name', + 'doctor_title', + 'hospital_id', + "avatar" + ]; + + $params = array(); + $params['doctor_id'] = $item['doctor_id']; + $user_doctor = UserDoctor::getOne($params, $fields); + if (empty($user_doctor)) { + return fail(HttpEnumCode::SERVER_ERROR); + } + + // 转换医生职称 + $user_doctor['doctor_title'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']); + + // 获取医生医院名称 + $user_doctor['hospital_name'] = ""; + $user_doctor['hospital_level_name'] = ""; + + // 医生头像 + $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); + + $fields = [ + 'hospital_id', + 'hospital_name', + 'hospital_level_name', + ]; + + $params = array(); + $params['hospital_id'] = $user_doctor['hospital_id']; + $hospital = Hospital::getOne($params, $fields); + if (!empty($hospital)) { + $user_doctor['hospital_name'] = $hospital['hospital_name']; + $user_doctor['hospital_level_name'] = $hospital['hospital_level_name']; + } + + $item['user_doctor'] = $user_doctor; + unset($hospital); + unset($user_doctor); + } + } + + return success($order_detection); + } + + /** * 获取患者未完成订单 * @param string $patient_id From 3732976a2b36dfb485f93e730b8f5f404e0e6a69 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 1 Aug 2023 17:35:24 +0800 Subject: [PATCH 018/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=82=A3=E8=80=85=E6=A3=80=E6=B5=8B=E8=AE=A2=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/PatientOrderController.php | 10 + app/Model/DetectionProject.php | 3 +- app/Model/OrderDetection.php | 3 +- app/Services/PatientOrderService.php | 234 +++++++++++++++------- 4 files changed, 181 insertions(+), 69 deletions(-) diff --git a/app/Controller/PatientOrderController.php b/app/Controller/PatientOrderController.php index 5c68fe8..d6b7be9 100644 --- a/app/Controller/PatientOrderController.php +++ b/app/Controller/PatientOrderController.php @@ -253,4 +253,14 @@ class PatientOrderController extends AbstractController return $this->response->json($data); } + /** + * 获取患者检测订单详情 + * @return ResponseInterface + */ + public function getPatientDetectionOrderInfo(): ResponseInterface + { + $PatientOrderService = new PatientOrderService(); + $data = $PatientOrderService->getPatientDetectionOrderInfo(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Model/DetectionProject.php b/app/Model/DetectionProject.php index fc98473..df00cb5 100644 --- a/app/Model/DetectionProject.php +++ b/app/Model/DetectionProject.php @@ -11,6 +11,7 @@ use Hyperf\Snowflake\Concern\Snowflake; /** * @property int $detection_project_id 主键id + * @property string $detection_project_title 检测项目标题 * @property string $detection_project_name 检测项目名称 * @property int $company_id 合作公司id * @property string $detection_project_price 检测价格 @@ -30,7 +31,7 @@ class DetectionProject extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['detection_project_id', 'detection_project_name', 'company_id', 'detection_project_price', 'img_path', 'created_at', 'updated_at']; + protected array $fillable = ['detection_project_id', 'detection_project_title', 'detection_project_name', 'company_id', 'detection_project_price', 'img_path', 'created_at', 'updated_at']; protected string $primaryKey = "detection_project_id"; diff --git a/app/Model/OrderDetection.php b/app/Model/OrderDetection.php index cac8b2d..a6be676 100644 --- a/app/Model/OrderDetection.php +++ b/app/Model/OrderDetection.php @@ -37,6 +37,7 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property int $patient_sex 患者性别-就诊人(0:未知 1:男 2:女) * @property int $patient_age 患者年龄-就诊人 * @property string $detection_bar_code 检测条码 + * @property string $detection_pic 检测管图片(逗号分隔) * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 */ @@ -52,7 +53,7 @@ class OrderDetection extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['order_detection_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'created_at', 'updated_at']; + protected array $fillable = ['order_detection_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'detection_pic', 'created_at', 'updated_at']; protected string $primaryKey = "order_detection_id"; diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index c8fde72..e21d508 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -7,6 +7,7 @@ use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer; use App\Constants\DoctorTitleCode; use App\Constants\HttpEnumCode; use App\Model\BasicLogisticsCompany; +use App\Model\DetectionProject; use App\Model\Hospital; use App\Model\OrderDetection; use App\Model\OrderInquiry; @@ -254,7 +255,6 @@ class PatientOrderService extends BaseService $order_inquiry['user_doctor'] = $user_doctor; - unset($hospital); unset($user_doctor); } @@ -286,12 +286,12 @@ class PatientOrderService extends BaseService $redis = $this->container->get(Redis::class); $redis_key = "order_inquiry_lock_" . $order_inquiry_id; - $redis_lock = $redis->setnx($redis_key,1); + $redis_lock = $redis->setnx($redis_key, 1); // 设置过期时间 - $redis->expire($redis_key,3); - if (!$redis_lock){ + $redis->expire($redis_key, 3); + if (!$redis_lock) { // 设置失败,表示已经设置该值 - return fail(HttpEnumCode::HTTP_SUCCESS,"请您稍后重试"); + return fail(HttpEnumCode::HTTP_SUCCESS, "请您稍后重试"); } // 检测订单状态 @@ -343,31 +343,31 @@ class PatientOrderService extends BaseService } try { - if (!empty($order_inquiry['doctor_id'])){ + if (!empty($order_inquiry['doctor_id'])) { // 获取医生数据 $params = array(); $params['doctor_id'] = $order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); - if (empty($user_doctor)){ + if (empty($user_doctor)) { Db::rollBack(); - return fail(HttpEnumCode::SERVER_ERROR,"取消失败"); + return fail(HttpEnumCode::SERVER_ERROR, "取消失败"); } // 推送医生-患者取消问诊 - $MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']); + $MessagePush = new MessagePush($user_doctor['user_id'], $order_inquiry['order_inquiry_id']); $MessagePush->patientCancelInquiryToDoctor(); // 获取用户优惠卷信息 $params = array(); $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; $order_inquiry_coupon = OrderInquiryCoupon::getOne($params); - if (!empty($order_inquiry_coupon)){ + if (!empty($order_inquiry_coupon)) { // 发送站内消息-优惠卷退还 $MessagePush = new MessagePush($order_inquiry['user_id'], $order_inquiry['order_inquiry_id']); $MessagePush->patientRefundCoupon($order_inquiry_coupon['coupon_name']); } } - }catch(\Exception $e){ + } catch (\Exception $e) { return success(); } @@ -443,7 +443,7 @@ class PatientOrderService extends BaseService $InquiryService = new InquiryService(); $result = $InquiryService->cancelUnpayInquiryOrder($order_inquiry['inquiry_no'], 2, "主动取消"); - if ($result['status'] != 1){ + if ($result['status'] != 1) { Db::rollBack(); return fail(); } @@ -504,7 +504,7 @@ class PatientOrderService extends BaseService $order_product = OrderProduct::getPatientOrderProductPage($params, $fields, $page, $per_page); - if (!empty($order_product['data'])){ + if (!empty($order_product['data'])) { foreach ($order_product['data'] as $item) { foreach ($item['orderProductItem'] as &$product_item) { $product_item['product_cover_img'] = addAliyunOssWebsite($product_item['product_cover_img']); @@ -603,8 +603,8 @@ class PatientOrderService extends BaseService } $OrderProductService = new OrderProductService(); - $result = $OrderProductService->cancelUnpayProductOrder($order_product['order_product_no'],1,"主动取消"); - if ($result['status'] != 1){ + $result = $OrderProductService->cancelUnpayProductOrder($order_product['order_product_no'], 1, "主动取消"); + if ($result['status'] != 1) { Db::rollBack(); return fail(); } @@ -717,7 +717,7 @@ class PatientOrderService extends BaseService // 验证订单过期支付时间 $diff_time = (strtotime($order_inquiry['created_at']) - time()) / 60; - if ($diff_time >= 30){ + if ($diff_time >= 30) { $return_result['message'] = "订单已过期"; $return_result['data']['order_id'] = $order_inquiry['order_inquiry_id']; $return_result['data']['order_status'] = $order_inquiry['inquiry_status']; @@ -734,13 +734,13 @@ class PatientOrderService extends BaseService $result['payment_amount_total'] = $order_inquiry['payment_amount_total']; // 实际订单金额 $result['coupon_amount_total'] = $order_inquiry['coupon_amount_total'];; // 优惠金额 - if ($order_inquiry['payment_amount_total'] > 0){ + if ($order_inquiry['payment_amount_total'] > 0) { // 发起支付 - $WechatPay = new WechatPay(1,1); + $WechatPay = new WechatPay(1, 1); // 获取预支付交易会话标识 - $prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_inquiry['payment_amount_total'] * 100), $user_info['open_id'],"问诊服务"); + $prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_inquiry['payment_amount_total'] * 100), $user_info['open_id'], "问诊服务"); if (empty($prepay)) { return fail(HttpEnumCode::SERVER_ERROR); } @@ -778,7 +778,7 @@ class PatientOrderService extends BaseService // 验证订单过期支付时间 $diff_time = (strtotime($order_product['created_at']) - time()) / 60; - if ($diff_time >= 30){ + if ($diff_time >= 30) { $return_result['message'] = "订单已过期"; $return_result['data']['order_product_id'] = $order_product['order_product_id']; $return_result['data']['order_product_status'] = $order_product['order_product_status']; @@ -794,12 +794,12 @@ class PatientOrderService extends BaseService $result['payment_amount_total'] = $order_product['payment_amount_total']; // 实际订单金额 $result['coupon_amount_total'] = 0; // 优惠金额 - if ($order_product['payment_amount_total'] > 0 ){ + if ($order_product['payment_amount_total'] > 0) { // 发起支付 - $WechatPay = new WechatPay(1,2); + $WechatPay = new WechatPay(1, 2); // 获取预支付交易会话标识 - $prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_product['payment_amount_total'] * 100), $user_info['open_id'],"问诊服务"); + $prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_product['payment_amount_total'] * 100), $user_info['open_id'], "问诊服务"); if (empty($prepay)) { return fail(HttpEnumCode::SERVER_ERROR); } @@ -838,7 +838,7 @@ class PatientOrderService extends BaseService // 验证订单过期支付时间 $diff_time = (strtotime($order_detection['created_at']) - time()) / 60; - if ($diff_time >= 30){ + if ($diff_time >= 30) { $return_result['message'] = "订单已过期"; $return_result['data']['order_id'] = $order_detection['order_detection_id']; $return_result['data']['order_status'] = $order_detection['detection_status']; @@ -854,12 +854,12 @@ class PatientOrderService extends BaseService $result['payment_amount_total'] = $order_detection['amount_total']; // 实际订单金额 $result['coupon_amount_total'] = 0; // 优惠金额 - if ($order_detection['payment_amount_total'] > 0 ){ + if ($order_detection['payment_amount_total'] > 0) { // 发起支付 - $WechatPay = new WechatPay(1,3); + $WechatPay = new WechatPay(1, 3); // 获取预支付交易会话标识 - $prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_detection['payment_amount_total'] * 100), $user_info['open_id'],"检测服务"); + $prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_detection['payment_amount_total'] * 100), $user_info['open_id'], "检测服务"); if (empty($prepay)) { return fail(HttpEnumCode::SERVER_ERROR); } @@ -906,14 +906,14 @@ class PatientOrderService extends BaseService } // 验证订单状态 - if ($order_inquiry['inquiry_status'] != 1){ + if ($order_inquiry['inquiry_status'] != 1) { Db::rollBack(); // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) return fail(HttpEnumCode::HTTP_ERROR, "支付失败"); } // 验证支付金额 - if ($order_inquiry['payment_amount_total'] != 0){ + if ($order_inquiry['payment_amount_total'] != 0) { Db::rollBack(); return fail(HttpEnumCode::HTTP_ERROR, "支付失败"); } @@ -924,22 +924,22 @@ class PatientOrderService extends BaseService $data = array(); $data['inquiry_pay_channel'] = 3; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) $data['inquiry_pay_status'] = 2; - if ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3){ + if ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3) { // 专家-公益 $data['inquiry_status'] = 3;// 3:待接诊 - }elseif ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4){ + } elseif ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4) { // 快速-购药 $data['inquiry_status'] = 2;// 2:待分配 } $data['escrow_trade_no'] = "GD" . $generator->generate(); // 第三方支付流水号 - $data['pay_time'] = date('Y-m-d H:i:s',time());// 支付时间 - $data['updated_at'] = date('Y-m-d H:i:s',time()); + $data['pay_time'] = date('Y-m-d H:i:s', time());// 支付时间 + $data['updated_at'] = date('Y-m-d H:i:s', time()); $params = array(); $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - OrderInquiry::edit($params,$data); + OrderInquiry::edit($params, $data); - if ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4){ + if ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4) { // 快速-购药 // 加入分配医生队列 $data = array(); @@ -953,23 +953,23 @@ class PatientOrderService extends BaseService Db::rollBack(); return fail(HttpEnumCode::HTTP_ERROR, "分配医生失败"); } - }elseif ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3){ + } elseif ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3) { // 专家-公益,发送im消息 // 获取订单医生数据 $params = array(); $params['doctor_id'] = $order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); - if (empty($user_doctor)){ + if (empty($user_doctor)) { Db::rollBack(); return fail(HttpEnumCode::HTTP_ERROR, "医生数据错误"); } // 发送IM消息-等待医生接诊 $imService = new ImService(); - $imService->waitDoctorInquiry($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']); + $imService->waitDoctorInquiry($order_inquiry, $user_doctor['user_id'], $order_inquiry['user_id']); // 发送站内、订阅失败发送短信消息-医生有新问诊 - $MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']); + $MessagePush = new MessagePush($user_doctor['user_id'], $order_inquiry['order_inquiry_id']); $MessagePush->doctorHaveNewInquiry(); Log::getInstance()->info("发送im消息成功"); @@ -978,7 +978,7 @@ class PatientOrderService extends BaseService Db::commit(); } catch (\Exception $e) { Db::rollBack(); - return fail(HttpEnumCode::SERVER_ERROR,$e->getMessage()); + return fail(HttpEnumCode::SERVER_ERROR, $e->getMessage()); } return success(); @@ -1071,15 +1071,15 @@ class PatientOrderService extends BaseService return fail(HttpEnumCode::HTTP_ERROR, "存在库存不足商品", $not_enough_product_ids); } - $app_env = config('app_env','prod'); - if ($app_env != "dev"){ + $app_env = config('app_env', 'prod'); + if ($app_env != "dev") { // 获取运费金额 $Prescription = new Prescription(); $result = $Prescription->getLogisticsFee(); - if ($amount_total >= $result['drugCost']){ + if ($amount_total >= $result['drugCost']) { $logistics_fee = 0; - }else{ + } else { $logistics_fee = $result['freight']; } @@ -1087,7 +1087,7 @@ class PatientOrderService extends BaseService $payment_amount_total = $amount_total + $logistics_fee; } - if ($app_env == "dev"){ + if ($app_env == "dev") { $logistics_fee = 0; $payment_amount_total = 0.01; } @@ -1158,7 +1158,7 @@ class PatientOrderService extends BaseService $params = array(); $params['product_platform_code'] = $product['product_platform_code']; $product_platform_amount = ProductPlatformAmount::getSharedLockOne($params); - if (empty($product_platform_amount)){ + if (empty($product_platform_amount)) { Db::rollBack(); return fail(HttpEnumCode::HTTP_ERROR, "无商品库存数据"); } @@ -1246,7 +1246,7 @@ class PatientOrderService extends BaseService $params['order_product_id'] = $order_product_id; $params['patient_id'] = $user_info['client_user_id']; $order_product = OrderProduct::getOne($params); - if (empty($order_product)){ + if (empty($order_product)) { return fail(); } @@ -1273,14 +1273,14 @@ class PatientOrderService extends BaseService $params = array(); $params['order_product_id'] = $order_product_id; $order_product_logistics = OrderProductLogistic::getOne($params); - if (empty($order_product_logistics)){ - if (!empty($order_product['logistics_no']) && !empty($order_product['logistics_company_code'])){ + if (empty($order_product_logistics)) { + if (!empty($order_product['logistics_no']) && !empty($order_product['logistics_company_code'])) { // 获取快递公司名称 $params = array(); $params['company_code'] = $order_product['logistics_company_code']; $params['company_type'] = 1; $basic_logistics_company = BasicLogisticsCompany::getOne($params); - if (!empty($basic_logistics_company)){ + if (!empty($basic_logistics_company)) { $logistics = array(); $logistics['order_product_id'] = $order_product_id; $logistics['company_name'] = $basic_logistics_company['company_name']; @@ -1289,10 +1289,10 @@ class PatientOrderService extends BaseService $result['logistics'] = $logistics; } } - }else{ + } else { $order_product_logistics = $order_product_logistics->toArray(); - $order_product_logistics['logistics_content'] = json_decode($order_product_logistics['logistics_content'],true); + $order_product_logistics['logistics_content'] = json_decode($order_product_logistics['logistics_content'], true); $result['logistics'] = $order_product_logistics; } return success($result); @@ -1358,7 +1358,7 @@ class PatientOrderService extends BaseService $params = array(); $params['order_prescription_id'] = $order_prescription_id; $order_prescription_file = OrderPrescriptionFile::getOne($params); - if (empty($order_prescription_file)){ + if (empty($order_prescription_file)) { return fail(); } @@ -1368,7 +1368,7 @@ class PatientOrderService extends BaseService $params = array(); $params['doctor_id'] = $order_prescription['doctor_id']; $user_doctor_info = UserDoctorInfo::getOne($params); - if (empty($user_doctor_info)){ + if (empty($user_doctor_info)) { return fail(HttpEnumCode::SERVER_ERROR); } $order_prescription['doctor_sign_image'] = addAliyunOssWebsite($user_doctor_info['sign_image']); @@ -1377,7 +1377,7 @@ class PatientOrderService extends BaseService $params = array(); $params['pharmacist_id'] = $order_prescription['pharmacist_id']; $user_pharmacist_info = UserPharmacistInfo::getOne($params); - if (empty($user_pharmacist_info)){ + if (empty($user_pharmacist_info)) { return fail(HttpEnumCode::SERVER_ERROR); } $order_prescription['pharmacist_sign_image'] = addAliyunOssWebsite($user_pharmacist_info['sign_image']); @@ -1458,18 +1458,18 @@ class PatientOrderService extends BaseService // 获取运费金额 $logistics_fee = 0; - if (env("APP_ENV") == "prod"){ + if (env("APP_ENV") == "prod") { $Prescription = new Prescription(); $result = $Prescription->getLogisticsFee(); - if ($amount_total < $result['drugCost']){ + if ($amount_total < $result['drugCost']) { $logistics_fee = $result['freight']; } } // 实际支付金额 - if (env("APP_ENV") == "dev"){ + if (env("APP_ENV") == "dev") { $payment_amount_total = 0.01; - }else{ + } else { $payment_amount_total = $amount_total + $logistics_fee; } @@ -1645,6 +1645,106 @@ class PatientOrderService extends BaseService return success($order_detection); } + /** + * 获取患者检测订单详情 + * @return array + */ + public function getPatientDetectionOrderInfo(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $order_detection_id = $this->request->route('order_detection_id'); + + // 获取订单数据 + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['order_detection_id'] = $order_detection_id; + $params['is_delete'] = 0; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + return fail(); + } + + $order_detection = $order_detection->toArray(); + + // 获取医生数据 + $order_detection['user_doctor'] = []; + if (!empty($order_detection['doctor_id'])) { + $fields = [ + 'user_id', + 'doctor_id', + 'user_name', + 'doctor_title', + 'hospital_id', + 'avatar', + 'department_custom_name', + 'multi_point_status', + ]; + + $params = array(); + $params['doctor_id'] = $order_detection['doctor_id']; + $user_doctor = UserDoctor::getOne($params, $fields); + if (empty($user_doctor)) { + return fail(HttpEnumCode::SERVER_ERROR); + } + + // 转换医生职称 + $user_doctor['doctor_title'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']); + + // 头像 + $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); + + // 获取医生医院名称 + $user_doctor['hospital_name'] = ""; + $user_doctor['hospital_level_name'] = ""; + + $fields = [ + 'hospital_id', + 'hospital_name', + 'hospital_level_name', + ]; + + $params = array(); + $params['hospital_id'] = $user_doctor['hospital_id']; + $hospital = Hospital::getOne($params, $fields); + if (!empty($hospital)) { + $user_doctor['hospital_name'] = $hospital['hospital_name']; + $user_doctor['hospital_level_name'] = $hospital['hospital_level_name']; + } + + // 获取医生关注状态 + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['doctor_id'] = $user_doctor['doctor_id']; + $user_doctor['follow'] = PatientFollow::getExists($params); + + $order_detection['user_doctor'] = $user_doctor; + + unset($hospital); + unset($user_doctor); + } + + // 检测管图片 + if (!empty($order_detection['detection_pic'])){ + $detection_pic = explode(',', $order_detection['detection_pic']); + foreach ($detection_pic as &$value) { + $value = addAliyunOssWebsite($value); + } + $order_detection['detection_pic'] = $detection_pic; + } + + // 获取项目名称 + $params = array(); + $params['detection_project_id'] = $order_detection['detection_project_id']; + $detection_project = DetectionProject::getOne($params); + if (empty($detection_project)){ + return fail(); + } + + $order_detection['detection_project_name'] = $detection_project['detection_project_name']; + return success($order_detection); + } + /** * 获取患者未完成订单 @@ -1656,21 +1756,21 @@ class PatientOrderService extends BaseService public function getNotFinishedOrderInquiry(string|int $inquiry_type, string $patient_id = '', string $family_id = ''): string { $params = array(); - if (!empty($patient_id)){ - $params[] = ['patient_id','=',$patient_id]; + if (!empty($patient_id)) { + $params[] = ['patient_id', '=', $patient_id]; } - if (!empty($family_id)){ - $params[] = ['family_id','=',$family_id]; + if (!empty($family_id)) { + $params[] = ['family_id', '=', $family_id]; } - $params[] = ['inquiry_type','=',$inquiry_type]; - $params[] = ['inquiry_mode','=',1]; - $params[] = ['inquiry_refund_status','=',0]; + $params[] = ['inquiry_type', '=', $inquiry_type]; + $params[] = ['inquiry_mode', '=', 1]; + $params[] = ['inquiry_refund_status', '=', 0]; $order_inquiry = OrderInquiry::getOrderOne($params); if (!empty($order_inquiry)) { // 1:待支付 2:待分配 3:待接诊 4:已接诊 - if (in_array($order_inquiry['inquiry_status'], [1,2, 3, 4])) { + if (in_array($order_inquiry['inquiry_status'], [1, 2, 3, 4])) { return $order_inquiry['order_inquiry_id']; } } From 91f829f26ec8d20ab2f2c149ca712cc4d18571bb Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 2 Aug 2023 11:48:45 +0800 Subject: [PATCH 019/176] 1 --- app/Services/DetectionService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index d27fd4e..0275bba 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -232,6 +232,7 @@ class DetectionService extends BaseService "user_name", "avatar", "doctor_title", + "hospital_id", ]; $user_doctors = UserDoctor::getDiagnoCoopDoctorList($params,$hospital_params,$fields); if (!empty($user_doctors)){ @@ -241,7 +242,7 @@ class DetectionService extends BaseService $doctor['hospital_name'] = $value['Hospital']['hospital_name']; } - unset($value['Hospital']); +// unset($value['Hospital']); $value['avatar'] = addAliyunOssWebsite($value['avatar']); } From 8cfb0f38945c9aa4373f2e9249e07457961f1a41 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 2 Aug 2023 13:43:06 +0800 Subject: [PATCH 020/176] 1 --- app/Services/MessagePush.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 21a0190..9400255 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -23,7 +23,6 @@ use Hyperf\Amqp\Producer; use Hyperf\Utils\ApplicationContext; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; -use function _PHPStan_503e82092\RingCentral\Psr7\str; /** * 消息推送业务类 @@ -362,8 +361,6 @@ class MessagePush extends BaseService * 患者的问诊服务结束 * 站内、订阅 * @return void - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface */ public function patientInquiryFinish(): void { @@ -442,7 +439,9 @@ class MessagePush extends BaseService $data['sub_data'] = $sub_data; $data['sms_data'] = array(); + dump($data); $message = new SendSubMessageProducer($data); + dump($message->payload()); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); From 209352072568d70acbf3fc637dd6780b8824f0db Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 2 Aug 2023 14:35:28 +0800 Subject: [PATCH 021/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E8=AF=8A?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/MessagePush.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 9400255..a7c8267 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -416,11 +416,8 @@ class MessagePush extends BaseService // 问诊内容 $disease_desc = $order_inquiry_case['disease_desc']; - if (!empty($disease_desc)) { - $disease_desc = substr($disease_desc, 0, 15); - if ($disease_desc) { - $disease_desc = $disease_desc . "..."; - } + if (mb_strlen($disease_desc) > 15){ + $disease_desc = mb_substr($disease_desc, 0, 15, 'UTF-8') . '...'; } // 订阅 @@ -439,9 +436,7 @@ class MessagePush extends BaseService $data['sub_data'] = $sub_data; $data['sms_data'] = array(); - dump($data); $message = new SendSubMessageProducer($data); - dump($message->payload()); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); From f2879527ae2e1c298935082a49a48a78b5cb3a80 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 3 Aug 2023 14:46:03 +0800 Subject: [PATCH 022/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=97=B6=E9=97=B4=EF=BC=8C=E9=85=8D=E5=90=88?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 91ea031..8c9706d 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -926,7 +926,8 @@ class InquiryService extends BaseService $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; $message = new AutoFinishInquiryDelayDirectProducer($data); - $message->setDelayMs(1000 * 60 * 60 * 24 * 3); +// $message->setDelayMs(1000 * 60 * 60 * 24 * 3); + $message->setDelayMs(1000 * 60 * 3); $producer = $this->container->get(Producer::class); $res = $producer->produce($message); if (!$res) { From 932d29405092fcce107fa3baff0093bcd4e4c74c Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 3 Aug 2023 15:06:31 +0800 Subject: [PATCH 023/176] 1 --- app/Request/PatientOrderRequest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Request/PatientOrderRequest.php b/app/Request/PatientOrderRequest.php index 81760cf..e162d12 100644 --- a/app/Request/PatientOrderRequest.php +++ b/app/Request/PatientOrderRequest.php @@ -19,7 +19,7 @@ class PatientOrderRequest extends FormRequest 'family_id',// 家庭成员id(就诊用户) ], 'getPatientOrderPayInfo' => [ // 获取患者订单支付数据 - "order_type", // 订单类型(1:问诊订单 2:药品订单) + "order_type", // 订单类型(1:问诊订单 2:药品订单 3:检测订单) "order_no"// 订单编号 ], 'addPatientOrderPay' => [ // 模拟支付成功-金额为0时使用 @@ -73,7 +73,7 @@ class PatientOrderRequest extends FormRequest 'inquiry_status' => 'required|integer|min:0|max:4', - 'order_type' => 'required|integer|min:1|max:2', + 'order_type' => 'required|integer|min:1|max:3', 'order_no' => 'required', 'order_prescription_id' => 'required', From a59d292eedabe7635479a5f3e4363a18973251dc Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 3 Aug 2023 16:08:07 +0800 Subject: [PATCH 024/176] 1 --- app/Services/PatientOrderService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index e21d508..d831fe2 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -828,7 +828,7 @@ class PatientOrderService extends BaseService } // 验证订单支付状态 - if ($order_detection['inquiry_pay_status'] != 1) { + if ($order_detection['detection_pay_status'] != 1) { $return_result['message'] = "订单支付状态错误"; $return_result['data']['order_id'] = $order_detection['order_detection_id']; $return_result['data']['order_status'] = $order_detection['detection_status']; From 654639b7d1d1158b4c1bf64283bc3840eeb5ef71 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 3 Aug 2023 16:55:51 +0800 Subject: [PATCH 025/176] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 8c9706d..91ea031 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -926,8 +926,7 @@ class InquiryService extends BaseService $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; $message = new AutoFinishInquiryDelayDirectProducer($data); -// $message->setDelayMs(1000 * 60 * 60 * 24 * 3); - $message->setDelayMs(1000 * 60 * 3); + $message->setDelayMs(1000 * 60 * 60 * 24 * 3); $producer = $this->container->get(Producer::class); $res = $producer->produce($message); if (!$res) { From 69808dbab18b04180b073b2460cbc07f17c2f09e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 09:20:52 +0800 Subject: [PATCH 026/176] 1 --- app/Services/PatientOrderService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index d831fe2..6af2b64 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -854,7 +854,7 @@ class PatientOrderService extends BaseService $result['payment_amount_total'] = $order_detection['amount_total']; // 实际订单金额 $result['coupon_amount_total'] = 0; // 优惠金额 - if ($order_detection['payment_amount_total'] > 0) { + if ($order_detection['amount_total'] > 0) { // 发起支付 $WechatPay = new WechatPay(1, 3); From ee35d2682152aa07792dab3a27aff7839d799f65 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 09:41:47 +0800 Subject: [PATCH 027/176] 1 --- app/Services/DetectionService.php | 2 ++ app/Services/PatientOrderService.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 0275bba..63a7872 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -411,6 +411,8 @@ class DetectionService extends BaseService $data['detection_pay_channel'] = $detection_pay_channel; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) $data['detection_no'] = "D" . $generator->generate(); // 系统订单编号 $data['amount_total'] = $detection_project['detection_project_price']; // 订单金额 + $data['coupon_amount_total'] = 0;// 优惠卷总金额 + $data['payment_amount_total'] = $detection_project['detection_project_price'];// 实际付款金额 $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 6af2b64..d831fe2 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -854,7 +854,7 @@ class PatientOrderService extends BaseService $result['payment_amount_total'] = $order_detection['amount_total']; // 实际订单金额 $result['coupon_amount_total'] = 0; // 优惠金额 - if ($order_detection['amount_total'] > 0) { + if ($order_detection['payment_amount_total'] > 0) { // 发起支付 $WechatPay = new WechatPay(1, 3); From 7bcf4e9fb7ada1fc65a39d63225010ca58bd7c93 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 10:24:26 +0800 Subject: [PATCH 028/176] 1 --- app/Services/DetectionService.php | 1 - app/Services/PatientOrderService.php | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 63a7872..378cdfe 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -412,7 +412,6 @@ class DetectionService extends BaseService $data['detection_no'] = "D" . $generator->generate(); // 系统订单编号 $data['amount_total'] = $detection_project['detection_project_price']; // 订单金额 $data['coupon_amount_total'] = 0;// 优惠卷总金额 - $data['payment_amount_total'] = $detection_project['detection_project_price'];// 实际付款金额 $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index d831fe2..7f61c16 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -678,7 +678,7 @@ class PatientOrderService extends BaseService // 获取订单金额 $result = array(); - $result['amount_total'] = 0; // 订单金额 + $result['amount_total'] = 0; // 订单总额 $result['payment_amount_total'] = 0; // 实际订单金额 $result['coupon_amount_total'] = 0; // 优惠金额 $result['order_no'] = $order_no; // 订单编号 @@ -851,7 +851,7 @@ class PatientOrderService extends BaseService // 获取订单金额 $result['amount_total'] = $order_detection['amount_total']; // 订单金额 - $result['payment_amount_total'] = $order_detection['amount_total']; // 实际订单金额 + $result['payment_amount_total'] = $order_detection['amount_total'] - 0; // 实际订单金额 $result['coupon_amount_total'] = 0; // 优惠金额 if ($order_detection['payment_amount_total'] > 0) { @@ -1585,9 +1585,6 @@ class PatientOrderService extends BaseService 'patient_age', 'created_at', ]; - dump($params); - dump($detection_status_params); - dump($fields); $order_detection = OrderDetection::getPatientOrderDetectionPage($params, $detection_status_params, $fields, $page, $per_page); if (empty($order_detection['data'])) { return success($order_detection); From 20faf6f59ee69b21c52ed36093dc8f87d996f953 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 11:30:18 +0800 Subject: [PATCH 029/176] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/PatientOrderController.php | 11 +++++++ app/Services/PatientOrderService.php | 38 +++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/app/Controller/PatientOrderController.php b/app/Controller/PatientOrderController.php index d6b7be9..c446f31 100644 --- a/app/Controller/PatientOrderController.php +++ b/app/Controller/PatientOrderController.php @@ -263,4 +263,15 @@ class PatientOrderController extends AbstractController $data = $PatientOrderService->getPatientDetectionOrderInfo(); return $this->response->json($data); } + + /** + * 删除检测订单 + * @return ResponseInterface + */ + public function deletePatientDetectionOrder(): ResponseInterface + { + $PatientOrderService = new PatientOrderService(); + $data = $PatientOrderService->deletePatientDetectionOrder(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 7f61c16..761bed5 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1742,6 +1742,44 @@ class PatientOrderService extends BaseService return success($order_detection); } + /** + * 删除检测订单 + * @return array + */ + public function deletePatientDetectionOrder(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $order_detection_id = $this->request->route('order_detection_id'); + + // 获取订单数据 + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['order_detection_id'] = $order_detection_id; + $params['is_delete'] = 0; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + return fail(); + } + + // 检测订单状态 + if (!in_array($order_detection['detection_status'], [5])) { + // 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + return fail(HttpEnumCode::HTTP_ERROR, "订单无法删除"); + } + + // 修改订单删除状态 + $data = array(); + $data['is_delete'] = 1; + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + + OrderDetection::editOrderDetection($params, $data); + + return success(); + } + /** * 获取患者未完成订单 From a2821171efa497603662b740a9fd93548dbc2dbb Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 13:52:03 +0800 Subject: [PATCH 030/176] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E8=AE=A2=E5=8D=95,=E5=8F=96=E6=B6=88=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/PatientOrderController.php | 13 +++ app/Services/DetectionService.php | 113 +++++++++++++++++++++- app/Services/MessagePush.php | 60 ++++++++++++ app/Services/PatientOrderService.php | 90 +++++++++++++++++ config/routes.php | 6 +- 5 files changed, 280 insertions(+), 2 deletions(-) diff --git a/app/Controller/PatientOrderController.php b/app/Controller/PatientOrderController.php index c446f31..d4c2817 100644 --- a/app/Controller/PatientOrderController.php +++ b/app/Controller/PatientOrderController.php @@ -274,4 +274,17 @@ class PatientOrderController extends AbstractController $data = $PatientOrderService->deletePatientDetectionOrder(); return $this->response->json($data); } + + /** + * 取消检测订单 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function putCancelPatientDetectionOrder(): ResponseInterface + { + $PatientOrderService = new PatientOrderService(); + $data = $PatientOrderService->putCancelPatientDetectionOrder(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 378cdfe..1b761cb 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -4,6 +4,7 @@ namespace App\Services; use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer; use App\Constants\HttpEnumCode; +use App\Exception\BusinessException; use App\Model\Area; use App\Model\BasicCompany; use App\Model\BasicNation; @@ -12,10 +13,12 @@ use App\Model\DetectionProjectPurpose; use App\Model\DiseaseClassDetection; use App\Model\OrderDetection; use App\Model\OrderDetectionCase; +use App\Model\OrderDetectionRefund; use App\Model\PatientFamily; use App\Model\UserDoctor; use App\Model\UserLocation; use App\Utils\Log; +use Extend\Wechat\WechatPay; use Hyperf\Amqp\Producer; use Hyperf\DbConnection\Db; use Hyperf\Snowflake\IdGeneratorInterface; @@ -242,7 +245,7 @@ class DetectionService extends BaseService $doctor['hospital_name'] = $value['Hospital']['hospital_name']; } -// unset($value['Hospital']); + unset($value['Hospital']); $value['avatar'] = addAliyunOssWebsite($value['avatar']); } @@ -547,4 +550,112 @@ class DetectionService extends BaseService return $result; } + + /** + * 检测订单退款接口 + */ + public function detectionRefund(string $order_detection_id, string $refund_reason) + { + // 获取订单数据 + $params = array(); + $params['order_detection_id'] = $order_detection_id; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + throw new BusinessException("订单数据为空"); + } + + // 检测问诊订单状态 + if (!in_array($order_detection['detection_status'], [2, 5])) { + // 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + throw new BusinessException("订单状态错误"); + } + + // 检测订单退款状态 + if (in_array($order_detection['detection_refund_status'], [2, 3, 5,6])) { + // 检测订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) + throw new BusinessException("订单退款状态错误"); + } + + // 检测支付状态 + if ($order_detection['detection_pay_status'] != 2) { + // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) + throw new BusinessException("订单支付状态错误"); + } + + // 系统退款编号 + $generator = $this->container->get(IdGeneratorInterface::class); + $detection_refund_no = $generator->generate(); + + // 检测订单金额 + if ($order_detection['payment_amount_total'] > 0){ + // 发起退款 + $WechatPay = new WechatPay(1, 1); + + $options = array(); + $options['transaction_id'] = $order_detection['escrow_trade_no']; + $options['out_refund_no'] = (string)$detection_refund_no; + $options['reason'] = $refund_reason; + $options['amount'] = [ + 'refund' => (int)round($order_detection['payment_amount_total'] * 100), + 'total' => (int)round($order_detection['payment_amount_total'] * 100), + 'currency' => "CNY", + ]; + + $result = $WechatPay->refund($options); + + // 处理订单退款状态 + // 检测订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭) + $success_time = ""; + if ($result['status'] == "SUCCESS") { + // 退款成功 + $detection_refund_status = 3; + $success_time = $result['success_time']; + } elseif ($result['status'] == "CLOSED") { + // 退款关闭 + $detection_refund_status = 5; + } elseif ($result['status'] == "PROCESSING") { + // 退款处理中 + $detection_refund_status = 2; + } elseif ($result['status'] == "ABNORMAL") { + // 退款异常,此情况不处理,进行短信通知 + throw new BusinessException("订单退款状态异常"); + } else { + throw new BusinessException("订单退款状态错误"); + } + + $refund_id = $result['refund_id']; + }else{ + $detection_refund_status = 3; + $success_time = date('Y-m-d H:i:s',time()); + $refund_id = $generator->generate(); + } + + // 新增退款表 + $data = array(); + $data['patient_id'] = $order_detection['patient_id']; + $data['order_detection_id'] = $order_detection['order_detection_id']; + $data['detection_no'] = $order_detection['detection_no']; + $data['detection_refund_no'] = $detection_refund_no; + $data['refund_id'] = $refund_id; + $data['detection_refund_status'] = $detection_refund_status; + $data['refund_total'] = $order_detection['payment_amount_total']; + $data['refund_reason'] = $refund_reason; + + if ($detection_refund_status == 3 && !empty($success_time)) { + $data['success_time'] = date("Y-m-d H:i:s", strtotime($success_time)); // 退款成功时间 + } + + $order_detection_refund = OrderDetectionRefund::add($data); + if (empty($order_detection_refund)) { + throw new BusinessException("添加退款表失败"); + } + + // 修改问诊订单表状态 + $data = array(); + $data['detection_refund_status'] = $detection_refund_status; + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params, $data); + } } \ No newline at end of file diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index a7c8267..2b97394 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -7,7 +7,9 @@ use App\Amqp\Producer\SendStationMessageProducer; use App\Amqp\Producer\SendSubMessageProducer; use App\Constants\HttpEnumCode; use App\Exception\BusinessException; +use App\Model\DetectionProject; use App\Model\DoctorWithdrawal; +use App\Model\OrderDetection; use App\Model\OrderInquiry; use App\Model\OrderInquiryCase; use App\Model\OrderInquiryCoupon; @@ -2074,6 +2076,7 @@ class MessagePush extends BaseService $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)) { Log::getInstance("MessagePush")->error("错误:医生数据为空"); + return; } // 获取问诊订单关联病例 @@ -2108,6 +2111,7 @@ class MessagePush extends BaseService $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); + return; } // 问诊内容-病情主诉 @@ -2226,4 +2230,60 @@ class MessagePush extends BaseService Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } + + /** + * 患者-订单取消成功通知 + * 订阅 + * @param string $order_detection_id + * @return void + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function patientCancelOrderSuccess(string $order_detection_id): void + { + try { + // 获取检测订单 + $params = array(); + $params['order_detection_id'] = $order_detection_id; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + Log::getInstance("MessagePush")->error("错误:加入推送队列失败,无检测订单数据"); + return; + } + + // 获取检测项目 + $params = array(); + $params['detection_project_id'] = $order_detection['detection_project_id']; + $detection_project = DetectionProject::getOne($params); + if (empty($detection_project)){ + Log::getInstance("MessagePush")->error("错误:加入推送队列失败,检测项目错误"); + return; + } + + $sub_data = array(); + $sub_data['push_user_id'] = $this->user['user_id']; + $sub_data['wx_template_id'] = "5aJSrO8SU5rxqdB99zzl4rMVgcOTjt5mQh56cpZI1Hg";//咨询提醒 + $sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id="; + $sub_data['params']['data'] = [ + "thing1" => $order_detection['patient_name'],// 就诊人 + "thing7" => (string)$detection_project['detection_project_name'],// 服务项目 + "time6" => date('Y年m月d日 H:i'),// 取消时间 + "amount8" => $order_detection['payment_amount_total'],// 退款金额 + "thing5" => "订单取消成功,支付金额将立即原路退回。",// 温馨提示 + ]; + + $data = array(); + $data['sub_data'] = $sub_data; + $data['sms_data'] = []; + + $message = new SendSubMessageProducer($data); + $producer = ApplicationContext::getContainer()->get(Producer::class); + $result = $producer->produce($message); + if (!$result) { + Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); + } + } catch (\Exception $e) { + Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); + } + } } \ No newline at end of file diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 761bed5..5ceb793 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1780,6 +1780,96 @@ class PatientOrderService extends BaseService return success(); } + /** + * 取消检测订单 + * @return array + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function putCancelPatientDetectionOrder(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $order_detection_id = $this->request->route('order_detection_id'); + + // 获取订单数据 + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['order_detection_id'] = $order_detection_id; + $params['is_delete'] = 0; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + return fail(); + } + + $redis = $this->container->get(Redis::class); + $redis_key = "order_detection_lock_" . $order_detection_id; + $redis_lock = $redis->setnx($redis_key, 1); + // 设置过期时间 + $redis->expire($redis_key, 3); + if (!$redis_lock) { + // 设置失败,表示已经设置该值 + return fail(HttpEnumCode::HTTP_SUCCESS, "请您稍后重试"); + } + + // 检测订单状态 + if (!in_array($order_detection['detection_status'], [2])) { + // 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + return fail(HttpEnumCode::HTTP_ERROR, "订单无法取消"); + } + + if ($order_detection['detection_refund_status'] == 1) { + // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭) + return fail(HttpEnumCode::HTTP_ERROR, "订单申请退款中,请您稍后取消"); + } + + if ($order_detection['detection_refund_status'] == 2) { + // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭) + return fail(HttpEnumCode::HTTP_ERROR, "订单正在退款中,请您稍后取消"); + } + + Db::beginTransaction(); + try { + // 退款成功 + // 修改问诊订单为取消 + $data = array(); + $data['detection_status'] = 5; + $data['cancel_time'] = date("Y-m-d H:i:s", time()); + $data['cancel_reason'] = 2; // 取消订单原因(1:主动取消 2:客服取消 3:支付超时) + $data['updated_at'] = date("Y-m-d H:i:s", time()); + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params, $data); + + // 检测支付状态,判断是否需要退款处理 + if ($order_detection['detection_pay_status'] == 2 && $order_detection['detection_refund_status'] != 3) { + // 需退款 + $detectionService = new DetectionService(); + $detectionService->detectionRefund($order_detection['order_detection_id'], "取消检测"); + } + + // 删除锁 + $redis->del($redis_key); + + Db::commit(); + } catch (\Exception $e) { + Db::rollBack(); + return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage()); + } + + try { + if (!empty($order_inquiry['doctor_id'])) { + // 推送患者-订单取消成功通知 + $MessagePush = new MessagePush($order_detection['user_id'], $order_inquiry['order_inquiry_id']); + $MessagePush->patientCancelOrderSuccess($order_detection['order_detection_id']); + } + } catch (\Exception $e) { + return success(); + } + + return success(); + } /** * 获取患者未完成订单 diff --git a/config/routes.php b/config/routes.php index fc5717b..c2fd465 100644 --- a/config/routes.php +++ b/config/routes.php @@ -269,7 +269,11 @@ Router::addGroup('/patient', function () { // 检测 Router::addGroup('/detection', function () { // 创建检测订单 - Router::post('', [DetectionController::class, 'addDetectionOrder']); + Router::post('', [DetectionController::class, 'addDetectionOrder'], + [ + 'middleware' => [LockRequestMiddleware::class] // 锁定重复请求 + ] + ); // 获取检测机构合作医生列表 Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']); From 6eaefae3a4dc4a5d1e9a1ddd9bff61c909ca2c1f Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 13:57:54 +0800 Subject: [PATCH 031/176] 1 --- composer.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/composer.json b/composer.json index f6501b8..f7598f0 100644 --- a/composer.json +++ b/composer.json @@ -94,14 +94,5 @@ "Composer\\Config::disableProcessTimeout", "php ./bin/hyperf.php start" ] - }, - "repositories": { - "proxy": { - "type": "composer", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy", - "only": [ - "hyperf/*" - ] - } } } From d96e0a6b74d1070929271f8882ad53438c46f174 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 14:05:15 +0800 Subject: [PATCH 032/176] 1 --- composer.lock | 1062 ++++++++++++++++++++++--------------------------- 1 file changed, 478 insertions(+), 584 deletions(-) diff --git a/composer.lock b/composer.lock index 91a63b4..465abc1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "05e3ba05b453d5d07af51ee1337d0eaf", + "content-hash": "7b8eb338a7660aee649c5dd55b456b7c", "packages": [ { "name": "adbario/php-dot-notation", @@ -385,16 +385,16 @@ }, { "name": "alibabacloud/tea-utils", - "version": "0.2.18", + "version": "0.2.19", "source": { "type": "git", "url": "https://github.com/alibabacloud-sdk-php/tea-utils.git", - "reference": "103e6cde583cf446b217fbb5c565b9007c238702" + "reference": "8dfc1a93e9415818e93a621b644abbb84981aea4" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/alibabacloud/tea-utils/0.2.18/alibabacloud-tea-utils-0.2.18.zip", - "reference": "103e6cde583cf446b217fbb5c565b9007c238702", + "url": "https://mirrors.huaweicloud.com/repository/php/alibabacloud/tea-utils/0.2.19/alibabacloud-tea-utils-0.2.19.zip", + "reference": "8dfc1a93e9415818e93a621b644abbb84981aea4", "shasum": "" }, "require": { @@ -417,27 +417,27 @@ } ], "description": "Alibaba Cloud Tea Utils for PHP", - "time": "2023-04-11T02:17:04+00:00" + "time": "2023-06-26T09:49:19+00:00" }, { "name": "alibabacloud/tea-xml", - "version": "0.2.3", + "version": "0.2.4", "source": { "type": "git", "url": "https://github.com/alibabacloud-sdk-php/tea-xml.git", - "reference": "4bd2303d71c968cb7ae4e487c5fa3023aed3ff3b" + "reference": "3e0c000bf536224eebbac913c371bef174c0a16a" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/alibabacloud/tea-xml/0.2.3/alibabacloud-tea-xml-0.2.3.zip", - "reference": "4bd2303d71c968cb7ae4e487c5fa3023aed3ff3b", + "url": "https://mirrors.huaweicloud.com/repository/php/alibabacloud/tea-xml/0.2.4/alibabacloud-tea-xml-0.2.4.zip", + "reference": "3e0c000bf536224eebbac913c371bef174c0a16a", "shasum": "" }, "require": { "php": ">5.5" }, "require-dev": { - "phpunit/phpunit": "^4.8.35|^5.4.3", + "phpunit/phpunit": "*", "symfony/var-dumper": "*" }, "type": "library", @@ -456,7 +456,7 @@ } ], "description": "Alibaba Cloud Tea XML Library for PHP", - "time": "2021-12-08T06:43:00+00:00" + "time": "2022-08-02T04:12:58+00:00" }, { "name": "aliyuncs/oss-sdk-php", @@ -879,16 +879,16 @@ }, { "name": "firebase/php-jwt", - "version": "v6.8.0", + "version": "v6.8.1", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "48b0210c51718d682e53210c24d25c5a10a2299b" + "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/firebase/php-jwt/v6.8.0/firebase-php-jwt-v6.8.0.zip", - "reference": "48b0210c51718d682e53210c24d25c5a10a2299b", + "url": "https://mirrors.huaweicloud.com/repository/php/firebase/php-jwt/v6.8.1/firebase-php-jwt-v6.8.1.zip", + "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26", "shasum": "" }, "require": { @@ -933,7 +933,7 @@ "jwt", "php" ], - "time": "2023-06-20T16:45:35+00:00" + "time": "2023-07-14T18:33:00+00:00" }, { "name": "graham-campbell/result-type", @@ -1115,16 +1115,16 @@ }, { "name": "guzzlehttp/promises", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6" + "reference": "111166291a0f8130081195ac4556a5587d7f1b5d" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/guzzlehttp/promises/2.0.0/guzzlehttp-promises-2.0.0.zip", - "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6", + "url": "https://mirrors.huaweicloud.com/repository/php/guzzlehttp/promises/2.0.1/guzzlehttp-promises-2.0.1.zip", + "reference": "111166291a0f8130081195ac4556a5587d7f1b5d", "shasum": "" }, "require": { @@ -1189,20 +1189,20 @@ "type": "tidelift" } ], - "time": "2023-05-21T13:50:22+00:00" + "time": "2023-08-03T15:11:55+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.5.0", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6" + "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/guzzlehttp/psr7/2.5.0/guzzlehttp-psr7-2.5.0.zip", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6", + "url": "https://mirrors.huaweicloud.com/repository/php/guzzlehttp/psr7/2.6.0/guzzlehttp-psr7-2.6.0.zip", + "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77", "shasum": "" }, "require": { @@ -1300,20 +1300,20 @@ "type": "tidelift" } ], - "time": "2023-04-17T16:11:26+00:00" + "time": "2023-08-03T15:06:02+00:00" }, { "name": "hyperf/amqp", - "version": "v3.0.18", + "version": "v3.0.30", "source": { "type": "git", "url": "https://github.com/hyperf/amqp.git", - "reference": "701520b989a0277d2faded8a1141e1c4545261c2" + "reference": "9ec17402a985f4fd8f9b664ce43602596f6ef9a9" }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/proxy/archive/hyperf/amqp/v3.0.18?source=%E5%AE%98%E6%96%B9%E6%BA%90", - "reference": "701520b989a0277d2faded8a1141e1c4545261c2", + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/amqp/v3.0.30/hyperf-amqp-v3.0.30.zip", + "reference": "9ec17402a985f4fd8f9b664ce43602596f6ef9a9", "shasum": "" }, "require": { @@ -1359,16 +1359,21 @@ "hyperf", "php" ], - "time": "2023-04-26T03:02:31+00:00" + "time": "2023-07-15T00:53:13+00:00" }, { "name": "hyperf/async-queue", "version": "v3.0.18", + "source": { + "type": "git", + "url": "https://github.com/hyperf/async-queue.git", + "reference": "7e7b558492a80ac29baeffe1942709a062d087aa" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/async-queue/v3.0.18", - "reference": "d8fd56d9643a2f8f7406cc05306531aec4b95de0", - "shasum": "d8fd56d9643a2f8f7406cc05306531aec4b95de0" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/async-queue/v3.0.18/hyperf-async-queue-v3.0.18.zip", + "reference": "7e7b558492a80ac29baeffe1942709a062d087aa", + "shasum": "" }, "require": { "hyperf/codec": "~3.0.0", @@ -1401,11 +1406,6 @@ "Hyperf\\AsyncQueue\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\AsyncQueue\\": "tests/" - } - }, "license": [ "MIT" ], @@ -1416,20 +1416,21 @@ "hyperf", "php" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-04-26T03:02:31+00:00" }, { "name": "hyperf/cache", "version": "v3.0.26", + "source": { + "type": "git", + "url": "https://github.com/hyperf/cache.git", + "reference": "562639b565036bf13494f4e312a83439fe2bece0" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/cache/v3.0.26", - "reference": "db83b8a49202aa391a8bc23b7bfd450a27283061", - "shasum": "db83b8a49202aa391a8bc23b7bfd450a27283061" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/cache/v3.0.26/hyperf-cache-v3.0.26.zip", + "reference": "562639b565036bf13494f4e312a83439fe2bece0", + "shasum": "" }, "require": { "hyperf/codec": "~3.0.0", @@ -1459,11 +1460,6 @@ "Hyperf\\Cache\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Cache\\": "tests/" - } - }, "license": [ "MIT" ], @@ -1474,20 +1470,21 @@ "hyperf", "php" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-06-19T11:35:29+00:00" }, { "name": "hyperf/code-parser", "version": "v3.0.18", + "source": { + "type": "git", + "url": "https://github.com/hyperf/code-parser.git", + "reference": "f1812421150d7ef95067eb6657c6f84514b6dfea" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/code-parser/v3.0.18", - "reference": "09cf5238ff84284c3200d7faff552adfc14a6ebf", - "shasum": "09cf5238ff84284c3200d7faff552adfc14a6ebf" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/code-parser/v3.0.18/hyperf-code-parser-v3.0.18.zip", + "reference": "f1812421150d7ef95067eb6657c6f84514b6dfea", + "shasum": "" }, "require": { "hyperf/collection": "~3.0.0", @@ -1510,11 +1507,6 @@ "Hyperf\\CodeParser\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\CodeParser\\": "tests/" - } - }, "license": [ "MIT" ], @@ -1526,20 +1518,21 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-04-26T03:02:31+00:00" }, { "name": "hyperf/codec", "version": "v3.0.30", + "source": { + "type": "git", + "url": "https://github.com/hyperf/codec.git", + "reference": "30b170b59770c7f92ae845fca777b8ea8a953599" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/codec/v3.0.30", - "reference": "b9424b52cfca296fc819d785fff30c7eea36cd3b", - "shasum": "b9424b52cfca296fc819d785fff30c7eea36cd3b" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/codec/v3.0.30/hyperf-codec-v3.0.30.zip", + "reference": "30b170b59770c7f92ae845fca777b8ea8a953599", + "shasum": "" }, "require": { "ext-json": "*", @@ -1561,11 +1554,6 @@ "Hyperf\\Codec\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Codec\\": "tests/" - } - }, "license": [ "MIT" ], @@ -1577,20 +1565,21 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-07-18T12:10:42+00:00" }, { "name": "hyperf/collection", "version": "v3.0.29", + "source": { + "type": "git", + "url": "https://github.com/hyperf/collection.git", + "reference": "c2e3f919f8c445da69e0e0c10920c6fc0754b9ad" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/collection/v3.0.29", - "reference": "455aa584f4b5277c46b4c2a3e76b03417054a3e6", - "shasum": "455aa584f4b5277c46b4c2a3e76b03417054a3e6" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/collection/v3.0.29/hyperf-collection-v3.0.29.zip", + "reference": "c2e3f919f8c445da69e0e0c10920c6fc0754b9ad", + "shasum": "" }, "require": { "hyperf/contract": "~3.0.0", @@ -1604,16 +1593,11 @@ } }, "autoload": { - "psr-4": { - "Hyperf\\Collection\\": "src/" - }, "files": [ "src/Functions.php" - ] - }, - "autoload-dev": { + ], "psr-4": { - "HyperfTest\\Collection\\": "tests/" + "Hyperf\\Collection\\": "src/" } }, "license": [ @@ -1627,20 +1611,21 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-07-14T03:41:52+00:00" }, { "name": "hyperf/command", "version": "v3.0.27", + "source": { + "type": "git", + "url": "https://github.com/hyperf/command.git", + "reference": "06df0f8102ec4079591d937adaca507fe5191082" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/command/v3.0.27", - "reference": "73d3160c752913676d8ada632d498ec423fe425b", - "shasum": "73d3160c752913676d8ada632d498ec423fe425b" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/command/v3.0.27/hyperf-command-v3.0.27.zip", + "reference": "06df0f8102ec4079591d937adaca507fe5191082", + "shasum": "" }, "require": { "hyperf/support": "~3.0.0", @@ -1664,11 +1649,6 @@ "Hyperf\\Command\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Command\\": "tests/" - } - }, "license": [ "MIT" ], @@ -1677,16 +1657,22 @@ "command", "php", "swoole" - ] + ], + "time": "2023-06-26T23:53:52+00:00" }, { "name": "hyperf/conditionable", "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/hyperf/conditionable.git", + "reference": "4222cdc512e9e48e4375a480161c6365276ff803" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/conditionable/v3.0.0", - "reference": "acf1854ba2beadaa7a2248e46f44841bf4e57c67", - "shasum": "acf1854ba2beadaa7a2248e46f44841bf4e57c67" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/conditionable/v3.0.0/hyperf-conditionable-v3.0.0.zip", + "reference": "4222cdc512e9e48e4375a480161c6365276ff803", + "shasum": "" }, "require": { "php": ">=7.4" @@ -1702,11 +1688,6 @@ "Hyperf\\Conditionable\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Conditionable\\": "tests/" - } - }, "license": [ "MIT" ], @@ -1718,20 +1699,21 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-03-28T15:02:39+00:00" }, { "name": "hyperf/config", "version": "v3.0.20", + "source": { + "type": "git", + "url": "https://github.com/hyperf/config.git", + "reference": "6503882f8547809d609b9489170037ceaef04962" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/config/v3.0.20", - "reference": "44d1e4636661f0572512a94169fd2a2bfbbc8b2d", - "shasum": "44d1e4636661f0572512a94169fd2a2bfbbc8b2d" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/config/v3.0.20/hyperf-config-v3.0.20.zip", + "reference": "6503882f8547809d609b9489170037ceaef04962", + "shasum": "" }, "require": { "hyperf/collection": "~3.0.0", @@ -1758,16 +1740,11 @@ } }, "autoload": { - "psr-4": { - "Hyperf\\Config\\": "src/" - }, "files": [ "./src/Functions.php" - ] - }, - "autoload-dev": { + ], "psr-4": { - "HyperfTest\\Config\\": "tests/" + "Hyperf\\Config\\": "src/" } }, "license": [ @@ -1782,20 +1759,21 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-05-09T03:02:12+00:00" }, { "name": "hyperf/constants", "version": "v3.0.18", + "source": { + "type": "git", + "url": "https://github.com/hyperf/constants.git", + "reference": "71eadfcf6495eb4945a2416569649e39a89a55e3" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/constants/v3.0.18", - "reference": "714b07a448671f5c09b907a8d3bcd570bb1396a9", - "shasum": "714b07a448671f5c09b907a8d3bcd570bb1396a9" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/constants/v3.0.18/hyperf-constants-v3.0.18.zip", + "reference": "71eadfcf6495eb4945a2416569649e39a89a55e3", + "shasum": "" }, "require": { "hyperf/di": "~3.0.0", @@ -1820,11 +1798,6 @@ "Hyperf\\Constants\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Constants\\": "tests/" - } - }, "license": [ "MIT" ], @@ -1835,20 +1808,21 @@ "hyperf", "php" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-04-26T03:02:31+00:00" }, { "name": "hyperf/context", "version": "v3.0.18", + "source": { + "type": "git", + "url": "https://github.com/hyperf/context.git", + "reference": "8cff8cc1c70c1a8c390a13b97986ddd5e47fa2ec" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/context/v3.0.18", - "reference": "79de6266d5c0603d545362a0657856e13e357a46", - "shasum": "79de6266d5c0603d545362a0657856e13e357a46" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/context/v3.0.18/hyperf-context-v3.0.18.zip", + "reference": "8cff8cc1c70c1a8c390a13b97986ddd5e47fa2ec", + "shasum": "" }, "require": { "hyperf/engine": "^1.2|^2.0", @@ -1865,36 +1839,32 @@ "Hyperf\\Context\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Context\\": "tests/" - } - }, "license": [ "MIT" ], "description": "A coroutine/application context library.", "homepage": "https://hyperf.io", "keywords": [ - "context", + "Context", "hyperf", "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-04-26T03:02:31+00:00" }, { "name": "hyperf/contract", "version": "v3.0.10", + "source": { + "type": "git", + "url": "https://github.com/hyperf/contract.git", + "reference": "93488df36b1c4e2fc16c630fb77c110bafffb141" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/contract/v3.0.10", - "reference": "6f5eb5e3d979e1fabbc7e1bd7e80c98121a5d14a", - "shasum": "6f5eb5e3d979e1fabbc7e1bd7e80c98121a5d14a" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/contract/v3.0.10/hyperf-contract-v3.0.10.zip", + "reference": "93488df36b1c4e2fc16c630fb77c110bafffb141", + "shasum": "" }, "require": { "php": ">=8.0" @@ -1920,20 +1890,21 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-03-10T04:21:37+00:00" }, { "name": "hyperf/coordinator", "version": "v3.0.22", + "source": { + "type": "git", + "url": "https://github.com/hyperf/coordinator.git", + "reference": "a49c2d22995b4115e8b21f1de58b992047c4d0fd" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/coordinator/v3.0.22", - "reference": "614412a4502ad06b31f628711444bd56f1e3ee22", - "shasum": "614412a4502ad06b31f628711444bd56f1e3ee22" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/coordinator/v3.0.22/hyperf-coordinator-v3.0.22.zip", + "reference": "a49c2d22995b4115e8b21f1de58b992047c4d0fd", + "shasum": "" }, "require": { "hyperf/engine": "^1.2|^2.0", @@ -1950,36 +1921,32 @@ "Hyperf\\Coordinator\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Coordinator\\": "tests/" - } - }, "license": [ "MIT" ], "description": "Hyperf Coordinator", "homepage": "https://hyperf.io", "keywords": [ - "coordinator", + "Coordinator", "hyperf", "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-05-26T13:44:16+00:00" }, { "name": "hyperf/coroutine", "version": "v3.0.16", + "source": { + "type": "git", + "url": "https://github.com/hyperf/coroutine.git", + "reference": "4944ce69d5f35407e5dbcf7e9991f1db3366f254" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/coroutine/v3.0.16", - "reference": "7f1d81bba50f1af8f6b909b771c3e9269619fa29", - "shasum": "7f1d81bba50f1af8f6b909b771c3e9269619fa29" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/coroutine/v3.0.16/hyperf-coroutine-v3.0.16.zip", + "reference": "4944ce69d5f35407e5dbcf7e9991f1db3366f254", + "shasum": "" }, "require": { "hyperf/context": "~3.0.0", @@ -1994,16 +1961,11 @@ } }, "autoload": { - "psr-4": { - "Hyperf\\Coroutine\\": "src/" - }, "files": [ "src/Functions.php" - ] - }, - "autoload-dev": { + ], "psr-4": { - "HyperfTest\\Coroutine\\": "tests/" + "Hyperf\\Coroutine\\": "src/" } }, "license": [ @@ -2017,28 +1979,25 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-04-12T05:34:25+00:00" }, { "name": "hyperf/crontab", - "version": "v3.0.16", + "version": "v3.0.18", "source": { "type": "git", "url": "https://github.com/hyperf/crontab.git", - "reference": "99f8accd65cda19035f74023e80fd154bd7a576f" + "reference": "8cd73b5f6c4f2e673f9d8a116d0f8a53c2f0df7a" }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/proxy/archive/hyperf/crontab/v3.0.16?source=%E5%AE%98%E6%96%B9%E6%BA%90", - "reference": "99f8accd65cda19035f74023e80fd154bd7a576f", + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/crontab/v3.0.18/hyperf-crontab-v3.0.18.zip", + "reference": "8cd73b5f6c4f2e673f9d8a116d0f8a53c2f0df7a", "shasum": "" }, "require": { "hyperf/framework": "~3.0.0", + "hyperf/support": "~3.0.0", "hyperf/utils": "~3.0.0", "nesbot/carbon": "^2.0", "php": ">=8.0" @@ -2072,16 +2031,21 @@ "php", "swoole" ], - "time": "2023-04-12T04:36:10+00:00" + "time": "2023-04-26T03:02:31+00:00" }, { "name": "hyperf/database", "version": "v3.0.30", + "source": { + "type": "git", + "url": "https://github.com/hyperf/database.git", + "reference": "2b6178219951df7044417de1412a20a08cc331fa" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/database/v3.0.30", - "reference": "0d56e81769593fa693de44ab80ac9882eb905b38", - "shasum": "0d56e81769593fa693de44ab80ac9882eb905b38" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/database/v3.0.30/hyperf-database-v3.0.30.zip", + "reference": "2b6178219951df7044417de1412a20a08cc331fa", + "shasum": "" }, "require": { "hyperf/code-parser": "~3.0.0", @@ -2111,11 +2075,6 @@ "Hyperf\\Database\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Database\\": "tests/" - } - }, "license": [ "MIT" ], @@ -2126,20 +2085,21 @@ "hyperf", "php" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-07-17T12:16:22+00:00" }, { "name": "hyperf/db-connection", "version": "v3.0.18", + "source": { + "type": "git", + "url": "https://github.com/hyperf/db-connection.git", + "reference": "e4264bbaaa4b2f6a02096400ee05e4289b6a5509" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/db-connection/v3.0.18", - "reference": "f56782784de4fdc6258e920fc4f70970cc2e4adb", - "shasum": "f56782784de4fdc6258e920fc4f70970cc2e4adb" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/db-connection/v3.0.18/hyperf-db-connection-v3.0.18.zip", + "reference": "e4264bbaaa4b2f6a02096400ee05e4289b6a5509", + "shasum": "" }, "require": { "hyperf/database": "~3.0.0", @@ -2166,36 +2126,32 @@ "Hyperf\\DbConnection\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\DbConnection\\": "tests/" - } - }, "license": [ "MIT" ], "description": "A hyperf db connection handler for hyperf/database.", "homepage": "https://hyperf.io", "keywords": [ - "connection", + "Connection", "database", "hyperf", "php" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-04-26T03:02:31+00:00" }, { "name": "hyperf/di", "version": "v3.0.24", + "source": { + "type": "git", + "url": "https://github.com/hyperf/di.git", + "reference": "4fa46897ffe0e1f2d1260a65a1e25dadaacbdcd2" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/di/v3.0.24", - "reference": "53969f159a586b7256927fab837f0675db777a3e", - "shasum": "53969f159a586b7256927fab837f0675db777a3e" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/di/v3.0.24/hyperf-di-v3.0.24.zip", + "reference": "4fa46897ffe0e1f2d1260a65a1e25dadaacbdcd2", + "shasum": "" }, "require": { "doctrine/instantiator": "^1.0", @@ -2227,11 +2183,6 @@ "Hyperf\\Di\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Di\\": "tests/" - } - }, "license": [ "MIT" ], @@ -2244,20 +2195,21 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-06-05T07:53:17+00:00" }, { "name": "hyperf/dispatcher", "version": "v3.0.24", + "source": { + "type": "git", + "url": "https://github.com/hyperf/dispatcher.git", + "reference": "af232ac01c3dcb91ad565d6202e3e3bfb2fcf560" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/dispatcher/v3.0.24", - "reference": "eca5620db1a71a5b9b485ae22a5fcd2f62260258", - "shasum": "eca5620db1a71a5b9b485ae22a5fcd2f62260258" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/dispatcher/v3.0.24/hyperf-dispatcher-v3.0.24.zip", + "reference": "af232ac01c3dcb91ad565d6202e3e3bfb2fcf560", + "shasum": "" }, "require": { "hyperf/contract": "~3.0.0", @@ -2280,11 +2232,6 @@ "Hyperf\\Dispatcher\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Dispatcher\\": "tests/" - } - }, "license": [ "MIT" ], @@ -2298,11 +2245,7 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-06-04T02:14:26+00:00" }, { "name": "hyperf/engine", @@ -2314,7 +2257,7 @@ }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/proxy/archive/hyperf/engine/v1.10.0?source=%E5%AE%98%E6%96%B9%E6%BA%90", + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/engine/v1.10.0/hyperf-engine-v1.10.0.zip", "reference": "da38c8708f3d78d1490331e432d385489720568f", "shasum": "" }, @@ -2358,11 +2301,16 @@ { "name": "hyperf/event", "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/hyperf/event.git", + "reference": "e10cd5e8b7f02bad9c542c3592b495debba9a39a" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/event/v3.0.0", - "reference": "687743ca1f3643276f19bd232180221814431ee1", - "shasum": "687743ca1f3643276f19bd232180221814431ee1" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/event/v3.0.0/hyperf-event-v3.0.0.zip", + "reference": "e10cd5e8b7f02bad9c542c3592b495debba9a39a", + "shasum": "" }, "require": { "hyperf/contract": "~3.0.0", @@ -2386,11 +2334,6 @@ "Hyperf\\Event\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Event\\": "tests/" - } - }, "license": [ "MIT" ], @@ -2402,20 +2345,21 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2022-10-13T02:40:13+00:00" }, { "name": "hyperf/exception-handler", "version": "v3.0.24", + "source": { + "type": "git", + "url": "https://github.com/hyperf/exception-handler.git", + "reference": "bcadcd90f2d4f71e8e85f769256afdd4ea712ad3" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/exception-handler/v3.0.24", - "reference": "6c024d3021cf0c115c3ac80eb8c92e365cb1c2c7", - "shasum": "6c024d3021cf0c115c3ac80eb8c92e365cb1c2c7" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/exception-handler/v3.0.24/hyperf-exception-handler-v3.0.24.zip", + "reference": "bcadcd90f2d4f71e8e85f769256afdd4ea712ad3", + "shasum": "" }, "require": { "hyperf/contract": "~3.0.0", @@ -2440,11 +2384,6 @@ "Hyperf\\ExceptionHandler\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\ExceptionHandler\\": "tests/" - } - }, "license": [ "MIT" ], @@ -2455,20 +2394,21 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-06-04T02:14:26+00:00" }, { "name": "hyperf/framework", "version": "v3.0.23", + "source": { + "type": "git", + "url": "https://github.com/hyperf/framework.git", + "reference": "38e0fdfd097e73efbe7391795a695cea874d4ca6" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/framework/v3.0.23", - "reference": "990cc53e7230d165ef94d06faa31837b196e9dcd", - "shasum": "990cc53e7230d165ef94d06faa31837b196e9dcd" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/framework/v3.0.23/hyperf-framework-v3.0.23.zip", + "reference": "38e0fdfd097e73efbe7391795a695cea874d4ca6", + "shasum": "" }, "require": { "fig/http-message-util": "^1.1.2", @@ -2501,38 +2441,34 @@ "Hyperf\\Framework\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Framework\\": "tests/" - } - }, "license": [ "MIT" ], "description": "A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares.", "homepage": "https://hyperf.io", "keywords": [ + "Microservice", "framework", "hyperf", - "microservice", "middleware", "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-05-30T01:25:37+00:00" }, { "name": "hyperf/guzzle", "version": "v3.0.24", + "source": { + "type": "git", + "url": "https://github.com/hyperf/guzzle.git", + "reference": "7791900eed289bd6584e2e52d2ec02b47f85740c" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/guzzle/v3.0.24", - "reference": "ede3ea8aca5fa88163ad706ba0e2234a4e9e73cd", - "shasum": "ede3ea8aca5fa88163ad706ba0e2234a4e9e73cd" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/guzzle/v3.0.24/hyperf-guzzle-v3.0.24.zip", + "reference": "7791900eed289bd6584e2e52d2ec02b47f85740c", + "shasum": "" }, "require": { "guzzlehttp/guzzle": "^6.3|^7.0", @@ -2558,30 +2494,31 @@ "Hyperf\\Guzzle\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Guzzle\\": "tests/" - } - }, "license": [ "MIT" ], "description": "Swoole coroutine handler for guzzle", "keywords": [ - "guzzle", + "Guzzle", "handler", "php", "swoole" - ] + ], + "time": "2023-06-04T02:14:26+00:00" }, { "name": "hyperf/http-message", "version": "v3.0.18", + "source": { + "type": "git", + "url": "https://github.com/hyperf/http-message.git", + "reference": "23affffb7a15842f990144b5bd49641e4de8dda4" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/http-message/v3.0.18", - "reference": "1fed954be30f9ff185360efe5f6f4b774e70194b", - "shasum": "1fed954be30f9ff185360efe5f6f4b774e70194b" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/http-message/v3.0.18/hyperf-http-message-v3.0.18.zip", + "reference": "23affffb7a15842f990144b5bd49641e4de8dda4", + "shasum": "" }, "require": { "hyperf/codec": "~3.0.0", @@ -2609,11 +2546,6 @@ "Hyperf\\HttpMessage\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\HttpMessage\\": "tests/" - } - }, "license": [ "MIT" ], @@ -2623,16 +2555,22 @@ "hyperf", "php", "swoole" - ] + ], + "time": "2023-04-26T03:02:31+00:00" }, { "name": "hyperf/http-server", "version": "v3.0.24", + "source": { + "type": "git", + "url": "https://github.com/hyperf/http-server.git", + "reference": "d8a3256a6b32879b6d7bfd308cc1dca9d8d27de1" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/http-server/v3.0.24", - "reference": "23bf6fd698b22177dfe8a7595c6956becb04c9d9", - "shasum": "23bf6fd698b22177dfe8a7595c6956becb04c9d9" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/http-server/v3.0.24/hyperf-http-server-v3.0.24.zip", + "reference": "d8a3256a6b32879b6d7bfd308cc1dca9d8d27de1", + "shasum": "" }, "require": { "hyperf/codec": "~3.0.0", @@ -2669,11 +2607,6 @@ "Hyperf\\HttpServer\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\HttpServer\\": "tests/" - } - }, "license": [ "MIT" ], @@ -2686,20 +2619,21 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-06-06T12:33:49+00:00" }, { "name": "hyperf/logger", "version": "v3.0.20", + "source": { + "type": "git", + "url": "https://github.com/hyperf/logger.git", + "reference": "24a3b87f646ab6684310ead0b277e2464c6c5cab" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/logger/v3.0.20", - "reference": "b41374876dbf782bc330223b1b0c3df2c51337e4", - "shasum": "b41374876dbf782bc330223b1b0c3df2c51337e4" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/logger/v3.0.20/hyperf-logger-v3.0.20.zip", + "reference": "24a3b87f646ab6684310ead0b277e2464c6c5cab", + "shasum": "" }, "require": { "hyperf/contract": "~3.0.0", @@ -2724,11 +2658,6 @@ "Hyperf\\Logger\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Logger\\": "tests/" - } - }, "license": [ "MIT" ], @@ -2739,20 +2668,21 @@ "logger", "php" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-05-09T10:27:25+00:00" }, { "name": "hyperf/macroable", "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/hyperf/macroable.git", + "reference": "822de69ba0c75aa9767a9cea487b84bf31d5240a" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/macroable/v3.0.0", - "reference": "b76659a7708e3508b84a7cc8a0b99d4e0a6119e3", - "shasum": "b76659a7708e3508b84a7cc8a0b99d4e0a6119e3" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/macroable/v3.0.0/hyperf-macroable-v3.0.0.zip", + "reference": "822de69ba0c75aa9767a9cea487b84bf31d5240a", + "shasum": "" }, "require": { "php": ">=7.4" @@ -2768,11 +2698,6 @@ "Hyperf\\Macroable\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Macroable\\": "tests/" - } - }, "license": [ "MIT" ], @@ -2784,11 +2709,7 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2022-11-01T02:50:54+00:00" }, { "name": "hyperf/memory", @@ -2800,7 +2721,7 @@ }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/proxy/archive/hyperf/memory/v3.0.0?source=%E5%AE%98%E6%96%B9%E6%BA%90", + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/memory/v3.0.0/hyperf-memory-v3.0.0.zip", "reference": "c7217c9b5177562329074d332f9e13b40693bdfe", "shasum": "" }, @@ -2837,11 +2758,16 @@ { "name": "hyperf/model-listener", "version": "v3.0.18", + "source": { + "type": "git", + "url": "https://github.com/hyperf/model-listener.git", + "reference": "2167252ea7bdc8626cfd3d44f0f4709502c10432" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/model-listener/v3.0.18", - "reference": "15a7741288efc696f88abba7683e74a0413a41db", - "shasum": "15a7741288efc696f88abba7683e74a0413a41db" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/model-listener/v3.0.18/hyperf-model-listener-v3.0.18.zip", + "reference": "2167252ea7bdc8626cfd3d44f0f4709502c10432", + "shasum": "" }, "require": { "hyperf/contract": "~3.0.0", @@ -2867,11 +2793,6 @@ "Hyperf\\ModelListener\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\ModelListener\\": "tests/" - } - }, "license": [ "MIT" ], @@ -2883,11 +2804,7 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-04-26T03:02:31+00:00" }, { "name": "hyperf/paginator", @@ -2899,7 +2816,7 @@ }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/proxy/archive/hyperf/paginator/v3.0.18?source=%E5%AE%98%E6%96%B9%E6%BA%90", + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/paginator/v3.0.18/hyperf-paginator-v3.0.18.zip", "reference": "5e732c60fb47be062970a2d436e3bee341f15302", "shasum": "" }, @@ -2943,11 +2860,16 @@ { "name": "hyperf/pipeline", "version": "v3.0.16", + "source": { + "type": "git", + "url": "https://github.com/hyperf/pipeline.git", + "reference": "a3f48561f5cfef5f697e7005446e16560024a443" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/pipeline/v3.0.16", - "reference": "351149a128c9be0e8388f5c77baab1464a391253", - "shasum": "351149a128c9be0e8388f5c77baab1464a391253" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/pipeline/v3.0.16/hyperf-pipeline-v3.0.16.zip", + "reference": "a3f48561f5cfef5f697e7005446e16560024a443", + "shasum": "" }, "require": { "php": ">=8.0", @@ -2964,11 +2886,6 @@ "Hyperf\\Pipeline\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Pipeline\\": "tests/" - } - }, "license": [ "MIT" ], @@ -2980,20 +2897,21 @@ "pipeline", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-04-11T07:57:32+00:00" }, { "name": "hyperf/pool", "version": "v3.0.18", + "source": { + "type": "git", + "url": "https://github.com/hyperf/pool.git", + "reference": "44c87d46a1619554deed3879e8db675654ffd051" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/pool/v3.0.18", - "reference": "a51177e8c498d2231151593fcb95e92d168c5ebc", - "shasum": "a51177e8c498d2231151593fcb95e92d168c5ebc" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/pool/v3.0.18/hyperf-pool-v3.0.18.zip", + "reference": "44c87d46a1619554deed3879e8db675654ffd051", + "shasum": "" }, "require": { "hyperf/contract": "~3.0.0", @@ -3016,11 +2934,6 @@ "Hyperf\\Pool\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Pool\\": "tests/" - } - }, "license": [ "MIT" ], @@ -3032,20 +2945,21 @@ "php", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-04-26T03:02:31+00:00" }, { "name": "hyperf/process", "version": "v3.0.22", + "source": { + "type": "git", + "url": "https://github.com/hyperf/process.git", + "reference": "e804c32bf7497bedcdee28994257aeaf71a1fde7" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/process/v3.0.22", - "reference": "06ea5fa5b3267eb2685715b7679b69f968e61986", - "shasum": "06ea5fa5b3267eb2685715b7679b69f968e61986" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/process/v3.0.22/hyperf-process-v3.0.22.zip", + "reference": "e804c32bf7497bedcdee28994257aeaf71a1fde7", + "shasum": "" }, "require": { "hyperf/contract": "~3.0.0", @@ -3074,11 +2988,6 @@ "Hyperf\\Process\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Process\\": "tests/" - } - }, "license": [ "MIT" ], @@ -3089,20 +2998,21 @@ "php", "process" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-05-27T06:08:52+00:00" }, { "name": "hyperf/redis", "version": "v3.0.21", + "source": { + "type": "git", + "url": "https://github.com/hyperf/redis.git", + "reference": "65ec6cbecb64793670ef1a512bd15369b683c746" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/redis/v3.0.21", - "reference": "21510bbfa31387643ae7ac138368b58b93e61cf6", - "shasum": "21510bbfa31387643ae7ac138368b58b93e61cf6" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/redis/v3.0.21/hyperf-redis-v3.0.21.zip", + "reference": "65ec6cbecb64793670ef1a512bd15369b683c746", + "shasum": "" }, "require": { "ext-redis": "*", @@ -3132,11 +3042,6 @@ "Hyperf\\Redis\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Redis\\": "tests/" - } - }, "license": [ "MIT" ], @@ -3148,20 +3053,21 @@ "pool", "redis" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-05-15T04:08:45+00:00" }, { "name": "hyperf/serializer", "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/hyperf/serializer.git", + "reference": "c4efedaa072c5ffe196e95e0c74a9d90fd1e4811" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/serializer/v3.0.0", - "reference": "ba7659a4f9928aa6f46c47649d1b9fa2fed379c8", - "shasum": "ba7659a4f9928aa6f46c47649d1b9fa2fed379c8" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/serializer/v3.0.0/hyperf-serializer-v3.0.0.zip", + "reference": "c4efedaa072c5ffe196e95e0c74a9d90fd1e4811", + "shasum": "" }, "require": { "hyperf/contract": "~3.0.0", @@ -3186,11 +3092,6 @@ "Hyperf\\Serializer\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Serializer\\": "tests/" - } - }, "license": [ "MIT" ], @@ -3202,20 +3103,21 @@ "swoole", "tappable" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-04-24T07:07:56+00:00" }, { "name": "hyperf/server", "version": "v3.0.24", + "source": { + "type": "git", + "url": "https://github.com/hyperf/server.git", + "reference": "0a2bfa37355631a0f0484bfd08d815ad858d279c" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/server/v3.0.24", - "reference": "8129ef965778acb97b0977d751e9a7b17c85ba21", - "shasum": "8129ef965778acb97b0977d751e9a7b17c85ba21" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/server/v3.0.24/hyperf-server-v3.0.24.zip", + "reference": "0a2bfa37355631a0f0484bfd08d815ad858d279c", + "shasum": "" }, "require": { "hyperf/contract": "~3.0.0", @@ -3247,11 +3149,6 @@ "Hyperf\\Server\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\Server\\": "tests/" - } - }, "license": [ "MIT" ], @@ -3263,11 +3160,7 @@ "server", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-06-07T05:27:29+00:00" }, { "name": "hyperf/snowflake", @@ -3279,7 +3172,7 @@ }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/proxy/archive/hyperf/snowflake/v3.0.18?source=%E5%AE%98%E6%96%B9%E6%BA%90", + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/snowflake/v3.0.18/hyperf-snowflake-v3.0.18.zip", "reference": "76d7ef7683c964d17d4cd30815bcb0509428adf3", "shasum": "" }, @@ -3319,12 +3212,17 @@ }, { "name": "hyperf/stringable", - "version": "v3.0.27", + "version": "v3.0.31", + "source": { + "type": "git", + "url": "https://github.com/hyperf/stringable.git", + "reference": "1bcea1466a87267c780cd67df05de0127c237dcd" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/stringable/v3.0.27", - "reference": "17cf616de2698100364d0381861fc18fd64a3f07", - "shasum": "17cf616de2698100364d0381861fc18fd64a3f07" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/stringable/v3.0.31/hyperf-stringable-v3.0.31.zip", + "reference": "1bcea1466a87267c780cd67df05de0127c237dcd", + "shasum": "" }, "require": { "hyperf/collection": "~3.0.0", @@ -3345,16 +3243,11 @@ } }, "autoload": { - "psr-4": { - "Hyperf\\Stringable\\": "src/" - }, "files": [ "src/Functions.php" - ] - }, - "autoload-dev": { + ], "psr-4": { - "HyperfTest\\Stringable\\": "tests/" + "Hyperf\\Stringable\\": "src/" } }, "license": [ @@ -3368,20 +3261,21 @@ "stringable", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-07-25T12:44:39+00:00" }, { "name": "hyperf/support", "version": "v3.0.24", + "source": { + "type": "git", + "url": "https://github.com/hyperf/support.git", + "reference": "576838e7185bf8eb749920a3285b399cb9c3a24b" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/support/v3.0.24", - "reference": "2f30401ef07803829376334b2afdaa05a17af358", - "shasum": "2f30401ef07803829376334b2afdaa05a17af358" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/support/v3.0.24/hyperf-support-v3.0.24.zip", + "reference": "576838e7185bf8eb749920a3285b399cb9c3a24b", + "shasum": "" }, "require": { "hyperf/collection": "~3.0.0", @@ -3402,16 +3296,11 @@ } }, "autoload": { - "psr-4": { - "Hyperf\\Support\\": "src/" - }, "files": [ "src/Functions.php" - ] - }, - "autoload-dev": { + ], "psr-4": { - "HyperfTest\\Support\\": "tests/" + "Hyperf\\Support\\": "src/" } }, "license": [ @@ -3425,20 +3314,21 @@ "support", "swoole" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-06-08T06:55:09+00:00" }, { "name": "hyperf/tappable", "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/hyperf/tappable.git", + "reference": "4f90b9026a5bdce5b3e6be29a2ab7a86c54f372a" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/tappable/v3.0.0", - "reference": "5833fabfe5b6161265d9debce5be422cab854b52", - "shasum": "5833fabfe5b6161265d9debce5be422cab854b52" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/tappable/v3.0.0/hyperf-tappable-v3.0.0.zip", + "reference": "4f90b9026a5bdce5b3e6be29a2ab7a86c54f372a", + "shasum": "" }, "require": { "php": ">=7.4" @@ -3450,16 +3340,11 @@ } }, "autoload": { - "psr-4": { - "Hyperf\\Tappable\\": "src/" - }, "files": [ "src/Functions.php" - ] - }, - "autoload-dev": { + ], "psr-4": { - "HyperfTest\\Tappable\\": "tests/" + "Hyperf\\Tappable\\": "src/" } }, "license": [ @@ -3473,29 +3358,26 @@ "swoole", "tappable" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-03-28T15:02:39+00:00" }, { "name": "hyperf/translation", - "version": "v3.0.16", + "version": "v3.0.22", "source": { "type": "git", "url": "https://github.com/hyperf/translation.git", - "reference": "2fe511baa79816b14471de466bd665050b8b01f3" + "reference": "d8043633db04c81490b87c29007f3e53307b3aa1" }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/proxy/archive/hyperf/translation/v3.0.16?source=%E5%AE%98%E6%96%B9%E6%BA%90", - "reference": "2fe511baa79816b14471de466bd665050b8b01f3", + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/translation/v3.0.22/hyperf-translation-v3.0.22.zip", + "reference": "d8043633db04c81490b87c29007f3e53307b3aa1", "shasum": "" }, "require": { "hyperf/contract": "~3.0.0", "hyperf/macroable": "~3.0.0", + "hyperf/support": "~3.0.0", "hyperf/utils": "~3.0.0", "php": ">=8.0", "psr/container": "^1.0|^2.0" @@ -3510,12 +3392,12 @@ } }, "autoload": { - "psr-4": { - "Hyperf\\Translation\\": "src/" - }, "files": [ "src/Functions.php" - ] + ], + "psr-4": { + "Hyperf\\Translation\\": "src/" + } }, "license": [ "MIT" @@ -3525,16 +3407,21 @@ "hyperf", "translation" ], - "time": "2023-04-12T04:36:10+00:00" + "time": "2023-05-24T13:51:45+00:00" }, { "name": "hyperf/utils", "version": "v3.0.18", + "source": { + "type": "git", + "url": "https://github.com/hyperf/utils.git", + "reference": "2e59cef3dd562053fe7c9b2a41e7243b4ee23bd6" + }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/archive/hyperf/utils/v3.0.18", - "reference": "52a46ef030af6351ec6634987a71d15ba36f6d76", - "shasum": "52a46ef030af6351ec6634987a71d15ba36f6d76" + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/utils/v3.0.18/hyperf-utils-v3.0.18.zip", + "reference": "2e59cef3dd562053fe7c9b2a41e7243b4ee23bd6", + "shasum": "" }, "require": { "doctrine/inflector": "^2.0", @@ -3569,16 +3456,11 @@ } }, "autoload": { - "psr-4": { - "Hyperf\\Utils\\": "src/" - }, "files": [ "src/Functions.php" - ] - }, - "autoload-dev": { + ], "psr-4": { - "HyperfTest\\Utils\\": "tests/" + "Hyperf\\Utils\\": "src/" } }, "license": [ @@ -3592,41 +3474,40 @@ "swoole", "utils" ], - "support": { - "issues": "https://github.com/hyperf/hyperf/issues", - "source": "https://github.com/hyperf/hyperf", - "docs": "https://hyperf.wiki" - } + "time": "2023-04-26T03:02:31+00:00" }, { "name": "hyperf/validation", - "version": "v3.0.16", + "version": "v3.0.28", "source": { "type": "git", "url": "https://github.com/hyperf/validation.git", - "reference": "df511f856a93bbdfce39b345f084d812d2c6043d" + "reference": "c1aa358eabf24148487602005e49565bbf02979b" }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/proxy/archive/hyperf/validation/v3.0.16?source=%E5%AE%98%E6%96%B9%E6%BA%90", - "reference": "df511f856a93bbdfce39b345f084d812d2c6043d", + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/validation/v3.0.28/hyperf-validation-v3.0.28.zip", + "reference": "c1aa358eabf24148487602005e49565bbf02979b", "shasum": "" }, "require": { "egulias/email-validator": "^3.0", + "hyperf/collection": "~3.0.0", "hyperf/contract": "~3.0.0", "hyperf/database": "~3.0.0", "hyperf/di": "~3.0.0", "hyperf/framework": "~3.0.0", "hyperf/http-server": "~3.0.0", "hyperf/macroable": "~3.0.0", + "hyperf/support": "~3.0.0", + "hyperf/tappable": "~3.0.0", "hyperf/translation": "~3.0.0", "hyperf/utils": "~3.0.0", "nesbot/carbon": "^2.21", "php": ">=8.0", "psr/container": "^1.0|^2.0", "psr/event-dispatcher": "^1.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0|^2.0" }, "type": "library", "extra": { @@ -3650,7 +3531,7 @@ "hyperf", "validation" ], - "time": "2023-04-12T04:36:10+00:00" + "time": "2023-07-03T04:37:00+00:00" }, { "name": "intervention/image", @@ -4307,16 +4188,16 @@ }, { "name": "overtrue/socialite", - "version": "4.8.0", + "version": "4.8.1", "source": { "type": "git", "url": "https://github.com/overtrue/socialite.git", - "reference": "e55fdf50f8003be8f03a85a7e5a5b7c5716f4c9a" + "reference": "470b781f288fbb24c8b105cfdada215d83d84d4b" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/overtrue/socialite/4.8.0/overtrue-socialite-4.8.0.zip", - "reference": "e55fdf50f8003be8f03a85a7e5a5b7c5716f4c9a", + "url": "https://mirrors.huaweicloud.com/repository/php/overtrue/socialite/4.8.1/overtrue-socialite-4.8.1.zip", + "reference": "470b781f288fbb24c8b105cfdada215d83d84d4b", "shasum": "" }, "require": { @@ -4371,7 +4252,7 @@ "type": "github" } ], - "time": "2023-01-10T14:29:55+00:00" + "time": "2023-07-17T08:56:49+00:00" }, { "name": "paragonie/constant_time_encoding", @@ -6591,21 +6472,22 @@ }, { "name": "symfony/psr-http-message-bridge", - "version": "v2.2.0", + "version": "v2.3.1", "source": { "type": "git", "url": "https://github.com/symfony/psr-http-message-bridge.git", - "reference": "28a732c05bbad801304ad5a5c674cf2970508993" + "reference": "581ca6067eb62640de5ff08ee1ba6850a0ee472e" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/symfony/psr-http-message-bridge/v2.2.0/symfony-psr-http-message-bridge-v2.2.0.zip", - "reference": "28a732c05bbad801304ad5a5c674cf2970508993", + "url": "https://mirrors.huaweicloud.com/repository/php/symfony/psr-http-message-bridge/v2.3.1/symfony-psr-http-message-bridge-v2.3.1.zip", + "reference": "581ca6067eb62640de5ff08ee1ba6850a0ee472e", "shasum": "" }, "require": { "php": ">=7.2.5", "psr/http-message": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.5 || ^3.0", "symfony/http-foundation": "^5.4 || ^6.0" }, "require-dev": { @@ -6624,7 +6506,7 @@ "type": "symfony-bridge", "extra": { "branch-alias": { - "dev-main": "2.2-dev" + "dev-main": "2.3-dev" } }, "autoload": { @@ -6670,7 +6552,7 @@ "type": "tidelift" } ], - "time": "2023-04-21T08:40:19+00:00" + "time": "2023-07-26T11:53:26+00:00" }, { "name": "symfony/service-contracts", @@ -7258,16 +7140,16 @@ }, { "name": "w7corp/easywechat", - "version": "6.12.1", + "version": "6.12.3", "source": { "type": "git", "url": "https://github.com/w7corp/easywechat.git", - "reference": "7487ea7bec3fce156d49f37d2d486535861ec636" + "reference": "10b9f31b61b4e5327c9e4457dffcf307de2deb6c" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/w7corp/easywechat/6.12.1/w7corp-easywechat-6.12.1.zip", - "reference": "7487ea7bec3fce156d49f37d2d486535861ec636", + "url": "https://mirrors.huaweicloud.com/repository/php/w7corp/easywechat/6.12.3/w7corp-easywechat-6.12.3.zip", + "reference": "10b9f31b61b4e5327c9e4457dffcf307de2deb6c", "shasum": "" }, "require": { @@ -7349,7 +7231,7 @@ "type": "github" } ], - "time": "2023-06-14T13:26:31+00:00" + "time": "2023-07-05T14:14:28+00:00" } ], "packages-dev": [ @@ -7627,16 +7509,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.19.1", + "version": "v3.22.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "14772488aa1f31bd7ed767c390b96841ca687435" + "reference": "92b019f6c8d79aa26349d0db7671d37440dc0ff3" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/friendsofphp/php-cs-fixer/v3.19.1/friendsofphp-php-cs-fixer-v3.19.1.zip", - "reference": "14772488aa1f31bd7ed767c390b96841ca687435", + "url": "https://mirrors.huaweicloud.com/repository/php/friendsofphp/php-cs-fixer/v3.22.0/friendsofphp-php-cs-fixer-v3.22.0.zip", + "reference": "92b019f6c8d79aa26349d0db7671d37440dc0ff3", "shasum": "" }, "require": { @@ -7660,6 +7542,7 @@ "symfony/stopwatch": "^5.4 || ^6.0" }, "require-dev": { + "facile-it/paraunit": "^1.3 || ^2.0", "justinrainbow/json-schema": "^5.2", "keradus/cli-executor": "^2.0", "mikey179/vfsstream": "^1.6.11", @@ -7714,7 +7597,7 @@ "type": "github" } ], - "time": "2023-06-24T17:16:35+00:00" + "time": "2023-07-16T23:08:06+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -7764,22 +7647,24 @@ }, { "name": "hyperf/devtool", - "version": "v3.0.16", + "version": "v3.0.18", "source": { "type": "git", "url": "https://github.com/hyperf/devtool.git", - "reference": "818acbd00bb4976c1175a57606d58bdaf964d6a3" + "reference": "6318b261197c333f69e19de2d2ea36ffcb45383b" }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/proxy/archive/hyperf/devtool/v3.0.16?source=%E5%AE%98%E6%96%B9%E6%BA%90", - "reference": "818acbd00bb4976c1175a57606d58bdaf964d6a3", + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/devtool/v3.0.18/hyperf-devtool-v3.0.18.zip", + "reference": "6318b261197c333f69e19de2d2ea36ffcb45383b", "shasum": "" }, "require": { + "hyperf/code-parser": "~3.0.0", "hyperf/command": "~3.0.0", "hyperf/contract": "~3.0.0", "hyperf/di": "~3.0.0", + "hyperf/support": "~3.0.0", "hyperf/utils": "~3.0.0", "php": ">=8.0" }, @@ -7808,30 +7693,35 @@ "php", "swoole" ], - "time": "2023-04-11T07:57:32+00:00" + "time": "2023-04-26T03:02:31+00:00" }, { "name": "hyperf/testing", - "version": "v3.0.16", + "version": "v3.0.30", "source": { "type": "git", "url": "https://github.com/hyperf/testing.git", - "reference": "f35d779b87b911202a607d33cd0dc800089aa1ad" + "reference": "fa9d8c1e79bc4958be5a2642387e1915a7fc9f13" }, "dist": { "type": "zip", - "url": "https://hyperf-cloud-composer.pkg.coding.net/limingxinleo/proxy/proxy/archive/hyperf/testing/v3.0.16?source=%E5%AE%98%E6%96%B9%E6%BA%90", - "reference": "f35d779b87b911202a607d33cd0dc800089aa1ad", + "url": "https://mirrors.huaweicloud.com/repository/php/hyperf/testing/v3.0.30/hyperf-testing-v3.0.30.zip", + "reference": "fa9d8c1e79bc4958be5a2642387e1915a7fc9f13", "shasum": "" }, "require": { + "hyperf/codec": "~3.0.0", + "hyperf/collection": "~3.0.0", "hyperf/contract": "~3.0.0", + "hyperf/coroutine": "~3.0.0", "hyperf/http-message": "~3.0.0", "hyperf/http-server": "~3.0.0", + "hyperf/support": "~3.0.0", "hyperf/utils": "~3.0.0", "php": ">=8.0", "phpunit/phpunit": "^9.5", - "psr/container": "^1.0|^2.0" + "psr/container": "^1.0|^2.0", + "symfony/http-foundation": "^5.4|^6.0" }, "bin": [ "co-phpunit" @@ -7856,41 +7746,37 @@ "swoole", "testing" ], - "time": "2023-04-12T04:36:10+00:00" + "time": "2023-07-21T03:15:25+00:00" }, { "name": "mockery/mockery", - "version": "1.6.2", + "version": "1.6.4", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "13a7fa2642c76c58fa2806ef7f565344c817a191" + "reference": "d1413755e26fe56a63455f7753221c86cbb88f66" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/mockery/mockery/1.6.2/mockery-mockery-1.6.2.zip", - "reference": "13a7fa2642c76c58fa2806ef7f565344c817a191", + "url": "https://mirrors.huaweicloud.com/repository/php/mockery/mockery/1.6.4/mockery-mockery-1.6.4.zip", + "reference": "d1413755e26fe56a63455f7753221c86cbb88f66", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": "^7.4 || ^8.0" + "php": ">=7.4,<8.3" }, "conflict": { "phpunit/phpunit": "<8.0" }, "require-dev": { "phpunit/phpunit": "^8.5 || ^9.3", - "psalm/plugin-phpunit": "^0.18", - "vimeo/psalm": "^5.9" + "psalm/plugin-phpunit": "^0.18.4", + "symplify/easy-coding-standard": "^11.5.0", + "vimeo/psalm": "^5.13.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.6.x-dev" - } - }, "autoload": { "files": [ "library/helpers.php", @@ -7907,12 +7793,20 @@ { "name": "Pádraic Brady", "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" + "homepage": "https://github.com/padraic", + "role": "Author" }, { "name": "Dave Marshall", "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" + "homepage": "https://davedevelopment.co.uk", + "role": "Developer" + }, + { + "name": "Nathanael Esayeas", + "email": "nathanael.esayeas@protonmail.com", + "homepage": "https://github.com/ghostwriter", + "role": "Lead Developer" } ], "description": "Mockery is a simple yet flexible PHP mock object framework", @@ -7929,7 +7823,7 @@ "test double", "testing" ], - "time": "2023-06-07T09:07:52+00:00" + "time": "2023-07-19T15:51:02+00:00" }, { "name": "myclabs/deep-copy", @@ -8088,16 +7982,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.21", + "version": "1.10.26", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5" + "reference": "5d660cbb7e1b89253a47147ae44044f49832351f" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/phpstan/phpstan/1.10.21/phpstan-phpstan-1.10.21.zip", - "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5", + "url": "https://mirrors.huaweicloud.com/repository/php/phpstan/phpstan/1.10.26/phpstan-phpstan-1.10.26.zip", + "reference": "5d660cbb7e1b89253a47147ae44044f49832351f", "shasum": "" }, "require": { @@ -8138,7 +8032,7 @@ "type": "tidelift" } ], - "time": "2023-06-21T20:07:58+00:00" + "time": "2023-07-19T12:44:37+00:00" }, { "name": "phpunit/php-code-coverage", @@ -8996,16 +8890,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "bde739e7565280bda77be70044ac1047bc007e34" }, "dist": { "type": "zip", - "url": "https://mirrors.huaweicloud.com/repository/php/sebastian/global-state/5.0.5/sebastian-global-state-5.0.5.zip", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://mirrors.huaweicloud.com/repository/php/sebastian/global-state/5.0.6/sebastian-global-state-5.0.6.zip", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", "shasum": "" }, "require": { @@ -9051,7 +8945,7 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2023-08-02T09:26:13+00:00" }, { "name": "sebastian/lines-of-code", From 1810a511bc8b3ddb8040b9251b80217bf581612e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 14:33:13 +0800 Subject: [PATCH 033/176] 1 --- app/Services/DetectionService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 1b761cb..43e638d 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -415,6 +415,7 @@ class DetectionService extends BaseService $data['detection_no'] = "D" . $generator->generate(); // 系统订单编号 $data['amount_total'] = $detection_project['detection_project_price']; // 订单金额 $data['coupon_amount_total'] = 0;// 优惠卷总金额 + $data['payment_amount_total'] = $detection_project['detection_project_price']; // 实际付款金额 $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) From cf98a6fbaa67d65b2cf1937f2fa462464a3f990a Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 14:44:06 +0800 Subject: [PATCH 034/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E7=99=BD=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Utils/Auth.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Utils/Auth.php b/app/Utils/Auth.php index 07f9f35..8c05436 100644 --- a/app/Utils/Auth.php +++ b/app/Utils/Auth.php @@ -28,6 +28,8 @@ class Auth "/callback/wxpay/inquiry/refund" => "post", // 微信问诊退款回调 "/callback/wxpay/product/success" => "post", // 微信药品支付回调 "/callback/wxpay/product/refund" => "post", // 微信药品退款回调 + "/callback/wxpay/decetion/success" => "post", // 微信药品支付回调 + "/callback/wxpay/decetion/refund" => "post", // 微信药品退款回调 "/callback/im" => "post", // im回调 "/callback/platform/logistics" => "post", // 处方平台物流回调 "/callback/logistics" => "post", // 快递100订阅回调 From 26acfcf40384e6f319e0d238e891ce5438c56314 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 14:50:15 +0800 Subject: [PATCH 035/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E7=99=BD=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Utils/Auth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Utils/Auth.php b/app/Utils/Auth.php index 8c05436..d19f589 100644 --- a/app/Utils/Auth.php +++ b/app/Utils/Auth.php @@ -28,8 +28,8 @@ class Auth "/callback/wxpay/inquiry/refund" => "post", // 微信问诊退款回调 "/callback/wxpay/product/success" => "post", // 微信药品支付回调 "/callback/wxpay/product/refund" => "post", // 微信药品退款回调 - "/callback/wxpay/decetion/success" => "post", // 微信药品支付回调 - "/callback/wxpay/decetion/refund" => "post", // 微信药品退款回调 + "/callback/wxpay/detection/success" => "post", // 微信药品支付回调 + "/callback/wxpay/detection/refund" => "post", // 微信药品退款回调 "/callback/im" => "post", // im回调 "/callback/platform/logistics" => "post", // 处方平台物流回调 "/callback/logistics" => "post", // 快递100订阅回调 From 7ee83d9bc9c0f92d58410650dd91d04b791ab158 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 14:57:13 +0800 Subject: [PATCH 036/176] 1 --- app/Services/DetectionService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 43e638d..feb4f15 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -590,7 +590,7 @@ class DetectionService extends BaseService // 检测订单金额 if ($order_detection['payment_amount_total'] > 0){ // 发起退款 - $WechatPay = new WechatPay(1, 1); + $WechatPay = new WechatPay(1, 3); $options = array(); $options['transaction_id'] = $order_detection['escrow_trade_no']; @@ -602,6 +602,7 @@ class DetectionService extends BaseService 'currency' => "CNY", ]; + dump($options); $result = $WechatPay->refund($options); // 处理订单退款状态 From b67b252390143acb19c1b45babdf821e28338fde Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 15:11:02 +0800 Subject: [PATCH 037/176] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E9=87=91=E9=A2=9D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index bdc4146..44c4a44 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1161,9 +1161,6 @@ class CallBackController extends AbstractController Log::getInstance()->error("检测微信支付回调数据处理失败:无支付金额"); return $this->wxPayErrorReturn("检测微信支付回调数据处理失败:无支付金额"); } - - // 实际付款金额 - $data['payment_amount_total'] = $message['amount']['payer_total']; } elseif ($message['trade_state'] == "CLOSED") { // 已关闭 $data['detection_pay_status'] = 6; From 55bb38d6d9553583b6d618aa69b403f501ad3760 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 15:17:28 +0800 Subject: [PATCH 038/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=88=90=E5=8A=9F=E9=80=9A=E7=9F=A5=20?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DetectionService.php | 1 - app/Services/PatientOrderService.php | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index feb4f15..47c01d7 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -602,7 +602,6 @@ class DetectionService extends BaseService 'currency' => "CNY", ]; - dump($options); $result = $WechatPay->refund($options); // 处理订单退款状态 diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 5ceb793..ba0e297 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1859,11 +1859,9 @@ class PatientOrderService extends BaseService } try { - if (!empty($order_inquiry['doctor_id'])) { - // 推送患者-订单取消成功通知 - $MessagePush = new MessagePush($order_detection['user_id'], $order_inquiry['order_inquiry_id']); - $MessagePush->patientCancelOrderSuccess($order_detection['order_detection_id']); - } + // 推送患者-订单取消成功通知 + $MessagePush = new MessagePush($order_detection['user_id']); + $MessagePush->patientCancelOrderSuccess($order_detection['order_detection_id']); } catch (\Exception $e) { return success(); } From 2159400c445f71ee193c201bb760b372ab199af2 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 17:42:47 +0800 Subject: [PATCH 039/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=88=90=E5=8A=9F=E9=80=9A=E7=9F=A5=20?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/PatientOrderController.php | 11 ++++++ app/Services/DetectionService.php | 3 +- app/Services/MessagePush.php | 2 +- app/Services/PatientOrderService.php | 41 +++++++++++++++++++++++ config/routes.php | 3 -- 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/app/Controller/PatientOrderController.php b/app/Controller/PatientOrderController.php index d4c2817..7a491e4 100644 --- a/app/Controller/PatientOrderController.php +++ b/app/Controller/PatientOrderController.php @@ -287,4 +287,15 @@ class PatientOrderController extends AbstractController $data = $PatientOrderService->putCancelPatientDetectionOrder(); return $this->response->json($data); } + + /** + * 检测订单取消支付 + * @return ResponseInterface + */ + public function putPatientDetectionOrderCancelPay(): ResponseInterface + { + $PatientOrderService = new PatientOrderService(); + $data = $PatientOrderService->putPatientDetectionOrderCancelPay(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 47c01d7..b04ca59 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -240,9 +240,8 @@ class DetectionService extends BaseService $user_doctors = UserDoctor::getDiagnoCoopDoctorList($params,$hospital_params,$fields); if (!empty($user_doctors)){ foreach ($user_doctors as &$value){ - $doctor = array(); if (!empty($value['Hospital'])){ - $doctor['hospital_name'] = $value['Hospital']['hospital_name']; + $value['hospital_name'] = $value['Hospital']['hospital_name']; } unset($value['Hospital']); diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 2b97394..433dfe0 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -2263,7 +2263,7 @@ class MessagePush extends BaseService $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "5aJSrO8SU5rxqdB99zzl4rMVgcOTjt5mQh56cpZI1Hg";//咨询提醒 - $sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id="; + $sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['order_detection_id']; $sub_data['params']['data'] = [ "thing1" => $order_detection['patient_name'],// 就诊人 "thing7" => (string)$detection_project['detection_project_name'],// 服务项目 diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index ba0e297..9dbc50e 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1869,6 +1869,47 @@ class PatientOrderService extends BaseService return success(); } + /** + * 检测订单取消支付 + * @return array + */ + public function putPatientDetectionOrderCancelPay(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $order_detection_id = $this->request->route('order_detection_id'); + + Db::beginTransaction(); + + try { + // 获取订单数据 + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['order_detection_id'] = $order_detection_id; + $params['is_delete'] = 0; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + return fail(); + } + + // 检测订单取消 + // 取消订单原因(1:主动取消 2:客服取消 3:支付超时) + $DetectionService = new DetectionService(); + $result = $DetectionService->cancelUnpayDetectionOrder($order_detection['detection_no'], 3, "支付超时"); + if ($result['status'] != 1) { + Db::rollBack(); + return fail(); + } + + Db::commit(); + } catch (\Exception $e) { + Db::rollBack(); + return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage()); + } + + return success(); + } + /** * 获取患者未完成订单 * @param string $patient_id diff --git a/config/routes.php b/config/routes.php index c2fd465..7225f10 100644 --- a/config/routes.php +++ b/config/routes.php @@ -278,9 +278,6 @@ Router::addGroup('/patient', function () { // 获取检测机构合作医生列表 Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']); - // 获取患者进行中的订单 - Router::get('/progress-order', [DetectionController::class, 'getDetectionDoctorList']); - // 检测项目 Router::addGroup('/project', function () { // 获取合作公司检测项目列表 From cefe11b02b0f3db29b83e31f64a50001cd9cf203 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 7 Aug 2023 09:06:34 +0800 Subject: [PATCH 040/176] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=82=A3=E8=80=85?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=AD=E7=9A=84=E6=A3=80=E6=B5=8B=E8=AE=A2?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/DetectionController.php | 23 ++++++++++++++++++++++- app/Request/DetectionRequest.php | 3 +++ app/Services/DetectionService.php | 23 +++++++++++++++++++++++ config/routes.php | 3 +++ 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php index 47538d1..63b759d 100644 --- a/app/Controller/DetectionController.php +++ b/app/Controller/DetectionController.php @@ -54,7 +54,12 @@ class DetectionController extends AbstractController return $this->response->json($data); } - // 创建检测订单 + /** + * 创建检测订单 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ public function addDetectionOrder(): ResponseInterface { $request = $this->container->get(DetectionRequest::class); @@ -64,4 +69,20 @@ class DetectionController extends AbstractController $data = $detectionService->addDetectionOrder(); return $this->response->json($data); } + + /** + * 获取患者进行中的检测订单 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function getDetectionDoctorOrderFirst(): ResponseInterface + { + $request = $this->container->get(DetectionRequest::class); + $request->scene('getDetectionDoctorOrderFirst')->validateResolved(); + + $detectionService = new DetectionService(); + $data = $detectionService->getDetectionDoctorOrderFirst(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Request/DetectionRequest.php b/app/Request/DetectionRequest.php index eccc0d4..c3329dc 100644 --- a/app/Request/DetectionRequest.php +++ b/app/Request/DetectionRequest.php @@ -21,6 +21,9 @@ class DetectionRequest extends FormRequest 'doctor_id', // 医生id 'client_type', // 客户端类型(1:手机 2:电脑) ], + 'getDetectionDoctorOrderFirst' => [ // 创建检测订单 + 'family_id', + ], ]; /** diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index b04ca59..0f2ebfa 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -470,6 +470,29 @@ class DetectionService extends BaseService return success($result); } + /** + * 获取患者进行中的检测订单 + * @return array + */ + public function getDetectionDoctorOrderFirst(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $family_id = $this->request->input("family_id"); + + // 检测是否存在同类型未完成的检测订单 + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['family_id'] = $family_id; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)){ + return success(); + } + + return success($order_detection['order_detection_id']); + + } + /** * 取消未支付检测订单 * @param string|int $order_no 订单编号 diff --git a/config/routes.php b/config/routes.php index 7225f10..f753a31 100644 --- a/config/routes.php +++ b/config/routes.php @@ -275,6 +275,9 @@ Router::addGroup('/patient', function () { ] ); + // 获取患者进行中的检测订单 + Router::get('', [DetectionController::class, 'getDetectionDoctorOrderFirst']); + // 获取检测机构合作医生列表 Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']); From 26cd0dcbe81c0e9bfef54c92bf56c23ed761ec50 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 7 Aug 2023 11:06:57 +0800 Subject: [PATCH 041/176] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=82=A3=E8=80=85?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=AD=E7=9A=84=E6=A3=80=E6=B5=8B=E8=AE=A2?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/DetectionController.php | 22 ++++++++-- app/Controller/TestController.php | 28 ++++++++++++ app/Request/DetectionRequest.php | 8 +++- app/Services/DetectionService.php | 60 +++++++++++++++++++++++++- config/routes.php | 8 +++- 5 files changed, 120 insertions(+), 6 deletions(-) diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php index 63b759d..9cdba87 100644 --- a/app/Controller/DetectionController.php +++ b/app/Controller/DetectionController.php @@ -76,13 +76,29 @@ class DetectionController extends AbstractController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function getDetectionDoctorOrderFirst(): ResponseInterface + public function getDetectionOrderFirst(): ResponseInterface { $request = $this->container->get(DetectionRequest::class); - $request->scene('getDetectionDoctorOrderFirst')->validateResolved(); + $request->scene('getDetectionOrderFirst')->validateResolved(); $detectionService = new DetectionService(); - $data = $detectionService->getDetectionDoctorOrderFirst(); + $data = $detectionService->getDetectionOrderFirst(); + return $this->response->json($data); + } + + /** + * 绑定检测管 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function bindDetectionTube(): ResponseInterface + { + $request = $this->container->get(DetectionRequest::class); + $request->scene('bindDetectionTube')->validateResolved(); + + $detectionService = new DetectionService(); + $data = $detectionService->bindDetectionTube(); return $this->response->json($data); } } \ No newline at end of file diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 5618ad6..92a5267 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -396,4 +396,32 @@ class TestController extends AbstractController $result = $Wechat->getUrlLink($options); dump($result); } + + // 设置坐班医生 + public function setDoctor(){ + $timestamp = time(); // 当前时间戳 + $weekNumber = date('W', $timestamp); // 获取当前年份的周数 + + // 计算本周一的时间戳 + $weekStartTimestamp = strtotime("Monday this week", $timestamp); + + // 计算本周一所在周的奇数或偶数周 + if ($weekNumber % 2 === 1) { + $startOfWeek = $weekStartTimestamp; // 奇数周的本周一 + $endOfWeek = strtotime('+6 days', $startOfWeek); // 奇数周的本周日 + } else { + $endOfWeek = $weekStartTimestamp; // 偶数周的本周一 + $startOfWeek = strtotime('-6 days', $endOfWeek); // 偶数周的本周日 + } + + // 获取每日日期 + $dates = []; + for ($i = 0; $i < 7; $i++) { + $dates[] = date('Y-m-d', strtotime("+$i days", $startOfWeek)); + } + + echo "Start of the week: " . date('Y-m-d', $startOfWeek) . "\n"; + echo "End of the week: " . date('Y-m-d', $endOfWeek) . "\n"; + echo "Dates of the week: " . implode(', ', $dates); + } } \ No newline at end of file diff --git a/app/Request/DetectionRequest.php b/app/Request/DetectionRequest.php index c3329dc..231e685 100644 --- a/app/Request/DetectionRequest.php +++ b/app/Request/DetectionRequest.php @@ -21,9 +21,13 @@ class DetectionRequest extends FormRequest 'doctor_id', // 医生id 'client_type', // 客户端类型(1:手机 2:电脑) ], - 'getDetectionDoctorOrderFirst' => [ // 创建检测订单 + 'getDetectionOrderFirst' => [ // 获取患者进行中的检测订单 'family_id', ], + 'bindDetectionTube' => [ // 绑定检测管 + 'detection_bar_code', + 'detection_pic', + ], ]; /** @@ -47,6 +51,8 @@ class DetectionRequest extends FormRequest 'detection_project_id' => 'required', 'doctor_id' => 'required', 'client_type' => 'required|integer|min:1|max:2', + 'detection_bar_code' => 'required', + 'detection_pic' => 'required', ]; } diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 0f2ebfa..df30d9a 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -18,6 +18,7 @@ use App\Model\PatientFamily; use App\Model\UserDoctor; use App\Model\UserLocation; use App\Utils\Log; +use App\Utils\PcreMatch; use Extend\Wechat\WechatPay; use Hyperf\Amqp\Producer; use Hyperf\DbConnection\Db; @@ -474,7 +475,7 @@ class DetectionService extends BaseService * 获取患者进行中的检测订单 * @return array */ - public function getDetectionDoctorOrderFirst(): array + public function getDetectionOrderFirst(): array { $user_info = $this->request->getAttribute("userInfo") ?? []; @@ -493,6 +494,63 @@ class DetectionService extends BaseService } + // 绑定检测管 + public function bindDetectionTube(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $order_detection_id = $this->request->route("order_detection_id"); + + $request_params = $this->request->all(); + + if (count($request_params['detection_pic']) < 1){ + return fail(HttpEnumCode::HTTP_ERROR,"请上传检测管图片"); + } + + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['order_detection_id'] = $order_detection_id; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)){ + return fail(); + } + + // 检测订单状态 + if ($order_detection['detection_status'] != 2){ + return fail(HttpEnumCode::HTTP_ERROR,"订单状态错误"); + } + + if ($order_detection['detection_pay_status'] != 2){ + return fail(HttpEnumCode::HTTP_ERROR,"订单未支付"); + } + + if (!empty($order_detection['detection_bar_code'])){ + return fail(HttpEnumCode::HTTP_ERROR,"请勿重复绑定"); + } + + if (!empty($order_detection['detection_pic'])){ + return fail(HttpEnumCode::HTTP_ERROR,"请勿重复绑定"); + } + + // 处理检测管图片 + $detection_pic = implode(',', $request_params['detection_pic']); + $detection_pic = PcreMatch::pregRemoveOssWebsite($detection_pic); + + $data = array(); + $data['detection_pic'] = $detection_pic; + $data['detection_bar_code'] = $request_params['detection_bar_code']; + $data['detection_status'] = 3; + + $params = array(); + $params['order_detection_id'] = $order_detection_id; + $res = OrderDetection::editOrderDetection($params,$data); + if (!$res){ + return fail(HttpEnumCode::HTTP_ERROR,"绑定失败"); + } + + return success(); + } + /** * 取消未支付检测订单 * @param string|int $order_no 订单编号 diff --git a/config/routes.php b/config/routes.php index f753a31..f7f92e7 100644 --- a/config/routes.php +++ b/config/routes.php @@ -276,7 +276,10 @@ Router::addGroup('/patient', function () { ); // 获取患者进行中的检测订单 - Router::get('', [DetectionController::class, 'getDetectionDoctorOrderFirst']); + Router::get('', [DetectionController::class, 'getDetectionOrderFirst']); + + // 绑定检测管 + Router::put('/bind/{order_detection_id:\d+}', [DetectionController::class, 'bindDetectionTube']); // 获取检测机构合作医生列表 Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']); @@ -688,6 +691,9 @@ Router::addGroup('/test', function () { // 模拟退款 // Router::get('/refund', [TestController::class, 'refund']); + // 设置坐班医生 + Router::get('/doctor', [TestController::class, 'setDoctor']); + }); // 地址管理 From faeb1a1502c8b79d9c5c31207c5ba1d86d3e5470 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 7 Aug 2023 11:48:57 +0800 Subject: [PATCH 042/176] =?UTF-8?q?=E7=BB=91=E5=AE=9A=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E7=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/TestController.php | 208 +++++++++++++++++++++++++++--- app/Model/DoctorInquiryTime.php | 8 +- 2 files changed, 196 insertions(+), 20 deletions(-) diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 92a5267..90c3c6d 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -399,29 +399,201 @@ class TestController extends AbstractController // 设置坐班医生 public function setDoctor(){ - $timestamp = time(); // 当前时间戳 - $weekNumber = date('W', $timestamp); // 获取当前年份的周数 +// $timestamp = time(); // 当前时间戳 +// +// // 计算本周一的时间戳 +// $weekStartTimestamp = strtotime("Monday this week", $timestamp); +// +// // 获取每日日期 +// for ($i = 21; $i < 28; $i++) { +// $date = date('Y-m-d', strtotime("+$i days", $weekStartTimestamp)); +// $this->secondDoctor($date); +// } + } - // 计算本周一的时间戳 - $weekStartTimestamp = strtotime("Monday this week", $timestamp); + function firstDoctor($date){ + $dayOfWeek = date('N', strtotime($date)); - // 计算本周一所在周的奇数或偶数周 - if ($weekNumber % 2 === 1) { - $startOfWeek = $weekStartTimestamp; // 奇数周的本周一 - $endOfWeek = strtotime('+6 days', $startOfWeek); // 奇数周的本周日 - } else { - $endOfWeek = $weekStartTimestamp; // 偶数周的本周一 - $startOfWeek = strtotime('-6 days', $endOfWeek); // 偶数周的本周日 + // 第一周 + if ($dayOfWeek == 1){ + $doctor_id = "534770104371658752"; // 吕明磊 + } elseif ($dayOfWeek == 2){ + $doctor_id = "534770104371658752"; // 吕明磊 + } elseif ($dayOfWeek == 3){ + $doctor_id = "515881272740962304"; // 乔新勋 + } elseif ($dayOfWeek == 4){ + $doctor_id = "534770104371658752"; // 吕明磊 + } elseif ($dayOfWeek == 5){ + $doctor_id = "515881272740962304"; // 乔新勋 + } elseif ($dayOfWeek == 6){ + $doctor_id = "515881272740962304"; // 乔新勋 + } elseif ($dayOfWeek == 7){ + $doctor_id = "515881272740962304"; // 乔新勋 } - // 获取每日日期 - $dates = []; - for ($i = 0; $i < 7; $i++) { - $dates[] = date('Y-m-d', strtotime("+$i days", $startOfWeek)); + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 2; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1000"; + $data['end_time'] = "1230"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); } - echo "Start of the week: " . date('Y-m-d', $startOfWeek) . "\n"; - echo "End of the week: " . date('Y-m-d', $endOfWeek) . "\n"; - echo "Dates of the week: " . implode(', ', $dates); + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 2; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1430"; + $data['end_time'] = "1730"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); + } + + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 2; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1830"; + $data['end_time'] = "2130"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); + } + + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 4; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1000"; + $data['end_time'] = "1230"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); + } + + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 4; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1430"; + $data['end_time'] = "1730"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); + } + + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 4; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1830"; + $data['end_time'] = "2130"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); + } + } + + function secondDoctor($date){ + $dayOfWeek = date('N', strtotime($date)); + + // 第一周 + if ($dayOfWeek == 1){ + $doctor_id = "515881272740962304"; // 乔新勋 + } elseif ($dayOfWeek == 2){ + $doctor_id = "534770104371658752"; // 吕明磊 + } elseif ($dayOfWeek == 3){ + $doctor_id = "515881272740962304"; // 乔新勋 + } elseif ($dayOfWeek == 4){ + $doctor_id = "534770104371658752"; // 吕明磊 + } elseif ($dayOfWeek == 5){ + $doctor_id = "515881272740962304"; // 乔新勋 + } elseif ($dayOfWeek == 6){ + $doctor_id = "534770104371658752"; // 吕明磊 + } elseif ($dayOfWeek == 7){ + $doctor_id = "515881272740962304"; // 乔新勋 + } + + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 2; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1000"; + $data['end_time'] = "1230"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); + } + + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 2; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1430"; + $data['end_time'] = "1730"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); + } + + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 2; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1830"; + $data['end_time'] = "2130"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); + } + + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 4; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1000"; + $data['end_time'] = "1230"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); + } + + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 4; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1430"; + $data['end_time'] = "1730"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); + } + + $data = array(); + $data['doctor_id'] = $doctor_id; + $data['inquiry_type'] = 4; + $data['inquiry_mode'] = 1; + $data['inquiry_date'] = $date; + $data['start_time'] = "1830"; + $data['end_time'] = "2130"; + $doctor_inquiry_time = DoctorInquiryTime::add($data); + if (empty($doctor_inquiry_time)){ + return fail(); + } } } \ No newline at end of file diff --git a/app/Model/DoctorInquiryTime.php b/app/Model/DoctorInquiryTime.php index 1fbb332..211cbd8 100644 --- a/app/Model/DoctorInquiryTime.php +++ b/app/Model/DoctorInquiryTime.php @@ -6,9 +6,7 @@ namespace App\Model; -use Hyperf\Database\Model\Builder; use Hyperf\Database\Model\Collection; -use Hyperf\Database\Model\Model; use Hyperf\Database\Model\Relations\HasOne; use Hyperf\Snowflake\Concern\Snowflake; @@ -114,4 +112,10 @@ class DoctorInquiryTime extends Model ->get($fields); } + + + public static function add(array $data): \Hyperf\Database\Model\Model|DoctorInquiryTime + { + return self::create($data); + } } From 3649f1635d07db8e7852c97b1b965b8e17e0b8b7 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 7 Aug 2023 14:23:55 +0800 Subject: [PATCH 043/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Request/SafeRequest.php | 2 +- app/Services/DetectionService.php | 5 ++--- app/Services/PatientOrderService.php | 4 ++-- app/Services/SafeService.php | 4 ++++ config/routes.php | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/Request/SafeRequest.php b/app/Request/SafeRequest.php index 72e2e2e..0759d3d 100644 --- a/app/Request/SafeRequest.php +++ b/app/Request/SafeRequest.php @@ -31,7 +31,7 @@ class SafeRequest extends FormRequest { return [ 'user_type' => 'required|integer|min:1|max:3', - 'scene' => 'required|integer|min:1|max:2', + 'scene' => 'required|integer|min:1|max:3', ]; } diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index df30d9a..622a517 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -313,7 +313,7 @@ class DetectionService extends BaseService if (!empty($order_detection)){ $result['status'] = 2; $result['message'] = "当前患者存在未完成的检测订单"; - $result['data']['order_detection_id'] = $order_detection['order_detection_id']; + $result['data']['order_no'] = $order_detection['detection_no']; return success($result); } @@ -490,8 +490,7 @@ class DetectionService extends BaseService return success(); } - return success($order_detection['order_detection_id']); - + return success($order_detection['detection_no']); } // 绑定检测管 diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 9dbc50e..edb239a 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1650,12 +1650,12 @@ class PatientOrderService extends BaseService { $user_info = $this->request->getAttribute("userInfo") ?? []; - $order_detection_id = $this->request->route('order_detection_id'); + $order_no = $this->request->route('order_no'); // 获取订单数据 $params = array(); $params['patient_id'] = $user_info['client_user_id']; - $params['order_detection_id'] = $order_detection_id; + $params['detection_no'] = $order_no; $params['is_delete'] = 0; $order_detection = OrderDetection::getOne($params); if (empty($order_detection)) { diff --git a/app/Services/SafeService.php b/app/Services/SafeService.php index a2bf80c..bb7c976 100644 --- a/app/Services/SafeService.php +++ b/app/Services/SafeService.php @@ -52,6 +52,10 @@ class SafeService extends BaseService // 名片 $dir = $dir . 'card/'; break; + case 4: + // 检测管 + $dir = $dir . 'detection/'; + break; default: // code... diff --git a/config/routes.php b/config/routes.php index f7f92e7..1c6ab4e 100644 --- a/config/routes.php +++ b/config/routes.php @@ -448,7 +448,7 @@ Router::addGroup('/patient', function () { Router::get('', [PatientOrderController::class, 'getPatientDetectionOrderList']); // 获取患者检测订单详情 - Router::get('/{order_detection_id:\d+}', [PatientOrderController::class, 'getPatientDetectionOrderInfo']); + Router::get('/{order_no:\d+}', [PatientOrderController::class, 'getPatientDetectionOrderInfo']); // 删除检测订单 Router::delete('/{order_detection_id:\d+}', [PatientOrderController::class, 'deletePatientDetectionOrder']); From 397db7dfa1ece7e981449221b35a20517f12c96e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 7 Aug 2023 14:35:12 +0800 Subject: [PATCH 044/176] 1 --- config/routes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.php b/config/routes.php index 1c6ab4e..0ebea34 100644 --- a/config/routes.php +++ b/config/routes.php @@ -448,7 +448,7 @@ Router::addGroup('/patient', function () { Router::get('', [PatientOrderController::class, 'getPatientDetectionOrderList']); // 获取患者检测订单详情 - Router::get('/{order_no:\d+}', [PatientOrderController::class, 'getPatientDetectionOrderInfo']); + Router::get('/{order_no}', [PatientOrderController::class, 'getPatientDetectionOrderInfo']); // 删除检测订单 Router::delete('/{order_detection_id:\d+}', [PatientOrderController::class, 'deletePatientDetectionOrder']); From 00937e915412c2bbc6285be4d99fd5225e396e50 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 7 Aug 2023 17:32:04 +0800 Subject: [PATCH 045/176] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE-=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/BasicDataController.php | 16 ++++++++ app/Model/Product.php | 33 +++++++++++++++++ app/Request/BasicDataRequest.php | 3 ++ app/Services/BasicDataService.php | 51 ++++++++++++++++++++++++++ config/routes.php | 5 ++- 5 files changed, 107 insertions(+), 1 deletion(-) diff --git a/app/Controller/BasicDataController.php b/app/Controller/BasicDataController.php index 52bf0ea..c30d142 100644 --- a/app/Controller/BasicDataController.php +++ b/app/Controller/BasicDataController.php @@ -129,6 +129,22 @@ class BasicDataController extends AbstractController return $this->response->json($data); } + /** + * 获取商品数据-分页 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function getProductPage(): ResponseInterface + { + $request = $this->container->get(BasicDataRequest::class); + $request->scene('getProductPage')->validateResolved(); + + $BasicDataService = new BasicDataService(); + $data = $BasicDataService->getProductPage(); + return $this->response->json($data); + } + /** * 搜索平台疾病分类 * @return ResponseInterface diff --git a/app/Model/Product.php b/app/Model/Product.php index 2f4b1b7..7059df5 100644 --- a/app/Model/Product.php +++ b/app/Model/Product.php @@ -159,6 +159,39 @@ class Product extends Model return $data; } + /** + * 获取列表-分页 + * @param array $params 条件 + * @param string $keyword 搜索条件 + * @param array $fields 字段 + * @param int|null $page 页码 + * @param int|null $per_page 每页个数 + * @return array + */ + public static function getWithAmountPage(array $params,string $keyword, array $fields = ["*"], int $page = null, ?int $per_page = 10): array + { + $raw = self::with([ + 'ProductPlatformAmount:amount_id,product_platform_id,stock' + ]) + ->when($keyword, function ($query, $keyword) { + $query->where(function ($query) use ($keyword) { + $query->orwhere("product_name", 'like', '%' . $keyword . '%'); + $query->orwhere("common_name", 'like', '%' . $keyword . '%'); + $query->orwhere("mnemonic_code", 'like', '%' . $keyword . '%'); + }); + }) + ->where($params)->paginate($per_page, $fields, "page", $page); + + $data = array(); + $data['current_page'] = $raw->currentPage();// 当前页码 + $data['total'] = $raw->total();//数据总数 + $data['data'] = $raw->items();//数据 + $data['per_page'] = $raw->perPage();//每页个数 + $data['last_page'] = $raw->lastPage();//最后一页 + + return $data; + } + /** * 新增 * @param array $data diff --git a/app/Request/BasicDataRequest.php b/app/Request/BasicDataRequest.php index 513a55c..9fc11d8 100644 --- a/app/Request/BasicDataRequest.php +++ b/app/Request/BasicDataRequest.php @@ -31,6 +31,9 @@ class BasicDataRequest extends FormRequest 'getDetectionDiseaseList' => [ // 获取检测疾病分类列表 'detection_project_id', ], + 'getProductPage' => [ // 获取商品数据-分页 + 'keyword', + ], ]; /** diff --git a/app/Services/BasicDataService.php b/app/Services/BasicDataService.php index 74bd041..06c4ce0 100644 --- a/app/Services/BasicDataService.php +++ b/app/Services/BasicDataService.php @@ -415,4 +415,55 @@ class BasicDataService extends BaseService return success($disease_class_detections->toArray()); } + + /** + * 获取商品数据-分页 + * @return array + */ + public function getProductPage(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $keyword = $this->request->input('keyword',""); + + $page = $this->request->input('page', 1); + $per_page = $this->request->input('per_page', 10); + + $fields = [ + 'product_id', + 'product_platform_id', + 'product_name', + 'product_price', + 'product_cover_img', + 'product_spec', + 'manufacturer', + 'single_unit', + 'single_use', + 'packaging_unit', + 'frequency_use', + 'available_days', + ]; + + $params = array(); + + + $product = Product::getWithAmountPage($params, $keyword,$fields, $page, $per_page); + if (empty($product['data'])) { + return success($product); + } + + foreach ($product['data'] as &$item) { + $item['product_cover_img'] = addAliyunOssWebsite($item['product_cover_img']); + + $item['product_name'] = $item['product_name'] . ' ' . $item['product_spec']; + $item['stock'] = 0; + if (!empty($item['ProductPlatformAmount'])){ + $item['stock'] = $item['ProductPlatformAmount']['stock']; + } + + unset($item['ProductPlatformAmount']); + } + + return success($product); + } } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index 0ebea34..5988a4c 100644 --- a/config/routes.php +++ b/config/routes.php @@ -585,10 +585,13 @@ Router::addGroup('/basic', function () { Router::get('/search', [BasicDataController::class, 'getDiseaseIcdSearch']); }); - // 搜索商品 + // 商品 Router::addGroup('/product', function () { // 搜索商品 Router::get('/search', [BasicDataController::class, 'getProductSearch']); + + // 获取商品数据-分页 + Router::get('', [BasicDataController::class, 'getProductPage']); }); // 获取民族数据 From 3bb279ab57dd54fe164cadaf1fe20eca209366ba Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 9 Aug 2023 11:27:56 +0800 Subject: [PATCH 046/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E3=80=81=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=AE=A2=E5=8D=95=E3=80=81=E6=96=B0=E5=A2=9E?= =?UTF-8?q?im=E6=8E=A8=E9=80=81=E3=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...AutoCompleteInquiryDelayDirectConsumer.php | 6 +- app/Controller/CallBackController.php | 220 ++++++++++++++++++ app/Model/OrderDetection.php | 3 +- app/Request/DetectionRequest.php | 2 +- app/Services/DetectionService.php | 49 ++-- app/Services/ImService.php | 67 ++++++ app/Services/MessagePush.php | 69 +++++- app/Services/PatientOrderService.php | 8 +- config/routes.php | 6 + 9 files changed, 402 insertions(+), 28 deletions(-) diff --git a/app/Amqp/Consumer/AutoCompleteInquiryDelayDirectConsumer.php b/app/Amqp/Consumer/AutoCompleteInquiryDelayDirectConsumer.php index bb9fd14..770f130 100644 --- a/app/Amqp/Consumer/AutoCompleteInquiryDelayDirectConsumer.php +++ b/app/Amqp/Consumer/AutoCompleteInquiryDelayDirectConsumer.php @@ -147,6 +147,9 @@ class AutoCompleteInquiryDelayDirectConsumer extends ConsumerMessage // 是否需要推送消息 $is_push_prescription_verify_fail = true; + + // 驳回处方id + $order_prescription_id = $item['order_prescription_id']; } } @@ -177,8 +180,9 @@ class AutoCompleteInquiryDelayDirectConsumer extends ConsumerMessage try { if (isset($is_push_prescription_verify_fail)){ // 站内、订阅失败发送短信-医生开具的处方审核未通过 + $order_prescription_id = $order_prescription_id ?? ""; $MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']); - $MessagePush->prescriptionVerifyFail($order_prescription['order_prescription_id']); + $MessagePush->prescriptionVerifyFail($order_prescription_id); } // 发送IM消息-问诊已完成 diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 44c4a44..6b3f1a2 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -3,15 +3,19 @@ namespace App\Controller; use App\Amqp\Producer\AssignDoctorDelayDirectProducer; +use App\Amqp\Producer\AutoCompleteInquiryDelayDirectProducer; use App\Constants\DoctorTitleCode; use App\Constants\HttpEnumCode; use App\Exception\BusinessException; use App\Model\BasicLogisticsCompany; +use App\Model\DetectionProject; use App\Model\Hospital; use App\Model\MessageIm; use App\Model\OrderDetection; +use App\Model\OrderDetectionCase; use App\Model\OrderDetectionRefund; use App\Model\OrderInquiry; +use App\Model\OrderInquiryCase; use App\Model\OrderInquiryCoupon; use App\Model\OrderInquiryRefund; use App\Model\OrderPrescription; @@ -19,6 +23,7 @@ use App\Model\OrderProduct; use App\Model\OrderProductItem; use App\Model\OrderProductLogistic; use App\Model\OrderProductRefund; +use App\Model\PatientFamily; use App\Model\Product; use App\Model\ProductPlatformAmount; use App\Model\UserCoupon; @@ -40,6 +45,7 @@ use Hyperf\DbConnection\Db; use Hyperf\HttpMessage\Stream\SwooleFileStream; use Hyperf\HttpMessage\Stream\SwooleStream; use Hyperf\Redis\Redis; +use Hyperf\Snowflake\IdGeneratorInterface; use Hyperf\Utils\ApplicationContext; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; @@ -1303,4 +1309,218 @@ class CallBackController extends AbstractController return $server->serve(); } + /** + * 检测所结果回调 + * @return ResponseInterface + */ + public function DetectionResultCallBack(): ResponseInterface + { + $request_params = $this->request->all(); + try { + Log::getInstance("detectionResult")->info(json_encode($request_params, JSON_UNESCAPED_UNICODE)); + + // 获取检测订单数据 + $params = array(); + $params['detection_no'] = "D547019667026825217"; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)){ + return $this->detectionResultFailReturn("非法订单"); + } + + // 检测订单状态 + if ($order_detection['detection_status'] != 3){ + return $this->detectionResultFailReturn("订单状态错误,无法处理"); + } + + // 获取医生数据 + $params = array(); + $params['doctor_id'] = $order_detection['doctor_id']; + $user_doctor = UserDoctor::getOne($params); + if (empty($user_doctor)){ + return $this->detectionResultFailReturn("订单数据错误"); + } + + // 获取检测病例数据 + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + $order_detection_case = OrderDetectionCase::getOne($params); + if (empty($order_detection_case)){ + return $this->detectionResultFailReturn("订单数据错误"); + } + + // 获取检测项目数据 + $params = array(); + $params['detection_project_id'] = $order_detection['detection_project_id']; + $detection_project = DetectionProject::getOne($params); + if (empty($detection_project)){ + return $this->detectionResultFailReturn("订单数据错误"); + } + + // 检测家庭成员是否存在 + $params = array(); + $params['family_id'] = $order_detection['family_id']; + $params['patient_id'] = $order_detection['user_id']; + $patient_family = PatientFamily::getOne($params); + if (empty($patient_family)) { + return $this->detectionResultFailReturn("患者信息错误"); + } + + Db::beginTransaction(); + + try { + // 修改检测状态 + $data = array(); + $data['detection_status'] = 4; + $data['detection_time'] = date('Y-m-d H:i:s',time()); + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params,$data); + + $generator = $this->container->get(IdGeneratorInterface::class); + + // 创建问诊订单 + $data = array(); + $data['user_id'] = $order_detection['user_id']; + $data['patient_id'] = $order_detection['patient_id']; + $data['doctor_id'] = $order_detection['doctor_id']; + $data['family_id'] = $order_detection['family_id']; + $data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) + $data['inquiry_mode'] = 1; // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) + $data['inquiry_status'] = 4; // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) + $data['inquiry_pay_channel'] = 3; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) + $data['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) + $data['inquiry_no'] = $generator->generate();// 订单编号 + $data['escrow_trade_no'] = "GD" . $generator->generate(); // 第三方支付流水号 + $data['amount_total'] = 0;// 订单金额 + $data['coupon_amount_total'] = 0;// 优惠卷总金额 + $data['payment_amount_total'] = 0;// 实际付款金额 + $data['pay_time'] = date('Y-m-d H:i:s', time());// 支付时间 + $data['reception_time'] = date('Y-m-d H:i:s', time());// 接诊时间 + $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 + $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) + $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) + $data['patient_age'] = $patient_family['age'];// 患者年龄-就诊人 + $order_inquiry = OrderInquiry::addOrderInquiry($data); + if (empty($order_inquiry)) { + Db::rollBack(); + return $this->detectionResultFailReturn("问诊订单创建失败"); + } + + // 增加患者问诊病例 + $data = array(); + $data['user_id'] = $order_detection['user_id']; + $data['patient_id'] = $order_detection['patient_id']; + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id + $data['family_id'] = $patient_family['family_id']; // 家庭成员id + $data['relation'] = $patient_family['relation']; // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) + $data['name'] = $patient_family['card_name']; // 患者名称 + $data['sex'] = $patient_family['sex'] ?? 0; // 患者性别(0:未知 1:男 2:女) + $data['age'] = $patient_family['age'] ?? null; // 患者年龄 + $data['height'] = $patient_family['height'] ?: null; // 身高(cm) + $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) + $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); + if (empty($order_inquiry_case)) { + Db::rollBack(); + return $this->detectionResultFailReturn("问诊订单病例创建失败"); + } + + // 添加自动完成队列 + $time = 1000 * 60 * 60 * 24 * 3; + + $data = array(); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + $message = new AutoCompleteInquiryDelayDirectProducer($data); + $message->setDelayMs($time); + $producer = $this->container->get(Producer::class); + $res = $producer->produce($message); + if (!$res) { + Db::rollBack(); + return $this->detectionResultFailReturn("添加自动完成队列失败"); + } + + // 发送IM消息-检测报告结果 + $imService = new ImService(); + $imService->detectionTestReport( + $order_detection, + $user_doctor['user_id'], + $order_detection['user_id'], + $order_detection_case['detection_disease_class_names'], + $detection_project['detection_project_name'] + ); + + Db::commit(); + } catch (\Exception $e) { + Db::rollBack(); + return $this->detectionResultFailReturn($e->getMessage()); + } + + try { + // 发送IM消息-检测报告结果-文字 + $imService->detectionTestReportStr( + $user_doctor['user_name'], + $detection_project['detection_project_name'], + $user_doctor['user_id'], + $order_detection['user_id'], + $order_detection_case['detection_disease_class_names'] + ); + + // 患者-通知患者报告生成结果 + + // 医生-发送检测报告短信 + }catch (\Exception $e){ + Log::getInstance("detectionResult")->error($e->getMessage()); + } + + return $this->detectionResultSuccessReturn(); + } catch (\Exception $e) { + return $this->detectionResultFailReturn("异常:" . $e->getMessage()); + } + } + + /** + * 检测所结果回调失败 + * @param string $message + * @return ResponseInterface + */ + protected function detectionResultFailReturn(string $message): ResponseInterface + { + return $this->response + ->withStatus(200) + ->withBody( + new SwooleStream( + strval( + json_encode([ + 'result' => false, + 'returnCode' => "500", + 'message' => $message, + ], JSON_UNESCAPED_UNICODE) + ) + ) + ); + } + + /** + * 检测所结果回调成功 + * @param string $message + * @return ResponseInterface + */ + protected function detectionResultSuccessReturn(string $message = ""): ResponseInterface + { + return $this->response + ->withStatus(200) + ->withBody( + new SwooleStream( + strval( + json_encode([ + 'result' => true, + 'returnCode' => "200", + 'message' => $message, + ], JSON_UNESCAPED_UNICODE) + ) + ) + ); + } + } \ No newline at end of file diff --git a/app/Model/OrderDetection.php b/app/Model/OrderDetection.php index a6be676..5f88ad2 100644 --- a/app/Model/OrderDetection.php +++ b/app/Model/OrderDetection.php @@ -38,6 +38,7 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property int $patient_age 患者年龄-就诊人 * @property string $detection_bar_code 检测条码 * @property string $detection_pic 检测管图片(逗号分隔) + * @property string $detection_time 检测时间 * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 */ @@ -53,7 +54,7 @@ class OrderDetection extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['order_detection_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'detection_pic', 'created_at', 'updated_at']; + protected array $fillable = ['order_detection_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'detection_pic', 'detection_time', 'created_at', 'updated_at']; protected string $primaryKey = "order_detection_id"; diff --git a/app/Request/DetectionRequest.php b/app/Request/DetectionRequest.php index 231e685..1bb503a 100644 --- a/app/Request/DetectionRequest.php +++ b/app/Request/DetectionRequest.php @@ -52,7 +52,6 @@ class DetectionRequest extends FormRequest 'doctor_id' => 'required', 'client_type' => 'required|integer|min:1|max:2', 'detection_bar_code' => 'required', - 'detection_pic' => 'required', ]; } @@ -72,6 +71,7 @@ class DetectionRequest extends FormRequest 'client_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'client_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'client_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'detection_bar_code.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), ]; } } diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 622a517..5977c73 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -15,6 +15,7 @@ use App\Model\OrderDetection; use App\Model\OrderDetectionCase; use App\Model\OrderDetectionRefund; use App\Model\PatientFamily; +use App\Model\ReportDetection; use App\Model\UserDoctor; use App\Model\UserLocation; use App\Utils\Log; @@ -493,7 +494,10 @@ class DetectionService extends BaseService return success($order_detection['detection_no']); } - // 绑定检测管 + /** + * 绑定检测管 + * @return array + */ public function bindDetectionTube(): array { $user_info = $this->request->getAttribute("userInfo") ?? []; @@ -502,10 +506,6 @@ class DetectionService extends BaseService $request_params = $this->request->all(); - if (count($request_params['detection_pic']) < 1){ - return fail(HttpEnumCode::HTTP_ERROR,"请上传检测管图片"); - } - $params = array(); $params['patient_id'] = $user_info['client_user_id']; $params['order_detection_id'] = $order_detection_id; @@ -527,24 +527,39 @@ class DetectionService extends BaseService return fail(HttpEnumCode::HTTP_ERROR,"请勿重复绑定"); } - if (!empty($order_detection['detection_pic'])){ + if (!empty($order_detection['detection_pic']) && !empty($request_params['detection_pic'])){ return fail(HttpEnumCode::HTTP_ERROR,"请勿重复绑定"); } // 处理检测管图片 - $detection_pic = implode(',', $request_params['detection_pic']); - $detection_pic = PcreMatch::pregRemoveOssWebsite($detection_pic); + if (!empty($request_params['detection_pic'])){ + $detection_pic = implode(',', $request_params['detection_pic']); + $detection_pic = PcreMatch::pregRemoveOssWebsite($detection_pic); + } - $data = array(); - $data['detection_pic'] = $detection_pic; - $data['detection_bar_code'] = $request_params['detection_bar_code']; - $data['detection_status'] = 3; - $params = array(); - $params['order_detection_id'] = $order_detection_id; - $res = OrderDetection::editOrderDetection($params,$data); - if (!$res){ - return fail(HttpEnumCode::HTTP_ERROR,"绑定失败"); + Db::beginTransaction(); + try { + // 修改检测订单 + $data = array(); + $data['detection_pic'] = $detection_pic ?? ""; + $data['detection_bar_code'] = $request_params['detection_bar_code']; + $data['detection_status'] = 3; + + $params = array(); + $params['order_detection_id'] = $order_detection_id; + $res = OrderDetection::editOrderDetection($params,$data); + if (!$res){ + Db::rollBack(); + return fail(HttpEnumCode::HTTP_ERROR,"绑定失败"); + } + + // 上报数据 + + Db::commit(); + }catch (\Exception $e){ + Db::rollBack(); + return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage()); } return success(); diff --git a/app/Services/ImService.php b/app/Services/ImService.php index a60ec44..a2eeb1d 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -662,4 +662,71 @@ class ImService extends BaseService throw new BusinessException($e->getMessage()); } } + + /** + * 糖组检测报告 + * @param array|object $order_detection 检测订单数据 + * @param string $doctor_user_id 医生user_id + * @param string $patient_user_id 患者user_id + * @param string $disease_class_names 疾病数据 + * @return void + */ + public function detectionTestReport(array|object $order_detection,string $doctor_user_id, string $patient_user_id,string $disease_class_names,string $detection_project_name): void + { + try { + // 发送消息 + $cloud_custom_data = array(); + $cloud_custom_data['is_system'] = 1; + $cloud_custom_data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) + $cloud_custom_data['message_rounds'] = 0; + $cloud_custom_data['order_no'] = $order_detection['order_no']; + $cloud_custom_data['patient_family_data']['patient_name'] = $order_detection['patient_name']; + $cloud_custom_data['patient_family_data']['patient_sex'] = $order_detection['patient_sex']; + $cloud_custom_data['patient_family_data']['patient_age'] = $order_detection['patient_age']; + + // 消息内容 + $message_content_data = array(); + $message_content_data['message_type'] = 10; + $message_content_data['title'] = $detection_project_name; + $message_content_data['desc'] = ""; + $message_content_data['data']['order_no'] = (string)$order_detection['order_no']; + $message_content_data['data']['disease_class_names'] = $disease_class_names; + $message_content_data['data']['message_path'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no']; // 跳转地址(小程序内页) + $message_content = [ + 'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE), + ]; + + $this->sendMessage($patient_user_id,$doctor_user_id, $message_content, "TIMCustomElem", $cloud_custom_data); + + } catch (\Exception $e) { + throw new BusinessException($e->getMessage()); + } + } + + /** + * 糖组检测报告-文字 + * @param array|object $doctor_name 医生名称 + * @param string $detection_project_name 检测项目名称 + * @param string $doctor_user_id 医生user_id + * @param string $patient_user_id 患者user_id + * @param string $disease_class_names 疾病数据 + * @return void + */ + public function detectionTestReportStr(string $doctor_name,string $detection_project_name,string $doctor_user_id, string $patient_user_id,string $disease_class_names): void + { + try { + // 消息内容 + $message_content_data = array(); + $message_content_data['Text'] = $doctor_name . "医生您好,我在您那里开具的【" . $detection_project_name . "】服务,报告单已出,请您查看报告并详细的做一下解读,谢谢医生。"; + $message_content = [ + 'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE), + ]; + + $this->sendMessage($patient_user_id,$doctor_user_id, $message_content, "TIMTextElem", []); + + } catch (\Exception $e) { + throw new BusinessException($e->getMessage()); + } + } + } \ No newline at end of file diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 433dfe0..d9004e9 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -1394,7 +1394,7 @@ class MessagePush extends BaseService * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function prescriptionVerifyFail(string $order_prescription_id): void + public function prescriptionVerifyFail(string $order_prescription_id = ""): void { try { // 获取问诊订单处方数据 @@ -2232,14 +2232,14 @@ class MessagePush extends BaseService } /** - * 患者-订单取消成功通知 + * 患者-检测订单取消成功通知 * 订阅 * @param string $order_detection_id * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function patientCancelOrderSuccess(string $order_detection_id): void + public function patientCancelDetectionOrderSuccess(string $order_detection_id): void { try { // 获取检测订单 @@ -2263,7 +2263,7 @@ class MessagePush extends BaseService $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "5aJSrO8SU5rxqdB99zzl4rMVgcOTjt5mQh56cpZI1Hg";//咨询提醒 - $sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['order_detection_id']; + $sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no']; $sub_data['params']['data'] = [ "thing1" => $order_detection['patient_name'],// 就诊人 "thing7" => (string)$detection_project['detection_project_name'],// 服务项目 @@ -2286,4 +2286,65 @@ class MessagePush extends BaseService Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } + + // 患者-新报告生成通知 + // 订阅发送失败发送短信 + public function patientDetectionResultNotice(string $order_detection_id){ + try { + // 获取检测订单 + $params = array(); + $params['order_detection_id'] = $order_detection_id; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + Log::getInstance("MessagePush-patientDetectionResultNotice")->error("错误:加入推送队列失败,无检测订单数据"); + return; + } + + // 获取检测项目 + $params = array(); + $params['detection_project_id'] = $order_detection['detection_project_id']; + $detection_project = DetectionProject::getOne($params); + if (empty($detection_project)){ + Log::getInstance("MessagePush-patientDetectionResultNotice")->error("错误:加入推送队列失败,检测项目错误"); + return; + } + + // 订阅 + $sub_data = array(); + $sub_data['push_user_id'] = $this->user['user_id']; + $sub_data['wx_template_id'] = "dNj3azLupP_w3j649v6lqz7je_ScqwgwFsnug6pKvyI"; // 处方审核结果通知 + $sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no']; + $sub_data['params']['data'] = [ + "thing1" => $order_detection['patient_name'],// 报告名称 + "time3" => (string)$detection_project['detection_project_name'],// 生成时间 + "thing9" => date('Y年m月d日 H:i'),// 就诊人 + "thing4" => $order_detection['payment_amount_total'],// 单位名称-检测所名称 + "thing8" => "订单取消成功,支付金额将立即原路退回。",// 测评结果 + ]; + + // 短信 + $sms_data = array(); + $sms_data['template_code'] = "SMS_271905264"; + $sms_data['scene_desc'] = "您为{$this->order_inquiry['patient_name']}患者开具的电子处方药师审核不通过,请尽快前往微信小程序“处方管理”中查看原因,并重开处方。模版code:SMS_271905264"; + $sms_data['phone'] = $this->user['mobile']; + $sms_data['user_id'] = $this->user['user_id']; + + $template_param = array(); + $template_param['name'] = $this->order_inquiry['patient_name']; + $sms_data['template_param'] = $template_param; + + $data = array(); + $data['sub_data'] = $sub_data; + $data['sms_data'] = $sms_data; + + $message = new SendSubMessageProducer($data); + $producer = ApplicationContext::getContainer()->get(Producer::class); + $result = $producer->produce($message); + if (!$result) { + Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); + } + } catch (\Exception $e) { + Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . $e->getMessage()); + } + } } \ No newline at end of file diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index edb239a..a8de752 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -196,11 +196,11 @@ class PatientOrderService extends BaseService $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; $order_inquiry_case = OrderInquiryCase::getOne($params, $fields); if (empty($order_inquiry_case)) { - return fail(); + $order_inquiry['case'] = []; + }else{ + $order_inquiry['case'] = $order_inquiry_case->toArray(); } - $order_inquiry['case'] = $order_inquiry_case->toArray(); - // 获取医生数据 $order_inquiry['user_doctor'] = []; if (!empty($order_inquiry['doctor_id'])) { @@ -1861,7 +1861,7 @@ class PatientOrderService extends BaseService try { // 推送患者-订单取消成功通知 $MessagePush = new MessagePush($order_detection['user_id']); - $MessagePush->patientCancelOrderSuccess($order_detection['order_detection_id']); + $MessagePush->patientCancelDetectionOrderSuccess($order_detection['order_detection_id']); } catch (\Exception $e) { return success(); } diff --git a/config/routes.php b/config/routes.php index 5988a4c..4b562bc 100644 --- a/config/routes.php +++ b/config/routes.php @@ -665,6 +665,12 @@ Router::addGroup('/callback', function () { // 快递订阅查询 Router::post('', [CallBackController::class, 'LogisticsCallBack']); }); + + // 检测 + Router::addGroup('/detection', function () { + // 检测所结果回调 + Router::post('', [CallBackController::class, 'DetectionResultCallBack']); + }); }); // 用户 From 92d67d44929d5bd4bee34ac4f445931caebbd637 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 9 Aug 2023 11:29:32 +0800 Subject: [PATCH 047/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9oss=E7=AD=BE=E5=90=8D?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Request/SafeRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Request/SafeRequest.php b/app/Request/SafeRequest.php index 0759d3d..5d68fb4 100644 --- a/app/Request/SafeRequest.php +++ b/app/Request/SafeRequest.php @@ -31,7 +31,7 @@ class SafeRequest extends FormRequest { return [ 'user_type' => 'required|integer|min:1|max:3', - 'scene' => 'required|integer|min:1|max:3', + 'scene' => 'required|integer|min:1|max:4', ]; } From af3295eaa5f48d3078a7c8acd4252b4f16f808ce Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 9 Aug 2023 14:02:00 +0800 Subject: [PATCH 048/176] 1 --- app/Controller/CallBackController.php | 33 ++++++------ app/Model/BasicDetectionOrgan.php | 78 +++++++++++++++++++++++++++ app/Model/OrderDetection.php | 3 +- app/Services/DetectionService.php | 2 + app/Services/MessagePush.php | 58 +++++++++++++------- app/Services/PatientOrderService.php | 1 + 6 files changed, 139 insertions(+), 36 deletions(-) create mode 100644 app/Model/BasicDetectionOrgan.php diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 6b3f1a2..7ca95b6 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1321,7 +1321,7 @@ class CallBackController extends AbstractController // 获取检测订单数据 $params = array(); - $params['detection_no'] = "D547019667026825217"; + $params['detection_no'] = "D547725550262296576"; $order_detection = OrderDetection::getOne($params); if (empty($order_detection)){ return $this->detectionResultFailReturn("非法订单"); @@ -1359,7 +1359,7 @@ class CallBackController extends AbstractController // 检测家庭成员是否存在 $params = array(); $params['family_id'] = $order_detection['family_id']; - $params['patient_id'] = $order_detection['user_id']; + $params['patient_id'] = $order_detection['patient_id']; $patient_family = PatientFamily::getOne($params); if (empty($patient_family)) { return $this->detectionResultFailReturn("患者信息错误"); @@ -1368,15 +1368,6 @@ class CallBackController extends AbstractController Db::beginTransaction(); try { - // 修改检测状态 - $data = array(); - $data['detection_status'] = 4; - $data['detection_time'] = date('Y-m-d H:i:s',time()); - - $params = array(); - $params['order_detection_id'] = $order_detection['order_detection_id']; - OrderDetection::editOrderDetection($params,$data); - $generator = $this->container->get(IdGeneratorInterface::class); // 创建问诊订单 @@ -1425,6 +1416,16 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("问诊订单病例创建失败"); } + // 修改检测状态 + $data = array(); + $data['detection_status'] = 4; + $data['detection_time'] = date('Y-m-d H:i:s',time()); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params,$data); + // 添加自动完成队列 $time = 1000 * 60 * 60 * 24 * 3; @@ -1451,7 +1452,7 @@ class CallBackController extends AbstractController ); Db::commit(); - } catch (\Exception $e) { + } catch (\Throwable $e) { Db::rollBack(); return $this->detectionResultFailReturn($e->getMessage()); } @@ -1466,15 +1467,17 @@ class CallBackController extends AbstractController $order_detection_case['detection_disease_class_names'] ); - // 患者-通知患者报告生成结果 + // 患者-新报告生成通知 + $MessagePush = new MessagePush($order_detection['user_id']); + $MessagePush->patientDetectionResultNotice($order_detection['order_detection_id']); // 医生-发送检测报告短信 - }catch (\Exception $e){ + }catch (\Throwable $e){ Log::getInstance("detectionResult")->error($e->getMessage()); } return $this->detectionResultSuccessReturn(); - } catch (\Exception $e) { + } catch (\Throwable $e) { return $this->detectionResultFailReturn("异常:" . $e->getMessage()); } } diff --git a/app/Model/BasicDetectionOrgan.php b/app/Model/BasicDetectionOrgan.php new file mode 100644 index 0000000..c74de09 --- /dev/null +++ b/app/Model/BasicDetectionOrgan.php @@ -0,0 +1,78 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增-批量 + * @param array $data 新增数据 + * @return \Hyperf\Database\Model\Model|BasicDetectionOrgan + */ + public static function add(array $data): \Hyperf\Database\Model\Model|BasicDetectionOrgan + { + return self::create($data); + } + + /** + * 修改-批量 + * @param array $params + * @param array $data + * @return int + */ + public static function edit(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } + +} diff --git a/app/Model/OrderDetection.php b/app/Model/OrderDetection.php index 5f88ad2..491106f 100644 --- a/app/Model/OrderDetection.php +++ b/app/Model/OrderDetection.php @@ -18,6 +18,7 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property int $detection_project_id 检测项目id * @property int $purpose_id 检测项目用途id * @property int $detection_organ_id 检测机构id + * @property int $order_inquiry_id 问诊-订单id(检测完成后,会生成此字段) * @property int $detection_status 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) * @property int $is_delete 删除状态(0:否 1:是) * @property int $detection_refund_status 检测订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) @@ -54,7 +55,7 @@ class OrderDetection extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['order_detection_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'detection_pic', 'detection_time', 'created_at', 'updated_at']; + protected array $fillable = ['order_detection_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'order_inquiry_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'detection_pic', 'detection_time', 'created_at', 'updated_at']; protected string $primaryKey = "order_detection_id"; diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 5977c73..218b140 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -537,6 +537,7 @@ class DetectionService extends BaseService $detection_pic = PcreMatch::pregRemoveOssWebsite($detection_pic); } + // 获取检测所 Db::beginTransaction(); try { @@ -545,6 +546,7 @@ class DetectionService extends BaseService $data['detection_pic'] = $detection_pic ?? ""; $data['detection_bar_code'] = $request_params['detection_bar_code']; $data['detection_status'] = 3; + $data['detection_organ_id'] = 1;// 检测机构id $params = array(); $params['order_detection_id'] = $order_detection_id; diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index d9004e9..00fe5f7 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -7,6 +7,7 @@ use App\Amqp\Producer\SendStationMessageProducer; use App\Amqp\Producer\SendSubMessageProducer; use App\Constants\HttpEnumCode; use App\Exception\BusinessException; +use App\Model\BasicDetectionOrgan; use App\Model\DetectionProject; use App\Model\DoctorWithdrawal; use App\Model\OrderDetection; @@ -22,7 +23,8 @@ use App\Model\User; use App\Model\UserDoctor; use App\Utils\Log; use Hyperf\Amqp\Producer; -use Hyperf\Utils\ApplicationContext; +//use Hyperf\Utils\ApplicationContext; +use Hyperf\Context\ApplicationContext; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; @@ -418,7 +420,7 @@ class MessagePush extends BaseService // 问诊内容 $disease_desc = $order_inquiry_case['disease_desc']; - if (mb_strlen($disease_desc) > 15){ + if (mb_strlen($disease_desc) > 15) { $disease_desc = mb_substr($disease_desc, 0, 15, 'UTF-8') . '...'; } @@ -1421,7 +1423,7 @@ class MessagePush extends BaseService // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_271905264"; - $sms_data['scene_desc'] = "您为{$this->order_inquiry['patient_name']}患者开具的电子处方药师审核不通过,请尽快前往微信小程序“处方管理”中查看原因,并重开处方。模版code:SMS_271905264"; + $sms_data['scene_desc'] = "您为{$this->order_inquiry['patient_name']}患者开具的电子处方药师审核不通过,请尽快前往微信小程序“处方管理”中查看原因,并重开处方。"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; @@ -2255,7 +2257,7 @@ class MessagePush extends BaseService $params = array(); $params['detection_project_id'] = $order_detection['detection_project_id']; $detection_project = DetectionProject::getOne($params); - if (empty($detection_project)){ + if (empty($detection_project)) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败,检测项目错误"); return; } @@ -2287,16 +2289,23 @@ class MessagePush extends BaseService } } - // 患者-新报告生成通知 - // 订阅发送失败发送短信 - public function patientDetectionResultNotice(string $order_detection_id){ + /** + * 患者-新报告生成通知 + * 订阅发送失败发送短信 + * @param string $order_detection_id + * @return void + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function patientDetectionResultNotice(string $order_detection_id): void + { try { // 获取检测订单 $params = array(); $params['order_detection_id'] = $order_detection_id; $order_detection = OrderDetection::getOne($params); if (empty($order_detection)) { - Log::getInstance("MessagePush-patientDetectionResultNotice")->error("错误:加入推送队列失败,无检测订单数据"); + Log::getInstance("MessagePush-patientDetectionResultNotice")->error("无检测订单数据"); return; } @@ -2304,8 +2313,17 @@ class MessagePush extends BaseService $params = array(); $params['detection_project_id'] = $order_detection['detection_project_id']; $detection_project = DetectionProject::getOne($params); - if (empty($detection_project)){ - Log::getInstance("MessagePush-patientDetectionResultNotice")->error("错误:加入推送队列失败,检测项目错误"); + if (empty($detection_project)) { + Log::getInstance("MessagePush-patientDetectionResultNotice")->error("检测项目错误"); + return; + } + + // 获取检测机构名称 + $params = array(); + $params['detection_organ_id'] = $order_detection['detection_organ_id']; + $basic_detection_organ = BasicDetectionOrgan::getOne($params); + if (empty($basic_detection_organ)){ + Log::getInstance("MessagePush-patientDetectionResultNotice")->error("检测机构错误"); return; } @@ -2315,22 +2333,22 @@ class MessagePush extends BaseService $sub_data['wx_template_id'] = "dNj3azLupP_w3j649v6lqz7je_ScqwgwFsnug6pKvyI"; // 处方审核结果通知 $sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no']; $sub_data['params']['data'] = [ - "thing1" => $order_detection['patient_name'],// 报告名称 - "time3" => (string)$detection_project['detection_project_name'],// 生成时间 - "thing9" => date('Y年m月d日 H:i'),// 就诊人 - "thing4" => $order_detection['payment_amount_total'],// 单位名称-检测所名称 - "thing8" => "订单取消成功,支付金额将立即原路退回。",// 测评结果 + "thing1" => "【" . $detection_project['detection_project_name'] . "】报告已出",// 报告名称 + "time3" => date('Y年m月d日 H:i'),// 生成时间 + "thing9" => $order_detection['patient_name'],// 就诊人 + "thing4" => $basic_detection_organ['gts_ccis_name'],// 单位名称-检测所名称 + "thing8" => "请联系医生做报告解读,您有5个沟通回合。",// 测评结果 ]; // 短信 $sms_data = array(); - $sms_data['template_code'] = "SMS_271905264"; - $sms_data['scene_desc'] = "您为{$this->order_inquiry['patient_name']}患者开具的电子处方药师审核不通过,请尽快前往微信小程序“处方管理”中查看原因,并重开处方。模版code:SMS_271905264"; + $sms_data['template_code'] = "SMS_462035956"; + $sms_data['scene_desc'] = "您的${$detection_project['detection_project_name']}报告单已出,请联系医生做报告解读。平台已赠送您和医生5个沟通回合,请珍惜沟通机会,请前往肝胆相照互联网医院微信小程序“个人中心”-“检测订单”-“订单详情”查看报告。"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); - $template_param['name'] = $this->order_inquiry['patient_name']; + $template_param['name'] = $order_detection['patient_name']; $sms_data['template_param'] = $template_param; $data = array(); @@ -2341,10 +2359,10 @@ class MessagePush extends BaseService $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { - Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); + Log::getInstance("MessagePush-patientDetectionResultNotice")->error(json_encode($data, JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { - Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . $e->getMessage()); + Log::getInstance("MessagePush-patientDetectionResultNotice")->error($e->getMessage()); } } } \ No newline at end of file diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index a8de752..72beb82 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1739,6 +1739,7 @@ class PatientOrderService extends BaseService } $order_detection['detection_project_name'] = $detection_project['detection_project_name']; + return success($order_detection); } From 751a87ab33b145637df73e4561bd324233c70624 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 9 Aug 2023 14:57:22 +0800 Subject: [PATCH 049/176] 1 --- app/Controller/CallBackController.php | 6 ++--- app/Model/BasicDetectionOrgan.php | 8 +++---- app/Services/ImService.php | 32 ++++++++++++++++++--------- extend/TencentIm/Base.php | 1 + 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 7ca95b6..92c56f5 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1321,7 +1321,7 @@ class CallBackController extends AbstractController // 获取检测订单数据 $params = array(); - $params['detection_no'] = "D547725550262296576"; + $params['detection_no'] = "D547790897904513024"; $order_detection = OrderDetection::getOne($params); if (empty($order_detection)){ return $this->detectionResultFailReturn("非法订单"); @@ -1460,11 +1460,11 @@ class CallBackController extends AbstractController try { // 发送IM消息-检测报告结果-文字 $imService->detectionTestReportStr( + $order_detection, $user_doctor['user_name'], $detection_project['detection_project_name'], $user_doctor['user_id'], - $order_detection['user_id'], - $order_detection_case['detection_disease_class_names'] + $order_detection['user_id'] ); // 患者-新报告生成通知 diff --git a/app/Model/BasicDetectionOrgan.php b/app/Model/BasicDetectionOrgan.php index c74de09..c3d45ba 100644 --- a/app/Model/BasicDetectionOrgan.php +++ b/app/Model/BasicDetectionOrgan.php @@ -10,8 +10,8 @@ use Hyperf\Database\Model\Collection; use Hyperf\Snowflake\Concern\Snowflake; /** - * @property int $gts_ccis_id 主键id - * @property string $gts_ccis_name 检测机构名称 + * @property int $detection_organ_id 主键id + * @property string $detection_organ_name 检测机构名称 * @property int $status 状态(1:正常 2:删除) * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 @@ -28,9 +28,9 @@ class BasicDetectionOrgan extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['gts_ccis_id', 'gts_ccis_name', 'status', 'created_at', 'updated_at']; + protected array $fillable = ['detection_organ_id', 'detection_organ_name', 'status', 'created_at', 'updated_at']; - protected string $primaryKey = "gts_ccis_id"; + protected string $primaryKey = "detection_organ_id"; /** * 获取信息-单条 diff --git a/app/Services/ImService.php b/app/Services/ImService.php index a2eeb1d..0f0c2d1 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -669,6 +669,7 @@ class ImService extends BaseService * @param string $doctor_user_id 医生user_id * @param string $patient_user_id 患者user_id * @param string $disease_class_names 疾病数据 + * @param string $detection_project_name * @return void */ public function detectionTestReport(array|object $order_detection,string $doctor_user_id, string $patient_user_id,string $disease_class_names,string $detection_project_name): void @@ -676,10 +677,11 @@ class ImService extends BaseService try { // 发送消息 $cloud_custom_data = array(); + $cloud_custom_data['order_inquiry_id'] = $order_detection['order_inquiry_id']; $cloud_custom_data['is_system'] = 1; $cloud_custom_data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) $cloud_custom_data['message_rounds'] = 0; - $cloud_custom_data['order_no'] = $order_detection['order_no']; + $cloud_custom_data['order_no'] = $order_detection['detection_no']; $cloud_custom_data['patient_family_data']['patient_name'] = $order_detection['patient_name']; $cloud_custom_data['patient_family_data']['patient_sex'] = $order_detection['patient_sex']; $cloud_custom_data['patient_family_data']['patient_age'] = $order_detection['patient_age']; @@ -689,7 +691,7 @@ class ImService extends BaseService $message_content_data['message_type'] = 10; $message_content_data['title'] = $detection_project_name; $message_content_data['desc'] = ""; - $message_content_data['data']['order_no'] = (string)$order_detection['order_no']; + $message_content_data['data']['order_no'] = (string)$order_detection['detection_no']; $message_content_data['data']['disease_class_names'] = $disease_class_names; $message_content_data['data']['message_path'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no']; // 跳转地址(小程序内页) $message_content = [ @@ -698,33 +700,41 @@ class ImService extends BaseService $this->sendMessage($patient_user_id,$doctor_user_id, $message_content, "TIMCustomElem", $cloud_custom_data); - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException($e->getMessage()); } } /** * 糖组检测报告-文字 - * @param array|object $doctor_name 医生名称 + * @param array|object $order_detection + * @param string $doctor_name 医生名称 * @param string $detection_project_name 检测项目名称 * @param string $doctor_user_id 医生user_id * @param string $patient_user_id 患者user_id - * @param string $disease_class_names 疾病数据 * @return void */ - public function detectionTestReportStr(string $doctor_name,string $detection_project_name,string $doctor_user_id, string $patient_user_id,string $disease_class_names): void + public function detectionTestReportStr(array|object $order_detection,string $doctor_name,string $detection_project_name,string $doctor_user_id, string $patient_user_id): void { try { // 消息内容 - $message_content_data = array(); - $message_content_data['Text'] = $doctor_name . "医生您好,我在您那里开具的【" . $detection_project_name . "】服务,报告单已出,请您查看报告并详细的做一下解读,谢谢医生。"; + $cloud_custom_data = array(); + $cloud_custom_data['order_inquiry_id'] = $order_detection['order_inquiry_id']; + $cloud_custom_data['is_system'] = 1; + $cloud_custom_data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) + $cloud_custom_data['message_rounds'] = 1; + $cloud_custom_data['order_no'] = $order_detection['detection_no']; + $cloud_custom_data['patient_family_data']['patient_name'] = $order_detection['patient_name']; + $cloud_custom_data['patient_family_data']['patient_sex'] = $order_detection['patient_sex']; + $cloud_custom_data['patient_family_data']['patient_age'] = $order_detection['patient_age']; + $message_content = [ - 'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE), + 'Text' => $doctor_name . "医生您好,我在您那里开具的【" . $detection_project_name . "】服务,报告单已出,请您查看报告并详细的做一下解读,谢谢医生。", ]; - $this->sendMessage($patient_user_id,$doctor_user_id, $message_content, "TIMTextElem", []); + $this->sendMessage($patient_user_id,$doctor_user_id, $message_content, "TIMTextElem", $cloud_custom_data); - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException($e->getMessage()); } } diff --git a/extend/TencentIm/Base.php b/extend/TencentIm/Base.php index 8dc1741..f4a1a74 100644 --- a/extend/TencentIm/Base.php +++ b/extend/TencentIm/Base.php @@ -95,6 +95,7 @@ class Base $content = json_decode($response->getBody(),true); + dump($content); if (empty($content)){ throw new BusinessException("请求失败"); } From cc259e237e99eb73dbff4d81eb9a5171ef83f148 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 9 Aug 2023 14:57:36 +0800 Subject: [PATCH 050/176] 1 --- extend/TencentIm/Base.php | 1 - 1 file changed, 1 deletion(-) diff --git a/extend/TencentIm/Base.php b/extend/TencentIm/Base.php index f4a1a74..8dc1741 100644 --- a/extend/TencentIm/Base.php +++ b/extend/TencentIm/Base.php @@ -95,7 +95,6 @@ class Base $content = json_decode($response->getBody(),true); - dump($content); if (empty($content)){ throw new BusinessException("请求失败"); } From 2986856197fad44911c835d8ee97983071814ad0 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 9 Aug 2023 15:32:58 +0800 Subject: [PATCH 051/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=9E=E5=90=88?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/ImService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/ImService.php b/app/Services/ImService.php index 0f0c2d1..0544ad7 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -722,7 +722,7 @@ class ImService extends BaseService $cloud_custom_data['order_inquiry_id'] = $order_detection['order_inquiry_id']; $cloud_custom_data['is_system'] = 1; $cloud_custom_data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) - $cloud_custom_data['message_rounds'] = 1; + $cloud_custom_data['message_rounds'] = 0; $cloud_custom_data['order_no'] = $order_detection['detection_no']; $cloud_custom_data['patient_family_data']['patient_name'] = $order_detection['patient_name']; $cloud_custom_data['patient_family_data']['patient_sex'] = $order_detection['patient_sex']; From 0aa81cf7667dd6c6c8e4aa652cb2f8f55f71e07d Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 9 Aug 2023 16:23:38 +0800 Subject: [PATCH 052/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Amqp/Consumer/SendSmsMessageConsumer.php | 6 ++++++ app/Controller/CallBackController.php | 5 ++++- app/Services/ImService.php | 4 ++-- app/Services/MessagePush.php | 11 +++-------- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/Amqp/Consumer/SendSmsMessageConsumer.php b/app/Amqp/Consumer/SendSmsMessageConsumer.php index 66ed41a..c74b355 100644 --- a/app/Amqp/Consumer/SendSmsMessageConsumer.php +++ b/app/Amqp/Consumer/SendSmsMessageConsumer.php @@ -184,6 +184,12 @@ class SendSmsMessageConsumer extends ConsumerMessage case 'SMS_272165092': // 医生修改简介审核拒绝 break; + case 'SMS_462035956': + // 患者-新报告生成通知 + if (!isset($template_param['report'])) { + return false; + } + break; default: // 非法模版 return false; diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 92c56f5..32138a4 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1321,7 +1321,7 @@ class CallBackController extends AbstractController // 获取检测订单数据 $params = array(); - $params['detection_no'] = "D547790897904513024"; + $params['detection_no'] = "D547814062550614016"; $order_detection = OrderDetection::getOne($params); if (empty($order_detection)){ return $this->detectionResultFailReturn("非法订单"); @@ -1398,6 +1398,9 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("问诊订单创建失败"); } + // 回填问诊订单id + $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + // 增加患者问诊病例 $data = array(); $data['user_id'] = $order_detection['user_id']; diff --git a/app/Services/ImService.php b/app/Services/ImService.php index 0544ad7..3022ca9 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -677,7 +677,7 @@ class ImService extends BaseService try { // 发送消息 $cloud_custom_data = array(); - $cloud_custom_data['order_inquiry_id'] = $order_detection['order_inquiry_id']; + $cloud_custom_data['order_inquiry_id'] = (string)$order_detection['order_inquiry_id']; $cloud_custom_data['is_system'] = 1; $cloud_custom_data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) $cloud_custom_data['message_rounds'] = 0; @@ -719,7 +719,7 @@ class ImService extends BaseService try { // 消息内容 $cloud_custom_data = array(); - $cloud_custom_data['order_inquiry_id'] = $order_detection['order_inquiry_id']; + $cloud_custom_data['order_inquiry_id'] = (string)$order_detection['order_inquiry_id']; $cloud_custom_data['is_system'] = 1; $cloud_custom_data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) $cloud_custom_data['message_rounds'] = 0; diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 00fe5f7..26bd6bd 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -2133,15 +2133,10 @@ class MessagePush extends BaseService $sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen"; $sub_data['params']['data'] = [ "thing1" => "问诊咨询已取消",// 提醒内容 - "name2" => (string)$this->order_inquiry['patient_name'],// 患者姓名 - "thing4" => (string)$disease_desc,// 病情描述 - "thing6" => "您可以选择其他患者的问诊咨询进行接诊",// 提示说明 - "thing5" => "",// 咨询内容 - ]; $data = array(); @@ -2336,19 +2331,19 @@ class MessagePush extends BaseService "thing1" => "【" . $detection_project['detection_project_name'] . "】报告已出",// 报告名称 "time3" => date('Y年m月d日 H:i'),// 生成时间 "thing9" => $order_detection['patient_name'],// 就诊人 - "thing4" => $basic_detection_organ['gts_ccis_name'],// 单位名称-检测所名称 + "thing4" => $basic_detection_organ['detection_organ_name'],// 单位名称-检测所名称 "thing8" => "请联系医生做报告解读,您有5个沟通回合。",// 测评结果 ]; // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_462035956"; - $sms_data['scene_desc'] = "您的${$detection_project['detection_project_name']}报告单已出,请联系医生做报告解读。平台已赠送您和医生5个沟通回合,请珍惜沟通机会,请前往肝胆相照互联网医院微信小程序“个人中心”-“检测订单”-“订单详情”查看报告。"; + $sms_data['scene_desc'] = "您的{$detection_project['detection_project_name']}报告单已出,请联系医生做报告解读。平台已赠送您和医生5个沟通回合,请珍惜沟通机会,请前往肝胆相照互联网医院微信小程序“个人中心”-“检测订单”-“订单详情”查看报告。"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); - $template_param['name'] = $order_detection['patient_name']; + $template_param['report'] = $detection_project['detection_project_name']; $sms_data['template_param'] = $template_param; $data = array(); From 94116245f3a44758d9edc8a6144bc8eadefed7bb Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 9 Aug 2023 17:04:15 +0800 Subject: [PATCH 053/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E7=AB=AF=E5=88=86=E9=92=9F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/IndexService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/IndexService.php b/app/Services/IndexService.php index b7cc9f3..769f033 100644 --- a/app/Services/IndexService.php +++ b/app/Services/IndexService.php @@ -111,7 +111,7 @@ class IndexService extends BaseService $info['is_img_welfare_reception'] = $doctor['is_img_welfare_reception'];// 是否参加公益图文问诊(0:否 1:是) $info['is_img_quick_reception'] = $doctor['is_img_quick_reception'];// 是否参加快速图文接诊(0:否 1:是) $info['praise_rate'] = $doctor['praise_rate'];// 好评率(百分制。回复质量占4、服务态度占3、回复速度占3。每周计算一次) - $info['avg_response_time'] = (float)ceil($doctor['avg_response_time'] * 10) / 10;;// 平均响应时间(分钟制) + $info['avg_response_time'] = (float)ceil($doctor['avg_response_time']);;// 平均响应时间(分钟制) $info['number_of_fans'] = $doctor['number_of_fans'];// 被关注数量 $info['inquiry_price'] = $doctor_inquiry_config['inquiry_price'] ?? "";// 在线问诊价格 $info['not_accepted_inquiry_num'] = $not_accepted_inquiry_num ?? 0;// 获取未接诊患者个数 From d121c5ddb0f13d3bbac3f8a4490592624b87d876 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 9 Aug 2023 17:16:13 +0800 Subject: [PATCH 054/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=82=A3=E8=80=85=E9=97=AE=E8=AF=8A=E7=97=85=E4=BE=8B=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A3=80=E6=B5=8B=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 91ea031..d0f6d16 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -8,11 +8,13 @@ use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer; use App\Constants\DoctorTitleCode; use App\Constants\HttpEnumCode; use App\Exception\BusinessException; +use App\Model\DetectionProject; use App\Model\DiseaseClass; use App\Model\DoctorInquiryConfig; use App\Model\Hospital; use App\Model\InquiryCaseProduct; use App\Model\MessageIm; +use App\Model\OrderDetection; use App\Model\OrderEvaluation; use App\Model\OrderInquiry; use App\Model\OrderInquiryCase; @@ -475,6 +477,28 @@ class InquiryService extends BaseService $order_inquiry_case['diagnose_images'] = $diagnose_images; } + // 检测项目 + $order_inquiry_case['detection_project'] = []; + if ($order_inquiry['inquiry_type'] == 5){ + // 获取检测订单 + $params = array(); + $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + $order_detection = OrderDetection::getOne($params); + if (!empty($order_detection)){ + // 获取检测项目 + $params = array(); + $params['detection_project_id'] = $order_detection['detection_project_id']; + $detection_project = DetectionProject::getOne($params); + if (!empty($detection_project)){ + $order_inquiry_case['detection_project']['detection_project_name'] = $detection_project['detection_project_name']; // 检测项目名称 + $order_inquiry_case['detection_project']['detection_time'] = $order_detection['detection_time']; // 检测时间 + $order_inquiry_case['detection_project']['detection_link'] = ""; // 检测结果链接 + } + } + + + } + return success($order_inquiry_case->toArray()); } From aa8cbcf9e8e7ed368314a5a095c4567fa3174b83 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 9 Aug 2023 17:31:06 +0800 Subject: [PATCH 055/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=84=E6=96=B9,=E5=A2=9E=E5=8A=A0=E7=97=85=E6=83=85?= =?UTF-8?q?=E4=B8=BB=E8=AF=89=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/OrderInquiryCase.php | 11 +++++++++++ app/Services/UserDoctorService.php | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/app/Model/OrderInquiryCase.php b/app/Model/OrderInquiryCase.php index e65bbec..7c2356d 100644 --- a/app/Model/OrderInquiryCase.php +++ b/app/Model/OrderInquiryCase.php @@ -119,4 +119,15 @@ class OrderInquiryCase extends Model { return self::create($data); } + + /** + * 修改-批量 + * @param array $params + * @param array $data + * @return int + */ + public static function edit(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } } diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 545f67a..06bd5e4 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1271,6 +1271,7 @@ class UserDoctorService extends BaseService $prescription_icd = $this->request->input('prescription_icd'); $doctor_advice = $this->request->input('doctor_advice'); $prescription_product = $this->request->input('prescription_product'); + $disease_desc = $this->request->input('disease_desc'); // 获取医生信息 $params = array(); @@ -1321,10 +1322,32 @@ class UserDoctorService extends BaseService } } + // 获取患者问诊病例 + $params = array(); + $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + $order_inquiry_case = OrderInquiryCase::getOne($params); + if (empty($order_inquiry_case)){ + return fail(HttpEnumCode::HTTP_ERROR, "患者病例数据错误"); + } + + if (empty($order_inquiry_case['disease_desc']) && empty($disease_desc)){ + return fail(HttpEnumCode::HTTP_ERROR, "请填写病情主诉"); + } + Db::beginTransaction(); $generator = $this->container->get(IdGeneratorInterface::class); try { + // 修改问诊病例表 + if (empty($order_inquiry_case['disease_desc'])){ + $data = array(); + $data['disease_desc'] = $disease_desc; + + $params = array(); + $params['inquiry_case_id'] = $order_inquiry_case['inquiry_case_id']; + OrderInquiryCase::edit($params,$data); + } + // 新增处方表 $data = array(); $data['order_inquiry_id'] = $order_inquiry_id; From 84c24faf70cfe1f9d8b590feec884603be2d7f9b Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 10 Aug 2023 11:39:39 +0800 Subject: [PATCH 056/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=82=A3=E8=80=85?= =?UTF-8?q?=E9=97=AE=E8=AF=8A=E7=97=85=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssignDoctorDelayDirectConsumer.php | 21 ++++++++-- app/Controller/CallBackController.php | 16 +++++++- app/Services/ImService.php | 38 +++++++++++++++++++ app/Services/PatientOrderService.php | 15 +++++++- app/Services/UserDoctorService.php | 2 +- 5 files changed, 85 insertions(+), 7 deletions(-) diff --git a/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php b/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php index 09a095a..8fef432 100644 --- a/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php +++ b/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php @@ -9,6 +9,7 @@ use App\Amqp\Producer\CancelUnInquiryOrdersDelayDirectProducer; use App\Amqp\Producer\UserCouponExpiredDelayDirectProducer; use App\Constants\HttpEnumCode; use App\Model\OrderInquiry; +use App\Model\OrderInquiryCase; use App\Model\UserDoctor; use App\Services\ImService; use App\Services\InquiryService; @@ -55,6 +56,15 @@ class AssignDoctorDelayDirectConsumer extends ConsumerMessage return Result::DROP;// 销毁 } + // 获取病例数据 + $params = array(); + $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + $order_inquiry_case = OrderInquiryCase::getOne($params); + if (empty($order_inquiry_case)){ + Log::getInstance('queue-AssignDoctor')->error("错误:患者病例错误"); + return Result::DROP;// 销毁 + } + // 检测订单状态 $res = $this->checkInquiryStatus($order_inquiry); if (!$res){ @@ -245,7 +255,7 @@ class AssignDoctorDelayDirectConsumer extends ConsumerMessage Db::commit(); Log::getInstance("queue-AssignDoctor")->info("成功"); - } catch (\Exception $e) { + } catch (\Throwable $e) { Db::rollBack(); Log::getInstance("queue-AssignDoctor")->error("失败:" . $e->getMessage()); return Result::REQUEUE; // 重回队列 @@ -262,14 +272,19 @@ class AssignDoctorDelayDirectConsumer extends ConsumerMessage return Result::ACK; } - // 发送IM消息-等待医生接诊 + // 发送im消息 $imService = new ImService(); + + // 患者病例 + $imService->patientCase($order_inquiry,$user_doctor['user_id'],$order_inquiry_case['disease_desc']); + + // 等待医生接诊 $imService->waitDoctorInquiry($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']); // 医生-医生有新问诊 站内、订阅失败发送短信 $MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']); $MessagePush->doctorHaveNewInquiry(); - }catch (\Exception $e){ + }catch (\Throwable $e){ Log::getInstance("queue-AssignDoctor")->error("发送消息异常错误:" . $e->getMessage()); return Result::ACK; } diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 32138a4..c6ef184 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -90,6 +90,15 @@ class CallBackController extends AbstractController return $server->serve(); } + // 获取病例数据 + $params = array(); + $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + $order_inquiry_case = OrderInquiryCase::getOne($params); + if (empty($order_inquiry_case)){ + Log::getInstance()->info("问诊微信支付回调数据处理失败,患者病例错误"); + return $server->serve(); + } + // 验证订单状态 if ($order_inquiry['inquiry_status'] != 1) { // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) @@ -174,8 +183,11 @@ class CallBackController extends AbstractController return $server->serve(); } - // 发送IM消息-等待医生接诊 + // 发送im消息 $imService = new ImService(); + // 患者病例 + $imService->patientCase($order_inquiry,$user_doctor['user_id'],$order_inquiry_case['disease_desc']); + // 等待医生接诊 $imService->waitDoctorInquiry($order_inquiry, $user_doctor['user_id'], $order_inquiry['user_id']); // 发送站内、订阅失败发送短信消息-医生有新问诊 @@ -1321,7 +1333,7 @@ class CallBackController extends AbstractController // 获取检测订单数据 $params = array(); - $params['detection_no'] = "D547814062550614016"; + $params['detection_no'] = "D548076621233111040"; $order_detection = OrderDetection::getOne($params); if (empty($order_detection)){ return $this->detectionResultFailReturn("非法订单"); diff --git a/app/Services/ImService.php b/app/Services/ImService.php index 3022ca9..9d3439c 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -739,4 +739,42 @@ class ImService extends BaseService } } + /** + * 患者病例 + * @param array|object $order_inquiry + * @param string $doctor_user_id + * @param string $disease_desc + * @return void + */ + public function patientCase(array|object $order_inquiry, string $doctor_user_id,string $disease_desc): void + { + try { + // 发送消息 + $cloud_custom_data = array(); + $cloud_custom_data['order_inquiry_id'] = $order_inquiry['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'] = 11; + $message_content_data['title'] = "患者信息"; + $message_content_data['desc'] = ""; + $message_content_data['data']['order_no'] = $order_inquiry['inquiry_no']; + $message_content_data['data']['disease_desc'] = $disease_desc ?: ""; + $message_content_data['data']['message_path'] = "/Pages/yishi/case/index?order_inquiry_id=" . $order_inquiry['order_inquiry_id']; // 跳转地址(小程序内页) + $message_content = [ + 'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE), + ]; + + $this->sendMessage($doctor_user_id, $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data); + + } catch (\Throwable $e) { + throw new BusinessException($e->getMessage()); + } + } } \ No newline at end of file diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 72beb82..8849a8c 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -905,6 +905,15 @@ class PatientOrderService extends BaseService return fail(HttpEnumCode::HTTP_ERROR, "非法订单"); } + // 获取病例数据 + $params = array(); + $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + $order_inquiry_case = OrderInquiryCase::getOne($params); + if (empty($order_inquiry_case)){ + Db::rollBack(); + return fail(HttpEnumCode::HTTP_ERROR, "患者病例错误"); + } + // 验证订单状态 if ($order_inquiry['inquiry_status'] != 1) { Db::rollBack(); @@ -964,8 +973,12 @@ class PatientOrderService extends BaseService return fail(HttpEnumCode::HTTP_ERROR, "医生数据错误"); } - // 发送IM消息-等待医生接诊 + // 发送im消息 $imService = new ImService(); + // 患者病例 + $imService->patientCase($order_inquiry,$user_doctor['user_id'],$order_inquiry_case['disease_desc']); + + // 等待医生接诊 $imService->waitDoctorInquiry($order_inquiry, $user_doctor['user_id'], $order_inquiry['user_id']); // 发送站内、订阅失败发送短信消息-医生有新问诊 diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 06bd5e4..accdb30 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1271,7 +1271,7 @@ class UserDoctorService extends BaseService $prescription_icd = $this->request->input('prescription_icd'); $doctor_advice = $this->request->input('doctor_advice'); $prescription_product = $this->request->input('prescription_product'); - $disease_desc = $this->request->input('disease_desc'); + $disease_desc = $this->request->input('disease_desc'); // 病情主诉 // 获取医生信息 $params = array(); From 3085aaa3e69f0c764e50edf41f3e3889d18e2080 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 10 Aug 2023 14:16:20 +0800 Subject: [PATCH 057/176] 1 --- app/Services/InquiryService.php | 2 +- app/Services/UserDoctorService.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index d0f6d16..6ee3266 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -478,7 +478,7 @@ class InquiryService extends BaseService } // 检测项目 - $order_inquiry_case['detection_project'] = []; + $order_inquiry_case['detection_project'] = null; if ($order_inquiry['inquiry_type'] == 5){ // 获取检测订单 $params = array(); diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index accdb30..2fd0ec6 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -2001,7 +2001,6 @@ class UserDoctorService extends BaseService return ""; } - /** * 获取坐班时间包含某时间的平台深度合作医生 * @param string $inquiry_type From 7fe4b6dd8c8a6b4e30720efdc022c933720f44c3 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 10 Aug 2023 15:21:54 +0800 Subject: [PATCH 058/176] 1 --- app/Controller/CallBackController.php | 12 ++++++++++-- app/Services/ImService.php | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index c6ef184..a8a3048 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1333,7 +1333,7 @@ class CallBackController extends AbstractController // 获取检测订单数据 $params = array(); - $params['detection_no'] = "D548076621233111040"; + $params['detection_no'] = "D548154592174350336"; $order_detection = OrderDetection::getOne($params); if (empty($order_detection)){ return $this->detectionResultFailReturn("非法订单"); @@ -1456,8 +1456,16 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("添加自动完成队列失败"); } - // 发送IM消息-检测报告结果 + // 发送im消息 $imService = new ImService(); + // 患者病例 + $imService->patientCase( + $order_inquiry, + $user_doctor['user_id'], + $order_inquiry_case['disease_desc'] + ); + + // 发送IM消息-检测报告结果 $imService->detectionTestReport( $order_detection, $user_doctor['user_id'], diff --git a/app/Services/ImService.php b/app/Services/ImService.php index 9d3439c..3a59580 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -746,7 +746,7 @@ class ImService extends BaseService * @param string $disease_desc * @return void */ - public function patientCase(array|object $order_inquiry, string $doctor_user_id,string $disease_desc): void + public function patientCase(array|object $order_inquiry, string $doctor_user_id,string|null $disease_desc): void { try { // 发送消息 From 8cfa586c1ca6d00bd2f66df702dc1e4d7c7578a1 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 10 Aug 2023 15:23:00 +0800 Subject: [PATCH 059/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E7=8E=B0?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DoctorAccountService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/DoctorAccountService.php b/app/Services/DoctorAccountService.php index d6e5f89..57a9c56 100644 --- a/app/Services/DoctorAccountService.php +++ b/app/Services/DoctorAccountService.php @@ -339,7 +339,7 @@ class DoctorAccountService extends BaseService if ($app_env != "dev"){ // 正式环境高于300元才可以提现 if ($withdrawal_amount_total < 300){ - return fail("提现金额小于300元"); + return fail(HttpEnumCode::HTTP_ERROR,"提现金额小于300元"); } } From d9c9c9af4e22521485f570a74cb02f5a5f16e275 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 10 Aug 2023 15:50:34 +0800 Subject: [PATCH 060/176] 1 --- app/Services/InquiryService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 6ee3266..81f9bee 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -478,7 +478,7 @@ class InquiryService extends BaseService } // 检测项目 - $order_inquiry_case['detection_project'] = null; + $order_inquiry_case['detection_project'] = array(); if ($order_inquiry['inquiry_type'] == 5){ // 获取检测订单 $params = array(); From dd470ac83964d8fc209c0241f254e27c261ff2fe Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 10 Aug 2023 16:01:47 +0800 Subject: [PATCH 061/176] 1 --- app/Services/InquiryService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 81f9bee..6ee3266 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -478,7 +478,7 @@ class InquiryService extends BaseService } // 检测项目 - $order_inquiry_case['detection_project'] = array(); + $order_inquiry_case['detection_project'] = null; if ($order_inquiry['inquiry_type'] == 5){ // 获取检测订单 $params = array(); From 1a7dceb86b1370ccf6228a7411ef9ffc44d3cbe7 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 10 Aug 2023 17:00:08 +0800 Subject: [PATCH 062/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=80=E5=85=B7?= =?UTF-8?q?=E5=A4=84=E6=96=B9=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=9B=9E=E6=BB=9A?= =?UTF-8?q?=E3=80=82=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8log=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=A4=84=E6=96=B9=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Amqp/Consumer/AssignPharmacistConsumer.php | 2 +- app/Services/CaService.php | 3 +-- app/Services/OrderPrescriptionService.php | 2 +- app/Services/UserDoctorService.php | 5 +++-- extend/Ca/Ca.php | 3 --- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/Amqp/Consumer/AssignPharmacistConsumer.php b/app/Amqp/Consumer/AssignPharmacistConsumer.php index 1425b9e..d5c76ac 100644 --- a/app/Amqp/Consumer/AssignPharmacistConsumer.php +++ b/app/Amqp/Consumer/AssignPharmacistConsumer.php @@ -98,7 +98,7 @@ class AssignPharmacistConsumer extends ConsumerMessage OrderPrescription::edit($params, $save_data); Db::commit(); - } catch (\Exception $e) { + } catch (\Throwable $e) { Db::rollBack(); Log::getInstance()->error("分配药师队列执行失败原因:" . $e->getMessage()); diff --git a/app/Services/CaService.php b/app/Services/CaService.php index 7bf43c4..6d55e1a 100644 --- a/app/Services/CaService.php +++ b/app/Services/CaService.php @@ -397,7 +397,7 @@ class CaService extends BaseService $pdf->Image('@' . $img_result, 10, 10, 0, 0, '', '', '', false, 300, '', false, false, 0, false, false, false); $prescription_pdf_local_filename = $order_prescription['order_prescription_id'] . '.' . 'pdf'; - $prescription_pdf_local_path = dirname(__DIR__, 2) . "/file/prescription/"; + $prescription_pdf_local_path = BASE_PATH . "/runtime/file/prescription/"; $res = mkdirs($prescription_pdf_local_path); if (!$res){ @@ -406,7 +406,6 @@ class CaService extends BaseService // 图片生成的处方pdf存储为本地文件 runtime目录下 $pdf->Output($prescription_pdf_local_path . $prescription_pdf_local_filename, "F"); - return $prescription_img_oss_path; } diff --git a/app/Services/OrderPrescriptionService.php b/app/Services/OrderPrescriptionService.php index dd48625..aae18bc 100644 --- a/app/Services/OrderPrescriptionService.php +++ b/app/Services/OrderPrescriptionService.php @@ -198,7 +198,7 @@ class OrderPrescriptionService extends BaseService $result['file_id'] = $file_id; return $result; - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException($e->getMessage()); } } diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 2fd0ec6..e6c7173 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1402,6 +1402,7 @@ class UserDoctorService extends BaseService $params['product_id'] = $item['product_id']; $product = Product::getOne($params); if (empty($product)){ + Db::rollBack(); return fail(HttpEnumCode::SERVER_ERROR,"商品错误"); } @@ -1521,7 +1522,7 @@ class UserDoctorService extends BaseService } Db::commit(); - } catch (\Exception $e) { + } catch (\Throwable $e) { Db::rollBack(); return fail(HttpEnumCode::SERVER_ERROR, $e->getMessage()); } @@ -1530,7 +1531,7 @@ class UserDoctorService extends BaseService // 发送消息-药师审核中 $ImService = new ImService(); $ImService->pharmacistVerify($order_inquiry,(string)$order_prescription->order_prescription_id,$product_name,$user_doctor['user_id'],$order_inquiry['user_id']); - }catch (\Exception $e){ + }catch (\Throwable $e){ return success([],HttpEnumCode::HTTP_SUCCESS,"消息发送失败"); } diff --git a/extend/Ca/Ca.php b/extend/Ca/Ca.php index a8b8fdf..e621b5c 100644 --- a/extend/Ca/Ca.php +++ b/extend/Ca/Ca.php @@ -54,7 +54,6 @@ abstract class Ca ] ]; - Log::getInstance()->info("获取云证书签名请求",$option); try { $response = $this->httpRequest( $this->api_url . '/cloud-certificate-service' . '/api/cloudCert/open/cert/sign', @@ -89,8 +88,6 @@ abstract class Ca ] ]; - dump($option); - try { $response = $this->httpRequest( $this->api_url . '/signgw-service/api/signature/verifyPkcs7', From a13b55d90b6a6e52ef6934485632fa5e0b8831ae Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 14 Aug 2023 14:14:54 +0800 Subject: [PATCH 063/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B2=9F=E9=80=9A?= =?UTF-8?q?=E5=B8=82=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 2 +- app/Model/BasicDetectionOrgan.php | 7 ++++++- app/Services/InquiryService.php | 23 ++++++++++------------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index a8a3048..7e2f896 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1333,7 +1333,7 @@ class CallBackController extends AbstractController // 获取检测订单数据 $params = array(); - $params['detection_no'] = "D548154592174350336"; + $params['detection_no'] = "D549534850211602432"; $order_detection = OrderDetection::getOne($params); if (empty($order_detection)){ return $this->detectionResultFailReturn("非法订单"); diff --git a/app/Model/BasicDetectionOrgan.php b/app/Model/BasicDetectionOrgan.php index c3d45ba..1967aac 100644 --- a/app/Model/BasicDetectionOrgan.php +++ b/app/Model/BasicDetectionOrgan.php @@ -11,8 +11,13 @@ use Hyperf\Snowflake\Concern\Snowflake; /** * @property int $detection_organ_id 主键id + * @property int $company_id 合作公司id * @property string $detection_organ_name 检测机构名称 + * @property string $app_id key + * @property string $app_secret 秘钥 * @property int $status 状态(1:正常 2:删除) + * @property string $request_dev_url 测试请求地址 + * @property string $request_prod_url 正式请求地址 * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 */ @@ -28,7 +33,7 @@ class BasicDetectionOrgan extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['detection_organ_id', 'detection_organ_name', 'status', 'created_at', 'updated_at']; + protected array $fillable = ['detection_organ_id', 'company_id', 'detection_organ_name', 'app_id', 'app_secret', 'status', 'request_dev_url', 'request_prod_url', 'created_at', 'updated_at']; protected string $primaryKey = "detection_organ_id"; diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 6ee3266..70a3b25 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -766,18 +766,17 @@ class InquiryService extends BaseService $follow = false; // 关注状态 $is_evaluation = false; // 评价状态 + // 沟通次数,沟通时长 + $params = array(); + $params['inquiry_type'] = $order_inquiry['inquiry_type']; + $params['inquiry_mode'] = $order_inquiry['inquiry_mode']; + $system_inquiry_config = SystemInquiryConfig::getOne($params); + if (!empty($system_inquiry_config)){ + $times_number = $system_inquiry_config['times_number']; + $duration = $system_inquiry_config['duration']; + } + if ($user_info['user_type'] == 1){ - - // 沟通次数,沟通时长 - $params = array(); - $params['inquiry_type'] = $order_inquiry['inquiry_type']; - $params['inquiry_mode'] = $order_inquiry['inquiry_mode']; - $system_inquiry_config = SystemInquiryConfig::getOne($params); - if (!empty($system_inquiry_config)){ - $times_number = $system_inquiry_config['times_number']; - $duration = $system_inquiry_config['duration']; - } - // 关注状态 $params = array(); $params['patient_id'] = $user_info['client_user_id']; @@ -792,8 +791,6 @@ class InquiryService extends BaseService $is_evaluation = OrderEvaluation::getExists($params); } - - $result = array(); $result['doctor_user_id'] = $user_doctor['user_id']; $result['patient_user_id'] = $order_inquiry['user_id']; From 19ae7e6bff06b17d04e8bd5ae45d6fa9703575b9 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 15 Aug 2023 15:23:24 +0800 Subject: [PATCH 064/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=89=80=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E7=9F=AD=E4=BF=A1=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 81 ++++++++++-- app/Model/OrderDetection.php | 6 +- app/Services/DetectionService.php | 21 ++- app/Services/ImService.php | 2 +- app/Services/MessagePush.php | 50 +++++++- app/Utils/Auth.php | 6 +- extend/Alibaba/Oss.php | 4 - extend/Detection/Base.php | 96 ++++++++++++++ extend/Detection/Wy.php | 177 ++++++++++++++++++++++++++ 9 files changed, 416 insertions(+), 27 deletions(-) create mode 100644 extend/Detection/Base.php create mode 100644 extend/Detection/Wy.php diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 7e2f896..5e3c80f 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -7,6 +7,7 @@ use App\Amqp\Producer\AutoCompleteInquiryDelayDirectProducer; use App\Constants\DoctorTitleCode; use App\Constants\HttpEnumCode; use App\Exception\BusinessException; +use App\Model\BasicDetectionOrgan; use App\Model\BasicLogisticsCompany; use App\Model\DetectionProject; use App\Model\Hospital; @@ -35,6 +36,7 @@ use App\Services\InquiryService; use App\Services\MessagePush; use App\Services\OrderPrescriptionService; use App\Utils\Log; +use Extend\Alibaba\Oss; use Extend\TencentIm\Account; use Extend\TencentIm\Message; use Extend\TencentIm\Profile; @@ -1328,12 +1330,54 @@ class CallBackController extends AbstractController public function DetectionResultCallBack(): ResponseInterface { $request_params = $this->request->all(); + $auth = $this->request->getHeader("Authorization"); + if (empty($auth)){ + return $this->detectionResultFailReturn("非法请求"); + } + try { - Log::getInstance("detectionResult")->info(json_encode($request_params, JSON_UNESCAPED_UNICODE)); + // 检测参数 + if (!isset($request_params['appId'])){ + return $this->detectionResultFailReturn("缺少appId参数"); + } + + if (!isset($request_params['orderCode'])){ + return $this->detectionResultFailReturn("缺少orderCode参数"); + } + + if (!isset($request_params['detectBarcode'])){ + return $this->detectionResultFailReturn("缺少detectBarcode参数"); + } + + if (!isset($request_params['pdfReport'])){ + return $this->detectionResultFailReturn("缺少pdfReport参数"); + } + + // 检测签名 +// $params = array(); +// $params['app_id'] = $request_params['appId']; +// $basic_detection_organ = BasicDetectionOrgan::getOne($params); +// if (empty($basic_detection_organ)){ +// return $this->detectionResultFailReturn("非法appId"); +// } +// +// $time = date('Y-m-d'); +// $sign = md5($basic_detection_organ['app_id'] . $basic_detection_organ['app_secret'] . $time); +// if ($auth != $sign){ +// return $this->detectionResultFailReturn("签名错误"); +// } + + // 检测pdf文件 + $pdfData = base64_decode($request_params['pdfReport']); + if (!$pdfData){ + return $this->detectionResultFailReturn("文件错误"); + } + + Log::getInstance("CallBackController-DetectionResultCallBack")->info(json_encode($request_params, JSON_UNESCAPED_UNICODE)); // 获取检测订单数据 $params = array(); - $params['detection_no'] = "D549534850211602432"; + $params['detection_no'] = $request_params['orderCode']; $order_detection = OrderDetection::getOne($params); if (empty($order_detection)){ return $this->detectionResultFailReturn("非法订单"); @@ -1344,6 +1388,14 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("订单状态错误,无法处理"); } + if (!empty($order_detection['detection_result_pdf'])){ + return $this->detectionResultSuccessReturn(); + } + +// if ($order_detection['detection_bar_code'] != $request_params['detectBarcode']){ +// return $this->detectionResultFailReturn("检测条码无法对应"); +// } + // 获取医生数据 $params = array(); $params['doctor_id'] = $order_detection['doctor_id']; @@ -1377,6 +1429,12 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("患者信息错误"); } + // 上传处方图片至oss + $oss = new Oss(); + $detection_result_pdf_name = "applet/patient/detection/pdf/" . $order_detection['order_detection_id'] . '.' . 'pdf'; + $detection_result_pdf = $oss->putObject($detection_result_pdf_name, $pdfData); + $detection_result_pdf = '/' . $detection_result_pdf; + Db::beginTransaction(); try { @@ -1431,10 +1489,11 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("问诊订单病例创建失败"); } - // 修改检测状态 + // 修改检测订单 $data = array(); $data['detection_status'] = 4; - $data['detection_time'] = date('Y-m-d H:i:s',time()); + $data['detection_result_pdf'] = $detection_result_pdf; + $data['detection_result_date'] = date('Y-m-d H:i:s',time()); $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id $params = array(); @@ -1494,7 +1553,9 @@ class CallBackController extends AbstractController $MessagePush = new MessagePush($order_detection['user_id']); $MessagePush->patientDetectionResultNotice($order_detection['order_detection_id']); - // 医生-发送检测报告短信 + // 医生-通知医生患者检测报告已生成 + $MessagePush = new MessagePush($user_doctor['user_id']); + $MessagePush->doctorDetectionResultNotice($order_detection['order_detection_id']); }catch (\Throwable $e){ Log::getInstance("detectionResult")->error($e->getMessage()); } @@ -1518,9 +1579,8 @@ class CallBackController extends AbstractController new SwooleStream( strval( json_encode([ - 'result' => false, - 'returnCode' => "500", - 'message' => $message, + 'code' => 0, + 'msg' => $message, ], JSON_UNESCAPED_UNICODE) ) ) @@ -1540,9 +1600,8 @@ class CallBackController extends AbstractController new SwooleStream( strval( json_encode([ - 'result' => true, - 'returnCode' => "200", - 'message' => $message, + 'code' => 1, + 'msg' => $message, ], JSON_UNESCAPED_UNICODE) ) ) diff --git a/app/Model/OrderDetection.php b/app/Model/OrderDetection.php index 491106f..a367b07 100644 --- a/app/Model/OrderDetection.php +++ b/app/Model/OrderDetection.php @@ -39,7 +39,9 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property int $patient_age 患者年龄-就诊人 * @property string $detection_bar_code 检测条码 * @property string $detection_pic 检测管图片(逗号分隔) - * @property string $detection_time 检测时间 + * @property string $detection_time 上传检测时间 + * @property string $detection_result_pdf 检测结果 + * @property string $detection_result_date 检测结果时间 * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 */ @@ -55,7 +57,7 @@ class OrderDetection extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['order_detection_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'order_inquiry_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'detection_pic', 'detection_time', 'created_at', 'updated_at']; + protected array $fillable = ['order_detection_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'detection_project_id', 'purpose_id', 'detection_organ_id', 'order_inquiry_id', 'detection_status', 'is_delete', 'detection_refund_status', 'detection_pay_channel', 'detection_pay_status', 'detection_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'detection_bar_code', 'detection_pic', 'detection_time', 'detection_result_pdf', 'detection_result_date', 'created_at', 'updated_at']; protected string $primaryKey = "order_detection_id"; diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 218b140..810949f 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -20,6 +20,7 @@ use App\Model\UserDoctor; use App\Model\UserLocation; use App\Utils\Log; use App\Utils\PcreMatch; +use Extend\Detection\Wy; use Extend\Wechat\WechatPay; use Hyperf\Amqp\Producer; use Hyperf\DbConnection\Db; @@ -537,16 +538,27 @@ class DetectionService extends BaseService $detection_pic = PcreMatch::pregRemoveOssWebsite($detection_pic); } - // 获取检测所 + // 检测检测管编码是否已被使用 + $params = array(); + $params['detection_bar_code'] = $request_params['detection_bar_code']; + $result = OrderDetection::getOne($params); + if (!empty($result)){ + return fail(HttpEnumCode::HTTP_ERROR,"检测管已被使用"); + } Db::beginTransaction(); try { + // 上报数据 + $wy = new Wy($order_detection['detection_organ_id']); + $wy->report($order_detection); + // 修改检测订单 $data = array(); $data['detection_pic'] = $detection_pic ?? ""; $data['detection_bar_code'] = $request_params['detection_bar_code']; $data['detection_status'] = 3; $data['detection_organ_id'] = 1;// 检测机构id + $data['detection_time'] = date('Y-m-d H:i:s', time());// 上传检测时间 $params = array(); $params['order_detection_id'] = $order_detection_id; @@ -556,12 +568,11 @@ class DetectionService extends BaseService return fail(HttpEnumCode::HTTP_ERROR,"绑定失败"); } - // 上报数据 - Db::commit(); - }catch (\Exception $e){ + }catch (\Throwable $e){ Db::rollBack(); - return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage()); + Log::getInstance("DetectionService-bindDetectionTube")->error($e->getMessage()); + return fail(HttpEnumCode::HTTP_ERROR, "绑定失败"); } return success(); diff --git a/app/Services/ImService.php b/app/Services/ImService.php index 3a59580..4df8c80 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -729,7 +729,7 @@ class ImService extends BaseService $cloud_custom_data['patient_family_data']['patient_age'] = $order_detection['patient_age']; $message_content = [ - 'Text' => $doctor_name . "医生您好,我在您那里开具的【" . $detection_project_name . "】服务,报告单已出,请您查看报告并详细的做一下解读,谢谢医生。", + 'Text' => $doctor_name . "医生您好,您给我开具的【" . $detection_project_name . "】检测项目报告已经出来啦,请您抽空查看报告并做一下解读,谢谢。", ]; $this->sendMessage($patient_user_id,$doctor_user_id, $message_content, "TIMTextElem", $cloud_custom_data); diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 26bd6bd..2ddc7b7 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -2338,7 +2338,7 @@ class MessagePush extends BaseService // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_462035956"; - $sms_data['scene_desc'] = "您的{$detection_project['detection_project_name']}报告单已出,请联系医生做报告解读。平台已赠送您和医生5个沟通回合,请珍惜沟通机会,请前往肝胆相照互联网医院微信小程序“个人中心”-“检测订单”-“订单详情”查看报告。"; + $sms_data['scene_desc'] = "新报告生成通知"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; @@ -2360,4 +2360,52 @@ class MessagePush extends BaseService Log::getInstance("MessagePush-patientDetectionResultNotice")->error($e->getMessage()); } } + + /** + * 医生-通知医生患者检测报告已生成 + * 短信 + * @param string $order_detection_id + * @return void + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function doctorDetectionResultNotice(string $order_detection_id): void + { + // 获取检测订单 + $params = array(); + $params['order_detection_id'] = $order_detection_id; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + Log::getInstance("MessagePush-patientDetectionResultNotice")->error("无检测订单数据"); + return; + } + + // 获取检测项目 + $params = array(); + $params['detection_project_id'] = $order_detection['detection_project_id']; + $detection_project = DetectionProject::getOne($params); + if (empty($detection_project)) { + Log::getInstance("MessagePush-patientDetectionResultNotice")->error("检测项目错误"); + return; + } + + // 获取系统接诊配置 + $data = array(); + $data['template_code'] = "SMS_461980700"; + $data['scene_desc'] = "通知医生患者检测报告已生成"; + $data['phone'] = $this->user['mobile']; + $data['user_id'] = $this->user['user_id']; + + $template_param = array(); + $template_param['name'] = $order_detection['patient_name']; + $template_param['report'] = $detection_project['detection_project_name']; + $data['template_param'] = $template_param; + + $message = new SendSmsMessageProducer($data); + $producer = ApplicationContext::getContainer()->get(Producer::class); + $result = $producer->produce($message); + if (!$result) { + throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); + } + } } \ No newline at end of file diff --git a/app/Utils/Auth.php b/app/Utils/Auth.php index d19f589..78d99a2 100644 --- a/app/Utils/Auth.php +++ b/app/Utils/Auth.php @@ -28,17 +28,17 @@ class Auth "/callback/wxpay/inquiry/refund" => "post", // 微信问诊退款回调 "/callback/wxpay/product/success" => "post", // 微信药品支付回调 "/callback/wxpay/product/refund" => "post", // 微信药品退款回调 - "/callback/wxpay/detection/success" => "post", // 微信药品支付回调 - "/callback/wxpay/detection/refund" => "post", // 微信药品退款回调 + "/callback/wxpay/detection/success" => "post", // 微信检测订单支付回调 + "/callback/wxpay/detection/refund" => "post", // 微信检测订单退款回调 "/callback/im" => "post", // im回调 "/callback/platform/logistics" => "post", // 处方平台物流回调 "/callback/logistics" => "post", // 快递100订阅回调 "/popup" => "get", // 获取弹窗数据 "/basic/keyword/search" => "get", // 获取热门搜索关键词 "/test/uninquiry" => "get", // 获取未接诊的医生 - "/test/refund" => "get", // 测试退款 "/test" => "get", // 测试 + "/callback/detection" => "post", // 检测所结果回调 ]; } diff --git a/extend/Alibaba/Oss.php b/extend/Alibaba/Oss.php index 092c3d2..2f744f4 100644 --- a/extend/Alibaba/Oss.php +++ b/extend/Alibaba/Oss.php @@ -110,13 +110,9 @@ class Oss public function getCusTomObjectToRAM(string $filename,string $style = "image/resize"): string { try { -// $download_file = "./runtime/aaa.jpg"; - - $ossClient = $this->createClient(); $options = array( OssClient::OSS_PROCESS => $style, -// OssClient::OSS_FILE_DOWNLOAD => $download_file, ); $object = $filename; diff --git a/extend/Detection/Base.php b/extend/Detection/Base.php new file mode 100644 index 0000000..57c0a90 --- /dev/null +++ b/extend/Detection/Base.php @@ -0,0 +1,96 @@ +container = ApplicationContext::getContainer(); + $this->client = $this->container->get(Client::class); + + // 获取检测机构数据 + $params = array(); + $params['detection_organ_id'] = $detection_organ_id; + $basic_detection_organ = BasicDetectionOrgan::getOne($params); + if (!empty($basic_detection_organ)){ + if (!empty($basic_detection_organ['app_id'])){ + $this->app_id = $basic_detection_organ['app_id']; + } + + if (!empty($basic_detection_organ['app_secret'])){ + $this->secret = $basic_detection_organ['app_secret']; + } + + $app_env = config("app_env","dev"); + if ($app_env == "dev"){ + if (!empty($basic_detection_organ['request_dev_url'])){ + $this->request_url = $basic_detection_organ['request_dev_url']; + } + }else{ + if (!empty($basic_detection_organ['request_prod_url'])){ + $this->request_url = $basic_detection_organ['request_prod_url']; + } + } + } + } + + + /** + * 请求封装 + * @param string $sign + * @param array $arg 请求参数 + * @return array + * @throws GuzzleException + */ + protected function httpRequest(string $sign,array $arg = []): array + { + $option = [ + "headers" => [ + "source" => $sign + ] + ]; + + if (!empty($option)){ + $arg = array_merge($arg,$option); + } + + $response = $this->client->post($this->request_url, $arg); + + if ($response->getStatusCode() != '200'){ + // 请求失败 + throw new BusinessException($response->getBody()->getContents()); + } + + $body = json_decode($response->getBody(),true); + if (empty($body)){ + // 返回值为空 + throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR)); + } + + return $body; + } +} \ No newline at end of file diff --git a/extend/Detection/Wy.php b/extend/Detection/Wy.php new file mode 100644 index 0000000..e6804ab --- /dev/null +++ b/extend/Detection/Wy.php @@ -0,0 +1,177 @@ +app_id) || empty($this->secret) || empty($this->request_url)){ + throw new BusinessException("缺少签名数据"); + } + + $time = date('Y-m-d'); + return md5($this->app_id . $this->secret . $time); + } + + /** + * 上报数据 + * @param array|object $order_detection + */ + public function report(array|object $order_detection) + { + // 获取检测订单病例数据 + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + $order_detection_case = OrderDetectionCase::getOne($params); + if (empty($order_detection_case)){ + throw new BusinessException("病例数据错误"); + } + + // 获取家庭成员数据 + $params = array(); + $params['family_id'] = $order_detection['family_id']; + $patient_family = PatientFamily::getOne($params); + if (empty($patient_family)){ + throw new BusinessException("患者家庭成员数据错误"); + } + + // 获取患者地址 + $params = array(); + $params['user_id'] = $order_detection['user_id']; + $user_location = UserLocation::getOne($params); + if (!empty($user_location)){ + $address = $user_location['province'] . $user_location['city'] . $user_location['county'] . $user_location['address']; + } + + // 获取医生数据 + $params = array(); + $params['doctor_id'] = $order_detection['doctor_id']; + $user_doctor = UserDoctor::getOne($params); + if (empty($user_doctor)){ + throw new BusinessException("医生数据错误"); + } + + // 获取医院数据 + $params = array(); + $params['hospital_id'] = $user_doctor['hospital_id']; + $hospital = Hospital::getOne($params); + if (empty($hospital)){ + throw new BusinessException("医院数据错误"); + } + + // 获取检测项目数据 + $params = array(); + $params['detection_project_id'] = $order_detection['detection_project_id']; + $detection_project = DetectionProject::getOne($params); + if (empty($detection_project)){ + throw new BusinessException("检测数据错误"); + } + + // 获取检测用途数据 + $params = array(); + $params['purpose_id'] = $order_detection['purpose_id']; + $detection_project_purpose = DetectionProjectPurpose::getOne($params); + if (empty($detection_project_purpose)){ + throw new BusinessException("检测数据错误"); + } + + // 处理检测管图片 + $oss = new Oss(); + + $pics = []; + $detection_pics = explode(',',$order_detection['detection_pic']); + foreach ($detection_pics as $key => $value){ + // 去除用户签名图片第一个/ oss不识别 + $value = substr($value, 1, strlen($value) - 1); + + $pic = $oss->getObjectToRAM($value); + if (empty($pic)){ + throw new BusinessException("检测管图片错误"); + } + + $pic = base64_encode($pic); + if (!$pic) { + throw new BusinessException("检测管图片下载失败"); + } + + $pics[$key]['pictureNo'] = $key + 1; // 图片序号 + $pics[$key]['pictureName'] = "检测管图片"; // 图片名称 + $pics[$key]['pictureInfo'] = $pic; // 对图片进行base64后的编码 + } + + // 获取签名 + $sign = $this->getSign(); + + $arg = array(); + $arg['appId'] = $this->app_id; + $arg['orderCode'] = $order_detection['detection_no']; // 订单编号 + $arg['orderTime'] = date('Y-m-d H:i:s',strtotime($order_detection['created_at'])); // 订单时间 + $arg['userPatientRelationships'] = $patient_family['relation']; // 操作用户与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) + $arg['patientName'] = $order_detection['patient_name']; // 患者姓名 + $arg['patientSex'] = $order_detection['patient_sex']; // 患者性别(0:未知 1:男 2:女) + $arg['patientNationality'] = $order_detection_case['nation_name']; // 患者民族 + $arg['patientPastMedicalHistory'] = $order_detection_case['detection_disease_class_names']; // 患者既往病史 + $arg['patientCardNo'] = $patient_family['id_number']; // 患者身份证号 + $arg['patientPhone'] = $patient_family['mobile']; // 患者手机号 + $arg['patientAddress'] = $address ?? ""; // 患者住址(非必填) + $arg['detectBarCode'] = $order_detection['detection_bar_code']; // 检测条形码 + $arg['pictureOfDetectionTube'] = $pics; // 检测管图片数组 + $arg['hospitalName'] = $hospital['hospital_name']; // 医院名称(送检单位) + $arg['doctorName'] = $user_doctor['user_name']; // 医生名称 + $arg['projectName'] = $detection_project['detection_project_name']; // 检测项目名称 + $arg['projectPurpose'] = $detection_project_purpose['purpose_name']; // 检测项目用途名称 + $arg['payTime'] = $order_detection['pay_time']; // 支付时间 + $arg['payAmount'] = $order_detection['payment_amount_total']; // 支付金额 + $arg['reportUrl'] = $this->request_url; // 推送报告的回调地址 + + $option = [ + "json" => $arg + ]; + + try { + $response = $this->httpRequest($sign,$option); + if (empty($response)){ + // 返回值错误为空 + throw new BusinessException(""); + } + + if (!isset($response['code'])){ + throw new BusinessException("上报数据返回值错误"); + } + + if ($response['code'] != 1){ + if (!isset($response['msg'])){ + throw new BusinessException("上报数据返回值错误"); + } + + if (empty($response['msg'])){ + throw new BusinessException("上报数据返回值错误"); + } + throw new BusinessException($response['msg']); + } + } catch (GuzzleException $e) { + throw new BusinessException($e->getMessage()); + } + } +} \ No newline at end of file From 205d59726be13905ec0d069154c73c71ea81d67e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 15 Aug 2023 16:22:33 +0800 Subject: [PATCH 065/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/UserDoctor.php | 33 ++++++++++++++------------- app/Request/UserDoctorRequest.php | 2 +- app/Services/PatientDoctorService.php | 19 ++++++++++++++- app/Services/UserDoctorService.php | 7 +++++- 4 files changed, 42 insertions(+), 19 deletions(-) diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index 9e19a4e..af70bb0 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -215,34 +215,35 @@ class UserDoctor extends Model * @param int|null $per_page * @return array */ - public static function getInquiryDoctorPage(string $keyword = "", array $doctor_params = [], string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array + public static function getInquiryDoctorPage(string $keyword = "", array $hospital_params = [], array $doctor_params = [], array $doctor_expertise_params = [], string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array { $query = self::with([ "Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id", - "DoctorExpertise", - "DoctorExpertise.DiseaseClassExpertise:expertise_id,expertise_name", + "DoctorExpertise" => function ($query) use ($doctor_expertise_params) { + $query->where($doctor_expertise_params); + }, "DoctorInquiryConfig" => function ($query) use ($sort_order) { $params = array(); $params['inquiry_mode'] = 1;// 接诊方式:图文 $query->where($params)->whereIn('inquiry_type', [1, 3]); -// if ($sort_order == 1) { -// // 综合 -// $query->orderBy('inquiry_price', 'asc');// 价格从低到高 -// } elseif ($sort_order == 3) { -// // 价格从低到高 -// $query->orderBy('inquiry_price', 'asc'); -// } elseif ($sort_order == 4) { -// // 价格从高到低 -// $query->orderBy('inquiry_price', 'desc');// 价格从高到低 -// } + if ($sort_order == 1) { + // 综合-价格从低到高 + $query->orderBy('inquiry_price', 'asc'); + } elseif ($sort_order == 3) { + // 价格从低到高 + $query->orderBy('inquiry_price', 'asc'); + } elseif ($sort_order == 4) { + // 价格从高到低 + $query->orderBy('inquiry_price', 'desc'); + } return $query; }, ]) ->where($doctor_params) -// ->whereHas('Hospital', function ($query) use ($hospital_params) { -// $query->where($hospital_params); -// }) + ->whereHas('Hospital', function ($query) use ($hospital_params) { + $query->where($hospital_params); + }) ->when($keyword, function ($query, $keyword) { $query->where(function ($query) use ($keyword) { $query->orwhere("user_name", 'like', '%' . $keyword . '%'); diff --git a/app/Request/UserDoctorRequest.php b/app/Request/UserDoctorRequest.php index 236818c..0e823ad 100644 --- a/app/Request/UserDoctorRequest.php +++ b/app/Request/UserDoctorRequest.php @@ -101,7 +101,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:3', + 'pharmacist_audit_status' => 'required|integer|min:0|max:2', 'words_type' => 'required|integer|min:1|max:3', 'words' => 'required', 'doctor_id' => 'required', diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 8fbedbd..87db426 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -38,7 +38,24 @@ class PatientDoctorService extends BaseService $per_page = $this->request->input('per_page',10); // 组合条件 + $hospital_params = array();// 医院搜索 $doctor_params = array();// 医生搜索 + $doctor_expertise_params = array();// 医生专长搜索 + + // 省市区 + if (!empty($province_id)) { + if (empty($city_id)) { + // 省份存在时需和城市在一块 + return fail(HttpEnumCode::CLIENT_HTTP_ERROR); + } + $hospital_params[] = ['province_id', '=', $province_id]; + $hospital_params[] = ['city_id', '=', $city_id]; + } + + // 医生专长 + if (!empty($expertise_id)) { + $doctor_expertise_params['expertise_id'] = $expertise_id; + } // 固定医生查询条件 $doctor_params['status'] = 1; // 状态(0:禁用 1:正常 2:删除) @@ -73,7 +90,7 @@ class PatientDoctorService extends BaseService "be_good_at", ]; - $user_doctors = UserDoctor::getInquiryDoctorPage($keyword, $doctor_params, $sort_order, $fields,$page,$per_page); + $user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params, $sort_order, $fields,$page,$per_page); // 处理数据 if (!empty($user_doctors['data'])) { diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index e6c7173..c28718c 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -484,9 +484,14 @@ class UserDoctorService extends BaseService // 获取处方数据 $params = array(); $params['doctor_id'] = $user_info['client_user_id']; - $params['prescription_status'] = 1; $params['pharmacist_audit_status'] = $pharmacist_audit_status; $params['is_delete'] = 0; + + if ($pharmacist_audit_status == 1){ + // 审核通过 + $params['platform_audit_status'] = 1; + } + $order_prescriptions = OrderPrescription::getWithIcdPage($params,['*'],$page,$per_page); if (empty($order_prescriptions)) { return success($order_prescriptions); From 340a447a83660583112b89da1c6052d50e5e490e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 15 Aug 2023 16:35:05 +0800 Subject: [PATCH 066/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/UserDoctor.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index af70bb0..b7fbcd5 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -261,14 +261,14 @@ class UserDoctor extends Model $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 } elseif ($sort_order == 2) { // 响应时间快 - $query->orderBy('avg_response_time', 'desc'); + $query->orderBy('avg_response_time', 'asc'); $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 } elseif ($sort_order == 3) { - // 响应时间快 - $query->orderBy('avg_response_time', 'desc'); + // 价格从低到高 + $query->orderBy('avg_response_time', 'asc'); $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 } elseif ($sort_order == 4) { - // 响应时间快 + // 价格从高到低 $query->orderBy('avg_response_time', 'desc'); $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 } elseif ($sort_order == 5) { From 7479355defa304ca050ed99796185d960b6ca4c7 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 16 Aug 2023 09:08:24 +0800 Subject: [PATCH 067/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E3=80=81=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/UserDoctor.php | 24 +++--- app/Services/PatientDoctorService.php | 106 +++++++++++++------------- extend/Detection/Base.php | 4 +- extend/Detection/Wy.php | 13 +++- 4 files changed, 81 insertions(+), 66 deletions(-) diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index b7fbcd5..52de0a3 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -219,13 +219,8 @@ class UserDoctor extends Model { $query = self::with([ "Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id", - "DoctorExpertise" => function ($query) use ($doctor_expertise_params) { - $query->where($doctor_expertise_params); - }, + "DoctorExpertise", "DoctorInquiryConfig" => function ($query) use ($sort_order) { - $params = array(); - $params['inquiry_mode'] = 1;// 接诊方式:图文 - $query->where($params)->whereIn('inquiry_type', [1, 3]); if ($sort_order == 1) { // 综合-价格从低到高 $query->orderBy('inquiry_price', 'asc'); @@ -236,8 +231,6 @@ class UserDoctor extends Model // 价格从高到低 $query->orderBy('inquiry_price', 'desc'); } - - return $query; }, ]) ->where($doctor_params) @@ -253,6 +246,14 @@ class UserDoctor extends Model }); }); }) + ->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) { + $query->where($doctor_expertise_params); + }) + ->whereHas('DoctorInquiryConfig', function ($query) { + $params = array(); + $params['inquiry_mode'] = 1;// 接诊方式:图文 + $query->where($params)->whereIn('inquiry_type', [1, 3]); + }) ->when($sort_order, function ($query, $sort_order) { if ($sort_order == 1) { $query->orderBy('is_recommend', 'desc');// 是否首页推荐(0:否 1:是) @@ -277,7 +278,12 @@ class UserDoctor extends Model $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 } return $query; - }); + }) +// ->join('doctor_inquiry_config', 'user_doctor.doctor_id', '=', 'doctor_inquiry_config.doctor_id') +// ->groupBy("user_doctor.doctor_id") +// ->orderBy("doctor_inquiry_config.inquiry_price",'desc') + ->select("user_doctor.*"); + $result = $query->paginate($per_page, $fields, "page", $page); diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 87db426..cdff3cd 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -93,59 +93,59 @@ class PatientDoctorService extends BaseService $user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params, $sort_order, $fields,$page,$per_page); // 处理数据 - if (!empty($user_doctors['data'])) { - foreach ($user_doctors['data'] as &$user_doctor) { - $user_doctor['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']); - - // 处理医生专长 - if (!empty($user_doctor['DoctorExpertise'])) { - foreach ($user_doctor['DoctorExpertise'] as &$data) { - if (!empty($data['DiseaseClassExpertise'])) { - $data['expertise_name'] = $data['DiseaseClassExpertise']['expertise_name']; - } - unset($data['DiseaseClassExpertise']); - } - } - - // 处理问诊价格 - $user_doctor['price'] = 0; - $user_doctor['free_clinic_price'] = 0; - if (!empty($user_doctor['DoctorInquiryConfig'])) { - foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { - if ($doctor_inquiry_config['inquiry_mode'] == 1) { - if ($doctor_inquiry_config['inquiry_type'] == 1) { - // 专家 - $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; - } - if ($doctor_inquiry_config['inquiry_type'] == 3) { - // 公益 - $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; - } - } - } - unset($user_doctor['DoctorInquiryConfig']); - } - - // 好评率-超过5个已结束的订单后展示 - $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; - // 响应时间-超过5个已结束的订单后展示 - $user_doctor['avg_response_time'] = (float)floor($user_doctor['avg_response_time'] * 10) / 10; - - // 获取医生订单数 - $params = array(); - $params['doctor_id'] = $user_doctor['doctor_id']; - $params['inquiry_status'] = 6; // 已结束 - $inquiry_order_count = OrderInquiry::getCount($params); - if (empty($inquiry_order_count) || $inquiry_order_count == 0) { - $user_doctor['is_display_score'] = false; - } else { - $user_doctor['is_display_score'] = true; - } - - // 头像 - $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); - } - } +// if (!empty($user_doctors['data'])) { +// foreach ($user_doctors['data'] as &$user_doctor) { +// $user_doctor['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']); +// +// // 处理医生专长 +// if (!empty($user_doctor['DoctorExpertise'])) { +// foreach ($user_doctor['DoctorExpertise'] as &$data) { +// if (!empty($data['DiseaseClassExpertise'])) { +// $data['expertise_name'] = $data['DiseaseClassExpertise']['expertise_name']; +// } +// unset($data['DiseaseClassExpertise']); +// } +// } +// +// // 处理问诊价格 +// $user_doctor['price'] = 0; +// $user_doctor['free_clinic_price'] = 0; +// if (!empty($user_doctor['DoctorInquiryConfig'])) { +// foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { +// if ($doctor_inquiry_config['inquiry_mode'] == 1) { +// if ($doctor_inquiry_config['inquiry_type'] == 1) { +// // 专家 +// $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; +// } +// if ($doctor_inquiry_config['inquiry_type'] == 3) { +// // 公益 +// $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; +// } +// } +// } +// unset($user_doctor['DoctorInquiryConfig']); +// } +// +// // 好评率-超过5个已结束的订单后展示 +// $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; +// // 响应时间-超过5个已结束的订单后展示 +// $user_doctor['avg_response_time'] = (float)floor($user_doctor['avg_response_time'] * 10) / 10; +// +// // 获取医生订单数 +// $params = array(); +// $params['doctor_id'] = $user_doctor['doctor_id']; +// $params['inquiry_status'] = 6; // 已结束 +// $inquiry_order_count = OrderInquiry::getCount($params); +// if (empty($inquiry_order_count) || $inquiry_order_count == 0) { +// $user_doctor['is_display_score'] = false; +// } else { +// $user_doctor['is_display_score'] = true; +// } +// +// // 头像 +// $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); +// } +// } return success($user_doctors); } diff --git a/extend/Detection/Base.php b/extend/Detection/Base.php index 57c0a90..c2e5ade 100644 --- a/extend/Detection/Base.php +++ b/extend/Detection/Base.php @@ -66,7 +66,7 @@ class Base * @return array * @throws GuzzleException */ - protected function httpRequest(string $sign,array $arg = []): array + protected function httpRequest(string $sign,$path,array $arg = []): array { $option = [ "headers" => [ @@ -78,7 +78,7 @@ class Base $arg = array_merge($arg,$option); } - $response = $this->client->post($this->request_url, $arg); + $response = $this->client->post($path, $arg); if ($response->getStatusCode() != '200'){ // 请求失败 diff --git a/extend/Detection/Wy.php b/extend/Detection/Wy.php index e6804ab..a71febd 100644 --- a/extend/Detection/Wy.php +++ b/extend/Detection/Wy.php @@ -123,6 +123,14 @@ class Wy extends Base // 获取签名 $sign = $this->getSign(); + // 获取回调地址 + $app_env = \Hyperf\Config\config("app_env",'dev'); + if ($app_env == "prod"){ + $callback_url = env('DOMAIN_NAME_PROD','https://prod.hospital.applets.igandanyiyuan.com/'); + }else{ + $callback_url = env('DOMAIN_NAME_DEV','https://dev.hospital.applets.igandanyiyuan.com/'); + } + $arg = array(); $arg['appId'] = $this->app_id; $arg['orderCode'] = $order_detection['detection_no']; // 订单编号 @@ -143,14 +151,15 @@ class Wy extends Base $arg['projectPurpose'] = $detection_project_purpose['purpose_name']; // 检测项目用途名称 $arg['payTime'] = $order_detection['pay_time']; // 支付时间 $arg['payAmount'] = $order_detection['payment_amount_total']; // 支付金额 - $arg['reportUrl'] = $this->request_url; // 推送报告的回调地址 + $arg['reportUrl'] = $callback_url . "callback/detection"; // 推送报告的回调地址 $option = [ "json" => $arg ]; + $path = $this->request_url . "api/sdInternet/v1/externalData/saveOrder"; try { - $response = $this->httpRequest($sign,$option); + $response = $this->httpRequest($sign,$path,$option); if (empty($response)){ // 返回值错误为空 throw new BusinessException(""); From a6732021ca12a4b083472a63dc085e6005b12053 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 16 Aug 2023 09:15:20 +0800 Subject: [PATCH 068/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DetectionService.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 810949f..6f78ae5 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -15,7 +15,6 @@ use App\Model\OrderDetection; use App\Model\OrderDetectionCase; use App\Model\OrderDetectionRefund; use App\Model\PatientFamily; -use App\Model\ReportDetection; use App\Model\UserDoctor; use App\Model\UserLocation; use App\Utils\Log; @@ -546,10 +545,13 @@ class DetectionService extends BaseService return fail(HttpEnumCode::HTTP_ERROR,"检测管已被使用"); } + // 计算检测机构 + $detection_organ_id = 1; + Db::beginTransaction(); try { // 上报数据 - $wy = new Wy($order_detection['detection_organ_id']); + $wy = new Wy($detection_organ_id); $wy->report($order_detection); // 修改检测订单 @@ -557,7 +559,7 @@ class DetectionService extends BaseService $data['detection_pic'] = $detection_pic ?? ""; $data['detection_bar_code'] = $request_params['detection_bar_code']; $data['detection_status'] = 3; - $data['detection_organ_id'] = 1;// 检测机构id + $data['detection_organ_id'] = $detection_organ_id;// 检测机构id $data['detection_time'] = date('Y-m-d H:i:s', time());// 上传检测时间 $params = array(); From fd9c774c13a07090acbca679e9a0f6d5f259f71e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 16 Aug 2023 10:54:26 +0800 Subject: [PATCH 069/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 30 +++++++++++------------ app/Services/DetectionService.php | 34 ++++++++++++++++++++------- extend/Detection/Base.php | 7 ++++++ extend/Detection/Wy.php | 26 +++++++++++++++++--- 4 files changed, 70 insertions(+), 27 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 5e3c80f..986d9dd 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1354,18 +1354,18 @@ class CallBackController extends AbstractController } // 检测签名 -// $params = array(); -// $params['app_id'] = $request_params['appId']; -// $basic_detection_organ = BasicDetectionOrgan::getOne($params); -// if (empty($basic_detection_organ)){ -// return $this->detectionResultFailReturn("非法appId"); -// } -// -// $time = date('Y-m-d'); -// $sign = md5($basic_detection_organ['app_id'] . $basic_detection_organ['app_secret'] . $time); -// if ($auth != $sign){ -// return $this->detectionResultFailReturn("签名错误"); -// } + $params = array(); + $params['app_id'] = $request_params['appId']; + $basic_detection_organ = BasicDetectionOrgan::getOne($params); + if (empty($basic_detection_organ)){ + return $this->detectionResultFailReturn("非法appId"); + } + + $time = date('Y-m-d'); + $sign = md5($basic_detection_organ['app_id'] . $basic_detection_organ['app_secret'] . $time); + if ($auth != $sign){ + return $this->detectionResultFailReturn("签名错误"); + } // 检测pdf文件 $pdfData = base64_decode($request_params['pdfReport']); @@ -1392,9 +1392,9 @@ class CallBackController extends AbstractController return $this->detectionResultSuccessReturn(); } -// if ($order_detection['detection_bar_code'] != $request_params['detectBarcode']){ -// return $this->detectionResultFailReturn("检测条码无法对应"); -// } + if ($order_detection['detection_bar_code'] != $request_params['detectBarcode']){ + return $this->detectionResultFailReturn("检测条码无法对应"); + } // 获取医生数据 $params = array(); diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 6f78ae5..6fd2aff 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -7,6 +7,7 @@ use App\Constants\HttpEnumCode; use App\Exception\BusinessException; use App\Model\Area; use App\Model\BasicCompany; +use App\Model\BasicDetectionOrgan; use App\Model\BasicNation; use App\Model\DetectionProject; use App\Model\DetectionProjectPurpose; @@ -537,6 +538,10 @@ class DetectionService extends BaseService $detection_pic = PcreMatch::pregRemoveOssWebsite($detection_pic); } + if (!isset($detection_pic)){ + return fail(HttpEnumCode::HTTP_ERROR,"上传图片失败"); + } + // 检测检测管编码是否已被使用 $params = array(); $params['detection_bar_code'] = $request_params['detection_bar_code']; @@ -545,21 +550,28 @@ class DetectionService extends BaseService return fail(HttpEnumCode::HTTP_ERROR,"检测管已被使用"); } - // 计算检测机构 - $detection_organ_id = 1; + // 获取检测码对应的检测所 + $detection_organ_code = substr($request_params['detection_bar_code'], 3, 1); + if (!$detection_organ_code){ + return fail(HttpEnumCode::HTTP_ERROR,"检测码错误"); + } + + // 获取检测所数据 + $params = array(); + $params['detection_organ_code'] = $detection_organ_code; + $basic_detection_organ = BasicDetectionOrgan::getOne($params); + if (empty($basic_detection_organ)){ + return fail(HttpEnumCode::HTTP_ERROR,"检测码错误"); + } Db::beginTransaction(); try { - // 上报数据 - $wy = new Wy($detection_organ_id); - $wy->report($order_detection); - // 修改检测订单 $data = array(); - $data['detection_pic'] = $detection_pic ?? ""; + $data['detection_pic'] = $detection_pic; $data['detection_bar_code'] = $request_params['detection_bar_code']; $data['detection_status'] = 3; - $data['detection_organ_id'] = $detection_organ_id;// 检测机构id + $data['detection_organ_id'] = $basic_detection_organ['detection_organ_id'];// 检测机构id $data['detection_time'] = date('Y-m-d H:i:s', time());// 上传检测时间 $params = array(); @@ -570,11 +582,15 @@ class DetectionService extends BaseService return fail(HttpEnumCode::HTTP_ERROR,"绑定失败"); } + // 上报数据 + $wy = new Wy($basic_detection_organ['detection_organ_id']); + $wy->report($order_detection_id); + Db::commit(); }catch (\Throwable $e){ Db::rollBack(); Log::getInstance("DetectionService-bindDetectionTube")->error($e->getMessage()); - return fail(HttpEnumCode::HTTP_ERROR, "绑定失败"); + return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage()); } return success(); diff --git a/extend/Detection/Base.php b/extend/Detection/Base.php index c2e5ade..70f417a 100644 --- a/extend/Detection/Base.php +++ b/extend/Detection/Base.php @@ -5,6 +5,7 @@ namespace Extend\Detection; use App\Constants\HttpEnumCode; use App\Exception\BusinessException; use App\Model\BasicDetectionOrgan; +use App\Utils\Log; use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; use Hyperf\Di\Annotation\Inject; @@ -78,6 +79,12 @@ class Base $arg = array_merge($arg,$option); } + // 打印使用 + $l = $arg; + unset($l['json']['pictureOfDetectionTube']); + dump($l); + + Log::getInstance("请求参数")->info(json_encode($arg,JSON_UNESCAPED_UNICODE)); $response = $this->client->post($path, $arg); if ($response->getStatusCode() != '200'){ diff --git a/extend/Detection/Wy.php b/extend/Detection/Wy.php index a71febd..7a233cb 100644 --- a/extend/Detection/Wy.php +++ b/extend/Detection/Wy.php @@ -7,8 +7,10 @@ use App\Exception\BusinessException; use App\Model\DetectionProject; use App\Model\DetectionProjectPurpose; use App\Model\Hospital; +use App\Model\OrderDetection; use App\Model\OrderDetectionCase; use App\Model\PatientFamily; +use App\Model\User; use App\Model\UserDoctor; use App\Model\UserLocation; use App\Utils\Log; @@ -30,7 +32,7 @@ class Wy extends Base throw new BusinessException("缺少签名数据"); } - $time = date('Y-m-d'); + $time = date('Ymd'); return md5($this->app_id . $this->secret . $time); } @@ -38,8 +40,15 @@ class Wy extends Base * 上报数据 * @param array|object $order_detection */ - public function report(array|object $order_detection) + public function report(string $order_detection_id) { + $params = array(); + $params['order_detection_id'] = $order_detection_id; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)){ + throw new BusinessException("检测订单数据错误"); + } + // 获取检测订单病例数据 $params = array(); $params['order_detection_id'] = $order_detection['order_detection_id']; @@ -96,6 +105,14 @@ class Wy extends Base throw new BusinessException("检测数据错误"); } + // 获取用户数据 + $params = array(); + $params['user_id'] = $order_detection['user_id']; + $user = User::getOne($params); + if (empty($user)){ + throw new BusinessException("用户数据错误"); + } + // 处理检测管图片 $oss = new Oss(); @@ -138,15 +155,17 @@ class Wy extends Base $arg['userPatientRelationships'] = $patient_family['relation']; // 操作用户与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) $arg['patientName'] = $order_detection['patient_name']; // 患者姓名 $arg['patientSex'] = $order_detection['patient_sex']; // 患者性别(0:未知 1:男 2:女) + $arg['patientAge'] = $order_detection['patient_age']; // 患者年龄 $arg['patientNationality'] = $order_detection_case['nation_name']; // 患者民族 $arg['patientPastMedicalHistory'] = $order_detection_case['detection_disease_class_names']; // 患者既往病史 $arg['patientCardNo'] = $patient_family['id_number']; // 患者身份证号 - $arg['patientPhone'] = $patient_family['mobile']; // 患者手机号 + $arg['patientPhone'] = $user['mobile']; // 患者手机号 $arg['patientAddress'] = $address ?? ""; // 患者住址(非必填) $arg['detectBarCode'] = $order_detection['detection_bar_code']; // 检测条形码 $arg['pictureOfDetectionTube'] = $pics; // 检测管图片数组 $arg['hospitalName'] = $hospital['hospital_name']; // 医院名称(送检单位) $arg['doctorName'] = $user_doctor['user_name']; // 医生名称 + $arg['sendSampleDate'] = date('Y-m-d'); // 送检日期(yyyy-MM-dd) $arg['projectName'] = $detection_project['detection_project_name']; // 检测项目名称 $arg['projectPurpose'] = $detection_project_purpose['purpose_name']; // 检测项目用途名称 $arg['payTime'] = $order_detection['pay_time']; // 支付时间 @@ -160,6 +179,7 @@ class Wy extends Base $path = $this->request_url . "api/sdInternet/v1/externalData/saveOrder"; try { $response = $this->httpRequest($sign,$path,$option); + dump($response); if (empty($response)){ // 返回值错误为空 throw new BusinessException(""); From 82b2d4ff7a54e32588a85eba58251069cd52740a Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 16 Aug 2023 11:00:55 +0800 Subject: [PATCH 070/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Amqp/Consumer/SendSmsMessageConsumer.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Amqp/Consumer/SendSmsMessageConsumer.php b/app/Amqp/Consumer/SendSmsMessageConsumer.php index c74b355..99bb2b2 100644 --- a/app/Amqp/Consumer/SendSmsMessageConsumer.php +++ b/app/Amqp/Consumer/SendSmsMessageConsumer.php @@ -190,6 +190,15 @@ class SendSmsMessageConsumer extends ConsumerMessage return false; } break; + case 'SMS_461980700': + // 医生-新报告生成通知 + if (!isset($template_param['report'])) { + return false; + } + if (!isset($template_param['name'])) { + return false; + } + break; default: // 非法模版 return false; From 76661ed7b793024f4bc76553922604c225fa0c43 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 16 Aug 2023 13:35:57 +0800 Subject: [PATCH 071/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 4 ++-- app/Controller/TestController.php | 29 ++++++--------------------- config/autoload/server.php | 1 + 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 986d9dd..8a879bd 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1330,7 +1330,7 @@ class CallBackController extends AbstractController public function DetectionResultCallBack(): ResponseInterface { $request_params = $this->request->all(); - $auth = $this->request->getHeader("Authorization"); + $auth = $this->request->header("Authorization"); if (empty($auth)){ return $this->detectionResultFailReturn("非法请求"); } @@ -1361,7 +1361,7 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("非法appId"); } - $time = date('Y-m-d'); + $time = date('Ymd'); $sign = md5($basic_detection_organ['app_id'] . $basic_detection_organ['app_secret'] . $time); if ($auth != $sign){ return $this->detectionResultFailReturn("签名错误"); diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 90c3c6d..544bab0 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -370,31 +370,14 @@ class TestController extends AbstractController } public function test_15(){ - $env_version = "release"; - $app_env = \Hyperf\Support\env("APP_ENV",'dev'); - if ($app_env == "dev"){ - $env_version = "trial"; + $oss = new Oss(); + $pic = $oss->getObjectToRAM("applet/patient/detection/pdf/SDBA23S16881.pdf"); + if (empty($pic)){ + throw new BusinessException("检测管图片错误"); } - $options = [ - 'json' => [ - "path" => "pages/index/index", - "query" => "doctor_id=539452507563012096", - "expire_type" => 1, - "expire_interval" => 1, - "env_version" => $env_version, - ] - ]; - $Wechat = new Wechat(1); - $result = $Wechat->createUrlLink($options); - dump($result); - - $options = [ - "url_link" => $result['url_link'] - ]; - - $result = $Wechat->getUrlLink($options); - dump($result); + $pic = base64_encode($pic); + Log::getInstance("请求参数")->info($pic); } // 设置坐班医生 diff --git a/config/autoload/server.php b/config/autoload/server.php index 56f6afb..c36d7fc 100644 --- a/config/autoload/server.php +++ b/config/autoload/server.php @@ -37,6 +37,7 @@ return [ Constant::OPTION_MAX_REQUEST => 100000, Constant::OPTION_SOCKET_BUFFER_SIZE => 2 * 1024 * 1024, Constant::OPTION_BUFFER_OUTPUT_SIZE => 2 * 1024 * 1024, + Constant::OPTION_PACKAGE_MAX_LENGTH => 5 * 1024 * 1024, ], 'callbacks' => [ Event::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'], From 7663a6512c8215be0675268ad9e20a3195fe12d6 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 16 Aug 2023 13:52:54 +0800 Subject: [PATCH 072/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 4 ++-- app/Services/PatientOrderService.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 8a879bd..892a6d8 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1335,6 +1335,8 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("非法请求"); } + Log::getInstance("CallBackController-DetectionResultCallBack")->info("处理检测所结果"); + try { // 检测参数 if (!isset($request_params['appId'])){ @@ -1373,8 +1375,6 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("文件错误"); } - Log::getInstance("CallBackController-DetectionResultCallBack")->info(json_encode($request_params, JSON_UNESCAPED_UNICODE)); - // 获取检测订单数据 $params = array(); $params['detection_no'] = $request_params['orderCode']; diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 8849a8c..b1488a3 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1752,6 +1752,7 @@ class PatientOrderService extends BaseService } $order_detection['detection_project_name'] = $detection_project['detection_project_name']; + $order_detection['detection_result_pdf'] = addAliyunOssWebsite($order_detection['detection_result_pdf']); return success($order_detection); } From 83828de3259fc78e625f1cc5493cf4ed1837d631 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 16 Aug 2023 16:44:01 +0800 Subject: [PATCH 073/176] =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A4=87=E6=B3=A8=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/DetectionProject.php | 3 +- app/Model/UserDoctor.php | 122 ++++++++++++++++++++------------- config/autoload/server.php | 2 +- extend/Detection/Base.php | 4 +- extend/Detection/Wy.php | 1 - 5 files changed, 81 insertions(+), 51 deletions(-) diff --git a/app/Model/DetectionProject.php b/app/Model/DetectionProject.php index df00cb5..d33a28f 100644 --- a/app/Model/DetectionProject.php +++ b/app/Model/DetectionProject.php @@ -16,6 +16,7 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property int $company_id 合作公司id * @property string $detection_project_price 检测价格 * @property string $img_path 内容图片地址 + * @property string $informed_consent_form 知情同意书 * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 */ @@ -31,7 +32,7 @@ class DetectionProject extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['detection_project_id', 'detection_project_title', 'detection_project_name', 'company_id', 'detection_project_price', 'img_path', 'created_at', 'updated_at']; + protected array $fillable = ['detection_project_id', 'detection_project_title', 'detection_project_name', 'company_id', 'detection_project_price', 'img_path', 'informed_consent_form', 'created_at', 'updated_at']; protected string $primaryKey = "detection_project_id"; diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index 52de0a3..8864619 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -219,24 +219,13 @@ class UserDoctor extends Model { $query = self::with([ "Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id", - "DoctorExpertise", +// "DoctorExpertise", "DoctorInquiryConfig" => function ($query) use ($sort_order) { - if ($sort_order == 1) { - // 综合-价格从低到高 - $query->orderBy('inquiry_price', 'asc'); - } elseif ($sort_order == 3) { - // 价格从低到高 - $query->orderBy('inquiry_price', 'asc'); - } elseif ($sort_order == 4) { - // 价格从高到低 - $query->orderBy('inquiry_price', 'desc'); - } + $query->whereIn('inquiry_type', [1, 3]) + ->where('inquiry_mode', 1); }, ]) ->where($doctor_params) - ->whereHas('Hospital', function ($query) use ($hospital_params) { - $query->where($hospital_params); - }) ->when($keyword, function ($query, $keyword) { $query->where(function ($query) use ($keyword) { $query->orwhere("user_name", 'like', '%' . $keyword . '%'); @@ -246,44 +235,83 @@ class UserDoctor extends Model }); }); }) - ->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) { - $query->where($doctor_expertise_params); + ->whereHas('Hospital', function ($query) use ($hospital_params) { + $query->where($hospital_params); }) +// ->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) { +// $query->where($doctor_expertise_params); +// }) ->whereHas('DoctorInquiryConfig', function ($query) { $params = array(); $params['inquiry_mode'] = 1;// 接诊方式:图文 $query->where($params)->whereIn('inquiry_type', [1, 3]); - }) - ->when($sort_order, function ($query, $sort_order) { - if ($sort_order == 1) { - $query->orderBy('is_recommend', 'desc');// 是否首页推荐(0:否 1:是) - $query->orderBy('avg_response_time', 'desc');// 响应时间快 - $query->orderBy('served_patients_num', 'desc');// 服务数从多到少 - $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 - } elseif ($sort_order == 2) { - // 响应时间快 - $query->orderBy('avg_response_time', 'asc'); - $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 - } elseif ($sort_order == 3) { - // 价格从低到高 - $query->orderBy('avg_response_time', 'asc'); - $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 - } elseif ($sort_order == 4) { - // 价格从高到低 - $query->orderBy('avg_response_time', 'desc'); - $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 - } elseif ($sort_order == 5) { - // 服务数从多到少 - $query->orderBy('served_patients_num', 'desc'); - $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 - } - return $query; - }) -// ->join('doctor_inquiry_config', 'user_doctor.doctor_id', '=', 'doctor_inquiry_config.doctor_id') -// ->groupBy("user_doctor.doctor_id") -// ->orderBy("doctor_inquiry_config.inquiry_price",'desc') - ->select("user_doctor.*"); + }); +// ->when($sort_order, function ($query, $sort_order) { +// if ($sort_order == 1) { +// $query->orderBy('is_recommend', 'desc');// 是否首页推荐(0:否 1:是) +// $query->orderBy('avg_response_time', 'desc');// 响应时间快 +// $query->orderBy('served_patients_num', 'desc');// 服务数从多到少 +// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 +// } elseif ($sort_order == 2) { +// // 响应时间快 +// $query->orderBy('avg_response_time', 'asc'); +// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 +// } elseif ($sort_order == 3) { +// // 价格从低到高 +// $query->orderBy('avg_response_time', 'asc'); +// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 +// } elseif ($sort_order == 4) { +// // 价格从高到低 +// $query->orderBy('avg_response_time', 'desc'); +// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 +// } elseif ($sort_order == 5) { +// // 服务数从多到少 +// $query->orderBy('served_patients_num', 'desc'); +// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 +// } +// return $query; +// }); + if (!empty($sort_order)){ + if (in_array($sort_order,[1,3,4])){ + $query = $query->join('doctor_inquiry_config', function ($query) { + $query->on('user_doctor.doctor_id', '=', 'doctor_inquiry_config.doctor_id') + ->whereIn('inquiry_type', [1, 3]) + ->where('inquiry_mode', 1) + ->orderBy('inquiry_price', 'desc') + ->take(1); + }) + ->select("user_doctor.*") + ->groupBy("user_doctor.doctor_id"); + } + + if ($sort_order == 1) { + // 综合-价格从低到高 + $query->orderBy('is_recommend', 'desc');// 是否首页推荐(0:否 1:是) + $query->orderBy('avg_response_time', 'asc');// 响应时间快 + $query->orderBy('served_patients_num', 'desc');// 服务数从多到少 + $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 + $query->orderBy('doctor_inquiry_config.inquiry_price', 'asc'); + } elseif ($sort_order == 2) { + // 响应时间快 + $query->orderBy('avg_response_time', 'asc'); + $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 + } elseif ($sort_order == 3) { + // 价格从低到高 + $query->orderBy('doctor_inquiry_config.inquiry_price', 'asc'); + $query->orderBy('avg_response_time', 'asc'); + $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 + } elseif ($sort_order == 4) { + // 价格从高到低 + $query->orderBy('doctor_inquiry_config.inquiry_price', 'desc'); + $query->orderBy('avg_response_time', 'asc'); + $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 + } elseif ($sort_order == 5) { + // 服务数从多到少 + $query->orderBy('served_patients_num', 'desc'); + $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 + } + } $result = $query->paginate($per_page, $fields, "page", $page); @@ -297,6 +325,8 @@ class UserDoctor extends Model return $data; } + + /** * 获取是否存在 * @param array $params diff --git a/config/autoload/server.php b/config/autoload/server.php index c36d7fc..da29ba9 100644 --- a/config/autoload/server.php +++ b/config/autoload/server.php @@ -37,7 +37,7 @@ return [ Constant::OPTION_MAX_REQUEST => 100000, Constant::OPTION_SOCKET_BUFFER_SIZE => 2 * 1024 * 1024, Constant::OPTION_BUFFER_OUTPUT_SIZE => 2 * 1024 * 1024, - Constant::OPTION_PACKAGE_MAX_LENGTH => 5 * 1024 * 1024, + Constant::OPTION_PACKAGE_MAX_LENGTH => 5 * 1024 * 1024, // 接收数据包的最大长度 ], 'callbacks' => [ Event::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'], diff --git a/extend/Detection/Base.php b/extend/Detection/Base.php index 70f417a..8314228 100644 --- a/extend/Detection/Base.php +++ b/extend/Detection/Base.php @@ -63,6 +63,7 @@ class Base /** * 请求封装 * @param string $sign + * @param $path * @param array $arg 请求参数 * @return array * @throws GuzzleException @@ -82,9 +83,8 @@ class Base // 打印使用 $l = $arg; unset($l['json']['pictureOfDetectionTube']); - dump($l); - Log::getInstance("请求参数")->info(json_encode($arg,JSON_UNESCAPED_UNICODE)); + Log::getInstance("请求参数")->info(json_encode($l,JSON_UNESCAPED_UNICODE)); $response = $this->client->post($path, $arg); if ($response->getStatusCode() != '200'){ diff --git a/extend/Detection/Wy.php b/extend/Detection/Wy.php index 7a233cb..0f9b978 100644 --- a/extend/Detection/Wy.php +++ b/extend/Detection/Wy.php @@ -179,7 +179,6 @@ class Wy extends Base $path = $this->request_url . "api/sdInternet/v1/externalData/saveOrder"; try { $response = $this->httpRequest($sign,$path,$option); - dump($response); if (empty($response)){ // 返回值错误为空 throw new BusinessException(""); From 8ebda591e604d218dc675ed189af15617882b9d3 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 16 Aug 2023 16:44:42 +0800 Subject: [PATCH 074/176] =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A4=87=E6=B3=A8=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/UserDoctor.php | 8 +- app/Services/PatientDoctorService.php | 106 +++++++++++++------------- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index 8864619..6774413 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -219,7 +219,7 @@ class UserDoctor extends Model { $query = self::with([ "Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id", -// "DoctorExpertise", + "DoctorExpertise", "DoctorInquiryConfig" => function ($query) use ($sort_order) { $query->whereIn('inquiry_type', [1, 3]) ->where('inquiry_mode', 1); @@ -238,9 +238,9 @@ class UserDoctor extends Model ->whereHas('Hospital', function ($query) use ($hospital_params) { $query->where($hospital_params); }) -// ->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) { -// $query->where($doctor_expertise_params); -// }) + ->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) { + $query->where($doctor_expertise_params); + }) ->whereHas('DoctorInquiryConfig', function ($query) { $params = array(); $params['inquiry_mode'] = 1;// 接诊方式:图文 diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index cdff3cd..87db426 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -93,59 +93,59 @@ class PatientDoctorService extends BaseService $user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params, $sort_order, $fields,$page,$per_page); // 处理数据 -// if (!empty($user_doctors['data'])) { -// foreach ($user_doctors['data'] as &$user_doctor) { -// $user_doctor['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']); -// -// // 处理医生专长 -// if (!empty($user_doctor['DoctorExpertise'])) { -// foreach ($user_doctor['DoctorExpertise'] as &$data) { -// if (!empty($data['DiseaseClassExpertise'])) { -// $data['expertise_name'] = $data['DiseaseClassExpertise']['expertise_name']; -// } -// unset($data['DiseaseClassExpertise']); -// } -// } -// -// // 处理问诊价格 -// $user_doctor['price'] = 0; -// $user_doctor['free_clinic_price'] = 0; -// if (!empty($user_doctor['DoctorInquiryConfig'])) { -// foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { -// if ($doctor_inquiry_config['inquiry_mode'] == 1) { -// if ($doctor_inquiry_config['inquiry_type'] == 1) { -// // 专家 -// $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; -// } -// if ($doctor_inquiry_config['inquiry_type'] == 3) { -// // 公益 -// $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; -// } -// } -// } -// unset($user_doctor['DoctorInquiryConfig']); -// } -// -// // 好评率-超过5个已结束的订单后展示 -// $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; -// // 响应时间-超过5个已结束的订单后展示 -// $user_doctor['avg_response_time'] = (float)floor($user_doctor['avg_response_time'] * 10) / 10; -// -// // 获取医生订单数 -// $params = array(); -// $params['doctor_id'] = $user_doctor['doctor_id']; -// $params['inquiry_status'] = 6; // 已结束 -// $inquiry_order_count = OrderInquiry::getCount($params); -// if (empty($inquiry_order_count) || $inquiry_order_count == 0) { -// $user_doctor['is_display_score'] = false; -// } else { -// $user_doctor['is_display_score'] = true; -// } -// -// // 头像 -// $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); -// } -// } + if (!empty($user_doctors['data'])) { + foreach ($user_doctors['data'] as &$user_doctor) { + $user_doctor['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']); + + // 处理医生专长 + if (!empty($user_doctor['DoctorExpertise'])) { + foreach ($user_doctor['DoctorExpertise'] as &$data) { + if (!empty($data['DiseaseClassExpertise'])) { + $data['expertise_name'] = $data['DiseaseClassExpertise']['expertise_name']; + } + unset($data['DiseaseClassExpertise']); + } + } + + // 处理问诊价格 + $user_doctor['price'] = 0; + $user_doctor['free_clinic_price'] = 0; + if (!empty($user_doctor['DoctorInquiryConfig'])) { + foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { + if ($doctor_inquiry_config['inquiry_mode'] == 1) { + if ($doctor_inquiry_config['inquiry_type'] == 1) { + // 专家 + $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; + } + if ($doctor_inquiry_config['inquiry_type'] == 3) { + // 公益 + $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; + } + } + } + unset($user_doctor['DoctorInquiryConfig']); + } + + // 好评率-超过5个已结束的订单后展示 + $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; + // 响应时间-超过5个已结束的订单后展示 + $user_doctor['avg_response_time'] = (float)floor($user_doctor['avg_response_time'] * 10) / 10; + + // 获取医生订单数 + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_status'] = 6; // 已结束 + $inquiry_order_count = OrderInquiry::getCount($params); + if (empty($inquiry_order_count) || $inquiry_order_count == 0) { + $user_doctor['is_display_score'] = false; + } else { + $user_doctor['is_display_score'] = true; + } + + // 头像 + $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); + } + } return success($user_doctors); } From 328aa2bf500b349a0a46ae0564e9a0c45b811273 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 16 Aug 2023 16:45:09 +0800 Subject: [PATCH 075/176] =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/UserDoctor.php | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index 6774413..741c5af 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -246,31 +246,6 @@ class UserDoctor extends Model $params['inquiry_mode'] = 1;// 接诊方式:图文 $query->where($params)->whereIn('inquiry_type', [1, 3]); }); -// ->when($sort_order, function ($query, $sort_order) { -// if ($sort_order == 1) { -// $query->orderBy('is_recommend', 'desc');// 是否首页推荐(0:否 1:是) -// $query->orderBy('avg_response_time', 'desc');// 响应时间快 -// $query->orderBy('served_patients_num', 'desc');// 服务数从多到少 -// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 -// } elseif ($sort_order == 2) { -// // 响应时间快 -// $query->orderBy('avg_response_time', 'asc'); -// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 -// } elseif ($sort_order == 3) { -// // 价格从低到高 -// $query->orderBy('avg_response_time', 'asc'); -// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 -// } elseif ($sort_order == 4) { -// // 价格从高到低 -// $query->orderBy('avg_response_time', 'desc'); -// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 -// } elseif ($sort_order == 5) { -// // 服务数从多到少 -// $query->orderBy('served_patients_num', 'desc'); -// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 -// } -// return $query; -// }); if (!empty($sort_order)){ if (in_array($sort_order,[1,3,4])){ From bea292cd5eb9c4c23fea0459268ce90fee64aa4c Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 17 Aug 2023 09:27:46 +0800 Subject: [PATCH 076/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=9C=AA=E6=8E=A5=E8=AF=8A=E8=AE=A2=E5=8D=95=E4=B8=BA10?= =?UTF-8?q?=E5=88=86=E9=92=9F=EF=BC=88=E5=8E=9F5=E5=88=86=E9=92=9F?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php b/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php index 8fef432..b761dee 100644 --- a/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php +++ b/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php @@ -244,7 +244,7 @@ class AssignDoctorDelayDirectConsumer extends ConsumerMessage $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; $message = new CancelUnInquiryOrdersDelayDirectProducer($data); // 快速/购药-5分钟 - $message->setDelayMs(1000 * 60 * 5); + $message->setDelayMs(1000 * 60 * 10); $producer = $this->container->get(Producer::class); $res = $producer->produce($message); if (!$res) { From 857536e8bd9f06e6366113e99079cda19b8cde4e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 17 Aug 2023 13:49:17 +0800 Subject: [PATCH 077/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=8C=BB=E7=94=9F?= =?UTF-8?q?xx=E6=97=B6=E9=97=B4=E6=9C=AA=E6=8E=A5=E8=AF=8A=E6=8F=90?= =?UTF-8?q?=E9=86=92=E9=98=9F=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssignDoctorDelayDirectConsumer.php | 17 ++- ...ncelUnInquiryOrdersDelayDirectConsumer.php | 1 + .../CancelUnpayOrdersDelayDirectConsumer.php | 2 +- ...DoctorNotYetInquiryDelayDirectConsumer.php | 80 ++++++++++++ ...DoctorNotYetInquiryDelayDirectProducer.php | 30 +++++ app/Controller/CallBackController.php | 11 ++ app/Controller/UserController.php | 5 +- app/Services/MessagePush.php | 115 ++++++++---------- app/Services/PatientOrderService.php | 11 ++ config/routes.php | 3 + 10 files changed, 208 insertions(+), 67 deletions(-) create mode 100644 app/Amqp/Consumer/DoctorNotYetInquiryDelayDirectConsumer.php create mode 100644 app/Amqp/Producer/DoctorNotYetInquiryDelayDirectProducer.php diff --git a/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php b/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php index b761dee..d997003 100644 --- a/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php +++ b/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php @@ -6,6 +6,7 @@ namespace App\Amqp\Consumer; use App\Amqp\Producer\AssignDoctorDelayDirectProducer; use App\Amqp\Producer\CancelUnInquiryOrdersDelayDirectProducer; +use App\Amqp\Producer\DoctorNotYetInquiryDelayDirectProducer; use App\Amqp\Producer\UserCouponExpiredDelayDirectProducer; use App\Constants\HttpEnumCode; use App\Model\OrderInquiry; @@ -131,8 +132,8 @@ class AssignDoctorDelayDirectConsumer extends ConsumerMessage } // 检测分配时间 - if ($diff_time > 300) { - Log::getInstance("queue-AssignDoctor")->info("信息:超出5分钟,执行退款"); + if ($diff_time > 600) { + Log::getInstance("queue-AssignDoctor")->info("信息:超出10分钟,执行退款"); $InquiryService = new InquiryService(); @@ -284,6 +285,16 @@ class AssignDoctorDelayDirectConsumer extends ConsumerMessage // 医生-医生有新问诊 站内、订阅失败发送短信 $MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']); $MessagePush->doctorHaveNewInquiry(); + + // 加入xx时间未接诊通知队列 + $data = array(); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + $time = 1000 * 60 * 3; + $message = new DoctorNotYetInquiryDelayDirectProducer($data); + $message->setDelayMs($time); + $producer = $this->container->get(Producer::class); + $producer->produce($message); }catch (\Throwable $e){ Log::getInstance("queue-AssignDoctor")->error("发送消息异常错误:" . $e->getMessage()); return Result::ACK; @@ -355,7 +366,7 @@ class AssignDoctorDelayDirectConsumer extends ConsumerMessage } // 执行次数过多 - if ($redis_value > 3) { + if ($redis_value > 4) { // 加入短信队列,通知管理员 return false; diff --git a/app/Amqp/Consumer/CancelUnInquiryOrdersDelayDirectConsumer.php b/app/Amqp/Consumer/CancelUnInquiryOrdersDelayDirectConsumer.php index 028219b..9480f76 100644 --- a/app/Amqp/Consumer/CancelUnInquiryOrdersDelayDirectConsumer.php +++ b/app/Amqp/Consumer/CancelUnInquiryOrdersDelayDirectConsumer.php @@ -151,6 +151,7 @@ class CancelUnInquiryOrdersDelayDirectConsumer extends ConsumerMessage $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)) { Log::getInstance()->info("取消未接诊问诊订单成功,发送IM消息失败:医生数据错误"); + return Result::ACK; } // 发送IM消息-医生未接诊 diff --git a/app/Amqp/Consumer/CancelUnpayOrdersDelayDirectConsumer.php b/app/Amqp/Consumer/CancelUnpayOrdersDelayDirectConsumer.php index b945f92..0f49592 100644 --- a/app/Amqp/Consumer/CancelUnpayOrdersDelayDirectConsumer.php +++ b/app/Amqp/Consumer/CancelUnpayOrdersDelayDirectConsumer.php @@ -49,7 +49,7 @@ class CancelUnpayOrdersDelayDirectConsumer extends ConsumerMessage public function consumeMessage($data, AMQPMessage $message): string { - Log::getInstance("queue-CancelUnpayOrders")->error("开始执行 取消未支付订单 队列:" . json_encode($data, JSON_UNESCAPED_UNICODE)); + Log::getInstance("queue-CancelUnpayOrders")->info("开始执行 取消未支付订单 队列:" . json_encode($data, JSON_UNESCAPED_UNICODE)); Db::beginTransaction(); diff --git a/app/Amqp/Consumer/DoctorNotYetInquiryDelayDirectConsumer.php b/app/Amqp/Consumer/DoctorNotYetInquiryDelayDirectConsumer.php new file mode 100644 index 0000000..cdf6894 --- /dev/null +++ b/app/Amqp/Consumer/DoctorNotYetInquiryDelayDirectConsumer.php @@ -0,0 +1,80 @@ +info("开始:" . json_encode($data, JSON_UNESCAPED_UNICODE)); + + if (!isset($data['order_inquiry_id'])){ + Log::getInstance("queue-DoctorNotYetInquiry")->error("缺少参数"); + return Result::ACK; + } + + try { + // 获取问诊订单数据 + $params = array(); + $params['order_inquiry_id'] = $data['order_inquiry_id']; + $order_inquiry = OrderInquiry::getOne($params); + if (empty($order_inquiry)){ + Log::getInstance("queue-DoctorNotYetInquiry")->error("未找到对应问诊订单"); + return Result::ACK; + } + + // 检测问诊订单状态 + if ($order_inquiry['inquiry_status'] != 3){ + Log::getInstance("queue-DoctorNotYetInquiry")->error("状态非待接诊,无需发送"); + return Result::ACK; + } + + // 获取订单医生数据 + $params = array(); + $params['doctor_id'] = $order_inquiry['doctor_id']; + $user_doctor = UserDoctor::getOne($params); + if (empty($user_doctor)) { + Log::getInstance("queue-DoctorNotYetInquiry")->error("医生数据错误"); + } + + // 发送站内、订阅消息-医生-超时未接诊 + $MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']); + $MessagePush->doctorNotYetInquiry(); + }catch (\Throwable $e){ + Log::getInstance("queue-DoctorNotYetInquiry")->error("失败:" . $e->getMessage()); + return Result::ACK; + } + + return Result::ACK; + } +} diff --git a/app/Amqp/Producer/DoctorNotYetInquiryDelayDirectProducer.php b/app/Amqp/Producer/DoctorNotYetInquiryDelayDirectProducer.php new file mode 100644 index 0000000..ffe1d5b --- /dev/null +++ b/app/Amqp/Producer/DoctorNotYetInquiryDelayDirectProducer.php @@ -0,0 +1,30 @@ +payload = $data; + } +} diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 892a6d8..242e8cf 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -4,6 +4,7 @@ namespace App\Controller; use App\Amqp\Producer\AssignDoctorDelayDirectProducer; use App\Amqp\Producer\AutoCompleteInquiryDelayDirectProducer; +use App\Amqp\Producer\DoctorNotYetInquiryDelayDirectProducer; use App\Constants\DoctorTitleCode; use App\Constants\HttpEnumCode; use App\Exception\BusinessException; @@ -196,6 +197,16 @@ class CallBackController extends AbstractController $MessagePush = new MessagePush($user_doctor['user_id'], $order_inquiry['order_inquiry_id']); $MessagePush->doctorHaveNewInquiry(); + // 加入xx时间未接诊通知队列 + $data = array(); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + $time = 1000 * 60 * 60 * 2; + $message = new DoctorNotYetInquiryDelayDirectProducer($data); + $message->setDelayMs($time); + $producer = $this->container->get(Producer::class); + $producer->produce($message); + Log::getInstance()->info("发送im消息成功"); } } diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index b1a680b..d161ca9 100644 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -168,7 +168,10 @@ class UserController extends AbstractController return $this->response->json($data); } - // 上报用户地址 + /** + * 上报用户地址 + * @return ResponseInterface + */ public function postLocation(): ResponseInterface { $UserService = new UserService(); diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 2ddc7b7..910421a 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -1178,78 +1178,69 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败:问诊病例为空"); } - if ($this->push_type == 1) { - // 站内 - $data = array(); - $data['user_id'] = $this->user['user_id']; - $data['notice_type'] = 1; - $data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) - $data['from_name'] = "肝胆小秘书"; - $data['notice_brief_title'] = "{$this->order_inquiry['patient_name']}患者的问诊您还未接诊,请注意查看。"; - $data['notice_title'] = "{$this->order_inquiry['patient_name']}患者的问诊您还未接诊,请注意查看。"; - $data['notice_content'] = "{$this->order_inquiry['patient_name']}患者的问诊您还未接诊,请注意查看。"; - $data['link_type'] = 1; // 聊天详情页 + // 站内 + $data = array(); + $data['user_id'] = $this->user['user_id']; + $data['notice_type'] = 1; + $data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) + $data['from_name'] = "肝胆小秘书"; + $data['notice_brief_title'] = "{$this->order_inquiry['patient_name']}患者的问诊您还未接诊,请注意查看。"; + $data['notice_title'] = "{$this->order_inquiry['patient_name']}患者的问诊您还未接诊,请注意查看。"; + $data['notice_content'] = "{$this->order_inquiry['patient_name']}患者的问诊您还未接诊,请注意查看。"; + $data['link_type'] = 1; // 聊天详情页 - $link_params = array(); - $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; - $link_params['inquiry_type'] = $this->order_inquiry['inquiry_type']; - $link_params['doctor_user_id'] = $this->user['user_id']; - $link_params['patient_user_id'] = $this->order_inquiry['user_id']; - $data['link_params'] = json_encode($link_params, JSON_UNESCAPED_UNICODE);// 跳转参数 + $link_params = array(); + $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; + $link_params['inquiry_type'] = $this->order_inquiry['inquiry_type']; + $link_params['doctor_user_id'] = $this->user['user_id']; + $link_params['patient_user_id'] = $this->order_inquiry['user_id']; + $data['link_params'] = json_encode($link_params, JSON_UNESCAPED_UNICODE);// 跳转参数 - $message = new SendStationMessageProducer($data); - $producer = ApplicationContext::getContainer()->get(Producer::class); - $result = $producer->produce($message); - if (!$result) { - throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); - } - } elseif ($this->push_type == 2) { - // 订阅 - $inquiry_type = inquiryTypeToString($this->order_inquiry['inquiry_type']); + $message = new SendStationMessageProducer($data); + $producer = ApplicationContext::getContainer()->get(Producer::class); + $result = $producer->produce($message); + if (!$result) { + Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); + } - $sub_data = array(); - $sub_data['push_user_id'] = $this->user['user_id']; - $sub_data['wx_template_id'] = "G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc"; // 咨询提醒 - $sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen"; - $sub_data['params']['data'] = [ - "thing1" => "您好医生,{$this->order_inquiry['patient_name']}患者的({$inquiry_type})服务您还未接诊;",// 提醒内容 + $inquiry_type = inquiryTypeToString($this->order_inquiry['inquiry_type']); - "name2" => $this->order_inquiry['patient_name'],// 患者姓名 + // 订阅 + $sub_data = array(); + $sub_data['push_user_id'] = $this->user['user_id']; + $sub_data['wx_template_id'] = "G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc"; // 咨询提醒 + $sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen"; + $sub_data['params']['data'] = [ + "thing1" => "您好医生,{$this->order_inquiry['patient_name']}患者的({$inquiry_type})服务您还未接诊;",// 提醒内容 + "name2" => $this->order_inquiry['patient_name'],// 患者姓名 + "thing4" => mb_substr($order_inquiry_case['disease_desc'], 0, 18),// 病情描述 + "thing6" => "24小时内未接诊,平台将自动取消问诊。",// 提示说明 + "thing5" => "",// 咨询内容 + ]; - "thing4" => mb_substr($order_inquiry_case['disease_desc'], 0, 18),// 病情描述 + $sms_data = array(); + $sms_data['template_code'] = "SMS_272SMS_271905266120097"; + $sms_data['scene_desc'] = "医生xx时间后还未接诊"; + $sms_data['phone'] = $this->user['mobile']; + $sms_data['user_id'] = $this->user['user_id']; - "thing6" => "24小时内未接诊,平台将自动取消问诊。",// 提示说明 + $template_param = array(); + $template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']); + $template_param['name'] = $this->order_inquiry['patient_name']; + $sms_data['template_param'] = $template_param; - "thing5" => "",// 咨询内容 - - ]; - - // 短信 - $sms_data = array(); - $sms_data['template_code'] = "SMS_271905266"; - $sms_data['scene_desc'] = "医生xx时间后还未接诊"; - $sms_data['phone'] = $this->user['mobile']; - $sms_data['user_id'] = $this->user['user_id']; - - $template_param = array(); - $template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']); - $template_param['name'] = $this->order_inquiry['patient_name']; - $sms_data['template_param'] = $template_param; - - $data = array(); - $data['sub_data'] = $sub_data; - $data['sms_data'] = $sms_data; - - $message = new SendSubMessageProducer($data); - $producer = ApplicationContext::getContainer()->get(Producer::class); - $result = $producer->produce($message); - if (!$result) { - throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); - } + $data = array(); + $data['sub_data'] = $sub_data; + $data['sms_data'] = $sms_data; + $message = new SendSubMessageProducer($data); + $producer = ApplicationContext::getContainer()->get(Producer::class); + $result = $producer->produce($message); + if (!$result) { + Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { - throw new BusinessException("加入推送队列失败" . $e->getMessage()); + Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } return true; diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index b1488a3..af1bc09 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -4,6 +4,7 @@ namespace App\Services; use App\Amqp\Producer\AssignDoctorDelayDirectProducer; use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer; +use App\Amqp\Producer\DoctorNotYetInquiryDelayDirectProducer; use App\Constants\DoctorTitleCode; use App\Constants\HttpEnumCode; use App\Model\BasicLogisticsCompany; @@ -985,6 +986,16 @@ class PatientOrderService extends BaseService $MessagePush = new MessagePush($user_doctor['user_id'], $order_inquiry['order_inquiry_id']); $MessagePush->doctorHaveNewInquiry(); + // 加入xx时间未接诊通知队列 + $data = array(); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + $time = 1000 * 60 * 60 * 2; + $message = new DoctorNotYetInquiryDelayDirectProducer($data); + $message->setDelayMs($time); + $producer = $this->container->get(Producer::class); + $producer->produce($message); + Log::getInstance()->info("发送im消息成功"); } diff --git a/config/routes.php b/config/routes.php index 4b562bc..57b50d7 100644 --- a/config/routes.php +++ b/config/routes.php @@ -686,6 +686,9 @@ Router::addGroup('/user', function () { // 上报用户地址 Router::post('/location', [UserController::class, 'postLocation']); +// +// // 获取用户地址 +// Router::get('/location', [UserController::class, 'getLocation']); }); // 获取患者问诊病例 From 46cee4c1dfa4ac13af448ad467344ecbac1f2a39 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 17 Aug 2023 13:54:21 +0800 Subject: [PATCH 078/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=8C=BB=E7=94=9F?= =?UTF-8?q?xx=E6=97=B6=E9=97=B4=E6=9C=AA=E6=8E=A5=E8=AF=8A=E6=8F=90?= =?UTF-8?q?=E9=86=92=E9=98=9F=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/MessagePush.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 910421a..d41779c 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -1219,7 +1219,7 @@ class MessagePush extends BaseService ]; $sms_data = array(); - $sms_data['template_code'] = "SMS_272SMS_271905266120097"; + $sms_data['template_code'] = "SMS_271905266"; $sms_data['scene_desc'] = "医生xx时间后还未接诊"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; From 9a2cb728483b3723a216aaae4a8e93d645b50cca Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 17 Aug 2023 13:58:49 +0800 Subject: [PATCH 079/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=89=80=E6=97=B6=EF=BC=8C=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/Detection/Wy.php | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/extend/Detection/Wy.php b/extend/Detection/Wy.php index 0f9b978..0927481 100644 --- a/extend/Detection/Wy.php +++ b/extend/Detection/Wy.php @@ -117,26 +117,29 @@ class Wy extends Base $oss = new Oss(); $pics = []; - $detection_pics = explode(',',$order_detection['detection_pic']); - foreach ($detection_pics as $key => $value){ - // 去除用户签名图片第一个/ oss不识别 - $value = substr($value, 1, strlen($value) - 1); + if (!empty($order_detection['detection_pic'])){ + $detection_pics = explode(',',$order_detection['detection_pic']); + foreach ($detection_pics as $key => $value){ + // 去除用户签名图片第一个/ oss不识别 + $value = substr($value, 1, strlen($value) - 1); - $pic = $oss->getObjectToRAM($value); - if (empty($pic)){ - throw new BusinessException("检测管图片错误"); + $pic = $oss->getObjectToRAM($value); + if (empty($pic)){ + throw new BusinessException("检测管图片错误"); + } + + $pic = base64_encode($pic); + if (!$pic) { + throw new BusinessException("检测管图片下载失败"); + } + + $pics[$key]['pictureNo'] = $key + 1; // 图片序号 + $pics[$key]['pictureName'] = "检测管图片"; // 图片名称 + $pics[$key]['pictureInfo'] = $pic; // 对图片进行base64后的编码 } - - $pic = base64_encode($pic); - if (!$pic) { - throw new BusinessException("检测管图片下载失败"); - } - - $pics[$key]['pictureNo'] = $key + 1; // 图片序号 - $pics[$key]['pictureName'] = "检测管图片"; // 图片名称 - $pics[$key]['pictureInfo'] = $pic; // 对图片进行base64后的编码 } + // 获取签名 $sign = $this->getSign(); From c1c68f24c2eb5825f37f07036398bb41a6eb4b1c Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 17 Aug 2023 17:34:03 +0800 Subject: [PATCH 080/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=89=80=E6=97=B6=EF=BC=8C=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DetectionService.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 6fd2aff..c1c8575 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -538,9 +538,7 @@ class DetectionService extends BaseService $detection_pic = PcreMatch::pregRemoveOssWebsite($detection_pic); } - if (!isset($detection_pic)){ - return fail(HttpEnumCode::HTTP_ERROR,"上传图片失败"); - } + // 检测检测管编码是否已被使用 $params = array(); @@ -568,7 +566,10 @@ class DetectionService extends BaseService try { // 修改检测订单 $data = array(); - $data['detection_pic'] = $detection_pic; + if (isset($detection_pic)){ + $data['detection_pic'] = $detection_pic; + } + $data['detection_bar_code'] = $request_params['detection_bar_code']; $data['detection_status'] = 3; $data['detection_organ_id'] = $basic_detection_organ['detection_organ_id'];// 检测机构id From b9d3cd09a3cc230290078ca6d03dac99eed5ded2 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 22 Aug 2023 16:32:48 +0800 Subject: [PATCH 081/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/UserService.php | 1 + extend/Tencent/map/Location.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Services/UserService.php b/app/Services/UserService.php index 17f3604..8fa73d7 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -614,6 +614,7 @@ class UserService extends BaseService } } }catch (\Exception $e){ + dump($e->getMessage()); return success(); } diff --git a/extend/Tencent/map/Location.php b/extend/Tencent/map/Location.php index d8b8838..b455569 100644 --- a/extend/Tencent/map/Location.php +++ b/extend/Tencent/map/Location.php @@ -66,7 +66,7 @@ class Location { $query = [ "key" => config("tencent_map.secret"), - "location" => $lon . "," . $lat, + "location" => $lat . "," . $lon, ]; $path = "https://apis.map.qq.com" . $this->getSign("/ws/geocoder/v1",$query); From a6a423f7200bfb844818d885c57a63682450816e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 22 Aug 2023 17:16:25 +0800 Subject: [PATCH 082/176] 1 --- app/Model/OrderDetection.php | 11 +++++++++++ app/Services/DetectionService.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Model/OrderDetection.php b/app/Model/OrderDetection.php index a367b07..c5c73bf 100644 --- a/app/Model/OrderDetection.php +++ b/app/Model/OrderDetection.php @@ -72,6 +72,17 @@ class OrderDetection extends Model return self::where($params)->first($fields); } + /** + * 获取信息-单条 + * @param array $params + * @param array $fields + * @return object|null + */ + public static function getLastOne(array $params, array $fields = ['*']): object|null + { + return self::where($params)->latest($fields); + } + /** * 获取数据-多 * @param array $params diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index c1c8575..c45fd0a 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -487,7 +487,7 @@ class DetectionService extends BaseService $params = array(); $params['patient_id'] = $user_info['client_user_id']; $params['family_id'] = $family_id; - $order_detection = OrderDetection::getOne($params); + $order_detection = OrderDetection::getLastOne($params); if (empty($order_detection)){ return success(); } From 53f87c96a90b1482648f87ed8db3dd948003d896 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 22 Aug 2023 17:33:35 +0800 Subject: [PATCH 083/176] 1 --- app/Model/OrderDetection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Model/OrderDetection.php b/app/Model/OrderDetection.php index c5c73bf..b2da6ba 100644 --- a/app/Model/OrderDetection.php +++ b/app/Model/OrderDetection.php @@ -6,6 +6,7 @@ namespace App\Model; +use Hyperf\Database\Model\Builder; use Hyperf\Database\Model\Collection; use Hyperf\Snowflake\Concern\Snowflake; @@ -80,7 +81,7 @@ class OrderDetection extends Model */ public static function getLastOne(array $params, array $fields = ['*']): object|null { - return self::where($params)->latest($fields); + return self::where($params)->latest()->first($fields); } /** From 4bb1e72d7887b461520fc9eeed0a6bad325f6e74 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 23 Aug 2023 09:11:53 +0800 Subject: [PATCH 084/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E4=B8=AD=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DetectionService.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index c45fd0a..4cfe04e 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -492,7 +492,12 @@ class DetectionService extends BaseService return success(); } - return success($order_detection['detection_no']); + if ($order_detection['detection_status'] != 4 || $order_detection['detection_status'] != 5){ + // 检测完成-已取消 + return success($order_detection['detection_no']); + } + + return success(); } /** From 7cf3bed599627226d2e6ad6c4f2e1d71f3c32c4e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 23 Aug 2023 09:25:29 +0800 Subject: [PATCH 085/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E4=B8=AD=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Request/DetectionRequest.php | 1 + app/Services/DetectionService.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/Request/DetectionRequest.php b/app/Request/DetectionRequest.php index 1bb503a..34694bd 100644 --- a/app/Request/DetectionRequest.php +++ b/app/Request/DetectionRequest.php @@ -23,6 +23,7 @@ class DetectionRequest extends FormRequest ], 'getDetectionOrderFirst' => [ // 获取患者进行中的检测订单 'family_id', + 'detection_project_id', ], 'bindDetectionTube' => [ // 绑定检测管 'detection_bar_code', diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 4cfe04e..142d6ac 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -482,11 +482,13 @@ class DetectionService extends BaseService $user_info = $this->request->getAttribute("userInfo") ?? []; $family_id = $this->request->input("family_id"); + $detection_project_id = $this->request->input("detection_project_id"); // 检测是否存在同类型未完成的检测订单 $params = array(); $params['patient_id'] = $user_info['client_user_id']; $params['family_id'] = $family_id; + $params['detection_project_id'] = $detection_project_id; $order_detection = OrderDetection::getLastOne($params); if (empty($order_detection)){ return success(); From 544d62ec7d67a581949f250397f5de901980d991 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 23 Aug 2023 09:58:07 +0800 Subject: [PATCH 086/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E4=B8=AD=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DetectionService.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 142d6ac..d2357b3 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -489,13 +489,8 @@ class DetectionService extends BaseService $params['patient_id'] = $user_info['client_user_id']; $params['family_id'] = $family_id; $params['detection_project_id'] = $detection_project_id; - $order_detection = OrderDetection::getLastOne($params); - if (empty($order_detection)){ - return success(); - } - - if ($order_detection['detection_status'] != 4 || $order_detection['detection_status'] != 5){ - // 检测完成-已取消 + $order_detection = OrderDetection::getNotFinishedOrderDetectionOne($params); + if (!empty($order_detection)){ return success($order_detection['detection_no']); } From 9884afeee403e293ddb01f8f42c2256412a4a7c8 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 23 Aug 2023 10:19:20 +0800 Subject: [PATCH 087/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E4=B8=AD=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DetectionService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index d2357b3..1a1cb5d 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -494,7 +494,7 @@ class DetectionService extends BaseService return success($order_detection['detection_no']); } - return success(); + return success(""); } /** From c83a7c1874e4b614d754fb6f98ea3ecfba59dea9 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 23 Aug 2023 10:27:10 +0800 Subject: [PATCH 088/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD=E6=B0=91=E6=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientFamilyService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Services/PatientFamilyService.php b/app/Services/PatientFamilyService.php index 9aa2176..272ff2d 100644 --- a/app/Services/PatientFamilyService.php +++ b/app/Services/PatientFamilyService.php @@ -42,6 +42,7 @@ class PatientFamilyService extends BaseService 'card_name_mask', 'sex', 'age', + 'nation_id', ]; $patient_familys = PatientFamilyModel::getList($params, $field); From 9630e662338fa6422e7b0ebe3abfc7ac1e6602d6 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 23 Aug 2023 10:33:29 +0800 Subject: [PATCH 089/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/UserLocation.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Model/UserLocation.php b/app/Model/UserLocation.php index 5717387..2448f5f 100644 --- a/app/Model/UserLocation.php +++ b/app/Model/UserLocation.php @@ -7,6 +7,7 @@ namespace App\Model; use Hyperf\Database\Model\Collection; +use Hyperf\Snowflake\Concern\Snowflake; /** * @property int $user_location_id 主键id @@ -22,6 +23,8 @@ use Hyperf\Database\Model\Collection; */ class UserLocation extends Model { + use Snowflake; + /** * The table associated with the model. */ From b788dca5a2c45d6bb8eb1cb92e8cc527d5e61f38 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 23 Aug 2023 15:05:16 +0800 Subject: [PATCH 090/176] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A3=80=E6=B5=8B=E6=88=90=E5=8A=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/DetectionProject.php | 3 ++- app/Services/PatientOrderService.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Model/DetectionProject.php b/app/Model/DetectionProject.php index d33a28f..b84bfa7 100644 --- a/app/Model/DetectionProject.php +++ b/app/Model/DetectionProject.php @@ -15,6 +15,7 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property string $detection_project_name 检测项目名称 * @property int $company_id 合作公司id * @property string $detection_project_price 检测价格 + * @property int $detection_time 检测时间(小时) * @property string $img_path 内容图片地址 * @property string $informed_consent_form 知情同意书 * @property \Carbon\Carbon $created_at 创建时间 @@ -32,7 +33,7 @@ class DetectionProject extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['detection_project_id', 'detection_project_title', 'detection_project_name', 'company_id', 'detection_project_price', 'img_path', 'informed_consent_form', 'created_at', 'updated_at']; + protected array $fillable = ['detection_project_id', 'detection_project_title', 'detection_project_name', 'company_id', 'detection_project_price', 'detection_time', 'img_path', 'informed_consent_form', 'created_at', 'updated_at']; protected string $primaryKey = "detection_project_id"; diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index af1bc09..f771194 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1765,6 +1765,10 @@ class PatientOrderService extends BaseService $order_detection['detection_project_name'] = $detection_project['detection_project_name']; $order_detection['detection_result_pdf'] = addAliyunOssWebsite($order_detection['detection_result_pdf']); + // 检测成功时间 + $detection_success_time = date('Y-m-d',time() + 60 * 60 * $detection_project['detection_time']); + $order_detection['detection_success_time'] = $detection_success_time; + return success($order_detection); } From e56e4c2606be8d7ddc75acc194b6dbb82ac91efc Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 23 Aug 2023 16:50:26 +0800 Subject: [PATCH 091/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=82=A3=E8=80=85=E9=97=AE=E8=AF=8A=E7=97=85=E4=BE=8B=20?= =?UTF-8?q?=E7=9B=91=E6=B5=8B=E6=8A=A5=E5=91=8A=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 70a3b25..74bc462 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -400,6 +400,8 @@ class InquiryService extends BaseService return fail(); } + $order_inquiry_case = $order_inquiry_case->toArray(); + // 获取患者家庭成员信息表-基本信息 $params = array(); $params['family_id'] = $order_inquiry_case['family_id']; @@ -495,11 +497,9 @@ class InquiryService extends BaseService $order_inquiry_case['detection_project']['detection_link'] = ""; // 检测结果链接 } } - - } - return success($order_inquiry_case->toArray()); + return success($order_inquiry_case); } /** From fac54d32870b36c449cab381694713a33a6b9415 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 23 Aug 2023 17:19:17 +0800 Subject: [PATCH 092/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=9C=B0=E5=9D=80=E3=80=82=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=A3=80=E6=B5=8B=E6=9C=BA=E6=9E=84=E5=90=88?= =?UTF-8?q?=E4=BD=9C=E5=8C=BB=E7=94=9F=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E6=8B=86=E5=88=86=E4=B8=BA=E4=B8=A4=E4=B8=AA=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/DetectionController.php | 6 ++ app/Controller/UserController.php | 11 ++ app/Request/DetectionRequest.php | 10 ++ app/Services/DetectionService.php | 133 ++++++------------------- app/Services/UserService.php | 65 ++++++++++++ config/routes.php | 6 +- 6 files changed, 123 insertions(+), 108 deletions(-) diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php index 9cdba87..24b7e9e 100644 --- a/app/Controller/DetectionController.php +++ b/app/Controller/DetectionController.php @@ -3,6 +3,7 @@ namespace App\Controller; use App\Request\DetectionRequest; +use App\Request\UserRequest; use App\Services\DetectionService; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; @@ -35,9 +36,14 @@ class DetectionController extends AbstractController /** * 获取检测机构合作医生列表 * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ public function getDetectionDoctorList(): ResponseInterface { + $request = $this->container->get(DetectionRequest::class); + $request->scene('getDetectionDoctorList')->validateResolved(); + $detectionService = new DetectionService(); $data = $detectionService->getDetectionDoctorList(); return $this->response->json($data); diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index d161ca9..6de89b5 100644 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -178,4 +178,15 @@ class UserController extends AbstractController $data = $UserService->postLocation(); return $this->response->json($data); } + + /** + * 获取用户地址 + * @return ResponseInterface + */ + public function getLocation(): ResponseInterface + { + $UserService = new UserService(); + $data = $UserService->getLocation(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Request/DetectionRequest.php b/app/Request/DetectionRequest.php index 34694bd..e244678 100644 --- a/app/Request/DetectionRequest.php +++ b/app/Request/DetectionRequest.php @@ -29,6 +29,12 @@ class DetectionRequest extends FormRequest 'detection_bar_code', 'detection_pic', ], + 'getDetectionDoctorList' => [ // 绑定检测管 + 'province_id', + 'city_id', + 'county_id', + 'company_id' + ], ]; /** @@ -53,6 +59,8 @@ class DetectionRequest extends FormRequest 'doctor_id' => 'required', 'client_type' => 'required|integer|min:1|max:2', 'detection_bar_code' => 'required', + 'province_id' => 'required_with:city_id,county_id', + 'city_id' => 'required_with:county_id', ]; } @@ -73,6 +81,8 @@ class DetectionRequest extends FormRequest 'client_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'client_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'detection_bar_code.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'province_id.required_with' => "请选择省份", + 'city_id.required_with' => "请选择城市", ]; } } diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 1a1cb5d..d5aef0c 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -112,116 +112,41 @@ class DetectionService extends BaseService return fail(); } - // 返回数据 - $response_data = array( - "area" => [ - "province_id" => "", - "province" => "", - "city_id" => "", - "city" => "", - "county_id" => "", - "county" => "", - ], - "doctors" => [], - ); - // 搜索数据 $hospital_params = array(); - if (empty($province_id) && empty($city_id) && empty($county_id)){ - // 获取用户定位地址数据 + if (!empty($province_id)){ $params = array(); - $params['user_id'] = $user_info['user_id']; - $user_location = UserLocation::getOne($params); - if (!empty($user_location)){ - // 处理省市区对应 - if (!empty($user_location['province']) && !empty($user_location['city'])){ - $params = array(); - $params['area_name'] = $user_location['province']; - $params['area_type'] = 2; - $area_province = Area::getOne($params); - if (!empty($area_province)){ - $response_data['area']['province_id'] = $area_province['area_id']; - $response_data['area']['province'] = $area_province['area_name']; - - // 搜索条件 - $hospital_params['province_id'] = $area_province['area_id']; - } - - if (!empty($response_data['area']['province_id'])){ - $params = array(); - $params['area_name'] = $user_location['city']; - $params['parent_id'] = $response_data['area']['province_id']; - $params['area_type'] = 3; - $area_city = Area::getOne($params); - if (!empty($area_city)){ - $response_data['area']['city_id'] = $area_city['area_id']; - $response_data['area']['city'] = $area_city['area_name']; - - // 搜索条件 - $hospital_params['city_id'] = $area_city['area_id']; - } - } - } - - if (!empty($response_data['area']['city_id']) && !empty($user_location['county'])){ - $params = array(); - $params['area_name'] = $user_location['county']; - $params['parent_id'] = $response_data['area']['city_id']; - $params['area_type'] = 4; - $area_county = Area::getOne($params); - if (!empty($area_county)){ - $response_data['area']['county_id'] = $area_county['area_id']; - $response_data['area']['county'] = $area_county['area_name']; - - // 搜索条件 - $hospital_params['county_id'] = $area_county['area_id']; - } - } + $params['area_id'] = $province_id; + $params['area_type'] = 2; + $area_province = Area::getOne($params); + if (!empty($area_province)){ + // 搜索条件 + $hospital_params['province_id'] = $area_province['area_id']; } - } else{ - if (!empty($province_id)){ - $params = array(); - $params['area_id'] = $province_id; - $params['area_type'] = 2; - $area_province = Area::getOne($params); - if (!empty($area_province)){ - $response_data['area']['province_id'] = $area_province['area_id']; - $response_data['area']['province'] = $area_province['area_name']; + } - // 搜索条件 - $hospital_params['province_id'] = $area_province['area_id']; - } + if (!empty($city_id)){ + $params = array(); + $params['area_id'] = $city_id; + $params['parent_id'] = $province_id; + $params['area_type'] = 3; + $area_city = Area::getOne($params); + if (!empty($area_city)){ + // 搜索条件 + $hospital_params['city_id'] = $area_city['area_id']; } + } - if (!empty($response_data['area']['province_id']) && !empty($city_id)){ - $params = array(); - $params['area_id'] = $city_id; - $params['parent_id'] = $response_data['area']['province_id']; - $params['area_type'] = 3; - $area_city = Area::getOne($params); - if (!empty($area_city)){ - $response_data['area']['city_id'] = $area_city['area_id']; - $response_data['area']['city'] = $area_city['area_name']; - - // 搜索条件 - $hospital_params['city_id'] = $area_city['area_id']; - } - } - - if (!empty($response_data['area']['city_id']) && !empty($county_id)){ - $params = array(); - $params['area_id'] = $county_id; - $params['parent_id'] = $response_data['area']['city_id']; - $params['area_type'] = 4; - $area_county = Area::getOne($params); - if (!empty($area_county)){ - $response_data['area']['county_id'] = $area_county['area_id']; - $response_data['area']['county'] = $area_county['area_name']; - - // 搜索条件 - $hospital_params['county_id'] = $area_county['area_id']; - } + if (!empty($county_id)){ + $params = array(); + $params['area_id'] = $county_id; + $params['parent_id'] = $city_id; + $params['area_type'] = 4; + $area_county = Area::getOne($params); + if (!empty($area_county)){ + // 搜索条件 + $hospital_params['county_id'] = $area_county['area_id']; } } @@ -251,11 +176,9 @@ class DetectionService extends BaseService $value['avatar'] = addAliyunOssWebsite($value['avatar']); } - - $response_data['doctors'] = $user_doctors->toArray(); } - return success($response_data); + return success($user_doctors->toArray()); } /** diff --git a/app/Services/UserService.php b/app/Services/UserService.php index 8fa73d7..8c8f11c 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -3,6 +3,7 @@ namespace App\Services; use App\Constants\HttpEnumCode; +use App\Model\Area; use App\Model\Popup; use App\Model\SubTemplate; use App\Model\User; @@ -621,6 +622,70 @@ class UserService extends BaseService return success(); } + /** + * 获取用户地址 + * @return array + */ + public function getLocation(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + // 定义返回数据 + $area = [ + "province_id" => "", + "province" => "", + "city_id" => "", + "city" => "", + "county_id" => "", + "county" => "", + ]; + + $params = array(); + $params['user_id'] = $user_info['user_id']; + $user_location = UserLocation::getOne($params); + if (empty($user_location)){ + return success($area); + } + + // 处理省市区对应 + if (!empty($user_location['province']) && !empty($user_location['city'])){ + $params = array(); + $params['area_name'] = $user_location['province']; + $params['area_type'] = 2; + $area_province = Area::getOne($params); + if (!empty($area_province)){ + $area['province_id'] = $area_province['area_id']; + $area['province'] = $area_province['area_name']; + } + + if (!empty($area['province_id'])){ + $params = array(); + $params['area_name'] = $user_location['city']; + $params['parent_id'] = $area['province_id']; + $params['area_type'] = 3; + $area_city = Area::getOne($params); + if (!empty($area_city)){ + $area['city_id'] = $area_city['area_id']; + $area['city'] = $area_city['area_name']; + } + } + } + + if (!empty($area['city_id']) && !empty($user_location['county'])){ + $params = array(); + $params['area_name'] = $user_location['county']; + $params['parent_id'] = $area['city_id']; + $params['area_type'] = 4; + $area_county = Area::getOne($params); + if (!empty($area_county)){ + $area['county_id'] = $area_county['area_id']; + $area['county'] = $area_county['area_name']; + } + } + + return success($area); + } + /** * 通过user_id获取用户openid * @param string|int $user_id diff --git a/config/routes.php b/config/routes.php index 57b50d7..494b22e 100644 --- a/config/routes.php +++ b/config/routes.php @@ -686,9 +686,9 @@ Router::addGroup('/user', function () { // 上报用户地址 Router::post('/location', [UserController::class, 'postLocation']); -// -// // 获取用户地址 -// Router::get('/location', [UserController::class, 'getLocation']); + + // 获取用户地址 + Router::get('/location', [UserController::class, 'getLocation']); }); // 获取患者问诊病例 From a003b1083a2be992dc8d9a4088cbb5e83fa851b6 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 23 Aug 2023 17:24:29 +0800 Subject: [PATCH 093/176] =?UTF-8?q?=E7=97=85=E4=BE=8B=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=A3=80=E6=B5=8B=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DetectionService.php | 1 - app/Services/InquiryService.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index d5aef0c..a5532a9 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -103,7 +103,6 @@ class DetectionService extends BaseService $city_id = $this->request->input("city_id"); $county_id = $this->request->input("county_id"); - // 获取合作公司数据 $params = array(); $params['company_id'] = $company_id; diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 74bc462..6bfaaf8 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -494,7 +494,7 @@ class InquiryService extends BaseService if (!empty($detection_project)){ $order_inquiry_case['detection_project']['detection_project_name'] = $detection_project['detection_project_name']; // 检测项目名称 $order_inquiry_case['detection_project']['detection_time'] = $order_detection['detection_time']; // 检测时间 - $order_inquiry_case['detection_project']['detection_link'] = ""; // 检测结果链接 + $order_inquiry_case['detection_project']['detection_link'] = addAliyunOssWebsite($detection_project['detection_result_pdf']); // 检测结果链接 } } } From 6562fee46e5628e2254810c2aa00a5eae521a080 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 23 Aug 2023 17:33:22 +0800 Subject: [PATCH 094/176] =?UTF-8?q?im=E7=B3=96=E7=BB=84=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E6=8E=A8=E9=80=81=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E9=93=BE=E6=8E=A5=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/ImService.php | 2 +- app/Services/InquiryService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Services/ImService.php b/app/Services/ImService.php index 4df8c80..41bdf17 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -693,7 +693,7 @@ class ImService extends BaseService $message_content_data['desc'] = ""; $message_content_data['data']['order_no'] = (string)$order_detection['detection_no']; $message_content_data['data']['disease_class_names'] = $disease_class_names; - $message_content_data['data']['message_path'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no']; // 跳转地址(小程序内页) + $message_content_data['data']['detection_link'] = addAliyunOssWebsite($order_detection['detection_result_pdf']);// 检测结果链接(oss) $message_content = [ 'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE), ]; diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 6bfaaf8..2aac429 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -494,7 +494,7 @@ class InquiryService extends BaseService if (!empty($detection_project)){ $order_inquiry_case['detection_project']['detection_project_name'] = $detection_project['detection_project_name']; // 检测项目名称 $order_inquiry_case['detection_project']['detection_time'] = $order_detection['detection_time']; // 检测时间 - $order_inquiry_case['detection_project']['detection_link'] = addAliyunOssWebsite($detection_project['detection_result_pdf']); // 检测结果链接 + $order_inquiry_case['detection_project']['detection_link'] = addAliyunOssWebsite($order_detection['detection_result_pdf']); // 检测结果链接 } } } From 20cd849f7152aea30761fb3f35d4f6bf60ff10d8 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 24 Aug 2023 15:36:46 +0800 Subject: [PATCH 095/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E8=AF=8A?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Common/Common.php | 2 ++ app/Services/MessagePush.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Common/Common.php b/app/Common/Common.php index 41da95f..bff6f43 100644 --- a/app/Common/Common.php +++ b/app/Common/Common.php @@ -170,6 +170,8 @@ function inquiryTypeToString(int|string $inquiry_type): string $result = "公益问诊"; } elseif ($inquiry_type == 4) { $result = "问诊购药"; + } elseif ($inquiry_type == 5) { + $result = "检测问诊"; } else { $result = "未知"; } diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index d41779c..fc78f05 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -445,7 +445,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } From 52657e2b5081e468f16d896b04ee7b8e6d018a7d Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 24 Aug 2023 16:12:15 +0800 Subject: [PATCH 096/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/MessagePush.php | 80 +++++++++++++++--------------------- 1 file changed, 34 insertions(+), 46 deletions(-) diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index fc78f05..34601f0 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -142,7 +142,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:" . $e->getMessage()); } } @@ -187,7 +187,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:" . $e->getMessage()); } } @@ -224,7 +224,7 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } @@ -356,7 +356,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -522,7 +522,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -563,7 +563,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -595,7 +595,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -627,7 +627,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -659,7 +659,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -749,7 +749,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -879,7 +879,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -920,7 +920,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -986,13 +986,9 @@ class MessagePush extends BaseService $sub_data['params']['page'] = "pages/medinceOrderDetail/medinceOrderDetail?order_product_id={$order_product_id}"; $sub_data['params']['data'] = [ "character_string9" => (string)$order_product['order_product_no'],// 快递单号 - "time7" => $order_product['delivery_time'],// 发货时间 - "thing3" => $order_product['province'] . $order_product['city'] . $order_product['county'],// 收货地址 - "thing6" => (string)$order_product['consignee_name'],// 收货人 - "thing5" => "您的药品已发货,点击可以查看订单详情",// 备注 ]; @@ -1018,7 +1014,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -1035,7 +1031,7 @@ class MessagePush extends BaseService { try { - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } @@ -1116,22 +1112,16 @@ class MessagePush extends BaseService $thing6 = "5分钟内未接诊,平台将自动取消问诊"; } - $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc";//咨询提醒 $sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen"; $sub_data['params']['data'] = [ "thing1" => "您有一个新的问诊服务等待接诊",// 提醒内容 - "name2" => (string)$this->order_inquiry['patient_name'],// 患者姓名 - "thing4" => (string)$disease_desc,// 病情描述 - "thing6" => $thing6,// 提示说明 - "thing5" => "",// 咨询内容 - ]; // 短信 @@ -1155,7 +1145,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入订阅推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -1164,8 +1154,6 @@ class MessagePush extends BaseService * 医生xx时间后还未接诊 * 站内、订阅失败发送短信 * @return bool - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface */ public function doctorNotYetInquiry(): bool { @@ -1239,8 +1227,8 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { - Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); + } catch (\Throwable $e) { + Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" .$e->getMessage()); } return true; @@ -1290,7 +1278,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -1374,7 +1362,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } @@ -1432,7 +1420,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . $e->getMessage()); } } @@ -1466,7 +1454,7 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } @@ -1502,7 +1490,7 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } @@ -1581,7 +1569,7 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } @@ -1657,7 +1645,7 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } @@ -1735,7 +1723,7 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } @@ -1810,7 +1798,7 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } @@ -1890,7 +1878,7 @@ class MessagePush extends BaseService Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } @@ -1969,7 +1957,7 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } @@ -2008,7 +1996,7 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } @@ -2046,7 +2034,7 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } @@ -2140,7 +2128,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -2214,7 +2202,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -2270,7 +2258,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } @@ -2347,7 +2335,7 @@ class MessagePush extends BaseService if (!$result) { Log::getInstance("MessagePush-patientDetectionResultNotice")->error(json_encode($data, JSON_UNESCAPED_UNICODE)); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance("MessagePush-patientDetectionResultNotice")->error($e->getMessage()); } } From aa5d4e7724b44c50c44ed16b040aeadcb8e9afa9 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 24 Aug 2023 16:57:21 +0800 Subject: [PATCH 097/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9im=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E6=82=A3=E8=80=85=E7=97=85=E4=BE=8B=E6=B6=88=E6=81=AF=E6=97=B6?= =?UTF-8?q?=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssignDoctorDelayDirectConsumer.php | 3 --- app/Controller/CallBackController.php | 4 ++-- app/Services/MessagePush.php | 2 -- app/Services/PatientOrderService.php | 2 -- app/Services/UserDoctorService.php | 19 +++++++++++++++++++ 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php b/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php index d997003..891696a 100644 --- a/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php +++ b/app/Amqp/Consumer/AssignDoctorDelayDirectConsumer.php @@ -276,9 +276,6 @@ class AssignDoctorDelayDirectConsumer extends ConsumerMessage // 发送im消息 $imService = new ImService(); - // 患者病例 - $imService->patientCase($order_inquiry,$user_doctor['user_id'],$order_inquiry_case['disease_desc']); - // 等待医生接诊 $imService->waitDoctorInquiry($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']); diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 242e8cf..30c9a93 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -188,8 +188,7 @@ class CallBackController extends AbstractController // 发送im消息 $imService = new ImService(); - // 患者病例 - $imService->patientCase($order_inquiry,$user_doctor['user_id'],$order_inquiry_case['disease_desc']); + // 等待医生接诊 $imService->waitDoctorInquiry($order_inquiry, $user_doctor['user_id'], $order_inquiry['user_id']); @@ -1528,6 +1527,7 @@ class CallBackController extends AbstractController // 发送im消息 $imService = new ImService(); + // 患者病例 $imService->patientCase( $order_inquiry, diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 34601f0..1384ddb 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -235,8 +235,6 @@ class MessagePush extends BaseService * 患者-通知患者医生已接诊 * 站内、订阅、短信 * @return void - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface */ public function patientAcceptedInquiry(): void { diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index f771194..4b953df 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -976,8 +976,6 @@ class PatientOrderService extends BaseService // 发送im消息 $imService = new ImService(); - // 患者病例 - $imService->patientCase($order_inquiry,$user_doctor['user_id'],$order_inquiry_case['disease_desc']); // 等待医生接诊 $imService->waitDoctorInquiry($order_inquiry, $user_doctor['user_id'], $order_inquiry['user_id']); diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index c28718c..15911f5 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1810,10 +1810,29 @@ class UserDoctorService extends BaseService } try { + // 获取订单医生数据 + $params = array(); + $params['doctor_id'] = $order_inquiry['doctor_id']; + $user_doctor = UserDoctor::getOne($params); + if (empty($user_doctor)) { + return success([],HttpEnumCode::HTTP_SUCCESS,"医生数据错误"); + } + + // 获取病例数据 + $params = array(); + $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + $order_inquiry_case = OrderInquiryCase::getOne($params); + if (empty($order_inquiry_case)){ + return success([],HttpEnumCode::HTTP_SUCCESS,"患者病例错误"); + } + // 发送IM消息-医生接诊 $imService = new ImService(); $imService->doctorInquiry($order_inquiry,$user_info['user_id'],$order_inquiry['user_id']); + // 发送IM消息-患者病例 + $imService->patientCase($order_inquiry,$user_doctor['user_id'],$order_inquiry_case['disease_desc']); + // 发送站内、订阅、短信消息-医生已接诊 $MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']); $MessagePush->patientAcceptedInquiry(); From 3169cf4bfc56fa796c51f82bd3789416a8957c3e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 25 Aug 2023 14:37:20 +0800 Subject: [PATCH 098/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientOrderService.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 4b953df..85d1697 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -701,6 +701,7 @@ class PatientOrderService extends BaseService // 验证订单状态 if ($order_inquiry['inquiry_status'] != 1) { $return_result['message'] = "订单状态错误"; + $return_result['data'] = $result; $return_result['data']['order_id'] = $order_inquiry['order_inquiry_id']; $return_result['data']['order_status'] = $order_inquiry['inquiry_status']; $return_result['data']['order_pay_status'] = $order_inquiry['inquiry_pay_status']; @@ -710,6 +711,7 @@ class PatientOrderService extends BaseService // 验证订单支付状态 if ($order_inquiry['inquiry_pay_status'] != 1) { $return_result['message'] = "订单支付状态错误"; + $return_result['data'] = $result; $return_result['data']['order_id'] = $order_inquiry['order_inquiry_id']; $return_result['data']['order_status'] = $order_inquiry['inquiry_status']; $return_result['data']['order_pay_status'] = $order_inquiry['inquiry_pay_status']; @@ -720,6 +722,7 @@ class PatientOrderService extends BaseService $diff_time = (strtotime($order_inquiry['created_at']) - time()) / 60; if ($diff_time >= 30) { $return_result['message'] = "订单已过期"; + $return_result['data'] = $result; $return_result['data']['order_id'] = $order_inquiry['order_inquiry_id']; $return_result['data']['order_status'] = $order_inquiry['inquiry_status']; $return_result['data']['order_pay_status'] = $order_inquiry['inquiry_pay_status']; @@ -762,6 +765,7 @@ class PatientOrderService extends BaseService // 验证订单状态 if ($order_product['order_product_status'] != 1) { $return_result['message'] = "订单状态错误"; + $return_result['data'] = $result; $return_result['data']['order_id'] = $order_product['order_product_id']; $return_result['data']['order_status'] = $order_product['order_product_status']; $return_result['data']['order_pay_status'] = $order_product['pay_status']; @@ -771,6 +775,7 @@ class PatientOrderService extends BaseService // 验证订单支付状态 if ($order_product['pay_status'] != 1) { $return_result['message'] = "订单支付状态错误"; + $return_result['data'] = $result; $return_result['data']['order_product_id'] = $order_product['order_product_id']; $return_result['data']['order_product_status'] = $order_product['order_product_status']; $return_result['data']['order_pay_status'] = $order_product['pay_status']; @@ -781,6 +786,7 @@ class PatientOrderService extends BaseService $diff_time = (strtotime($order_product['created_at']) - time()) / 60; if ($diff_time >= 30) { $return_result['message'] = "订单已过期"; + $return_result['data'] = $result; $return_result['data']['order_product_id'] = $order_product['order_product_id']; $return_result['data']['order_product_status'] = $order_product['order_product_status']; $return_result['data']['order_pay_status'] = $order_product['pay_status']; @@ -822,6 +828,7 @@ class PatientOrderService extends BaseService // 验证订单状态 if ($order_detection['detection_status'] != 1) { $return_result['message'] = "订单状态错误"; + $return_result['data'] = $result; $return_result['data']['order_id'] = $order_detection['order_detection_id']; $return_result['data']['order_status'] = $order_detection['detection_status']; $return_result['data']['order_pay_status'] = $order_detection['detection_pay_status']; @@ -831,6 +838,7 @@ class PatientOrderService extends BaseService // 验证订单支付状态 if ($order_detection['detection_pay_status'] != 1) { $return_result['message'] = "订单支付状态错误"; + $return_result['data'] = $result; $return_result['data']['order_id'] = $order_detection['order_detection_id']; $return_result['data']['order_status'] = $order_detection['detection_status']; $return_result['data']['order_pay_status'] = $order_detection['detection_pay_status']; @@ -841,6 +849,7 @@ class PatientOrderService extends BaseService $diff_time = (strtotime($order_detection['created_at']) - time()) / 60; if ($diff_time >= 30) { $return_result['message'] = "订单已过期"; + $return_result['data'] = $result; $return_result['data']['order_id'] = $order_detection['order_detection_id']; $return_result['data']['order_status'] = $order_detection['detection_status']; $return_result['data']['order_pay_status'] = $order_detection['detection_pay_status']; From 9b675c16811282d295ca3693008c1f6a6265c8a6 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 25 Aug 2023 16:57:40 +0800 Subject: [PATCH 099/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=AD=89=E5=BE=85?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=A3=80=E6=B5=8B=E8=AE=A2=E5=8D=95=E9=98=9F?= =?UTF-8?q?=E5=88=97=EF=BC=8C=E4=BF=AE=E6=94=B9im=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetectionCompleteDelayDirectConsumer.php | 83 +++++++ .../DetectionCompleteDelayDirectProducer.php | 31 +++ app/Controller/CallBackController.php | 109 ++++++++- app/Services/ImService.php | 1 + app/Services/InquiryService.php | 227 ++++++++++++------ app/Services/UserDoctorService.php | 2 +- 6 files changed, 379 insertions(+), 74 deletions(-) create mode 100644 app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php create mode 100644 app/Amqp/Producer/DetectionCompleteDelayDirectProducer.php diff --git a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php new file mode 100644 index 0000000..f9dd400 --- /dev/null +++ b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php @@ -0,0 +1,83 @@ +info("开始:" . json_encode($data, JSON_UNESCAPED_UNICODE)); + + // 获取检测订单数据 + $params = array(); + $params['detection_no'] = $data['detection_no']; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)){ + Log::getInstance("queue-DoctorNotYetInquiry")->error("非法订单"); + return Result::ACK; + } + + try { + // 检测当前医生是否和患者存在未完成问诊订单 + $InquiryService = new InquiryService(); + $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($order_detection['user_id'],$order_detection['doctor_id']); + if (!empty($order_inquiry)){ + // 存在未完成订单 + // 获取现在时间距离订单结束时间的时间差 + $time_diff = $InquiryService->getInquiryFinishTimeDiff($order_inquiry); + + // 计算时间并重新加入队列 + $queue_data = array(); + $queue_data['order_inquiry_id'] = $data['order_inquiry_id']; + + $message = new DetectionCompleteDelayDirectProducer($queue_data); + $message->setDelayMs(1000 * $time_diff); + $producer = $this->container->get(Producer::class); + $res = $producer->produce($message); + if (!$res) { + Db::rollBack(); + Log::getInstance()->error("处理用户优惠卷过期队列 执行失败:未到过期时间,重新添加队列失败"); + return Result::REQUEUE; + } + + return Result::DROP; + } + + }catch (\Throwable $e){ + Log::getInstance("queue-DoctorNotYetInquiry")->error($e->getMessage()); + return Result::DROP; // 重回队列 + } + + + return Result::ACK; + } +} diff --git a/app/Amqp/Producer/DetectionCompleteDelayDirectProducer.php b/app/Amqp/Producer/DetectionCompleteDelayDirectProducer.php new file mode 100644 index 0000000..4c10686 --- /dev/null +++ b/app/Amqp/Producer/DetectionCompleteDelayDirectProducer.php @@ -0,0 +1,31 @@ +payload = $data; + } +} diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 30c9a93..7d4d57a 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1337,7 +1337,7 @@ class CallBackController extends AbstractController * 检测所结果回调 * @return ResponseInterface */ - public function DetectionResultCallBack(): ResponseInterface + public function DetectionResultCallBack1(): ResponseInterface { $request_params = $this->request->all(); $auth = $this->request->header("Authorization"); @@ -1510,6 +1510,10 @@ class CallBackController extends AbstractController $params['order_detection_id'] = $order_detection['order_detection_id']; OrderDetection::editOrderDetection($params,$data); + // 回填检测结果字段 + $order_detection['detection_result_pdf'] = $detection_result_pdf; + $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + // 添加自动完成队列 $time = 1000 * 60 * 60 * 24 * 3; @@ -1577,6 +1581,109 @@ class CallBackController extends AbstractController } } + /** + * 检测所结果回调 + * @return ResponseInterface + */ + public function DetectionResultCallBack(): ResponseInterface + { + $request_params = $this->request->all(); + $auth = $this->request->header("Authorization"); + if (empty($auth)){ + return $this->detectionResultFailReturn("非法请求"); + } + + Log::getInstance("CallBackController-DetectionResultCallBack")->info("处理检测所结果"); + + try { + // 检测参数 + if (!isset($request_params['appId'])){ + return $this->detectionResultFailReturn("缺少appId参数"); + } + + if (!isset($request_params['orderCode'])){ + return $this->detectionResultFailReturn("缺少orderCode参数"); + } + + if (!isset($request_params['detectBarcode'])){ + return $this->detectionResultFailReturn("缺少detectBarcode参数"); + } + + if (!isset($request_params['pdfReport'])){ + return $this->detectionResultFailReturn("缺少pdfReport参数"); + } + + // 检测签名 + $params = array(); + $params['app_id'] = $request_params['appId']; + $basic_detection_organ = BasicDetectionOrgan::getOne($params); + if (empty($basic_detection_organ)){ + return $this->detectionResultFailReturn("非法appId"); + } + + $time = date('Ymd'); + $sign = md5($basic_detection_organ['app_id'] . $basic_detection_organ['app_secret'] . $time); + if ($auth != $sign){ + return $this->detectionResultFailReturn("签名错误"); + } + + // 检测pdf文件 + $pdfData = base64_decode($request_params['pdfReport']); + if (!$pdfData){ + return $this->detectionResultFailReturn("文件错误"); + } + + // 获取检测订单数据 + $params = array(); + $params['detection_no'] = $request_params['orderCode']; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)){ + return $this->detectionResultFailReturn("非法订单"); + } + + // 检测订单状态 + if ($order_detection['detection_status'] != 3){ + return $this->detectionResultFailReturn("订单状态错误,无法处理"); + } + + if (!empty($order_detection['detection_result_pdf'])){ + return $this->detectionResultSuccessReturn(); + } + + if ($order_detection['detection_bar_code'] != $request_params['detectBarcode']){ + return $this->detectionResultFailReturn("检测条码无法对应"); + } + + // 上传处方图片至oss + $oss = new Oss(); + $detection_result_pdf_name = "applet/patient/detection/pdf/" . $order_detection['order_detection_id'] . '.' . 'pdf'; + $detection_result_pdf = $oss->putObject($detection_result_pdf_name, $pdfData); + $detection_result_pdf = '/' . $detection_result_pdf; + + Db::beginTransaction(); + + try { + // 修改检测订单 + $data = array(); + $data['detection_result_pdf'] = $detection_result_pdf; + $data['detection_result_date'] = date('Y-m-d H:i:s',time()); + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params,$data); + + Db::commit(); + } catch (\Throwable $e) { + Db::rollBack(); + return $this->detectionResultFailReturn($e->getMessage()); + } + + return $this->detectionResultSuccessReturn(); + } catch (\Throwable $e) { + return $this->detectionResultFailReturn("异常:" . $e->getMessage()); + } + } + /** * 检测所结果回调失败 * @param string $message diff --git a/app/Services/ImService.php b/app/Services/ImService.php index 41bdf17..c6b579e 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -694,6 +694,7 @@ class ImService extends BaseService $message_content_data['data']['order_no'] = (string)$order_detection['detection_no']; $message_content_data['data']['disease_class_names'] = $disease_class_names; $message_content_data['data']['detection_link'] = addAliyunOssWebsite($order_detection['detection_result_pdf']);// 检测结果链接(oss) + $message_content_data['data']['message_path'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no']; // 跳转地址(小程序内页) $message_content = [ 'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE), ]; diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 2aac429..92ca6c6 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -81,7 +81,7 @@ class InquiryService extends BaseService // 检测是否存在同类型未完成的问诊订单 $PatientOrderService = new PatientOrderService(); - $order_inquiry_id = $PatientOrderService->getNotFinishedOrderInquiry($request_params['inquiry_type'],$user_info['client_user_id']); + $order_inquiry_id = $PatientOrderService->getNotFinishedOrderInquiry($request_params['inquiry_type'], $user_info['client_user_id']); if (!empty($order_inquiry_id)) { $result['status'] = 2; $result['message'] = "当前患者存在进行中的问诊订单"; @@ -95,7 +95,7 @@ class InquiryService extends BaseService } // 是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在 - if (isset($request_params['is_taboo'])){ + if (isset($request_params['is_taboo'])) { if ($request_params['is_taboo'] == 0) { return fail(HttpEnumCode::HTTP_ERROR, "无法为您开具药物"); } @@ -134,8 +134,8 @@ class InquiryService extends BaseService // 检测当前医生是否和患者存在未完成问诊订单 $InquiryService = new InquiryService(); - $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($user_info['client_user_id'],$request_params['doctor_id']); - if (!empty($order_inquiry)){ + $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($user_info['client_user_id'], $request_params['doctor_id']); + if (!empty($order_inquiry)) { $result['status'] = 2; $result['message'] = "您和当前医生存在问诊中订单,无法再次发起问诊"; $result['data']['order_inquiry_id'] = $order_inquiry_id; @@ -146,7 +146,7 @@ class InquiryService extends BaseService // 检测当前是否符合系统问诊时间 $inquiryService = new InquiryService(); $is_system_time_pass = $inquiryService->checkSystemInquiryTime($request_params['inquiry_type']); - if (!$is_system_time_pass && $request_params['inquiry_type'] == 4){ + if (!$is_system_time_pass && $request_params['inquiry_type'] == 4) { return fail(HttpEnumCode::HTTP_ERROR, "当前非医生接诊时间"); } @@ -154,7 +154,7 @@ class InquiryService extends BaseService $DoctorInquiryService = new DoctorInquiryService(); $inquiry_price = $DoctorInquiryService->getDoctorInquiryPrice($request_params['inquiry_type'], $request_params['inquiry_mode'], $request_params['doctor_id'] ?: ""); - if ($inquiry_price > 0){ + if ($inquiry_price > 0) { // 获取可用优惠卷 $CouponService = new CouponService(); $user_coupon = $CouponService->getUserUsableCouponOne($user_info['user_id'], $request_params['inquiry_type']); @@ -184,9 +184,9 @@ class InquiryService extends BaseService $data = array(); $data['user_id'] = $user_info['user_id']; $data['patient_id'] = $user_info['client_user_id']; - if (isset($request_params['doctor_id'])){ - if (!empty($request_params['doctor_id'])){ - $data['doctor_id'] = $request_params['doctor_id']; + if (isset($request_params['doctor_id'])) { + if (!empty($request_params['doctor_id'])) { + $data['doctor_id'] = $request_params['doctor_id']; } } @@ -233,25 +233,25 @@ class InquiryService extends BaseService $data['diagnosis_date'] = $request_params['diagnosis_date'] ?: null; // 确诊日期 $data['disease_desc'] = $request_params['disease_desc'] ?: null; // 病情描述(主诉) $data['diagnose_images'] = $diagnose_images ?? ""; // 复诊凭证(多个使用逗号分隔) - if (isset($request_params['is_allergy_history'])){ - if ($request_params['is_allergy_history'] !== null){ + if (isset($request_params['is_allergy_history'])) { + if ($request_params['is_allergy_history'] !== null) { $data['is_allergy_history'] = $request_params['is_allergy_history']; // 是否存在过敏史(0:否 1:是) } } $data['allergy_history'] = $request_params['allergy_history'] ?? null; // 过敏史描述 - if (isset($request_params['is_family_history'])){ - if ($request_params['is_family_history'] !== null){ + if (isset($request_params['is_family_history'])) { + if ($request_params['is_family_history'] !== null) { $data['is_family_history'] = $request_params['is_family_history']; // 是否存在家族病史(0:否 1:是) } } $data['family_history'] = $request_params['family_history'] ?? null; // 家族病史描述 - if (isset($request_params['is_pregnant'])){ - if ($request_params['is_pregnant'] !== null){ + if (isset($request_params['is_pregnant'])) { + if ($request_params['is_pregnant'] !== null) { $data['is_pregnant'] = $request_params['is_pregnant']; // 是否备孕、妊娠、哺乳期(0:否 1:是) } } - if (isset($request_params['is_taboo'])){ - if ($request_params['is_taboo'] !== null){ + if (isset($request_params['is_taboo'])) { + if ($request_params['is_taboo'] !== null) { $data['is_taboo'] = $request_params['is_taboo']; // 是否存在禁忌药物(0:否 1:是)问诊购药时存在 } } @@ -335,7 +335,7 @@ class InquiryService extends BaseService // 加入未接诊取消订单延迟队列 // 专家问诊-公益问诊 - if (!empty($request_params['doctor_id']) && ($request_params['inquiry_type'] == 1 || $request_params['inquiry_type'] == 3)){ + if (!empty($request_params['doctor_id']) && ($request_params['inquiry_type'] == 1 || $request_params['inquiry_type'] == 3)) { $data = array(); $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; $message = new CancelUnInquiryOrdersDelayDirectProducer($data); @@ -418,11 +418,11 @@ class InquiryService extends BaseService $params = array(); $params['family_id'] = $order_inquiry_case['family_id']; $patient_family_health = PatientFamilyHealth::getOne($params); - if (empty($patient_family_health)){ + if (empty($patient_family_health)) { $order_inquiry_case['diagnosis_hospital'] = ""; $order_inquiry_case['is_take_medicine'] = null; $order_inquiry_case['drugs_name'] = ""; - }else{ + } else { $order_inquiry_case['diagnosis_hospital'] = $patient_family_health['diagnosis_hospital']; $order_inquiry_case['is_take_medicine'] = $patient_family_health['is_take_medicine']; $order_inquiry_case['drugs_name'] = $patient_family_health['drugs_name']; @@ -432,14 +432,14 @@ class InquiryService extends BaseService $params = array(); $params['family_id'] = $order_inquiry_case['family_id']; $patient_family_personal = PatientFamilyPersonal::getOne($params); - if (empty($patient_family_personal)){ + if (empty($patient_family_personal)) { $order_inquiry_case['drink_wine_status'] = null; $order_inquiry_case['smoke_status'] = null; $order_inquiry_case['chemical_compound_status'] = null; $order_inquiry_case['chemical_compound_describe'] = ""; $order_inquiry_case['is_operation'] = null; $order_inquiry_case['operation'] = ""; - }else{ + } else { $order_inquiry_case['drink_wine_status'] = $patient_family_personal['drink_wine_status']; $order_inquiry_case['smoke_status'] = $patient_family_personal['smoke_status']; $order_inquiry_case['chemical_compound_status'] = $patient_family_personal['chemical_compound_status']; @@ -481,17 +481,17 @@ class InquiryService extends BaseService // 检测项目 $order_inquiry_case['detection_project'] = null; - if ($order_inquiry['inquiry_type'] == 5){ + if ($order_inquiry['inquiry_type'] == 5) { // 获取检测订单 $params = array(); $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; $order_detection = OrderDetection::getOne($params); - if (!empty($order_detection)){ + if (!empty($order_detection)) { // 获取检测项目 $params = array(); $params['detection_project_id'] = $order_detection['detection_project_id']; $detection_project = DetectionProject::getOne($params); - if (!empty($detection_project)){ + if (!empty($detection_project)) { $order_inquiry_case['detection_project']['detection_project_name'] = $detection_project['detection_project_name']; // 检测项目名称 $order_inquiry_case['detection_project']['detection_time'] = $order_detection['detection_time']; // 检测时间 $order_inquiry_case['detection_project']['detection_link'] = addAliyunOssWebsite($order_detection['detection_result_pdf']); // 检测结果链接 @@ -605,7 +605,7 @@ class InquiryService extends BaseService $data['doctor_id'] = $doctor_id; $data['patient_id'] = $user_info['client_user_id']; $data['order_inquiry_id'] = $order_inquiry_id; - $data['name_mask'] = Mask::maskNameStr($order_inquiry['patient_name'],2); + $data['name_mask'] = Mask::maskNameStr($order_inquiry['patient_name'], 2); $data['reply_quality'] = $reply_quality; $data['service_attitude'] = $service_attitude; $data['reply_progress'] = $reply_progress; @@ -721,7 +721,7 @@ class InquiryService extends BaseService $result['quick_inquiry_price'] = $quick_inquiry_price; $result['medicine_inquiry_price'] = $medicine_inquiry_price; $result['expert_inquiry_price'] = $expert_inquiry_price ?: 0; - $result['welfare_inquiry_price'] = $welfare_inquiry_price ?: 0 ; + $result['welfare_inquiry_price'] = $welfare_inquiry_price ?: 0; return success($result); } @@ -739,17 +739,17 @@ class InquiryService extends BaseService $params['order_inquiry_id'] = $order_inquiry_id; $order_inquiry = OrderInquiry::getOne($params); if (empty($order_inquiry)) { - return fail(HttpEnumCode::HTTP_ERROR,"订单错误"); + return fail(HttpEnumCode::HTTP_ERROR, "订单错误"); } - if ($user_info['user_type'] == 1){ - if ($order_inquiry['patient_id'] != $user_info['client_user_id']){ + if ($user_info['user_type'] == 1) { + if ($order_inquiry['patient_id'] != $user_info['client_user_id']) { return fail(HttpEnumCode::SERVER_ERROR); } } - if ($user_info['user_type'] == 2){ - if ($order_inquiry['doctor_id'] != $user_info['client_user_id']){ + if ($user_info['user_type'] == 2) { + if ($order_inquiry['doctor_id'] != $user_info['client_user_id']) { return fail(HttpEnumCode::SERVER_ERROR); } } @@ -771,12 +771,12 @@ class InquiryService extends BaseService $params['inquiry_type'] = $order_inquiry['inquiry_type']; $params['inquiry_mode'] = $order_inquiry['inquiry_mode']; $system_inquiry_config = SystemInquiryConfig::getOne($params); - if (!empty($system_inquiry_config)){ + if (!empty($system_inquiry_config)) { $times_number = $system_inquiry_config['times_number']; $duration = $system_inquiry_config['duration']; } - if ($user_info['user_type'] == 1){ + if ($user_info['user_type'] == 1) { // 关注状态 $params = array(); $params['patient_id'] = $user_info['client_user_id']; @@ -825,7 +825,7 @@ class InquiryService extends BaseService $params = array(); $params['doctor_id'] = $user_info['client_user_id']; - $inquiry_status_params = ["5","6"]; + $inquiry_status_params = ["5", "6"]; $fields = [ 'order_inquiry_id', @@ -849,10 +849,10 @@ class InquiryService extends BaseService 'created_at', ]; - $result = OrderInquiry::getInquiryStatusWithDoctorPage($params,$inquiry_status_params,$fields,$page,$per_page); + $result = OrderInquiry::getInquiryStatusWithDoctorPage($params, $inquiry_status_params, $fields, $page, $per_page); - if (!empty($result['data'])){ - foreach ($result['data'] as &$item){ + if (!empty($result['data'])) { + foreach ($result['data'] as &$item) { $params = array(); $params['message_send_result'] = 1; $params['order_inquiry_id'] = $item['order_inquiry_id']; @@ -873,7 +873,7 @@ class InquiryService extends BaseService $order_inquiry_id = $this->request->route('order_inquiry_id'); - if (empty($user_info)){ + if (empty($user_info)) { return fail(HttpEnumCode::HTTP_ERROR, "操作失败"); } // 获取问诊订单数据 @@ -886,7 +886,7 @@ class InquiryService extends BaseService $order_inquiry = $order_inquiry->toArray(); - if ($order_inquiry['doctor_id'] != $user_info['client_user_id'] && $order_inquiry['patient_id'] != $user_info['client_user_id']){ + if ($order_inquiry['doctor_id'] != $user_info['client_user_id'] && $order_inquiry['patient_id'] != $user_info['client_user_id']) { return fail(HttpEnumCode::HTTP_ERROR, "操作失败"); } @@ -896,13 +896,13 @@ class InquiryService extends BaseService } // 订单退款状态 - if (!in_array($order_inquiry['inquiry_refund_status'],[0,4,5])){ + if (!in_array($order_inquiry['inquiry_refund_status'], [0, 4, 5])) { // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) return fail(HttpEnumCode::HTTP_ERROR, "订单正在退款,无法结束"); } // 订单支付状态 - if ($order_inquiry['inquiry_pay_status'] != 2){ + if ($order_inquiry['inquiry_pay_status'] != 2) { return fail(HttpEnumCode::HTTP_ERROR, "订单未支付,无法结束"); } @@ -910,7 +910,7 @@ class InquiryService extends BaseService $params = array(); $params['doctor_id'] = $order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); - if (empty($user_doctor)){ + if (empty($user_doctor)) { return fail(HttpEnumCode::HTTP_ERROR, "操作失败"); } @@ -920,24 +920,24 @@ class InquiryService extends BaseService // 修改问诊订单表 $data = array(); $data['inquiry_status'] = 5;// 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) - $data['complete_time'] = date('Y-m-d H:i:s',time());// 订单完成时间(问诊完成时间) + $data['complete_time'] = date('Y-m-d H:i:s', time());// 订单完成时间(问诊完成时间) $params = array(); $params['order_inquiry_id'] = $order_inquiry_id; - OrderInquiry::edit($params,$data); + OrderInquiry::edit($params, $data); // 新增患者历史问诊表-问诊完成后添加 $data = array(); $data['patient_id'] = $order_inquiry['patient_id']; $data['doctor_id'] = $order_inquiry['doctor_id']; - if (!empty($order_inquiry['pharmacist_id'])){ + if (!empty($order_inquiry['pharmacist_id'])) { $data['pharmacist_id'] = $order_inquiry['pharmacist_id']; } $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; $data['history_status'] = 1; $patient_history_inquiry = PatientHistoryInquiry::addPatientHistoryInquiry($data); - if (empty($patient_history_inquiry)){ + if (empty($patient_history_inquiry)) { Db::rollBack(); return fail(HttpEnumCode::SERVER_ERROR, "添加患者历史问诊表失败"); } @@ -964,20 +964,20 @@ class InquiryService extends BaseService try { // 发送IM消息-问诊已完成 $imService = new ImService(); - $imService->inquiryComplete($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']); + $imService->inquiryComplete($order_inquiry, $user_doctor['user_id'], $order_inquiry['user_id']); // 发送IM消息-问诊结束评价通知 - $imService->inquiryEndEvaluation($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']); + $imService->inquiryEndEvaluation($order_inquiry, $user_doctor['user_id'], $order_inquiry['user_id']); // 医生-发送通知消息-问诊结束 - $MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']); + $MessagePush = new MessagePush($user_doctor['user_id'], $order_inquiry['order_inquiry_id']); $MessagePush->finishInquiryToDoctor(); // 患者-发送通知消息-患者的问诊服务结束 - $MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']); + $MessagePush = new MessagePush($order_inquiry['user_id'], $order_inquiry['order_inquiry_id']); $MessagePush->patientInquiryFinish(); - }catch(\Exception $e){ - return success([],HttpEnumCode::HTTP_SUCCESS,"消息发送失败"); + } catch (\Exception $e) { + return success([], HttpEnumCode::HTTP_SUCCESS, "消息发送失败"); } return success(); @@ -1079,7 +1079,7 @@ class InquiryService extends BaseService $params['inquiry_status'] = 6; // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) $order_inquiry = OrderInquiry::getList($params); - if (empty($order_inquiry)){ + if (empty($order_inquiry)) { return []; } @@ -1141,7 +1141,7 @@ class InquiryService extends BaseService $inquiry_refund_no = $generator->generate(); // 检测订单金额 - if ($order_inquiry['payment_amount_total'] > 0){ + if ($order_inquiry['payment_amount_total'] > 0) { // 发起退款 $WechatPay = new WechatPay(1, 1); @@ -1179,7 +1179,7 @@ class InquiryService extends BaseService $refund_id = $result['refund_id']; - }else{ + } else { // 模拟退款 $inquiry_refund_status = 3; $refund_id = "模拟退款:" . $generator->generate(); @@ -1286,7 +1286,7 @@ class InquiryService extends BaseService // 取消问诊订单 $data = array(); $data['inquiry_status'] = 7; - if ($cancel_reason == 5){ + if ($cancel_reason == 5) { $data['inquiry_pay_status'] = 5; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) } @@ -1308,7 +1308,7 @@ class InquiryService extends BaseService $params = array(); $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; $order_inquiry_coupon = OrderInquiryCoupon::getOne($params); - if (!empty($order_inquiry_coupon)){ + if (!empty($order_inquiry_coupon)) { // 发送站内消息-优惠卷退还 $MessagePush = new MessagePush($order_inquiry['user_id'], $order_inquiry['order_inquiry_id']); $MessagePush->patientRefundCoupon($order_inquiry_coupon['coupon_name']); @@ -1319,7 +1319,7 @@ class InquiryService extends BaseService } /** - * 检测当前医生是否和患者存在未完成问诊订单 + * 检测当前医生是否和患者进行中的问诊订单 * @param string $patient_id * @param string $doctor_id * @return array @@ -1362,8 +1362,8 @@ class InquiryService extends BaseService $redis_key = "inquiryRefund" . $order_inquiry_id; $redis_value = $redis->get($redis_key); - if(empty($redis_value)){ - $redis->set($redis_key, 1,60 * 60 * 24 * 5); + if (empty($redis_value)) { + $redis->set($redis_key, 1, 60 * 60 * 24 * 5); return true; } @@ -1391,14 +1391,14 @@ class InquiryService extends BaseService * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function returnInquiryCoupon(string $order_inquiry_id,string $patient_user_id): bool + public function returnInquiryCoupon(string $order_inquiry_id, string $patient_user_id): bool { try { // 获取用户优惠卷信息 $params = array(); $params['order_inquiry_id'] = $order_inquiry_id; $order_inquiry_coupon = OrderInquiryCoupon::getOne($params); - if (empty($order_inquiry_coupon)){ + if (empty($order_inquiry_coupon)) { // 订单未使用优惠卷,无需退还 return true; } @@ -1407,7 +1407,7 @@ class InquiryService extends BaseService $params = array(); $params['user_coupon_id'] = $order_inquiry_coupon['user_coupon_id']; $user_coupon = UserCoupon::getOne($params); - if (empty($user_coupon)){ + if (empty($user_coupon)) { // 无该优惠卷数据,无需处理 return true; } @@ -1416,10 +1416,10 @@ class InquiryService extends BaseService $data = array(); // 检测优惠卷过期时间。判断是否需要退还 - if (strtotime($user_coupon['valid_end_time']) <= time()){ + if (strtotime($user_coupon['valid_end_time']) <= time()) { // 超出过期时间,置为已过期 $data['user_coupon_status'] = 3; - }else{ + } else { $data['user_coupon_status'] = 0; $data['coupon_use_date'] = null; } @@ -1429,7 +1429,7 @@ class InquiryService extends BaseService UserCoupon::edit($params, $data); return true; - } catch(\Exception $e){ + } catch (\Exception $e) { Log::getInstance()->error("退还用户优惠卷失败" . $e->getMessage()); return false; } @@ -1447,7 +1447,7 @@ class InquiryService extends BaseService $params['inquiry_type'] = $inquiry_type; $params['inquiry_mode'] = 1; $system_inquiry_config = SystemInquiryConfig::getOne($params); - if (empty($system_inquiry_config)){ + if (empty($system_inquiry_config)) { throw new BusinessException("系统问诊配置错误"); } @@ -1455,16 +1455,16 @@ class InquiryService extends BaseService $params = array(); $params['system_inquiry_config_id'] = $system_inquiry_config['system_inquiry_config_id']; $system_inquiry_time = SystemInquiryTime::getList($params); - if (empty($system_inquiry_time)){ + if (empty($system_inquiry_time)) { throw new BusinessException("系统问诊时间配置错误"); } // 检测当前是否坐班时间 $is_time_pass = false; // 非坐班时间 - foreach ($system_inquiry_time as $item){ - $now_time = date('H',time()) . date('i',time()); - if ($item['start_time'] < $now_time && $item['end_time'] > $now_time){ + foreach ($system_inquiry_time as $item) { + $now_time = date('H', time()) . date('i', time()); + if ($item['start_time'] < $now_time && $item['end_time'] > $now_time) { // 符合当前时间区间 $is_time_pass = true; } @@ -1472,4 +1472,87 @@ class InquiryService extends BaseService return $is_time_pass; } + + /** + * 获取现在时间距离订单结束时间的时间差 + * @param array|object $order_inquiry + * @return float|int + */ + public function getInquiryFinishTimeDiff(array|object $order_inquiry): float|int + { + if (!in_array($order_inquiry['inquiry_status'], [1, 2, 3, 4])) { + throw new BusinessException("问诊订单状态错误"); + } + + $time = 0; + $wait_pay_time = 60 * 30;// 待支付时间 + $wait_assign_time = 60 * 5;// 待分配时间 + $wait_inquiry_time = 0; // 待接诊时间 + $wait_finish_time = 0;// 待结束时间 + + if ($order_inquiry['inquiry_type'] == 1) { + // 专家问诊 + $wait_assign_time = 0; + $wait_inquiry_time = 60 * 60 * 24; + $wait_finish_time = 60 * 60 * 24; + } elseif ($order_inquiry['inquiry_type'] == 2) { + // 快速问诊 + $wait_assign_time = 60 * 5; + $wait_inquiry_time = 60 * 10; + $wait_finish_time = 60 * 60; + } elseif ($order_inquiry['inquiry_type'] == 3) { + // 公益问诊 + $wait_assign_time = 0; + $wait_inquiry_time = 60 * 60 * 24; + $wait_finish_time = 60 * 60 * 24; + } elseif ($order_inquiry['inquiry_type'] == 4) { + // 问诊购药 + $wait_assign_time = 60 * 5; + $wait_inquiry_time = 60 * 10; + $wait_finish_time = 60 * 30; + } + + switch ($order_inquiry['inquiry_status']) { + case '1': + // 待支付 + $wait_pay_time = $wait_pay_time - (time() - strtotime($order_inquiry['created_at'])); + if ($wait_pay_time < 0 ){ + $wait_pay_time = 0; + } + + $time = $wait_pay_time + $wait_assign_time + $wait_inquiry_time + $wait_finish_time; + break; + case '2': + // 待分配 + $time = $wait_assign_time + $wait_inquiry_time + $wait_finish_time; + break; + case '3': + // 待接诊 + $wait_inquiry_time = $wait_inquiry_time - (time() - strtotime($order_inquiry['pay_time'])); + if ($wait_inquiry_time < 0 ){ + $wait_inquiry_time = 0; + } + + $time = $wait_inquiry_time + $wait_finish_time; + break; + case '4': + // 已接诊 + $wait_finish_time = $wait_finish_time - (time() - strtotime($order_inquiry['reception_time'])); + if ($wait_finish_time < 0 ){ + $wait_finish_time = 0; + } + + $time = $wait_finish_time; + break; + default: + break; + } + + if ($time < 0){ + $time = 0; + } + + return $time; + } + } \ No newline at end of file diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 15911f5..652becc 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1777,7 +1777,7 @@ class UserDoctorService extends BaseService $params['order_inquiry_id'] = $order_inquiry_id; OrderInquiry::edit($params,$data); - // 添加自动完成队列 + // 添加自动结束队列 if ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3){ // 专家问诊-公益问诊 $time = 1000 * 60 * 60 * 24; From bdd749267043369b7bd5c3185cdad6130d65defa Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 25 Aug 2023 17:22:54 +0800 Subject: [PATCH 100/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=89=80=E7=BB=93=E6=9E=9C=E5=9B=9E=E8=B0=83=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetectionCompleteDelayDirectConsumer.php | 203 ++++++++++++++++- app/Controller/CallBackController.php | 207 +++++++++++++++++- 2 files changed, 401 insertions(+), 9 deletions(-) diff --git a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php index f9dd400..a7fa172 100644 --- a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php +++ b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php @@ -4,10 +4,19 @@ declare(strict_types=1); namespace App\Amqp\Consumer; +use App\Amqp\Producer\AutoCompleteInquiryDelayDirectProducer; use App\Amqp\Producer\DetectionCompleteDelayDirectProducer; use App\Exception\BusinessException; +use App\Model\DetectionProject; use App\Model\OrderDetection; +use App\Model\OrderDetectionCase; +use App\Model\OrderInquiry; +use App\Model\OrderInquiryCase; +use App\Model\PatientFamily; +use App\Model\UserDoctor; +use App\Services\ImService; use App\Services\InquiryService; +use App\Services\MessagePush; use App\Utils\Log; use Hyperf\Amqp\Message\ConsumerDelayedMessageTrait; use Hyperf\Amqp\Message\ProducerDelayedMessageTrait; @@ -17,6 +26,7 @@ use Hyperf\Amqp\Result; use Hyperf\Amqp\Annotation\Consumer; use Hyperf\Amqp\Message\ConsumerMessage; use Hyperf\DbConnection\Db; +use Hyperf\Snowflake\IdGeneratorInterface; use PhpAmqpLib\Message\AMQPMessage; #[Consumer(nums: 1)] @@ -42,7 +52,7 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage $params['detection_no'] = $data['detection_no']; $order_detection = OrderDetection::getOne($params); if (empty($order_detection)){ - Log::getInstance("queue-DoctorNotYetInquiry")->error("非法订单"); + Log::getInstance("queue-DetectionComplete")->error("非法订单"); return Result::ACK; } @@ -54,29 +64,210 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage // 存在未完成订单 // 获取现在时间距离订单结束时间的时间差 $time_diff = $InquiryService->getInquiryFinishTimeDiff($order_inquiry); + if ($time_diff == 0){ + $time_diff = 10; + } // 计算时间并重新加入队列 $queue_data = array(); - $queue_data['order_inquiry_id'] = $data['order_inquiry_id']; + $queue_data['detection_no'] = $data['detection_no']; $message = new DetectionCompleteDelayDirectProducer($queue_data); $message->setDelayMs(1000 * $time_diff); $producer = $this->container->get(Producer::class); $res = $producer->produce($message); if (!$res) { - Db::rollBack(); - Log::getInstance()->error("处理用户优惠卷过期队列 执行失败:未到过期时间,重新添加队列失败"); + Log::getInstance("queue-DetectionComplete")->error("重新添加队列失败"); return Result::REQUEUE; } + } + // 检测订单状态 + if ($order_detection['detection_status'] != 3){ + Log::getInstance("queue-DetectionComplete")->error("订单状态错误,无法处理"); return Result::DROP; } + if (!empty($order_detection['detection_result_pdf'])){ + Log::getInstance("queue-DetectionComplete")->error("无检测报告数据"); + return Result::DROP; + } + + // 获取医生数据 + $params = array(); + $params['doctor_id'] = $order_detection['doctor_id']; + $user_doctor = UserDoctor::getOne($params); + if (empty($user_doctor)){ + Log::getInstance("queue-DetectionComplete")->error("医生数据错误"); + return Result::DROP; + } + + // 获取检测病例数据 + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + $order_detection_case = OrderDetectionCase::getOne($params); + if (empty($order_detection_case)){ + Log::getInstance("queue-DetectionComplete")->error("订单数据错误"); + return Result::DROP; + } + + // 获取检测项目数据 + $params = array(); + $params['detection_project_id'] = $order_detection['detection_project_id']; + $detection_project = DetectionProject::getOne($params); + if (empty($detection_project)){ + Log::getInstance("queue-DetectionComplete")->error("订单数据错误"); + return Result::DROP; + } + + // 检测家庭成员是否存在 + $params = array(); + $params['family_id'] = $order_detection['family_id']; + $params['patient_id'] = $order_detection['patient_id']; + $patient_family = PatientFamily::getOne($params); + if (empty($patient_family)) { + Log::getInstance("queue-DetectionComplete")->error("患者信息错误"); + return Result::DROP; + } + + }catch (\Throwable $e){ - Log::getInstance("queue-DoctorNotYetInquiry")->error($e->getMessage()); - return Result::DROP; // 重回队列 + Log::getInstance("queue-DetectionComplete")->error($e->getMessage()); + return Result::DROP; } + Db::beginTransaction(); + + try { + $generator = $this->container->get(IdGeneratorInterface::class); + + // 创建问诊订单 + $data = array(); + $data['user_id'] = $order_detection['user_id']; + $data['patient_id'] = $order_detection['patient_id']; + $data['doctor_id'] = $order_detection['doctor_id']; + $data['family_id'] = $order_detection['family_id']; + $data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) + $data['inquiry_mode'] = 1; // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) + $data['inquiry_status'] = 4; // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) + $data['inquiry_pay_channel'] = 3; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) + $data['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) + $data['inquiry_no'] = $generator->generate();// 订单编号 + $data['escrow_trade_no'] = "GD" . $generator->generate(); // 第三方支付流水号 + $data['amount_total'] = 0;// 订单金额 + $data['coupon_amount_total'] = 0;// 优惠卷总金额 + $data['payment_amount_total'] = 0;// 实际付款金额 + $data['pay_time'] = date('Y-m-d H:i:s', time());// 支付时间 + $data['reception_time'] = date('Y-m-d H:i:s', time());// 接诊时间 + $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 + $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) + $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) + $data['patient_age'] = $patient_family['age'];// 患者年龄-就诊人 + $order_inquiry = OrderInquiry::addOrderInquiry($data); + if (empty($order_inquiry)) { + Db::rollBack(); + Log::getInstance("queue-DetectionComplete")->error("问诊订单创建失败"); + return Result::DROP; + } + + // 回填问诊订单id + $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + // 增加患者问诊病例 + $data = array(); + $data['user_id'] = $order_detection['user_id']; + $data['patient_id'] = $order_detection['patient_id']; + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id + $data['family_id'] = $patient_family['family_id']; // 家庭成员id + $data['relation'] = $patient_family['relation']; // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) + $data['name'] = $patient_family['card_name']; // 患者名称 + $data['sex'] = $patient_family['sex'] ?? 0; // 患者性别(0:未知 1:男 2:女) + $data['age'] = $patient_family['age'] ?? null; // 患者年龄 + $data['height'] = $patient_family['height'] ?: null; // 身高(cm) + $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) + $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); + if (empty($order_inquiry_case)) { + Db::rollBack(); + Log::getInstance("queue-DetectionComplete")->error("问诊订单病例创建失败"); + return Result::DROP; + } + + // 修改检测订单 + $data = array(); + $data['detection_status'] = 4; + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params,$data); + + // 回填检测结果字段 + $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + // 添加自动完成队列 + $time = 1000 * 60 * 60 * 24 * 3; + + $data = array(); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + $message = new AutoCompleteInquiryDelayDirectProducer($data); + $message->setDelayMs($time); + $producer = $this->container->get(Producer::class); + $res = $producer->produce($message); + if (!$res) { + Db::rollBack(); + Log::getInstance("queue-DetectionComplete")->error("添加自动完成队列失败"); + return Result::DROP; + } + + // 发送im消息 + $imService = new ImService(); + + // 患者病例 + $imService->patientCase( + $order_inquiry, + $user_doctor['user_id'], + $order_inquiry_case['disease_desc'] + ); + + // 发送IM消息-检测报告结果 + $imService->detectionTestReport( + $order_detection, + $user_doctor['user_id'], + $order_detection['user_id'], + $order_detection_case['detection_disease_class_names'], + $detection_project['detection_project_name'] + ); + + Db::commit(); + }catch (\Throwable $e){ + Db::rollBack(); + Log::getInstance("queue-DetectionComplete")->error($e->getMessage()); + return Result::DROP; + } + + // 发送消息 + try { + // 发送IM消息-检测报告结果-文字 + $imService->detectionTestReportStr( + $order_detection, + $user_doctor['user_name'], + $detection_project['detection_project_name'], + $user_doctor['user_id'], + $order_detection['user_id'] + ); + + // 患者-新报告生成通知 + $MessagePush = new MessagePush($order_detection['user_id']); + $MessagePush->patientDetectionResultNotice($order_detection['order_detection_id']); + + // 医生-通知医生患者检测报告已生成 + $MessagePush = new MessagePush($user_doctor['user_id']); + $MessagePush->doctorDetectionResultNotice($order_detection['order_detection_id']); + }catch (\Throwable $e){ + Log::getInstance("queue-DetectionComplete")->error($e->getMessage()); + return Result::DROP; + } return Result::ACK; } diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 7d4d57a..97c95de 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -4,6 +4,7 @@ namespace App\Controller; use App\Amqp\Producer\AssignDoctorDelayDirectProducer; use App\Amqp\Producer\AutoCompleteInquiryDelayDirectProducer; +use App\Amqp\Producer\DetectionCompleteDelayDirectProducer; use App\Amqp\Producer\DoctorNotYetInquiryDelayDirectProducer; use App\Constants\DoctorTitleCode; use App\Constants\HttpEnumCode; @@ -1411,7 +1412,7 @@ class CallBackController extends AbstractController $params['doctor_id'] = $order_detection['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ - return $this->detectionResultFailReturn("订单数据错误"); + return $this->detectionResultFailReturn("医生数据错误"); } // 获取检测病例数据 @@ -1660,9 +1661,52 @@ class CallBackController extends AbstractController $detection_result_pdf = $oss->putObject($detection_result_pdf_name, $pdfData); $detection_result_pdf = '/' . $detection_result_pdf; - Db::beginTransaction(); + // 获取医生数据 + $params = array(); + $params['doctor_id'] = $order_detection['doctor_id']; + $user_doctor = UserDoctor::getOne($params); + if (empty($user_doctor)){ + return $this->detectionResultFailReturn("医生数据错误"); + } + + // 获取检测病例数据 + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + $order_detection_case = OrderDetectionCase::getOne($params); + if (empty($order_detection_case)){ + return $this->detectionResultFailReturn("订单数据错误"); + } + + // 获取检测项目数据 + $params = array(); + $params['detection_project_id'] = $order_detection['detection_project_id']; + $detection_project = DetectionProject::getOne($params); + if (empty($detection_project)){ + return $this->detectionResultFailReturn("订单数据错误"); + } + + // 检测当前医生是否和患者存在未完成问诊订单 + $InquiryService = new InquiryService(); + $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($order_detection['user_id'],$order_detection['doctor_id']); + if(!empty($order_inquiry)){ + // 存在问诊订单 + $time_diff = $InquiryService->getInquiryFinishTimeDiff($order_inquiry); + if ($time_diff == 0){ + $time_diff = 60; + } + + // 计算时间并重新加入队列 + $queue_data = array(); + $queue_data['detection_no'] = $order_detection['detection_no']; + + $message = new DetectionCompleteDelayDirectProducer($queue_data); + $message->setDelayMs(1000 * $time_diff); + $producer = $this->container->get(Producer::class); + $res = $producer->produce($message); + if (!$res) { + return $this->detectionResultFailReturn("加入队列失败"); + } - try { // 修改检测订单 $data = array(); $data['detection_result_pdf'] = $detection_result_pdf; @@ -1672,12 +1716,169 @@ class CallBackController extends AbstractController $params['order_detection_id'] = $order_detection['order_detection_id']; OrderDetection::editOrderDetection($params,$data); + // 发送im消息 + $imService = new ImService(); + + // 发送IM消息-检测报告结果 + $imService->detectionTestReport( + $order_detection, + $user_doctor['user_id'], + $order_detection['user_id'], + $order_detection_case['detection_disease_class_names'], + $detection_project['detection_project_name'] + ); + + // 发送IM消息-检测报告结果-文字 + $imService->detectionTestReportStr( + $order_detection, + $user_doctor['user_name'], + $detection_project['detection_project_name'], + $user_doctor['user_id'], + $order_detection['user_id'] + ); + + return $this->detectionResultSuccessReturn(); + } + + // 检测家庭成员是否存在 + $params = array(); + $params['family_id'] = $order_detection['family_id']; + $params['patient_id'] = $order_detection['patient_id']; + $patient_family = PatientFamily::getOne($params); + if (empty($patient_family)) { + return $this->detectionResultFailReturn("患者信息错误"); + } + + Db::beginTransaction(); + + try { + $generator = $this->container->get(IdGeneratorInterface::class); + + // 创建问诊订单 + $data = array(); + $data['user_id'] = $order_detection['user_id']; + $data['patient_id'] = $order_detection['patient_id']; + $data['doctor_id'] = $order_detection['doctor_id']; + $data['family_id'] = $order_detection['family_id']; + $data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) + $data['inquiry_mode'] = 1; // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) + $data['inquiry_status'] = 4; // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) + $data['inquiry_pay_channel'] = 3; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) + $data['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) + $data['inquiry_no'] = $generator->generate();// 订单编号 + $data['escrow_trade_no'] = "GD" . $generator->generate(); // 第三方支付流水号 + $data['amount_total'] = 0;// 订单金额 + $data['coupon_amount_total'] = 0;// 优惠卷总金额 + $data['payment_amount_total'] = 0;// 实际付款金额 + $data['pay_time'] = date('Y-m-d H:i:s', time());// 支付时间 + $data['reception_time'] = date('Y-m-d H:i:s', time());// 接诊时间 + $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 + $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) + $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) + $data['patient_age'] = $patient_family['age'];// 患者年龄-就诊人 + $order_inquiry = OrderInquiry::addOrderInquiry($data); + if (empty($order_inquiry)) { + Db::rollBack(); + return $this->detectionResultFailReturn("问诊订单创建失败"); + } + + // 回填问诊订单id + $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + // 增加患者问诊病例 + $data = array(); + $data['user_id'] = $order_detection['user_id']; + $data['patient_id'] = $order_detection['patient_id']; + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id + $data['family_id'] = $patient_family['family_id']; // 家庭成员id + $data['relation'] = $patient_family['relation']; // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) + $data['name'] = $patient_family['card_name']; // 患者名称 + $data['sex'] = $patient_family['sex'] ?? 0; // 患者性别(0:未知 1:男 2:女) + $data['age'] = $patient_family['age'] ?? null; // 患者年龄 + $data['height'] = $patient_family['height'] ?: null; // 身高(cm) + $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) + $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); + if (empty($order_inquiry_case)) { + Db::rollBack(); + return $this->detectionResultFailReturn("问诊订单病例创建失败"); + } + + // 修改检测订单 + $data = array(); + $data['detection_status'] = 4; + $data['detection_result_pdf'] = $detection_result_pdf; + $data['detection_result_date'] = date('Y-m-d H:i:s',time()); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params,$data); + + // 回填检测结果字段 + $order_detection['detection_result_pdf'] = $detection_result_pdf; + $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + // 添加自动完成队列 + $time = 1000 * 60 * 60 * 24 * 3; + + $data = array(); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + $message = new AutoCompleteInquiryDelayDirectProducer($data); + $message->setDelayMs($time); + $producer = $this->container->get(Producer::class); + $res = $producer->produce($message); + if (!$res) { + Db::rollBack(); + return $this->detectionResultFailReturn("添加自动完成队列失败"); + } + + // 发送im消息 + $imService = new ImService(); + + // 患者病例 + $imService->patientCase( + $order_inquiry, + $user_doctor['user_id'], + $order_inquiry_case['disease_desc'] + ); + + // 发送IM消息-检测报告结果 + $imService->detectionTestReport( + $order_detection, + $user_doctor['user_id'], + $order_detection['user_id'], + $order_detection_case['detection_disease_class_names'], + $detection_project['detection_project_name'] + ); + Db::commit(); } catch (\Throwable $e) { Db::rollBack(); return $this->detectionResultFailReturn($e->getMessage()); } + try { + // 发送IM消息-检测报告结果-文字 + $imService->detectionTestReportStr( + $order_detection, + $user_doctor['user_name'], + $detection_project['detection_project_name'], + $user_doctor['user_id'], + $order_detection['user_id'] + ); + + // 患者-新报告生成通知 + $MessagePush = new MessagePush($order_detection['user_id']); + $MessagePush->patientDetectionResultNotice($order_detection['order_detection_id']); + + // 医生-通知医生患者检测报告已生成 + $MessagePush = new MessagePush($user_doctor['user_id']); + $MessagePush->doctorDetectionResultNotice($order_detection['order_detection_id']); + }catch (\Throwable $e){ + Log::getInstance("detectionResult")->error($e->getMessage()); + } + return $this->detectionResultSuccessReturn(); } catch (\Throwable $e) { return $this->detectionResultFailReturn("异常:" . $e->getMessage()); From 48f180dbb1b8a6ace4110c1a866202535eb11705 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 25 Aug 2023 18:12:15 +0800 Subject: [PATCH 101/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E9=97=AE=E8=AF=8A=E8=AE=A2=E5=8D=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=9B=9E=E8=B0=83=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetectionCompleteDelayDirectConsumer.php | 8 +- app/Controller/CallBackController.php | 241 ++++++++---------- app/Controller/DetectionController.php | 12 + app/Services/DetectionService.php | 231 +++++++++++++++++ config/routes.php | 3 + 5 files changed, 358 insertions(+), 137 deletions(-) diff --git a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php index a7fa172..69c44ee 100644 --- a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php +++ b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php @@ -65,7 +65,7 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage // 获取现在时间距离订单结束时间的时间差 $time_diff = $InquiryService->getInquiryFinishTimeDiff($order_inquiry); if ($time_diff == 0){ - $time_diff = 10; + $time_diff = 60; } // 计算时间并重新加入队列 @@ -129,8 +129,6 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage Log::getInstance("queue-DetectionComplete")->error("患者信息错误"); return Result::DROP; } - - }catch (\Throwable $e){ Log::getInstance("queue-DetectionComplete")->error($e->getMessage()); return Result::DROP; @@ -194,16 +192,12 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage // 修改检测订单 $data = array(); - $data['detection_status'] = 4; $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id $params = array(); $params['order_detection_id'] = $order_detection['order_detection_id']; OrderDetection::editOrderDetection($params,$data); - // 回填检测结果字段 - $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - // 添加自动完成队列 $time = 1000 * 60 * 60 * 24 * 3; diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 97c95de..f63f933 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1685,6 +1685,9 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("订单数据错误"); } + // 发送im消息 + $imService = new ImService(); + // 检测当前医生是否和患者存在未完成问诊订单 $InquiryService = new InquiryService(); $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($order_detection['user_id'],$order_detection['doctor_id']); @@ -1707,142 +1710,16 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("加入队列失败"); } - // 修改检测订单 - $data = array(); - $data['detection_result_pdf'] = $detection_result_pdf; - $data['detection_result_date'] = date('Y-m-d H:i:s',time()); - - $params = array(); - $params['order_detection_id'] = $order_detection['order_detection_id']; - OrderDetection::editOrderDetection($params,$data); - - // 发送im消息 - $imService = new ImService(); - - // 发送IM消息-检测报告结果 - $imService->detectionTestReport( - $order_detection, - $user_doctor['user_id'], - $order_detection['user_id'], - $order_detection_case['detection_disease_class_names'], - $detection_project['detection_project_name'] - ); - - // 发送IM消息-检测报告结果-文字 - $imService->detectionTestReportStr( - $order_detection, - $user_doctor['user_name'], - $detection_project['detection_project_name'], - $user_doctor['user_id'], - $order_detection['user_id'] - ); - - return $this->detectionResultSuccessReturn(); - } - - // 检测家庭成员是否存在 - $params = array(); - $params['family_id'] = $order_detection['family_id']; - $params['patient_id'] = $order_detection['patient_id']; - $patient_family = PatientFamily::getOne($params); - if (empty($patient_family)) { - return $this->detectionResultFailReturn("患者信息错误"); - } - - Db::beginTransaction(); - - try { - $generator = $this->container->get(IdGeneratorInterface::class); - - // 创建问诊订单 - $data = array(); - $data['user_id'] = $order_detection['user_id']; - $data['patient_id'] = $order_detection['patient_id']; - $data['doctor_id'] = $order_detection['doctor_id']; - $data['family_id'] = $order_detection['family_id']; - $data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) - $data['inquiry_mode'] = 1; // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) - $data['inquiry_status'] = 4; // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) - $data['inquiry_pay_channel'] = 3; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) - $data['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) - $data['inquiry_no'] = $generator->generate();// 订单编号 - $data['escrow_trade_no'] = "GD" . $generator->generate(); // 第三方支付流水号 - $data['amount_total'] = 0;// 订单金额 - $data['coupon_amount_total'] = 0;// 优惠卷总金额 - $data['payment_amount_total'] = 0;// 实际付款金额 - $data['pay_time'] = date('Y-m-d H:i:s', time());// 支付时间 - $data['reception_time'] = date('Y-m-d H:i:s', time());// 接诊时间 - $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 - $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) - $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) - $data['patient_age'] = $patient_family['age'];// 患者年龄-就诊人 - $order_inquiry = OrderInquiry::addOrderInquiry($data); - if (empty($order_inquiry)) { - Db::rollBack(); - return $this->detectionResultFailReturn("问诊订单创建失败"); - } - - // 回填问诊订单id - $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - - // 增加患者问诊病例 - $data = array(); - $data['user_id'] = $order_detection['user_id']; - $data['patient_id'] = $order_detection['patient_id']; - $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id - $data['family_id'] = $patient_family['family_id']; // 家庭成员id - $data['relation'] = $patient_family['relation']; // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) - $data['name'] = $patient_family['card_name']; // 患者名称 - $data['sex'] = $patient_family['sex'] ?? 0; // 患者性别(0:未知 1:男 2:女) - $data['age'] = $patient_family['age'] ?? null; // 患者年龄 - $data['height'] = $patient_family['height'] ?: null; // 身高(cm) - $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) - $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); - if (empty($order_inquiry_case)) { - Db::rollBack(); - return $this->detectionResultFailReturn("问诊订单病例创建失败"); - } - // 修改检测订单 $data = array(); $data['detection_status'] = 4; $data['detection_result_pdf'] = $detection_result_pdf; $data['detection_result_date'] = date('Y-m-d H:i:s',time()); - $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id $params = array(); $params['order_detection_id'] = $order_detection['order_detection_id']; OrderDetection::editOrderDetection($params,$data); - // 回填检测结果字段 - $order_detection['detection_result_pdf'] = $detection_result_pdf; - $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - - // 添加自动完成队列 - $time = 1000 * 60 * 60 * 24 * 3; - - $data = array(); - $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - - $message = new AutoCompleteInquiryDelayDirectProducer($data); - $message->setDelayMs($time); - $producer = $this->container->get(Producer::class); - $res = $producer->produce($message); - if (!$res) { - Db::rollBack(); - return $this->detectionResultFailReturn("添加自动完成队列失败"); - } - - // 发送im消息 - $imService = new ImService(); - - // 患者病例 - $imService->patientCase( - $order_inquiry, - $user_doctor['user_id'], - $order_inquiry_case['disease_desc'] - ); - // 发送IM消息-检测报告结果 $imService->detectionTestReport( $order_detection, @@ -1852,10 +1729,114 @@ class CallBackController extends AbstractController $detection_project['detection_project_name'] ); - Db::commit(); - } catch (\Throwable $e) { - Db::rollBack(); - return $this->detectionResultFailReturn($e->getMessage()); + return $this->detectionResultSuccessReturn(); + }else{ + // 检测家庭成员是否存在 + $params = array(); + $params['family_id'] = $order_detection['family_id']; + $params['patient_id'] = $order_detection['patient_id']; + $patient_family = PatientFamily::getOne($params); + if (empty($patient_family)) { + return $this->detectionResultFailReturn("患者信息错误"); + } + + Db::beginTransaction(); + + try { + $generator = $this->container->get(IdGeneratorInterface::class); + + // 创建问诊订单 + $data = array(); + $data['user_id'] = $order_detection['user_id']; + $data['patient_id'] = $order_detection['patient_id']; + $data['doctor_id'] = $order_detection['doctor_id']; + $data['family_id'] = $order_detection['family_id']; + $data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) + $data['inquiry_mode'] = 1; // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) + $data['inquiry_status'] = 4; // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) + $data['inquiry_pay_channel'] = 3; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) + $data['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) + $data['inquiry_no'] = $generator->generate();// 订单编号 + $data['escrow_trade_no'] = "GD" . $generator->generate(); // 第三方支付流水号 + $data['amount_total'] = 0;// 订单金额 + $data['coupon_amount_total'] = 0;// 优惠卷总金额 + $data['payment_amount_total'] = 0;// 实际付款金额 + $data['pay_time'] = date('Y-m-d H:i:s', time());// 支付时间 + $data['reception_time'] = date('Y-m-d H:i:s', time());// 接诊时间 + $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 + $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) + $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) + $data['patient_age'] = $patient_family['age'];// 患者年龄-就诊人 + $order_inquiry = OrderInquiry::addOrderInquiry($data); + if (empty($order_inquiry)) { + Db::rollBack(); + return $this->detectionResultFailReturn("问诊订单创建失败"); + } + + // 回填问诊订单id + $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + // 增加患者问诊病例 + $data = array(); + $data['user_id'] = $order_detection['user_id']; + $data['patient_id'] = $order_detection['patient_id']; + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id + $data['family_id'] = $patient_family['family_id']; // 家庭成员id + $data['relation'] = $patient_family['relation']; // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) + $data['name'] = $patient_family['card_name']; // 患者名称 + $data['sex'] = $patient_family['sex'] ?? 0; // 患者性别(0:未知 1:男 2:女) + $data['age'] = $patient_family['age'] ?? null; // 患者年龄 + $data['height'] = $patient_family['height'] ?: null; // 身高(cm) + $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) + $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); + if (empty($order_inquiry_case)) { + Db::rollBack(); + return $this->detectionResultFailReturn("问诊订单病例创建失败"); + } + + // 修改检测订单 + $data = array(); + $data['detection_status'] = 4; + $data['detection_result_pdf'] = $detection_result_pdf; + $data['detection_result_date'] = date('Y-m-d H:i:s',time()); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params,$data); + + // 回填检测结果字段 + $order_detection['detection_result_pdf'] = $detection_result_pdf; + + // 添加自动完成队列 + $time = 1000 * 60 * 60 * 24 * 3; + + $data = array(); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + $message = new AutoCompleteInquiryDelayDirectProducer($data); + $message->setDelayMs($time); + $producer = $this->container->get(Producer::class); + $res = $producer->produce($message); + if (!$res) { + Db::rollBack(); + return $this->detectionResultFailReturn("添加自动完成队列失败"); + } + + // 发送IM消息-检测报告结果 + $imService->detectionTestReport( + $order_detection, + $user_doctor['user_id'], + $order_detection['user_id'], + $order_detection_case['detection_disease_class_names'], + $detection_project['detection_project_name'] + ); + + Db::commit(); + } catch (\Throwable $e) { + Db::rollBack(); + return $this->detectionResultFailReturn($e->getMessage()); + } } try { diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php index 24b7e9e..ae6a7a5 100644 --- a/app/Controller/DetectionController.php +++ b/app/Controller/DetectionController.php @@ -107,4 +107,16 @@ class DetectionController extends AbstractController $data = $detectionService->bindDetectionTube(); return $this->response->json($data); } + + /** + * 创建检测问诊订单 + * @return ResponseInterface + */ + public function addDetectionInquiryOrder(): ResponseInterface + { + $detectionService = new DetectionService(); + $data = $detectionService->addDetectionInquiryOrder(); + return $this->response->json($data); + } + } \ No newline at end of file diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index a5532a9..e96908b 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -2,6 +2,7 @@ namespace App\Services; +use App\Amqp\Producer\AutoCompleteInquiryDelayDirectProducer; use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer; use App\Constants\HttpEnumCode; use App\Exception\BusinessException; @@ -15,6 +16,8 @@ use App\Model\DiseaseClassDetection; use App\Model\OrderDetection; use App\Model\OrderDetectionCase; use App\Model\OrderDetectionRefund; +use App\Model\OrderInquiry; +use App\Model\OrderInquiryCase; use App\Model\PatientFamily; use App\Model\UserDoctor; use App\Model\UserLocation; @@ -23,6 +26,7 @@ use App\Utils\PcreMatch; use Extend\Detection\Wy; use Extend\Wechat\WechatPay; use Hyperf\Amqp\Producer; +use Hyperf\Amqp\Result; use Hyperf\DbConnection\Db; use Hyperf\Snowflake\IdGeneratorInterface; use Psr\Container\ContainerExceptionInterface; @@ -521,6 +525,233 @@ class DetectionService extends BaseService return success(); } + /** + * 创建检测问诊订单 + * @return array + */ + public function addDetectionInquiryOrder(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $order_detection_id = $this->request->route("order_detection_id"); + + $request_params = $this->request->all(); + + // 定义返回数据 + /* + * status解释 + * 1:成功 + * 2:存在待支付订单 + * 3:存在待接诊订单 + * 4:存在接诊中订单 + * */ + $result = array(); + $result['status'] = 1; + $result['message'] = "成功"; + $result['data'] = ""; + + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['order_detection_id'] = $order_detection_id; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)){ + return fail(); + } + + // 检测订单状态 + if ($order_detection['detection_status'] != 4){ + return fail(HttpEnumCode::HTTP_ERROR,"订单状态错误"); + } + + Db::beginTransaction(); + try { + // 检测当前医生是否和患者存在未完成问诊订单 + $InquiryService = new InquiryService(); + $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($order_detection['user_id'],$order_detection['doctor_id']); + if (!empty($order_inquiry)){ + if ($order_inquiry['inquiry_status'] == 1){ + // 待支付 + Db::rollBack(); + + $result['status'] = 2; + $result['message'] = "当前医生有您未支付的订单,点击“继续”将为您取消订单直接进入报告解读服务。"; + $result['data'] = (string)$order_inquiry['order_inquiry_id']; + + return success($result); + } + + if ($order_inquiry['inquiry_status'] == 3){ + // 待接诊 + Db::rollBack(); + + $result['status'] = 3; + $result['message'] = "当前医生有您待接诊的订单,点击“继续”将为您取消订单直接进入报告解读服务。"; + $result['data'] = (string)$order_inquiry['order_inquiry_id']; + + return success($result); + } + + if ($order_inquiry['inquiry_status'] == 4){ + // 已接诊 + Db::rollBack(); + + $result['status'] = 4; + $result['message'] = "当前医生有您问诊中的订单,点击“继续”将进入聊天详情。"; + $result['data'] = (string)$order_inquiry['order_inquiry_id']; + + return success($result); + } + } + + // 获取医生数据 + $params = array(); + $params['doctor_id'] = $order_detection['doctor_id']; + $user_doctor = UserDoctor::getOne($params); + if (empty($user_doctor)){ + Db::rollBack(); + return fail(); + } + + // 获取检测病例数据 + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + $order_detection_case = OrderDetectionCase::getOne($params); + if (empty($order_detection_case)){ + Db::rollBack(); + return fail(); + } + + // 获取检测项目数据 + $params = array(); + $params['detection_project_id'] = $order_detection['detection_project_id']; + $detection_project = DetectionProject::getOne($params); + if (empty($detection_project)){ + Db::rollBack(); + return fail(); + } + + // 检测家庭成员是否存在 + $params = array(); + $params['family_id'] = $order_detection['family_id']; + $params['patient_id'] = $order_detection['patient_id']; + $patient_family = PatientFamily::getOne($params); + if (empty($patient_family)) { + Db::rollBack(); + return fail(); + } + + $generator = $this->container->get(IdGeneratorInterface::class); + + // 创建问诊订单 + $data = array(); + $data['user_id'] = $order_detection['user_id']; + $data['patient_id'] = $order_detection['patient_id']; + $data['doctor_id'] = $order_detection['doctor_id']; + $data['family_id'] = $order_detection['family_id']; + $data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) + $data['inquiry_mode'] = 1; // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) + $data['inquiry_status'] = 4; // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) + $data['inquiry_pay_channel'] = 3; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) + $data['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) + $data['inquiry_no'] = $generator->generate();// 订单编号 + $data['escrow_trade_no'] = "GD" . $generator->generate(); // 第三方支付流水号 + $data['amount_total'] = 0;// 订单金额 + $data['coupon_amount_total'] = 0;// 优惠卷总金额 + $data['payment_amount_total'] = 0;// 实际付款金额 + $data['pay_time'] = date('Y-m-d H:i:s', time());// 支付时间 + $data['reception_time'] = date('Y-m-d H:i:s', time());// 接诊时间 + $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 + $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) + $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) + $data['patient_age'] = $patient_family['age'];// 患者年龄-就诊人 + $order_inquiry = OrderInquiry::addOrderInquiry($data); + if (empty($order_inquiry)) { + Db::rollBack(); + return fail(); + } + + // 回填问诊订单id + $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + // 增加患者问诊病例 + $data = array(); + $data['user_id'] = $order_detection['user_id']; + $data['patient_id'] = $order_detection['patient_id']; + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id + $data['family_id'] = $patient_family['family_id']; // 家庭成员id + $data['relation'] = $patient_family['relation']; // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) + $data['name'] = $patient_family['card_name']; // 患者名称 + $data['sex'] = $patient_family['sex'] ?? 0; // 患者性别(0:未知 1:男 2:女) + $data['age'] = $patient_family['age'] ?? null; // 患者年龄 + $data['height'] = $patient_family['height'] ?: null; // 身高(cm) + $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) + $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); + if (empty($order_inquiry_case)) { + Db::rollBack(); + return fail(); + } + + // 修改检测订单 + $data = array(); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id + + $params = array(); + $params['order_detection_id'] = $order_detection['order_detection_id']; + OrderDetection::editOrderDetection($params,$data); + + // 添加自动完成队列 + $time = 1000 * 60 * 60 * 24 * 3; + + $data = array(); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + + $message = new AutoCompleteInquiryDelayDirectProducer($data); + $message->setDelayMs($time); + $producer = $this->container->get(Producer::class); + $res = $producer->produce($message); + if (!$res) { + Db::rollBack(); + return fail(); + } + + // 发送im消息 + $imService = new ImService(); + + // 患者病例 + $imService->patientCase( + $order_inquiry, + $user_doctor['user_id'], + $order_inquiry_case['disease_desc'] + ); + + // 发送IM消息-检测报告结果 + $imService->detectionTestReport( + $order_detection, + $user_doctor['user_id'], + $order_detection['user_id'], + $order_detection_case['detection_disease_class_names'], + $detection_project['detection_project_name'] + ); + + // 发送IM消息-检测报告结果-文字 + $imService->detectionTestReportStr( + $order_detection, + $user_doctor['user_name'], + $detection_project['detection_project_name'], + $user_doctor['user_id'], + $order_detection['user_id'] + ); + + Db::commit(); + }catch (\Throwable $e){ + Db::rollBack(); + Log::getInstance("DetectionService-bindDetectionTube")->error($e->getMessage()); + return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage()); + } + + return success($result); + } + /** * 取消未支付检测订单 * @param string|int $order_no 订单编号 diff --git a/config/routes.php b/config/routes.php index 494b22e..c94c597 100644 --- a/config/routes.php +++ b/config/routes.php @@ -295,6 +295,9 @@ Router::addGroup('/patient', function () { // 获取检测项目用途列表 Router::get('/purpose', [DetectionController::class, 'getDetectionProjectPurposeList']); }); + + // 创建检测问诊订单 + Router::post('/inquiry/{order_detection_id:\d+}', [DetectionController::class, 'addDetectionInquiryOrder']); }); // 医生数据 From a47dccdedcf8bde953ec37a129e9372be84b5c45 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 28 Aug 2023 09:05:14 +0800 Subject: [PATCH 102/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E5=BD=93=E5=89=8D=E5=8C=BB=E7=94=9F=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=92=8C=E6=82=A3=E8=80=85=E5=AD=98=E5=9C=A8=E6=9C=AA?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=97=AE=E8=AF=8A=E8=AE=A2=E5=8D=95=E5=A6=82?= =?UTF-8?q?=E6=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetectionCompleteDelayDirectConsumer.php | 2 +- app/Controller/CallBackController.php | 3 +- app/Services/DetectionService.php | 59 ++++++++++--------- 3 files changed, 33 insertions(+), 31 deletions(-) diff --git a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php index 69c44ee..8505043 100644 --- a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php +++ b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php @@ -59,7 +59,7 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage try { // 检测当前医生是否和患者存在未完成问诊订单 $InquiryService = new InquiryService(); - $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($order_detection['user_id'],$order_detection['doctor_id']); + $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($order_detection['patient_id'],$order_detection['doctor_id']); if (!empty($order_inquiry)){ // 存在未完成订单 // 获取现在时间距离订单结束时间的时间差 diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index f63f933..221c6ed 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1690,7 +1690,7 @@ class CallBackController extends AbstractController // 检测当前医生是否和患者存在未完成问诊订单 $InquiryService = new InquiryService(); - $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($order_detection['user_id'],$order_detection['doctor_id']); + $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($order_detection['patient_id'],$order_detection['doctor_id']); if(!empty($order_inquiry)){ // 存在问诊订单 $time_diff = $InquiryService->getInquiryFinishTimeDiff($order_inquiry); @@ -1698,6 +1698,7 @@ class CallBackController extends AbstractController $time_diff = 60; } + dump($time_diff); // 计算时间并重新加入队列 $queue_data = array(); $queue_data['detection_no'] = $order_detection['detection_no']; diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index e96908b..76959fc 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -567,7 +567,8 @@ class DetectionService extends BaseService try { // 检测当前医生是否和患者存在未完成问诊订单 $InquiryService = new InquiryService(); - $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($order_detection['user_id'],$order_detection['doctor_id']); + $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($order_detection['patient_id'],$order_detection['doctor_id']); + dump($order_inquiry); if (!empty($order_inquiry)){ if ($order_inquiry['inquiry_status'] == 1){ // 待支付 @@ -714,35 +715,35 @@ class DetectionService extends BaseService return fail(); } - // 发送im消息 - $imService = new ImService(); +// // 发送im消息 +// $imService = new ImService(); +// +// // 患者病例 +// $imService->patientCase( +// $order_inquiry, +// $user_doctor['user_id'], +// $order_inquiry_case['disease_desc'] +// ); +// +// // 发送IM消息-检测报告结果 +// $imService->detectionTestReport( +// $order_detection, +// $user_doctor['user_id'], +// $order_detection['user_id'], +// $order_detection_case['detection_disease_class_names'], +// $detection_project['detection_project_name'] +// ); +// +// // 发送IM消息-检测报告结果-文字 +// $imService->detectionTestReportStr( +// $order_detection, +// $user_doctor['user_name'], +// $detection_project['detection_project_name'], +// $user_doctor['user_id'], +// $order_detection['user_id'] +// ); - // 患者病例 - $imService->patientCase( - $order_inquiry, - $user_doctor['user_id'], - $order_inquiry_case['disease_desc'] - ); - - // 发送IM消息-检测报告结果 - $imService->detectionTestReport( - $order_detection, - $user_doctor['user_id'], - $order_detection['user_id'], - $order_detection_case['detection_disease_class_names'], - $detection_project['detection_project_name'] - ); - - // 发送IM消息-检测报告结果-文字 - $imService->detectionTestReportStr( - $order_detection, - $user_doctor['user_name'], - $detection_project['detection_project_name'], - $user_doctor['user_id'], - $order_detection['user_id'] - ); - - Db::commit(); +// Db::commit(); }catch (\Throwable $e){ Db::rollBack(); Log::getInstance("DetectionService-bindDetectionTube")->error($e->getMessage()); From 6543cddfa826a343fe210af200fc077820d3e6fd Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 28 Aug 2023 09:06:03 +0800 Subject: [PATCH 103/176] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DetectionService.php | 57 +++++++++++++++---------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 76959fc..d25fb96 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -568,7 +568,6 @@ class DetectionService extends BaseService // 检测当前医生是否和患者存在未完成问诊订单 $InquiryService = new InquiryService(); $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($order_detection['patient_id'],$order_detection['doctor_id']); - dump($order_inquiry); if (!empty($order_inquiry)){ if ($order_inquiry['inquiry_status'] == 1){ // 待支付 @@ -715,35 +714,35 @@ class DetectionService extends BaseService return fail(); } -// // 发送im消息 -// $imService = new ImService(); -// -// // 患者病例 -// $imService->patientCase( -// $order_inquiry, -// $user_doctor['user_id'], -// $order_inquiry_case['disease_desc'] -// ); -// -// // 发送IM消息-检测报告结果 -// $imService->detectionTestReport( -// $order_detection, -// $user_doctor['user_id'], -// $order_detection['user_id'], -// $order_detection_case['detection_disease_class_names'], -// $detection_project['detection_project_name'] -// ); -// -// // 发送IM消息-检测报告结果-文字 -// $imService->detectionTestReportStr( -// $order_detection, -// $user_doctor['user_name'], -// $detection_project['detection_project_name'], -// $user_doctor['user_id'], -// $order_detection['user_id'] -// ); + // 发送im消息 + $imService = new ImService(); -// Db::commit(); + // 患者病例 + $imService->patientCase( + $order_inquiry, + $user_doctor['user_id'], + $order_inquiry_case['disease_desc'] + ); + + // 发送IM消息-检测报告结果 + $imService->detectionTestReport( + $order_detection, + $user_doctor['user_id'], + $order_detection['user_id'], + $order_detection_case['detection_disease_class_names'], + $detection_project['detection_project_name'] + ); + + // 发送IM消息-检测报告结果-文字 + $imService->detectionTestReportStr( + $order_detection, + $user_doctor['user_name'], + $detection_project['detection_project_name'], + $user_doctor['user_id'], + $order_detection['user_id'] + ); + + Db::commit(); }catch (\Throwable $e){ Db::rollBack(); Log::getInstance("DetectionService-bindDetectionTube")->error($e->getMessage()); From 6301ae507936041663cf5433bf54998dccc8b464 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 28 Aug 2023 10:42:45 +0800 Subject: [PATCH 104/176] 1 --- .../DetectionCompleteDelayDirectConsumer.php | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php index 8505043..3d250f9 100644 --- a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php +++ b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php @@ -56,6 +56,22 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage return Result::ACK; } + // 检测订单状态 + if ($order_detection['detection_status'] != 4){ + Log::getInstance("queue-DetectionComplete")->error("订单状态错误,无法处理"); + return Result::DROP; + } + + if (!empty($order_detection['detection_result_pdf'])){ + Log::getInstance("queue-DetectionComplete")->error("无检测报告数据"); + return Result::DROP; + } + + if (!empty($order_detection['order_inquiry_id'])){ + Log::getInstance("queue-DetectionComplete")->info("已创建检测问诊订单,无需继续处理"); + return Result::ACK; + } + try { // 检测当前医生是否和患者存在未完成问诊订单 $InquiryService = new InquiryService(); @@ -82,17 +98,6 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage } } - // 检测订单状态 - if ($order_detection['detection_status'] != 3){ - Log::getInstance("queue-DetectionComplete")->error("订单状态错误,无法处理"); - return Result::DROP; - } - - if (!empty($order_detection['detection_result_pdf'])){ - Log::getInstance("queue-DetectionComplete")->error("无检测报告数据"); - return Result::DROP; - } - // 获取医生数据 $params = array(); $params['doctor_id'] = $order_detection['doctor_id']; From f9bf260291f1fc99cb8a9d8ccbd0adc8072e7b65 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 28 Aug 2023 14:01:30 +0800 Subject: [PATCH 105/176] 2 --- app/Services/DetectionService.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index d25fb96..4ca2a58 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -563,6 +563,15 @@ class DetectionService extends BaseService return fail(HttpEnumCode::HTTP_ERROR,"订单状态错误"); } + // 检测是否已经创建问诊订单 + if (!empty($order_detection['order_inquiry_id'])){ + $result['status'] = 1; + $result['message'] = "成功"; + $result['data'] = (string)$order_detection['order_inquiry_id']; + + return success($result); + } + Db::beginTransaction(); try { // 检测当前医生是否和患者存在未完成问诊订单 @@ -749,6 +758,10 @@ class DetectionService extends BaseService return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage()); } + $result['status'] = 1; + $result['message'] = "成功"; + $result['data'] = (string)$order_detection['order_inquiry_id']; + return success($result); } From 6cc8089dde89fef140c65a15aad6a9aeb45b018b Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 28 Aug 2023 14:25:15 +0800 Subject: [PATCH 106/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientOrderService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 85d1697..96a2011 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1932,7 +1932,7 @@ class PatientOrderService extends BaseService // 检测订单取消 // 取消订单原因(1:主动取消 2:客服取消 3:支付超时) $DetectionService = new DetectionService(); - $result = $DetectionService->cancelUnpayDetectionOrder($order_detection['detection_no'], 3, "支付超时"); + $result = $DetectionService->cancelUnpayDetectionOrder($order_detection['detection_no'], 1, "主动取消"); if ($result['status'] != 1) { Db::rollBack(); return fail(); From e044596a473b1df86d5c5475ab3943271e695ce0 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 28 Aug 2023 15:23:25 +0800 Subject: [PATCH 107/176] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8C=BB=E7=94=9Fger?= =?UTF-8?q?enzhongxin=E6=95=B0=E6=8D=AE=E6=96=B0=E5=A2=9E=E8=81=8C?= =?UTF-8?q?=E7=A7=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/UserDoctorService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 652becc..9005b04 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -564,6 +564,7 @@ class UserDoctorService extends BaseService 'multi_point_status', 'is_bind_bank', 'avatar', + 'doctor_title', ]; $user_doctor = UserDoctor::getOne($params, $fields); if (empty($user_doctor)) { From fb5d32c831f41b2f6d0018c4ac2af687cc513def Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 28 Aug 2023 15:26:52 +0800 Subject: [PATCH 108/176] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8C=BB=E7=94=9Fger?= =?UTF-8?q?enzhongxin=E6=95=B0=E6=8D=AE=E6=96=B0=E5=A2=9E=E8=81=8C?= =?UTF-8?q?=E7=A7=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/UserDoctorService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 9005b04..2b12007 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -603,6 +603,7 @@ class UserDoctorService extends BaseService $user_doctor['balance_account'] = $balance_account; $user_doctor['estimate_income'] = $estimate_income; + $user_doctor['doctor_title'] = DoctorTitleCode::getMessage($user_doctor['doctor_title']); return success($user_doctor); } From bb748354312df14cf645ec51adf5117a1d074c32 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 28 Aug 2023 15:50:39 +0800 Subject: [PATCH 109/176] =?UTF-8?q?=E6=82=A3=E8=80=85=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E8=AF=8A=E6=9C=8D=E5=8A=A1=E7=BB=93=E6=9D=9F=20,=E7=97=85?= =?UTF-8?q?=E6=83=85=E6=8F=8F=E8=BF=B0=E4=B8=BA=E7=A9=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/MessagePush.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 1384ddb..59fd5b2 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -417,9 +417,13 @@ class MessagePush extends BaseService } // 问诊内容 - $disease_desc = $order_inquiry_case['disease_desc']; - if (mb_strlen($disease_desc) > 15) { - $disease_desc = mb_substr($disease_desc, 0, 15, 'UTF-8') . '...'; + if (empty($order_inquiry_case['disease_desc'])){ + $disease_desc = $inquiry_type_string; + }else{ + $disease_desc = $order_inquiry_case['disease_desc']; + if (mb_strlen($disease_desc) > 15) { + $disease_desc = mb_substr($disease_desc, 0, 15, 'UTF-8') . '...'; + } } // 订阅 From 962ed9b7b316e2dbfceb91c94ae9a72091f4add8 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 28 Aug 2023 16:40:39 +0800 Subject: [PATCH 110/176] =?UTF-8?q?=E6=82=A3=E8=80=85=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=EF=BC=8C=E6=A3=80=E6=B5=8B=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/OrderDetection.php | 10 ++++++++++ app/Services/DetectionService.php | 14 ++++++++++++++ app/Services/UserPatientService.php | 5 +++++ 3 files changed, 29 insertions(+) diff --git a/app/Model/OrderDetection.php b/app/Model/OrderDetection.php index b2da6ba..cae0655 100644 --- a/app/Model/OrderDetection.php +++ b/app/Model/OrderDetection.php @@ -155,4 +155,14 @@ class OrderDetection extends Model return $data; } + + /** + * 获取数量 + * @param array $params + * @return int + */ + public static function getCount(array $params): int + { + return self::where($params)->count(); + } } diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 4ca2a58..60db330 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -953,4 +953,18 @@ class DetectionService extends BaseService $params['order_detection_id'] = $order_detection['order_detection_id']; OrderDetection::editOrderDetection($params, $data); } + + /** + * 获取患者某一状态下的检测订单数量 + * @param string $patient_id 患者id + * @param int $detection_status 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + * @return int + */ + public function getPatientDetectionWithStatus(string $patient_id,int $detection_status): int + { + $params = array(); + $params['patient_id'] = $patient_id; + $params['detection_status'] = $detection_status; + return OrderDetection::getCount($params); + } } \ No newline at end of file diff --git a/app/Services/UserPatientService.php b/app/Services/UserPatientService.php index 6e2de0a..1df621b 100644 --- a/app/Services/UserPatientService.php +++ b/app/Services/UserPatientService.php @@ -59,6 +59,10 @@ class UserPatientService extends BaseService $OrderProductService = new OrderProductService(); $order_product_count = $OrderProductService->getPatientProductWithStatus($user_patient['patient_id'],1); + // 获取检测数量-待支付 + $detectionService = new DetectionService(); + $order_detection_count = $detectionService->getPatientDetectionWithStatus($user_patient['patient_id'],1); + // 处理头像 $user_patient['avatar'] = addAliyunOssWebsite($user_patient['avatar']); @@ -70,6 +74,7 @@ class UserPatientService extends BaseService $result['order_inquiry_count'] = $order_inquiry_count; $result['order_prescription_count'] = $order_prescription_count; $result['order_product_count'] = $order_product_count; + $result['order_detection_count'] = $order_detection_count; return success($result); } From abde7c0aa4acb270f117e16607fe96b591b1dc08 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 29 Aug 2023 11:03:51 +0800 Subject: [PATCH 111/176] =?UTF-8?q?im=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 7 ++++++- app/Services/DetectionService.php | 2 -- app/Services/ImService.php | 2 +- app/Services/InquiryService.php | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 221c6ed..a80db9e 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1698,7 +1698,6 @@ class CallBackController extends AbstractController $time_diff = 60; } - dump($time_diff); // 计算时间并重新加入队列 $queue_data = array(); $queue_data['detection_no'] = $order_detection['detection_no']; @@ -1824,6 +1823,12 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("添加自动完成队列失败"); } + $imService->patientCase( + $order_inquiry, + $user_doctor['user_id'], + $order_inquiry_case['disease_desc'] + ); + // 发送IM消息-检测报告结果 $imService->detectionTestReport( $order_detection, diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 60db330..1d98b3f 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -535,8 +535,6 @@ class DetectionService extends BaseService $order_detection_id = $this->request->route("order_detection_id"); - $request_params = $this->request->all(); - // 定义返回数据 /* * status解释 diff --git a/app/Services/ImService.php b/app/Services/ImService.php index c6b579e..65f9a0d 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -747,7 +747,7 @@ class ImService extends BaseService * @param string $disease_desc * @return void */ - public function patientCase(array|object $order_inquiry, string $doctor_user_id,string|null $disease_desc): void + public function patientCase(array|object $order_inquiry, string $doctor_user_id,string|null $disease_desc = ""): void { try { // 发送消息 diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 92ca6c6..f19821c 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -876,6 +876,7 @@ class InquiryService extends BaseService if (empty($user_info)) { return fail(HttpEnumCode::HTTP_ERROR, "操作失败"); } + // 获取问诊订单数据 $params = array(); $params['order_inquiry_id'] = $order_inquiry_id; From cbeaee75c6f71b1b9fc23b2271081fec1c15950a Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 29 Aug 2023 11:08:39 +0800 Subject: [PATCH 112/176] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index a80db9e..5ae58da 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1661,6 +1661,9 @@ class CallBackController extends AbstractController $detection_result_pdf = $oss->putObject($detection_result_pdf_name, $pdfData); $detection_result_pdf = '/' . $detection_result_pdf; + // 回填检测结果字段 + $order_detection['detection_result_pdf'] = $detection_result_pdf; + // 获取医生数据 $params = array(); $params['doctor_id'] = $order_detection['doctor_id']; @@ -1805,9 +1808,6 @@ class CallBackController extends AbstractController $params['order_detection_id'] = $order_detection['order_detection_id']; OrderDetection::editOrderDetection($params,$data); - // 回填检测结果字段 - $order_detection['detection_result_pdf'] = $detection_result_pdf; - // 添加自动完成队列 $time = 1000 * 60 * 60 * 24 * 3; From 622be1f2637cdc93647e23e7dbd0e0385a85dab9 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 29 Aug 2023 14:48:34 +0800 Subject: [PATCH 113/176] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/routes.php b/config/routes.php index c94c597..d6e12d8 100644 --- a/config/routes.php +++ b/config/routes.php @@ -297,7 +297,11 @@ Router::addGroup('/patient', function () { }); // 创建检测问诊订单 - Router::post('/inquiry/{order_detection_id:\d+}', [DetectionController::class, 'addDetectionInquiryOrder']); + Router::post('/inquiry/{order_detection_id:\d+}', [DetectionController::class, 'addDetectionInquiryOrder'], + [ + 'middleware' => [LockRequestMiddleware::class] // 锁定重复请求 + ] + ); }); // 医生数据 From a86aec29e6e93480eaf4f33f2ffa26a74741fa34 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 29 Aug 2023 14:51:17 +0800 Subject: [PATCH 114/176] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 5ae58da..a2c5f0d 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1701,6 +1701,7 @@ class CallBackController extends AbstractController $time_diff = 60; } + dump($time_diff); // 计算时间并重新加入队列 $queue_data = array(); $queue_data['detection_no'] = $order_detection['detection_no']; From 1366e121fd1b3a20caa8709aefaa3ce64ec8bac4 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 29 Aug 2023 15:00:58 +0800 Subject: [PATCH 115/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9im=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index a2c5f0d..9e6032f 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1724,6 +1724,8 @@ class CallBackController extends AbstractController $params['order_detection_id'] = $order_detection['order_detection_id']; OrderDetection::editOrderDetection($params,$data); + $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + // 发送IM消息-检测报告结果 $imService->detectionTestReport( $order_detection, From 3606b62397af54a9f6982f95cbe9d515f4436720 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 29 Aug 2023 15:20:32 +0800 Subject: [PATCH 116/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetectionCompleteDelayDirectConsumer.php | 6 +- app/Controller/CallBackController.php | 503 +++++++++--------- app/Model/UserDoctor.php | 2 - app/Services/DetectionService.php | 6 +- app/Services/ImService.php | 10 +- 5 files changed, 267 insertions(+), 260 deletions(-) diff --git a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php index 3d250f9..fc5d629 100644 --- a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php +++ b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php @@ -235,7 +235,8 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage $user_doctor['user_id'], $order_detection['user_id'], $order_detection_case['detection_disease_class_names'], - $detection_project['detection_project_name'] + $detection_project['detection_project_name'], + $order_inquiry['inquiry_type'] ); Db::commit(); @@ -253,7 +254,8 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage $user_doctor['user_name'], $detection_project['detection_project_name'], $user_doctor['user_id'], - $order_detection['user_id'] + $order_detection['user_id'], + $order_inquiry['inquiry_type'] ); // 患者-新报告生成通知 diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 9e6032f..bdfe60e 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1334,253 +1334,253 @@ class CallBackController extends AbstractController return $server->serve(); } - /** - * 检测所结果回调 - * @return ResponseInterface - */ - public function DetectionResultCallBack1(): ResponseInterface - { - $request_params = $this->request->all(); - $auth = $this->request->header("Authorization"); - if (empty($auth)){ - return $this->detectionResultFailReturn("非法请求"); - } - - Log::getInstance("CallBackController-DetectionResultCallBack")->info("处理检测所结果"); - - try { - // 检测参数 - if (!isset($request_params['appId'])){ - return $this->detectionResultFailReturn("缺少appId参数"); - } - - if (!isset($request_params['orderCode'])){ - return $this->detectionResultFailReturn("缺少orderCode参数"); - } - - if (!isset($request_params['detectBarcode'])){ - return $this->detectionResultFailReturn("缺少detectBarcode参数"); - } - - if (!isset($request_params['pdfReport'])){ - return $this->detectionResultFailReturn("缺少pdfReport参数"); - } - - // 检测签名 - $params = array(); - $params['app_id'] = $request_params['appId']; - $basic_detection_organ = BasicDetectionOrgan::getOne($params); - if (empty($basic_detection_organ)){ - return $this->detectionResultFailReturn("非法appId"); - } - - $time = date('Ymd'); - $sign = md5($basic_detection_organ['app_id'] . $basic_detection_organ['app_secret'] . $time); - if ($auth != $sign){ - return $this->detectionResultFailReturn("签名错误"); - } - - // 检测pdf文件 - $pdfData = base64_decode($request_params['pdfReport']); - if (!$pdfData){ - return $this->detectionResultFailReturn("文件错误"); - } - - // 获取检测订单数据 - $params = array(); - $params['detection_no'] = $request_params['orderCode']; - $order_detection = OrderDetection::getOne($params); - if (empty($order_detection)){ - return $this->detectionResultFailReturn("非法订单"); - } - - // 检测订单状态 - if ($order_detection['detection_status'] != 3){ - return $this->detectionResultFailReturn("订单状态错误,无法处理"); - } - - if (!empty($order_detection['detection_result_pdf'])){ - return $this->detectionResultSuccessReturn(); - } - - if ($order_detection['detection_bar_code'] != $request_params['detectBarcode']){ - return $this->detectionResultFailReturn("检测条码无法对应"); - } - - // 获取医生数据 - $params = array(); - $params['doctor_id'] = $order_detection['doctor_id']; - $user_doctor = UserDoctor::getOne($params); - if (empty($user_doctor)){ - return $this->detectionResultFailReturn("医生数据错误"); - } - - // 获取检测病例数据 - $params = array(); - $params['order_detection_id'] = $order_detection['order_detection_id']; - $order_detection_case = OrderDetectionCase::getOne($params); - if (empty($order_detection_case)){ - return $this->detectionResultFailReturn("订单数据错误"); - } - - // 获取检测项目数据 - $params = array(); - $params['detection_project_id'] = $order_detection['detection_project_id']; - $detection_project = DetectionProject::getOne($params); - if (empty($detection_project)){ - return $this->detectionResultFailReturn("订单数据错误"); - } - - // 检测家庭成员是否存在 - $params = array(); - $params['family_id'] = $order_detection['family_id']; - $params['patient_id'] = $order_detection['patient_id']; - $patient_family = PatientFamily::getOne($params); - if (empty($patient_family)) { - return $this->detectionResultFailReturn("患者信息错误"); - } - - // 上传处方图片至oss - $oss = new Oss(); - $detection_result_pdf_name = "applet/patient/detection/pdf/" . $order_detection['order_detection_id'] . '.' . 'pdf'; - $detection_result_pdf = $oss->putObject($detection_result_pdf_name, $pdfData); - $detection_result_pdf = '/' . $detection_result_pdf; - - Db::beginTransaction(); - - try { - $generator = $this->container->get(IdGeneratorInterface::class); - - // 创建问诊订单 - $data = array(); - $data['user_id'] = $order_detection['user_id']; - $data['patient_id'] = $order_detection['patient_id']; - $data['doctor_id'] = $order_detection['doctor_id']; - $data['family_id'] = $order_detection['family_id']; - $data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) - $data['inquiry_mode'] = 1; // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) - $data['inquiry_status'] = 4; // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) - $data['inquiry_pay_channel'] = 3; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) - $data['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) - $data['inquiry_no'] = $generator->generate();// 订单编号 - $data['escrow_trade_no'] = "GD" . $generator->generate(); // 第三方支付流水号 - $data['amount_total'] = 0;// 订单金额 - $data['coupon_amount_total'] = 0;// 优惠卷总金额 - $data['payment_amount_total'] = 0;// 实际付款金额 - $data['pay_time'] = date('Y-m-d H:i:s', time());// 支付时间 - $data['reception_time'] = date('Y-m-d H:i:s', time());// 接诊时间 - $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 - $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) - $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) - $data['patient_age'] = $patient_family['age'];// 患者年龄-就诊人 - $order_inquiry = OrderInquiry::addOrderInquiry($data); - if (empty($order_inquiry)) { - Db::rollBack(); - return $this->detectionResultFailReturn("问诊订单创建失败"); - } - - // 回填问诊订单id - $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - - // 增加患者问诊病例 - $data = array(); - $data['user_id'] = $order_detection['user_id']; - $data['patient_id'] = $order_detection['patient_id']; - $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id - $data['family_id'] = $patient_family['family_id']; // 家庭成员id - $data['relation'] = $patient_family['relation']; // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) - $data['name'] = $patient_family['card_name']; // 患者名称 - $data['sex'] = $patient_family['sex'] ?? 0; // 患者性别(0:未知 1:男 2:女) - $data['age'] = $patient_family['age'] ?? null; // 患者年龄 - $data['height'] = $patient_family['height'] ?: null; // 身高(cm) - $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) - $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); - if (empty($order_inquiry_case)) { - Db::rollBack(); - return $this->detectionResultFailReturn("问诊订单病例创建失败"); - } - - // 修改检测订单 - $data = array(); - $data['detection_status'] = 4; - $data['detection_result_pdf'] = $detection_result_pdf; - $data['detection_result_date'] = date('Y-m-d H:i:s',time()); - $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id - - $params = array(); - $params['order_detection_id'] = $order_detection['order_detection_id']; - OrderDetection::editOrderDetection($params,$data); - - // 回填检测结果字段 - $order_detection['detection_result_pdf'] = $detection_result_pdf; - $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - - // 添加自动完成队列 - $time = 1000 * 60 * 60 * 24 * 3; - - $data = array(); - $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - - $message = new AutoCompleteInquiryDelayDirectProducer($data); - $message->setDelayMs($time); - $producer = $this->container->get(Producer::class); - $res = $producer->produce($message); - if (!$res) { - Db::rollBack(); - return $this->detectionResultFailReturn("添加自动完成队列失败"); - } - - // 发送im消息 - $imService = new ImService(); - - // 患者病例 - $imService->patientCase( - $order_inquiry, - $user_doctor['user_id'], - $order_inquiry_case['disease_desc'] - ); - - // 发送IM消息-检测报告结果 - $imService->detectionTestReport( - $order_detection, - $user_doctor['user_id'], - $order_detection['user_id'], - $order_detection_case['detection_disease_class_names'], - $detection_project['detection_project_name'] - ); - - Db::commit(); - } catch (\Throwable $e) { - Db::rollBack(); - return $this->detectionResultFailReturn($e->getMessage()); - } - - try { - // 发送IM消息-检测报告结果-文字 - $imService->detectionTestReportStr( - $order_detection, - $user_doctor['user_name'], - $detection_project['detection_project_name'], - $user_doctor['user_id'], - $order_detection['user_id'] - ); - - // 患者-新报告生成通知 - $MessagePush = new MessagePush($order_detection['user_id']); - $MessagePush->patientDetectionResultNotice($order_detection['order_detection_id']); - - // 医生-通知医生患者检测报告已生成 - $MessagePush = new MessagePush($user_doctor['user_id']); - $MessagePush->doctorDetectionResultNotice($order_detection['order_detection_id']); - }catch (\Throwable $e){ - Log::getInstance("detectionResult")->error($e->getMessage()); - } - - return $this->detectionResultSuccessReturn(); - } catch (\Throwable $e) { - return $this->detectionResultFailReturn("异常:" . $e->getMessage()); - } - } +// /** +// * 检测所结果回调 +// * @return ResponseInterface +// */ +// public function DetectionResultCallBack1(): ResponseInterface +// { +// $request_params = $this->request->all(); +// $auth = $this->request->header("Authorization"); +// if (empty($auth)){ +// return $this->detectionResultFailReturn("非法请求"); +// } +// +// Log::getInstance("CallBackController-DetectionResultCallBack")->info("处理检测所结果"); +// +// try { +// // 检测参数 +// if (!isset($request_params['appId'])){ +// return $this->detectionResultFailReturn("缺少appId参数"); +// } +// +// if (!isset($request_params['orderCode'])){ +// return $this->detectionResultFailReturn("缺少orderCode参数"); +// } +// +// if (!isset($request_params['detectBarcode'])){ +// return $this->detectionResultFailReturn("缺少detectBarcode参数"); +// } +// +// if (!isset($request_params['pdfReport'])){ +// return $this->detectionResultFailReturn("缺少pdfReport参数"); +// } +// +// // 检测签名 +// $params = array(); +// $params['app_id'] = $request_params['appId']; +// $basic_detection_organ = BasicDetectionOrgan::getOne($params); +// if (empty($basic_detection_organ)){ +// return $this->detectionResultFailReturn("非法appId"); +// } +// +// $time = date('Ymd'); +// $sign = md5($basic_detection_organ['app_id'] . $basic_detection_organ['app_secret'] . $time); +// if ($auth != $sign){ +// return $this->detectionResultFailReturn("签名错误"); +// } +// +// // 检测pdf文件 +// $pdfData = base64_decode($request_params['pdfReport']); +// if (!$pdfData){ +// return $this->detectionResultFailReturn("文件错误"); +// } +// +// // 获取检测订单数据 +// $params = array(); +// $params['detection_no'] = $request_params['orderCode']; +// $order_detection = OrderDetection::getOne($params); +// if (empty($order_detection)){ +// return $this->detectionResultFailReturn("非法订单"); +// } +// +// // 检测订单状态 +// if ($order_detection['detection_status'] != 3){ +// return $this->detectionResultFailReturn("订单状态错误,无法处理"); +// } +// +// if (!empty($order_detection['detection_result_pdf'])){ +// return $this->detectionResultSuccessReturn(); +// } +// +// if ($order_detection['detection_bar_code'] != $request_params['detectBarcode']){ +// return $this->detectionResultFailReturn("检测条码无法对应"); +// } +// +// // 获取医生数据 +// $params = array(); +// $params['doctor_id'] = $order_detection['doctor_id']; +// $user_doctor = UserDoctor::getOne($params); +// if (empty($user_doctor)){ +// return $this->detectionResultFailReturn("医生数据错误"); +// } +// +// // 获取检测病例数据 +// $params = array(); +// $params['order_detection_id'] = $order_detection['order_detection_id']; +// $order_detection_case = OrderDetectionCase::getOne($params); +// if (empty($order_detection_case)){ +// return $this->detectionResultFailReturn("订单数据错误"); +// } +// +// // 获取检测项目数据 +// $params = array(); +// $params['detection_project_id'] = $order_detection['detection_project_id']; +// $detection_project = DetectionProject::getOne($params); +// if (empty($detection_project)){ +// return $this->detectionResultFailReturn("订单数据错误"); +// } +// +// // 检测家庭成员是否存在 +// $params = array(); +// $params['family_id'] = $order_detection['family_id']; +// $params['patient_id'] = $order_detection['patient_id']; +// $patient_family = PatientFamily::getOne($params); +// if (empty($patient_family)) { +// return $this->detectionResultFailReturn("患者信息错误"); +// } +// +// // 上传处方图片至oss +// $oss = new Oss(); +// $detection_result_pdf_name = "applet/patient/detection/pdf/" . $order_detection['order_detection_id'] . '.' . 'pdf'; +// $detection_result_pdf = $oss->putObject($detection_result_pdf_name, $pdfData); +// $detection_result_pdf = '/' . $detection_result_pdf; +// +// Db::beginTransaction(); +// +// try { +// $generator = $this->container->get(IdGeneratorInterface::class); +// +// // 创建问诊订单 +// $data = array(); +// $data['user_id'] = $order_detection['user_id']; +// $data['patient_id'] = $order_detection['patient_id']; +// $data['doctor_id'] = $order_detection['doctor_id']; +// $data['family_id'] = $order_detection['family_id']; +// $data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) +// $data['inquiry_mode'] = 1; // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) +// $data['inquiry_status'] = 4; // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) +// $data['inquiry_pay_channel'] = 3; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) +// $data['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) +// $data['inquiry_no'] = $generator->generate();// 订单编号 +// $data['escrow_trade_no'] = "GD" . $generator->generate(); // 第三方支付流水号 +// $data['amount_total'] = 0;// 订单金额 +// $data['coupon_amount_total'] = 0;// 优惠卷总金额 +// $data['payment_amount_total'] = 0;// 实际付款金额 +// $data['pay_time'] = date('Y-m-d H:i:s', time());// 支付时间 +// $data['reception_time'] = date('Y-m-d H:i:s', time());// 接诊时间 +// $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 +// $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) +// $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) +// $data['patient_age'] = $patient_family['age'];// 患者年龄-就诊人 +// $order_inquiry = OrderInquiry::addOrderInquiry($data); +// if (empty($order_inquiry)) { +// Db::rollBack(); +// return $this->detectionResultFailReturn("问诊订单创建失败"); +// } +// +// // 回填问诊订单id +// $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; +// +// // 增加患者问诊病例 +// $data = array(); +// $data['user_id'] = $order_detection['user_id']; +// $data['patient_id'] = $order_detection['patient_id']; +// $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id +// $data['family_id'] = $patient_family['family_id']; // 家庭成员id +// $data['relation'] = $patient_family['relation']; // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) +// $data['name'] = $patient_family['card_name']; // 患者名称 +// $data['sex'] = $patient_family['sex'] ?? 0; // 患者性别(0:未知 1:男 2:女) +// $data['age'] = $patient_family['age'] ?? null; // 患者年龄 +// $data['height'] = $patient_family['height'] ?: null; // 身高(cm) +// $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) +// $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); +// if (empty($order_inquiry_case)) { +// Db::rollBack(); +// return $this->detectionResultFailReturn("问诊订单病例创建失败"); +// } +// +// // 修改检测订单 +// $data = array(); +// $data['detection_status'] = 4; +// $data['detection_result_pdf'] = $detection_result_pdf; +// $data['detection_result_date'] = date('Y-m-d H:i:s',time()); +// $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id +// +// $params = array(); +// $params['order_detection_id'] = $order_detection['order_detection_id']; +// OrderDetection::editOrderDetection($params,$data); +// +// // 回填检测结果字段 +// $order_detection['detection_result_pdf'] = $detection_result_pdf; +// $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; +// +// // 添加自动完成队列 +// $time = 1000 * 60 * 60 * 24 * 3; +// +// $data = array(); +// $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; +// +// $message = new AutoCompleteInquiryDelayDirectProducer($data); +// $message->setDelayMs($time); +// $producer = $this->container->get(Producer::class); +// $res = $producer->produce($message); +// if (!$res) { +// Db::rollBack(); +// return $this->detectionResultFailReturn("添加自动完成队列失败"); +// } +// +// // 发送im消息 +// $imService = new ImService(); +// +// // 患者病例 +// $imService->patientCase( +// $order_inquiry, +// $user_doctor['user_id'], +// $order_inquiry_case['disease_desc'] +// ); +// +// // 发送IM消息-检测报告结果 +// $imService->detectionTestReport( +// $order_detection, +// $user_doctor['user_id'], +// $order_detection['user_id'], +// $order_detection_case['detection_disease_class_names'], +// $detection_project['detection_project_name'] +// ); +// +// Db::commit(); +// } catch (\Throwable $e) { +// Db::rollBack(); +// return $this->detectionResultFailReturn($e->getMessage()); +// } +// +// try { +// // 发送IM消息-检测报告结果-文字 +// $imService->detectionTestReportStr( +// $order_detection, +// $user_doctor['user_name'], +// $detection_project['detection_project_name'], +// $user_doctor['user_id'], +// $order_detection['user_id'] +// ); +// +// // 患者-新报告生成通知 +// $MessagePush = new MessagePush($order_detection['user_id']); +// $MessagePush->patientDetectionResultNotice($order_detection['order_detection_id']); +// +// // 医生-通知医生患者检测报告已生成 +// $MessagePush = new MessagePush($user_doctor['user_id']); +// $MessagePush->doctorDetectionResultNotice($order_detection['order_detection_id']); +// }catch (\Throwable $e){ +// Log::getInstance("detectionResult")->error($e->getMessage()); +// } +// +// return $this->detectionResultSuccessReturn(); +// } catch (\Throwable $e) { +// return $this->detectionResultFailReturn("异常:" . $e->getMessage()); +// } +// } /** * 检测所结果回调 @@ -1732,7 +1732,8 @@ class CallBackController extends AbstractController $user_doctor['user_id'], $order_detection['user_id'], $order_detection_case['detection_disease_class_names'], - $detection_project['detection_project_name'] + $detection_project['detection_project_name'], + $order_inquiry['inquiry_type'] ); return $this->detectionResultSuccessReturn(); @@ -1838,7 +1839,8 @@ class CallBackController extends AbstractController $user_doctor['user_id'], $order_detection['user_id'], $order_detection_case['detection_disease_class_names'], - $detection_project['detection_project_name'] + $detection_project['detection_project_name'], + $order_inquiry['inquiry_type'] ); Db::commit(); @@ -1855,7 +1857,8 @@ class CallBackController extends AbstractController $user_doctor['user_name'], $detection_project['detection_project_name'], $user_doctor['user_id'], - $order_detection['user_id'] + $order_detection['user_id'], + $order_inquiry['inquiry_type'] ); // 患者-新报告生成通知 diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index 741c5af..9ff4a30 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -300,8 +300,6 @@ class UserDoctor extends Model return $data; } - - /** * 获取是否存在 * @param array $params diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 1d98b3f..9046935 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -737,7 +737,8 @@ class DetectionService extends BaseService $user_doctor['user_id'], $order_detection['user_id'], $order_detection_case['detection_disease_class_names'], - $detection_project['detection_project_name'] + $detection_project['detection_project_name'], + $order_inquiry['inquiry_type'] ); // 发送IM消息-检测报告结果-文字 @@ -746,7 +747,8 @@ class DetectionService extends BaseService $user_doctor['user_name'], $detection_project['detection_project_name'], $user_doctor['user_id'], - $order_detection['user_id'] + $order_detection['user_id'], + $order_inquiry['inquiry_type'] ); Db::commit(); diff --git a/app/Services/ImService.php b/app/Services/ImService.php index 65f9a0d..a00e4c3 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -670,16 +670,17 @@ class ImService extends BaseService * @param string $patient_user_id 患者user_id * @param string $disease_class_names 疾病数据 * @param string $detection_project_name + * @param string|int $inquiry_type * @return void */ - public function detectionTestReport(array|object $order_detection,string $doctor_user_id, string $patient_user_id,string $disease_class_names,string $detection_project_name): void + public function detectionTestReport(array|object $order_detection,string $doctor_user_id, string $patient_user_id,string $disease_class_names,string $detection_project_name,string|int $inquiry_type): void { try { // 发送消息 $cloud_custom_data = array(); $cloud_custom_data['order_inquiry_id'] = (string)$order_detection['order_inquiry_id']; $cloud_custom_data['is_system'] = 1; - $cloud_custom_data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) + $cloud_custom_data['inquiry_type'] = $inquiry_type; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) $cloud_custom_data['message_rounds'] = 0; $cloud_custom_data['order_no'] = $order_detection['detection_no']; $cloud_custom_data['patient_family_data']['patient_name'] = $order_detection['patient_name']; @@ -713,16 +714,17 @@ class ImService extends BaseService * @param string $detection_project_name 检测项目名称 * @param string $doctor_user_id 医生user_id * @param string $patient_user_id 患者user_id + * @param string|int $inquiry_type * @return void */ - public function detectionTestReportStr(array|object $order_detection,string $doctor_name,string $detection_project_name,string $doctor_user_id, string $patient_user_id): void + public function detectionTestReportStr(array|object $order_detection,string $doctor_name,string $detection_project_name,string $doctor_user_id, string $patient_user_id,string|int $inquiry_type): void { try { // 消息内容 $cloud_custom_data = array(); $cloud_custom_data['order_inquiry_id'] = (string)$order_detection['order_inquiry_id']; $cloud_custom_data['is_system'] = 1; - $cloud_custom_data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) + $cloud_custom_data['inquiry_type'] = $inquiry_type; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) $cloud_custom_data['message_rounds'] = 0; $cloud_custom_data['order_no'] = $order_detection['detection_no']; $cloud_custom_data['patient_family_data']['patient_name'] = $order_detection['patient_name']; From b593520857a56818d17f6a5dff62698f85d49702 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 29 Aug 2023 15:38:10 +0800 Subject: [PATCH 117/176] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AE=B6=E5=BA=AD?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=88=97=E8=A1=A8=E6=96=B0=E5=A2=9E=E6=B0=91?= =?UTF-8?q?=E6=97=8F=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientFamilyService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Services/PatientFamilyService.php b/app/Services/PatientFamilyService.php index 272ff2d..a67193d 100644 --- a/app/Services/PatientFamilyService.php +++ b/app/Services/PatientFamilyService.php @@ -43,6 +43,7 @@ class PatientFamilyService extends BaseService 'sex', 'age', 'nation_id', + 'nation_name', ]; $patient_familys = PatientFamilyModel::getList($params, $field); From 3e8562641e9fbc1c1719bbc93beb225cefb5edef Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 29 Aug 2023 17:49:04 +0800 Subject: [PATCH 118/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9im=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetectionCompleteDelayDirectConsumer.php | 49 ++++++---- app/Controller/CallBackController.php | 91 ++++++++++++------- app/Services/DetectionService.php | 47 ++++++---- app/Services/ImService.php | 51 +++++------ 4 files changed, 140 insertions(+), 98 deletions(-) diff --git a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php index fc5d629..d5070b1 100644 --- a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php +++ b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php @@ -62,7 +62,7 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage return Result::DROP; } - if (!empty($order_detection['detection_result_pdf'])){ + if (empty($order_detection['detection_result_pdf'])){ Log::getInstance("queue-DetectionComplete")->error("无检测报告数据"); return Result::DROP; } @@ -173,9 +173,6 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage return Result::DROP; } - // 回填问诊订单id - $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - // 增加患者问诊病例 $data = array(); $data['user_id'] = $order_detection['user_id']; @@ -230,14 +227,20 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage ); // 发送IM消息-检测报告结果 - $imService->detectionTestReport( - $order_detection, - $user_doctor['user_id'], - $order_detection['user_id'], - $order_detection_case['detection_disease_class_names'], - $detection_project['detection_project_name'], - $order_inquiry['inquiry_type'] - ); + $data = [ + "order_inquiry_id" => $order_inquiry['order_inquiry_id'], + "inquiry_type" => $order_inquiry['inquiry_type'], + "detection_no" => $order_detection['detection_no'], + "patient_name" => $order_detection['patient_name'], + "patient_sex" => $order_detection['patient_sex'], + "patient_age" => $order_detection['patient_age'], + "detection_project_name" => $detection_project['detection_project_name'], + "disease_class_names" => $order_detection_case['detection_disease_class_names'], + "detection_result_pdf" => $order_detection['detection_result_pdf'], + "patient_user_id" => $order_detection['user_id'], + "doctor_user_id" => $user_doctor['user_id'], + ]; + $imService->detectionTestReport($data); Db::commit(); }catch (\Throwable $e){ @@ -249,14 +252,20 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage // 发送消息 try { // 发送IM消息-检测报告结果-文字 - $imService->detectionTestReportStr( - $order_detection, - $user_doctor['user_name'], - $detection_project['detection_project_name'], - $user_doctor['user_id'], - $order_detection['user_id'], - $order_inquiry['inquiry_type'] - ); + $data = [ + "order_inquiry_id" => $order_inquiry['order_inquiry_id'], + "inquiry_type" => $order_inquiry['inquiry_type'], + "detection_no" => $order_detection['detection_no'], + "doctor_name" => $user_doctor['user_name'], + "patient_name" => $order_detection['patient_name'], + "patient_sex" => $order_detection['patient_sex'], + "patient_age" => $order_detection['patient_age'], + "detection_project_name" => $detection_project['detection_project_name'], + "patient_user_id" => $order_detection['user_id'], + "doctor_user_id" => $user_doctor['user_id'], + ]; + + $imService->detectionTestReportStr($data); // 患者-新报告生成通知 $MessagePush = new MessagePush($order_detection['user_id']); diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index bdfe60e..8b6f44f 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1724,17 +1724,37 @@ class CallBackController extends AbstractController $params['order_detection_id'] = $order_detection['order_detection_id']; OrderDetection::editOrderDetection($params,$data); - $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - // 发送IM消息-检测报告结果 - $imService->detectionTestReport( - $order_detection, - $user_doctor['user_id'], - $order_detection['user_id'], - $order_detection_case['detection_disease_class_names'], - $detection_project['detection_project_name'], - $order_inquiry['inquiry_type'] - ); + $data = [ + "order_inquiry_id" => $order_inquiry['order_inquiry_id'], + "inquiry_type" => $order_inquiry['inquiry_type'], + "detection_no" => $order_detection['detection_no'], + "patient_name" => $order_inquiry['patient_name'], + "patient_sex" => $order_inquiry['patient_sex'], + "patient_age" => $order_inquiry['patient_age'], + "detection_project_name" => $detection_project['detection_project_name'], + "disease_class_names" => $order_detection_case['detection_disease_class_names'], + "detection_result_pdf" => $order_detection['detection_result_pdf'], + "patient_user_id" => $order_detection['user_id'], + "doctor_user_id" => $user_doctor['user_id'], + ]; + $imService->detectionTestReport($data); + + // 发送IM消息-检测报告结果-文字 + $data = [ + "order_inquiry_id" => $order_inquiry['order_inquiry_id'], + "inquiry_type" => $order_inquiry['inquiry_type'], + "detection_no" => $order_detection['detection_no'], + "doctor_name" => $user_doctor['user_name'], + "patient_name" => $order_inquiry['patient_name'], + "patient_sex" => $order_inquiry['patient_sex'], + "patient_age" => $order_inquiry['patient_age'], + "detection_project_name" => $detection_project['detection_project_name'], + "patient_user_id" => $order_detection['user_id'], + "doctor_user_id" => $user_doctor['user_id'], + ]; + + $imService->detectionTestReportStr($data); return $this->detectionResultSuccessReturn(); }else{ @@ -1780,9 +1800,6 @@ class CallBackController extends AbstractController return $this->detectionResultFailReturn("问诊订单创建失败"); } - // 回填问诊订单id - $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - // 增加患者问诊病例 $data = array(); $data['user_id'] = $order_detection['user_id']; @@ -1834,14 +1851,36 @@ class CallBackController extends AbstractController ); // 发送IM消息-检测报告结果 - $imService->detectionTestReport( - $order_detection, - $user_doctor['user_id'], - $order_detection['user_id'], - $order_detection_case['detection_disease_class_names'], - $detection_project['detection_project_name'], - $order_inquiry['inquiry_type'] - ); + $data = [ + "order_inquiry_id" => $order_inquiry['order_inquiry_id'], + "inquiry_type" => $order_inquiry['inquiry_type'], + "detection_no" => $order_detection['detection_no'], + "patient_name" => $order_detection['patient_name'], + "patient_sex" => $order_detection['patient_sex'], + "patient_age" => $order_detection['patient_age'], + "detection_project_name" => $detection_project['detection_project_name'], + "disease_class_names" => $order_detection_case['detection_disease_class_names'], + "detection_result_pdf" => $order_detection['detection_result_pdf'], + "patient_user_id" => $order_detection['user_id'], + "doctor_user_id" => $user_doctor['user_id'], + ]; + $imService->detectionTestReport($data); + + // 发送IM消息-检测报告结果-文字 + $data = [ + "order_inquiry_id" => $order_inquiry['order_inquiry_id'], + "inquiry_type" => $order_inquiry['inquiry_type'], + "detection_no" => $order_detection['detection_no'], + "doctor_name" => $user_doctor['user_name'], + "patient_name" => $order_detection['patient_name'], + "patient_sex" => $order_detection['patient_sex'], + "patient_age" => $order_detection['patient_age'], + "detection_project_name" => $detection_project['detection_project_name'], + "patient_user_id" => $order_detection['user_id'], + "doctor_user_id" => $user_doctor['user_id'], + ]; + + $imService->detectionTestReportStr($data); Db::commit(); } catch (\Throwable $e) { @@ -1851,16 +1890,6 @@ class CallBackController extends AbstractController } try { - // 发送IM消息-检测报告结果-文字 - $imService->detectionTestReportStr( - $order_detection, - $user_doctor['user_name'], - $detection_project['detection_project_name'], - $user_doctor['user_id'], - $order_detection['user_id'], - $order_inquiry['inquiry_type'] - ); - // 患者-新报告生成通知 $MessagePush = new MessagePush($order_detection['user_id']); $MessagePush->patientDetectionResultNotice($order_detection['order_detection_id']); diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 9046935..221192f 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -677,9 +677,6 @@ class DetectionService extends BaseService return fail(); } - // 回填问诊订单id - $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - // 增加患者问诊病例 $data = array(); $data['user_id'] = $order_detection['user_id']; @@ -732,24 +729,36 @@ class DetectionService extends BaseService ); // 发送IM消息-检测报告结果 - $imService->detectionTestReport( - $order_detection, - $user_doctor['user_id'], - $order_detection['user_id'], - $order_detection_case['detection_disease_class_names'], - $detection_project['detection_project_name'], - $order_inquiry['inquiry_type'] - ); + $data = [ + "order_inquiry_id" => $order_inquiry['order_inquiry_id'], + "inquiry_type" => $order_inquiry['inquiry_type'], + "detection_no" => $order_detection['detection_no'], + "patient_name" => $order_detection['patient_name'], + "patient_sex" => $order_detection['patient_sex'], + "patient_age" => $order_detection['patient_age'], + "detection_project_name" => $detection_project['detection_project_name'], + "disease_class_names" => $order_detection_case['detection_disease_class_names'], + "detection_result_pdf" => $order_detection['detection_result_pdf'], + "patient_user_id" => $order_detection['user_id'], + "doctor_user_id" => $user_doctor['user_id'], + ]; + $imService->detectionTestReport($data); // 发送IM消息-检测报告结果-文字 - $imService->detectionTestReportStr( - $order_detection, - $user_doctor['user_name'], - $detection_project['detection_project_name'], - $user_doctor['user_id'], - $order_detection['user_id'], - $order_inquiry['inquiry_type'] - ); + $data = [ + "order_inquiry_id" => $order_inquiry['order_inquiry_id'], + "inquiry_type" => $order_inquiry['inquiry_type'], + "detection_no" => $order_detection['detection_no'], + "doctor_name" => $user_doctor['user_name'], + "patient_name" => $order_detection['patient_name'], + "patient_sex" => $order_detection['patient_sex'], + "patient_age" => $order_detection['patient_age'], + "detection_project_name" => $detection_project['detection_project_name'], + "patient_user_id" => $order_detection['user_id'], + "doctor_user_id" => $user_doctor['user_id'], + ]; + + $imService->detectionTestReportStr($data); Db::commit(); }catch (\Throwable $e){ diff --git a/app/Services/ImService.php b/app/Services/ImService.php index a00e4c3..f7c4dc8 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -665,42 +665,37 @@ class ImService extends BaseService /** * 糖组检测报告 - * @param array|object $order_detection 检测订单数据 - * @param string $doctor_user_id 医生user_id - * @param string $patient_user_id 患者user_id - * @param string $disease_class_names 疾病数据 - * @param string $detection_project_name - * @param string|int $inquiry_type + * @param array $data * @return void */ - public function detectionTestReport(array|object $order_detection,string $doctor_user_id, string $patient_user_id,string $disease_class_names,string $detection_project_name,string|int $inquiry_type): void + public function detectionTestReport(array $data): void { try { // 发送消息 $cloud_custom_data = array(); - $cloud_custom_data['order_inquiry_id'] = (string)$order_detection['order_inquiry_id']; + $cloud_custom_data['order_inquiry_id'] = (string)$data['order_inquiry_id']; $cloud_custom_data['is_system'] = 1; - $cloud_custom_data['inquiry_type'] = $inquiry_type; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) + $cloud_custom_data['inquiry_type'] = $data['inquiry_type']; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) $cloud_custom_data['message_rounds'] = 0; - $cloud_custom_data['order_no'] = $order_detection['detection_no']; - $cloud_custom_data['patient_family_data']['patient_name'] = $order_detection['patient_name']; - $cloud_custom_data['patient_family_data']['patient_sex'] = $order_detection['patient_sex']; - $cloud_custom_data['patient_family_data']['patient_age'] = $order_detection['patient_age']; + $cloud_custom_data['order_no'] = $data['detection_no']; + $cloud_custom_data['patient_family_data']['patient_name'] = $data['patient_name']; + $cloud_custom_data['patient_family_data']['patient_sex'] = $data['patient_sex']; + $cloud_custom_data['patient_family_data']['patient_age'] = $data['patient_age']; // 消息内容 $message_content_data = array(); $message_content_data['message_type'] = 10; - $message_content_data['title'] = $detection_project_name; + $message_content_data['title'] = $data['detection_project_name']; $message_content_data['desc'] = ""; - $message_content_data['data']['order_no'] = (string)$order_detection['detection_no']; - $message_content_data['data']['disease_class_names'] = $disease_class_names; - $message_content_data['data']['detection_link'] = addAliyunOssWebsite($order_detection['detection_result_pdf']);// 检测结果链接(oss) - $message_content_data['data']['message_path'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no']; // 跳转地址(小程序内页) + $message_content_data['data']['order_no'] = (string)$data['detection_no']; + $message_content_data['data']['disease_class_names'] = $data['disease_class_names']; + $message_content_data['data']['detection_link'] = addAliyunOssWebsite($data['detection_result_pdf']);// 检测结果链接(oss) + $message_content_data['data']['message_path'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $data['detection_no']; // 跳转地址(小程序内页) $message_content = [ 'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE), ]; - $this->sendMessage($patient_user_id,$doctor_user_id, $message_content, "TIMCustomElem", $cloud_custom_data); + $this->sendMessage($data['patient_user_id'],$data['doctor_user_id'], $message_content, "TIMCustomElem", $cloud_custom_data); } catch (\Throwable $e) { throw new BusinessException($e->getMessage()); @@ -717,25 +712,25 @@ class ImService extends BaseService * @param string|int $inquiry_type * @return void */ - public function detectionTestReportStr(array|object $order_detection,string $doctor_name,string $detection_project_name,string $doctor_user_id, string $patient_user_id,string|int $inquiry_type): void + public function detectionTestReportStr(array $data): void { try { // 消息内容 $cloud_custom_data = array(); - $cloud_custom_data['order_inquiry_id'] = (string)$order_detection['order_inquiry_id']; + $cloud_custom_data['order_inquiry_id'] = (string)$data['order_inquiry_id']; $cloud_custom_data['is_system'] = 1; - $cloud_custom_data['inquiry_type'] = $inquiry_type; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) + $cloud_custom_data['inquiry_type'] = $data['inquiry_type']; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) $cloud_custom_data['message_rounds'] = 0; - $cloud_custom_data['order_no'] = $order_detection['detection_no']; - $cloud_custom_data['patient_family_data']['patient_name'] = $order_detection['patient_name']; - $cloud_custom_data['patient_family_data']['patient_sex'] = $order_detection['patient_sex']; - $cloud_custom_data['patient_family_data']['patient_age'] = $order_detection['patient_age']; + $cloud_custom_data['order_no'] = $data['detection_no']; + $cloud_custom_data['patient_family_data']['patient_name'] = $data['patient_name']; + $cloud_custom_data['patient_family_data']['patient_sex'] = $data['patient_sex']; + $cloud_custom_data['patient_family_data']['patient_age'] = $data['patient_age']; $message_content = [ - 'Text' => $doctor_name . "医生您好,您给我开具的【" . $detection_project_name . "】检测项目报告已经出来啦,请您抽空查看报告并做一下解读,谢谢。", + 'Text' => $data['doctor_name'] . "医生您好,您给我开具的【" . $data['detection_project_name'] . "】检测项目报告已经出来啦,请您抽空查看报告并做一下解读,谢谢。", ]; - $this->sendMessage($patient_user_id,$doctor_user_id, $message_content, "TIMTextElem", $cloud_custom_data); + $this->sendMessage($data['patient_user_id'],$data['doctor_user_id'], $message_content, "TIMTextElem", $cloud_custom_data); } catch (\Throwable $e) { throw new BusinessException($e->getMessage()); From b5739783ad999cd29c28f254b21b262245ee6a89 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 30 Aug 2023 11:32:43 +0800 Subject: [PATCH 119/176] =?UTF-8?q?=E9=97=AE=E8=AF=8A=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E5=88=97=E8=A1=A8+=E6=B0=91=E6=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 1 + app/Model/OrderInquiry.php | 51 +++++++++++++++++++++++++++ app/Services/InquiryService.php | 40 ++++++++++++++++----- 3 files changed, 83 insertions(+), 9 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 8b6f44f..29fcb31 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1624,6 +1624,7 @@ class CallBackController extends AbstractController $time = date('Ymd'); $sign = md5($basic_detection_organ['app_id'] . $basic_detection_organ['app_secret'] . $time); + dump($sign); if ($auth != $sign){ return $this->detectionResultFailReturn("签名错误"); } diff --git a/app/Model/OrderInquiry.php b/app/Model/OrderInquiry.php index b18251e..5ca18b8 100644 --- a/app/Model/OrderInquiry.php +++ b/app/Model/OrderInquiry.php @@ -8,6 +8,7 @@ namespace App\Model; use Hyperf\Database\Model\Collection; use Hyperf\Database\Model\Relations\HasOne; use Hyperf\Database\Query\Builder; +use Hyperf\DbConnection\Db; use Hyperf\Snowflake\Concern\Snowflake; /** @@ -434,4 +435,54 @@ class OrderInquiry extends Model ->limit($limit) ->get($fields); } + + /** + * 获取问诊结束会话列表-分页 + * @param array $params + * @param array $fields + * @param int|null $page + * @param int|null $per_page + * @return array + */ + public static function getInquiryEndPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array + { + $query = self::select("user_id") + ->whereNotIn('user_id', function ($query) use ($params){ + $query->select('user_id') + ->from('order_inquiry') + ->whereIn('inquiry_status', [1,2,3,4]) + ->where($params) + ->groupBy(["user_id"]); + }) + ->whereIn('inquiry_status', [5,6]) + ->where($params) + ->orderBy('complete_time', 'desc') + ->groupBy(["user_id"]); + + $result = $query->paginate($per_page, $fields, "page", $page); + + $data = array(); + $data['current_page'] = $result->currentPage();// 当前页码 + $data['total'] = $result->total();//数据总数 + $data['data'] = $result->items();//数据 + $data['per_page'] = $result->perPage();//每页个数 + $data['last_page'] = $result->lastPage();//最后一页 + + return $data; + } + + /** + * 获取某种状态的最后一条订单 + * @param array $params + * @param array $inquiry_status_params + * @param array $fields + * @return object|null + */ + public static function getInquiryStatusLastOne(array $params, array $inquiry_status_params,array $fields = ["*"]): object|null + { + return self::where($params) + ->whereIn("inquiry_status", $inquiry_status_params) + ->latest() + ->first($fields); + } } diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index f19821c..cd610f4 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -407,10 +407,19 @@ class InquiryService extends BaseService $params['family_id'] = $order_inquiry_case['family_id']; $patient_family = PatientFamily::getOne($params); + // 民族 + $nation_name = ""; + if (isset($patient_family)){ + if (!empty($patient_family['nation_name'])){ + $nation_name = $patient_family['nation_name']; + }else{ +// if (!empty($order_inquiry_case[''])) + } + } $order_inquiry_case['height'] = $order_inquiry_case['height'] ?: $patient_family['height'] ?: NULL; $order_inquiry_case['weight'] = $order_inquiry_case['weight'] ?: $patient_family['weight'] ?: NULL; $order_inquiry_case['job_name'] = $patient_family['job_name'] ?? ""; - $order_inquiry_case['nation_name'] = $patient_family['nation_name'] ?? ""; + $order_inquiry_case['nation_name'] = $nation_name; $order_inquiry_case['marital_status'] = $patient_family['marital_status'] ?? 0; $order_inquiry_case['id_number'] = $patient_family['id_number'] ?? ""; @@ -822,6 +831,8 @@ class InquiryService extends BaseService $page = $this->request->input('page', 1); $per_page = $this->request->input('per_page', 10); + // 获取该医生下问诊过的用户id和家庭成员id + $params = array(); $params['doctor_id'] = $user_info['client_user_id']; @@ -849,14 +860,26 @@ class InquiryService extends BaseService 'created_at', ]; - $result = OrderInquiry::getInquiryStatusWithDoctorPage($params, $inquiry_status_params, $fields, $page, $per_page); + $result = OrderInquiry::getInquiryEndPage($params, $fields, $page, $per_page); if (!empty($result['data'])) { foreach ($result['data'] as &$item) { $params = array(); - $params['message_send_result'] = 1; - $params['order_inquiry_id'] = $item['order_inquiry_id']; - $item['message_im'] = MessageIm::getOne($params); + $params['doctor_id'] = $user_info['client_user_id']; + $params['user_id'] = $item['user_id']; + + $inquiry_status_params = [5,6]; + $order_inquiry = OrderInquiry::getInquiryStatusLastOne($params,$inquiry_status_params,$fields); + + unset($item['user_id']); + if (!empty($order_inquiry)){ + $item = $order_inquiry->toArray(); + + $params = array(); + $params['message_send_result'] = 1; + $params['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + $item['message_im'] = MessageIm::getOne($params); + } } } return success($result); @@ -1332,10 +1355,6 @@ class InquiryService extends BaseService $params[] = ['patient_id', '=', $patient_id]; } - if (!empty($family_id)) { - $params[] = ['family_id', '=', $family_id]; - } - $params = array(); $params[] = ['patient_id', '=', $patient_id]; $params[] = ['doctor_id', '=', $doctor_id]; @@ -1511,6 +1530,9 @@ class InquiryService extends BaseService $wait_assign_time = 60 * 5; $wait_inquiry_time = 60 * 10; $wait_finish_time = 60 * 30; + } elseif ($order_inquiry['inquiry_type'] == 5) { + // 问诊购药 + $wait_finish_time = 60 * 60 * 24 * 3; } switch ($order_inquiry['inquiry_status']) { From 055bfc09f968765a73d1a493f48bcda3a74c6e2e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 30 Aug 2023 11:57:22 +0800 Subject: [PATCH 120/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=82=A3=E8=80=85?= =?UTF-8?q?=E9=97=AE=E8=AF=8A=E7=97=85=E4=BE=8B=E6=B0=91=E6=97=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetectionCompleteDelayDirectConsumer.php | 2 ++ app/Controller/CallBackController.php | 2 ++ app/Model/OrderInquiryCase.php | 12 +++++++----- app/Services/DetectionService.php | 2 ++ app/Services/InquiryService.php | 4 +++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php index d5070b1..1ce10cf 100644 --- a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php +++ b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php @@ -185,6 +185,8 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage $data['age'] = $patient_family['age'] ?? null; // 患者年龄 $data['height'] = $patient_family['height'] ?: null; // 身高(cm) $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) + $data['nation_id'] = $order_detection_case['nation_id'] ?: $patient_family['nation_id'] ?: null;; // 民族 + $data['nation_name'] = $order_detection_case['nation_id'] ?: $patient_family['nation_name'] ?: null;; // 民族名称 $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); if (empty($order_inquiry_case)) { Db::rollBack(); diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 29fcb31..ef04fb4 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1813,6 +1813,8 @@ class CallBackController extends AbstractController $data['age'] = $patient_family['age'] ?? null; // 患者年龄 $data['height'] = $patient_family['height'] ?: null; // 身高(cm) $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) + $data['nation_id'] = $order_detection_case['nation_id'] ?: $patient_family['nation_id'] ?: null;; // 民族 + $data['nation_name'] = $order_detection_case['nation_id'] ?: $patient_family['nation_name'] ?: null;; // 民族名称 $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); if (empty($order_inquiry_case)) { Db::rollBack(); diff --git a/app/Model/OrderInquiryCase.php b/app/Model/OrderInquiryCase.php index 7c2356d..1584daf 100644 --- a/app/Model/OrderInquiryCase.php +++ b/app/Model/OrderInquiryCase.php @@ -32,12 +32,14 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property string $family_history 家族病史描述 * @property int $is_pregnant 是否备孕、妊娠、哺乳期(0:否 1:是) * @property string $pregnant 备孕、妊娠、哺乳期描述 - * @property int $is_taboo 是否存在禁忌药物(0:否 1:是)问诊购药时存在 + * @property int $is_taboo 是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在 + * @property int $nation_id 民族 + * @property string $nation_name 民族名称 * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 - * @property-read BasicJob $BasicJob - * @property-read BasicNation $BasicNation - * @property-read OrderInquiry $OrderInquiry + * @property-read BasicJob|null $BasicJob + * @property-read BasicNation|null $BasicNation + * @property-read OrderInquiry|null $OrderInquiry */ class OrderInquiryCase extends Model { @@ -51,7 +53,7 @@ class OrderInquiryCase extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['inquiry_case_id', 'user_id', 'patient_id', 'order_inquiry_id', 'family_id', 'relation', 'status', 'name', 'sex', 'age', 'height', 'weight', 'disease_class_id', 'disease_class_name', 'diagnosis_date', 'disease_desc', 'diagnose_images', 'is_allergy_history', 'allergy_history', 'is_family_history', 'family_history', 'is_pregnant', 'pregnant', 'is_taboo', 'created_at', 'updated_at']; + protected array $fillable = ['inquiry_case_id', 'user_id', 'patient_id', 'order_inquiry_id', 'family_id', 'relation', 'status', 'name', 'sex', 'age', 'height', 'weight', 'disease_class_id', 'disease_class_name', 'diagnosis_date', 'disease_desc', 'diagnose_images', 'is_allergy_history', 'allergy_history', 'is_family_history', 'family_history', 'is_pregnant', 'pregnant', 'is_taboo', 'nation_id', 'nation_name', 'created_at', 'updated_at']; protected string $primaryKey = "inquiry_case_id"; diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 221192f..c6712ef 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -689,6 +689,8 @@ class DetectionService extends BaseService $data['age'] = $patient_family['age'] ?? null; // 患者年龄 $data['height'] = $patient_family['height'] ?: null; // 身高(cm) $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) + $data['nation_id'] = $order_detection_case['nation_id'] ?: $patient_family['nation_id'] ?: null;; // 民族 + $data['nation_name'] = $order_detection_case['nation_id'] ?: $patient_family['nation_name'] ?: null;; // 民族名称 $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); if (empty($order_inquiry_case)) { Db::rollBack(); diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index cd610f4..ac0f993 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -413,7 +413,9 @@ class InquiryService extends BaseService if (!empty($patient_family['nation_name'])){ $nation_name = $patient_family['nation_name']; }else{ -// if (!empty($order_inquiry_case[''])) + if (!empty($order_inquiry_case['nation_name'])){ + $nation_name = $order_inquiry_case['nation_name']; + } } } $order_inquiry_case['height'] = $order_inquiry_case['height'] ?: $patient_family['height'] ?: NULL; From 132f066f7cc2fcf0afd3145cdf970fdbc28d3c20 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 30 Aug 2023 13:13:52 +0800 Subject: [PATCH 121/176] =?UTF-8?q?=E7=BB=93=E6=9D=9F=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/OrderInquiry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Model/OrderInquiry.php b/app/Model/OrderInquiry.php index 5ca18b8..eb0d3a1 100644 --- a/app/Model/OrderInquiry.php +++ b/app/Model/OrderInquiry.php @@ -456,7 +456,7 @@ class OrderInquiry extends Model }) ->whereIn('inquiry_status', [5,6]) ->where($params) - ->orderBy('complete_time', 'desc') + ->orderBy('complete_time') ->groupBy(["user_id"]); $result = $query->paginate($per_page, $fields, "page", $page); From 3b8681034a2a019519fa4c9cfeb6f0daffe8db80 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 30 Aug 2023 13:44:25 +0800 Subject: [PATCH 122/176] =?UTF-8?q?=E7=BB=93=E6=9D=9F=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/OrderInquiry.php | 5 +++-- app/Services/InquiryService.php | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Model/OrderInquiry.php b/app/Model/OrderInquiry.php index eb0d3a1..08b4449 100644 --- a/app/Model/OrderInquiry.php +++ b/app/Model/OrderInquiry.php @@ -446,7 +446,7 @@ class OrderInquiry extends Model */ public static function getInquiryEndPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array { - $query = self::select("user_id") + $query = self::select(["user_id","family_id"]) ->whereNotIn('user_id', function ($query) use ($params){ $query->select('user_id') ->from('order_inquiry') @@ -457,7 +457,8 @@ class OrderInquiry extends Model ->whereIn('inquiry_status', [5,6]) ->where($params) ->orderBy('complete_time') - ->groupBy(["user_id"]); + ->groupBy(["user_id","family_id"]); + $result = $query->paginate($per_page, $fields, "page", $page); diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index ac0f993..d2fe832 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -869,11 +869,13 @@ class InquiryService extends BaseService $params = array(); $params['doctor_id'] = $user_info['client_user_id']; $params['user_id'] = $item['user_id']; + $params['family_id'] = $item['family_id']; $inquiry_status_params = [5,6]; $order_inquiry = OrderInquiry::getInquiryStatusLastOne($params,$inquiry_status_params,$fields); unset($item['user_id']); + unset($item['family_id']); if (!empty($order_inquiry)){ $item = $order_inquiry->toArray(); From 8277a6530fea575b27efecc25748c2fdc8832d80 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 30 Aug 2023 16:00:30 +0800 Subject: [PATCH 123/176] =?UTF-8?q?=E7=BB=93=E6=9D=9F=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/OrderInquiry.php | 42 +++++++++++++++++++++++--- app/Services/InquiryService.php | 52 ++++++++++++++++----------------- 2 files changed, 63 insertions(+), 31 deletions(-) diff --git a/app/Model/OrderInquiry.php b/app/Model/OrderInquiry.php index 08b4449..7f9bbda 100644 --- a/app/Model/OrderInquiry.php +++ b/app/Model/OrderInquiry.php @@ -444,9 +444,13 @@ class OrderInquiry extends Model * @param int|null $per_page * @return array */ - public static function getInquiryEndPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array + public static function getInquiryEndPage(array $params, int $page = null, ?int $per_page = 10): array { - $query = self::select(["user_id","family_id"]) +// 参考sql +// SELECT t1.* FROM test t1 INNER JOIN ( +// SELECT user_id, MAX(create_at) AS max_create_at FROM test GROUP BY user_id +// ) t2 ON t1.user_id = t2.user_id AND t1.create_at = t2.max_create_at; + $subQuery = self::select(["user_id","family_id",Db::raw('max(reception_time) as at')]) ->whereNotIn('user_id', function ($query) use ($params){ $query->select('user_id') ->from('order_inquiry') @@ -454,12 +458,42 @@ class OrderInquiry extends Model ->where($params) ->groupBy(["user_id"]); }) - ->whereIn('inquiry_status', [5,6]) ->where($params) - ->orderBy('complete_time') ->groupBy(["user_id","family_id"]); + $query = self:: joinSub($subQuery, 'sub_query', function($join) { + $join->on('order_inquiry.user_id', '=', 'sub_query.user_id') + ->on('order_inquiry.family_id', '=', 'sub_query.family_id') + ->on('order_inquiry.reception_time', '=', 'sub_query.at'); + }) + ->whereIn('inquiry_status', [5,6]) + ->where($params) + ->orderBy("sub_query.at",'desc'); + + + $fields = [ + 'order_inquiry.order_inquiry_id', + 'order_inquiry.user_id', + 'order_inquiry.patient_id', + 'order_inquiry.doctor_id', + 'order_inquiry.family_id', + 'order_inquiry.inquiry_type', + 'order_inquiry.inquiry_mode', + 'order_inquiry.inquiry_status', + 'order_inquiry.inquiry_no', + 'order_inquiry.reception_time', + 'order_inquiry.complete_time', + 'order_inquiry.finish_time', + 'order_inquiry.cancel_time', + 'order_inquiry.cancel_reason', + 'order_inquiry.cancel_remarks', + 'order_inquiry.patient_name', + 'order_inquiry.patient_sex', + 'order_inquiry.patient_age', + 'order_inquiry.created_at', + ]; + $result = $query->paginate($per_page, $fields, "page", $page); $data = array(); diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index d2fe832..5fcee51 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -837,34 +837,9 @@ class InquiryService extends BaseService $params = array(); $params['doctor_id'] = $user_info['client_user_id']; + $result = OrderInquiry::getInquiryEndPage($params, $page, $per_page); - $inquiry_status_params = ["5", "6"]; - - $fields = [ - 'order_inquiry_id', - 'user_id', - 'patient_id', - 'doctor_id', - 'family_id', - 'inquiry_type', - 'inquiry_mode', - 'inquiry_status', - 'inquiry_no', - 'reception_time', - 'complete_time', - 'finish_time', - 'cancel_time', - 'cancel_reason', - 'cancel_remarks', - 'patient_name', - 'patient_sex', - 'patient_age', - 'created_at', - ]; - - $result = OrderInquiry::getInquiryEndPage($params, $fields, $page, $per_page); - - if (!empty($result['data'])) { + if (empty($result['data'])) { foreach ($result['data'] as &$item) { $params = array(); $params['doctor_id'] = $user_info['client_user_id']; @@ -872,6 +847,29 @@ class InquiryService extends BaseService $params['family_id'] = $item['family_id']; $inquiry_status_params = [5,6]; + + $fields = [ + 'order_inquiry_id', + 'user_id', + 'patient_id', + 'doctor_id', + 'family_id', + 'inquiry_type', + 'inquiry_mode', + 'inquiry_status', + 'inquiry_no', + 'reception_time', + 'complete_time', + 'finish_time', + 'cancel_time', + 'cancel_reason', + 'cancel_remarks', + 'patient_name', + 'patient_sex', + 'patient_age', + 'created_at', + ]; + $order_inquiry = OrderInquiry::getInquiryStatusLastOne($params,$inquiry_status_params,$fields); unset($item['user_id']); From 9568ccf64f446db34703b3a435c365bf73183c16 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 30 Aug 2023 16:17:00 +0800 Subject: [PATCH 124/176] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=97=AE=E8=AF=8A?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DetectionService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index c6712ef..a6e69ee 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -771,7 +771,7 @@ class DetectionService extends BaseService $result['status'] = 1; $result['message'] = "成功"; - $result['data'] = (string)$order_detection['order_inquiry_id']; + $result['data'] = (string)$order_inquiry['order_inquiry_id']; return success($result); } From bd356a8bbee783c60240dec52ed50bc3a896b0e9 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 30 Aug 2023 16:22:49 +0800 Subject: [PATCH 125/176] 1 --- app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php | 2 +- app/Controller/CallBackController.php | 2 +- app/Services/DetectionService.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php index 1ce10cf..2c0b91f 100644 --- a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php +++ b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php @@ -186,7 +186,7 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage $data['height'] = $patient_family['height'] ?: null; // 身高(cm) $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) $data['nation_id'] = $order_detection_case['nation_id'] ?: $patient_family['nation_id'] ?: null;; // 民族 - $data['nation_name'] = $order_detection_case['nation_id'] ?: $patient_family['nation_name'] ?: null;; // 民族名称 + $data['nation_name'] = $order_detection_case['nation_name'] ?: $patient_family['nation_name'] ?: null;; // 民族名称 $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); if (empty($order_inquiry_case)) { Db::rollBack(); diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index ef04fb4..5c70361 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -1814,7 +1814,7 @@ class CallBackController extends AbstractController $data['height'] = $patient_family['height'] ?: null; // 身高(cm) $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) $data['nation_id'] = $order_detection_case['nation_id'] ?: $patient_family['nation_id'] ?: null;; // 民族 - $data['nation_name'] = $order_detection_case['nation_id'] ?: $patient_family['nation_name'] ?: null;; // 民族名称 + $data['nation_name'] = $order_detection_case['nation_name'] ?: $patient_family['nation_name'] ?: null;; // 民族名称 $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); if (empty($order_inquiry_case)) { Db::rollBack(); diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index a6e69ee..60bae2c 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -690,7 +690,7 @@ class DetectionService extends BaseService $data['height'] = $patient_family['height'] ?: null; // 身高(cm) $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) $data['nation_id'] = $order_detection_case['nation_id'] ?: $patient_family['nation_id'] ?: null;; // 民族 - $data['nation_name'] = $order_detection_case['nation_id'] ?: $patient_family['nation_name'] ?: null;; // 民族名称 + $data['nation_name'] = $order_detection_case['nation_name'] ?: $patient_family['nation_name'] ?: null;; // 民族名称 $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); if (empty($order_inquiry_case)) { Db::rollBack(); From 136af7bd666e5949c589d79f815212779e93b23d Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 30 Aug 2023 16:51:34 +0800 Subject: [PATCH 126/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=B8=E5=BA=94?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=BF=AB=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/UserDoctor.php | 17 +++-- app/Services/PatientDoctorService.php | 106 +++++++++++++------------- 2 files changed, 64 insertions(+), 59 deletions(-) diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index 9ff4a30..d1014c4 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -248,7 +248,7 @@ class UserDoctor extends Model }); if (!empty($sort_order)){ - if (in_array($sort_order,[1,3,4])){ + if (in_array($sort_order,[1,3,4])){ $query = $query->join('doctor_inquiry_config', function ($query) { $query->on('user_doctor.doctor_id', '=', 'doctor_inquiry_config.doctor_id') ->whereIn('inquiry_type', [1, 3]) @@ -258,28 +258,32 @@ class UserDoctor extends Model }) ->select("user_doctor.*") ->groupBy("user_doctor.doctor_id"); - } + } if ($sort_order == 1) { // 综合-价格从低到高 $query->orderBy('is_recommend', 'desc');// 是否首页推荐(0:否 1:是) - $query->orderBy('avg_response_time', 'asc');// 响应时间快 + $query->orderByRaw('avg_response_time = 0 ASC'); + $query->orderBy('avg_response_time'); $query->orderBy('served_patients_num', 'desc');// 服务数从多到少 $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 $query->orderBy('doctor_inquiry_config.inquiry_price', 'asc'); } elseif ($sort_order == 2) { // 响应时间快 - $query->orderBy('avg_response_time', 'asc'); + $query->orderByRaw('avg_response_time = 0 ASC'); + $query->orderBy('avg_response_time'); $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 } elseif ($sort_order == 3) { // 价格从低到高 $query->orderBy('doctor_inquiry_config.inquiry_price', 'asc'); - $query->orderBy('avg_response_time', 'asc'); + $query->orderByRaw('avg_response_time = 0 ASC'); + $query->orderBy('avg_response_time'); $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 } elseif ($sort_order == 4) { // 价格从高到低 $query->orderBy('doctor_inquiry_config.inquiry_price', 'desc'); - $query->orderBy('avg_response_time', 'asc'); + $query->orderByRaw('avg_response_time = 0 ASC'); + $query->orderBy('avg_response_time'); $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 } elseif ($sort_order == 5) { // 服务数从多到少 @@ -300,6 +304,7 @@ class UserDoctor extends Model return $data; } + /** * 获取是否存在 * @param array $params diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 87db426..cdff3cd 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -93,59 +93,59 @@ class PatientDoctorService extends BaseService $user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params, $sort_order, $fields,$page,$per_page); // 处理数据 - if (!empty($user_doctors['data'])) { - foreach ($user_doctors['data'] as &$user_doctor) { - $user_doctor['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']); - - // 处理医生专长 - if (!empty($user_doctor['DoctorExpertise'])) { - foreach ($user_doctor['DoctorExpertise'] as &$data) { - if (!empty($data['DiseaseClassExpertise'])) { - $data['expertise_name'] = $data['DiseaseClassExpertise']['expertise_name']; - } - unset($data['DiseaseClassExpertise']); - } - } - - // 处理问诊价格 - $user_doctor['price'] = 0; - $user_doctor['free_clinic_price'] = 0; - if (!empty($user_doctor['DoctorInquiryConfig'])) { - foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { - if ($doctor_inquiry_config['inquiry_mode'] == 1) { - if ($doctor_inquiry_config['inquiry_type'] == 1) { - // 专家 - $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; - } - if ($doctor_inquiry_config['inquiry_type'] == 3) { - // 公益 - $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; - } - } - } - unset($user_doctor['DoctorInquiryConfig']); - } - - // 好评率-超过5个已结束的订单后展示 - $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; - // 响应时间-超过5个已结束的订单后展示 - $user_doctor['avg_response_time'] = (float)floor($user_doctor['avg_response_time'] * 10) / 10; - - // 获取医生订单数 - $params = array(); - $params['doctor_id'] = $user_doctor['doctor_id']; - $params['inquiry_status'] = 6; // 已结束 - $inquiry_order_count = OrderInquiry::getCount($params); - if (empty($inquiry_order_count) || $inquiry_order_count == 0) { - $user_doctor['is_display_score'] = false; - } else { - $user_doctor['is_display_score'] = true; - } - - // 头像 - $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); - } - } +// if (!empty($user_doctors['data'])) { +// foreach ($user_doctors['data'] as &$user_doctor) { +// $user_doctor['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']); +// +// // 处理医生专长 +// if (!empty($user_doctor['DoctorExpertise'])) { +// foreach ($user_doctor['DoctorExpertise'] as &$data) { +// if (!empty($data['DiseaseClassExpertise'])) { +// $data['expertise_name'] = $data['DiseaseClassExpertise']['expertise_name']; +// } +// unset($data['DiseaseClassExpertise']); +// } +// } +// +// // 处理问诊价格 +// $user_doctor['price'] = 0; +// $user_doctor['free_clinic_price'] = 0; +// if (!empty($user_doctor['DoctorInquiryConfig'])) { +// foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { +// if ($doctor_inquiry_config['inquiry_mode'] == 1) { +// if ($doctor_inquiry_config['inquiry_type'] == 1) { +// // 专家 +// $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; +// } +// if ($doctor_inquiry_config['inquiry_type'] == 3) { +// // 公益 +// $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; +// } +// } +// } +// unset($user_doctor['DoctorInquiryConfig']); +// } +// +// // 好评率-超过5个已结束的订单后展示 +// $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; +// // 响应时间-超过5个已结束的订单后展示 +// $user_doctor['avg_response_time'] = (float)floor($user_doctor['avg_response_time'] * 10) / 10; +// +// // 获取医生订单数 +// $params = array(); +// $params['doctor_id'] = $user_doctor['doctor_id']; +// $params['inquiry_status'] = 6; // 已结束 +// $inquiry_order_count = OrderInquiry::getCount($params); +// if (empty($inquiry_order_count) || $inquiry_order_count == 0) { +// $user_doctor['is_display_score'] = false; +// } else { +// $user_doctor['is_display_score'] = true; +// } +// +// // 头像 +// $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); +// } +// } return success($user_doctors); } From a872e4ce0f02728ff6155ded5a443194b211dbe5 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 30 Aug 2023 16:53:57 +0800 Subject: [PATCH 127/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=B8=E5=BA=94?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=BF=AB=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientDoctorService.php | 107 +++++++++++++------------- 1 file changed, 53 insertions(+), 54 deletions(-) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index cdff3cd..c8f377c 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -92,60 +92,59 @@ class PatientDoctorService extends BaseService $user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params, $sort_order, $fields,$page,$per_page); - // 处理数据 -// if (!empty($user_doctors['data'])) { -// foreach ($user_doctors['data'] as &$user_doctor) { -// $user_doctor['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']); -// -// // 处理医生专长 -// if (!empty($user_doctor['DoctorExpertise'])) { -// foreach ($user_doctor['DoctorExpertise'] as &$data) { -// if (!empty($data['DiseaseClassExpertise'])) { -// $data['expertise_name'] = $data['DiseaseClassExpertise']['expertise_name']; -// } -// unset($data['DiseaseClassExpertise']); -// } -// } -// -// // 处理问诊价格 -// $user_doctor['price'] = 0; -// $user_doctor['free_clinic_price'] = 0; -// if (!empty($user_doctor['DoctorInquiryConfig'])) { -// foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { -// if ($doctor_inquiry_config['inquiry_mode'] == 1) { -// if ($doctor_inquiry_config['inquiry_type'] == 1) { -// // 专家 -// $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; -// } -// if ($doctor_inquiry_config['inquiry_type'] == 3) { -// // 公益 -// $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; -// } -// } -// } -// unset($user_doctor['DoctorInquiryConfig']); -// } -// -// // 好评率-超过5个已结束的订单后展示 -// $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; -// // 响应时间-超过5个已结束的订单后展示 -// $user_doctor['avg_response_time'] = (float)floor($user_doctor['avg_response_time'] * 10) / 10; -// -// // 获取医生订单数 -// $params = array(); -// $params['doctor_id'] = $user_doctor['doctor_id']; -// $params['inquiry_status'] = 6; // 已结束 -// $inquiry_order_count = OrderInquiry::getCount($params); -// if (empty($inquiry_order_count) || $inquiry_order_count == 0) { -// $user_doctor['is_display_score'] = false; -// } else { -// $user_doctor['is_display_score'] = true; -// } -// -// // 头像 -// $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); -// } -// } + if (!empty($user_doctors['data'])) { + foreach ($user_doctors['data'] as &$user_doctor) { + $user_doctor['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']); + + // 处理医生专长 + if (!empty($user_doctor['DoctorExpertise'])) { + foreach ($user_doctor['DoctorExpertise'] as &$data) { + if (!empty($data['DiseaseClassExpertise'])) { + $data['expertise_name'] = $data['DiseaseClassExpertise']['expertise_name']; + } + unset($data['DiseaseClassExpertise']); + } + } + + // 处理问诊价格 + $user_doctor['price'] = 0; + $user_doctor['free_clinic_price'] = 0; + if (!empty($user_doctor['DoctorInquiryConfig'])) { + foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { + if ($doctor_inquiry_config['inquiry_mode'] == 1) { + if ($doctor_inquiry_config['inquiry_type'] == 1) { + // 专家 + $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; + } + if ($doctor_inquiry_config['inquiry_type'] == 3) { + // 公益 + $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; + } + } + } + unset($user_doctor['DoctorInquiryConfig']); + } + + // 好评率-超过5个已结束的订单后展示 + $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; + // 响应时间-超过5个已结束的订单后展示 + $user_doctor['avg_response_time'] = (float)floor($user_doctor['avg_response_time'] * 10) / 10; + + // 获取医生订单数 + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_status'] = 6; // 已结束 + $inquiry_order_count = OrderInquiry::getCount($params); + if (empty($inquiry_order_count) || $inquiry_order_count == 0) { + $user_doctor['is_display_score'] = false; + } else { + $user_doctor['is_display_score'] = true; + } + + // 头像 + $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); + } + } return success($user_doctors); } From 5afe01d1cc4a713390be630c9de9f1e123c60ac5 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 31 Aug 2023 08:53:49 +0800 Subject: [PATCH 128/176] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=8F=91=E9=80=81=E7=9F=AD=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/Alibaba/Dysms.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extend/Alibaba/Dysms.php b/extend/Alibaba/Dysms.php index 29cd577..a5e566a 100644 --- a/extend/Alibaba/Dysms.php +++ b/extend/Alibaba/Dysms.php @@ -74,6 +74,11 @@ class Dysms public static function sendSms(string $phone_numbers,array $template_param,string $template_code,string $scene_desc = ""): void { try { + $app_env = config('app_env','dev'); + if ($app_env == "dev"){ + return; + } + $config = config("alibaba.dysms"); $client = self::createClient($config['accessKey'], $config['accessKeySecret']); From add698753865437ab420bb0129e1e8867b85b252 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 31 Aug 2023 15:44:41 +0800 Subject: [PATCH 129/176] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=82=A3=E7=97=85?= =?UTF-8?q?=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/UserDoctorService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 2b12007..f5bc620 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -527,7 +527,7 @@ class UserDoctorService extends BaseService // 患病时长 if (empty($order_inquiry_case['diagnosis_date'])) { - $data['diagnosis_date'] = "未知"; + $data['diagnosis_date'] = ""; } else { $data['diagnosis_date'] = date('Y-m-d', strtotime($order_inquiry_case['diagnosis_date'])); } From 79d532c44f1e5e6b108dca6f2b0f7f0228c10936 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 31 Aug 2023 17:01:25 +0800 Subject: [PATCH 130/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=A4=84=E6=96=B9=E5=88=97=E8=A1=A8=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=AD=97=E6=AE=B5=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=20=E8=8E=B7=E5=8F=96=E6=82=A3=E8=80=85=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E4=B8=80=E6=9D=A1=E9=97=AE=E8=AF=8A=E8=AE=A2=E5=8D=95id?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/InquiryController.php | 14 ++++++++++++ app/Model/OrderInquiry.php | 13 +++++++++++ app/Request/InquiryRequest.php | 4 ++++ app/Services/InquiryService.php | 34 ++++++++++++++++++++++++++-- app/Services/UserDoctorService.php | 6 +++++ config/routes.php | 3 +++ 6 files changed, 72 insertions(+), 2 deletions(-) diff --git a/app/Controller/InquiryController.php b/app/Controller/InquiryController.php index 8003941..a6e083a 100644 --- a/app/Controller/InquiryController.php +++ b/app/Controller/InquiryController.php @@ -131,4 +131,18 @@ class InquiryController extends AbstractController $data = $InquiryService->putFinishInquiry(); return $this->response->json($data); } + + /** + * 获取患者最后一条问诊订单id + * @return ResponseInterface + */ + public function getPatientLastInquiryId(): ResponseInterface + { + $request = $this->container->get(InquiryRequest::class); + $request->scene('getPatientLastInquiryId')->validateResolved(); + + $InquiryService = new InquiryService(); + $data = $InquiryService->getPatientLastInquiryId(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Model/OrderInquiry.php b/app/Model/OrderInquiry.php index 7f9bbda..e611911 100644 --- a/app/Model/OrderInquiry.php +++ b/app/Model/OrderInquiry.php @@ -520,4 +520,17 @@ class OrderInquiry extends Model ->latest() ->first($fields); } + + /** + * 获取最后一条订单 + * @param array $params + * @param array $fields + * @return object|null + */ + public static function getInquiryLastOne(array $params,array $fields = ["*"]): object|null + { + return self::where($params) + ->latest() + ->first($fields); + } } diff --git a/app/Request/InquiryRequest.php b/app/Request/InquiryRequest.php index 802999c..78d8cda 100644 --- a/app/Request/InquiryRequest.php +++ b/app/Request/InquiryRequest.php @@ -42,6 +42,10 @@ class InquiryRequest extends FormRequest 'getPatientInquiryCase' => [ // 获取患者问诊病例 'order_inquiry_id', ], + 'getPatientLastInquiryId' => [ // 获取患者最后一条问诊订单id + 'patient_id', + 'doctor_id', + ], ]; /** diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 5fcee51..5df95af 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -1009,6 +1009,35 @@ class InquiryService extends BaseService return success(); } + /** + * 获取患者最后一条问诊订单id + * @return array + */ + public function getPatientLastInquiryId(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $patient_id = $this->request->input('patient_id'); + $doctor_id = $this->request->input('doctor_id'); + + if (empty($user_info)) { + return fail(HttpEnumCode::HTTP_ERROR, "操作失败"); + } + + // 获取问诊订单数据 + $params = array(); + $params['patient_id'] = $patient_id; + $params['doctor_id'] = $doctor_id; + + $inquiry_status_params = [3,4,5,6,7]; + $order_inquiry = OrderInquiry::getInquiryStatusLastOne($params,$inquiry_status_params); + if (empty($order_inquiry)) { + return success(""); + } + + return success($order_inquiry['order_inquiry_id']); + } + /** * 获取医生未接诊订单数量 * @param string $doctor_id 医生id @@ -1506,7 +1535,8 @@ class InquiryService extends BaseService throw new BusinessException("问诊订单状态错误"); } - $time = 0; + // 随机初始时间 + $time = mt_rand(60,600); $wait_pay_time = 60 * 30;// 待支付时间 $wait_assign_time = 60 * 5;// 待分配时间 $wait_inquiry_time = 0; // 待接诊时间 @@ -1533,7 +1563,7 @@ class InquiryService extends BaseService $wait_inquiry_time = 60 * 10; $wait_finish_time = 60 * 30; } elseif ($order_inquiry['inquiry_type'] == 5) { - // 问诊购药 + // 检测订单 $wait_finish_time = 60 * 60 * 24 * 3; } diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index f5bc620..ff11330 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -535,6 +535,12 @@ class UserDoctorService extends BaseService // 疾病信息 $data['order_prescription_icd'] = $order_prescription['OrderPrescriptionIcd'] ?? []; + // 患者id + $data['patient_id'] = $order_inquiry_case['patient_id']; + + // 医生id + $data['doctor_id'] = $order_inquiry_case['doctor_id']; + $result[] = $data; } diff --git a/config/routes.php b/config/routes.php index d6e12d8..9045e2a 100644 --- a/config/routes.php +++ b/config/routes.php @@ -752,6 +752,9 @@ Router::addGroup('/inquiry', function () { // 结束问诊 Router::put('/finish/{order_inquiry_id:\d+}', [InquiryController::class, 'putFinishInquiry']); + + // 获取患者最后一条问诊订单id + Router::get('/last', [InquiryController::class, 'getPatientLastInquiryId']); }); // 获取弹窗数据 From 8f03f1c63734a057076477a623671dcf1d3c0237 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 31 Aug 2023 17:03:44 +0800 Subject: [PATCH 131/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=A4=84=E6=96=B9=E5=88=97=E8=A1=A8=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=AD=97=E6=AE=B5=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=20=E8=8E=B7=E5=8F=96=E6=82=A3=E8=80=85=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E4=B8=80=E6=9D=A1=E9=97=AE=E8=AF=8A=E8=AE=A2=E5=8D=95id?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/UserDoctorService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index ff11330..fecc36f 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -539,7 +539,7 @@ class UserDoctorService extends BaseService $data['patient_id'] = $order_inquiry_case['patient_id']; // 医生id - $data['doctor_id'] = $order_inquiry_case['doctor_id']; + $data['doctor_id'] = $order_prescription['doctor_id']; $result[] = $data; } From 49ebb0f51d10de23da05281402065b98fd41cd8f Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 1 Sep 2023 08:58:48 +0800 Subject: [PATCH 132/176] 1 --- app/Services/InquiryService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 5df95af..0df5122 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -806,6 +806,7 @@ class InquiryService extends BaseService $result['doctor_user_id'] = $user_doctor['user_id']; $result['patient_user_id'] = $order_inquiry['user_id']; $result['doctor_id'] = $order_inquiry['doctor_id']; + $result['patient_id'] = $order_inquiry['patient_id']; $result['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; $result['patient_family_name'] = $order_inquiry['patient_name']; $result['patient_family_sex'] = $order_inquiry['patient_sex']; From bd94ef3e9c0e2f117e202045e2a29441d244a270 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 1 Sep 2023 14:20:00 +0800 Subject: [PATCH 133/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 0df5122..59f620d 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -1568,6 +1568,12 @@ class InquiryService extends BaseService $wait_finish_time = 60 * 60 * 24 * 3; } + // 测试使用 + $wait_pay_time = 60;// 待支付时间 + $wait_assign_time = 60;// 待分配时间 + $wait_inquiry_time = 0; // 待接诊时间 + $wait_finish_time = 0;// 待结束时间 + switch ($order_inquiry['inquiry_status']) { case '1': // 待支付 From 05f9849a414d25d594a90af156602f50130f051e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 1 Sep 2023 14:27:46 +0800 Subject: [PATCH 134/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 59f620d..a4a3ff1 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -1568,12 +1568,6 @@ class InquiryService extends BaseService $wait_finish_time = 60 * 60 * 24 * 3; } - // 测试使用 - $wait_pay_time = 60;// 待支付时间 - $wait_assign_time = 60;// 待分配时间 - $wait_inquiry_time = 0; // 待接诊时间 - $wait_finish_time = 0;// 待结束时间 - switch ($order_inquiry['inquiry_status']) { case '1': // 待支付 @@ -1582,11 +1576,11 @@ class InquiryService extends BaseService $wait_pay_time = 0; } - $time = $wait_pay_time + $wait_assign_time + $wait_inquiry_time + $wait_finish_time; + $time = $time + $wait_pay_time + $wait_assign_time + $wait_inquiry_time + $wait_finish_time; break; case '2': // 待分配 - $time = $wait_assign_time + $wait_inquiry_time + $wait_finish_time; + $time = $time + $wait_assign_time + $wait_inquiry_time + $wait_finish_time; break; case '3': // 待接诊 @@ -1595,7 +1589,7 @@ class InquiryService extends BaseService $wait_inquiry_time = 0; } - $time = $wait_inquiry_time + $wait_finish_time; + $time = $time + $wait_inquiry_time + $wait_finish_time; break; case '4': // 已接诊 @@ -1604,7 +1598,7 @@ class InquiryService extends BaseService $wait_finish_time = 0; } - $time = $wait_finish_time; + $time = $time + $wait_finish_time; break; default: break; @@ -1614,6 +1608,7 @@ class InquiryService extends BaseService $time = 0; } + $time = 60; return $time; } From ef4e2d181ff31fbf58e80fb0e74b48b8588c5bfd Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 1 Sep 2023 14:36:48 +0800 Subject: [PATCH 135/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php index 2c0b91f..e63cae7 100644 --- a/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php +++ b/app/Amqp/Consumer/DetectionCompleteDelayDirectConsumer.php @@ -96,6 +96,8 @@ class DetectionCompleteDelayDirectConsumer extends ConsumerMessage Log::getInstance("queue-DetectionComplete")->error("重新添加队列失败"); return Result::REQUEUE; } + + return Result::DROP; } // 获取医生数据 From f606af49927e373de6f3ace42039e6d2a51dd1ce Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 1 Sep 2023 14:51:11 +0800 Subject: [PATCH 136/176] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index a4a3ff1..cea9555 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -1608,7 +1608,6 @@ class InquiryService extends BaseService $time = 0; } - $time = 60; return $time; } From 22f9941d293ac91a000055a7b6f94b5c1350a0b4 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 7 Sep 2023 17:13:11 +0800 Subject: [PATCH 137/176] =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E5=A4=84=E6=96=B9?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=BC=96=E5=8F=B7=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/OrderPrescriptionService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/OrderPrescriptionService.php b/app/Services/OrderPrescriptionService.php index aae18bc..fab3007 100644 --- a/app/Services/OrderPrescriptionService.php +++ b/app/Services/OrderPrescriptionService.php @@ -389,7 +389,7 @@ class OrderPrescriptionService extends BaseService } $arg = array(); - $arg['terminalCode'] = "ZD-10003"; + $arg['terminalCode'] = \Hyperf\Config\config("pharmacy_code","ZD-10003"); $arg['orderNo'] = $order_product['order_product_no']; // 订单编号 $arg['transactNo'] = $order_product['escrow_trade_no']; // 流水单号 $arg['payDate'] = $order_product['pay_time']; // 支付时间 From 47d36afcb64aa528bc3c1edd54342498a7092e84 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 8 Sep 2023 10:31:49 +0800 Subject: [PATCH 138/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=BA=E6=9E=84?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E4=B8=BAzd10003?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/OrderPrescriptionService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/OrderPrescriptionService.php b/app/Services/OrderPrescriptionService.php index fab3007..aae18bc 100644 --- a/app/Services/OrderPrescriptionService.php +++ b/app/Services/OrderPrescriptionService.php @@ -389,7 +389,7 @@ class OrderPrescriptionService extends BaseService } $arg = array(); - $arg['terminalCode'] = \Hyperf\Config\config("pharmacy_code","ZD-10003"); + $arg['terminalCode'] = "ZD-10003"; $arg['orderNo'] = $order_product['order_product_no']; // 订单编号 $arg['transactNo'] = $order_product['escrow_trade_no']; // 流水单号 $arg['payDate'] = $order_product['pay_time']; // 支付时间 From 4afcbaacf09a4acc75ea2cd98c9dc35cffc578fc Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 8 Sep 2023 17:49:22 +0800 Subject: [PATCH 139/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=80=E5=85=B7?= =?UTF-8?q?=E5=A4=84=E6=96=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...oPharmacistCaVerifyDelayDirectConsumer.php | 80 +++++----- app/Services/CaService.php | 148 ++++++------------ app/Services/OrderPrescriptionService.php | 127 ++++++++++----- app/Services/UserDoctorService.php | 2 +- 4 files changed, 171 insertions(+), 186 deletions(-) diff --git a/app/Amqp/Consumer/AutoPharmacistCaVerifyDelayDirectConsumer.php b/app/Amqp/Consumer/AutoPharmacistCaVerifyDelayDirectConsumer.php index f16af85..16628a3 100644 --- a/app/Amqp/Consumer/AutoPharmacistCaVerifyDelayDirectConsumer.php +++ b/app/Amqp/Consumer/AutoPharmacistCaVerifyDelayDirectConsumer.php @@ -134,7 +134,7 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage // 检测执行次数 $res = $this->checkHandleNumber($data['prescription_file_id']); - }catch (\Exception $e){ + }catch (\Throwable $e){ // 检测次数失败 Log::getInstance("queue-AutoPharmacistCaVerify")->info("错误:" . $e->getMessage()); return Result::ACK; @@ -158,14 +158,13 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage Db::commit(); return Result::ACK; - }catch (\Exception $e){ + }catch (\Throwable $e){ Db::rollBack(); Log::getInstance("queue-AutoPharmacistCaVerify")->info("错误:" . $e->getMessage()); return Result::ACK; } } - // 下载医生签章文件 Db::beginTransaction(); try { @@ -199,30 +198,51 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage return Result::REQUEUE; } - Log::getInstance("queue-AutoPharmacistCaVerify")->info("下载医生的签章pdf并上传至oss"); - // 下载医生的签章pdf并上传至oss - $prescription_pdf_oss_path = $this->downCaPdfToOss($order_prescription, $user_doctor['user_id'],2,$order_prescription_file['doctor_ca_file_id']); - if (!$prescription_pdf_oss_path) { + Log::getInstance("queue-AutoPharmacistCaVerify")->info("下载医生的签章pdf并上传至oss"); + $CaService = new CaService($order_prescription,2,$user_doctor['user_id']); + $prescription_pdf_oss_path = $CaService->downCaPdfToOss($order_prescription_file['doctor_ca_file_id']); + if ($prescription_pdf_oss_path == "") { Db::rollBack(); Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:" . $prescription_pdf_oss_path); return Result::REQUEUE; } - // 药师/医院签章 - Log::getInstance("queue-AutoPharmacistCaVerify")->info("药师/医院签章"); + // 药师签章 + Log::getInstance("queue-AutoPharmacistCaVerify")->info("药师签章"); $OrderPrescriptionService = new OrderPrescriptionService(); - $prescription_open_result = $OrderPrescriptionService->openPrescription($data['order_prescription_id'],$user_pharmacist['user_id']); + $prescription_open_result = $OrderPrescriptionService->openPrescription($data['order_prescription_id'],3,$user_pharmacist['user_id']); if (empty($prescription_open_result['file_id'])){ Db::rollBack(); - Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:处方开具失败"); + Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:药师签章失败"); return Result::REQUEUE; } - // 下载医院的签章pdf并上传至oss + // 下载药师签章pdf并上传至oss + Log::getInstance("queue-AutoPharmacistCaVerify")->info("下载药师的签章pdf并上传至oss"); + $CaService = new CaService($order_prescription,3,$user_pharmacist['user_id']); + $prescription_pdf_oss_path = $CaService->downCaPdfToOss($prescription_open_result['file_id']); + if ($prescription_pdf_oss_path == "") { + Db::rollBack(); + Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:" . $prescription_pdf_oss_path); + return Result::REQUEUE; + } + + // 医院签章 + Log::getInstance("queue-AutoPharmacistCaVerify")->info("医院签章"); + $OrderPrescriptionService = new OrderPrescriptionService(); + $prescription_open_result = $OrderPrescriptionService->openPrescription($data['order_prescription_id'],1); + if (empty($prescription_open_result['file_id'])){ + Db::rollBack(); + Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:医院签章失败"); + return Result::REQUEUE; + } + + // 下载医院签章pdf并上传至oss Log::getInstance("queue-AutoPharmacistCaVerify")->info("下载医院的签章pdf并上传至oss"); - $prescription_pdf_oss_path = $this->downCaPdfToOss($order_prescription, $user_pharmacist['user_id'],3,$prescription_open_result['file_id']); - if (!$prescription_pdf_oss_path) { + $CaService = new CaService($order_prescription,1); + $prescription_pdf_oss_path = $CaService->downCaPdfToOss($prescription_open_result['file_id']); + if ($prescription_pdf_oss_path == "") { Db::rollBack(); Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:" . $prescription_pdf_oss_path); return Result::REQUEUE; @@ -244,7 +264,7 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage Db::commit(); Log::getInstance("queue-AutoPharmacistCaVerify")->info("成功"); - } catch (\Exception $e) { + } catch (\Throwable $e) { Db::rollBack(); Log::getInstance("queue-AutoPharmacistCaVerify")->error("异常错误:" . $e->getMessage()); @@ -279,7 +299,7 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage Log::getInstance("queue-AutoPharmacistCaVerify")->error("添加处方过期队列失败!"); return Result::ACK; } - }catch(\Exception $e){ + }catch(\Throwable $e){ Log::getInstance("queue-AutoPharmacistCaVerify")->error("发送消息异常错误:" . $e->getMessage()); return Result::ACK; } @@ -405,34 +425,6 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage return true; } - /** - * 下载签章pdf并上传至oss - * @param array|object $order_prescription - * @param string $user_id 用户id - * @param string|int $user_type 用户类型 1:患者 2:医生 3:药师 - * @param string $file_id - * @return string|bool oss地址|false(存在异常时) - */ - protected function downCaPdfToOss(array|object $order_prescription, string $user_id, string|int $user_type, string $file_id): string|bool - { - try { - $user = array(); - $user['user_id'] = $user_id; - $user['user_type'] = $user_type; - $CaService = new CaService($order_prescription, $user); - - // 下载签章pdf并上传至oss - if ($user_type == 2){ - return $CaService->downCaPdfToOss($file_id,1); - }else{ - return $CaService->downCaPdfToOss($file_id,2); - } - - } catch (\Exception $e) { - return false; - } - } - /** * 修改处方文件表 * @param string $prescription_file_id 主键id diff --git a/app/Services/CaService.php b/app/Services/CaService.php index 6d55e1a..371493d 100644 --- a/app/Services/CaService.php +++ b/app/Services/CaService.php @@ -38,81 +38,77 @@ class CaService extends BaseService // 是否已添加签章配置(第一次需申请) protected string $is_sign_config; - // 用户签名图片地址 + // 签名图片地址 public string $sign_image_path; - // 医院签名图片地址 - protected string $hospital_sign_image_path; - - // 用户唯一标识 - protected string $user_entity_id; - - // 医院唯一标识 - protected string $hospital_entity_id; + // 唯一标识 + protected string $entity_id; // 证书序列号 protected string $cert_serial_number; - // 身份证号 + // 身份证号/信用代码 protected string $card_num; - // 信用代码 - protected string $org_num; - // 处方pdf本地地址 protected string $prescription_pdf_local_path; // 处方pdf oss地址 protected string $prescription_pdf_oss_path; - /** * 初始化类,此处会获取基础数据 * @param array|object $order_prescription 处方表数据 - * @param array|object $user 用户表数据 + * @param string|int $user_id 用户id + * @param int $type 类型 1:医院 2:医生 3:药师 */ - public function __construct(array|object $order_prescription,array|object $user){ + public function __construct(array|object $order_prescription,int $type,string|int $user_id = ""){ // 获取用户、医院签名图片地址、用户标识信息 - $params = array(); - $params['user_id'] = $user['user_id']; - if ($user['user_type'] == 2) { + if ($type == 1){ + // 医院 + $this->sign_image_path = "basic/file/hospital_signature.png"; + $this->entity_id = "5345345461"; + $this->card_num = "91510106MABTJY4K9R"; + }elseif($type == 2){ + // 用户 + $params = array(); + $params['user_id'] = $user_id; $user_doctor_info = UserDoctorInfo::getOne($params); if (empty($user_doctor_info)) { throw new BusinessException("用户数据错误"); } - $user_sign_image_path = $user_doctor_info['sign_image']; + $this->sign_image_path = substr($user_doctor_info['sign_image'], 1, strlen($user_doctor_info['sign_image']) - 1); $app_env = config('app_env','dev'); if ($app_env == 'prod'){ - $this->user_entity_id = $user_doctor_info['user_id']; + $this->entity_id = $user_doctor_info['user_id']; }else{ - $this->user_entity_id = "491925054435950592"; + $this->entity_id = "491925054435950592"; } $this->card_num = $user_doctor_info['card_num']; - } else { + } elseif ($type == 3){ + $params = array(); + $params['user_id'] = $user_id; $user_pharmacist_info = UserPharmacistInfo::getOne($params); if (empty($user_pharmacist_info)) { throw new BusinessException("用户数据错误"); } - $user_sign_image_path = $user_pharmacist_info['sign_image']; - $this->user_entity_id = $user['user_id']; - $this->card_num = $user_pharmacist_info['card_num']; + // 去除用户签名图片第一个/ oss不识别 + $this->sign_image_path = substr($user_pharmacist_info['sign_image'], 1, strlen($user_pharmacist_info['sign_image']) - 1); - $this->hospital_sign_image_path = "basic/file/hospital_signature.png"; - $this->hospital_entity_id = "5345345461"; - $this->org_num = "91510106MABTJY4K9R"; + $this->entity_id = $user_id; + $this->card_num = $user_pharmacist_info['card_num']; + } else{ + throw new BusinessException("用户类型错误"); } - if (empty($user_sign_image_path) || empty($this->user_entity_id)) { + if (empty($this->sign_image_path) || empty($this->entity_id)) { throw new BusinessException("无签名图片/用户唯一标识"); } - // 去除用户签名图片第一个/ oss不识别 - $this->sign_image_path = substr($user_sign_image_path, 1, strlen($user_sign_image_path) - 1); - $order_prescription_id = $order_prescription['order_prescription_id']; // 创建协程客户端 @@ -225,9 +221,8 @@ class CaService extends BaseService /** * 获取云证书签名+验证云证书签名 * @param array|object $order_prescription - * @param int $type 类型 1:用户 2:医院 */ - public function getVerifyCertSign(array|object $order_prescription,int $type) + public function getVerifyCertSign(array|object $order_prescription) { $CaOnline = new CaOnline(); @@ -254,13 +249,7 @@ class CaService extends BaseService $data['product'][] = $product; } - if ($type == 1){ - // 用户 - $cert_sign_result = $CaOnline->getCertSign($this->user_entity_id, $this->user_entity_id, $data); - }else{ - // 医院 - $cert_sign_result = $CaOnline->getCertSign($this->hospital_entity_id, $this->hospital_entity_id, $data); - } + $cert_sign_result = $CaOnline->getCertSign($this->entity_id, $this->entity_id, $data); // 验证云证书签名 验证无需处理,只要不返回错误即可 $CaOnline->verifyPkcs7($cert_sign_result['signP7'], $data); @@ -411,38 +400,23 @@ class CaService extends BaseService /** * 下载Oss中处方pdf - * 存在:当次发版内医生开具后,药师再去开具 - * 不存在:医生开具后,进行发版过,此时需重新下载 * @return void */ public function downOssPdfToLocal(): void { - $res = file_exists($this->prescription_pdf_local_path); - if (!$res){ - // 去除第一个/ oss不识别 -// $prescription_pdf_path = substr($doctor_pdf_oss_path, 1, strlen($doctor_pdf_oss_path) - 1); - - $oss = new Oss(); - $oss->getObjectToLocal($this->prescription_pdf_oss_path, $this->prescription_pdf_local_path); - } + $oss = new Oss(); + $oss->getObjectToLocal($this->prescription_pdf_oss_path, $this->prescription_pdf_local_path); } /** * 下载CA中pdf至本地文件 * @param string $file_id - * @param int $type 类型 1:用户 2:医院 * @return void */ - public function downCaPdfToLocal(string $file_id,int $type): void + public function downCaPdfToLocal(string $file_id): void { $CaOnline = new CaOnline(); - if ($type == 1){ - // 用户 - $prescription_pdf_result = $CaOnline->getSignedFile($this->user_entity_id, $file_id); - }else{ - // 医院 - $prescription_pdf_result = $CaOnline->getSignedFile($this->hospital_entity_id, $file_id); - } + $prescription_pdf_result = $CaOnline->getSignedFile($this->entity_id, $file_id); $file = fopen($this->prescription_pdf_local_path, "w"); fwrite($file, $prescription_pdf_result); @@ -452,20 +426,13 @@ class CaService extends BaseService /** * 下载CA中的pdf并上传至oss * @param string $file_id - * @param int $type 类型 1:用户 2:医院 * @return string oss地址 */ - public function downCaPdfToOss(string $file_id,int $type): string + public function downCaPdfToOss(string $file_id): string { $CaOnline = new CaOnline(); - if ($type == 1){ - // 用户 - $prescription_pdf_result = $CaOnline->getSignedFile($this->user_entity_id, $file_id); - }else{ - // 医院 - $prescription_pdf_result = $CaOnline->getSignedFile($this->hospital_entity_id, $file_id); - } + $prescription_pdf_result = $CaOnline->getSignedFile($this->entity_id, $file_id); // 上传oss $oss = new Oss(); @@ -479,27 +446,15 @@ class CaService extends BaseService */ public function addSignPdf(string $type): string { - // 下载签名图片 + $oss = new Oss(); + if ($type == 1){ - $local_path = "./extend/Ca/hospital_signature.png"; - $res = file_exists($local_path); - if ($res){ - // 读取本地文件 - $sign_image = fopen($local_path,'r'); - } + $style = "image/resize,w_300,h_300"; + }else{ + $style = "image/resize,m_lfit,w_100,h_350"; } - if (!isset($sign_image)){ - $oss = new Oss(); - - if ($type == 1){ - $style = "image/resize,w_300,h_300"; - $sign_image = $oss->getCusTomObjectToRAM($this->hospital_sign_image_path, $style); - }else{ - $style = "image/resize,m_lfit,w_100,h_350"; - $sign_image = $oss->getCusTomObjectToRAM($this->sign_image_path, $style); - } - } + $sign_image = $oss->getCusTomObjectToRAM($this->sign_image_path, $style); $sign_image = base64_encode($sign_image); if (!$sign_image) { @@ -512,24 +467,18 @@ class CaService extends BaseService $lly = "210"; // 左边底部Y坐标 控制上下(越小越下) $urx = "520"; // 右边上部x坐标 $ury = "360"; // 右边上部y坐标 - - $entity_id = $this->hospital_entity_id; } elseif ($type == 2){ // 医生端 $llx = "120"; // 左边底部X坐标 $lly = "190"; // 左边底部Y坐标 $urx = "190"; // 右边上部x坐标 $ury = "140"; // 右边上部y坐标 - - $entity_id = $this->user_entity_id; }else{ // 药师端 $llx = "350"; // 左边底部X坐标 $lly = "190"; // 左边底部Y坐标 $urx = "440"; // 右边上部x坐标 $ury = "140"; // 右边上部y坐标 - - $entity_id = $this->user_entity_id; } $sign_param = [ @@ -559,11 +508,7 @@ class CaService extends BaseService $data['sign_param'] = json_encode($sign_param); $data['seal_img'] = $sign_image; - if ($type == 1){ - $CaOnline->addUserSignConfig($entity_id,$this->org_num,$data); - }else{ - $CaOnline->addUserSignConfig($entity_id,$this->card_num,$data); - } + $CaOnline->addUserSignConfig($this->entity_id,$this->card_num,$data); $params = array(); $params['cert_id'] = $user_ca_cert['cert_id']; @@ -580,17 +525,16 @@ class CaService extends BaseService throw new BusinessException("处方pdf打开失败"); } + // 处方pdf进行签章 $data = array(); $data['sign_param'] = json_encode($sign_param); $data['pdf_file'] = $pdf_file; - $sign_pdf_result = $CaOnline->addSignPdf($entity_id, $data); + $sign_pdf_result = $CaOnline->addSignPdf($this->entity_id, $data); if (empty($sign_pdf_result[0]['fileId'])) { throw new BusinessException("处方签章失败"); } return $sign_pdf_result[0]['fileId']; } - - } \ No newline at end of file diff --git a/app/Services/OrderPrescriptionService.php b/app/Services/OrderPrescriptionService.php index aae18bc..6d1d23d 100644 --- a/app/Services/OrderPrescriptionService.php +++ b/app/Services/OrderPrescriptionService.php @@ -132,21 +132,90 @@ class OrderPrescriptionService extends BaseService * @param string $user_id 用户id * @return array */ - public function openPrescription(string $order_prescription_id, string $user_id): array +// public function openPrescription1(string $order_prescription_id, string $user_id): array +// { +// try { +// // 获取用户数据 +// $params = array(); +// $params['user_id'] = $user_id; +// $user = User::getOne($params); +// if (empty($user)) { +// throw new BusinessException("用户数据错误"); +// } +// +// if ($user['user_type'] != 2 && $user['user_type'] != 3) { +// throw new BusinessException("用户类型错误"); +// } +// +// // 获取处方数据 +// $params = array(); +// $params['order_prescription_id'] = $order_prescription_id; +// $order_prescription = OrderPrescription::getOne($params); +// if (empty($order_prescription)) { +// throw new BusinessException("处方数据错误"); +// } +// +// if (empty($order_prescription['doctor_created_time'])) { +// throw new BusinessException("医生开方日期错误"); +// } +// +// $CaService = new CaService($order_prescription,$user); +// +// // 获取云证书签名+验证云证书签名 +// $CaService->getVerifyCertSign($order_prescription,1); +// +// // 医生 +// if ($user['user_type'] == 2) { +// // 生成处方图片+处方图片生成pdf +// $prescription_img_oss_path = $CaService->createPrescriptionImgPdf($order_prescription); +// } +// +// // 药师-医院签章 +// if ($user['user_type'] == 3) { +// // 获取医院云证书签名+验证云证书签名 +// $CaService->getVerifyCertSign($order_prescription,2); +// +// // 下载医生开具的处方pdf至本地 +// $CaService->downOssPdfToLocal(); +// } +// +// // 进行处方pdf签章 +// $file_id = $CaService->addSignPdf($user['user_type']); +// +// // 药师-医院签章 +// if ($user['user_type'] == 3) { +// // 药师端时,需要进行系统签章 +// // 把药师签章的pdf存储至本地文件 +// // 下载药师签章pdf图片 +// dump($file_id); +// $CaService->downCaPdfToLocal($file_id,1); +// +// // 进行处方pdf签章 +// $file_id = $CaService->addSignPdf($user['user_type']); +// } +// +// $result = array(); +// $result['prescription_img_oss_path'] = $prescription_img_oss_path ?? ""; +// $result['file_id'] = $file_id; +// return $result; +// +// } catch (\Throwable $e) { +// throw new BusinessException($e->getMessage()); +// } +// } + + /** + * 开具处方 + * 医生-正常开具 + * 药师-先开具药师处方,再开具医院签章 + * @param string $order_prescription_id 处方id + * @param string $user_id 用户id + * @param int $type 类型 1:医院 2:医生 3:药师 + * @return array + */ + public function openPrescription(string $order_prescription_id,int $type,string $user_id = ""): array { try { - // 获取用户数据 - $params = array(); - $params['user_id'] = $user_id; - $user = User::getOne($params); - if (empty($user)) { - throw new BusinessException("用户数据错误"); - } - - if ($user['user_type'] != 2 && $user['user_type'] != 3) { - throw new BusinessException("用户类型错误"); - } - // 获取处方数据 $params = array(); $params['order_prescription_id'] = $order_prescription_id; @@ -159,40 +228,20 @@ class OrderPrescriptionService extends BaseService throw new BusinessException("医生开方日期错误"); } - $CaService = new CaService($order_prescription,$user); + $CaService = new CaService($order_prescription,$type,$user_id); // 获取云证书签名+验证云证书签名 - $CaService->getVerifyCertSign($order_prescription,1); - - // 医生 - if ($user['user_type'] == 2) { + $CaService->getVerifyCertSign($order_prescription); + if ($type == 2) { // 生成处方图片+处方图片生成pdf $prescription_img_oss_path = $CaService->createPrescriptionImgPdf($order_prescription); - } - - // 药师-医院签章 - if ($user['user_type'] == 3) { - // 获取医院云证书签名+验证云证书签名 - $CaService->getVerifyCertSign($order_prescription,2); - - // 下载医生开具的处方pdf至本地,文件存在时不进行下载 + }else{ + // 下载已经开具的处方pdf至本地 $CaService->downOssPdfToLocal(); } // 进行处方pdf签章 - $file_id = $CaService->addSignPdf($user['user_type']); - - // 药师-医院签章 - if ($user['user_type'] == 3) { - // 药师端时,需要进行系统签章 - // 把药师签章的pdf存储至本地文件 - // 下载药师签章pdf图片 - $CaService->downCaPdfToLocal($file_id,1); - - // 进行处方pdf签章 - $file_id = $CaService->addSignPdf($user['user_type']); - } - + $file_id = $CaService->addSignPdf($type); $result = array(); $result['prescription_img_oss_path'] = $prescription_img_oss_path ?? ""; $result['file_id'] = $file_id; diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index fecc36f..b7778f1 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1471,7 +1471,7 @@ class UserDoctorService extends BaseService // 开具处方 $OrderPrescriptionService = new OrderPrescriptionService(); - $prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']); + $prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,2,$user_info['user_id']); if (empty($prescription_open_result['prescription_img_oss_path']) || empty($prescription_open_result['file_id'])){ Db::rollBack(); return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败"); From f8563694fe5dd19cb2bca4f91b7b0a93a25e1dec Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 8 Sep 2023 17:52:37 +0800 Subject: [PATCH 140/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=80=E5=85=B7?= =?UTF-8?q?=E5=A4=84=E6=96=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/OrderPrescriptionService.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Services/OrderPrescriptionService.php b/app/Services/OrderPrescriptionService.php index 6d1d23d..e23ce8f 100644 --- a/app/Services/OrderPrescriptionService.php +++ b/app/Services/OrderPrescriptionService.php @@ -124,14 +124,14 @@ class OrderPrescriptionService extends BaseService return OrderPrescription::getCount($params); } - /** - * 开具处方 - * 医生-正常开具 - * 药师-先开具药师处方,再开具医院签章 - * @param string $order_prescription_id 处方id - * @param string $user_id 用户id - * @return array - */ +// /** +// * 开具处方 +// * 医生-正常开具 +// * 药师-先开具药师处方,再开具医院签章 +// * @param string $order_prescription_id 处方id +// * @param string $user_id 用户id +// * @return array +// */ // public function openPrescription1(string $order_prescription_id, string $user_id): array // { // try { From a4d2cc47ce5239e1cceec094564bc77818bace9d Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 11 Sep 2023 09:41:22 +0800 Subject: [PATCH 141/176] =?UTF-8?q?=E5=A4=84=E6=96=B9=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E8=B7=B3=E8=BD=AC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/MessagePush.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 59fd5b2..3982160 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -1335,7 +1335,7 @@ class MessagePush extends BaseService $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知 - $sub_data['params']['page'] = "Pages/yishi/chufangsetup/index"; + $sub_data['params']['page'] = "Pages/yishi/chufangsetup/index?status=1"; $sub_data['params']['data'] = [ "phrase1" => "审方通过",// 审核结果 "thing2" => "审核通过",// 原因 @@ -1393,7 +1393,7 @@ class MessagePush extends BaseService $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知 - $sub_data['params']['page'] = "Pages/yishi/chufangsetup/index"; + $sub_data['params']['page'] = "Pages/yishi/chufangsetup/index?status=2"; $sub_data['params']['data'] = [ "phrase1" => "审方不通过",// 审核结果 "thing2" => (string)$order_prescription['pharmacist_fail_reason'],// 原因 From 21f2cf12da53f3234e98ee1603092a2dda13770a Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 11 Sep 2023 16:49:20 +0800 Subject: [PATCH 142/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=AE=A2=E5=8D=95command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Command/ReportPreProductOrderCommand.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/Command/ReportPreProductOrderCommand.php b/app/Command/ReportPreProductOrderCommand.php index dcd829f..c32b289 100644 --- a/app/Command/ReportPreProductOrderCommand.php +++ b/app/Command/ReportPreProductOrderCommand.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace App\Command; +use App\Exception\BusinessException; use App\Model\OrderPrescription; use App\Model\OrderProduct; use App\Model\UserPatient; @@ -55,6 +56,20 @@ class ReportPreProductOrderCommand extends HyperfCommand foreach ($order_product_ids as $item){ $this->line("本次请求订单号:" . $item['order_product_id']); + // 获取商品订单数据 + $params = array(); + $params['order_product_id'] = $item['order_product_id']; + $order_product = OrderProduct::getOne($params); + if (empty($order_product)) { + $this->line("结束,商品订单数据错误"); + continue; + } + + if ($order_product['report_pre_status'] == 1){ + $this->line("结束,订单已上报"); + continue; + } + Db::beginTransaction(); try { From 094696df2c73fd01e4fa9960871c2ec2b9046476 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 14 Sep 2023 09:49:00 +0800 Subject: [PATCH 143/176] =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E5=A4=84=E6=96=B9?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=8E=BB=E9=99=A4=E5=A4=B1=E8=B4=A5=E5=90=8E?= =?UTF-8?q?=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Command/ReportPreProductOrderCommand.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Command/ReportPreProductOrderCommand.php b/app/Command/ReportPreProductOrderCommand.php index c32b289..9c3e277 100644 --- a/app/Command/ReportPreProductOrderCommand.php +++ b/app/Command/ReportPreProductOrderCommand.php @@ -84,12 +84,12 @@ class ReportPreProductOrderCommand extends HyperfCommand // 修改药品订单表上报处方平台状态 $this->saveOrderProductPeportPreStatus($item['order_product_id'],2,"超出最大上报次数"); - // 修改失败时药品订单数据 - $this->savePreFailedOrderStatus($item['order_product_id'],"药房处方复核失败,平台会在24小时内进行退款处理"); - - // 退款 - $OrderProductService = new OrderProductService(); - $OrderProductService->OrderProductRefund($item['order_product_id'],"药品订单退款"); +// // 修改失败时药品订单数据 +// $this->savePreFailedOrderStatus($item['order_product_id'],"药房处方复核失败,平台会在24小时内进行退款处理"); +// +// // 退款 +// $OrderProductService = new OrderProductService(); +// $OrderProductService->OrderProductRefund($item['order_product_id'],"药品订单退款"); Db::commit(); continue; From 9d454e9ad64a1c043991e6c564f9b01819b936f3 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 15 Sep 2023 09:18:22 +0800 Subject: [PATCH 144/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9F=AD=E4=BF=A1=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Amqp/Consumer/SendSmsMessageConsumer.php | 6 ++ app/Command/ReportPreProductOrderCommand.php | 15 ++++ app/Model/OrderSystem.php | 82 ++++++++++++++++++++ app/Services/MessagePush.php | 31 +++++++- 4 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 app/Model/OrderSystem.php diff --git a/app/Amqp/Consumer/SendSmsMessageConsumer.php b/app/Amqp/Consumer/SendSmsMessageConsumer.php index 99bb2b2..1219cda 100644 --- a/app/Amqp/Consumer/SendSmsMessageConsumer.php +++ b/app/Amqp/Consumer/SendSmsMessageConsumer.php @@ -199,6 +199,12 @@ class SendSmsMessageConsumer extends ConsumerMessage return false; } break; + case 'SMS_463525093': + // 客服-通知客服 + if (!isset($template_param['code'])) { + return false; + } + break; default: // 非法模版 return false; diff --git a/app/Command/ReportPreProductOrderCommand.php b/app/Command/ReportPreProductOrderCommand.php index 9c3e277..6c23d29 100644 --- a/app/Command/ReportPreProductOrderCommand.php +++ b/app/Command/ReportPreProductOrderCommand.php @@ -7,6 +7,8 @@ namespace App\Command; use App\Exception\BusinessException; use App\Model\OrderPrescription; use App\Model\OrderProduct; +use App\Model\OrderSystem; +use App\Model\UserDoctor; use App\Model\UserPatient; use App\Services\MessagePush; use App\Services\OrderPrescriptionService; @@ -92,6 +94,19 @@ class ReportPreProductOrderCommand extends HyperfCommand // $OrderProductService->OrderProductRefund($item['order_product_id'],"药品订单退款"); Db::commit(); + + // 获取系统配置 + $params = array(); + $params['system_permission'] = "reportPreNotice"; + $order_system = OrderSystem::getOne($params); + if (!empty($order_system)){ + if ($order_system['is_sms'] == 1 && !empty($order_system['sms_mobile'])){ + // 客服-通知客服药品订单上报处方平台失败 + $MessagePush = new MessagePush(); + $MessagePush->noticeReport($order_product['order_product_no'],$order_system['sms_mobile']); + } + } + continue; } }catch(\Exception $e){ diff --git a/app/Model/OrderSystem.php b/app/Model/OrderSystem.php new file mode 100644 index 0000000..d5d7e3c --- /dev/null +++ b/app/Model/OrderSystem.php @@ -0,0 +1,82 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增数据 + * @param array $data + * @return \Hyperf\Database\Model\Model|OrderSystem + */ + public static function addOrderSystem(array $data = []): \Hyperf\Database\Model\Model|OrderSystem + { + return self::create($data); + } + + /** + * 修改 + * @param array $params + * @param array $data + * @return int + */ + public static function edit(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } + +} diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 3982160..48066c9 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -2270,8 +2270,6 @@ class MessagePush extends BaseService * 订阅发送失败发送短信 * @param string $order_detection_id * @return void - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface */ public function patientDetectionResultNotice(string $order_detection_id): void { @@ -2389,4 +2387,33 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } + + /** + * 客服-通知客服 + * 短信 + * @param string $order_no + * @param string $mobile + * @return void + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function noticeReport(string $order_no,string $mobile): void + { + // 获取系统接诊配置 + $data = array(); + $data['template_code'] = "SMS_463525093"; + $data['scene_desc'] = "通知客服"; + $data['phone'] = $mobile; + + $template_param = array(); + $template_param['code'] = $order_no; + $data['template_param'] = $template_param; + + $message = new SendSmsMessageProducer($data); + $producer = ApplicationContext::getContainer()->get(Producer::class); + $result = $producer->produce($message); + if (!$result) { + throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); + } + } } \ No newline at end of file From 668b95a229bd8ac97779bb2dc2858c7d7c678317 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 18 Sep 2023 17:37:55 +0800 Subject: [PATCH 145/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Constants/HttpEnumCode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Constants/HttpEnumCode.php b/app/Constants/HttpEnumCode.php index 0e4efef..36fc837 100644 --- a/app/Constants/HttpEnumCode.php +++ b/app/Constants/HttpEnumCode.php @@ -22,12 +22,12 @@ class HttpEnumCode extends AbstractConstants const HTTP_ERROR = -1; /** - * @Message("用户状态异常") + * @Message("账户状态异常,请联系客服:010-87573022") */ const USER_STATUS_ERROR = 201; /** - * @Message("用户已被禁用") + * @Message("账户已被禁用,请联系客服:010-87573022") */ const USER_STATUS_DISABLE = 202; From e41253d65d93fe4606391b35b2d452056717f496 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 22 Sep 2023 13:16:46 +0800 Subject: [PATCH 146/176] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=85=8D=E7=BD=AE=EF=BC=8C=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/UserController.php | 27 +++++++ app/Model/UserSystem.php | 98 +++++++++++++++++++++++ app/Request/UserRequest.php | 9 ++- app/Services/OrderPrescriptionService.php | 80 ------------------ app/Services/UserService.php | 70 ++++++++++++++++ config/routes.php | 6 ++ 6 files changed, 209 insertions(+), 81 deletions(-) create mode 100644 app/Model/UserSystem.php diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index 6de89b5..fd32538 100644 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -189,4 +189,31 @@ class UserController extends AbstractController $data = $UserService->getLocation(); return $this->response->json($data); } + + /** + * 获取用户配置 + * @return ResponseInterface + */ + public function getUserSystem(): ResponseInterface + { + $UserService = new UserService(); + $data = $UserService->getUserSystem(); + return $this->response->json($data); + } + + /** + * 修改用户配置 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function putUserSystem(): ResponseInterface + { + $request = $this->container->get(UserRequest::class); + $request->scene('putUserSystem')->validateResolved(); + + $UserService = new UserService(); + $data = $UserService->putUserSystem(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Model/UserSystem.php b/app/Model/UserSystem.php new file mode 100644 index 0000000..7c578d1 --- /dev/null +++ b/app/Model/UserSystem.php @@ -0,0 +1,98 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 获取是否存在 + * @param array $params + * @return bool + */ + public static function getExists(array $params): bool + { + return self::where($params)->exists(); + } + + /** + * 获取数量 + * @param array $params + * @return int + */ + public static function getCount(array $params): int + { + return self::where($params)->count(); + } + + /** + * 新增 + * @param array $data + * @return \Hyperf\Database\Model\Model|UserSystem + */ + public static function addUserSystem(array $data): \Hyperf\Database\Model\Model|UserSystem + { + return self::create($data); + } + + /** + * 修改 + * @param array $params + * @param array $data + * @return int + */ + public static function edit(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } + +} diff --git a/app/Request/UserRequest.php b/app/Request/UserRequest.php index 7c1686f..ad685c9 100644 --- a/app/Request/UserRequest.php +++ b/app/Request/UserRequest.php @@ -41,6 +41,9 @@ class UserRequest extends FormRequest 'is_default', 'tag', ], + 'putUserSystem' => [ // 修改用户配置 + 'is_accept_im_message_push', + ], ]; /** @@ -59,7 +62,6 @@ class UserRequest extends FormRequest return [ 'avatar' => 'required|url', 'user_name' => 'required', - 'province_id' => 'required_with:city_id,county_id', 'city_id' => 'required_with:county_id', 'county_id' => 'required', @@ -68,6 +70,7 @@ class UserRequest extends FormRequest 'consignee_tel' => 'required', 'is_default' => ['required','numeric','min:0','max:1'], 'tag' => ['sometimes','required','numeric','min:1','max:4'], + 'is_accept_im_message_push' => ['required','numeric','min:0','max:1'], ]; } @@ -95,6 +98,10 @@ class UserRequest extends FormRequest 'tag.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'tag.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'tag.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'is_accept_im_message_push.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'is_accept_im_message_push.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'is_accept_im_message_push.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'is_accept_im_message_push.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), ]; } } diff --git a/app/Services/OrderPrescriptionService.php b/app/Services/OrderPrescriptionService.php index e23ce8f..6c29f4c 100644 --- a/app/Services/OrderPrescriptionService.php +++ b/app/Services/OrderPrescriptionService.php @@ -124,86 +124,6 @@ class OrderPrescriptionService extends BaseService return OrderPrescription::getCount($params); } -// /** -// * 开具处方 -// * 医生-正常开具 -// * 药师-先开具药师处方,再开具医院签章 -// * @param string $order_prescription_id 处方id -// * @param string $user_id 用户id -// * @return array -// */ -// public function openPrescription1(string $order_prescription_id, string $user_id): array -// { -// try { -// // 获取用户数据 -// $params = array(); -// $params['user_id'] = $user_id; -// $user = User::getOne($params); -// if (empty($user)) { -// throw new BusinessException("用户数据错误"); -// } -// -// if ($user['user_type'] != 2 && $user['user_type'] != 3) { -// throw new BusinessException("用户类型错误"); -// } -// -// // 获取处方数据 -// $params = array(); -// $params['order_prescription_id'] = $order_prescription_id; -// $order_prescription = OrderPrescription::getOne($params); -// if (empty($order_prescription)) { -// throw new BusinessException("处方数据错误"); -// } -// -// if (empty($order_prescription['doctor_created_time'])) { -// throw new BusinessException("医生开方日期错误"); -// } -// -// $CaService = new CaService($order_prescription,$user); -// -// // 获取云证书签名+验证云证书签名 -// $CaService->getVerifyCertSign($order_prescription,1); -// -// // 医生 -// if ($user['user_type'] == 2) { -// // 生成处方图片+处方图片生成pdf -// $prescription_img_oss_path = $CaService->createPrescriptionImgPdf($order_prescription); -// } -// -// // 药师-医院签章 -// if ($user['user_type'] == 3) { -// // 获取医院云证书签名+验证云证书签名 -// $CaService->getVerifyCertSign($order_prescription,2); -// -// // 下载医生开具的处方pdf至本地 -// $CaService->downOssPdfToLocal(); -// } -// -// // 进行处方pdf签章 -// $file_id = $CaService->addSignPdf($user['user_type']); -// -// // 药师-医院签章 -// if ($user['user_type'] == 3) { -// // 药师端时,需要进行系统签章 -// // 把药师签章的pdf存储至本地文件 -// // 下载药师签章pdf图片 -// dump($file_id); -// $CaService->downCaPdfToLocal($file_id,1); -// -// // 进行处方pdf签章 -// $file_id = $CaService->addSignPdf($user['user_type']); -// } -// -// $result = array(); -// $result['prescription_img_oss_path'] = $prescription_img_oss_path ?? ""; -// $result['file_id'] = $file_id; -// return $result; -// -// } catch (\Throwable $e) { -// throw new BusinessException($e->getMessage()); -// } -// } - /** * 开具处方 * 医生-正常开具 diff --git a/app/Services/UserService.php b/app/Services/UserService.php index 8c8f11c..209362b 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -13,6 +13,7 @@ use App\Model\UserDoctorInfo; use App\Model\UserLocation; use App\Model\UserPatient; use App\Model\UserShipAddress; +use App\Model\UserSystem; use App\Utils\Mask; use App\Utils\PcreMatch; use Extend\Tencent\map\Location; @@ -686,6 +687,75 @@ class UserService extends BaseService return success($area); } + /** + * 获取用户配置 + * @return array + */ + public function getUserSystem(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + // 定义返回数据 + $result = array( + "is_accept_im_message_push" => 0, + ); + + // 获取用户配置数据 + $params = array(); + $params['user_id'] = $user_info['user_id']; + $user_system = UserSystem::getOne($params); + if (empty($user_system)){ + return success($result); + } + + $result['is_accept_im_message_push'] = 0; + return success($result); + } + + /** + * 修改用户配置 + * @return array + */ + public function putUserSystem(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + $request_params = $this->request->all(); + + // 获取用户配置数据 + $params = array(); + $params['user_id'] = $user_info['user_id']; + $user_system = UserSystem::getOne($params); + if (empty($user_system)){ + // 新增 + $data = array(); + $data['user_id'] = $user_info['user_id']; + $data['is_accept_im_message_push'] = $request_params['is_accept_im_message_push']; + $user_system = UserSystem::addUserSystem($data); + if (empty($user_system)){ + return fail(); + } + }else{ + // 修改 + $data = array(); + + if ($user_system['is_accept_im_message_push'] != $request_params['is_accept_im_message_push']){ + $data['is_accept_im_message_push'] = $request_params['is_accept_im_message_push']; + } + + if (!empty($data)){ + $params = array(); + $params['user_system_id'] = $user_system['user_system_id']; + + $res = UserSystem::edit($params,$data); + if (!$res){ + return fail(); + } + } + } + return success(); + } + + /** * 通过user_id获取用户openid * @param string|int $user_id diff --git a/config/routes.php b/config/routes.php index 9045e2a..ba62ff5 100644 --- a/config/routes.php +++ b/config/routes.php @@ -696,6 +696,12 @@ Router::addGroup('/user', function () { // 获取用户地址 Router::get('/location', [UserController::class, 'getLocation']); + + // 获取用户配置 + Router::get('/system', [UserController::class, 'getUserSystem']); + + // 修改用户配置 + Router::put('/system', [UserController::class, 'putUserSystem']); }); // 获取患者问诊病例 From 77dd5c933145ead16df8376a67e73ba3438f0dcc Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 25 Sep 2023 10:36:22 +0800 Subject: [PATCH 147/176] =?UTF-8?q?=E6=96=B0=E5=A2=9Eim=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E6=97=B6=E6=8E=A8=E9=80=81=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CallBackController.php | 280 ++------------------------ app/Services/MessagePush.php | 117 +++++++++++ app/Services/UserService.php | 75 ++++++- 3 files changed, 209 insertions(+), 263 deletions(-) diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 5c70361..54e5c9d 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -29,14 +29,17 @@ use App\Model\OrderProductRefund; use App\Model\PatientFamily; use App\Model\Product; use App\Model\ProductPlatformAmount; +use App\Model\User; use App\Model\UserCoupon; use App\Model\UserDoctor; use App\Model\UserPatient; +use App\Model\UserSystem; use App\Services\BaseService; use App\Services\ImService; use App\Services\InquiryService; use App\Services\MessagePush; use App\Services\OrderPrescriptionService; +use App\Services\UserService; use App\Utils\Log; use Extend\Alibaba\Oss; use Extend\TencentIm\Account; @@ -634,10 +637,9 @@ class CallBackController extends AbstractController { $request_params = $this->request->all(); try { - Log::getInstance()->info("Im回调数据:" . json_encode($request_params, JSON_UNESCAPED_UNICODE)); + Log::getInstance("CallBackController-imCallBack")->info("Im回调数据:" . json_encode($request_params, JSON_UNESCAPED_UNICODE)); if (empty($request_params['RequestTime']) || empty($request_params['Sign'])) { - Log::getInstance()->error("Im回调数据处理失败:缺少时间时间戳/签名字段"); return $this->ImErrorReturn("缺少时间时间戳/签名字段"); } @@ -645,37 +647,31 @@ class CallBackController extends AbstractController $imService = new ImService(); $result = $imService->validateSign($request_params['RequestTime'], $request_params['Sign']); if (!$result) { - Log::getInstance()->error("Im回调数据处理失败:回调签名不匹配"); return $this->ImErrorReturn("回调签名不匹配"); } // 验证消息内容 if (empty($request_params['MsgBody'])) { - Log::getInstance()->error("Im回调数据处理失败:消息内容错误"); return $this->ImErrorReturn("消息内容错误,缺少MsgBody"); } // 验证消息内容类型 if (empty($request_params['MsgBody'][0]['MsgType'])) { - Log::getInstance()->error("Im回调数据处理失败:缺少MsgType"); return $this->ImErrorReturn("消息内容错误,缺少MsgType"); } // 验证消息内容详情 if (empty($request_params['MsgBody'][0]['MsgContent'])) { - Log::getInstance()->error("Im回调数据处理失败:缺少MsgContent"); return $this->ImErrorReturn("消息内容错误,缺少MsgContent"); } // 验证接收方user_id if (empty($request_params['To_Account'])) { - Log::getInstance()->error("Im回调数据处理失败:接收用户错误"); return $this->ImErrorReturn("消息内容错误,接收用户错误"); } // 验证消息唯一id if (empty($request_params['MsgKey'])) { - Log::getInstance()->error("Im回调数据处理失败:消息唯一标识错误"); return $this->ImErrorReturn("消息内容错误,消息唯一标识错误"); } @@ -685,7 +681,7 @@ class CallBackController extends AbstractController $message = MessageIm::getExists($params); if ($message) { // 消息重复 - Log::getInstance()->info("Im回调数据处理失败:消息重复"); + Log::getInstance("CallBackController-imCallBack")->info("消息重复"); return $this->ImSuccessReturn(); } @@ -706,7 +702,6 @@ class CallBackController extends AbstractController $params['order_inquiry_id'] = $cloud_custom_data['order_inquiry_id']; $order_inquiry = OrderInquiry::getOne($params); if (empty($order_inquiry)) { - Log::getInstance()->error("Im回调数据处理失败:非法订单"); return $this->ImErrorReturn("消息内容错误,非法订单"); } @@ -745,13 +740,21 @@ class CallBackController extends AbstractController $data['message_custom_content'] = $request_params['CloudCustomData'] ?? ""; $message = MessageIm::addMessage($data); if (empty($message)) { - Log::getInstance()->error("Im回调数据处理失败:存储数据库失败"); - return $this->wxPayErrorReturn("存储数据库失败"); + return $this->ImErrorReturn("存储数据库失败"); + } + + // im消息通知 + if ($is_system == 0 && isset($message_send_result) && isset($order_inquiry_id)){ + try { + $UserService = new UserService(); + $UserService->userImMessageNotice($request_params['To_Account'],$order_inquiry_id,$request_params['MsgBody']); + }catch (\Throwable $e){ + Log::getInstance("CallBackController-imCallBack")->error("im消息通知失败"); + } } } catch (\Exception $e) { // 验证失败 - Log::getInstance()->error("Im回调数据处理失败:" . $e->getMessage()); - return $this->wxPayErrorReturn($e->getMessage()); + return $this->ImErrorReturn($e->getMessage()); } Log::getInstance()->info("Im回调数据处理成功"); @@ -765,6 +768,7 @@ class CallBackController extends AbstractController */ protected function ImErrorReturn(string $message): ResponseInterface { + Log::getInstance("CallBackController-imCallBack")->error("Im回调数据处理失败:接收用户错误"); return $this->response ->withStatus(200) ->withBody( @@ -1334,254 +1338,6 @@ class CallBackController extends AbstractController return $server->serve(); } -// /** -// * 检测所结果回调 -// * @return ResponseInterface -// */ -// public function DetectionResultCallBack1(): ResponseInterface -// { -// $request_params = $this->request->all(); -// $auth = $this->request->header("Authorization"); -// if (empty($auth)){ -// return $this->detectionResultFailReturn("非法请求"); -// } -// -// Log::getInstance("CallBackController-DetectionResultCallBack")->info("处理检测所结果"); -// -// try { -// // 检测参数 -// if (!isset($request_params['appId'])){ -// return $this->detectionResultFailReturn("缺少appId参数"); -// } -// -// if (!isset($request_params['orderCode'])){ -// return $this->detectionResultFailReturn("缺少orderCode参数"); -// } -// -// if (!isset($request_params['detectBarcode'])){ -// return $this->detectionResultFailReturn("缺少detectBarcode参数"); -// } -// -// if (!isset($request_params['pdfReport'])){ -// return $this->detectionResultFailReturn("缺少pdfReport参数"); -// } -// -// // 检测签名 -// $params = array(); -// $params['app_id'] = $request_params['appId']; -// $basic_detection_organ = BasicDetectionOrgan::getOne($params); -// if (empty($basic_detection_organ)){ -// return $this->detectionResultFailReturn("非法appId"); -// } -// -// $time = date('Ymd'); -// $sign = md5($basic_detection_organ['app_id'] . $basic_detection_organ['app_secret'] . $time); -// if ($auth != $sign){ -// return $this->detectionResultFailReturn("签名错误"); -// } -// -// // 检测pdf文件 -// $pdfData = base64_decode($request_params['pdfReport']); -// if (!$pdfData){ -// return $this->detectionResultFailReturn("文件错误"); -// } -// -// // 获取检测订单数据 -// $params = array(); -// $params['detection_no'] = $request_params['orderCode']; -// $order_detection = OrderDetection::getOne($params); -// if (empty($order_detection)){ -// return $this->detectionResultFailReturn("非法订单"); -// } -// -// // 检测订单状态 -// if ($order_detection['detection_status'] != 3){ -// return $this->detectionResultFailReturn("订单状态错误,无法处理"); -// } -// -// if (!empty($order_detection['detection_result_pdf'])){ -// return $this->detectionResultSuccessReturn(); -// } -// -// if ($order_detection['detection_bar_code'] != $request_params['detectBarcode']){ -// return $this->detectionResultFailReturn("检测条码无法对应"); -// } -// -// // 获取医生数据 -// $params = array(); -// $params['doctor_id'] = $order_detection['doctor_id']; -// $user_doctor = UserDoctor::getOne($params); -// if (empty($user_doctor)){ -// return $this->detectionResultFailReturn("医生数据错误"); -// } -// -// // 获取检测病例数据 -// $params = array(); -// $params['order_detection_id'] = $order_detection['order_detection_id']; -// $order_detection_case = OrderDetectionCase::getOne($params); -// if (empty($order_detection_case)){ -// return $this->detectionResultFailReturn("订单数据错误"); -// } -// -// // 获取检测项目数据 -// $params = array(); -// $params['detection_project_id'] = $order_detection['detection_project_id']; -// $detection_project = DetectionProject::getOne($params); -// if (empty($detection_project)){ -// return $this->detectionResultFailReturn("订单数据错误"); -// } -// -// // 检测家庭成员是否存在 -// $params = array(); -// $params['family_id'] = $order_detection['family_id']; -// $params['patient_id'] = $order_detection['patient_id']; -// $patient_family = PatientFamily::getOne($params); -// if (empty($patient_family)) { -// return $this->detectionResultFailReturn("患者信息错误"); -// } -// -// // 上传处方图片至oss -// $oss = new Oss(); -// $detection_result_pdf_name = "applet/patient/detection/pdf/" . $order_detection['order_detection_id'] . '.' . 'pdf'; -// $detection_result_pdf = $oss->putObject($detection_result_pdf_name, $pdfData); -// $detection_result_pdf = '/' . $detection_result_pdf; -// -// Db::beginTransaction(); -// -// try { -// $generator = $this->container->get(IdGeneratorInterface::class); -// -// // 创建问诊订单 -// $data = array(); -// $data['user_id'] = $order_detection['user_id']; -// $data['patient_id'] = $order_detection['patient_id']; -// $data['doctor_id'] = $order_detection['doctor_id']; -// $data['family_id'] = $order_detection['family_id']; -// $data['inquiry_type'] = 5; // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) -// $data['inquiry_mode'] = 1; // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) -// $data['inquiry_status'] = 4; // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) -// $data['inquiry_pay_channel'] = 3; // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) -// $data['inquiry_pay_status'] = 2; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) -// $data['inquiry_no'] = $generator->generate();// 订单编号 -// $data['escrow_trade_no'] = "GD" . $generator->generate(); // 第三方支付流水号 -// $data['amount_total'] = 0;// 订单金额 -// $data['coupon_amount_total'] = 0;// 优惠卷总金额 -// $data['payment_amount_total'] = 0;// 实际付款金额 -// $data['pay_time'] = date('Y-m-d H:i:s', time());// 支付时间 -// $data['reception_time'] = date('Y-m-d H:i:s', time());// 接诊时间 -// $data['patient_name'] = $patient_family['card_name'];// 患者姓名-就诊人 -// $data['patient_name_mask'] = $patient_family['card_name_mask'];// 患者姓名-就诊人(掩码) -// $data['patient_sex'] = $patient_family['sex'];// 患者性别-就诊人(0:未知 1:男 2:女) -// $data['patient_age'] = $patient_family['age'];// 患者年龄-就诊人 -// $order_inquiry = OrderInquiry::addOrderInquiry($data); -// if (empty($order_inquiry)) { -// Db::rollBack(); -// return $this->detectionResultFailReturn("问诊订单创建失败"); -// } -// -// // 回填问诊订单id -// $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; -// -// // 增加患者问诊病例 -// $data = array(); -// $data['user_id'] = $order_detection['user_id']; -// $data['patient_id'] = $order_detection['patient_id']; -// $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id -// $data['family_id'] = $patient_family['family_id']; // 家庭成员id -// $data['relation'] = $patient_family['relation']; // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 ) -// $data['name'] = $patient_family['card_name']; // 患者名称 -// $data['sex'] = $patient_family['sex'] ?? 0; // 患者性别(0:未知 1:男 2:女) -// $data['age'] = $patient_family['age'] ?? null; // 患者年龄 -// $data['height'] = $patient_family['height'] ?: null; // 身高(cm) -// $data['weight'] = $patient_family['weight'] ?: null;; // 体重(kg) -// $order_inquiry_case = OrderInquiryCase::addOrderInquiryCase($data); -// if (empty($order_inquiry_case)) { -// Db::rollBack(); -// return $this->detectionResultFailReturn("问诊订单病例创建失败"); -// } -// -// // 修改检测订单 -// $data = array(); -// $data['detection_status'] = 4; -// $data['detection_result_pdf'] = $detection_result_pdf; -// $data['detection_result_date'] = date('Y-m-d H:i:s',time()); -// $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id -// -// $params = array(); -// $params['order_detection_id'] = $order_detection['order_detection_id']; -// OrderDetection::editOrderDetection($params,$data); -// -// // 回填检测结果字段 -// $order_detection['detection_result_pdf'] = $detection_result_pdf; -// $order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; -// -// // 添加自动完成队列 -// $time = 1000 * 60 * 60 * 24 * 3; -// -// $data = array(); -// $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; -// -// $message = new AutoCompleteInquiryDelayDirectProducer($data); -// $message->setDelayMs($time); -// $producer = $this->container->get(Producer::class); -// $res = $producer->produce($message); -// if (!$res) { -// Db::rollBack(); -// return $this->detectionResultFailReturn("添加自动完成队列失败"); -// } -// -// // 发送im消息 -// $imService = new ImService(); -// -// // 患者病例 -// $imService->patientCase( -// $order_inquiry, -// $user_doctor['user_id'], -// $order_inquiry_case['disease_desc'] -// ); -// -// // 发送IM消息-检测报告结果 -// $imService->detectionTestReport( -// $order_detection, -// $user_doctor['user_id'], -// $order_detection['user_id'], -// $order_detection_case['detection_disease_class_names'], -// $detection_project['detection_project_name'] -// ); -// -// Db::commit(); -// } catch (\Throwable $e) { -// Db::rollBack(); -// return $this->detectionResultFailReturn($e->getMessage()); -// } -// -// try { -// // 发送IM消息-检测报告结果-文字 -// $imService->detectionTestReportStr( -// $order_detection, -// $user_doctor['user_name'], -// $detection_project['detection_project_name'], -// $user_doctor['user_id'], -// $order_detection['user_id'] -// ); -// -// // 患者-新报告生成通知 -// $MessagePush = new MessagePush($order_detection['user_id']); -// $MessagePush->patientDetectionResultNotice($order_detection['order_detection_id']); -// -// // 医生-通知医生患者检测报告已生成 -// $MessagePush = new MessagePush($user_doctor['user_id']); -// $MessagePush->doctorDetectionResultNotice($order_detection['order_detection_id']); -// }catch (\Throwable $e){ -// Log::getInstance("detectionResult")->error($e->getMessage()); -// } -// -// return $this->detectionResultSuccessReturn(); -// } catch (\Throwable $e) { -// return $this->detectionResultFailReturn("异常:" . $e->getMessage()); -// } -// } - /** * 检测所结果回调 * @return ResponseInterface diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 48066c9..ccde9f2 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -2416,4 +2416,121 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } + + /** + * 患者-im消息通知 + * 订阅 + * @param string $data 消息内容 + * @return void + */ + public function patientImMessageNotice(string $msg): void + { + try { + // 获取医生数据 + $params = array(); + $params['doctor_id'] = $this->order_inquiry['doctor_id']; + $user_doctor = UserDoctor::getOne($params); + if (empty($user_doctor)) { + Log::getInstance("MessagePush")->error("错误:医生数据为空"); + return; + } + + // im内容 + if (strlen($msg) > 15) { + $msg = mb_substr($msg, 0, 15); + if ($msg) { + $msg = $msg . "..."; + } + } + + // 订阅 + $sub_data = array(); + $sub_data['push_user_id'] = $this->user['user_id']; + $sub_data['wx_template_id'] = "9v6dZhjg09CttLd3W9nEUV_-eshNc4BYYNy59jglvZE";// 问诊提醒 + $sub_data['params']['page'] = "pages/message/message"; + $sub_data['params']['data'] = [ + "thing1" => (string)"医生回复了您的消息,点击查看详情",// 问诊内容 + "thing2" => (string)$msg,// 提醒内容 + "name3" => (string)$user_doctor['user_name'],// 问诊医生 + "thing4" => "如有困扰,前往个人中心的设置中关闭",// 提示说明 + ]; + + $data = array(); + $data['sub_data'] = $sub_data; + $data['sms_data'] = array();; + + $message = new SendSubMessageProducer($data); + $producer = ApplicationContext::getContainer()->get(Producer::class); + $result = $producer->produce($message); + if (!$result) { + Log::getInstance("MessagePush-patientImMessageNotice")->error(json_encode($data, JSON_UNESCAPED_UNICODE)); + } + } catch (\Throwable $e) { + Log::getInstance("MessagePush-patientImMessageNotice")->error($e->getMessage()); + } + } + + /** + * 医生-im消息通知 + * 订阅 + * @param string $im_data + * @return void + */ + public function doctorImMessageNotice(string $msg): void + { + try { + // 获取问诊订单关联病例 + $params = array(); + $params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; + $order_inquiry_case = OrderInquiryCase::getOne($params); + if (empty($order_inquiry_case)) { + Log::getInstance("MessagePush")->error("错误:病例数据为空"); + return; + } + + // im内容 + if (strlen($msg) > 15) { + $msg = mb_substr($msg, 0, 15); + if ($msg) { + $msg = $msg . "..."; + } + } + + // 问诊内容-病情主诉 + $disease_desc = $order_inquiry_case['disease_desc']; + if (!empty($disease_desc)) { + if (strlen($disease_desc) > 15) { + $disease_desc = mb_substr($disease_desc, 0, 15); + if ($disease_desc) { + $disease_desc = $disease_desc . "..."; + } + } + } + + // 订阅 + $sub_data = array(); + $sub_data['push_user_id'] = $this->user['user_id']; + $sub_data['wx_template_id'] = "G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc";// 问诊提醒 + $sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen"; + $sub_data['params']['data'] = [ + "thing1" => $msg,// 提醒内容 + "name2" => (string)$this->order_inquiry['patient_name'],// 患者姓名 + "thing4" => (string)$disease_desc,// 病情描述 + "thing6" => "患者发来了最新消息,点击查看详情",// 提示说明 + ]; + + $data = array(); + $data['sub_data'] = $sub_data; + $data['sms_data'] = array();; + + $message = new SendSubMessageProducer($data); + $producer = ApplicationContext::getContainer()->get(Producer::class); + $result = $producer->produce($message); + if (!$result) { + Log::getInstance("MessagePush-patientImMessageNotice")->error(json_encode($data, JSON_UNESCAPED_UNICODE)); + } + } catch (\Throwable $e) { + Log::getInstance("MessagePush-patientImMessageNotice")->error($e->getMessage()); + } + } } \ No newline at end of file diff --git a/app/Services/UserService.php b/app/Services/UserService.php index 209362b..f632526 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -755,7 +755,6 @@ class UserService extends BaseService return success(); } - /** * 通过user_id获取用户openid * @param string|int $user_id @@ -835,4 +834,78 @@ class UserService extends BaseService return $avatar; } + /** + * 用户im消息通知 + * @param int|string $user_id + * @param string|int $order_inquiry_id + * @param array $msg_body + * @return bool + */ + public function userImMessageNotice(int|string $user_id,string|int $order_inquiry_id,array $msg_body): bool + { + try { + // 获取用户数据 + $params = array(); + $params['user_id'] = $user_id; + $user = User::getOne($params); + if (empty($user)){ + return false; + } + + // 获取用户配置 + $params = array(); + $params['user_id'] = $user['user_id']; + $user_system = UserSystem::getOne($params); + if (empty($user_system)){ + return false; + } + + $message = "您有一条新的问诊消息"; + // 判断消息类型 + if (isset($msg_body[0]['MsgType'])){ + switch ($msg_body[0]['MsgType']) { + case 'TIMLocationElem': + $message = "地理位置"; + break; + case 'TIMFaceElem': + $message = "表情消息"; + break; + + case 'TIMSoundElem': + $message = "语音消息"; + break; + case 'TIMImageElem': + $message = "图像消息"; + break; + case 'TIMFileElem': + $message = "文件消息"; + break; + case 'TIMTextElem': + if (isset($msg_body[0]['MsgContent']['Text'])){ + $message = $msg_body[0]['MsgContent']['Text']; + } + break; + default: + // code... + break; + } + } + + $MessagePush = new MessagePush($user_id, $order_inquiry_id); + + if ($user['user_type'] == 1){ + // 患者 + $MessagePush->patientImMessageNotice($message); + } elseif ($user['user_type'] == 2){ + // 医师 + $MessagePush->doctorImMessageNotice($message); + }else{ + return false; + } + }catch (\Throwable $e){ + return false; + } + + return true; + } } \ No newline at end of file From 9b096e0060a2e8e1640acf1af9608a87b4c8bc92 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 25 Sep 2023 11:32:32 +0800 Subject: [PATCH 148/176] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E7=94=A8=E6=88=B7?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/LoginService.php | 111 ++++++++++++++++++++++------------ app/Services/UserService.php | 8 ++- extend/TencentIm/Account.php | 4 +- 3 files changed, 82 insertions(+), 41 deletions(-) diff --git a/app/Services/LoginService.php b/app/Services/LoginService.php index 7f51a52..ef40a64 100644 --- a/app/Services/LoginService.php +++ b/app/Services/LoginService.php @@ -8,6 +8,7 @@ use App\Model\User as UserModel; use App\Model\UserDoctor as UserDoctorModel; use App\Model\UserPatient as UserPatientModel; use App\Model\UserPharmacist as UserPharmacistModel; +use App\Model\UserSystem; use App\Utils\Http; use App\Utils\Jwt; use App\Utils\Log; @@ -42,7 +43,7 @@ class LoginService extends BaseService // 获取手机号 $phone_info = $weChat->getPhone($phone_code); - if (empty($phone_info) || empty($phone_info['phone_info']) || empty($phone_info['phone_info']['purePhoneNumber'])){ + if (empty($phone_info) || empty($phone_info['phone_info']) || empty($phone_info['phone_info']['purePhoneNumber'])) { return fail(HttpEnumCode::GET_WX_ERROR); } @@ -63,7 +64,7 @@ class LoginService extends BaseService // 处理药师特殊情况,后台添加,前台不允许注册 if ($user_type == 3) { Db::rollBack(); - return fail(HttpEnumCode::HTTP_ERROR,"账号不存在,请联系客服"); + return fail(HttpEnumCode::HTTP_ERROR, "账号不存在,请联系客服"); } // 获取用户默认头像oss地址 @@ -72,7 +73,7 @@ class LoginService extends BaseService // 新增用户表 $data = array(); - $data['user_name'] = 'gdxz' . substr($phone_info['phone_info']['purePhoneNumber'],-4) . mt_rand(10000,99999); + $data['user_name'] = 'gdxz' . substr($phone_info['phone_info']['purePhoneNumber'], -4) . mt_rand(10000, 99999); $data['mobile'] = $phone_info['phone_info']['purePhoneNumber']; $data['wx_mobile'] = $phone_info['phone_info']['purePhoneNumber']; $data['user_type'] = $user_type; @@ -115,17 +116,32 @@ class LoginService extends BaseService $client_user_id = $user_doctor['doctor_id']; } + // 新增用户配置表 + $params = array(); + $params['user_id'] = $user['user_id']; + $user_system = UserSystem::getOne($params); + if (empty($user_system)) { + $data = array(); + $data['user_id'] = $user['user_id']; + $data['is_accept_im_message_push'] = 1; // 默认新增一下配置表 + $user_system = UserSystem::addUserSystem($data); + if (empty($user_system)) { + Db::rollBack(); + return fail(HttpEnumCode::SERVER_ERROR); + } + } + // 创建im账号 $account = new Account(); // 创建单个账号 - $account->createAccount($user->user_id,$user->user_name,addAliyunOssWebsite($avatar)); + $account->createAccount($user->user_id, $user->user_name, addAliyunOssWebsite($avatar)); - if ($user['user_type'] == 1){ + if ($user['user_type'] == 1) { // 发放用户优惠卷 $CouponService = new CouponService(); - $res = $CouponService->DistributeCoupon(1,(string)$user->user_id,$user_patient['patient_id']); - if (!$res){ + $res = $CouponService->DistributeCoupon(1, (string)$user->user_id, $user_patient['patient_id']); + if (!$res) { Db::rollBack(); return fail(HttpEnumCode::SERVER_ERROR); } @@ -144,17 +160,17 @@ class LoginService extends BaseService $params['user_id'] = $user->user_id; if ($user['user_type'] == 1) { $result = UserPatientModel::getOne($params); - if (!empty($result)){ + if (!empty($result)) { $client_user_id = $result['patient_id']; } } elseif ($user['user_type'] == 2) { $result = UserDoctorModel::getOne($params); - if (!empty($result)){ + if (!empty($result)) { $client_user_id = $result['doctor_id']; } } elseif ($user['user_type'] == 3) { $result = UserPharmacistModel::getOne($params); - if (!empty($result)){ + if (!empty($result)) { $client_user_id = $result['pharmacist_id']; } } @@ -210,7 +226,7 @@ class LoginService extends BaseService // 创建单个账号 $account->createAccount($user['user_id'], $user['user_name'], $avatar); } - }catch(\Exception $e){ + } catch (\Exception $e) { Log::getInstance()->error("IM账号倒入失败"); } } @@ -224,8 +240,7 @@ class LoginService extends BaseService $data = array(); $data['login_ip'] = $login_ip ?? ""; $data['last_login_at'] = date('Y-m-d H:i:s', time()); - - UserModel::editUser($params,$data); + UserModel::editUser($params, $data); // 组合生成token的数据 $token_user_data = array(); @@ -266,16 +281,16 @@ class LoginService extends BaseService $user_type = $this->request->input('user_type'); $wx_code = $this->request->input('wx_code'); - $app_env = config('app_env','dev'); - if ($app_env != 'dev'){ + $app_env = config('app_env', 'dev'); + if ($app_env != 'dev') { $redis = $this->container->get(Redis::class); // 验证验证码 $sms_code = $redis->get("login_code" . $phone); - if (empty($sms_code)){ + if (empty($sms_code)) { return fail(HttpEnumCode::CODE_EXPIRED); } - if ($sms_code != $code){ + if ($sms_code != $code) { return fail(HttpEnumCode::CODE_ERROR); } } @@ -303,7 +318,7 @@ class LoginService extends BaseService // 处理药师特殊情况,后台添加,前台不允许注册 if ($user_type == 3) { Db::rollBack(); - return fail(HttpEnumCode::HTTP_ERROR,"账号不存在,请联系客服"); + return fail(HttpEnumCode::HTTP_ERROR, "账号不存在,请联系客服"); } // 获取用户默认头像oss地址 @@ -312,7 +327,7 @@ class LoginService extends BaseService // 新增用户表 $data = array(); - $data['user_name'] = 'gdxz' . substr($phone,-4) . mt_rand(10000,99999);; + $data['user_name'] = 'gdxz' . substr($phone, -4) . mt_rand(10000, 99999);; $data['mobile'] = $phone; $data['wx_mobile'] = $phone; $data['user_type'] = $user_type; @@ -351,25 +366,40 @@ class LoginService extends BaseService return fail(HttpEnumCode::SERVER_ERROR); } $client_user_id = $user_doctor['doctor_id']; - }elseif($user['user_type'] == 3){ + } elseif ($user['user_type'] == 3) { Db::rollBack(); return fail(HttpEnumCode::SERVER_ERROR); - }else{ + } else { Db::rollBack(); return fail(HttpEnumCode::SERVER_ERROR); } + // 新增用户配置表 + $params = array(); + $params['user_id'] = $user['user_id']; + $user_system = UserSystem::getOne($params); + if (empty($user_system)) { + $data = array(); + $data['user_id'] = $user['user_id']; + $data['is_accept_im_message_push'] = 1; // 默认新增一下配置表 + $user_system = UserSystem::addUserSystem($data); + if (empty($user_system)) { + Db::rollBack(); + return fail(HttpEnumCode::SERVER_ERROR); + } + } + // 创建im账号 $account = new Account(); // 创建单个账号 - $account->createAccount($user->user_id,$user->user_name,addAliyunOssWebsite($avatar)); + $account->createAccount($user->user_id, $user->user_name, addAliyunOssWebsite($avatar)); - if ($user['user_type'] == 1){ + if ($user['user_type'] == 1) { // 发放用户优惠卷 $CouponService = new CouponService(); - $res = $CouponService->DistributeCoupon(1,(string)$user->user_id,$user_patient['patient_id']); - if (!$res){ + $res = $CouponService->DistributeCoupon(1, (string)$user->user_id, $user_patient['patient_id']); + if (!$res) { Db::rollBack(); return fail(HttpEnumCode::SERVER_ERROR); } @@ -386,20 +416,20 @@ class LoginService extends BaseService $params['user_id'] = $user->user_id; if ($user['user_type'] == 1) { $result = UserPatientModel::getOne($params); - if (!empty($result)){ + if (!empty($result)) { $client_user_id = $result['patient_id']; } } elseif ($user['user_type'] == 2) { $result = UserDoctorModel::getOne($params); - if (!empty($result)){ + if (!empty($result)) { $client_user_id = $result['doctor_id']; } } elseif ($user['user_type'] == 3) { $result = UserPharmacistModel::getOne($params); - if (!empty($result)){ + if (!empty($result)) { $client_user_id = $result['pharmacist_id']; } - }else{ + } else { Db::rollBack(); return fail(HttpEnumCode::SERVER_ERROR); } @@ -438,6 +468,9 @@ class LoginService extends BaseService } elseif ($user['user_type'] == 3) { $params['pharmacist_id'] = $result['pharmacist_id']; $res = UserPharmacistModel::editUserPharmacist($params, $data); + } else { + Db::rollBack(); + return fail(HttpEnumCode::USER_STATUS_ERROR); } if (!$res) { @@ -455,7 +488,7 @@ class LoginService extends BaseService // 创建单个账号 $account->createAccount($user['user_id'], $user['user_name'], $avatar); } - }catch(\Exception $e){ + } catch (\Throwable $e) { Log::getInstance()->error("IM账号倒入失败"); } } @@ -469,7 +502,7 @@ class LoginService extends BaseService $data = array(); $data['login_ip'] = $login_ip ?? ""; $data['last_login_at'] = date('Y-m-d H:i:s', time()); - UserModel::editUser($params,$data); + UserModel::editUser($params, $data); // 组合生成token的数据 $token_user_data = array(); @@ -483,7 +516,9 @@ class LoginService extends BaseService $token = $Jwt->encode($token_user_data); // 登录成功,删除验证码 -// $redis->del("login_code" . $phone); + if ($app_env != 'dev') { + $redis->del("login_code" . $phone); + } // 组合返回数据 $data = array(); @@ -516,7 +551,7 @@ class LoginService extends BaseService $user_info = $this->request->getAttribute("userInfo") ?? []; $wx_code = $this->request->input('wx_code'); - if (empty($user_info)){ + if (empty($user_info)) { return fail(HttpEnumCode::GET_WX_ERROR); } @@ -524,7 +559,7 @@ class LoginService extends BaseService $params = array(); $params['user_id'] = $user_info['user_id']; $user = UserModel::getOne($params); - if (empty($user)){ + if (empty($user)) { return fail(); } @@ -567,7 +602,7 @@ class LoginService extends BaseService $data['open_id'] = $wx_info_data['openid']; } - if (!empty($data)){ + if (!empty($data)) { $data['updated_at'] = date('Y-m-d H:i:s', time()); $params = array(); @@ -580,7 +615,7 @@ class LoginService extends BaseService } elseif ($user['user_type'] == 3) { $params['pharmacist_id'] = $result['pharmacist_id']; $res = UserPharmacistModel::editUserPharmacist($params, $data); - }else{ + } else { $res = false; } @@ -588,9 +623,9 @@ class LoginService extends BaseService return fail(HttpEnumCode::SERVER_ERROR); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { // 此处不进行处理 - return fail(HttpEnumCode::GET_WX_ERROR,$e->getMessage()); + return fail(HttpEnumCode::GET_WX_ERROR, $e->getMessage()); } return success(); diff --git a/app/Services/UserService.php b/app/Services/UserService.php index f632526..0f2cf37 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -857,7 +857,13 @@ class UserService extends BaseService $params['user_id'] = $user['user_id']; $user_system = UserSystem::getOne($params); if (empty($user_system)){ - return false; + $data = array(); + $data['user_id'] = $user['user_id']; + $data['is_accept_im_message_push'] = 1; // 默认新增一下配置表 + $user_system = UserSystem::addUserSystem($data); + if (empty($user_system)){ + return false; + } } $message = "您有一条新的问诊消息"; diff --git a/extend/TencentIm/Account.php b/extend/TencentIm/Account.php index 7640af2..2a539fc 100644 --- a/extend/TencentIm/Account.php +++ b/extend/TencentIm/Account.php @@ -36,7 +36,7 @@ class Account extends Base $path = $this->config['base_url'] . $this->version . "/im_open_login_svc/account_import?" . $this->buildRequestParams(); return $this->postRequest($path,$options); - }catch (\Exception $e) { + }catch (\Throwable $e) { throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR); } } @@ -74,7 +74,7 @@ class Account extends Base } return true; - }catch (\Exception $e) { + }catch (\Throwable $e) { throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR); } } From b00c2d2d82b0d366c6201b028a051bf666107633 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 25 Sep 2023 14:32:50 +0800 Subject: [PATCH 149/176] 1 --- app/Services/UserService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/UserService.php b/app/Services/UserService.php index 0f2cf37..a96bee3 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -708,7 +708,7 @@ class UserService extends BaseService return success($result); } - $result['is_accept_im_message_push'] = 0; + $result['is_accept_im_message_push'] = $user_system['is_accept_im_message_push']; return success($result); } From 92d09762d1a1abe26a60cfafe93dd139792293c9 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 25 Sep 2023 16:20:30 +0800 Subject: [PATCH 150/176] 1 --- app/Services/UserService.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Services/UserService.php b/app/Services/UserService.php index a96bee3..a5d2a85 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -866,6 +866,11 @@ class UserService extends BaseService } } + // 无需发送 + if ($user_system['is_accept_im_message_push'] == 0){ + return true; + } + $message = "您有一条新的问诊消息"; // 判断消息类型 if (isset($msg_body[0]['MsgType'])){ From aa8b31c1bfe7743f8bcdbccd386b2e3900b681be Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Sat, 7 Oct 2023 16:26:42 +0800 Subject: [PATCH 151/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E8=AF=8A?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E4=BF=AE=E6=94=B9=E9=99=90=E5=88=B6=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DoctorInquiryService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Services/DoctorInquiryService.php b/app/Services/DoctorInquiryService.php index 41ac74a..290d267 100644 --- a/app/Services/DoctorInquiryService.php +++ b/app/Services/DoctorInquiryService.php @@ -345,7 +345,7 @@ class DoctorInquiryService extends BaseService $params[] = ['inquiry_config_id', '=', $doctor_inquiry_config['inquiry_config_id']]; $params[] = ['created_at', '>', date('Y-m-01', time())]; $modify_month_count = DoctorInquiryPriceRecord::getCount($params); - if ($modify_month_count >= 5000) { + if ($modify_month_count >= 5) { // 每自然月仅限调整5次 Db::rollBack(); return fail(HttpEnumCode::HTTP_ERROR, "问诊价格每自然月仅限调整5次"); @@ -356,7 +356,7 @@ class DoctorInquiryService extends BaseService $params[] = ['inquiry_config_id', '=', $doctor_inquiry_config['inquiry_config_id']]; $params[] = ['created_at', '>', date('Y-m-d', time())]; $modify_month_count = DoctorInquiryPriceRecord::getCount($params); - if ($modify_month_count >= 100000) { + if ($modify_month_count >= 1) { // 问诊价格每日仅限调整1次 Db::rollBack(); return fail(HttpEnumCode::HTTP_ERROR, "问诊价格每日仅限调整1次"); From e4ea689b79019518307ad110ee8a75b159853e79 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 10 Oct 2023 14:53:45 +0800 Subject: [PATCH 152/176] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E8=80=85id=E3=80=82=E5=A2=9E=E5=8A=A0=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E9=85=8D=E7=BD=AE=E8=A1=A8=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editDoctorInquiryConfigCommand.php | 123 ++++++++++++++++++ app/Model/DoctorInquiryConfig.php | 6 +- app/Model/User.php | 12 +- app/Services/LoginService.php | 18 ++- 4 files changed, 151 insertions(+), 8 deletions(-) create mode 100644 app/Command/editDoctorInquiryConfigCommand.php diff --git a/app/Command/editDoctorInquiryConfigCommand.php b/app/Command/editDoctorInquiryConfigCommand.php new file mode 100644 index 0000000..da76e3d --- /dev/null +++ b/app/Command/editDoctorInquiryConfigCommand.php @@ -0,0 +1,123 @@ +setDescription('修改医生问诊配置'); + } + + public function handle() + { + $this->line('开始'); + + // 获取医生信息 + $params = array(); + $user_doctors = UserDoctor::getList($params); + if (empty($user_doctors)) { + $this->line('结束,无医生需处理'); + return; + } + + // 获取系统问诊配置 + $params = array(); + $params['inquiry_type'] = 4; + $params['inquiry_mode'] = 1; + $system_inquiry_config = SystemInquiryConfig::getOne($params); + if (empty($system_inquiry_config)) { + $this->line('结束,系统问诊配置获取失败'); + return; + } + + foreach ($user_doctors as $user_doctor){ + Db::beginTransaction(); + + try { + // 是否参加专家图文接诊 + if ($user_doctor['is_img_expert_reception'] == 1){ + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_type'] = 1; + $params['inquiry_mode'] = 1; + + $data['is_enable'] = 1; + DoctorInquiryConfig::editInquiryConfig($params,$data); + } + + // 是否参加快速图文接诊 + if ($user_doctor['is_img_quick_reception'] == 1){ + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_type'] = 2; + $params['inquiry_mode'] = 1; + + $data['is_enable'] = 1; + DoctorInquiryConfig::editInquiryConfig($params,$data); + } + + // 是否参加公益图文问诊 + if ($user_doctor['is_img_welfare_reception'] == 1){ + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_type'] = 3; + $params['inquiry_mode'] = 1; + + $data['is_enable'] = 1; + DoctorInquiryConfig::editInquiryConfig($params,$data); + } + + // 医生多点执业认证状态 + if ($user_doctor['multi_point_status'] == 1){ + // 查询是否已设置多点执业认证状态 + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_type'] = 4; + $params['inquiry_mode'] = 1; + $doctor_inquiry_config = DoctorInquiryConfig::getOne($params); + if (empty($doctor_inquiry_config)) { + $data = array(); + $data['doctor_id'] = $user_doctor['doctor_id']; + $data['inquiry_type'] = 4; + $data['inquiry_mode'] = 1; + $data['is_enable'] = 1; + $data['work_num_day'] = $system_inquiry_config["max_work_num_day"]; + $data['inquiry_price'] = $system_inquiry_config["inquiry_price"]; + + $doctorInquiryConfig = DoctorInquiryConfig::addInquiryConfig($data); + if (empty($doctorInquiryConfig)){ + Db::rollBack(); + $this->line('失败:问诊购药处理失败'); + return; + } + } + } + + Db::commit(); + }catch (\Throwable $e){ + Db::rollBack(); + // 记录失败次数 + $this->line("失败:" . $e->getMessage()); + } + } + $this->line('结束'); + } +} diff --git a/app/Model/DoctorInquiryConfig.php b/app/Model/DoctorInquiryConfig.php index 9c48ba3..f3c8375 100644 --- a/app/Model/DoctorInquiryConfig.php +++ b/app/Model/DoctorInquiryConfig.php @@ -14,6 +14,8 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property string $doctor_id 医生id * @property int $inquiry_type 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) * @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) + * @property int $is_enable 是否启用(0:否 1:是) + * @property int $last_enable_method 最后开启方式(1:自己 2:后台) * @property int $work_num_day 每日接诊数量 * @property string $inquiry_price 接诊价格(专家问诊-公益问诊) * @property \Carbon\Carbon $created_at 创建时间 @@ -31,12 +33,12 @@ class DoctorInquiryConfig extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['inquiry_config_id', 'doctor_id', 'inquiry_type', 'inquiry_mode', 'work_num_day', 'inquiry_price', 'created_at', 'updated_at']; + protected array $fillable = ['inquiry_config_id', 'doctor_id', 'inquiry_type', 'inquiry_mode', 'is_enable', 'last_enable_method', 'work_num_day', 'inquiry_price', 'created_at', 'updated_at']; /** * The attributes that should be cast to native types. */ - protected array $casts = ['inquiry_config_id' => 'string', 'doctor_id' => 'string', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'work_num_day' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime']; + protected array $casts = ['inquiry_config_id' => 'string', 'doctor_id' => 'string', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'work_num_day' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'is_enable' => 'integer', 'last_enable_method' => 'integer']; protected string $primaryKey = "inquiry_config_id"; diff --git a/app/Model/User.php b/app/Model/User.php index 5a452fb..9a19c85 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -9,20 +9,22 @@ use Hyperf\Database\Model\Builder; use Hyperf\Snowflake\Concern\Snowflake; /** - * @property string $user_id 主键 + * @property int $user_id 主键 * @property string $user_name 用户名称 * @property string $user_account 账号 * @property string $mobile 手机号 - * @property int $sex 性别(0:未知 1:男 2:女) - * @property string $avatar 头像 * @property string $wx_mobile 微信手机号 * @property string $user_password 密码 * @property string $salt 密码混淆码 * @property int $user_type 用户类型(1:患者 2:医师 3:药师) * @property int $user_status 状态(0:禁用 1:正常 2:删除) - * @property int $register_method 注册方式(1:微信小程序 ) + * @property int $register_method 注册方式(1:微信小程序 2:后台添加 ) + * @property int $age 年龄 + * @property int $sex 性别(0:未知 1:男 2:女) + * @property string $avatar 头像 * @property string $login_ip 登陆ip * @property string $last_login_at 最后登陆时间 + * @property string $created_by 创建者id(后台用户表id null:自己注册) * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 */ @@ -38,7 +40,7 @@ class User extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'sex', 'avatar', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'login_ip', 'last_login_at', 'created_at', 'updated_at']; + protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'age', 'sex', 'avatar', 'login_ip', 'last_login_at', 'created_by', 'created_at', 'updated_at']; protected string $primaryKey = "user_id"; diff --git a/app/Services/LoginService.php b/app/Services/LoginService.php index ef40a64..c733fa6 100644 --- a/app/Services/LoginService.php +++ b/app/Services/LoginService.php @@ -131,6 +131,14 @@ class LoginService extends BaseService } } + // 修改用户表创建者id + $params = array(); + $params['user_id'] = $user['user_id']; + + $data = array(); + $data['created_by'] = $user['user_id']; + UserModel::editUser($params,$data); + // 创建im账号 $account = new Account(); // 创建单个账号 @@ -226,7 +234,7 @@ class LoginService extends BaseService // 创建单个账号 $account->createAccount($user['user_id'], $user['user_name'], $avatar); } - } catch (\Exception $e) { + } catch (\Throwable $e) { Log::getInstance()->error("IM账号倒入失败"); } } @@ -389,6 +397,14 @@ class LoginService extends BaseService } } + // 修改用户表创建者id + $params = array(); + $params['user_id'] = $user['user_id']; + + $data = array(); + $data['created_by'] = $user['user_id']; + UserModel::editUser($params,$data); + // 创建im账号 $account = new Account(); // 创建单个账号 From 97a7a6dcf9c57e9307f45e7e58fbe557f3d4a402 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 10 Oct 2023 17:03:17 +0800 Subject: [PATCH 153/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E7=AB=AF-=E5=8C=BB=E7=94=9F=E9=97=AE=E8=AF=8A=E5=BC=80?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E9=97=AE=E8=AF=8A=E9=85=8D=E7=BD=AE=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DoctorInquiryService.php | 101 +++++++++++--------------- 1 file changed, 44 insertions(+), 57 deletions(-) diff --git a/app/Services/DoctorInquiryService.php b/app/Services/DoctorInquiryService.php index 290d267..db8cd3a 100644 --- a/app/Services/DoctorInquiryService.php +++ b/app/Services/DoctorInquiryService.php @@ -163,75 +163,62 @@ class DoctorInquiryService extends BaseService return fail(HttpEnumCode::HTTP_ERROR, "请先进行绑定结算银行卡"); } - // 医生接诊配置表 - $params = array(); - $params['doctor_id'] = $user_info['client_user_id']; - $params['inquiry_type'] = $inquiry_type; - $params['inquiry_mode'] = $inquiry_mode; - $doctor_inquiry_config = DoctorInquiryConfig::getOne($params); - if (empty($doctor_inquiry_config)) { - if ($inquiry_type != 2) { - // 快速问诊可能会存在未创建的情况 - return fail(HttpEnumCode::HTTP_ERROR, "请先完善问诊配置"); - } - } - Db::beginTransaction(); + try { + // 医生接诊配置表 $params = array(); $params['doctor_id'] = $user_info['client_user_id']; + $params['inquiry_type'] = $inquiry_type; + $params['inquiry_mode'] = $inquiry_mode; + $doctor_inquiry_config = DoctorInquiryConfig::getOne($params); + if (empty($doctor_inquiry_config)) { + // 无问诊配置,快速问诊创建问诊配置并打开问诊。其余类型直接返回错误 + if ($inquiry_type != 2){ + // 快速问诊可能会存在未创建的情况 + Db::rollBack(); + return fail(HttpEnumCode::HTTP_ERROR, "请先完善问诊配置"); + } - $data = array(); - if ($inquiry_type == 1) { - // 专家 - $data['is_img_expert_reception'] = $is_open; - $data['is_online'] = $is_open; - } elseif ($inquiry_type == 2) { - // 快速 - $data['is_img_quick_reception'] = $is_open; - } elseif ($inquiry_type == 3) { - // 公益 - $data['is_img_welfare_reception'] = $is_open; - } - - UserDoctor::editUserDoctor($params, $data); - - if ($inquiry_type == 2 && $is_open == 1) { + // 获取系统问诊配置表 $params = array(); - $params['doctor_id'] = $user_info['client_user_id']; $params['inquiry_type'] = $inquiry_type; $params['inquiry_mode'] = $inquiry_mode; - $doctor_inquiry_config = DoctorInquiryConfig::getOne($params); - if (empty($doctor_inquiry_config)) { - // 系统问诊配置表 - $params = array(); - $params['inquiry_type'] = $inquiry_type; - $params['inquiry_mode'] = $inquiry_mode; - $system_inquiry_config = SystemInquiryConfig::getOne($params); - if (empty($system_inquiry_config)) { - Db::rollBack(); - return fail(HttpEnumCode::SERVER_ERROR); - } - - // 快速问诊,需创建 - $data = array(); - $data['doctor_id'] = $user_info['client_user_id']; - $data['system_inquiry_config_id'] = $system_inquiry_config['system_inquiry_config_id']; - $data['inquiry_type'] = $inquiry_type; - $data['inquiry_mode'] = $inquiry_mode; - $data['work_num_day'] = $system_inquiry_config['max_work_num_day'] ?: 0; - $data['inquiry_price'] = $system_inquiry_config['inquiry_price']; - - $doctor_inquiry_config = DoctorInquiryConfig::addInquiryConfig($data); - if (empty($doctor_inquiry_config)) { - Db::rollBack(); - return fail(HttpEnumCode::SERVER_ERROR); - } + $system_inquiry_config = SystemInquiryConfig::getOne($params); + if (empty($system_inquiry_config)) { + Db::rollBack(); + return fail(HttpEnumCode::SERVER_ERROR); } + + // 快速问诊,需创建 + $data = array(); + $data['doctor_id'] = $user_info['client_user_id']; + $data['system_inquiry_config_id'] = $system_inquiry_config['system_inquiry_config_id']; + $data['inquiry_type'] = $inquiry_type; + $data['inquiry_mode'] = $inquiry_mode; + $data['is_enable'] = 1; // 是否启用(0:否 1:是) + $data['last_enable_method'] = 1; // 最后开启方式(1:自己 2:后台) + $data['work_num_day'] = $system_inquiry_config['max_work_num_day'] ?: 0; + $data['inquiry_price'] = $system_inquiry_config['inquiry_price']; + + $doctor_inquiry_config = DoctorInquiryConfig::addInquiryConfig($data); + if (empty($doctor_inquiry_config)) { + Db::rollBack(); + return fail(HttpEnumCode::SERVER_ERROR); + } + }else{ + // 已存在问诊配置,进行修改 + $params = array(); + $params['inquiry_config_id'] = $doctor_inquiry_config["inquiry_config_id"]; + + $data = array(); + $data['is_enable'] = $is_open; + $data['last_enable_method'] = 1; + DoctorInquiryConfig::editInquiryConfig($params,$data); } Db::commit(); - } catch (\Exception $e) { + }catch (\Throwable $e){ Db::rollBack(); return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage()); } From 6ce57339a0d375154bd2d6c1b8ca4087e24f27da Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 10 Oct 2023 17:27:00 +0800 Subject: [PATCH 154/176] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E9=97=AE=E8=AF=8A=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=85=B3=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DoctorInquiryService.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/app/Services/DoctorInquiryService.php b/app/Services/DoctorInquiryService.php index db8cd3a..3ea3f69 100644 --- a/app/Services/DoctorInquiryService.php +++ b/app/Services/DoctorInquiryService.php @@ -51,17 +51,7 @@ class DoctorInquiryService extends BaseService } // 接诊开关 - $result['info']['is_open'] = 0; - if ($inquiry_type == 1) { - // 专家 - $result['info']['is_open'] = $doctor['is_img_expert_reception']; - } elseif ($inquiry_type == 2) { - // 快速 - $result['info']['is_open'] = $doctor['is_img_quick_reception']; - } elseif ($inquiry_type == 3) { - // 公益 - $result['info']['is_open'] = $doctor['is_img_welfare_reception']; - } + $is_open = 0; // 接诊价格 $result['info']['inquiry_price'] = 0; @@ -102,8 +92,14 @@ class DoctorInquiryService extends BaseService } $result['info']['work_num_day'] = $doctor_inquiry_config['work_num_day'] ?: 0; + + // 接诊开关 + $is_open = 1; } + // 接诊开关 + $result['info']['is_open'] = $is_open; + // 每日最大接诊数量 $result['config']['max_work_num_day'] = $system_inquiry_config['max_work_num_day']; From 0a8aa6040f74e33dad1cb4211b046b2958aaf577 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 10 Oct 2023 17:33:08 +0800 Subject: [PATCH 155/176] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E9=97=AE=E8=AF=8A=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=85=B3=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DoctorInquiryService.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Services/DoctorInquiryService.php b/app/Services/DoctorInquiryService.php index 3ea3f69..a32bd0b 100644 --- a/app/Services/DoctorInquiryService.php +++ b/app/Services/DoctorInquiryService.php @@ -94,7 +94,9 @@ class DoctorInquiryService extends BaseService $result['info']['work_num_day'] = $doctor_inquiry_config['work_num_day'] ?: 0; // 接诊开关 - $is_open = 1; + if ($doctor_inquiry_config['is_enable'] == 1){ + $is_open = 1; + } } // 接诊开关 From ba5c7d31f2e926540bf3ffc9cdcd0a07303ce7fc Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 11 Oct 2023 09:29:58 +0800 Subject: [PATCH 156/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E7=AB=AF=E9=A6=96=E9=A1=B5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/UserDoctorController.php | 1 - app/Model/DoctorInquiryConfig.php | 8 +- app/Services/IndexService.php | 132 +++++++++++++++++++++--- app/Services/PatientDoctorService.php | 2 +- 4 files changed, 125 insertions(+), 18 deletions(-) diff --git a/app/Controller/UserDoctorController.php b/app/Controller/UserDoctorController.php index 0844187..3e15027 100644 --- a/app/Controller/UserDoctorController.php +++ b/app/Controller/UserDoctorController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Amqp\Producer\PrescriptionDistributePhProducer; use App\Constants\HttpEnumCode; use App\Model\OrderPrescriptionIcd; use App\Model\OrderPrescriptionProduct; diff --git a/app/Model/DoctorInquiryConfig.php b/app/Model/DoctorInquiryConfig.php index f3c8375..5a81372 100644 --- a/app/Model/DoctorInquiryConfig.php +++ b/app/Model/DoctorInquiryConfig.php @@ -54,14 +54,14 @@ class DoctorInquiryConfig extends Model } /** - * 获取医生接诊配置信息-单条 + * 获取医生接诊配置信息 * @param array $params * @param array $fields * @return object|null */ - public static function getInquiryConfigOne(array $params, array $fields = ['*']): object|null + public static function getInquiryConfigList(array $params, array $fields = ['*']): object|null { - return self::where($params)->first($fields); + return self::where($params)->get($fields); } /** @@ -72,7 +72,7 @@ class DoctorInquiryConfig extends Model * @param array $inquiry_type_in_params * @return object|null */ - public static function getInquiryConfigList(array $params, array $fields = ['*'] , array $inquiry_type_in_params = [1,3]): object|null + public static function getInquiryConfigListByInquiryType(array $params, array $fields = ['*'] , array $inquiry_type_in_params = [1,3]): object|null { return self::where($params)->whereIn("inquiry_type",$inquiry_type_in_params)->get($fields); } diff --git a/app/Services/IndexService.php b/app/Services/IndexService.php index 769f033..da99fa0 100644 --- a/app/Services/IndexService.php +++ b/app/Services/IndexService.php @@ -20,6 +20,112 @@ use Hyperf\Utils\WaitGroup; */ class IndexService extends BaseService { +// /** +// * 医生端-首页 +// * @return array +// */ +// public function getDoctorIndex(): array +// { +// $user_info = $this->request->getAttribute("userInfo") ?? []; +// +// // 获取医生数据 +// $params = array(); +// $params['doctor_id'] = $user_info['client_user_id']; +// +// $fields = [ +// "doctor_id", +// "user_id", +// "user_name", +// "open_id", +// "status", +// "idcard_status", +// "iden_auth_status", +// "iden_auth_fail_reason", +// "multi_point_status", +// "is_bind_bank", +// "praise_rate", +// "avg_response_time", +// "number_of_fans", +// "avatar", +// "is_online", +// "is_img_expert_reception", +// "is_img_welfare_reception", +// "is_img_quick_reception", +// ]; +// +// $doctor = UserDoctorModel::getOne($params, $fields); +// if (empty($doctor)) { +// return fail(HttpEnumCode::USER_STATUS_ERROR); +// } +// +// if ($doctor['status'] == 0){ +// return fail(HttpEnumCode::USER_STATUS_DISABLE); +// } +// +// if ($doctor['status'] != 1){ +// return fail(HttpEnumCode::USER_STATUS_ERROR); +// } +// +// $InquiryService = new InquiryService(); +// $OrderPrescriptionService = new OrderPrescriptionService(); +// +// // 获取未接诊患者个数 +// $not_accepted_inquiry_num = $InquiryService->getDoctorNotAcceptedInquiryNum($doctor['doctor_id']); +// +// // 获取接诊中患者个数 +// $accepting_inquiry_num = $InquiryService->getDoctorAcceptingInquiryNum($doctor['doctor_id']); +// +// // 获取被驳回处方数据 +// $reject_prescription_number = $OrderPrescriptionService->getDoctorExistsAuditFail($doctor['doctor_id']); +// +// // 获取医生问诊价格 +// $params = array(); +// $params['doctor_id'] = $doctor['doctor_id']; +// $params['inquiry_type'] = 1;// 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊) +// $params['inquiry_mode'] = 1;// 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) +// $doctor_inquiry_config = DoctorInquiryConfigModel::getOne($params); +// +// // 获取banner +// $params = array(); +// $params["app_type"] = 1; +// $params["client_type"] = 2; +// $params["banner_place"] = 1; +// $params["banner_status"] = 1; +// $banner = BannerModel::getList($params); +// if (!empty($banner)){ +// foreach ($banner as &$item){ +// $item['banner_path'] = addAliyunOssWebsite($item['banner_path']); +// } +// } +// +// // 处理返回数据 +// $info = array(); +// $info['doctor_id'] = $doctor['doctor_id']; +// $info['user_name'] = $doctor['user_name']; +// $info['status'] = $doctor['status']; +// $info['idcard_status'] = $doctor['idcard_status'];// 实名认证状态(0:未认证 1:认证通过 2:认证失败) +// $info['iden_auth_status'] = $doctor['iden_auth_status'];// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) +// $info['multi_point_status'] = $doctor['multi_point_status'];// 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) +// $info['is_bind_bank'] = $doctor['is_bind_bank'];// 是否已绑定结算银行卡(0:否 1:是) +// $info['avatar'] = addAliyunOssWebsite($doctor['avatar']); +// $info['is_img_expert_reception'] = $doctor['is_img_expert_reception'];// 是否参加专家图文接诊(0:否 1:是) +// $info['is_img_welfare_reception'] = $doctor['is_img_welfare_reception'];// 是否参加公益图文问诊(0:否 1:是) +// $info['is_img_quick_reception'] = $doctor['is_img_quick_reception'];// 是否参加快速图文接诊(0:否 1:是) +// $info['praise_rate'] = $doctor['praise_rate'];// 好评率(百分制。回复质量占4、服务态度占3、回复速度占3。每周计算一次) +// $info['avg_response_time'] = (float)ceil($doctor['avg_response_time']);;// 平均响应时间(分钟制) +// $info['number_of_fans'] = $doctor['number_of_fans'];// 被关注数量 +// $info['inquiry_price'] = $doctor_inquiry_config['inquiry_price'] ?? "";// 在线问诊价格 +// $info['not_accepted_inquiry_num'] = $not_accepted_inquiry_num ?? 0;// 获取未接诊患者个数 +// $info['accepting_inquiry_num'] = $accepting_inquiry_num ?? 0;// 获取接诊中患者个数 +// $info['reject_prescription_number'] = $reject_prescription_number ?? 0;// 获取被驳回处方数据 +// +// $data = array(); +// $data['banner'] = $banner ?? [];// banner +// $data['info'] = $info;// 医生数据 +// +// return success($data); +// } + /** * 医生端-首页 * @return array @@ -47,10 +153,6 @@ class IndexService extends BaseService "avg_response_time", "number_of_fans", "avatar", - "is_online", - "is_img_expert_reception", - "is_img_welfare_reception", - "is_img_quick_reception", ]; $doctor = UserDoctorModel::getOne($params, $fields); @@ -78,12 +180,19 @@ class IndexService extends BaseService // 获取被驳回处方数据 $reject_prescription_number = $OrderPrescriptionService->getDoctorExistsAuditFail($doctor['doctor_id']); - // 获取医生问诊价格 + // 在线问诊价格 + $inquiry_price = ""; + + // 获取医生问诊配置 $params = array(); $params['doctor_id'] = $doctor['doctor_id']; - $params['inquiry_type'] = 1;// 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊) - $params['inquiry_mode'] = 1;// 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) - $doctor_inquiry_config = DoctorInquiryConfigModel::getOne($params); + $doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigList($params); + foreach ($doctor_inquiry_config as $value){ + // 获取在线问诊设置的价格 + if ($value['inquiry_type'] == 1 && $value['inquiry_mode'] == 1){ + $inquiry_price = $value['inquiry_price']; + } + } // 获取banner $params = array(); @@ -98,6 +207,7 @@ class IndexService extends BaseService } } + // 处理返回数据 $info = array(); $info['doctor_id'] = $doctor['doctor_id']; $info['user_name'] = $doctor['user_name']; @@ -107,13 +217,10 @@ class IndexService extends BaseService $info['multi_point_status'] = $doctor['multi_point_status'];// 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) $info['is_bind_bank'] = $doctor['is_bind_bank'];// 是否已绑定结算银行卡(0:否 1:是) $info['avatar'] = addAliyunOssWebsite($doctor['avatar']); - $info['is_img_expert_reception'] = $doctor['is_img_expert_reception'];// 是否参加专家图文接诊(0:否 1:是) - $info['is_img_welfare_reception'] = $doctor['is_img_welfare_reception'];// 是否参加公益图文问诊(0:否 1:是) - $info['is_img_quick_reception'] = $doctor['is_img_quick_reception'];// 是否参加快速图文接诊(0:否 1:是) $info['praise_rate'] = $doctor['praise_rate'];// 好评率(百分制。回复质量占4、服务态度占3、回复速度占3。每周计算一次) $info['avg_response_time'] = (float)ceil($doctor['avg_response_time']);;// 平均响应时间(分钟制) $info['number_of_fans'] = $doctor['number_of_fans'];// 被关注数量 - $info['inquiry_price'] = $doctor_inquiry_config['inquiry_price'] ?? "";// 在线问诊价格 + $info['inquiry_price'] = $inquiry_price;// 在线问诊价格 $info['not_accepted_inquiry_num'] = $not_accepted_inquiry_num ?? 0;// 获取未接诊患者个数 $info['accepting_inquiry_num'] = $accepting_inquiry_num ?? 0;// 获取接诊中患者个数 $info['reject_prescription_number'] = $reject_prescription_number ?? 0;// 获取被驳回处方数据 @@ -121,6 +228,7 @@ class IndexService extends BaseService $data = array(); $data['banner'] = $banner ?? [];// banner $data['info'] = $info;// 医生数据 + $data['doctor_inquiry_config'] = $doctor_inquiry_config;// 医生问诊配置 return success($data); } diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index c8f377c..64ddfb3 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -248,7 +248,7 @@ class PatientDoctorService extends BaseService $inquiry_type_in_params[] = 3; } - $doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigList($params,['*'],$inquiry_type_in_params); + $doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*'],$inquiry_type_in_params); if (!empty($doctor_inquiry_config)) { foreach ($doctor_inquiry_config as &$value) { // 获取医生当日的全部订单 From 095ad1d3271794587148f553f8fb8e7423d70922 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 11 Oct 2023 10:48:37 +0800 Subject: [PATCH 157/176] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=97=AE=E8=AF=8A?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=B6=88=E6=81=AF=E5=86=85=E9=A1=B5=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=98=AF=E5=90=A6=E5=BC=80=E5=90=AF=E9=97=AE=E8=AF=8A?= =?UTF-8?q?=E8=B4=AD=E8=8D=AF=E9=85=8D=E7=BD=AE=E5=AD=97=E6=AE=B5=E3=80=82?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=84=E6=96=B9=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E9=97=AE=E8=AF=8A=E8=B4=AD=E8=8D=AF=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 15 +++++++++++++++ app/Services/UserDoctorService.php | 14 ++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index cea9555..6a0e6e0 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -787,6 +787,20 @@ class InquiryService extends BaseService $duration = $system_inquiry_config['duration']; } + // 获取医生问诊配置-问诊购药 + $multi_point_enable = 0; + + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_type'] = 4; + $params['inquiry_mode'] = 1; + $doctor_inquiry_config = DoctorInquiryConfig::getOne($params); + if (!empty($doctor_inquiry_config)) { + if ($doctor_inquiry_config['is_enable'] == 1){ + $multi_point_enable = 1;// 是否开启问诊购药 + } + } + if ($user_info['user_type'] == 1) { // 关注状态 $params = array(); @@ -819,6 +833,7 @@ class InquiryService extends BaseService $result['is_evaluation'] = $is_evaluation; $result['reception_time'] = $order_inquiry['reception_time'] ?: null; // 接诊时间 $result['multi_point_status'] = $user_doctor['multi_point_status'] ?: null;// 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) + $result['multi_point_enable'] = $multi_point_enable;// 医生问诊购药是否开启 return success($result); } diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index b7778f1..64f8a67 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1303,6 +1303,20 @@ class UserDoctorService extends BaseService return fail(HttpEnumCode::HTTP_ERROR, "请先完成多点执业认证"); } + // 获取医生问诊配置-问诊购药 + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_type'] = 4; + $params['inquiry_mode'] = 1; + $doctor_inquiry_config = DoctorInquiryConfig::getOne($params); + if (empty($doctor_inquiry_config)) { + return fail(HttpEnumCode::HTTP_ERROR, "请联系客服开启问诊购药服务"); + } + + if ($doctor_inquiry_config['is_enable'] == 0){ + return fail(HttpEnumCode::HTTP_ERROR, "请联系客服开启问诊购药服务"); + } + // 获取问诊订单数据 $params = array(); $params['doctor_id'] = $user_info['client_user_id']; From b3897354e84a7c1eadfab1356aede3513d40c3fc Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 11 Oct 2023 15:36:41 +0800 Subject: [PATCH 158/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E8=AF=8A?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/TestController.php | 22 ++++-- app/Model/DoctorInquiryTime.php | 25 ++++++- app/Model/UserDoctor.php | 18 +++++ app/Services/PatientDoctorService.php | 9 +-- app/Services/UserDoctorService.php | 96 ++++++++------------------- 5 files changed, 90 insertions(+), 80 deletions(-) diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 544bab0..f068759 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -370,14 +370,22 @@ class TestController extends AbstractController } public function test_15(){ - $oss = new Oss(); - $pic = $oss->getObjectToRAM("applet/patient/detection/pdf/SDBA23S16881.pdf"); - if (empty($pic)){ - throw new BusinessException("检测管图片错误"); - } + $params = array(); + $params[] = ['inquiry_type','=',2]; + $params[] = ['inquiry_mode','=',1]; + $params[] = ['start_time','<',date('H',time()) . date('i',time())]; + $params[] = ['end_time','>',date('H',time()) . date('i',time())]; - $pic = base64_encode($pic); - Log::getInstance("请求参数")->info($pic); + $user_doctor_params = array(); + $user_doctor_params['is_platform_deep_cooperation'] = 1; + + $doctor_inquiry_config_params = array(); + $doctor_inquiry_config_params['inquiry_type'] = 2; + $doctor_inquiry_config_params['inquiry_mode'] = 1; + $doctor_inquiry_config_params['is_enable'] = 1; + + $doctor_inquiry_times = DoctorInquiryTime::getMinPlatDeepCooperationDoctor($params,$user_doctor_params,[],$doctor_inquiry_config_params); + dump($doctor_inquiry_times); } // 设置坐班医生 diff --git a/app/Model/DoctorInquiryTime.php b/app/Model/DoctorInquiryTime.php index 211cbd8..beb5748 100644 --- a/app/Model/DoctorInquiryTime.php +++ b/app/Model/DoctorInquiryTime.php @@ -9,6 +9,7 @@ namespace App\Model; use Hyperf\Database\Model\Collection; use Hyperf\Database\Model\Relations\HasOne; use Hyperf\Snowflake\Concern\Snowflake; +use Hyperf\DbConnection\Db; /** * @property int $inquiry_time_id 主键id @@ -112,10 +113,30 @@ class DoctorInquiryTime extends Model ->get($fields); } - - public static function add(array $data): \Hyperf\Database\Model\Model|DoctorInquiryTime { return self::create($data); } + + /** + * 获取坐班时间包含某时间的平台深度合作医生 + * @param array $params + * @param array $user_doctor_params + * @param array $user_doctor_not_in_params + * @param array $doctor_inquiry_config_params + * @param array $fields + * @return array|\Hyperf\Collection\Collection|Collection + */ + public static function getMinPlatDeepCooperationDoctor(array $params = [],array $user_doctor_params = [], array $user_doctor_not_in_params = [],array $doctor_inquiry_config_params = [], array $fields = ['*']): Collection|array|\Hyperf\Collection\Collection + { + $doctor_ids = Db::table('doctor_inquiry_config')->where($doctor_inquiry_config_params)->select("doctor_id"); + + $result = self::whereHas('UserDoctor' , function($query) use ($user_doctor_params,$user_doctor_not_in_params){ + $query->where($user_doctor_params)->whereNotIn('doctor_id',$user_doctor_not_in_params); + }) + ->where($params) + ->whereIn("doctor_id",$doctor_ids) + ->get($fields); + return $result; + } } diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index d1014c4..1b798ca 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -397,4 +397,22 @@ class UserDoctor extends Model ->where($params) ->get($fields); } + + /** + * 获取医生数据-医生配置 + * @param array $params + * @param array $not_in_params + * @param array $doctor_inquiry_config_params + * @param array $fields + * @return Collection|array|\Hyperf\Utils\Collection + */ + public static function getListWithConfig(array $params = [], array $not_in_params = [],array $doctor_inquiry_config_params = [],array $fields = ['*']): Collection|array|\Hyperf\Utils\Collection + { + $doctor_ids = Db::table('doctor_inquiry_config')->where($doctor_inquiry_config_params)->select("doctor_id"); + + return self::where($params) + ->whereNotIn('doctor_id',$not_in_params) + ->whereIn("doctor_id",$doctor_ids) + ->get($fields); + } } diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 64ddfb3..fc7cb94 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -589,8 +589,6 @@ class PatientDoctorService extends BaseService "department_custom_name", "hospital_id", "is_online", - "is_img_expert_reception", - "is_img_welfare_reception", "be_good_at", ]; @@ -610,11 +608,10 @@ class PatientDoctorService extends BaseService $data['doctor_title'] = empty($recommend_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($recommend_doctor['doctor_title']); $data['department_custom_name'] = $recommend_doctor['department_custom_name']; $data['is_online'] = $recommend_doctor['is_online']; - $data['is_img_expert_reception'] = $recommend_doctor['is_img_expert_reception']; - $data['is_img_welfare_reception'] = $recommend_doctor['is_img_welfare_reception']; $data['be_good_at'] = $recommend_doctor['be_good_at']; $data['hospital_name'] = $recommend_doctor['Hospital']['hospital_name'] ?? ""; $data['hospital_level_name'] = $recommend_doctor['Hospital']['hospital_level_name'] ?? ""; + $data['multi_point_enable'] = 0; // 是否开启问诊购药 // 处理接诊价格 $data['price'] = 0; @@ -630,6 +627,10 @@ class PatientDoctorService extends BaseService // 公益 $data['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; } + + if ($doctor_inquiry_config['inquiry_type'] == 4 && $doctor_inquiry_config['inquiry_mode'] == 1 && $doctor_inquiry_config['is_enable'] == 1) { + $data['multi_point_enable'] = 1; // 是否开启问诊购药 + } } } diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 64f8a67..9bf7a59 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1981,7 +1981,7 @@ class UserDoctorService extends BaseService if ($is_system_time_pass){ // 获取坐班时间包含当前时间的深度合作医生 - $doctor_ids = $this->getMinPlatDeepCooperationDoctorId($inquiry_type,time(),$not_doctor_ids); + $doctor_ids = $this->getNowTimePlatDeepCooperationDoctorId($inquiry_type,time(),$not_doctor_ids); Log::getInstance()->info("获取坐班时间包含当前时间的深度合作医生:" ,$doctor_ids); // 检测医生是否可被分配 @@ -2067,64 +2067,19 @@ class UserDoctorService extends BaseService $user_doctor_params = array(); $user_doctor_params['is_platform_deep_cooperation'] = 1; - if ($inquiry_type == 2){ - // 快速问诊 - $user_doctor_params['is_img_quick_reception'] = 1; - }elseif ($inquiry_type == 4){ - // 问诊购药 + + // 问诊购药 + if ($inquiry_type == 4){ $user_doctor_params['multi_point_status'] = 1; } - $doctor_inquiry_times = DoctorInquiryTime::getWithDoctorNotInList($params,$user_doctor_params,$not_doctor_ids); - if (!empty($doctor_inquiry_times)){ - foreach ($doctor_inquiry_times as $item){ - // 检测是否存在日期 - if (!empty($item['inquiry_date'])){ - // 获取当前日期 - $now_day = date('Y-m-d',time()); - if ($item['inquiry_date'] == $now_day){ - $doctor_ids[] = $item['doctor_id']; - } - }else{ - $doctor_ids[] = $item['doctor_id']; - } - } - } - if (!empty($doctor_ids)){ - $doctor_ids = array_unique($doctor_ids); - $doctor_ids = array_values($doctor_ids); - } + // 问诊配置 + $doctor_inquiry_config_params = array(); + $doctor_inquiry_config_params['inquiry_type'] = $inquiry_type; + $doctor_inquiry_config_params['inquiry_mode'] = 1; + $doctor_inquiry_config_params['is_enable'] = 1; - return $doctor_ids; - } - - /** - * 获取坐班时间包含某时间的平台深度合作医生 - * @param string $inquiry_type - * @param string $time 时间戳 - * @param array $not_doctor_ids 不可选择的医生id数组 - * @return array 医生id - */ - public function getMinPlatDeepCooperationDoctorId(string $inquiry_type,string $time,array $not_doctor_ids = []): array - { - $doctor_ids = []; - - $params = array(); - $params[] = ['inquiry_type','=',$inquiry_type]; - $params[] = ['inquiry_mode','=',1]; - $params[] = ['start_time','<',date('H',$time) . date('i',$time)]; - $params[] = ['end_time','>',date('H',$time) . date('i',$time)]; - - $user_doctor_params = array(); - $user_doctor_params['is_platform_deep_cooperation'] = 1; - if ($inquiry_type == 2){ - // 快速问诊 - $user_doctor_params['is_img_quick_reception'] = 1; - }elseif ($inquiry_type == 4){ - // 问诊购药 - $user_doctor_params['multi_point_status'] = 1; - } - $doctor_inquiry_times = DoctorInquiryTime::getWithDoctorNotInList($params,$user_doctor_params,$not_doctor_ids); + $doctor_inquiry_times = DoctorInquiryTime::getMinPlatDeepCooperationDoctor($params,$user_doctor_params,$not_doctor_ids,$doctor_inquiry_config_params); if (!empty($doctor_inquiry_times)){ foreach ($doctor_inquiry_times as $item){ // 检测是否存在日期 @@ -2215,16 +2170,20 @@ class UserDoctorService extends BaseService $params['iden_auth_status'] = 1; $params['is_bind_bank'] = 1; $params['is_online'] = 1; - if ($inquiry_type == 2){ - // 快速问诊 - $params['is_img_quick_reception'] = 1; - }elseif ($inquiry_type == 4){ - // 问诊购药 + + // 问诊购药 + if ($inquiry_type == 4){ $params['multi_point_status'] = 1; } + + $doctor_inquiry_config_params = array(); + $doctor_inquiry_config_params['inquiry_type'] = $inquiry_type; + $doctor_inquiry_config_params['inquiry_mode'] = 1; + $doctor_inquiry_config_params['is_enable'] = 1; + $params['is_platform_deep_cooperation'] = 1; - $user_doctor = UserDoctor::getUserDoctorNotInList($params,$not_doctor_ids); + $user_doctor = UserDoctor::getListWithConfig($params,$not_doctor_ids,$doctor_inquiry_config_params); return $user_doctor->toArray(); } @@ -2241,16 +2200,19 @@ class UserDoctorService extends BaseService $params['idcard_status'] = 1; $params['iden_auth_status'] = 1; $params['is_bind_bank'] = 1; - if ($inquiry_type == 2){ - // 快速问诊 - $params['is_img_quick_reception'] = 1; - }elseif ($inquiry_type == 4){ - // 问诊购药 + + // 问诊购药 + if ($inquiry_type == 4){ $params['multi_point_status'] = 1; } + $doctor_inquiry_config_params = array(); + $doctor_inquiry_config_params['inquiry_type'] = $inquiry_type; + $doctor_inquiry_config_params['inquiry_mode'] = 1; + $doctor_inquiry_config_params['is_enable'] = 1; + $params['is_platform_deep_cooperation'] = 0; - $user_doctor = UserDoctor::getUserDoctorNotInList($params,$not_doctor_ids); + $user_doctor = UserDoctor::getListWithConfig($params,$not_doctor_ids,$doctor_inquiry_config_params); return $user_doctor->toArray(); } From 9cad016a59c9e0ca4c7b6a70eb803c092075b1b2 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 11 Oct 2023 15:45:05 +0800 Subject: [PATCH 159/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E8=AF=8A?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientDoctorService.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index fc7cb94..76cccaf 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -634,6 +634,8 @@ class PatientDoctorService extends BaseService } } + $data['doctor_inquiry_config'] = $recommend_doctor['DoctorInquiryConfig']; + $results[] = $data; unset($data); From 41d82cc4eb437652ebad9f6d74d6bf9789af8a54 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 11 Oct 2023 16:14:17 +0800 Subject: [PATCH 160/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=8F=AF=E4=BB=A5=E6=8E=A5=E8=AF=8A=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientDoctorService.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 76cccaf..d66d6c8 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -432,6 +432,20 @@ class PatientDoctorService extends BaseService return fail(HttpEnumCode::HTTP_ERROR,"医生暂不可接诊"); } + // 获取医生问诊配置 + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_type'] = $inquiry_type; + $params['inquiry_mode'] = 1; + $doctor_inquiry_config = DoctorInquiryConfig::getOne($params); + if (empty($doctor_inquiry_config)){ + return fail(HttpEnumCode::HTTP_ERROR,"医生暂不可接诊"); + } + + if ($doctor_inquiry_config['is_enable'] == 0){ + return fail(HttpEnumCode::HTTP_ERROR,"医生暂不可接诊"); + } + // 检测当前医生是否和患者存在未完成问诊订单 $InquiryService = new InquiryService(); $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($user_info['client_user_id'],$doctor_id); From 438c6b28e35a15d0dedc45585621ca9bb3775e59 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 11 Oct 2023 16:24:44 +0800 Subject: [PATCH 161/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=97=AE=E8=AF=8A=E5=8C=BB=E7=94=9F=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientDoctorService.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index d66d6c8..2cdd1c6 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -179,9 +179,6 @@ class PatientDoctorService extends BaseService "avg_response_time", "number_of_fans", "is_online", - "is_img_expert_reception", - "is_img_welfare_reception", - "is_platform_deep_cooperation", "be_good_at", "brief_introduction", ]; @@ -239,16 +236,7 @@ class PatientDoctorService extends BaseService $params = array(); $params[] = ['doctor_id', '=', $doctor_id]; $params[] = ['inquiry_mode', '=', 1];// 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) - - $inquiry_type_in_params = array(); - if ($user_doctor['is_img_expert_reception'] == 1){ - $inquiry_type_in_params[] = 1; - } - if ($user_doctor['is_img_welfare_reception'] == 1){ - $inquiry_type_in_params[] = 3; - } - - $doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*'],$inquiry_type_in_params); + $doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*']); if (!empty($doctor_inquiry_config)) { foreach ($doctor_inquiry_config as &$value) { // 获取医生当日的全部订单 From 999e0753e98928ae4d3cfa38149df2072c7e5f0b Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 11 Oct 2023 17:01:52 +0800 Subject: [PATCH 162/176] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=97=AE=E8=AF=8A=E5=8C=BB=E7=94=9F=E5=88=97=E8=A1=A8=E9=97=AE?= =?UTF-8?q?=E8=AF=8A=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientDoctorService.php | 28 +++------------------------ 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 2cdd1c6..e050fc3 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -63,9 +63,9 @@ class PatientDoctorService extends BaseService $doctor_params["iden_auth_status"] = 1;// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) $doctor_params["is_bind_bank"] = 1;// 是否已绑定结算银行卡(0:否 1:是) - if (!empty($is_search_welfare_reception)){ - $doctor_params["is_img_welfare_reception"] = $is_search_welfare_reception;// 是否参加公益图文问诊(0:否 1:是) - } +// if (!empty($is_search_welfare_reception)){ +// $doctor_params["is_img_welfare_reception"] = $is_search_welfare_reception;// 是否参加公益图文问诊(0:否 1:是) +// } $fields = [ "doctor_id", @@ -84,9 +84,6 @@ class PatientDoctorService extends BaseService "avg_response_time", "number_of_fans", "is_online", - "is_img_expert_reception", - "is_img_welfare_reception", - "is_platform_deep_cooperation", "be_good_at", ]; @@ -106,25 +103,6 @@ class PatientDoctorService extends BaseService } } - // 处理问诊价格 - $user_doctor['price'] = 0; - $user_doctor['free_clinic_price'] = 0; - if (!empty($user_doctor['DoctorInquiryConfig'])) { - foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { - if ($doctor_inquiry_config['inquiry_mode'] == 1) { - if ($doctor_inquiry_config['inquiry_type'] == 1) { - // 专家 - $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; - } - if ($doctor_inquiry_config['inquiry_type'] == 3) { - // 公益 - $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; - } - } - } - unset($user_doctor['DoctorInquiryConfig']); - } - // 好评率-超过5个已结束的订单后展示 $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; // 响应时间-超过5个已结束的订单后展示 From 4aa31d785ac450f1209c91e770fd4504a875f68a Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 11 Oct 2023 17:19:41 +0800 Subject: [PATCH 163/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=88=91=E7=9A=84=E9=97=AE=E8=AF=8A=E3=80=81=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=AF=E5=A4=84=E6=96=B9=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientDoctorService.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index e050fc3..19d1736 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -540,6 +540,20 @@ class PatientDoctorService extends BaseService // 职称 $data['user_doctor']['doctor_title_name'] = empty($data['user_doctor']['doctor_title']) ? "" : DoctorTitleCode::getMessage($data['user_doctor']['doctor_title']); + // 医生问诊配置-问诊购药 + $data['user_doctor']['multi_point_enable'] = 0; + + $params = array(); + $params['doctor_id'] = $data['user_doctor']['doctor_id']; + $params['inquiry_type'] = 4; + $params['inquiry_mode'] = 1; + $doctor_inquiry_config = DoctorInquiryConfig::getOne($params); + if (!empty($doctor_inquiry_config)){ + if ($doctor_inquiry_config['is_enable'] == 1){ + $data['user_doctor']['multi_point_enable'] = 1; + } + } + $item = $data; } } @@ -608,7 +622,7 @@ class PatientDoctorService extends BaseService $data['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; } - if ($doctor_inquiry_config['inquiry_type'] == 4 && $doctor_inquiry_config['inquiry_mode'] == 1 && $doctor_inquiry_config['is_enable'] == 1) { + if ($doctor_inquiry_config['inquiry_type'] == 4 && $doctor_inquiry_config['is_enable'] == 1) { $data['multi_point_enable'] = 1; // 是否开启问诊购药 } } From f185c0e906340382585047b31cc772f444a48f08 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 11 Oct 2023 17:23:49 +0800 Subject: [PATCH 164/176] =?UTF-8?q?2277=EF=BC=88=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=88=91=E7=9A=84=E9=97=AE=E8=AF=8A=E3=80=81=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=88=97=E8=A1=A8=EF=BC=89=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BA=86multi=5Fpoint=5Fenable=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientDoctorService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 19d1736..4ee8a30 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -493,7 +493,7 @@ class PatientDoctorService extends BaseService /** * 获取我的问诊、关注医生列表 - * @return array|void + * @return array */ public function getDoctorList(){ $user_info = $this->request->getAttribute("userInfo") ?? []; From e59b0072443d6a4be6a467ae2375e6ac963ba2f6 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 11 Oct 2023 17:45:41 +0800 Subject: [PATCH 165/176] 1 --- app/Services/PatientDoctorService.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 4ee8a30..27c85dc 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -103,6 +103,24 @@ class PatientDoctorService extends BaseService } } + // 处理问诊价格 + $user_doctor['price'] = 0; + $user_doctor['free_clinic_price'] = 0; + if (!empty($user_doctor['DoctorInquiryConfig'])) { + foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { + if ($doctor_inquiry_config['inquiry_mode'] == 1) { + if ($doctor_inquiry_config['inquiry_type'] == 1) { + // 专家 + $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; + } + if ($doctor_inquiry_config['inquiry_type'] == 3) { + // 公益 + $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; + } + } + } + } + // 好评率-超过5个已结束的订单后展示 $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; // 响应时间-超过5个已结束的订单后展示 From c467fc9fa08d32c75c2e1f26bb1b0c8305e7cc9c Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 12 Oct 2023 09:03:25 +0800 Subject: [PATCH 166/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E8=AF=8A-?= =?UTF-8?q?=E8=8D=AF=E5=93=81=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E9=97=AE?= =?UTF-8?q?=E8=AF=8A=E8=B4=AD=E8=8D=AF=E5=BC=80=E5=90=AF=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientOrderService.php | 30 +++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 96a2011..d9a0fbb 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -9,6 +9,7 @@ use App\Constants\DoctorTitleCode; use App\Constants\HttpEnumCode; use App\Model\BasicLogisticsCompany; use App\Model\DetectionProject; +use App\Model\DoctorInquiryConfig; use App\Model\Hospital; use App\Model\OrderDetection; use App\Model\OrderInquiry; @@ -253,8 +254,21 @@ class PatientOrderService extends BaseService $params['doctor_id'] = $user_doctor['doctor_id']; $user_doctor['follow'] = PatientFollow::getExists($params); - $order_inquiry['user_doctor'] = $user_doctor; + // 获取医生问诊配置-问诊购药 + $user_doctor['multi_point_enable'] = 0; + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_type'] = 4; + $params['inquiry_mode'] = 1; + $doctor_inquiry_config = DoctorInquiryConfig::getOne($params); + if (!empty($doctor_inquiry_config)){ + if ($doctor_inquiry_config['is_enable'] == 1){ + $user_doctor['multi_point_enable'] = 1; + } + } + + $order_inquiry['user_doctor'] = $user_doctor; unset($hospital); unset($user_doctor); @@ -569,6 +583,20 @@ class PatientOrderService extends BaseService } $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); + + // 获取医生问诊配置-问诊购药 + $user_doctor['multi_point_enable'] = 0; + + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_type'] = 4; + $params['inquiry_mode'] = 1; + $doctor_inquiry_config = DoctorInquiryConfig::getOne($params); + if (!empty($doctor_inquiry_config)){ + if ($doctor_inquiry_config['is_enable'] == 1){ + $user_doctor['multi_point_enable'] = 1; + } + } } $result = array(); From abb2955f3494e9dfd0e6b81973f278271a8e9df8 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 12 Oct 2023 09:21:15 +0800 Subject: [PATCH 167/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E9=97=AE=E8=AF=8A=E8=B4=AD?= =?UTF-8?q?=E8=8D=AF=E5=BC=80=E5=90=AF=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientOrderService.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index d9a0fbb..bf48948 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1774,6 +1774,20 @@ class PatientOrderService extends BaseService $params['doctor_id'] = $user_doctor['doctor_id']; $user_doctor['follow'] = PatientFollow::getExists($params); + // 获取医生问诊配置-问诊购药 + $user_doctor['multi_point_enable'] = 0; + + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $params['inquiry_type'] = 4; + $params['inquiry_mode'] = 1; + $doctor_inquiry_config = DoctorInquiryConfig::getOne($params); + if (!empty($doctor_inquiry_config)){ + if ($doctor_inquiry_config['is_enable'] == 1){ + $user_doctor['multi_point_enable'] = 1; + } + } + $order_detection['user_doctor'] = $user_doctor; unset($hospital); From a646e5f464dc39b20fae9ebd1f51f1f5f931cc03 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 12 Oct 2023 13:06:45 +0800 Subject: [PATCH 168/176] 1 --- app/Services/PatientDoctorService.php | 139 +++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 5 deletions(-) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 27c85dc..5e741ae 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -21,6 +21,129 @@ use Hyperf\DbConnection\Db; class PatientDoctorService extends BaseService { +// /** +// * 获取问诊医生列表 +// * 专家问诊-公益问诊共用 +// * @return array +// */ +// public function getInquiryDoctorList(): array +// { +// $expertise_id = $this->request->input('expertise_id'); +// $province_id = $this->request->input('province_id'); +// $city_id = $this->request->input('city_id'); +// $sort_order = $this->request->input('sort_order',1); +// $keyword = $this->request->input('keyword',""); +// $is_search_welfare_reception = $this->request->input('is_search_welfare_reception',0); +// $page = $this->request->input('page',1); +// $per_page = $this->request->input('per_page',10); +// +// // 组合条件 +// $hospital_params = array();// 医院搜索 +// $doctor_params = array();// 医生搜索 +// $doctor_expertise_params = array();// 医生专长搜索 +// +// // 省市区 +// if (!empty($province_id)) { +// if (empty($city_id)) { +// // 省份存在时需和城市在一块 +// return fail(HttpEnumCode::CLIENT_HTTP_ERROR); +// } +// $hospital_params[] = ['province_id', '=', $province_id]; +// $hospital_params[] = ['city_id', '=', $city_id]; +// } +// +// // 医生专长 +// if (!empty($expertise_id)) { +// $doctor_expertise_params['expertise_id'] = $expertise_id; +// } +// +// // 固定医生查询条件 +// $doctor_params['status'] = 1; // 状态(0:禁用 1:正常 2:删除) +// +// $doctor_params["iden_auth_status"] = 1;// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) +// $doctor_params["is_bind_bank"] = 1;// 是否已绑定结算银行卡(0:否 1:是) +// +//// if (!empty($is_search_welfare_reception)){ +//// $doctor_params["is_img_welfare_reception"] = $is_search_welfare_reception;// 是否参加公益图文问诊(0:否 1:是) +//// } +// +// $fields = [ +// "doctor_id", +// "user_id", +// "user_name", +// "multi_point_status", +// "is_bind_bank", +// "is_recommend", +// "avatar", +// "doctor_title", +// "department_custom_id", +// "department_custom_name", +// "hospital_id", +// "served_patients_num", +// "praise_rate", +// "avg_response_time", +// "number_of_fans", +// "is_online", +// "be_good_at", +// ]; +// +// $user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params, $sort_order, $fields,$page,$per_page); +// +// if (!empty($user_doctors['data'])) { +// foreach ($user_doctors['data'] as &$user_doctor) { +// $user_doctor['doctor_title_name'] = empty($user_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($user_doctor['doctor_title']); +// +// // 处理医生专长 +// if (!empty($user_doctor['DoctorExpertise'])) { +// foreach ($user_doctor['DoctorExpertise'] as &$data) { +// if (!empty($data['DiseaseClassExpertise'])) { +// $data['expertise_name'] = $data['DiseaseClassExpertise']['expertise_name']; +// } +// unset($data['DiseaseClassExpertise']); +// } +// } +// +// // 处理问诊价格 +// $user_doctor['price'] = 0; +// $user_doctor['free_clinic_price'] = 0; +// if (!empty($user_doctor['DoctorInquiryConfig'])) { +// foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { +// if ($doctor_inquiry_config['inquiry_mode'] == 1) { +// if ($doctor_inquiry_config['inquiry_type'] == 1) { +// // 专家 +// $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; +// } +// if ($doctor_inquiry_config['inquiry_type'] == 3) { +// // 公益 +// $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; +// } +// } +// } +// } +// +// // 好评率-超过5个已结束的订单后展示 +// $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; +// // 响应时间-超过5个已结束的订单后展示 +// $user_doctor['avg_response_time'] = (float)floor($user_doctor['avg_response_time'] * 10) / 10; +// +// // 获取医生订单数 +// $params = array(); +// $params['doctor_id'] = $user_doctor['doctor_id']; +// $params['inquiry_status'] = 6; // 已结束 +// $inquiry_order_count = OrderInquiry::getCount($params); +// if (empty($inquiry_order_count) || $inquiry_order_count == 0) { +// $user_doctor['is_display_score'] = false; +// } else { +// $user_doctor['is_display_score'] = true; +// } +// +// // 头像 +// $user_doctor['avatar'] = addAliyunOssWebsite($user_doctor['avatar']); +// } +// } +// return success($user_doctors); +// } + /** * 获取问诊医生列表 * 专家问诊-公益问诊共用 @@ -33,7 +156,7 @@ class PatientDoctorService extends BaseService $city_id = $this->request->input('city_id'); $sort_order = $this->request->input('sort_order',1); $keyword = $this->request->input('keyword',""); - $is_search_welfare_reception = $this->request->input('is_search_welfare_reception',0); + $is_search_welfare_reception = $this->request->input('is_search_welfare_reception',0); // 是否参加公益图文问诊(0:否 1:是) $page = $this->request->input('page',1); $per_page = $this->request->input('per_page',10); @@ -63,9 +186,9 @@ class PatientDoctorService extends BaseService $doctor_params["iden_auth_status"] = 1;// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) $doctor_params["is_bind_bank"] = 1;// 是否已绑定结算银行卡(0:否 1:是) -// if (!empty($is_search_welfare_reception)){ -// $doctor_params["is_img_welfare_reception"] = $is_search_welfare_reception;// 是否参加公益图文问诊(0:否 1:是) -// } + if (!empty($is_search_welfare_reception)){ + $inquiry_type = 3; + } $fields = [ "doctor_id", @@ -87,7 +210,7 @@ class PatientDoctorService extends BaseService "be_good_at", ]; - $user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params, $sort_order, $fields,$page,$per_page); + $user_doctors = UserDoctor::getInquiryDoctorPage($keyword,$hospital_params, $doctor_params,$doctor_expertise_params,$inquiry_type, $sort_order, $fields,$page,$per_page); if (!empty($user_doctors['data'])) { foreach ($user_doctors['data'] as &$user_doctor) { @@ -227,6 +350,9 @@ class PatientDoctorService extends BaseService $params['doctor_id'] = $doctor_id; $result['follow'] = PatientFollow::getExists($params); + // 获取医生问诊配置-问诊购药 + $user_doctor['multi_point_enable'] = 0; + // 获取问诊价格 // 专家-公益 $params = array(); @@ -270,6 +396,9 @@ class PatientDoctorService extends BaseService $value['times_number'] = $system_inquiry_config['times_number']; $value['duration'] = $system_inquiry_config['duration']; + if ($value['is_enable'] == 1 && $value['inquiry_type'] == 4 && $value['inquiry_mode'] == 1){ + $user_doctor['multi_point_enable'] = 1; + } unset($system_inquiry_config); } $result['doctor_inquiry_config'] = $doctor_inquiry_config; From 0b9005b4c473a776c3c5e7d7d0975c3d165b0d67 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 12 Oct 2023 13:11:02 +0800 Subject: [PATCH 169/176] 1 --- app/Services/PatientDoctorService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 5e741ae..d2430f4 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -186,6 +186,8 @@ class PatientDoctorService extends BaseService $doctor_params["iden_auth_status"] = 1;// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) $doctor_params["is_bind_bank"] = 1;// 是否已绑定结算银行卡(0:否 1:是) + // 问诊类型 + $inquiry_type = 0; if (!empty($is_search_welfare_reception)){ $inquiry_type = 3; } @@ -351,7 +353,7 @@ class PatientDoctorService extends BaseService $result['follow'] = PatientFollow::getExists($params); // 获取医生问诊配置-问诊购药 - $user_doctor['multi_point_enable'] = 0; + $result['multi_point_enable'] = 0; // 获取问诊价格 // 专家-公益 @@ -397,7 +399,7 @@ class PatientDoctorService extends BaseService $value['duration'] = $system_inquiry_config['duration']; if ($value['is_enable'] == 1 && $value['inquiry_type'] == 4 && $value['inquiry_mode'] == 1){ - $user_doctor['multi_point_enable'] = 1; + $result['multi_point_enable'] = 1; } unset($system_inquiry_config); } From 7dd3c5cac0b44e403c19cc016c75f7b07d8edf0a Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 12 Oct 2023 13:18:51 +0800 Subject: [PATCH 170/176] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/UserDoctor.php | 112 ++++++++++++++++++++++++-- app/Services/PatientDoctorService.php | 4 +- 2 files changed, 109 insertions(+), 7 deletions(-) diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index 1b798ca..bf65542 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -202,6 +202,108 @@ class UserDoctor extends Model return $datas; } +// /** +// * 获取问诊医生列表 +// * 专家问诊-公益问诊共用 +// * @param string $keyword +// * @param array $hospital_params 医院搜索条件 +// * @param array $doctor_params 医生搜索条件 +// * @param array $doctor_expertise_params +// * @param string|int $sort_order +// * @param array $fields +// * @param int|null $page +// * @param int|null $per_page +// * @return array +// */ +// public static function getInquiryDoctorPage(string $keyword = "", array $hospital_params = [], array $doctor_params = [], array $doctor_expertise_params = [], string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array +// { +// $query = self::with([ +// "Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id", +// "DoctorExpertise", +// "DoctorInquiryConfig" => function ($query) use ($sort_order) { +// $query->whereIn('inquiry_type', [1, 3]) +// ->where('inquiry_mode', 1); +// }, +// ]) +// ->where($doctor_params) +// ->when($keyword, function ($query, $keyword) { +// $query->where(function ($query) use ($keyword) { +// $query->orwhere("user_name", 'like', '%' . $keyword . '%'); +// $query->orwhere("department_custom_name", 'like', '%' . $keyword . '%'); +// $query->orWhereHas('Hospital', function ($query) use ($keyword) { +// $query->where('hospital_name', 'like', '%' . $keyword . '%'); +// }); +// }); +// }) +// ->whereHas('Hospital', function ($query) use ($hospital_params) { +// $query->where($hospital_params); +// }) +// ->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) { +// $query->where($doctor_expertise_params); +// }) +// ->whereHas('DoctorInquiryConfig', function ($query) { +// $params = array(); +// $params['inquiry_mode'] = 1;// 接诊方式:图文 +// $query->where($params)->whereIn('inquiry_type', [1, 3]); +// }); +// +// if (!empty($sort_order)){ +// if (in_array($sort_order,[1,3,4])){ +// $query = $query->join('doctor_inquiry_config', function ($query) { +// $query->on('user_doctor.doctor_id', '=', 'doctor_inquiry_config.doctor_id') +// ->whereIn('inquiry_type', [1, 3]) +// ->where('inquiry_mode', 1) +// ->orderBy('inquiry_price', 'desc') +// ->take(1); +// }) +// ->select("user_doctor.*") +// ->groupBy("user_doctor.doctor_id"); +// } +// +// if ($sort_order == 1) { +// // 综合-价格从低到高 +// $query->orderBy('is_recommend', 'desc');// 是否首页推荐(0:否 1:是) +// $query->orderByRaw('avg_response_time = 0 ASC'); +// $query->orderBy('avg_response_time'); +// $query->orderBy('served_patients_num', 'desc');// 服务数从多到少 +// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 +// $query->orderBy('doctor_inquiry_config.inquiry_price', 'asc'); +// } elseif ($sort_order == 2) { +// // 响应时间快 +// $query->orderByRaw('avg_response_time = 0 ASC'); +// $query->orderBy('avg_response_time'); +// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 +// } elseif ($sort_order == 3) { +// // 价格从低到高 +// $query->orderBy('doctor_inquiry_config.inquiry_price', 'asc'); +// $query->orderByRaw('avg_response_time = 0 ASC'); +// $query->orderBy('avg_response_time'); +// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 +// } elseif ($sort_order == 4) { +// // 价格从高到低 +// $query->orderBy('doctor_inquiry_config.inquiry_price', 'desc'); +// $query->orderByRaw('avg_response_time = 0 ASC'); +// $query->orderBy('avg_response_time'); +// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 +// } elseif ($sort_order == 5) { +// // 服务数从多到少 +// $query->orderBy('served_patients_num', 'desc'); +// $query->orderBy(Db::raw("convert(substr(user_name,1,1) using `GBK`)"), 'asc');// 名称排名 +// } +// } +// +// $result = $query->paginate($per_page, $fields, "page", $page); +// +// $data = array(); +// $data['current_page'] = $result->currentPage();// 当前页码 +// $data['total'] = $result->total();//数据总数 +// $data['data'] = $result->items();//数据 +// $data['per_page'] = $result->perPage();//每页个数 +// $data['last_page'] = $result->lastPage();//最后一页 +// +// return $data; +// } + /** * 获取问诊医生列表 * 专家问诊-公益问诊共用 @@ -215,13 +317,13 @@ class UserDoctor extends Model * @param int|null $per_page * @return array */ - public static function getInquiryDoctorPage(string $keyword = "", array $hospital_params = [], array $doctor_params = [], array $doctor_expertise_params = [], string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array + public static function getInquiryDoctorPage(string $keyword = "", array $hospital_params = [], array $doctor_params = [], array $doctor_expertise_params = [],array $inquiry_type = [1,3], string|int $sort_order = 1, array $fields = ["*"], int $page = null, ?int $per_page = 10): array { $query = self::with([ "Hospital:hospital_id,hospital_name,hospital_status,hospital_level_name,province_id,city_id", "DoctorExpertise", - "DoctorInquiryConfig" => function ($query) use ($sort_order) { - $query->whereIn('inquiry_type', [1, 3]) + "DoctorInquiryConfig" => function ($query) use ($inquiry_type) { + $query->whereIn('inquiry_type', $inquiry_type) ->where('inquiry_mode', 1); }, ]) @@ -241,10 +343,10 @@ class UserDoctor extends Model ->whereHas('DoctorExpertise', function ($query) use ($doctor_expertise_params) { $query->where($doctor_expertise_params); }) - ->whereHas('DoctorInquiryConfig', function ($query) { + ->whereHas('DoctorInquiryConfig', function ($query) use ($inquiry_type) { $params = array(); $params['inquiry_mode'] = 1;// 接诊方式:图文 - $query->where($params)->whereIn('inquiry_type', [1, 3]); + $query->where($params)->whereIn('inquiry_type', $inquiry_type); }); if (!empty($sort_order)){ diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index d2430f4..f563490 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -187,9 +187,9 @@ class PatientDoctorService extends BaseService $doctor_params["is_bind_bank"] = 1;// 是否已绑定结算银行卡(0:否 1:是) // 问诊类型 - $inquiry_type = 0; + $inquiry_type = [1,3]; if (!empty($is_search_welfare_reception)){ - $inquiry_type = 3; + $inquiry_type = [3]; } $fields = [ From 95e6247e2832470542aea621b228e3e081810d80 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 12 Oct 2023 13:20:58 +0800 Subject: [PATCH 171/176] 1 --- app/Model/UserDoctor.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index bf65542..b905ea3 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -311,6 +311,7 @@ class UserDoctor extends Model * @param array $hospital_params 医院搜索条件 * @param array $doctor_params 医生搜索条件 * @param array $doctor_expertise_params + * @param array $inquiry_type * @param string|int $sort_order * @param array $fields * @param int|null $page From 6afdad5c64bc47efc4895974741b86c06d9ff444 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 12 Oct 2023 13:46:29 +0800 Subject: [PATCH 172/176] 1 --- app/Model/UserDoctor.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index b905ea3..ff6b0c7 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -183,12 +183,12 @@ class UserDoctor extends Model // 是否在线(0:不在线 1:在线) $params["is_online"] = 1; - // 是否参加专家图文接诊(0:否 1:是) - $params["is_img_expert_reception"] = 1; +// // 是否参加专家图文接诊(0:否 1:是) +// $params["is_img_expert_reception"] = 1; $datas = self::with([ 'Hospital:hospital_id,hospital_name,hospital_level_name', - 'DoctorInquiryConfig', + "DoctorInquiryConfig", ]) ->where($params) ->orderBy("is_recommend", "desc") From a6583fcbd42a5ce718b0fb85307a85edaa1e74fd Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 12 Oct 2023 13:48:35 +0800 Subject: [PATCH 173/176] 1 --- app/Services/PatientDoctorService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index f563490..a101078 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -360,7 +360,7 @@ class PatientDoctorService extends BaseService $params = array(); $params[] = ['doctor_id', '=', $doctor_id]; $params[] = ['inquiry_mode', '=', 1];// 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) - $doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*']); + $doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigListByInquiryType($params,['*'],[1,3,4]); if (!empty($doctor_inquiry_config)) { foreach ($doctor_inquiry_config as &$value) { // 获取医生当日的全部订单 From f901abf53c2e687bc4bbe462797a194cd7fa7cb6 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 16 Oct 2023 13:30:57 +0800 Subject: [PATCH 174/176] 1 --- app/Services/PatientDoctorService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index a101078..0a6cc24 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -187,9 +187,9 @@ class PatientDoctorService extends BaseService $doctor_params["is_bind_bank"] = 1;// 是否已绑定结算银行卡(0:否 1:是) // 问诊类型 - $inquiry_type = [1,3]; + $inquiry_type = [1,3,4]; if (!empty($is_search_welfare_reception)){ - $inquiry_type = [3]; + $inquiry_type = [3,4]; } $fields = [ From c37ace2399fcb31569fc8ad25989e38ab09e7f13 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 16 Oct 2023 13:36:26 +0800 Subject: [PATCH 175/176] 1 --- app/Services/PatientDoctorService.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 0a6cc24..ec2d6f4 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -231,17 +231,22 @@ class PatientDoctorService extends BaseService // 处理问诊价格 $user_doctor['price'] = 0; $user_doctor['free_clinic_price'] = 0; + $user_doctor['multi_point_enable'] = 0; if (!empty($user_doctor['DoctorInquiryConfig'])) { foreach ($user_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { if ($doctor_inquiry_config['inquiry_mode'] == 1) { - if ($doctor_inquiry_config['inquiry_type'] == 1) { + if ($doctor_inquiry_config['inquiry_type'] == 1 && $doctor_inquiry_config['is_enable'] == 1) { // 专家 $user_doctor['price'] = $doctor_inquiry_config['inquiry_price'] ?? 0; } - if ($doctor_inquiry_config['inquiry_type'] == 3) { + if ($doctor_inquiry_config['inquiry_type'] == 3 && $doctor_inquiry_config['is_enable'] == 1) { // 公益 $user_doctor['free_clinic_price'] = $doctor_inquiry_config['inquiry_price']; } + if ($doctor_inquiry_config['inquiry_type'] == 4 && $doctor_inquiry_config['is_enable'] == 1) { + // 问诊购药 + $user_doctor['multi_point_enable'] = 1; + } } } } From 3a48b23dde98031c50fbcad753fd896503bba28b Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 16 Oct 2023 13:42:47 +0800 Subject: [PATCH 176/176] 1 --- app/Services/UserDoctorService.php | 41 ------------------------------ 1 file changed, 41 deletions(-) diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 9bf7a59..0ad7623 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1894,47 +1894,6 @@ class UserDoctorService extends BaseService return true; } - /** - * 检测是否存在对应问诊的在线医生 - * @param int|string $inquiry_type 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) - * @return bool - */ - public function checkDoctorOnline(int|string $inquiry_type): bool - { - $params = array(); - $params['status'] = 1; // 状态 - $params['idcard_status'] = 1; // 实名认证状态 - $params['iden_auth_status'] = 1;// 身份认证状态 - - if ($inquiry_type == 4) { - // 问诊购药 - $params['multi_point_status'] = 1;// 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) - } - - $params['is_online'] = 1;// 是否在线(0:不在线 1:在线) - - switch ($inquiry_type) { - case 1: - // 专家 - $params['is_img_expert_reception'] = 1;// 是否参加专家图文接诊(0:否 1:是) - break; - case 2: - // 快速 - $params['is_img_quick_reception'] = 1;// 是否参加快速图文接诊(0:否 1:是) - break; - case 3: - // 公益 - $params['is_img_welfare_reception'] = 1;// 是否参加公益图文问诊(0:否 1:是) - break; - - default: - throw new BusinessException(); - break; - } - - return UserDoctor::getExists($params); - } - /** * 获取当前时间N分钟前接诊中的医生 * @param string|int $minute 分钟