Compare commits
1
Commits
20260708
...
master6-12
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c97cac5e4d |
@@ -1246,7 +1246,7 @@
|
||||
<el-option
|
||||
v-for="item in createOrderPatientList"
|
||||
:key="item.id"
|
||||
:label="`${item.patient_name} (${item.phone || '无手机'})`"
|
||||
:label="formatPatientOptionLabel(item)"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
@@ -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 = []
|
||||
|
||||
@@ -546,7 +546,7 @@
|
||||
<el-option
|
||||
v-for="item in patientList"
|
||||
:key="item.id"
|
||||
:label="`${item.patient_name} (${item.phone})`"
|
||||
:label="formatPatientOptionLabel(item)"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
@@ -646,7 +646,7 @@
|
||||
<el-option
|
||||
v-for="item in editPatientList"
|
||||
:key="item.id"
|
||||
:label="`${item.patient_name || '-'} (${item.phone || '-'})`"
|
||||
:label="formatPatientOptionLabel(item)"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
@@ -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) {
|
||||
|
||||
@@ -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