This commit is contained in:
Your Name
2026-06-12 17:48:42 +08:00
parent 08249451a7
commit c97cac5e4d
3 changed files with 31 additions and 4 deletions
@@ -769,12 +769,26 @@ class DiagnosisController extends BaseAdminController
$offset = ($page_no - 1) * $page_size;
$lists = \app\common\model\tcm\Diagnosis::where('patient_name|phone|id_card', 'like', '%' . $keyword . '%')
->field(['id', 'patient_name', 'phone', 'id_card', 'gender', 'age'])
->field(['id', 'patient_name', 'phone', 'id_card', 'gender', 'age', 'assistant_id'])
->limit($offset, $page_size)
->order('id desc')
->select()
->toArray();
// 同名患者需靠「诊单ID + 医助」区分,否则收款单/业务订单会绑错诊单
$assistantIds = array_values(array_unique(array_filter(array_map(
static fn(array $r): int => (int) ($r['assistant_id'] ?? 0),
$lists
))));
$assistantNames = $assistantIds === []
? []
: \app\common\model\auth\Admin::whereIn('id', $assistantIds)->column('name', 'id');
foreach ($lists as &$row) {
$aid = (int) ($row['assistant_id'] ?? 0);
$row['assistant_name'] = $aid > 0 ? (string) ($assistantNames[$aid] ?? '') : '';
}
unset($row);
$count = \app\common\model\tcm\Diagnosis::where('patient_name|phone|id_card', 'like', '%' . $keyword . '%')
->count();