多药房
Build Docker / build (push) Canceled after 0s

This commit is contained in:
haomingming
2026-09-08 10:09:07 +08:00
parent 4dfcdacb12
commit d3fce247e5
20 changed files with 782 additions and 65 deletions
+44
View File
@@ -16,6 +16,8 @@ use App\Model\HospitalDepartmentCustom;
use App\Model\HotSearchKeyword;
use App\Model\OperationManual;
use App\Model\Product;
use App\Model\DoctorPharmacy;
use App\Model\Pharmacy;
use Hyperf\Redis\Redis;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
@@ -242,6 +244,24 @@ class BasicDataService extends BaseService
$params = array();
$params['product_status'] = 1;
$params['is_delete'] = 0;
// 若是医生端,则只展示医生选定/默认药房下的药品
if (isset($user_info['user_type']) && $user_info['user_type'] == 2) {
$doctor_id = $user_info['client_user_id'] ?? 0;
$pharmacy_id = $this->request->input('pharmacy_id');
if (isset($pharmacy_id) && $pharmacy_id !== '') {
$pharmacy = Pharmacy::getValidPharmacy($pharmacy_id);
} else {
$defaultPharmacy = DoctorPharmacy::getDoctorDefaultPharmacy($doctor_id);
$pharmacy = ($defaultPharmacy && $defaultPharmacy->Pharmacy && $defaultPharmacy->Pharmacy->status == 1) ? $defaultPharmacy->Pharmacy : null;
}
if (empty($pharmacy) || empty($pharmacy->pharmacy_code)) {
return success([]);
}
$params['pharmacy_code'] = $pharmacy->pharmacy_code;
}
$product = Product::getSearchKeywordList($params, $product_keyword,$fields);
if (empty($product)) {
return success();
@@ -449,6 +469,30 @@ class BasicDataService extends BaseService
$params = array();
$params['product_status'] = 1;
$params['is_delete'] = 0;
// 若是医生端,则只展示医生选定/默认药房下的药品
if (isset($user_info['user_type']) && $user_info['user_type'] == 2) {
$doctor_id = $user_info['client_user_id'] ?? 0;
$pharmacy_id = $this->request->input('pharmacy_id');
if (isset($pharmacy_id) && $pharmacy_id !== '') {
$pharmacy = Pharmacy::getValidPharmacy($pharmacy_id);
} else {
$defaultPharmacy = DoctorPharmacy::getDoctorDefaultPharmacy($doctor_id);
$pharmacy = ($defaultPharmacy && $defaultPharmacy->Pharmacy && $defaultPharmacy->Pharmacy->status == 1) ? $defaultPharmacy->Pharmacy : null;
}
if (empty($pharmacy) || empty($pharmacy->pharmacy_code)) {
return success([
'total' => 0,
'per_page' => (int)$per_page,
'current_page' => (int)$page,
'last_page' => 0,
'data' => [],
]);
}
$params['pharmacy_code'] = $pharmacy->pharmacy_code;
}
$product = Product::getWithAmountPage($params, $keyword,$fields, $page, $per_page);
if (empty($product['data'])) {
return success($product);