修改ca签章

This commit is contained in:
2023-04-20 13:16:52 +08:00
parent 7f5a1f1192
commit 3d4a941537
8 changed files with 260 additions and 91 deletions
+23 -40
View File
@@ -5,6 +5,7 @@ namespace App\Services;
use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use App\Model\OrderInquiry;
use App\Model\OrderPrescriptionFile;
use App\Model\OrderProduct;
use App\Model\PatientFamily;
use App\Model\Product;
@@ -130,7 +131,7 @@ class OrderPrescriptionService extends BaseService
* @param string $user_id
* @return array
*/
public function openPrescription(string $order_prescription_id, string $user_id): array
public function openPrescription(string $order_prescription_id, string $user_id,string $doctor_pdf_oss_path = ""): array
{
try {
// 获取用户数据
@@ -157,10 +158,16 @@ class OrderPrescriptionService extends BaseService
throw new BusinessException("医生开方日期错误");
}
// 检测处方图片
if ($user['user_type'] == 3 && empty($order_prescription['prescription_img'])) {
throw new BusinessException("处方图片错误");
}
// // 获取处方文件数据
// $params = array();
// $params['order_prescription_id'] = $order_prescription_id;
// $order_prescription_file = OrderPrescriptionFile::getOne($params);
// if (empty($order_prescription_file)){
// // 检测处方图片
// if ($user['user_type'] == 3) {
// throw new BusinessException("处方文件错误");
// }
// }
$CaService = new CaService($order_prescription,$user);
@@ -175,33 +182,23 @@ class OrderPrescriptionService extends BaseService
// 药师
if ($user['user_type'] == 3) {
// 检测处方图片
if (empty($doctor_pdf_oss_path)){
throw new BusinessException("处方文件错误");
}
// 获取医院云证书签名+验证云证书签名
$CaService->getVerifyCertSign($order_prescription,2);
// 下载医生开具的处方pdf
$CaService->downDoctorPrescriptionPdf($order_prescription);
$CaService->downDoctorPrescriptionPdf($order_prescription['order_prescription_id'],$doctor_pdf_oss_path);
}
// 进行处方pdf签章
$file_id = $CaService->addSignPdf($order_prescription,$user['user_type']);
// // 增加队列处理、自动下载处方签章文件并上传oss
// // 未存在file_id时,药师审核列表无法看到、自动审核不处理
//
//
// // 下载处方签章文件
// $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成功");
// 增加队列处理、自动下载处方签章文件并上传oss
if ($user['user_type'] == 3) {
// 药师端时,需要进行系统签章
@@ -213,26 +210,12 @@ class OrderPrescriptionService extends BaseService
$file_id = $CaService->addSignPdf($order_prescription,$user['user_type']);
// 加入下载签章队列
//
// // 下载处方签章文件
// 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_img_url'] = $prescription_img_url ?? "";
$result['file_id'] = $file_id;
return $result;
} catch (\Exception $e) {