修改消息分野

This commit is contained in:
wucongxing 2023-03-31 18:26:47 +08:00
parent 25cdfbc20a
commit d6ccd430e0
4 changed files with 50 additions and 64 deletions

View File

@ -38,7 +38,8 @@ class TestController extends AbstractController
// $this->test_10();
// $this->test_11();
// $this->test_5();
$this->test_1();
// $this->test_1();
$this->test_11();
}
// 获取云证书-首次
@ -526,24 +527,9 @@ class TestController extends AbstractController
}
public function test_11(){
// 获取处方关联疾病数据
$params = array();
$params['order_prescription_id'] = "500341310934036481";
$order_prescription_icd = OrderPrescriptionIcd::getOne($params);
if (empty($order_prescription_icd)){
throw new BusinessException("处方疾病数据错误");
}
dump($order_prescription_icd->toArray());
// 处理疾病数据
$icd_name = array_column($order_prescription_icd->toArray(),'icd_name');
if (!empty($icd_name)){
$icd_name = implode(';',$icd_name);
}else{
$icd_name = "";
}
dump($icd_name);
$oss = new Oss();
$prescription_pdf = $oss->getObjectToLocal("applet/prescription/500341310934036481.pdf","./runtime/test.pdf");
dump($prescription_pdf);
}
}

View File

@ -282,22 +282,7 @@ class MessageNoticeService extends BaseService
$params['notice_system_type'] = $notice_system_type; // 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息)
$params['send_status'] = 1;
$fields = [
'notice_id',
'read_status',
'inquiry_type',
'from_name',
'notice_title',
'notice_send_time',
'notice_content',
'button_type',
'link_type',
'link_params',
'show_type',
'show_params',
];
$result = MessageNotice::getMessageNoticePage($params, $fields, $page, $per_page);
$result = MessageNotice::getMessageNoticePage($params, ['*'], $page, $per_page);
if (!empty($result['data'])) {
foreach ($result['data'] as &$item) {
if (!empty($item['link_params'])) {

View File

@ -258,8 +258,8 @@ class OrderPrescriptionService extends BaseService
// 医生
if ($user['user_type'] == 2){
// 下载基础处方pdf图片
$filename = "basic/file/prescription.jpg";
$prescription_image = $oss->getObjectToRAM($filename);
$prescription_basic_filename = "basic/file/prescription.jpg";
$prescription_image = $oss->getObjectToRAM($prescription_basic_filename);
dump("下载基础处方pdf图片成功");
@ -267,7 +267,6 @@ class OrderPrescriptionService extends BaseService
$image = $manager->make($prescription_image);
// $fontPath = './extend/Ca/ZiYuYongSongTi-2.ttf';
$fontPath = './extend/Ca/msyh.ttf';
// 处方号
@ -372,39 +371,36 @@ class OrderPrescriptionService extends BaseService
dump("处方图片生成成功");
// 上传处方图片至oss
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'jpg';
$prescription_img_url = $oss->putObject($filename, $img_result);
$prescription_img_oss_filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'jpg';
$prescription_img_url = $oss->putObject($prescription_img_oss_filename, $img_result);
dump("处方图片上传oss成功");
// 图片生成pdf
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
$pdf->AddPage();
$pdf->Image('@' . $img_result, 10, 10, 0, 0, '', '', '', false, 300, '', false, false, 0, false, false, false);
$prescription_pdf_local_filename = $order_prescription['order_prescription_id'] . '.' . 'pdf';
// 图片生成的处方pdf存储为本地文件
$pdf->Output(dirname(__DIR__, 2) . "/" . $prescription_pdf_local_filename ,"F");
dump("处方图片生成pdf成功");
}
// 药师
if ($user['user_type'] == 3){
// 下载开具的处方图片
$filename = "basic/file/prescription.jpg";
$prescription_image = $oss->getObjectToRAM($filename);
dump("下载基础处方pdf图片成功");
// 下载医生开具的处方pdf
// 去除第一个/ oss不识别
$prescription_pdf_path = substr($order_prescription['prescription_pdf'], 1, strlen($order_prescription['prescription_pdf']) - 1);
$local = "./runtime/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
$prescription_pdf_local = $oss->getObjectToLocal($prescription_pdf_path,$local);
dump("下载医生开具的处方pdf成功");
}
// 图片生成pdf
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
$pdf->AddPage();
$pdf->Image('@' . $img_result, 10, 10, 0, 0, '', '', '', false, 300, '', false, false, 0, false, false, false);
$filename = $order_prescription['order_prescription_id'] . '.' . 'pdf';
// 图片生成的处方pdf存储为本地文件
$pdf->Output(dirname(__DIR__, 2) . "/" . $filename ,"F");
dump("图片生成pdf成功");
// 下载签名图片
$style = "image/resize,m_lfit,w_100,h_350";
$sign_image = $oss->getCusTomObjectToRAM($sign_image_path,$style);
@ -440,7 +436,7 @@ class OrderPrescriptionService extends BaseService
}
// 打开处方pdf文件
$pdf_file = fopen("./runtime/" . $filename,'r');
$pdf_file = fopen("./runtime/" . $order_prescription['order_prescription_id'] . ".pdf",'r');
// 处方pdf进行签章
$data = array();

View File

@ -129,7 +129,6 @@ class Oss
/**
* 下载文件到内存
* @param string $filename
* @param string $style
* @return string
*/
public function getObjectToRAM(string $filename): string
@ -142,4 +141,24 @@ class Oss
}
}
/**
* 下载文件到本地
* @param string $filename
* @param string $local
* @return string
*/
public function getObjectToLocal(string $filename,string $local): string
{
try {
$options = array(
OssClient::OSS_FILE_DOWNLOAD => $local
);
$ossClient = $this->createClient();
return $ossClient->getObject($this->config['bucket'], $filename,$options);
}catch(\Exception $e) {
throw new BusinessException($e->getMessage());
}
}
}