新增医生开具处方对接ca平台
This commit is contained in:
parent
89c9eadb1b
commit
70932a142c
@ -5,6 +5,7 @@ namespace App\Controller;
|
|||||||
use App\Amqp\Producer\AssignDoctorProducer;
|
use App\Amqp\Producer\AssignDoctorProducer;
|
||||||
use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer;
|
use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer;
|
||||||
use App\Constants\HttpEnumCode;
|
use App\Constants\HttpEnumCode;
|
||||||
|
use App\Exception\BusinessException;
|
||||||
use App\Model\DoctorInquiryTime;
|
use App\Model\DoctorInquiryTime;
|
||||||
use App\Model\DoctorPharmacistCert;
|
use App\Model\DoctorPharmacistCert;
|
||||||
use App\Model\OrderInquiry;
|
use App\Model\OrderInquiry;
|
||||||
@ -503,7 +504,17 @@ class TestController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function test_11(){
|
public function test_11(){
|
||||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
// $ca = new Ca();
|
||||||
$result = $OrderPrescriptionService->doctorOpenPrescription("499871705345941504",1);
|
// $prescription_pdf_result = $ca->getSignedFile("491925054435950592","1641368425758359554");
|
||||||
|
// if (empty($prescription_pdf_result)){
|
||||||
|
// throw new BusinessException("下载处方签章文件失败");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// $oss = new Oss();
|
||||||
|
// $filename = "applet/prescription/" . "499993319660314624" . '.' . 'pdf';
|
||||||
|
// $prescription_pdf_url = $oss->putObject($filename, $prescription_pdf_result);
|
||||||
|
|
||||||
|
// $OrderPrescriptionService = new OrderPrescriptionService();
|
||||||
|
// $result = $OrderPrescriptionService->openPrescription("499871705345941504",1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,17 +235,20 @@ class OrderPrescriptionService extends BaseService
|
|||||||
$product['prescription_product_num'] = $item['prescription_product_num'] . $item['packaging_unit']; // 商品数量 + 基本包装单位(例:盒/瓶)
|
$product['prescription_product_num'] = $item['prescription_product_num'] . $item['packaging_unit']; // 商品数量 + 基本包装单位(例:盒/瓶)
|
||||||
$data['product'][] = $product;
|
$data['product'][] = $product;
|
||||||
}
|
}
|
||||||
|
dump("签名获取成功");
|
||||||
$cert_sign_result = $ca->getCertSign("491925054435950592", "491925054435950592", $data);
|
$cert_sign_result = $ca->getCertSign("491925054435950592", "491925054435950592", $data);
|
||||||
|
|
||||||
// 验证云证书签名-验证无需处理,只要不返回错误即可
|
// 验证云证书签名-验证无需处理,只要不返回错误即可
|
||||||
$ca->verifyPkcs7($cert_sign_result['signP7'],$data);
|
$ca->verifyPkcs7($cert_sign_result['signP7'],$data);
|
||||||
|
dump("签名验证成功");
|
||||||
// 生成处方pdf图片
|
// 下载基础处方pdf图片
|
||||||
$oss = new Oss();
|
$oss = new Oss();
|
||||||
|
|
||||||
$filename = "basic/file/prescription.jpg";
|
$filename = "basic/file/prescription.jpg";
|
||||||
$prescription_image = $oss->getObjectToRAM($filename);
|
$prescription_image = $oss->getObjectToRAM($filename);
|
||||||
|
|
||||||
|
dump("下载基础处方pdf图片成功");
|
||||||
|
|
||||||
$manager = new ImageManager();
|
$manager = new ImageManager();
|
||||||
|
|
||||||
$image = $manager->make($prescription_image);
|
$image = $manager->make($prescription_image);
|
||||||
@ -361,6 +364,7 @@ class OrderPrescriptionService extends BaseService
|
|||||||
// 图片生成的处方pdf存储为本地文件
|
// 图片生成的处方pdf存储为本地文件
|
||||||
$pdf->Output(dirname(__DIR__, 2) . "/" . $filename ,"F");
|
$pdf->Output(dirname(__DIR__, 2) . "/" . $filename ,"F");
|
||||||
|
|
||||||
|
dump("图片生成pdf成功");
|
||||||
// 下载签名图片
|
// 下载签名图片
|
||||||
$style = "image/resize,m_lfit,w_100,h_350";
|
$style = "image/resize,m_lfit,w_100,h_350";
|
||||||
$sign_image = $oss->getCusTomObjectToRAM($sign_image_path,$style);
|
$sign_image = $oss->getCusTomObjectToRAM($sign_image_path,$style);
|
||||||
@ -369,6 +373,8 @@ class OrderPrescriptionService extends BaseService
|
|||||||
throw new BusinessException("签名图片下载失败");
|
throw new BusinessException("签名图片下载失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dump("下载签名图片成功");
|
||||||
|
|
||||||
if ($user['user_type'] == 2){
|
if ($user['user_type'] == 2){
|
||||||
$sign_param = [
|
$sign_param = [
|
||||||
[ // 医生端
|
[ // 医生端
|
||||||
@ -406,13 +412,17 @@ class OrderPrescriptionService extends BaseService
|
|||||||
throw new BusinessException("处方签章失败");
|
throw new BusinessException("处方签章失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dump("处方pdf进行签章成功");
|
||||||
|
|
||||||
// 下载处方签章文件
|
// 下载处方签章文件
|
||||||
$file_id = $sign_pdf_result[0]['fileId'];
|
$file_id = $sign_pdf_result[0]['fileId'];
|
||||||
$prescription_pdf_result = $ca->getSignedFile("491925054435950592",$file_id);
|
$prescription_pdf_result = $ca->getSignedFile("491925054435950592",$file_id);
|
||||||
if (empty($result)){
|
if (empty($prescription_pdf_result)){
|
||||||
throw new BusinessException("下载处方签章文件失败");
|
throw new BusinessException("下载处方签章文件失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dump("下载处方签章文件成功");
|
||||||
|
|
||||||
// 上传oss
|
// 上传oss
|
||||||
$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);
|
||||||
|
|||||||
@ -27,6 +27,7 @@ use App\Model\OrderPrescriptionIcd;
|
|||||||
use App\Model\OrderPrescriptionProduct;
|
use App\Model\OrderPrescriptionProduct;
|
||||||
use App\Model\OrderProductItem;
|
use App\Model\OrderProductItem;
|
||||||
use App\Model\Product;
|
use App\Model\Product;
|
||||||
|
use App\Model\ProductPlatformAmount;
|
||||||
use App\Model\SystemInquiryConfig;
|
use App\Model\SystemInquiryConfig;
|
||||||
use App\Model\SystemInquiryTime;
|
use App\Model\SystemInquiryTime;
|
||||||
use App\Model\User;
|
use App\Model\User;
|
||||||
@ -1147,7 +1148,7 @@ class UserDoctorService extends BaseService
|
|||||||
$prescription_icd = $this->request->input('prescription_icd');
|
$prescription_icd = $this->request->input('prescription_icd');
|
||||||
$doctor_advice = $this->request->input('doctor_advice');
|
$doctor_advice = $this->request->input('doctor_advice');
|
||||||
$prescription_product = $this->request->input('prescription_product');
|
$prescription_product = $this->request->input('prescription_product');
|
||||||
return success();
|
|
||||||
// 获取医生信息
|
// 获取医生信息
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['doctor_id'] = $user_info['client_user_id'];
|
$params['doctor_id'] = $user_info['client_user_id'];
|
||||||
@ -1237,18 +1238,25 @@ class UserDoctorService extends BaseService
|
|||||||
// 商品数据
|
// 商品数据
|
||||||
foreach ($prescription_product as $item) {
|
foreach ($prescription_product as $item) {
|
||||||
// 获取商品数据
|
// 获取商品数据
|
||||||
$params = array();
|
$params =array();
|
||||||
$params['product_id'] = $item['product_id'];
|
$params['product_id'] = $item['product_id'];
|
||||||
$product = Product::getWithAmountOne($params);
|
$product = Product::getOne($params);
|
||||||
if (empty($product)) {
|
if (empty($product)){
|
||||||
Db::rollBack();
|
return fail(HttpEnumCode::SERVER_ERROR,"商品错误");
|
||||||
return fail(HttpEnumCode::HTTP_ERROR,"商品库存不足");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($product['ProductPlatformAmount'])) {
|
// 获取商品库存
|
||||||
|
$params =array();
|
||||||
|
$params['product_platform_id'] = $product['product_platform_id'];
|
||||||
|
$product_platform_amount = ProductPlatformAmount::getOne($params);
|
||||||
|
if (empty($product_platform_amount)) {
|
||||||
// 无药品库存数据
|
// 无药品库存数据
|
||||||
Db::rollBack();
|
Db::rollBack();
|
||||||
return fail();
|
return fail(HttpEnumCode::SERVER_ERROR,"无药品库存数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($product_platform_amount['stock'] <= 0){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR,"商品库存不足");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测药品库存数据
|
// 检测药品库存数据
|
||||||
@ -1283,7 +1291,20 @@ class UserDoctorService extends BaseService
|
|||||||
|
|
||||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
$OrderPrescriptionService = new OrderPrescriptionService();
|
||||||
|
|
||||||
$prescription_img = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$order_inquiry['order_inquiry_id']);
|
$prescription_img = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
|
||||||
|
if (empty($prescription_img)){
|
||||||
|
Db::rollBack();
|
||||||
|
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改处方表
|
||||||
|
$data = array();
|
||||||
|
$data['prescription_img'] = $prescription_img;
|
||||||
|
$data['doctor_created_time'] = date('Y-m-d H:i:s',time());
|
||||||
|
|
||||||
|
$params = array();
|
||||||
|
$params['order_prescription_id'] = $order_prescription->order_prescription_id;
|
||||||
|
OrderPrescription::edit($params,$data);
|
||||||
|
|
||||||
// 加入分配药师队列
|
// 加入分配药师队列
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user