修改创建药品订单 订单状态

This commit is contained in:
wucongxing 2023-03-30 14:13:34 +08:00
parent 0586745e7b
commit c2830d3ae2
3 changed files with 51 additions and 37 deletions

View File

@ -30,7 +30,9 @@ class TestController extends AbstractController
// $this->test_4();
// $this->test_6();
// $this->test_9();
$this->test_10();
// $this->test_10();
$this->test_11();
// $this->test_5();
}
// 获取云证书-首次
@ -166,7 +168,7 @@ class TestController extends AbstractController
// 下载阿里云图片
$oss = new Oss();
$filename = "Basic/images/prescription_img.jpg";
$filename = "Basic/images/prescription.jpg";
$sign_image = $oss->getObjectToRAM($filename);
$manager = new ImageManager();
@ -502,6 +504,6 @@ class TestController extends AbstractController
public function test_11(){
$OrderPrescriptionService = new OrderPrescriptionService();
$result = $OrderPrescriptionService->doctorOpenPrescription("499871705345941504");
$result = $OrderPrescriptionService->doctorOpenPrescription("499871705345941504",1);
}
}

View File

@ -11,6 +11,7 @@ use App\Model\OrderPrescription;
use App\Model\OrderPrescriptionIcd;
use App\Model\OrderPrescriptionProduct;
use App\Model\OrderProductItem;
use App\Model\User;
use App\Model\UserDoctor;
use Extend\Alibaba\Oss;
use Extend\Ca\Ca;
@ -106,7 +107,7 @@ class OrderPrescriptionService extends BaseService
}
// 医生开具处方
public function doctorOpenPrescription(string $order_prescription_id)
public function doctorOpenPrescription(string $order_prescription_id,string $user_type)
{
try {
// 获取处方数据
@ -169,40 +170,40 @@ class OrderPrescriptionService extends BaseService
$icd_name = "";
}
$ca = new Ca();
// 获取云证书签名
$data = array();
$data['created_at'] = $order_prescription['doctor_created_time'];
$data['department_custom_name'] = $hospital_department_custom['department_name'] ?: "";
$data['user_name'] = $order_prescription['patient_name'];
$data['sex'] = sexToStringSex($order_prescription['patient_sex']);
$data['age'] = $order_prescription['patient_age'];
$data['allergy_history'] = $order_inquiry_case['allergy_history'] ?: "";
$data['icd_name'] = $icd_name;
$data['doctor_advice'] = $order_prescription['doctor_advice'] ?: "";
// 商品数据
$data['product'] = array();
foreach ($order_prescription_product as $item){
$product = array();
$product['product_name'] = $item['product_name'] . "(" . $item['product_spec'] . ")"; // 商品名称+商品规格
$product['single_unit'] = $item['single_unit'] ?: ""; // 单次剂量1次1包
$product['frequency_use'] = $item['frequency_use'] ?: ""; // 使用频率(例1天3次)
$product['single_use'] = $item['single_use'] ?: ""; // 单次用法(例:口服)
$product['prescription_product_num'] = $item['prescription_product_num'] . $item['packaging_unit']; // 商品数量 + 基本包装单位(例:盒/瓶)
$data['product'][] = $product;
}
$cert_sign_result = $ca->getCertSign("491925054435950592", "491925054435950592", $data);
// 验证云证书签名-验证无需处理,只要不返回错误即可
$ca->verifyPkcs7($cert_sign_result['signP7'],$data);
// $ca = new Ca();
//
// // 获取云证书签名
// $data = array();
// $data['created_at'] = $order_prescription['doctor_created_time'];
// $data['department_custom_name'] = $hospital_department_custom['department_name'] ?: "";
// $data['user_name'] = $order_prescription['patient_name'];
// $data['sex'] = sexToStringSex($order_prescription['patient_sex']);
// $data['age'] = $order_prescription['patient_age'];
// $data['allergy_history'] = $order_inquiry_case['allergy_history'] ?: "无";
// $data['icd_name'] = $icd_name;
// $data['doctor_advice'] = $order_prescription['doctor_advice'] ?: "无";
//
// // 商品数据
// $data['product'] = array();
// foreach ($order_prescription_product as $item){
// $product = array();
// $product['product_name'] = $item['product_name'] . "(" . $item['product_spec'] . ")"; // 商品名称+商品规格
// $product['single_unit'] = $item['single_unit'] ?: ""; // 单次剂量1次1包
// $product['frequency_use'] = $item['frequency_use'] ?: ""; // 使用频率(例1天3次)
// $product['single_use'] = $item['single_use'] ?: ""; // 单次用法(例:口服)
// $product['prescription_product_num'] = $item['prescription_product_num'] . $item['packaging_unit']; // 商品数量 + 基本包装单位(例:盒/瓶)
// $data['product'][] = $product;
// }
//
// $cert_sign_result = $ca->getCertSign("491925054435950592", "491925054435950592", $data);
//
// // 验证云证书签名-验证无需处理,只要不返回错误即可
// $ca->verifyPkcs7($cert_sign_result['signP7'],$data);
// 生成处方pdf图片
$oss = new Oss();
$filename = "basic/file/prescription.pdf";
$filename = "basic/file/prescription.jpg";
$sign_image = $oss->getObjectToRAM($filename);
$manager = new ImageManager();
@ -273,6 +274,7 @@ class OrderPrescriptionService extends BaseService
$font->align('left');
});
// 商品数据
foreach ($order_prescription_product as $key => $item){
if ($key <= 2){
$x_axis = 229;
@ -312,11 +314,21 @@ class OrderPrescriptionService extends BaseService
$pdf->AddPage();
$pdf->Image('@' . $img_result, 10, 10, 0, 0, '', '', '', false, 300, '', false, false, 0, false, false, false);
// 生成本地文件
$pdf->Output(dirname(__DIR__, 2) . "/prescription_img.pdf","F");
// 生成文件流
$pdf_result = $pdf->Output("","S");
// 上传oss
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
$prescription_pdf = $oss->putObject($filename, $pdf_result);
dump($prescription_pdf);
} catch (\Exception $e) {
dump($e->getMessage());
}
}
}

View File

@ -866,10 +866,10 @@ class PatientOrderService extends BaseService
return fail(HttpEnumCode::HTTP_ERROR, "处方未审核");
}
if ($order_prescription['prescription_status'] == 3) {
if ($order_prescription['prescription_status'] == 4) {
return fail(HttpEnumCode::HTTP_ERROR, "处方已失效");
}
if ($order_prescription['prescription_status'] == 4) {
if ($order_prescription['prescription_status'] == 5) {
return fail(HttpEnumCode::HTTP_ERROR, "处方已使用");
}