diff --git a/admin/src/views/consumer/prescription/index.vue b/admin/src/views/consumer/prescription/index.vue
index f9e54a36..c469c81e 100644
--- a/admin/src/views/consumer/prescription/index.vue
+++ b/admin/src/views/consumer/prescription/index.vue
@@ -1246,7 +1246,7 @@
@@ -1691,6 +1691,7 @@ import {
prescriptionLibraryLists
} from '@/api/tcm'
import { medicineLists } from '@/api/medicine'
+import { searchPatients as searchPatientsAPI } from '@/api/order'
import { getDictData } from '@/api/app'
import { roleAll } from '@/api/perms/role'
import { usePaging } from '@/hooks/usePaging'
@@ -2351,6 +2352,12 @@ async function openCreateOrderFromPrescription(row: any) {
}
}
+/** 患者选项展示「诊单ID + 医助」,避免同名患者选错诊单导致支付单错绑 */
+function formatPatientOptionLabel(item: any) {
+ const base = `诊单#${item.id} ${item.patient_name || '-'} (${item.phone || '无手机'})`
+ return item.assistant_name ? `${base} · 医助:${item.assistant_name}` : base
+}
+
async function searchPatientsForOrder(query: string) {
if (!query) {
createOrderPatientList.value = []
diff --git a/admin/src/views/order/index.vue b/admin/src/views/order/index.vue
index d4f1484b..71bcc83c 100644
--- a/admin/src/views/order/index.vue
+++ b/admin/src/views/order/index.vue
@@ -546,7 +546,7 @@
@@ -646,7 +646,7 @@
@@ -1006,6 +1006,12 @@ const editOrderRules = {
order_type: [{ required: true, message: '请选择订单类型', trigger: 'change' }]
}
+// 患者选项展示「诊单ID + 医助」,避免同名患者选错诊单导致支付单错绑
+const formatPatientOptionLabel = (item: any) => {
+ const base = `诊单#${item.id} ${item.patient_name || '-'} (${item.phone || '无手机'})`
+ return item.assistant_name ? `${base} · 医助:${item.assistant_name}` : base
+}
+
// 搜索患者
const searchPatients = async (query: string) => {
if (!query) {
diff --git a/server/app/adminapi/controller/tcm/DiagnosisController.php b/server/app/adminapi/controller/tcm/DiagnosisController.php
index d1eb592f..a14308bf 100755
--- a/server/app/adminapi/controller/tcm/DiagnosisController.php
+++ b/server/app/adminapi/controller/tcm/DiagnosisController.php
@@ -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();