去除基廷成员验证
This commit is contained in:
parent
426e95a0fa
commit
cf12f1f0ab
129
app/Controller/TestController.php
Normal file
129
app/Controller/TestController.php
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Constants\HttpEnumCode;
|
||||||
|
use App\Model\DoctorPharmacistCert;
|
||||||
|
use Extend\Alibaba\Oss;
|
||||||
|
use Extend\Ca\Ca;
|
||||||
|
|
||||||
|
class TestController extends AbstractController
|
||||||
|
{
|
||||||
|
public function test(){
|
||||||
|
$this->test_4();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取云证书-首次
|
||||||
|
public function test_1(){
|
||||||
|
$ca = new Ca();
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['user_id'] = "491925054435950592";
|
||||||
|
$data['card_num'] = "410323199603261241";
|
||||||
|
$result = $ca->getCloudCert($data);
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['user_id'] = "491925054435950592";
|
||||||
|
$data['cert_base64'] = $result['certBase64'];
|
||||||
|
$data['cert_chain_p7'] = $result['certP7'];
|
||||||
|
$data['cert_serial_number'] = $result['certSerialnumber'];
|
||||||
|
$data['ca_pin'] = "491925054435950592";
|
||||||
|
$doctor_pharmacist_cert = DoctorPharmacistCert::addDoctorPharmacistCert($data);
|
||||||
|
if (empty($doctor_pharmacist_cert)){
|
||||||
|
return fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取用户云证书数据-验证PKCS7签名
|
||||||
|
public function test_2(){
|
||||||
|
$ca = new Ca();
|
||||||
|
|
||||||
|
$params = array();
|
||||||
|
$params['user_id'] = "491925054435950592";
|
||||||
|
$doctor_pharmacist_cert = DoctorPharmacistCert::getOne($params);
|
||||||
|
if (empty($doctor_pharmacist_cert)){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR,"用户数据错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取云证书签名
|
||||||
|
$data = array();
|
||||||
|
$data['created_at'] = date('Y-m-d H:i:s',time());
|
||||||
|
$data['department_custom_name'] = "外科";
|
||||||
|
$data['user_name'] = "测试用户1";
|
||||||
|
$data['sex'] = "男";
|
||||||
|
$data['age'] = 19;
|
||||||
|
$data['allergy_history'] = "无";
|
||||||
|
$data['icd_name'] = "感冒";
|
||||||
|
$data['doctor_advice'] = "多吃药";
|
||||||
|
$data['product'] = [
|
||||||
|
[
|
||||||
|
"product_name" => "感冒药1",
|
||||||
|
"single_unit" => "一次一包",
|
||||||
|
"frequency_use" => "1天3次",
|
||||||
|
"single_use" => "口服",
|
||||||
|
"prescription_product_num" => "X1盒",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"product_name" => "感冒药2",
|
||||||
|
"single_unit" => "一次一包",
|
||||||
|
"frequency_use" => "1天3次",
|
||||||
|
"single_use" => "口服",
|
||||||
|
"prescription_product_num" => "X1盒",
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$result = $ca->getCertSign("491925054435950592","491925054435950592",$data);
|
||||||
|
|
||||||
|
// 验证PKCS7签名-验证无需处理,只要不返回错误即可
|
||||||
|
$ca->verifyPkcs7($result['signP7'],$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加签章配置(首次)
|
||||||
|
public function test_3(){
|
||||||
|
$ca = new Ca();
|
||||||
|
|
||||||
|
// 下载阿里云图片
|
||||||
|
$oss = new Oss();
|
||||||
|
|
||||||
|
$filename = "applet/doctor/cert/67d7396d-0fc3-464d-9582-3501229ed188.png";
|
||||||
|
|
||||||
|
$style = "image/resize,m_lfit,w_100,h_350/rotate,270";
|
||||||
|
|
||||||
|
$sign_image = $oss->getCusTomObjectToRAM($filename,$style);
|
||||||
|
$sign_image = base64_encode($sign_image);
|
||||||
|
if (!$sign_image){
|
||||||
|
return fail(HttpEnumCode::SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sign_image = urlencode($sign_image);
|
||||||
|
|
||||||
|
$sign_param = [
|
||||||
|
[
|
||||||
|
"llx"=> 700, // 左边底部X坐标
|
||||||
|
"lly"=>2985, // 左边底部Y坐标
|
||||||
|
"urx"=>1101, // 右边上部x坐标
|
||||||
|
"ury"=>2896, // 右边上部y坐标
|
||||||
|
"pageList"=>[1],
|
||||||
|
"sealImg"=>$sign_image
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$data = array();
|
||||||
|
$data['sign_param'] = json_encode($sign_param,JSON_UNESCAPED_UNICODE);
|
||||||
|
$data['seal_img'] = $sign_image;
|
||||||
|
|
||||||
|
$result = $ca->addUserSignConfig("491925054435950592","410323199603261241",$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取用户签章图片
|
||||||
|
public function test_4(){
|
||||||
|
$ca = new Ca();
|
||||||
|
$result = $ca->getFetchUserSeal("491925054435950592");
|
||||||
|
$data = urldecode($result[0]['sealImg']);
|
||||||
|
dump($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理处方pdf图片
|
||||||
|
public function test_5(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -15,6 +15,7 @@ use App\Services\UserDoctorService;
|
|||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use App\Utils\Http;
|
use App\Utils\Http;
|
||||||
use App\Utils\Log;
|
use App\Utils\Log;
|
||||||
|
use Extend\Alibaba\Oss;
|
||||||
use Extend\Ca\Ca;
|
use Extend\Ca\Ca;
|
||||||
use Extend\Prescription\Prescription;
|
use Extend\Prescription\Prescription;
|
||||||
use Extend\TencentIm\Account;
|
use Extend\TencentIm\Account;
|
||||||
@ -359,64 +360,13 @@ class UserController extends AbstractController
|
|||||||
|
|
||||||
$ca = new Ca();
|
$ca = new Ca();
|
||||||
|
|
||||||
// 获取云证书-首次
|
|
||||||
// $data = array();
|
|
||||||
// $data['user_id'] = "491925054435950592";
|
|
||||||
// $data['card_num'] = "410323199603261241";
|
|
||||||
// $result = $ca->getCloudCert($data);
|
|
||||||
//
|
|
||||||
// $data = array();
|
|
||||||
// $data['user_id'] = "491925054435950592";
|
|
||||||
// $data['cert_base64'] = $result['certBase64'];
|
|
||||||
// $data['cert_chain_p7'] = $result['certP7'];
|
|
||||||
// $data['cert_serial_number'] = $result['certSerialnumber'];
|
|
||||||
// $data['ca_pin'] = "491925054435950592";
|
|
||||||
// $doctor_pharmacist_cert = DoctorPharmacistCert::addDoctorPharmacistCert($data);
|
|
||||||
// if (empty($doctor_pharmacist_cert)){
|
|
||||||
// return fail();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 获取用户云证书数据
|
|
||||||
$params = array();
|
|
||||||
$params['user_id'] = "491925054435950592";
|
|
||||||
$doctor_pharmacist_cert = DoctorPharmacistCert::getOne($params);
|
|
||||||
if (empty($doctor_pharmacist_cert)){
|
|
||||||
return fail(HttpEnumCode::HTTP_ERROR,"用户数据错误");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取云证书签名
|
|
||||||
$data = array();
|
|
||||||
$data['created_at'] = date('Y-m-d H:i:s',time());
|
|
||||||
$data['department_custom_name'] = "外科";
|
|
||||||
$data['user_name'] = "测试用户1";
|
|
||||||
$data['sex'] = "男";
|
|
||||||
$data['age'] = 19;
|
|
||||||
$data['allergy_history'] = "无";
|
|
||||||
$data['icd_name'] = "感冒";
|
|
||||||
$data['doctor_advice'] = "多吃药";
|
|
||||||
$data['product'] = [
|
|
||||||
[
|
|
||||||
"product_name" => "感冒药1",
|
|
||||||
"single_unit" => "一次一包",
|
|
||||||
"frequency_use" => "1天3次",
|
|
||||||
"single_use" => "口服",
|
|
||||||
"prescription_product_num" => "X1盒",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"product_name" => "感冒药2",
|
|
||||||
"single_unit" => "一次一包",
|
|
||||||
"frequency_use" => "1天3次",
|
|
||||||
"single_use" => "口服",
|
|
||||||
"prescription_product_num" => "X1盒",
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$result = $ca->getCertSign("491925054435950592","491925054435950592",$data);
|
|
||||||
|
|
||||||
// 验证PKCS7签名-验证无需处理,只要不返回错误即可
|
|
||||||
$ca->verifyPkcs7($result['signP7'],$data);
|
|
||||||
|
|
||||||
// 添加签章配置(首次)
|
// 添加签章配置(首次)
|
||||||
|
|
||||||
|
dump($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,9 +107,9 @@ class PatientFamilyRequest extends FormRequest
|
|||||||
'type' => ['required',Rule::in(['1', '2', '3', '4'])],
|
'type' => ['required',Rule::in(['1', '2', '3', '4'])],
|
||||||
'id_number' => "required",
|
'id_number' => "required",
|
||||||
'mobile' => ['sometimes','regex:/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/'],
|
'mobile' => ['sometimes','regex:/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/'],
|
||||||
'relation' => ['required',Rule::in(['1', '2', '3', '4', '5', '6'])],
|
'relation' => ['sometimes',Rule::in(['1', '2', '3', '4', '5', '6'])],
|
||||||
'city_id' => 'required_with:province_id',
|
'city_id' => 'required_with:province_id',
|
||||||
'province_id' => 'required_with:city_id,county_id',
|
'province_id' => 'required_with:city_id',
|
||||||
'is_default' => ['sometimes',Rule::in(['0', '1'])],
|
'is_default' => ['sometimes',Rule::in(['0', '1'])],
|
||||||
'height' => ['sometimes','numeric'], // 身高
|
'height' => ['sometimes','numeric'], // 身高
|
||||||
'weight' => ['sometimes','numeric'], // 体重
|
'weight' => ['sometimes','numeric'], // 体重
|
||||||
@ -139,7 +139,6 @@ class PatientFamilyRequest extends FormRequest
|
|||||||
'id_number.required' => "请选择证件号",
|
'id_number.required' => "请选择证件号",
|
||||||
// 'mobile.required' => "手机号不能为空",
|
// 'mobile.required' => "手机号不能为空",
|
||||||
'mobile.regex' => "手机号格式错误",
|
'mobile.regex' => "手机号格式错误",
|
||||||
'relation.required' => "请选择患者关系",
|
|
||||||
'relation.in' => "患者关系错误",
|
'relation.in' => "患者关系错误",
|
||||||
'city_id.required_with' => "请选择城市",
|
'city_id.required_with' => "请选择城市",
|
||||||
'province_id.required_with' => "请选择省份",
|
'province_id.required_with' => "请选择省份",
|
||||||
|
|||||||
@ -28,7 +28,7 @@ class Auth
|
|||||||
"/callback/wxpay/product/success" => "post", // 微信药品支付回调
|
"/callback/wxpay/product/success" => "post", // 微信药品支付回调
|
||||||
"/callback/wxpay/product/refund" => "post", // 微信药品退款回调
|
"/callback/wxpay/product/refund" => "post", // 微信药品退款回调
|
||||||
"/callback/im" => "post", // im回调
|
"/callback/im" => "post", // im回调
|
||||||
"/testpay" => "get", // 测试
|
"/test" => "get", // 测试
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ use App\Controller\PatientFamilyController;
|
|||||||
use App\Controller\PatientOrderController;
|
use App\Controller\PatientOrderController;
|
||||||
use App\Controller\SafeController;
|
use App\Controller\SafeController;
|
||||||
use App\Controller\SystemController;
|
use App\Controller\SystemController;
|
||||||
|
use App\Controller\TestController;
|
||||||
use App\Controller\UserController;
|
use App\Controller\UserController;
|
||||||
use App\Controller\UserDoctorController;
|
use App\Controller\UserDoctorController;
|
||||||
use App\Controller\UserPatientController;
|
use App\Controller\UserPatientController;
|
||||||
@ -520,7 +521,7 @@ Router::addGroup('/user', function () {
|
|||||||
Router::get('/case', [InquiryController::class, 'getPatientInquiryCase']);
|
Router::get('/case', [InquiryController::class, 'getPatientInquiryCase']);
|
||||||
|
|
||||||
|
|
||||||
Router::get('/testpay', [UserController::class, 'testpay']);
|
Router::get('/test', [TestController::class, 'test']);
|
||||||
|
|
||||||
// 地址管理
|
// 地址管理
|
||||||
Router::addGroup('/address', function () {
|
Router::addGroup('/address', function () {
|
||||||
|
|||||||
@ -100,4 +100,30 @@ class Oss
|
|||||||
throw new BusinessException($e->getMessage());
|
throw new BusinessException($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载自定义风格文件到内存
|
||||||
|
* @param string $filename
|
||||||
|
* @param string $style
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCusTomObjectToRAM(string $filename,string $style = "image/resize"): string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$ossClient = $this->createClient();
|
||||||
|
|
||||||
|
// 将图片缩放为固定宽高100 px后,再旋转90°。
|
||||||
|
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_PROCESS => $style);
|
||||||
|
|
||||||
|
$object = $filename;
|
||||||
|
return $ossClient->getObject($this->config['bucket'], $object,$options);
|
||||||
|
}catch(\Exception $e) {
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -115,6 +115,73 @@ class Ca
|
|||||||
throw new BusinessException($e->getMessage());
|
throw new BusinessException($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加签章配置
|
||||||
|
* @param string $user_id 用户id
|
||||||
|
* @param string $card_num 身份证号
|
||||||
|
* @param array $data
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function addUserSignConfig(string $user_id,string $card_num,array $data): mixed
|
||||||
|
{
|
||||||
|
$option = [
|
||||||
|
'form_params' => [
|
||||||
|
'userId' => $user_id,//用户标识信息(为云证书entityId)
|
||||||
|
'configKey' => $user_id, // 签章配置唯一标识,一张云证书配置一个
|
||||||
|
'keypairType' => "3", // 秘钥类型(3云证书)
|
||||||
|
'certSn' => $card_num, // 证书序列号,使用医生身份证号即可
|
||||||
|
'signType' => "4", // 签章方式(签章类型; 4客户端坐标签章;5客户端关键字签章;)
|
||||||
|
'signParam' => $data['sign_param'], // 签章配置,JSON
|
||||||
|
'sealImg' => $data['seal_img'], // 签章图片,base64格式
|
||||||
|
'sealType' => "4",
|
||||||
|
'signTemplate' => "1",
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->httpRequest(
|
||||||
|
config("ca.api_url") . '/signature-server/api/open/signature/userSignConfig',
|
||||||
|
$option
|
||||||
|
);
|
||||||
|
if (empty($response)){
|
||||||
|
// 返回值为空
|
||||||
|
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||||
|
}
|
||||||
|
return $response;
|
||||||
|
} catch (GuzzleException $e) {
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户签章图片
|
||||||
|
* @param string $user_id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getFetchUserSeal(string $user_id): mixed
|
||||||
|
{
|
||||||
|
$option = [
|
||||||
|
'form_params' => [
|
||||||
|
'userId' => $user_id,//用户标识信息(为云证书entityId)
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->httpRequest(
|
||||||
|
config("ca.api_url") . '/signature-server/api/open/signature/fetchUserSeal',
|
||||||
|
$option
|
||||||
|
);
|
||||||
|
if (empty($response)){
|
||||||
|
// 返回值为空
|
||||||
|
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||||
|
}
|
||||||
|
return $response;
|
||||||
|
} catch (GuzzleException $e) {
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取请求签名
|
* 获取请求签名
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user