Commit 88712760 by 赵增煜

详情页显示调整

parent 375271f9
......@@ -102,12 +102,27 @@ protected function detail($id)
$show->field('agent');
$show->field('patient_name');
$show->field('patient_mobile');
$show->field('patient_gender');
$show->field('patient_gender')->using(ExternalPrescriptionModel::SEX_MAP)->width(3);
$show->field('patient_age');
$show->field('patient_id_card');
$show->field('doctor_name');
$show->field('diagnosis');
$show->field('drug_info');
$show->field('drug_info')->display(function ($drugInfoJson) {
// 尝试将 $drugInfoJson 解码为数组
$drugInfoArray = json_decode($drugInfoJson, true);
// 检查解码是否成功且 $drugInfoArray 是一个数组
if (is_array($drugInfoArray)) {
// 使用 array_map 来格式化每个药物的信息
$formattedDrugs = array_map(function ($item) {
return $item['drug_name'] . ' : ' . ($item['drug_spec'] ?? '') . ' : ' . $item['drug_num'];
}, $drugInfoArray);
// 将数组转换为以逗号分隔的字符串(或根据您的需求进行其他格式化)
return implode(', ', $formattedDrugs);
} else {
// 如果解码失败或 $drugInfoJson 不是一个有效的 JSON 字符串,返回原始值或错误消息
return $drugInfoJson; // 或者返回一个错误消息,如 'Invalid JSON'
}
})->label(); // 设置列的标签
$show->field('pharmacist_name');
$show->field('review_at');
$show->field('pharmacist_attr');
......
......@@ -117,12 +117,27 @@ protected function detail($id)
$show->field('agent');
$show->field('patient_name');
$show->field('patient_mobile');
$show->field('patient_gender');
$show->field('patient_gender')->using(ExternalPrescriptionModel::SEX_MAP)->width(3);
$show->field('patient_age');
$show->field('patient_id_card');
$show->field('doctor_name');
$show->field('diagnosis');
$show->field('drug_info');
$show->field('drug_info')->display(function ($drugInfoJson) {
// 尝试将 $drugInfoJson 解码为数组
$drugInfoArray = json_decode($drugInfoJson, true);
// 检查解码是否成功且 $drugInfoArray 是一个数组
if (is_array($drugInfoArray)) {
// 使用 array_map 来格式化每个药物的信息
$formattedDrugs = array_map(function ($item) {
return $item['drug_name'] . ' : ' . ($item['drug_spec'] ?? '') . ' : ' . $item['drug_num'];
}, $drugInfoArray);
// 将数组转换为以逗号分隔的字符串(或根据您的需求进行其他格式化)
return implode(', ', $formattedDrugs);
} else {
// 如果解码失败或 $drugInfoJson 不是一个有效的 JSON 字符串,返回原始值或错误消息
return $drugInfoJson; // 或者返回一个错误消息,如 'Invalid JSON'
}
})->label(); // 设置列的标签
$show->field('pharmacist_name');
$show->field('review_at');
$show->field('pharmacist_attr');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment