新增自动开具处方。修改ca对接
This commit is contained in:
@@ -30,6 +30,8 @@ use Extend\Prescription\Prescription;
|
||||
use Hyperf\Contract\LengthAwarePaginatorInterface;
|
||||
use Hyperf\Utils\WaitGroup;
|
||||
use Intervention\Image\ImageManager;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Swoole\Coroutine\Channel;
|
||||
use TCPDF;
|
||||
|
||||
@@ -127,11 +129,11 @@ class OrderPrescriptionService extends BaseService
|
||||
* 开具处方
|
||||
* 医生-正常开具
|
||||
* 药师-先开具药师处方,再开具医院签章
|
||||
* @param string $order_prescription_id
|
||||
* @param string $user_id
|
||||
* @param string $order_prescription_id 处方id
|
||||
* @param string $user_id 用户id
|
||||
* @return array
|
||||
*/
|
||||
public function openPrescription(string $order_prescription_id, string $user_id,string $doctor_pdf_oss_path = ""): array
|
||||
public function openPrescription(string $order_prescription_id, string $user_id): array
|
||||
{
|
||||
try {
|
||||
// 获取用户数据
|
||||
@@ -166,38 +168,34 @@ class OrderPrescriptionService extends BaseService
|
||||
// 医生
|
||||
if ($user['user_type'] == 2) {
|
||||
// 生成处方图片+处方图片生成pdf
|
||||
$prescription_img_url = $CaService->createPrescriptionImgPdf($order_prescription);
|
||||
$prescription_img_oss_path = $CaService->createPrescriptionImgPdf($order_prescription);
|
||||
}
|
||||
|
||||
// 药师
|
||||
// 药师-医院签章
|
||||
if ($user['user_type'] == 3) {
|
||||
// 检测处方图片
|
||||
if (empty($doctor_pdf_oss_path)){
|
||||
throw new BusinessException("处方文件错误");
|
||||
}
|
||||
|
||||
// 获取医院云证书签名+验证云证书签名
|
||||
$CaService->getVerifyCertSign($order_prescription,2);
|
||||
|
||||
// 下载医生开具的处方pdf
|
||||
$CaService->downDoctorPrescriptionPdf($order_prescription['order_prescription_id'],$doctor_pdf_oss_path);
|
||||
// 下载医生开具的处方pdf至本地,文件存在时不进行下载
|
||||
$CaService->downOssPdfToLocal();
|
||||
}
|
||||
|
||||
// 进行处方pdf签章
|
||||
$file_id = $CaService->addSignPdf($order_prescription,$user['user_type']);
|
||||
$file_id = $CaService->addSignPdf($user['user_type']);
|
||||
|
||||
// 药师-医院签章
|
||||
if ($user['user_type'] == 3) {
|
||||
// 药师端时,需要进行系统签章
|
||||
// 把药师签章的pdf存储至本地文件
|
||||
// 下载药师签章pdf图片
|
||||
$CaService->downCaPdf($file_id,$order_prescription['order_prescription_id']);
|
||||
$CaService->downCaPdfToLocal($file_id,1);
|
||||
|
||||
// 进行处方pdf签章
|
||||
$file_id = $CaService->addSignPdf($order_prescription,$user['user_type']);
|
||||
$file_id = $CaService->addSignPdf($user['user_type']);
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result['prescription_img_url'] = $prescription_img_url ?? "";
|
||||
$result['prescription_img_oss_path'] = $prescription_img_oss_path ?? "";
|
||||
$result['file_id'] = $file_id;
|
||||
return $result;
|
||||
|
||||
@@ -481,4 +479,40 @@ class OrderPrescriptionService extends BaseService
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 药师驳回处方
|
||||
* @param string $order_prescription_id 处方id
|
||||
* @param string $doctor_user_id 医生user_id
|
||||
* @param string $patient_user_id 患者user_id
|
||||
* @param string $order_inquiry_id 问诊订单id
|
||||
* @param string $pharmacist_fail_reason 驳回原因
|
||||
* @return void
|
||||
*/
|
||||
public function rejectPrescription(string $order_prescription_id, string $doctor_user_id, string $patient_user_id, string $order_inquiry_id,string $pharmacist_fail_reason = ""): void
|
||||
{
|
||||
try {
|
||||
$params = array();
|
||||
$params['order_prescription_id'] = $order_prescription_id;
|
||||
|
||||
$data = array();
|
||||
$data['pharmacist_audit_status'] = 2;
|
||||
$data['pharmacist_verify_time'] = date('Y-m-d H:i:s', time());
|
||||
$data['pharmacist_fail_reason'] = $pharmacist_fail_reason;
|
||||
|
||||
OrderPrescription::edit($params, $data);
|
||||
|
||||
// 医生-开具的处方审核未通过
|
||||
$MessagePush = new MessagePush($doctor_user_id, $order_inquiry_id);
|
||||
$MessagePush->prescriptionVerifyFail($order_prescription_id);
|
||||
|
||||
// 患者-处方审核未通过
|
||||
$MessagePush = new MessagePush($patient_user_id, $order_inquiry_id);
|
||||
$MessagePush->patientPrescriptionVerifyFail();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
} catch (NotFoundExceptionInterface|ContainerExceptionInterface $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user