新增医生开具处方对接ca平台

This commit is contained in:
2023-03-30 17:28:58 +08:00
parent 89c9eadb1b
commit 70932a142c
3 changed files with 57 additions and 15 deletions
+30 -9
View File
@@ -27,6 +27,7 @@ use App\Model\OrderPrescriptionIcd;
use App\Model\OrderPrescriptionProduct;
use App\Model\OrderProductItem;
use App\Model\Product;
use App\Model\ProductPlatformAmount;
use App\Model\SystemInquiryConfig;
use App\Model\SystemInquiryTime;
use App\Model\User;
@@ -1147,7 +1148,7 @@ class UserDoctorService extends BaseService
$prescription_icd = $this->request->input('prescription_icd');
$doctor_advice = $this->request->input('doctor_advice');
$prescription_product = $this->request->input('prescription_product');
return success();
// 获取医生信息
$params = array();
$params['doctor_id'] = $user_info['client_user_id'];
@@ -1237,18 +1238,25 @@ class UserDoctorService extends BaseService
// 商品数据
foreach ($prescription_product as $item) {
// 获取商品数据
$params = array();
$params =array();
$params['product_id'] = $item['product_id'];
$product = Product::getWithAmountOne($params);
if (empty($product)) {
Db::rollBack();
return fail(HttpEnumCode::HTTP_ERROR,"商品库存不足");
$product = Product::getOne($params);
if (empty($product)){
return fail(HttpEnumCode::SERVER_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();
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();
$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();