升级php版本后错误修复

This commit is contained in:
2024-12-02 09:02:37 +08:00
parent 8cccdec06d
commit dc37829fa1
2 changed files with 12 additions and 8 deletions

View File

@@ -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;
}
/**

View File

@@ -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;
}