新增药师开具处方ca签章

This commit is contained in:
2023-04-03 11:34:53 +08:00
parent d09f9d8d77
commit 29965b14af
10 changed files with 225 additions and 90 deletions
+86 -21
View File
@@ -7,7 +7,7 @@ use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer;
use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use App\Model\DoctorInquiryTime;
use App\Model\DoctorPharmacistCert;
use App\Model\UserCaCert;
use App\Model\OrderInquiry;
use App\Model\OrderPrescription;
use App\Model\OrderPrescriptionIcd;
@@ -38,8 +38,9 @@ class TestController extends AbstractController
// $this->test_10();
// $this->test_11();
// $this->test_5();
$this->test_1();
// $this->test_1();
// $this->test_11();
$this->test_12();
}
// 获取云证书-首次
@@ -57,7 +58,7 @@ class TestController extends AbstractController
// $data['cert_chain_p7'] = $result['certP7'];
// $data['cert_serial_number'] = $result['certSerialnumber'];
// $data['ca_pin'] = "491925054435950592";
// $doctor_pharmacist_cert = DoctorPharmacistCert::addDoctorPharmacistCert($data);
// $doctor_pharmacist_cert = UserCaCert::addDoctorPharmacistCert($data);
// if (empty($doctor_pharmacist_cert)){
// return fail();
// }
@@ -74,27 +75,27 @@ class TestController extends AbstractController
// $data['cert_chain_p7'] = $result['certP7'];
// $data['cert_serial_number'] = $result['certSerialnumber'];
// $data['ca_pin'] = "534534546";
// $doctor_pharmacist_cert = DoctorPharmacistCert::addDoctorPharmacistCert($data);
// $doctor_pharmacist_cert = UserCaCert::addDoctorPharmacistCert($data);
// if (empty($doctor_pharmacist_cert)){
// return fail();
// }
// 测试企业
$data = array();
$data['user_id'] = "534534546";
$data['card_num'] = "410323199603261240";
$result = $ca->getCloudCert($data);
$data = array();
$data['user_id'] = "534534546";
$data['cert_base64'] = $result['certBase64'];
$data['cert_chain_p7'] = $result['certP7'];
$data['cert_serial_number'] = $result['certSerialnumber'];
$data['ca_pin'] = "534534546";
$doctor_pharmacist_cert = DoctorPharmacistCert::addDoctorPharmacistCert($data);
if (empty($doctor_pharmacist_cert)){
return fail();
}
// $data = array();
// $data['user_id'] = "5345345461";
// $data['card_num'] = "91510106MABTJY4K9R";
// $result = $ca->getCloudCert($data,"Organizational");
//
// $data = array();
// $data['is_system'] = 1;
// $data['cert_base64'] = $result['certBase64'];
// $data['cert_chain_p7'] = $result['certP7'];
// $data['cert_serial_number'] = $result['certSerialnumber'];
// $data['ca_pin'] = "5345345461";
// $doctor_pharmacist_cert = UserCaCert::addDoctorPharmacistCert($data);
// if (empty($doctor_pharmacist_cert)){
// return fail();
// }
}
// 获取用户云证书数据-验证PKCS7签名
@@ -103,7 +104,7 @@ class TestController extends AbstractController
$params = array();
$params['user_id'] = "491925054435950592";
$doctor_pharmacist_cert = DoctorPharmacistCert::getOne($params);
$doctor_pharmacist_cert = UserCaCert::getOne($params);
if (empty($doctor_pharmacist_cert)){
return fail(HttpEnumCode::HTTP_ERROR,"用户数据错误");
}
@@ -394,7 +395,7 @@ class TestController extends AbstractController
// pdf进行签章
public function test_6(){
$pdf_file = fopen("./runtime/prescription_img.pdf",'r');
$pdf_file = fopen("./runtime/prescription.pdf",'r');
$oss = new Oss();
@@ -578,4 +579,68 @@ class TestController extends AbstractController
dump($prescription_pdf);
}
// pdf进行签章
public function test_12(){
$ca = new Ca();
$pdf_file = fopen("./runtime/prescription.pdf",'r');
$oss = new Oss();
$filename = "basic/file/hospital_signature.png";
$style = "image/resize,w_300,h_300";
$sign_image = $oss->getCusTomObjectToRAM($filename,$style);
$sign_image = base64_encode($sign_image);
if (!$sign_image){
return fail(HttpEnumCode::SERVER_ERROR);
}
$sign_param = [
[ // 医院签章
"llx"=>"1550", // 左边底部X坐标
"lly"=>"1350", // 左边底部Y坐标
"urx"=>"2250", // 右边上部x坐标
"ury"=>"650", // 右边上部y坐标
"pageList"=>[1],
"sealImg"=>$sign_image
],
// [ // 药师端
// "llx"=>"350", // 左边底部X坐标
// "lly"=>"190", // 左边底部Y坐标
// "urx"=>"440", // 右边上部x坐标
// "ury"=>"140", // 右边上部y坐标
// "pageList"=>[1],
// "sealImg"=>$sign_image
// ]
];
$data = array();
$data['sign_param'] = json_encode($sign_param);
$data['pdf_file'] = $pdf_file;
$result = $ca->addSignPdf("5345345461",$data);
$file_id = $result[0]['fileId'];
$result = $ca->getSignedFile("5345345461",$file_id);
if (empty($result)){
return fail();
}
$file = fopen("./runtime/test.pdf", "w") or die("Unable to open file!");
fwrite($file, $result);
fclose($file);
// 上传阿里云oss
// $oss = new Oss();
//
// $filename = "applet/doctor/prescription/test.pdf";
//
// $result = $oss->putObject($filename, $result);
// dump($result);
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ use App\Amqp\Producer\PrescriptionDistributePhProducer;
use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use App\Model\DoctorInquiryTime;
use App\Model\DoctorPharmacistCert;
use App\Model\UserCaCert;
use App\Model\OrderInquiry;
use App\Model\UserDoctor;
use App\Request\UserRequest;