1
This commit is contained in:
@@ -112,9 +112,9 @@ class OrderPrescriptionService extends BaseService
|
||||
* 开具处方
|
||||
* @param string $order_prescription_id
|
||||
* @param string $user_id
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
public function openPrescription(string $order_prescription_id,string $user_id): string
|
||||
public function openPrescription(string $order_prescription_id,string $user_id): array
|
||||
{
|
||||
try {
|
||||
// 获取用户数据
|
||||
@@ -253,7 +253,8 @@ class OrderPrescriptionService extends BaseService
|
||||
|
||||
$image = $manager->make($prescription_image);
|
||||
|
||||
$fontPath = './extend/Ca/ZiYuYongSongTi-2.ttf';
|
||||
// $fontPath = './extend/Ca/ZiYuYongSongTi-2.ttf';
|
||||
$fontPath = './extend/Ca/msyh.ttf';
|
||||
|
||||
// 处方号
|
||||
$image->text($order_prescription['prescription_code'], 1480, 540, function ($font) use($fontPath) {
|
||||
@@ -354,6 +355,12 @@ class OrderPrescriptionService extends BaseService
|
||||
|
||||
// 生成图片
|
||||
$img_result = (string) $image->encode('png', 75);
|
||||
dump("处方图片生成成功");
|
||||
|
||||
// 上传处方图片至oss
|
||||
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'jpg';
|
||||
$prescription_img_url = $oss->putObject($filename, $img_result);
|
||||
dump("处方图片上传oss成功");
|
||||
|
||||
// 图片生成pdf
|
||||
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
|
||||
@@ -432,7 +439,10 @@ class OrderPrescriptionService extends BaseService
|
||||
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
|
||||
$prescription_pdf_url = $oss->putObject($filename, $prescription_pdf_result);
|
||||
|
||||
return $prescription_pdf_url;
|
||||
$result = array();
|
||||
$result['prescription_img_url'] = $prescription_img_url ?: "";
|
||||
$result['prescription_pdf_url'] = $prescription_pdf_url ?: "";
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
|
||||
@@ -171,7 +171,9 @@ class PatientFamilyService extends BaseService
|
||||
// 新增 患者家庭成员信息表-基本信息(patient_family)
|
||||
$data = array();
|
||||
$data['patient_id'] = $user_info['client_user_id'];
|
||||
$data['relation'] = $request_params['relation'];
|
||||
if (!empty($request_params['relation'])){
|
||||
$data['relation'] = $request_params['relation'];
|
||||
}
|
||||
$data['status'] = 1;
|
||||
$data['is_default'] = empty($request_params['is_default']) ? 0 : 1;
|
||||
$data['card_name'] = $request_params['card_name'];
|
||||
|
||||
@@ -1117,15 +1117,16 @@ class UserDoctorService extends BaseService
|
||||
}
|
||||
|
||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
||||
$prescription_img = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
|
||||
if (empty($prescription_img)){
|
||||
$prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
|
||||
if (empty($prescription_open_result['prescription_img_url']) || empty($prescription_open_result['prescription_pdf_url'])){
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
||||
}
|
||||
|
||||
// 修改处方表
|
||||
$data = array();
|
||||
$data['prescription_img'] = $prescription_img;
|
||||
$data['prescription_img'] = $prescription_open_result['prescription_img_url'];
|
||||
$data['prescription_pdf'] = $prescription_open_result['prescription_pdf_url'];
|
||||
$data['doctor_created_time'] = date('Y-m-d H:i:s',time());
|
||||
|
||||
$params = array();
|
||||
@@ -1310,15 +1311,16 @@ class UserDoctorService extends BaseService
|
||||
|
||||
// 开具处方
|
||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
||||
$prescription_img = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
|
||||
if (empty($prescription_img)){
|
||||
$prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
|
||||
if (empty($prescription_open_result['prescription_img_url']) || empty($prescription_open_result['prescription_pdf_url'])){
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
||||
}
|
||||
|
||||
// 修改处方表
|
||||
$data = array();
|
||||
$data['prescription_img'] = $prescription_img;
|
||||
$data['prescription_img'] = $prescription_open_result['prescription_img_url'];
|
||||
$data['prescription_pdf'] = $prescription_open_result['prescription_pdf_url'];
|
||||
$data['doctor_created_time'] = date('Y-m-d H:i:s',time());
|
||||
|
||||
$params = array();
|
||||
|
||||
Reference in New Issue
Block a user