Compare commits

...
1 Commits
Author SHA1 Message Date
Your Name c97cac5e4d 更新 2026-06-12 17:48:42 +08:00
3 changed files with 31 additions and 4 deletions
@@ -1246,7 +1246,7 @@
<el-option <el-option
v-for="item in createOrderPatientList" v-for="item in createOrderPatientList"
:key="item.id" :key="item.id"
:label="`${item.patient_name} (${item.phone || '无手机'})`" :label="formatPatientOptionLabel(item)"
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
@@ -1691,6 +1691,7 @@ import {
prescriptionLibraryLists prescriptionLibraryLists
} from '@/api/tcm' } from '@/api/tcm'
import { medicineLists } from '@/api/medicine' import { medicineLists } from '@/api/medicine'
import { searchPatients as searchPatientsAPI } from '@/api/order'
import { getDictData } from '@/api/app' import { getDictData } from '@/api/app'
import { roleAll } from '@/api/perms/role' import { roleAll } from '@/api/perms/role'
import { usePaging } from '@/hooks/usePaging' 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) { async function searchPatientsForOrder(query: string) {
if (!query) { if (!query) {
createOrderPatientList.value = [] createOrderPatientList.value = []
+8 -2
View File
@@ -546,7 +546,7 @@
<el-option <el-option
v-for="item in patientList" v-for="item in patientList"
:key="item.id" :key="item.id"
:label="`${item.patient_name} (${item.phone})`" :label="formatPatientOptionLabel(item)"
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
@@ -646,7 +646,7 @@
<el-option <el-option
v-for="item in editPatientList" v-for="item in editPatientList"
:key="item.id" :key="item.id"
:label="`${item.patient_name || '-'} (${item.phone || '-'})`" :label="formatPatientOptionLabel(item)"
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
@@ -1006,6 +1006,12 @@ const editOrderRules = {
order_type: [{ required: true, message: '请选择订单类型', trigger: 'change' }] 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) => { const searchPatients = async (query: string) => {
if (!query) { if (!query) {
@@ -769,12 +769,26 @@ class DiagnosisController extends BaseAdminController
$offset = ($page_no - 1) * $page_size; $offset = ($page_no - 1) * $page_size;
$lists = \app\common\model\tcm\Diagnosis::where('patient_name|phone|id_card', 'like', '%' . $keyword . '%') $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) ->limit($offset, $page_size)
->order('id desc') ->order('id desc')
->select() ->select()
->toArray(); ->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 = \app\common\model\tcm\Diagnosis::where('patient_name|phone|id_card', 'like', '%' . $keyword . '%')
->count(); ->count();