From 000117e019360b8ad515855c1d71758a390f19f8 Mon Sep 17 00:00:00 2001 From: lq Date: Thu, 26 Sep 2024 12:59:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8C=BB=E7=94=9F=E7=AB=AF?= =?UTF-8?q?=E5=A4=84=E6=96=B9=E5=88=97=E8=A1=A8=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/modules/v1/controllers/ExamineController.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/service/modules/v1/controllers/ExamineController.php b/service/modules/v1/controllers/ExamineController.php index e69cc51..3fabad1 100644 --- a/service/modules/v1/controllers/ExamineController.php +++ b/service/modules/v1/controllers/ExamineController.php @@ -114,13 +114,12 @@ class ExamineController extends BasePharmacistController foreach ($tmp['repice'] as $repiceInfo) { // 解析药品内容中的JSON数据 $drugJson = json_decode($repiceInfo['content'], true); - // 若药品信息中包含名称,则添加到处方药品列表中 - if (array_key_exists('name', $drugJson)) { - $v['p_drugs'][] = array_column($drugJson, 'name'); - } // 若药品信息中包含药品名称键,则直接添加药品名称到列表 if (array_key_exists('drug_name', $drugJson)){ $v['p_drugs'][] = $drugJson['drug_name']; + } else { + // 若药品信息中包含名称,则添加到处方药品列表中 + $v['p_drugs'] = array_column($drugJson, 'name'); } } // 移除重复的药品名称,并计算唯一药品的数量