1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<template>
<div class="flex flex-col pt-2 search">
<div class="flex items-center px-4 pb-1 shrink-0 top-bar">
<span class="shrink-0 pr-2 back-bt" @click="toBack">
<doc-icon type="doc-left-1" style="color: #262626"/>
</span>
<div class="grow flex items-center mr-2 input-box">
<!-- <doc-icon type="doc-search" class="shrink-0" style="color: #595959"/> -->
<van-field v-model="idCard" placeholder="请输入身份证号查询"
autocomplete="off"
clearable
:formatter="formatter"
@clear="idCardClear"
ref="idCardField"/>
<IdCardScan>
<doc-icon type="doc-camera" class="shrink-0 mr-3" style="color: #575B66"/>
</IdCardScan>
</div>
<span class="text-16 shrink-0 text-primary" @click="search">
搜索
</span>
</div>
<div class="grow px-4 overflow-y-auto">
<div class="pt-3" v-if="state === 1">
<div class="flex justify-between items-end pt-2 pb-1">
<span class="text-16 font-semibold">搜索历史</span>
<span class="flex items-center"
@click="clearHistory">
<doc-icon type="doc-delete" style="color: #8c8c8c"/>
<span class="ml-1" style="color: #595959">清除历史</span>
</span>
</div>
<div class="flex flex-wrap mt-4 history-list">
<span v-for="item in history" :key="item"
@click="toSearch(item)">{{ $idCardHide(item) }}</span>
</div>
</div>
<div class="pt-2" v-if="state === 2">
<div class="text-12" style="color: #8c8c8c">查找结果:</div>
<div class="card" >
<!-- v-if="result.chronicTagsArrayName || result.firstScreenResult || result.highTagsArray" -->
<div class="py-3">
<span class="text-16 font-semibold mr-3">{{ result.residentName }}</span>
<span class="text-12 mr-3">{{ result.currentAge || '-' }} 岁</span>
<span class="text-12 mr-3">{{ result.genderName }}</span>
<span class="text-12" v-if="result.chronicStatus == 9">死亡</span>
</div>
<div class="mb-2">
<span class="label">身份证号</span>
<span>{{ $idCardHide(result.idCard) }}</span>
</div>
<div class="mb-2">
<span class="label">人群分类</span>
<span>{{ result.chronicCrowdName || '-' }}</span>
</div>
<!-- <div class="flex mb-2">
<span class="shrink-0 label">专病高危评估</span>
<span>{{ result.highTagsArrayName || '-' }}</span>
</div> -->
<div class="flex mb-2">
<span class="shrink-0 label">慢病标签</span>
<ChronicTag :list="result.chronicTagsArray"/>
<!-- <span>{{ result.chronicTagsArrayName }}</span> -->
</div>
<div class="text-12 tip">
<div style="color: #A5AEBE;" >提示:</div>
<div style="color: #768092;">如需为居民进行 慢病诊断筛查 ,请在医生PC端进行操作</div>
</div>
<div class="text-center mt-5">
<van-button round type="primary" class="detail-bt" @click="toDetail">详情</van-button>
</div>
</div>
<!-- <div class="card" v-else-if="!!result.id">
<div class="py-3">
<span class="text-16 font-semibold mr-3">{{ result.residentName }}</span>
<span class="text-12 mr-3">{{ result.currentAge || '-' }} 岁</span>
<span class="text-12">{{ result.genderName }}</span>
</div>
<div class="mb-2">
<span class="label">身份证号</span>
<span>{{ $idCardHide(result.idCard) }}</span>
</div>
<div class="text-12 tip">
<div style="color: #A5AEBE;" >提示:</div>
<div style="color: #768092;">如需为居民进行 慢病诊断筛查 ,请在医生PC端进行操作</div>
</div>
</div> -->
<div class="text-center empty" v-if="!total">
<img src="@/assets/image/doctor/empty.png" alt="" style="width: 1.2rem;">
<p>暂无数据</p>
</div>
</div>
</div>
</div>
</template>
<script>
import { getResidentByPage } from '@/api/doctor/resident.js'
import { validateIdCard } from '@/utils/commonReg.js'
import { setLocalStorage, getLocalStorage } from '@/utils/common.js'
import { showFailToast } from 'vant'
import ChronicTag from '@/doctor/components/chronicTag/ChronicTag.vue'
import IdCardScan from '@/doctor/components/idCardScan/IdCardScan.vue'
export default {
components: {
ChronicTag,
IdCardScan
},
data() {
return {
// 查询使用
idCard: undefined,
// 历史记录
history: [],
result: {},
// 显示切换
state: 1,
total: 0,
show: false,
value1: undefined,
value2: undefined
}
},
computed: {
historyKey() {
return 'search-history'
},
},
created() {
this.history = getLocalStorage(this.historyKey) || []
},
methods: {
formatter(value) {
return value.replace(/[\u4e00-\u9fa5/\s+/]|[^a-zA-Z0-9\u4E00-\u9FA5]/g, '');
},
search() {
if (!this.idCard) return
if (!validateIdCard(this.idCard)) {
showFailToast('请输入正确的身份证号')
return
}
const query = {
idCard: this.idCard,
pageIndex: 1,
pageSize: 10
}
getResidentByPage(query).then(res => {
const result = res?.data?.dataList || []
this.result = result[0] || {}
this.total = res.data.total || 0
this.setHistory()
}).finally(() => {
this.state = 2
})
},
toSearch(idCard) {
this.idCard = idCard
this.search()
},
toDetail() {
this.$router.push({
path: `/doctor/patient-detail`,
query: {
residentInfoId: this.result.residentInfoId
}
})
},
toBack() {
this.$router.back()
},
idCardClear() {
this.state = 1
},
setHistory() {
const history = getLocalStorage(this.historyKey) || []
const index = history.findIndex(e => e === this.idCard)
if (index > -1) {
history.splice(index, 1)
}
history.unshift(this.idCard)
if (history.length > 8) {
history.pop()
}
this.history = history
setLocalStorage(this.historyKey, history)
},
clearHistory() {
setLocalStorage(this.historyKey, [])
this.history = []
}
}
}
</script>
<style lang="less" scoped>
.search {
height: 100vh;
}
.top-bar {
border-bottom: 1px solid #e5e5e5;
.back-bt {
flex-basis: 24px;
text-align: center;
}
.input-box {
background-color: #FAFAFA;
border: 1px solid #F5F5F5;
border-radius: 4px;
.svg-icon {
font-size: 16px;
}
.van-cell {
font-size: 14px;
padding: 4px 10px;
background: transparent;
&::after {
display: none;
}
}
}
}
.history-list {
gap: 10px;
>span {
border-radius: 34px;
background-color: #EFF2F7;
padding: 2px 12px;
}
}
.card {
line-height: 1.2;
.label {
display: inline-block;
color: #8C8C8C;
min-width: 8em;
}
.tip {
background-color: #F8FAFC;
padding: 8px 10px;
line-height: 1.5;
}
.detail-bt {
color: #607FF0;
background-color: #F0F3FF;
border: 0;
width: 50%;
height: 32px;
}
}
</style>