diff --git a/service/modules/v1/controllers/ExamineController.php b/service/modules/v1/controllers/ExamineController.php index 9ce986f..3fabad1 100644 --- a/service/modules/v1/controllers/ExamineController.php +++ b/service/modules/v1/controllers/ExamineController.php @@ -102,9 +102,8 @@ class ExamineController extends BasePharmacistController throw new Exception('暂无数据'); } - $list = []; // 遍历处方列表,处理每个处方的内容 - foreach ($prescription as $v) { + foreach ($prescription as &$v) { // 解析处方内容中的JSON数据 $tmp = json_decode($v['content'], true); // 提取并赋值处方类别 @@ -128,11 +127,10 @@ class ExamineController extends BasePharmacistController $v['drugs_count'] = count($v['p_drugs']); // 格式化创建时间,若无创建时间则设为空字符串 $v['created_at'] = !empty($v['created_at']) ? date('Y-m-d H:i:s', $v['created_at']) : ''; - $list[] = $v; } // 返回处理后的处方列表 - return $list; + return $prescription; } /** diff --git a/service/modules/v1/controllers/PatientController.php b/service/modules/v1/controllers/PatientController.php index 5bee3ae..6798c1c 100644 --- a/service/modules/v1/controllers/PatientController.php +++ b/service/modules/v1/controllers/PatientController.php @@ -139,14 +139,20 @@ class PatientController extends BaseServiceController 'patient'=>'patient.name', 'idcard'=>'patient.id_card', 'mobile'=>'patient.mobile', + 'status_text'=> function ($d) { + return self::getStatusInfo($d->status, 'text'); + }, + 'status_type' => function ($d) { + return self::getStatusInfo($d->status, 'type'); + }, 'status','status_text','status_type','is_pay','created_at','is_cancel' ] ]; $list = $this->create($query,$post); - foreach ($list->models as &$model) { - $model->status_text = self::getStatusInfo($model->status, 'text'); - $model->status_type = self::getStatusInfo($model->status, 'type'); - } +// foreach ($list->models as &$model) { +// $model->status_text = self::getStatusInfo($model->status, 'text'); +// $model->status_type = self::getStatusInfo($model->status, 'type'); +// } return $list; }