@@ -56,6 +56,8 @@ class CaService extends BaseService
|
||||
// 处方pdf oss地址
|
||||
protected string $prescription_pdf_oss_path;
|
||||
|
||||
protected array $sign_result = [];
|
||||
|
||||
/**
|
||||
* 初始化类,此处会获取基础数据
|
||||
* @param array|object $order_prescription 处方表数据
|
||||
@@ -254,13 +256,33 @@ class CaService extends BaseService
|
||||
$data['product'][] = $product;
|
||||
}
|
||||
|
||||
dump($this->entity_id);
|
||||
$cert_sign_result = $CaOnline->getCertSign($this->entity_id, $this->entity_id, $data);
|
||||
|
||||
// 验证云证书签名 验证无需处理,只要不返回错误即可
|
||||
$CaOnline->verifyPkcs7($cert_sign_result['signP7'], $data);
|
||||
|
||||
$this->cert_serial_number = $cert_sign_result['certSerialnumber'];
|
||||
$sign_originaltext = hash_hmac("sha1", json_encode($data, JSON_UNESCAPED_UNICODE), config('ca.online.secret'));
|
||||
$timestamp_sign = "";
|
||||
try {
|
||||
$timestamp_result = $CaOnline->getTimestampSign($sign_originaltext);
|
||||
if (is_array($timestamp_result)) {
|
||||
$timestamp_sign = $timestamp_result['signedData'] ?? "";
|
||||
} elseif (is_string($timestamp_result)) {
|
||||
$timestamp_sign = $timestamp_result;
|
||||
}
|
||||
} catch (\Throwable $throwable) {
|
||||
$timestamp_sign = "";
|
||||
}
|
||||
|
||||
$this->sign_result = [
|
||||
'ca_supplier' => (string) config('regulatory_platform.ca_supplier', '2'),
|
||||
'ca_sign_type' => (string) config('regulatory_platform.ca_sign_type', '1'),
|
||||
'ca_sign_originaltext' => $sign_originaltext,
|
||||
'ca_sign_text' => $cert_sign_result['signP7'] ?? "",
|
||||
'ca_sign_time' => $timestamp_sign,
|
||||
'cert_serial_number' => $cert_sign_result['certSerialnumber'] ?? "",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,6 +290,11 @@ class CaService extends BaseService
|
||||
* @param array|object $order_prescription
|
||||
* @return string
|
||||
*/
|
||||
public function getSignResult(): array
|
||||
{
|
||||
return $this->sign_result;
|
||||
}
|
||||
|
||||
public function createPrescriptionImgPdf(array|object $order_prescription): string
|
||||
{
|
||||
// 打开基础处方图片
|
||||
@@ -542,4 +569,4 @@ class CaService extends BaseService
|
||||
|
||||
return $sign_pdf_result[0]['fileId'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user