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'); } } // 移除重复的药品名称,并计算唯一药品的数量