1
This commit is contained in:
parent
8be42f20f0
commit
878bd21ec0
@ -21,7 +21,9 @@ use Extend\Ca\Ca;
|
|||||||
use Hyperf\Amqp\Producer;
|
use Hyperf\Amqp\Producer;
|
||||||
use Hyperf\DbConnection\Db;
|
use Hyperf\DbConnection\Db;
|
||||||
use Hyperf\Utils\ApplicationContext;
|
use Hyperf\Utils\ApplicationContext;
|
||||||
|
use Imagick;
|
||||||
use Intervention\Image\ImageManager;
|
use Intervention\Image\ImageManager;
|
||||||
|
use Spatie\PdfToImage\Pdf;
|
||||||
use TCPDF;
|
use TCPDF;
|
||||||
|
|
||||||
class TestController extends AbstractController
|
class TestController extends AbstractController
|
||||||
@ -505,22 +507,27 @@ class TestController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function test_11(){
|
public function test_11(){
|
||||||
|
$ca = new Ca();
|
||||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
$prescription_pdf_result = $ca->getSignedFile("491925054435950592","1641368425758359554");
|
||||||
$prescription_img = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
|
if (empty($prescription_pdf_result)){
|
||||||
if (empty($prescription_img)){
|
throw new BusinessException("下载处方签章文件失败");
|
||||||
Db::rollBack();
|
|
||||||
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改处方表
|
$file = fopen("./runtime/test.pdf", "w") or die("Unable to open file!");
|
||||||
$data = array();
|
fwrite($file, $prescription_pdf_result);
|
||||||
$data['prescription_img'] = $prescription_img;
|
fclose($file);
|
||||||
$data['doctor_created_time'] = date('Y-m-d H:i:s',time());
|
|
||||||
|
|
||||||
$params = array();
|
// 将临时文件转换为图片
|
||||||
$params['order_prescription_id'] = $order_prescription->order_prescription_id;
|
$pdf = new Pdf("./runtime/test.pdf");
|
||||||
OrderPrescription::edit($params,$data);
|
$pdf->saveImage("./runtime/test.jpg");
|
||||||
|
|
||||||
|
// dump($prescription_pdf_result);
|
||||||
|
//
|
||||||
|
// $manager = new ImageManager();
|
||||||
|
// $image = $manager->make($prescription_pdf_result)->convert('jpg');
|
||||||
|
//
|
||||||
|
// // 保存图片
|
||||||
|
// $image->save('./runtime/image.jpg');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ class PatientFamilyRequest extends FormRequest
|
|||||||
|
|
||||||
protected array $scenes = [
|
protected array $scenes = [
|
||||||
'addFamily' => [ // 新增家庭成员
|
'addFamily' => [ // 新增家庭成员
|
||||||
'relation',
|
// 'relation',
|
||||||
'is_default',
|
'is_default',
|
||||||
'card_name',
|
'card_name',
|
||||||
'mobile',
|
'mobile',
|
||||||
@ -33,7 +33,7 @@ class PatientFamilyRequest extends FormRequest
|
|||||||
'marital_status',
|
'marital_status',
|
||||||
],
|
],
|
||||||
'editFamily' => [ // 修改家庭成员
|
'editFamily' => [ // 修改家庭成员
|
||||||
'relation',
|
// 'relation',
|
||||||
'is_default',
|
'is_default',
|
||||||
'card_name',
|
'card_name',
|
||||||
'type',
|
'type',
|
||||||
|
|||||||
@ -112,9 +112,9 @@ class OrderPrescriptionService extends BaseService
|
|||||||
* 开具处方
|
* 开具处方
|
||||||
* @param string $order_prescription_id
|
* @param string $order_prescription_id
|
||||||
* @param string $user_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 {
|
try {
|
||||||
// 获取用户数据
|
// 获取用户数据
|
||||||
@ -253,7 +253,8 @@ class OrderPrescriptionService extends BaseService
|
|||||||
|
|
||||||
$image = $manager->make($prescription_image);
|
$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) {
|
$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);
|
$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
|
||||||
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
|
$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';
|
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
|
||||||
$prescription_pdf_url = $oss->putObject($filename, $prescription_pdf_result);
|
$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) {
|
} catch (\Exception $e) {
|
||||||
throw new BusinessException($e->getMessage());
|
throw new BusinessException($e->getMessage());
|
||||||
|
|||||||
@ -171,7 +171,9 @@ class PatientFamilyService extends BaseService
|
|||||||
// 新增 患者家庭成员信息表-基本信息(patient_family)
|
// 新增 患者家庭成员信息表-基本信息(patient_family)
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['patient_id'] = $user_info['client_user_id'];
|
$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['status'] = 1;
|
||||||
$data['is_default'] = empty($request_params['is_default']) ? 0 : 1;
|
$data['is_default'] = empty($request_params['is_default']) ? 0 : 1;
|
||||||
$data['card_name'] = $request_params['card_name'];
|
$data['card_name'] = $request_params['card_name'];
|
||||||
|
|||||||
@ -1117,15 +1117,16 @@ class UserDoctorService extends BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
$OrderPrescriptionService = new OrderPrescriptionService();
|
||||||
$prescription_img = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
|
$prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
|
||||||
if (empty($prescription_img)){
|
if (empty($prescription_open_result['prescription_img_url']) || empty($prescription_open_result['prescription_pdf_url'])){
|
||||||
Db::rollBack();
|
Db::rollBack();
|
||||||
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改处方表
|
// 修改处方表
|
||||||
$data = array();
|
$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());
|
$data['doctor_created_time'] = date('Y-m-d H:i:s',time());
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
@ -1310,15 +1311,16 @@ class UserDoctorService extends BaseService
|
|||||||
|
|
||||||
// 开具处方
|
// 开具处方
|
||||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
$OrderPrescriptionService = new OrderPrescriptionService();
|
||||||
$prescription_img = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
|
$prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
|
||||||
if (empty($prescription_img)){
|
if (empty($prescription_open_result['prescription_img_url']) || empty($prescription_open_result['prescription_pdf_url'])){
|
||||||
Db::rollBack();
|
Db::rollBack();
|
||||||
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改处方表
|
// 修改处方表
|
||||||
$data = array();
|
$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());
|
$data['doctor_created_time'] = date('Y-m-d H:i:s',time());
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|||||||
@ -37,6 +37,7 @@
|
|||||||
"hyperf/snowflake": "^3.0",
|
"hyperf/snowflake": "^3.0",
|
||||||
"hyperf/validation": "^3.0",
|
"hyperf/validation": "^3.0",
|
||||||
"intervention/image": "^2.7",
|
"intervention/image": "^2.7",
|
||||||
|
"spatie/pdf-to-image": "^1.2",
|
||||||
"tecnickcom/tcpdf": "^6.6",
|
"tecnickcom/tcpdf": "^6.6",
|
||||||
"w7corp/easywechat": "^6.7"
|
"w7corp/easywechat": "^6.7"
|
||||||
},
|
},
|
||||||
|
|||||||
51
composer.lock
generated
51
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "f11dd54f0558de3aed797460197d3986",
|
"content-hash": "bdf6fc89c13c332770e8c88e1076586f",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adbario/php-dot-notation",
|
"name": "adbario/php-dot-notation",
|
||||||
@ -4689,6 +4689,55 @@
|
|||||||
"description": "A polyfill for getallheaders.",
|
"description": "A polyfill for getallheaders.",
|
||||||
"time": "2019-03-08T08:55:37+00:00"
|
"time": "2019-03-08T08:55:37+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "spatie/pdf-to-image",
|
||||||
|
"version": "1.2.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/spatie/pdf-to-image.git",
|
||||||
|
"reference": "9a5cb264a99e87e010c65d4ece03b51f821d55bd"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://mirrors.huaweicloud.com/repository/php/spatie/pdf-to-image/1.2.2/spatie-pdf-to-image-1.2.2.zip",
|
||||||
|
"reference": "9a5cb264a99e87e010c65d4ece03b51f821d55bd",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "4.*",
|
||||||
|
"scrutinizer/ocular": "~1.1"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Spatie\\PdfToImage\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Freek Van der Herten",
|
||||||
|
"email": "freek@spatie.be",
|
||||||
|
"homepage": "https://spatie.be",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Convert a pdf to an image",
|
||||||
|
"homepage": "https://github.com/spatie/pdf-to-image",
|
||||||
|
"keywords": [
|
||||||
|
"convert",
|
||||||
|
"image",
|
||||||
|
"pdf",
|
||||||
|
"pdf-to-image",
|
||||||
|
"spatie"
|
||||||
|
],
|
||||||
|
"time": "2016-12-14T15:37:00+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/cache",
|
"name": "symfony/cache",
|
||||||
"version": "v6.0.18",
|
"version": "v6.0.18",
|
||||||
|
|||||||
BIN
extend/Ca/msyh.ttf
Executable file
BIN
extend/Ca/msyh.ttf
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user