|
@@ -0,0 +1,401 @@
|
|
1
|
+<template>
|
|
2
|
+ <!-- <div class="main-contain outpatientChargesManagement">
|
|
3
|
+ <div class="position">
|
|
4
|
+ <bread-crumb :crumbs='crumbs'></bread-crumb>
|
|
5
|
+ </div> -->
|
|
6
|
+ <div>
|
|
7
|
+ <div style="display: flex;justify-content: space-between;margin-bottom:10px;">
|
|
8
|
+ <div>
|
|
9
|
+
|
|
10
|
+ <el-select size="small" v-model="item_type" placeholder="请选择"
|
|
11
|
+ style="width:150px;margin-left:10px;" @change="changeItem">
|
|
12
|
+ <el-option
|
|
13
|
+ label="全部"
|
|
14
|
+ value="0">
|
|
15
|
+ </el-option>
|
|
16
|
+ <el-option
|
|
17
|
+ v-for="(item,index) in items"
|
|
18
|
+ :key="index"
|
|
19
|
+ :label="item.name"
|
|
20
|
+ :value="item.id">
|
|
21
|
+ </el-option>
|
|
22
|
+ </el-select>
|
|
23
|
+
|
|
24
|
+ <div class="mainCell" style="margin-bottom:10px;">
|
|
25
|
+ <el-input size="small" v-model.trim="search_input"
|
|
26
|
+ class="filter-item"/>
|
|
27
|
+ <el-button size="small" style="margin-left:10px;" class="filter-item" type="primary"
|
|
28
|
+ @click="searchAction">
|
|
29
|
+ 搜索
|
|
30
|
+ </el-button>
|
|
31
|
+ </div>
|
|
32
|
+
|
|
33
|
+ <el-date-picker
|
|
34
|
+ v-model="chargeDate"
|
|
35
|
+ type="daterange"
|
|
36
|
+ value-format="yyyy-MM-dd"
|
|
37
|
+ range-separator="至"
|
|
38
|
+ start-placeholder="开始日期"
|
|
39
|
+ @change="changeDate"
|
|
40
|
+ end-placeholder="结束日期">
|
|
41
|
+ </el-date-picker>
|
|
42
|
+ </div>
|
|
43
|
+ </div>
|
|
44
|
+ <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="table"
|
|
45
|
+ :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
|
|
46
|
+ show-summary
|
|
47
|
+ max-height="600"
|
|
48
|
+ v-loading="detail_loading"
|
|
49
|
+ highlight-current-row>
|
|
50
|
+ <el-table-column type="index" label="序号" width="60px" align="center"></el-table-column>
|
|
51
|
+ <el-table-column align="center" prop="name" label="处方日期">
|
|
52
|
+ <template slot-scope="scope">{{ }}</template>
|
|
53
|
+ </el-table-column>
|
|
54
|
+ <el-table-column align="center" prop="name" label="费用编码">
|
|
55
|
+ <template slot-scope="scope">{{scope.row.code}}</template>
|
|
56
|
+ </el-table-column>
|
|
57
|
+ <el-table-column align="center" prop="name" label="项目名称">
|
|
58
|
+ <template slot-scope="scope">{{scope.row.item_name}}</template>
|
|
59
|
+ </el-table-column>
|
|
60
|
+ <el-table-column align="center" prop="name" label="规格">
|
|
61
|
+ <template slot-scope="scope">{{scope.row.item_spec}}</template>
|
|
62
|
+ </el-table-column>
|
|
63
|
+ <el-table-column align="center" prop="name" label="数量">
|
|
64
|
+ <template slot-scope="scope">{{scope.row.count}}</template>
|
|
65
|
+ </el-table-column>
|
|
66
|
+ <el-table-column align="center" prop="name" label="单价">
|
|
67
|
+ <template slot-scope="scope">{{scope.row.price.toFixed(2)}}</template>
|
|
68
|
+ </el-table-column>
|
|
69
|
+ <el-table-column align="center" prop="name" label="金额">
|
|
70
|
+ <template slot-scope="scope">
|
|
71
|
+ <div>{{(scope.row.price.toFixed(2)*scope.row.count).toFixed(2)}}</div>
|
|
72
|
+ </template>
|
|
73
|
+ </el-table-column>
|
|
74
|
+
|
|
75
|
+ </el-table>
|
|
76
|
+ </div>
|
|
77
|
+
|
|
78
|
+ <!-- </div> -->
|
|
79
|
+</template>
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+<script>
|
|
83
|
+import BreadCrumb from '@/xt_pages/components/bread-crumb'
|
|
84
|
+import { GetSummaryDetail } from '@/api/his/his'
|
|
85
|
+import { uParseTime } from '@/utils/tools'
|
|
86
|
+import axios from 'axios'
|
|
87
|
+const moment = require('moment')
|
|
88
|
+export default {
|
|
89
|
+ components: {
|
|
90
|
+ BreadCrumb
|
|
91
|
+
|
|
92
|
+ },
|
|
93
|
+ data() {
|
|
94
|
+ return {
|
|
95
|
+ detail_loading: false,
|
|
96
|
+ tempArr: [],
|
|
97
|
+ pos: 0,
|
|
98
|
+ search_input: '',
|
|
99
|
+
|
|
100
|
+ sameRowArr: [],
|
|
101
|
+ keywords: '',
|
|
102
|
+ tableData: [],
|
|
103
|
+ chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
|
|
104
|
+ item_type: '0',
|
|
105
|
+ items: [
|
|
106
|
+ { id: 1, name: '药品' },
|
|
107
|
+ { id: 3, name: '耗材' },
|
|
108
|
+ { id: 2, name: '项目' }
|
|
109
|
+
|
|
110
|
+ ]
|
|
111
|
+
|
|
112
|
+ }
|
|
113
|
+ },
|
|
114
|
+ methods: {
|
|
115
|
+ searchAction(){
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+ },
|
|
119
|
+ changeDate() {
|
|
120
|
+ this.getSummaryDetailList()
|
|
121
|
+ },
|
|
122
|
+ changeItem() {
|
|
123
|
+ this.getSummaryDetailList()
|
|
124
|
+ },
|
|
125
|
+ getSummaryDetailList() {
|
|
126
|
+ this.detail_loading = true
|
|
127
|
+ let start_time = this.chargeDate[0]
|
|
128
|
+ let end_time = this.chargeDate[1]
|
|
129
|
+ let params = {
|
|
130
|
+ start_time: start_time,
|
|
131
|
+ end_time: end_time,
|
|
132
|
+ type: this.item_type,
|
|
133
|
+ keyword: this.keywords
|
|
134
|
+ }
|
|
135
|
+ GetSummaryDetail(params).then(response => {
|
|
136
|
+ if (response.data.state == 0) {
|
|
137
|
+ this.detail_loading = false
|
|
138
|
+
|
|
139
|
+ this.$message.error(response.data.msg)
|
|
140
|
+ return false
|
|
141
|
+ } else {
|
|
142
|
+ this.detail_loading = false
|
|
143
|
+
|
|
144
|
+ this.tableData = []
|
|
145
|
+ let tempPatients = []
|
|
146
|
+ let tempPatientsTwo = []
|
|
147
|
+
|
|
148
|
+ let tempData = response.data.data.patients
|
|
149
|
+ let data = response.data.data.patients
|
|
150
|
+ let orders = this.unique(tempData)
|
|
151
|
+ for (let i = 0; i < orders.length; i++) {
|
|
152
|
+ let obj = {
|
|
153
|
+ patient_id: orders[i].id,
|
|
154
|
+ name: orders[i].name,
|
|
155
|
+ orders: []
|
|
156
|
+ }
|
|
157
|
+ for (let b = 0; b < data.length; b++) {
|
|
158
|
+ if (orders[i].id == data[b].id) {
|
|
159
|
+ obj.orders = obj.orders.concat(data[b].orders)
|
|
160
|
+ }
|
|
161
|
+ }
|
|
162
|
+ tempPatients.push(obj)
|
|
163
|
+ }
|
|
164
|
+
|
|
165
|
+ for (let i = 0; i < tempPatients.length; i++) {
|
|
166
|
+ let obj = {
|
|
167
|
+ patient_id: tempPatients[i].patient_id,
|
|
168
|
+ name: tempPatients[i].name,
|
|
169
|
+ order_info: []
|
|
170
|
+ }
|
|
171
|
+ let orders = tempPatients[i].orders
|
|
172
|
+ for (let b = 0; b < orders.length; b++) {
|
|
173
|
+ for (let c = 0; c < orders[b].order_info.length; c++) {
|
|
174
|
+ let newObj = {}
|
|
175
|
+
|
|
176
|
+ newObj['count'] = orders[b].order_info[c].cnt
|
|
177
|
+ newObj['price'] = orders[b].order_info[c].pric
|
|
178
|
+ if (orders[b].order_info[c].advice_id > 0 && orders[b].order_info[c].project_id == 0) {
|
|
179
|
+ newObj['type'] = 1
|
|
180
|
+ newObj['item_name'] = orders[b].order_info[c].advice.advice_name
|
|
181
|
+ newObj['item_id'] = orders[b].order_info[c].advice.drug_id
|
|
182
|
+
|
|
183
|
+ if (orders[b].order_info[c].advice.drug.min_unit != orders[b].order_info[c].advice.drug.dose_unit) {
|
|
184
|
+ newObj['item_spec'] = orders[b].order_info[c].advice.drug.dose + orders[b].order_info[c].advice.drug.dose_unit + '*' + orders[b].order_info[c].advice.drug.min_number + orders[b].order_info[c].advice.drug.min_unit + '/' + orders[b].order_info[c].advice.drug.max_unit
|
|
185
|
+ } else {
|
|
186
|
+
|
|
187
|
+ newObj['item_spec'] = ''
|
|
188
|
+ }
|
|
189
|
+
|
|
190
|
+ }
|
|
191
|
+ if (orders[b].order_info[c].advice_id == 0 && orders[b].order_info[c].project_id > 0) {
|
|
192
|
+ newObj['type'] = 2
|
|
193
|
+ newObj['item_id'] = orders[b].order_info[c].project.project_id
|
|
194
|
+
|
|
195
|
+ if (orders[b].order_info[c].project.type == 2) {
|
|
196
|
+ newObj['item_spec'] =""
|
|
197
|
+ newObj['item_name'] = orders[b].order_info[c].project.project.project_name
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+ } else if (orders[b].order_info[c].project.type == 3) {
|
|
201
|
+ newObj['item_spec'] = orders[b].order_info[c].project.good_info.specification_name
|
|
202
|
+ newObj['item_name'] = orders[b].order_info[c].project.good_info.good_name
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+ }
|
|
206
|
+ }
|
|
207
|
+ obj.order_info.push(newObj)
|
|
208
|
+ }
|
|
209
|
+ }
|
|
210
|
+ tempPatientsTwo.push(obj)
|
|
211
|
+ }
|
|
212
|
+
|
|
213
|
+ for (let d = 0; d < tempPatientsTwo.length; d++) {
|
|
214
|
+ tempPatientsTwo[d]['new_order_info'] = []
|
|
215
|
+ let project = []
|
|
216
|
+ let advice = []
|
|
217
|
+ for (let b = 0; b < tempPatientsTwo[d].order_info.length; b++) {
|
|
218
|
+ if (tempPatientsTwo[d].order_info[b].type == 1) {
|
|
219
|
+ advice.push(tempPatientsTwo[d].order_info[b])
|
|
220
|
+ } else {
|
|
221
|
+ project.push(tempPatientsTwo[d].order_info[b])
|
|
222
|
+ }
|
|
223
|
+ }
|
|
224
|
+ project = this.uniqueProjectAndAdvice(project)
|
|
225
|
+ advice = this.uniqueProjectAndAdvice(advice)
|
|
226
|
+
|
|
227
|
+ for (let i = 0; i < project.length; i++) {
|
|
228
|
+ let obj = {}
|
|
229
|
+ let count = 0
|
|
230
|
+ for (let a = 0; a < tempPatientsTwo[d].order_info.length; a++) {
|
|
231
|
+ if (project[i].item_id == tempPatientsTwo[d].order_info[a].item_id && project[i].price == tempPatientsTwo[d].order_info[a].price) {
|
|
232
|
+ count = count + tempPatientsTwo[d].order_info[a].count
|
|
233
|
+ }
|
|
234
|
+ }
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+ obj['price'] = project[i].price
|
|
239
|
+ obj['type'] = project[i].type
|
|
240
|
+ obj['item_name'] = project[i].item_name
|
|
241
|
+ obj['item_spec'] = project[i].item_spec
|
|
242
|
+
|
|
243
|
+ obj['item_id'] = project[i].item_id
|
|
244
|
+ obj['name'] = tempPatientsTwo[d].name
|
|
245
|
+ obj['patient_id'] = tempPatientsTwo[d].patient_id
|
|
246
|
+ obj['count'] = count
|
|
247
|
+ tempPatientsTwo[d].new_order_info.push(obj)
|
|
248
|
+ }
|
|
249
|
+
|
|
250
|
+ for (let i = 0; i < advice.length; i++) {
|
|
251
|
+ let obj = {}
|
|
252
|
+ let count = 0
|
|
253
|
+ for (let a = 0; a < tempPatientsTwo[d].order_info.length; a++) {
|
|
254
|
+ if (advice[i].item_id == tempPatientsTwo[d].order_info[a].item_id && advice[i].price == tempPatientsTwo[d].order_info[a].price) {
|
|
255
|
+ count = count + tempPatientsTwo[d].order_info[a].count
|
|
256
|
+ }
|
|
257
|
+ }
|
|
258
|
+
|
|
259
|
+ obj['price'] = advice[i].price
|
|
260
|
+ obj['type'] = advice[i].type
|
|
261
|
+ obj['item_name'] = advice[i].item_name
|
|
262
|
+ obj['item_spec'] = advice[i].item_spec
|
|
263
|
+ obj['item_id'] = advice[i].item_id
|
|
264
|
+ obj['name'] = tempPatientsTwo[d].name
|
|
265
|
+ obj['patient_id'] = tempPatientsTwo[d].patient_id
|
|
266
|
+ obj['count'] = count
|
|
267
|
+ tempPatientsTwo[d].new_order_info.push(obj)
|
|
268
|
+ }
|
|
269
|
+
|
|
270
|
+ }
|
|
271
|
+
|
|
272
|
+ for (let i = 0; i < tempPatientsTwo.length; i++) {
|
|
273
|
+ let total = 0
|
|
274
|
+ for (let b = 0; b < tempPatientsTwo[i].new_order_info.length; b++) {
|
|
275
|
+ let new_name = tempPatientsTwo[i].new_order_info[b].item_name
|
|
276
|
+ // console.log('3 ' + new_name)
|
|
277
|
+ if (new_name != undefined){
|
|
278
|
+ // console.log('3 ' + tempPatientsTwo[i].new_order_info[b].patient_id)
|
|
279
|
+ // console.log('3 ' + tempPatientsTwo[i].new_order_info[b].price)
|
|
280
|
+ // console.log('3 ' + tempPatientsTwo[i].new_order_info[b].count)
|
|
281
|
+ //
|
|
282
|
+ // new_name = new_name.replace('( ', '')
|
|
283
|
+ // new_name = new_name.replace(' )', '')
|
|
284
|
+ if (new_name.length != 0) {
|
|
285
|
+ total = parseFloat(total) + parseFloat((parseFloat(tempPatientsTwo[i].new_order_info[b].count.toString()) * parseFloat(tempPatientsTwo[i].new_order_info[b].price.toString().toString())).toFixed(2))
|
|
286
|
+ }
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+ }
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+ }
|
|
294
|
+ tempPatientsTwo[i]['total'] = total
|
|
295
|
+ }
|
|
296
|
+ console.log('tempPatientsTwo', tempPatientsTwo)
|
|
297
|
+ for (let i = 0; i < tempPatientsTwo.length; i++) {
|
|
298
|
+ // console.log(111,tempPatientsTwo[i].total)
|
|
299
|
+ if (tempPatientsTwo[i].new_order_info.length > 0) {
|
|
300
|
+
|
|
301
|
+ for (let b = 0; b < tempPatientsTwo[i].new_order_info.length; b++) {
|
|
302
|
+ // let new_name = tempPatientsTwo[i].new_order_info[b].item_name
|
|
303
|
+ // console.log('2 ' + new_name)
|
|
304
|
+ //
|
|
305
|
+ // new_name = new_name.replace('( ', '')
|
|
306
|
+ // new_name = new_name.replace(' )', '')
|
|
307
|
+
|
|
308
|
+ let obj = {
|
|
309
|
+ name: tempPatientsTwo[i].name,
|
|
310
|
+ patient_id: tempPatientsTwo[i].patient_id,
|
|
311
|
+ price: tempPatientsTwo[i].new_order_info[b].price,
|
|
312
|
+ type: tempPatientsTwo[i].new_order_info[b].type,
|
|
313
|
+ item_name: tempPatientsTwo[i].new_order_info[b].item_name,
|
|
314
|
+ item_id: tempPatientsTwo[i].new_order_info[b].item_id,
|
|
315
|
+ count: tempPatientsTwo[i].new_order_info[b].count,
|
|
316
|
+ item_spec: tempPatientsTwo[i].new_order_info[b].item_spec
|
|
317
|
+ }
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+ // if(b == 0){
|
|
321
|
+ obj['total'] = tempPatientsTwo[i].total
|
|
322
|
+ // }else{
|
|
323
|
+ // obj['total'] = 0
|
|
324
|
+ // }
|
|
325
|
+ this.tableData.push(obj)
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+ }
|
|
329
|
+ }
|
|
330
|
+ }
|
|
331
|
+ this.handleSpanTempArr()
|
|
332
|
+ // this.tableData = tempPatientsTwo
|
|
333
|
+
|
|
334
|
+ // console.log(tempPatientsTwo.length)
|
|
335
|
+ //
|
|
336
|
+
|
|
337
|
+ }
|
|
338
|
+ //
|
|
339
|
+ // console.log('去重前')
|
|
340
|
+ // console.log(advice)
|
|
341
|
+ // console.log(project)
|
|
342
|
+ // //
|
|
343
|
+ // //
|
|
344
|
+
|
|
345
|
+ // //
|
|
346
|
+ // console.log('去重后')
|
|
347
|
+ //
|
|
348
|
+ // console.log(advice.length)
|
|
349
|
+ // console.log(project.length)
|
|
350
|
+ //
|
|
351
|
+ // for (let i = 0; i < project.length; i++) {
|
|
352
|
+ // let obj = {}
|
|
353
|
+ // let count = 0
|
|
354
|
+ // for (let a = 0; a < tempPatientsTwo.length; a++) {
|
|
355
|
+ // if (project[i].patient_id == tempPatientsTwo[a].patient_id && project[i].item_id == tempPatientsTwo[a].item_id && project[i].price == tempPatientsTwo[a].price) {
|
|
356
|
+ // count = count + tempPatientsTwo[a].count
|
|
357
|
+ // obj['count'] = count
|
|
358
|
+ //
|
|
359
|
+ // }
|
|
360
|
+ // obj['price'] = project[i].price
|
|
361
|
+ // obj['type'] = project[i].type
|
|
362
|
+ // obj['item_name'] = project[i].item_name
|
|
363
|
+ // obj['item_id'] = project[i].item_id
|
|
364
|
+ // obj['name'] = project[i].name
|
|
365
|
+ // obj['patient_id'] = project[i].patient_id
|
|
366
|
+ // obj['count'] = count
|
|
367
|
+ // this.tableData.push(obj)
|
|
368
|
+ // }
|
|
369
|
+ // }
|
|
370
|
+ //
|
|
371
|
+ //
|
|
372
|
+ // for (let i = 0; i < advice.length; i++) {
|
|
373
|
+ // let obj = {}
|
|
374
|
+ // let count = 0
|
|
375
|
+ // for (let a = 0; a < tempPatientsTwo.length; a++) {
|
|
376
|
+ // if (advice[i].patient_id == tempPatientsTwo[a].patient_id && advice[i].item_id == tempPatientsTwo[a].item_id && advice[i].price == tempPatientsTwo[a].price) {
|
|
377
|
+ // count = count + tempPatientsTwo[a].count
|
|
378
|
+ // obj['count'] = count
|
|
379
|
+ //
|
|
380
|
+ // }
|
|
381
|
+ // obj['price'] = advice[i].price
|
|
382
|
+ // obj['type'] = advice[i].type
|
|
383
|
+ // obj['item_name'] = advice[i].item_name
|
|
384
|
+ // obj['item_id'] = advice[i].item_id
|
|
385
|
+ // obj['name'] = advice[i].name
|
|
386
|
+ // obj['patient_id'] = advice[i].patient_id
|
|
387
|
+ // this.tableData.push(obj)
|
|
388
|
+ // }
|
|
389
|
+ // }
|
|
390
|
+ // console.log(this.tableData.length)
|
|
391
|
+ // this.tableData = this.sort(this.tableData)
|
|
392
|
+
|
|
393
|
+ })
|
|
394
|
+ },
|
|
395
|
+ },
|
|
396
|
+ created() {
|
|
397
|
+ this.getSummaryDetailList()
|
|
398
|
+
|
|
399
|
+ }
|
|
400
|
+}
|
|
401
|
+</script>
|