feat: 支持患者列表按最近挂号筛选

- tcm.diagnosis/lists 新增最近有效挂号时间区间与渠道筛选,lists/count 共用过滤逻辑

- 诊单患者列表更多筛选增加最近挂号时间和渠道,并与顶部挂号快捷筛选互斥

- 明确 daterange-picker change 事件转发,列表补充最近挂号渠道摘要展示
This commit is contained in:
2026-06-06 15:58:23 +08:00
parent b9486f32fe
commit e79f3190b8
3 changed files with 329 additions and 2 deletions
@@ -7,6 +7,7 @@
:end-placeholder="endPlaceholder"
:value-format="valueFormat"
clearable
@change="emit('change', $event)"
></el-date-picker>
</template>
@@ -29,7 +30,7 @@ const props = withDefaults(
endPlaceholder: '结束时间'
}
)
const emit = defineEmits(['update:startTime', 'update:endTime'])
const emit = defineEmits(['update:startTime', 'update:endTime', 'change'])
const content = computed<any>({
get: () => {
+115 -1
View File
@@ -14,6 +14,7 @@
formData.pending_assign !== '1' &&
formData.pending_booking !== '1' &&
formData.completed_appointment !== '1' &&
!hasLatestAppointmentFilter() &&
formData.appointment_date === tab.value
}
]"
@@ -110,6 +111,32 @@
<el-select v-model="formData.assistant_id" placeholder="医助" clearable filterable size="small" @change="doSearch">
<el-option v-for="item in assistantOptions" :key="item.id" :label="item.name" :value="Number(item.id)" />
</el-select>
<daterange-picker
class="latest-appointment-range"
v-model:startTime="formData.latest_appointment_start_date"
v-model:endTime="formData.latest_appointment_end_date"
picker-type="daterange"
value-format="YYYY-MM-DD"
start-placeholder="最近挂号开始"
end-placeholder="最近挂号结束"
@change="handleLatestAppointmentFilterChange"
/>
<el-select
v-model="formData.latest_appointment_channel_source"
placeholder="最近挂号渠道"
clearable
filterable
size="small"
class="latest-appointment-channel"
@change="handleLatestAppointmentFilterChange"
>
<el-option
v-for="item in channelOptions"
:key="String(item.value)"
:label="item.name"
:value="String(item.value)"
/>
</el-select>
<el-button size="small" @click="handleReset">重置</el-button>
</div>
</el-card>
@@ -213,6 +240,9 @@
<div class="apt-doctor">{{ row.appointment_doctor_name || '-' }}</div>
<div class="apt-time">{{ row.appointment_time_text || '-' }}</div>
</template>
<div v-if="latestAppointmentChannelText(row)" class="apt-latest-channel">
最近渠道{{ latestAppointmentChannelText(row) }}
</div>
</template>
<span v-else class="apt-none">未挂号</span>
</div>
@@ -689,6 +719,7 @@ import useUserStore from '@/stores/modules/user'
import { useRoute, useRouter } from 'vue-router'
import { computed, defineAsyncComponent, onMounted, onUnmounted, watch } from 'vue'
import dayjs from 'dayjs'
import DaterangePicker from '@/components/daterange-picker/index.vue'
const EditPopup = defineAsyncComponent(() => import('./edit.vue'))
const DetailPopup = defineAsyncComponent(() => import('./detail.vue'))
@@ -728,6 +759,9 @@ const formData = reactive({
assistant_id: '',
start_time: '',
end_time: '',
latest_appointment_start_date: '' as string,
latest_appointment_end_date: '' as string,
latest_appointment_channel_source: '' as string,
diagnosis_confirmed: '' as '' | '0' | '1',
appointment_date: '' as string,
has_appointment: '' as '' | '0' | '1',
@@ -760,6 +794,9 @@ const setHasAppointment = (v: string) => {
formData.has_appointment = v as '' | '0' | '1'
formData.pending_booking = ''
formData.completed_appointment = ''
if (v === '0') {
clearLatestAppointmentFilters()
}
pager.page = 1
getLists()
fetchDateCounts()
@@ -823,6 +860,9 @@ function buildPendingAssignCountPayload(): Record<string, unknown> {
has_appointment: '',
pending_booking: '',
completed_appointment: '',
latest_appointment_start_date: '',
latest_appointment_end_date: '',
latest_appointment_channel_source: '',
pending_assign_order_month: resolvePendingAssignOrderMonthForRequest()
} as Record<string, unknown>) as Record<string, unknown>
}
@@ -850,6 +890,9 @@ function clearSecondaryFiltersWhenPendingAssignWideSearch() {
formData.assistant_id = ''
formData.start_time = ''
formData.end_time = ''
formData.latest_appointment_start_date = ''
formData.latest_appointment_end_date = ''
formData.latest_appointment_channel_source = ''
formData.pending_assign_order_month = ''
activeTab.value = 'all'
if (kw1 !== '') {
@@ -886,6 +929,7 @@ const handleDateTabClick = async (value: string) => {
formData.pending_booking = ''
formData.completed_appointment = ''
formData.has_appointment = ''
clearLatestAppointmentFilters()
formData.appointment_date = value
pager.page = 1
await getLists()
@@ -901,6 +945,7 @@ const handlePendingBookingTabClick = async () => {
formData.completed_appointment = ''
formData.appointment_date = ''
formData.has_appointment = '0'
clearLatestAppointmentFilters()
pager.page = 1
await getLists()
fetchDateCounts()
@@ -915,6 +960,7 @@ const handleCompletedVisitTabClick = async () => {
formData.completed_appointment = '1'
formData.has_appointment = ''
formData.appointment_date = ''
clearLatestAppointmentFilters()
pager.page = 1
await getLists()
fetchDateCounts()
@@ -926,6 +972,7 @@ const handlePendingAssignTabClick = async () => {
formData.completed_appointment = ''
formData.has_appointment = ''
formData.appointment_date = ''
clearLatestAppointmentFilters()
if (!formData.pending_assign_order_month) {
formData.pending_assign_order_month = dayjs().format('YYYY-MM')
}
@@ -1047,16 +1094,29 @@ const handleMoreCommand = (cmd: string) => {
const diagnosisTypeOptions = ref<any[]>([])
const syndromeTypeOptions = ref<any[]>([])
const assistantOptions = ref<any[]>([])
const channelOptions = ref<Array<{ name: string; value: string }>>([])
const getDictOptions = async () => {
try {
const [diagnosisType, syndromeType, assistants] = await Promise.all([
const [diagnosisType, syndromeType, channels, assistants] = await Promise.all([
getDictData({ type: 'diagnosis_type' }),
getDictData({ type: 'syndrome_type' }),
getDictData({ type: 'channels' }),
getAssistants()
])
diagnosisTypeOptions.value = diagnosisType?.diagnosis_type || []
syndromeTypeOptions.value = syndromeType?.syndrome_type || []
channelOptions.value = (channels?.channels || [])
.filter((row: any) => row.status !== 0)
.sort((a: any, b: any) => {
const ds = Number(b?.sort ?? 0) - Number(a?.sort ?? 0)
if (ds !== 0) return ds
return Number(b?.id ?? 0) - Number(a?.id ?? 0)
})
.map((row: any) => ({
name: String(row?.name ?? row?.value ?? ''),
value: row?.value != null && row.value !== '' ? String(row.value) : ''
}))
assistantOptions.value = assistants || []
} catch (error) {
console.error('获取字典数据失败:', error)
@@ -1069,6 +1129,40 @@ const getDictLabel = (options: any[], value: string) => {
return item ? item.name : value || '-'
}
const clearLatestAppointmentFilters = () => {
formData.latest_appointment_start_date = ''
formData.latest_appointment_end_date = ''
formData.latest_appointment_channel_source = ''
}
const hasLatestAppointmentFilter = () =>
!!(
formData.latest_appointment_start_date ||
formData.latest_appointment_end_date ||
formData.latest_appointment_channel_source
)
const handleLatestAppointmentFilterChange = () => {
if (hasLatestAppointmentFilter()) {
formData.appointment_date = ''
formData.pending_booking = ''
formData.completed_appointment = ''
if (formData.has_appointment === '0') {
formData.has_appointment = ''
}
}
doSearch()
}
const latestAppointmentChannelText = (row: any) => {
const desc = String(row?.latest_appointment_channel_source_desc || '').trim()
const raw = String(row?.latest_appointment_channel_source || '').trim()
const detail = String(row?.latest_appointment_channel_source_detail || '').trim()
const base = desc || raw
if (!base) return ''
return detail ? `${base}${detail}` : base
}
// 获取医助名称
const getAssistantName = (assistantId: number | string) => {
// 如果没有assistant_id,返回"-"
@@ -1103,6 +1197,9 @@ const handleReset = () => {
formData.diagnosis_type = ''
formData.syndrome_type = ''
formData.assistant_id = ''
formData.latest_appointment_start_date = ''
formData.latest_appointment_end_date = ''
formData.latest_appointment_channel_source = ''
formData.diagnosis_confirmed = ''
formData.appointment_date = ''
formData.has_appointment = ''
@@ -2190,10 +2287,20 @@ onUnmounted(() => {
.filter-more {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 10px;
margin-top: 8px;
padding-top: 8px;
border-top: 1px dashed var(--el-border-color-lighter);
.latest-appointment-range {
width: 260px;
max-width: 100%;
}
.latest-appointment-channel {
width: 170px;
}
}
.list-card {
@@ -2363,6 +2470,13 @@ onUnmounted(() => {
font-size: 13px;
color: var(--el-text-color-placeholder);
}
.apt-latest-channel {
margin-top: 6px;
font-size: 12px;
line-height: 1.35;
color: var(--el-text-color-secondary);
}
}
.status-confirmed {