更新
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user