修改开具处方问题

This commit is contained in:
2023-09-08 17:49:22 +08:00
parent 47d36afcb6
commit 4afcbaacf0
4 changed files with 171 additions and 186 deletions
+88 -39
View File
@@ -132,21 +132,90 @@ class OrderPrescriptionService extends BaseService
* @param string $user_id 用户id
* @return array
*/
public function openPrescription(string $order_prescription_id, string $user_id): array
// public function openPrescription1(string $order_prescription_id, string $user_id): array
// {
// try {
// // 获取用户数据
// $params = array();
// $params['user_id'] = $user_id;
// $user = User::getOne($params);
// if (empty($user)) {
// throw new BusinessException("用户数据错误");
// }
//
// if ($user['user_type'] != 2 && $user['user_type'] != 3) {
// throw new BusinessException("用户类型错误");
// }
//
// // 获取处方数据
// $params = array();
// $params['order_prescription_id'] = $order_prescription_id;
// $order_prescription = OrderPrescription::getOne($params);
// if (empty($order_prescription)) {
// throw new BusinessException("处方数据错误");
// }
//
// if (empty($order_prescription['doctor_created_time'])) {
// throw new BusinessException("医生开方日期错误");
// }
//
// $CaService = new CaService($order_prescription,$user);
//
// // 获取云证书签名+验证云证书签名
// $CaService->getVerifyCertSign($order_prescription,1);
//
// // 医生
// if ($user['user_type'] == 2) {
// // 生成处方图片+处方图片生成pdf
// $prescription_img_oss_path = $CaService->createPrescriptionImgPdf($order_prescription);
// }
//
// // 药师-医院签章
// if ($user['user_type'] == 3) {
// // 获取医院云证书签名+验证云证书签名
// $CaService->getVerifyCertSign($order_prescription,2);
//
// // 下载医生开具的处方pdf至本地
// $CaService->downOssPdfToLocal();
// }
//
// // 进行处方pdf签章
// $file_id = $CaService->addSignPdf($user['user_type']);
//
// // 药师-医院签章
// if ($user['user_type'] == 3) {
// // 药师端时,需要进行系统签章
// // 把药师签章的pdf存储至本地文件
// // 下载药师签章pdf图片
// dump($file_id);
// $CaService->downCaPdfToLocal($file_id,1);
//
// // 进行处方pdf签章
// $file_id = $CaService->addSignPdf($user['user_type']);
// }
//
// $result = array();
// $result['prescription_img_oss_path'] = $prescription_img_oss_path ?? "";
// $result['file_id'] = $file_id;
// return $result;
//
// } catch (\Throwable $e) {
// throw new BusinessException($e->getMessage());
// }
// }
/**
* 开具处方
* 医生-正常开具
* 药师-先开具药师处方,再开具医院签章
* @param string $order_prescription_id 处方id
* @param string $user_id 用户id
* @param int $type 类型 1:医院 2:医生 3:药师
* @return array
*/
public function openPrescription(string $order_prescription_id,int $type,string $user_id = ""): array
{
try {
// 获取用户数据
$params = array();
$params['user_id'] = $user_id;
$user = User::getOne($params);
if (empty($user)) {
throw new BusinessException("用户数据错误");
}
if ($user['user_type'] != 2 && $user['user_type'] != 3) {
throw new BusinessException("用户类型错误");
}
// 获取处方数据
$params = array();
$params['order_prescription_id'] = $order_prescription_id;
@@ -159,40 +228,20 @@ class OrderPrescriptionService extends BaseService
throw new BusinessException("医生开方日期错误");
}
$CaService = new CaService($order_prescription,$user);
$CaService = new CaService($order_prescription,$type,$user_id);
// 获取云证书签名+验证云证书签名
$CaService->getVerifyCertSign($order_prescription,1);
// 医生
if ($user['user_type'] == 2) {
$CaService->getVerifyCertSign($order_prescription);
if ($type == 2) {
// 生成处方图片+处方图片生成pdf
$prescription_img_oss_path = $CaService->createPrescriptionImgPdf($order_prescription);
}
// 药师-医院签章
if ($user['user_type'] == 3) {
// 获取医院云证书签名+验证云证书签名
$CaService->getVerifyCertSign($order_prescription,2);
// 下载医生开具的处方pdf至本地,文件存在时不进行下载
}else{
// 下载已经开具的处方pdf至本地
$CaService->downOssPdfToLocal();
}
// 进行处方pdf签章
$file_id = $CaService->addSignPdf($user['user_type']);
// 药师-医院签章
if ($user['user_type'] == 3) {
// 药师端时,需要进行系统签章
// 把药师签章的pdf存储至本地文件
// 下载药师签章pdf图片
$CaService->downCaPdfToLocal($file_id,1);
// 进行处方pdf签章
$file_id = $CaService->addSignPdf($user['user_type']);
}
$file_id = $CaService->addSignPdf($type);
$result = array();
$result['prescription_img_oss_path'] = $prescription_img_oss_path ?? "";
$result['file_id'] = $file_id;