修改我的医生

This commit is contained in:
wucongxing 2023-04-13 14:39:36 +08:00
parent a5fb1d46e7
commit 81a47d72e0
10 changed files with 291 additions and 121 deletions

View File

@ -873,10 +873,79 @@ class CallBackController extends AbstractController
{
$request_params = $this->request->all();
try {
Log::getInstance()->info("处方平台物流回调数据:" . json_encode($request_params, JSON_UNESCAPED_UNICODE));
dump($request_params);
Log::getInstance()->info("快递100订阅回调数据" . json_encode($request_params, JSON_UNESCAPED_UNICODE));
// 检测回调数据
if (!isset($request_params['sign']) || !isset($request_params['param'])) {
return $this->LogisticsFailReturn("缺少推送参数:sign/param");
}
// 检测签名
$sign = strtoupper(md5( $request_params['param'] . config('kuaidi100.salt') ));
if ($sign != $request_params['sign']){
return $this->LogisticsFailReturn("签名验证错误");
}
// 转换编码
$data = json_decode($request_params['param'],true);
if (empty($data)){
return $this->LogisticsFailReturn("转换json失败");
}
// 检测消息体
if (!isset($request_params['param']['lastResult'])){
return $this->LogisticsFailReturn("缺少推送参数:lastResult");
}
// 检测订单号
if (!isset($request_params['param']['lastResult']['nu'])){
return $this->LogisticsFailReturn("缺少推送参数:nu");
}
// 检测快递公司编码
if (!isset($request_params['param']['lastResult']['com'])){
return $this->LogisticsFailReturn("缺少推送参数:com");
}
// 检测内容
if (!isset($request_params['param']['lastResult']['data'])){
return $this->LogisticsFailReturn("缺少推送参数:data");
}
// 运单签收状态(0在途 1揽收 2疑难 3签收 4退签 5派件 8清关 14拒签)
$logistics_status = [0,1,2,3,4,5,8,14];
// if ()
} catch (\Exception $e) {
}
}
/**
* 快递100订阅回调失败
* @param string $message
* @return ResponseInterface
*/
protected function LogisticsFailReturn(string $message): ResponseInterface
{
return $this->response
->withStatus(200)
->withBody(
new SwooleStream(
strval(
json_encode([
'result' => false,
'returnCode' => "500",
'message' => $message,
], JSON_UNESCAPED_UNICODE)
)
)
);
}
}

View File

@ -31,6 +31,7 @@ use App\Services\UserDoctorService;
use App\Utils\Log;
use Extend\Alibaba\Oss;
use Extend\Ca\Ca;
use Extend\Kuaidi100\Kuaidi;
use Extend\Prescription\Prescription;
use Extend\RegulatoryPlatform\regulatoryPlatform;
use Extend\TencentIm\RecentContact;
@ -59,7 +60,8 @@ class TestController extends AbstractController
// $this->test_1();
// $this->test_11();
// $this->test_12();
$this->test_13();
// $this->test_13();
$this->test_14();
}
// 获取云证书-首次
@ -770,4 +772,15 @@ class TestController extends AbstractController
return success();
}
// 快递订阅
public function test_14(){
// $Kuaidi = new Kuaidi();
// $result = $Kuaidi->subscribe("78674717911499","zhongtong","15201255314");
// dump($result);
$a = '{"status":"polling","message":"","lastResult":{"message":"ok","nu":"YT6074326614455","ischeck":"0","com":"yuantong","status":"200","state":"1","data":[{"time":"2023-02-02 09:57:03","context":"【长沙市】 【长沙东站】07**-55**234 的 长沙东站司法分部135****1234 已接单","ftime":"2023-02-02 09:57:03","areaCode":"CN430100000000","areaName":"湖南,长沙市","status":"揽收","location":null,"areaCenter":null,"areaPinYin":null,"statusCode":null}],"loop":false}}';
$b = strtoupper(md5( $a . config('kuaidi100.salt') ));
dump($b);
}
}

View File

@ -30,6 +30,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
* @property string $logistics_fee 运费金额
* @property string $logistics_no 物流编号
* @property string $logistics_company_code 快递公司编码
* @property int $sub_logistics_status 快递推送订阅状态0:未订阅/无需订阅 1:已订阅 2:订阅失败)
* @property string $delivery_time 发货时间
* @property string $pay_time 支付时间
* @property string $remarks 订单备注
@ -70,7 +71,7 @@ class OrderProduct extends Model
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['order_product_id', 'order_inquiry_id', 'order_prescription_id', 'doctor_id', 'patient_id', 'family_id', 'order_product_no', 'escrow_trade_no', 'order_product_status', 'pay_channel', 'pay_status', 'is_delete', 'cancel_reason', 'amount_total', 'payment_amount_total', 'logistics_fee', 'logistics_no', 'logistics_company_code', 'delivery_time', 'pay_time', 'remarks', 'refund_status', 'cancel_time', 'cancel_remarks', 'report_pre_status', 'report_pre_time', 'report_pre_fail_reason', 'province_id', 'province', 'city_id', 'city', 'county_id', 'county', 'address', 'address_mask', 'consignee_name', 'consignee_name_mask', 'consignee_tel', 'consignee_tel_mask', 'created_at', 'updated_at'];
protected array $fillable = ['order_product_id', 'order_inquiry_id', 'order_prescription_id', 'doctor_id', 'patient_id', 'family_id', 'order_product_no', 'escrow_trade_no', 'order_product_status', 'pay_channel', 'pay_status', 'is_delete', 'cancel_reason', 'amount_total', 'payment_amount_total', 'logistics_fee', 'logistics_no', 'logistics_company_code', 'sub_logistics_status', 'delivery_time', 'pay_time', 'remarks', 'refund_status', 'cancel_time', 'cancel_remarks', 'report_pre_status', 'report_pre_time', 'report_pre_fail_reason', 'province_id', 'province', 'city_id', 'city', 'county_id', 'county', 'address', 'address_mask', 'consignee_name', 'consignee_name_mask', 'consignee_tel', 'consignee_tel_mask', 'created_at', 'updated_at'];
protected string $primaryKey = "order_product_id";

View File

@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $logistics_id 主键id
* @property int $order_product_id 药品订单id
* @property int $logistics_status 运单签收状态(0在途 1揽收 2疑难 3签收 4退签 5派件 8清关 14拒签)
* @property string $logistics_no 物流编号
* @property string $company_name 快递公司名称
* @property string $company_code 快递公司编码
* @property string $logistics_content 内容
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class OrderProductLogistic extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'order_product_logistics';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['logistics_id', 'order_product_id', 'logistics_status', 'logistics_no', 'company_name', 'company_code', 'logistics_content', 'created_at', 'updated_at'];
protected string $primaryKey = "logistics_id";
/**
* 获取信息-单条
* @param array $params
* @param array $fields
* @return object|null
*/
public static function getOne(array $params, array $fields = ['*']): object|null
{
return self::where($params)->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();
}
}

View File

@ -531,7 +531,7 @@ class PatientDoctorService extends BaseService
// 职称
$data['user_doctor']['doctor_title_name'] = empty($data['user_doctor']['doctor_title']) ? "" : DoctorTitleCode::getMessage($data['user_doctor']['doctor_title']);
$result['data'] = $data;
$result['data'][] = $data;
}
}

View File

@ -31,7 +31,8 @@ class Auth
"/callback/platform/logistics" => "post", // 处方平台物流回调
"/callback/logistics" => "post", // 快递100订阅回调
"/test/test_13" => "get", // 测试
"/test/test_13" => "get", // 测试退款
"/test" => "get", // 测试
];
}

View File

@ -99,5 +99,6 @@ return [
"key" => env('LOGISTICS_KEY', 'Mpjjgebe8764'),
"customer" => env('LOGISTICS_CUSTOMER', 'EA3A55C09C524BDB72AE31231721B20F'),
"api_url" => env('LOGISTICS_APP_URL', 'https://poll.kuaidi100.com/poll/query.do'),
"salt" => env('LOGISTICS_SALT', 'gdxz2023.d'),
],
];

View File

@ -600,8 +600,11 @@ Router::get('/case', [InquiryController::class, 'getPatientInquiryCase']);
// 测试使用
Router::addGroup('/test', function () {
Router::get('', [TestController::class, 'test_14']);
// 模拟退款
Router::get('/test_13', [TestController::class, 'test_13']);
});
// 地址管理

View File

@ -44,7 +44,16 @@ class Kuaidi
}
public function subscribe(string $logistics_no,string $logistics_company_code,string $phone){
/**
* 订阅快递推送
* @param string $logistics_no
* @param string $logistics_company_code
* @param string $order_product_id
* @param string $phone
* @return mixed
* @throws GuzzleException
*/
public function subscribe(string $logistics_no,string $logistics_company_code,string $phone = ""){
$param = [
'company' => $logistics_company_code, // 快递公司编码
'number' => $logistics_no, // 快递单号
@ -52,12 +61,13 @@ class Kuaidi
'parameters' => array (
'callbackurl' => 'http://dev.hospital.applets.igandanyiyuan.com/callback/logistics', // 回调地址
'resultv2' => '1', // 行政区域解析
'phone' => $phone // 手机号
'phone' => $phone, // 手机号
'salt' => config('kuaidi100.salt'), // 签名用字符串
)
];
$option = [
"json" => [
"form_params" => [
"schema" => "json",
"param" => json_encode($param, JSON_UNESCAPED_UNICODE),
],
@ -73,21 +83,22 @@ class Kuaidi
throw new BusinessException($response->getBody()->getContents());
}
$body = json_decode($response->getBody(), true);
dump($body);
if (empty($body)) {
// 返回值为空
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
}
if ($body['result_code'] != 0) {
if ($body['returnCode'] != 200) {
// 请求失败
if (!empty($body['result_msg'])) {
throw new BusinessException($body['result_msg']);
if (!empty($body['message'])) {
throw new BusinessException($body['message']);
}
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
}
return $body['body'];
return $body;
}
}

View File

@ -73,6 +73,7 @@ REG_PLAT_APP_URL=https://202.61.88.184:19200/
LOGISTICS_KEY=Mpjjgebe8764
LOGISTICS_CUSTOMER=EA3A55C09C524BDB72AE31231721B20F
LOGISTICS_APP_URL=https://poll.kuaidi100.com/poll/query.do
LOGISTICS_SALT=gdxz2023.d
">.env
#nginx_upstrame="/Users/wucongxing/Desktop/test/hospital-upstream.conf"