|
@@ -0,0 +1,866 @@
|
|
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
|
+ <!--<el-button size="small" style="margin-left:10px;" class="filter-item" type="primary"-->
|
|
10
|
+ <!--@click="Action">-->
|
|
11
|
+ <!--导出-->
|
|
12
|
+ <!--</el-button>-->
|
|
13
|
+ <el-input size="small" style="width:150px;" v-model="keywords" @input="searchAction"
|
|
14
|
+ @keyup.enter.native='searchAction'
|
|
15
|
+ placeholder="请输入患者姓名"
|
|
16
|
+ class="filter-item"/>
|
|
17
|
+ <el-select size="small" v-model="item_type" placeholder="请选择"
|
|
18
|
+ style="width:150px;margin-left:10px;" @change="changeItem">
|
|
19
|
+ <el-option
|
|
20
|
+ label="全部"
|
|
21
|
+ value="0">
|
|
22
|
+ </el-option>
|
|
23
|
+ <el-option
|
|
24
|
+ v-for="item,index in items"
|
|
25
|
+ :key="index"
|
|
26
|
+ :label="item.name"
|
|
27
|
+ :value="item.id">
|
|
28
|
+ </el-option>
|
|
29
|
+ </el-select>
|
|
30
|
+
|
|
31
|
+ <el-select size="small" v-model="item_time_type" placeholder="请选择"
|
|
32
|
+ style="width:150px;margin-left:10px;" @change="changeTimeItem">
|
|
33
|
+ <el-option
|
|
34
|
+ label="处方时间"
|
|
35
|
+ value="0">
|
|
36
|
+ </el-option>
|
|
37
|
+ <el-option
|
|
38
|
+ label="结算时间"
|
|
39
|
+ value="1">
|
|
40
|
+ </el-option>
|
|
41
|
+ </el-select>
|
|
42
|
+
|
|
43
|
+ <el-date-picker
|
|
44
|
+ v-model="chargeDate"
|
|
45
|
+ type="daterange"
|
|
46
|
+ value-format="yyyy-MM-dd"
|
|
47
|
+ range-separator="至"
|
|
48
|
+ start-placeholder="开始日期"
|
|
49
|
+ @change="handleDateChange"
|
|
50
|
+ end-placeholder="结束日期">
|
|
51
|
+ </el-date-picker>
|
|
52
|
+ <!--<el-radio v-model="radio" label="1">明细</el-radio>-->
|
|
53
|
+ <!--<el-radio v-model="radio" label="2">汇总</el-radio>-->
|
|
54
|
+ </div>
|
|
55
|
+ <div>
|
|
56
|
+ <!-- <el-popover
|
|
57
|
+ placement="bottom"
|
|
58
|
+ width="210"
|
|
59
|
+ trigger="click">
|
|
60
|
+ <el-button size="small" ref="button_two" @click="open(1)">打印清单</el-button>
|
|
61
|
+ <el-button size="small" ref="button_six" @click="open(2)">打印汇总</el-button>
|
|
62
|
+ <el-button slot="reference" style="margin:0 10px;" type="primary" size="small">打印</el-button>
|
|
63
|
+
|
|
64
|
+ </el-popover> -->
|
|
65
|
+ <el-button size="small" type="primary" @click="export_detail">报表下载</el-button>
|
|
66
|
+ </div>
|
|
67
|
+ </div>
|
|
68
|
+ <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="table"
|
|
69
|
+ :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
|
|
70
|
+ :span-method="merge"
|
|
71
|
+ show-summary
|
|
72
|
+ :summary-method="getTotal"
|
|
73
|
+ max-height="600"
|
|
74
|
+
|
|
75
|
+ v-loading="detail_loading"
|
|
76
|
+ highlight-current-row>
|
|
77
|
+
|
|
78
|
+ <el-table-column align="center" prop="name" label="患者名字">
|
|
79
|
+ <template slot-scope="scope">{{ scope.row.name }}</template>
|
|
80
|
+ </el-table-column>
|
|
81
|
+ <el-table-column align="center" prop="name" label="处方日期">
|
|
82
|
+ <template slot-scope="scope">{{ scope.row.name }}</template>
|
|
83
|
+ </el-table-column>
|
|
84
|
+ <!--<el-table-column align="center" prop="name" label="患者类型">-->
|
|
85
|
+ <!--<template slot-scope="scope"></template>-->
|
|
86
|
+ <!--</el-table-column>-->
|
|
87
|
+ <el-table-column align="center" prop="name" label="费用类型">
|
|
88
|
+ <template slot-scope="scope">{{ scope.row.name }}</template>
|
|
89
|
+ </el-table-column>
|
|
90
|
+
|
|
91
|
+ <el-table-column align="center" prop="name" label="处方类型">
|
|
92
|
+ <template slot-scope="scope">{{ scope.row.name }}</template>
|
|
93
|
+ </el-table-column>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+ <el-table-column align="center" prop="name" label="项目名称">
|
|
97
|
+ <template slot-scope="scope">{{scope.row.item_name}}</template>
|
|
98
|
+ </el-table-column>
|
|
99
|
+
|
|
100
|
+ <el-table-column align="center" prop="name" label="规格型号">
|
|
101
|
+ <template slot-scope="scope">{{scope.row.item_spec}}</template>
|
|
102
|
+ </el-table-column>
|
|
103
|
+
|
|
104
|
+ <el-table-column align="center" prop="name" label="数量">
|
|
105
|
+ <template slot-scope="scope">{{scope.row.count}}</template>
|
|
106
|
+ </el-table-column>
|
|
107
|
+
|
|
108
|
+ <el-table-column align="center" prop="name" label="单位">
|
|
109
|
+ <template slot-scope="scope">{{scope.row.count}}</template>
|
|
110
|
+ </el-table-column>
|
|
111
|
+
|
|
112
|
+ <el-table-column align="center" prop="name" label="单价">
|
|
113
|
+ <template slot-scope="scope">{{scope.row.price.toFixed(2)}}</template>
|
|
114
|
+ </el-table-column>
|
|
115
|
+
|
|
116
|
+ <el-table-column align="center" prop="name" label="金额">
|
|
117
|
+ <template slot-scope="scope">
|
|
118
|
+ <div>{{((scope.row.price*scope.row.count).toFixed(2))}}</div>
|
|
119
|
+ </template>
|
|
120
|
+ </el-table-column>
|
|
121
|
+
|
|
122
|
+ <el-table-column align="center" prop="name" label="是否结算">
|
|
123
|
+ <template slot-scope="scope">{{scope.row.price.toFixed(2)}}</template>
|
|
124
|
+ </el-table-column>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+ <el-table-column align="center" prop="name" label="结算日期">
|
|
128
|
+ <template slot-scope="scope">{{scope.row.price.toFixed(2)}}</template>
|
|
129
|
+ </el-table-column>
|
|
130
|
+
|
|
131
|
+ </el-table>
|
|
132
|
+ </div>
|
|
133
|
+
|
|
134
|
+ <!-- </div> -->
|
|
135
|
+</template>
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+<script>
|
|
139
|
+import BreadCrumb from '@/xt_pages/components/bread-crumb'
|
|
140
|
+import { GetSummaryDetail } from '@/api/his/his'
|
|
141
|
+import { uParseTime } from '@/utils/tools'
|
|
142
|
+import axios from 'axios'
|
|
143
|
+import pako from 'pako';
|
|
144
|
+// import NewStatementPrint from './newStatementPrint'
|
|
145
|
+const moment = require('moment')
|
|
146
|
+export default {
|
|
147
|
+ components: {
|
|
148
|
+ BreadCrumb
|
|
149
|
+
|
|
150
|
+ },
|
|
151
|
+ data() {
|
|
152
|
+ return {
|
|
153
|
+ pickerOptions: {
|
|
154
|
+ disabledDate(time) {
|
|
155
|
+ // 获取当前日期
|
|
156
|
+ const now = new Date();
|
|
157
|
+
|
|
158
|
+ // 设置一个月后的日期
|
|
159
|
+ const oneMonthLater = new Date();
|
|
160
|
+ oneMonthLater.setMonth(oneMonthLater.getMonth() + 1);
|
|
161
|
+
|
|
162
|
+ // 如果当前日期在一个月后之后,则禁用
|
|
163
|
+ return time.getTime() > oneMonthLater.getTime() || time.getTime() < now.getTime();
|
|
164
|
+ },
|
|
165
|
+ },
|
|
166
|
+ detail_loading: false,
|
|
167
|
+ tempArr: [],
|
|
168
|
+ pos: 0,
|
|
169
|
+
|
|
170
|
+ sameRowArr: [],
|
|
171
|
+ keywords: '',
|
|
172
|
+ tableData: [],
|
|
173
|
+ chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
|
|
174
|
+ item_type: '0',
|
|
175
|
+ item_time_type:'0',
|
|
176
|
+ items: [
|
|
177
|
+ { id: 1, name: '未结算' },
|
|
178
|
+ { id: 2, name: '已结算' },
|
|
179
|
+ ]
|
|
180
|
+
|
|
181
|
+ }
|
|
182
|
+ },
|
|
183
|
+ methods: {
|
|
184
|
+ handleDateChangetwo(value) {
|
|
185
|
+ this.$confirm('提示', '接口优化升级,如有数据需要,请联系客服!', {
|
|
186
|
+ confirmButtonText: '确 定',
|
|
187
|
+ cancelButtonText: '取 消',
|
|
188
|
+ type: 'warning'
|
|
189
|
+ }).then(() => {
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+ }).catch(() => {
|
|
193
|
+ })
|
|
194
|
+
|
|
195
|
+ // let start_time = this.chargeDate[0]
|
|
196
|
+ // let end_time = this.chargeDate[1]
|
|
197
|
+ // const dateObj1 = new Date(start_time);
|
|
198
|
+ // const dateObj2 = new Date(end_time);
|
|
199
|
+ //
|
|
200
|
+ // // 计算两个日期之间的月份差
|
|
201
|
+ // const monthDifference = (dateObj2.getFullYear() - dateObj1.getFullYear()) * 12 +
|
|
202
|
+ // (dateObj2.getMonth() - dateObj1.getMonth());
|
|
203
|
+ // if (monthDifference >= 1){
|
|
204
|
+ // this.$message.error("时间间隔不能超出一个月")
|
|
205
|
+ // return
|
|
206
|
+ // }else{
|
|
207
|
+ // this.getSummaryDetailList()
|
|
208
|
+ // }
|
|
209
|
+
|
|
210
|
+ },
|
|
211
|
+
|
|
212
|
+ handleDateChange(value) {
|
|
213
|
+ // let start_time = this.chargeDate[0]
|
|
214
|
+ // let end_time = this.chargeDate[1]
|
|
215
|
+ // const dateObj1 = new Date(start_time);
|
|
216
|
+ // const dateObj2 = new Date(end_time);
|
|
217
|
+ //
|
|
218
|
+ // // 计算两个日期之间的月份差
|
|
219
|
+ // const monthDifference = (dateObj2.getFullYear() - dateObj1.getFullYear()) * 12 +
|
|
220
|
+ // (dateObj2.getMonth() - dateObj1.getMonth());
|
|
221
|
+ // if (monthDifference >= 1){
|
|
222
|
+ // this.$message.error("时间间隔不能超出一个月")
|
|
223
|
+ // return
|
|
224
|
+ // }else{
|
|
225
|
+ // this.getSummaryDetailListtwo()
|
|
226
|
+ // }
|
|
227
|
+ this.getSummaryDetailList()
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+ },
|
|
231
|
+ Action(){
|
|
232
|
+ var that = this
|
|
233
|
+ axios.get('http://127.0.0.1:9531/handelExcel', {
|
|
234
|
+ params: {}
|
|
235
|
+ })
|
|
236
|
+ .then(function(response) {
|
|
237
|
+ if (response.data.state == 0) {
|
|
238
|
+ that.$message.error(response.data.msg)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+ return false
|
|
242
|
+ } else {
|
|
243
|
+
|
|
244
|
+ var list = []
|
|
245
|
+ for(let i = 0; i < response.data.data.list.length; i++){
|
|
246
|
+ let team = response.data.data.list[i]
|
|
247
|
+ for(let b = 0; b < team.list.length; b++){
|
|
248
|
+ let name = ""
|
|
249
|
+ if(team.list[b].type == 2){
|
|
250
|
+ name = team.list[b].project.project_name
|
|
251
|
+ }else{
|
|
252
|
+
|
|
253
|
+ name = team.list[b].good_info.good_name
|
|
254
|
+
|
|
255
|
+ }
|
|
256
|
+
|
|
257
|
+ let obj = {
|
|
258
|
+ '客户组合编码': team.id,
|
|
259
|
+ '客户组合名称': team.project_team,
|
|
260
|
+ '客户单项编码': team.list[b].id,
|
|
261
|
+ '客户单项名称': name,
|
|
262
|
+ '中心组合编码': '',
|
|
263
|
+ '中心组合名称': '',
|
|
264
|
+ '中心单项编码': '',
|
|
265
|
+ '中心单项名称': '',
|
|
266
|
+ }
|
|
267
|
+
|
|
268
|
+ list.push(obj)
|
|
269
|
+ }
|
|
270
|
+ }
|
|
271
|
+
|
|
272
|
+ import('@/vendor/Export2Excel').then(excel => {
|
|
273
|
+ const tHeader = [ '客户组合编码', '客户组合名称', '客户单项编码', '客户单项名称', '中心组合编码', '中心组合名称', '中心单项编码', '中心单项名称']
|
|
274
|
+ const filterVal = [ '客户组合编码', '客户组合名称', '客户单项编码', '客户单项名称', '中心组合编码', '中心组合名称', '中心单项编码', '中心单项名称']
|
|
275
|
+ const data = that.formatJson(filterVal, list)
|
|
276
|
+ excel.export_json_to_excel({
|
|
277
|
+ header: tHeader,
|
|
278
|
+ data,
|
|
279
|
+ filename: "消费明细"
|
|
280
|
+ })
|
|
281
|
+ })
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+ }
|
|
285
|
+ })
|
|
286
|
+ .catch(function(error) {
|
|
287
|
+
|
|
288
|
+ })
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+ },formatJson(filterVal, jsonData) {
|
|
294
|
+ return jsonData.map(v => filterVal.map(j => v[j]))
|
|
295
|
+ },
|
|
296
|
+ objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
297
|
+ if (columnIndex === 0) {
|
|
298
|
+ if (rowIndex % 2 === 0) {
|
|
299
|
+ return {
|
|
300
|
+ rowspan: 2,
|
|
301
|
+ colspan: 1
|
|
302
|
+ }
|
|
303
|
+ } else {
|
|
304
|
+ return {
|
|
305
|
+ rowspan: 0,
|
|
306
|
+ colspan: 0
|
|
307
|
+ }
|
|
308
|
+ }
|
|
309
|
+ }
|
|
310
|
+ },
|
|
311
|
+ unique(arr) {
|
|
312
|
+ const res = new Map()
|
|
313
|
+ return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1))
|
|
314
|
+ },
|
|
315
|
+ uniquepid(arr) {
|
|
316
|
+ const res = new Map()
|
|
317
|
+ return arr.filter((arr) => !res.has(arr.p_id) && res.set(arr.p_id, 1))
|
|
318
|
+ },
|
|
319
|
+ changeDate() {
|
|
320
|
+ this.getSummaryDetailList()
|
|
321
|
+ },
|
|
322
|
+ changeItem() {
|
|
323
|
+ this.getSummaryDetailList()
|
|
324
|
+ },changeTimeItem(){
|
|
325
|
+
|
|
326
|
+ this.getSummaryDetailList()
|
|
327
|
+
|
|
328
|
+ },
|
|
329
|
+ searchAction() {
|
|
330
|
+ this.item_type = '0'
|
|
331
|
+ this.getSummaryDetailList()
|
|
332
|
+
|
|
333
|
+ }, getSummaryDetailListtwo() {
|
|
334
|
+ this.detail_loading = true
|
|
335
|
+ let start_time = this.chargeDate[0]
|
|
336
|
+ let end_time = this.chargeDate[1]
|
|
337
|
+ let params = {
|
|
338
|
+ start_time: start_time,
|
|
339
|
+ end_time: end_time,
|
|
340
|
+ type: this.item_type,
|
|
341
|
+ keyword: this.keywords
|
|
342
|
+ }
|
|
343
|
+ GetSummaryDetail(params).then(response => {
|
|
344
|
+ if (response.data.state == 0) {
|
|
345
|
+ this.detail_loading = false
|
|
346
|
+
|
|
347
|
+ this.$message.error(response.data.msg)
|
|
348
|
+ return false
|
|
349
|
+ } else {
|
|
350
|
+ this.detail_loading = false
|
|
351
|
+
|
|
352
|
+ this.$confirm('提示', '接口优化升级,如有数据需要,请联系客服!', {
|
|
353
|
+ confirmButtonText: '确 定',
|
|
354
|
+ cancelButtonText: '取 消',
|
|
355
|
+ type: 'warning'
|
|
356
|
+ }).then(() => {
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+ }).catch(() => {
|
|
360
|
+ })
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+ }
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+ //
|
|
369
|
+ // console.log('去重前')
|
|
370
|
+ // console.log(advice)
|
|
371
|
+ // console.log(project)
|
|
372
|
+ // //
|
|
373
|
+ // //
|
|
374
|
+
|
|
375
|
+ // //
|
|
376
|
+ // console.log('去重后')
|
|
377
|
+ //
|
|
378
|
+ // console.log(advice.length)
|
|
379
|
+ // console.log(project.length)
|
|
380
|
+ //
|
|
381
|
+ // for (let i = 0; i < project.length; i++) {
|
|
382
|
+ // let obj = {}
|
|
383
|
+ // let count = 0
|
|
384
|
+ // for (let a = 0; a < tempPatientsTwo.length; a++) {
|
|
385
|
+ // if (project[i].patient_id == tempPatientsTwo[a].patient_id && project[i].item_id == tempPatientsTwo[a].item_id && project[i].price == tempPatientsTwo[a].price) {
|
|
386
|
+ // count = count + tempPatientsTwo[a].count
|
|
387
|
+ // obj['count'] = count
|
|
388
|
+ //
|
|
389
|
+ // }
|
|
390
|
+ // obj['price'] = project[i].price
|
|
391
|
+ // obj['type'] = project[i].type
|
|
392
|
+ // obj['item_name'] = project[i].item_name
|
|
393
|
+ // obj['item_id'] = project[i].item_id
|
|
394
|
+ // obj['name'] = project[i].name
|
|
395
|
+ // obj['patient_id'] = project[i].patient_id
|
|
396
|
+ // obj['count'] = count
|
|
397
|
+ // this.tableData.push(obj)
|
|
398
|
+ // }
|
|
399
|
+ // }
|
|
400
|
+ //
|
|
401
|
+ //
|
|
402
|
+ // for (let i = 0; i < advice.length; i++) {
|
|
403
|
+ // let obj = {}
|
|
404
|
+ // let count = 0
|
|
405
|
+ // for (let a = 0; a < tempPatientsTwo.length; a++) {
|
|
406
|
+ // if (advice[i].patient_id == tempPatientsTwo[a].patient_id && advice[i].item_id == tempPatientsTwo[a].item_id && advice[i].price == tempPatientsTwo[a].price) {
|
|
407
|
+ // count = count + tempPatientsTwo[a].count
|
|
408
|
+ // obj['count'] = count
|
|
409
|
+ //
|
|
410
|
+ // }
|
|
411
|
+ // obj['price'] = advice[i].price
|
|
412
|
+ // obj['type'] = advice[i].type
|
|
413
|
+ // obj['item_name'] = advice[i].item_name
|
|
414
|
+ // obj['item_id'] = advice[i].item_id
|
|
415
|
+ // obj['name'] = advice[i].name
|
|
416
|
+ // obj['patient_id'] = advice[i].patient_id
|
|
417
|
+ // this.tableData.push(obj)
|
|
418
|
+ // }
|
|
419
|
+ // }
|
|
420
|
+ // console.log(this.tableData.length)
|
|
421
|
+ // this.tableData = this.sort(this.tableData)
|
|
422
|
+
|
|
423
|
+ })
|
|
424
|
+ },
|
|
425
|
+ getSummaryDetailList() {
|
|
426
|
+ this.detail_loading = true
|
|
427
|
+ let start_time = this.chargeDate[0]
|
|
428
|
+ let end_time = this.chargeDate[1]
|
|
429
|
+ let params = {
|
|
430
|
+ start_time: start_time,
|
|
431
|
+ end_time: end_time,
|
|
432
|
+ type: this.item_type,
|
|
433
|
+ keyword: this.keywords,
|
|
434
|
+ time_type:this.item_time_type
|
|
435
|
+ }
|
|
436
|
+ GetSummaryDetail(params).then(response => {
|
|
437
|
+ if (response.data.state == 0) {
|
|
438
|
+ this.detail_loading = false
|
|
439
|
+
|
|
440
|
+ this.$message.error(response.data.msg)
|
|
441
|
+ return false
|
|
442
|
+ } else {
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+ this.detail_loading = false
|
|
446
|
+
|
|
447
|
+ this.tableData = []
|
|
448
|
+ let tempPatients = []
|
|
449
|
+ let tempPatientsTwo = []
|
|
450
|
+ //
|
|
451
|
+ let tempData = response.data
|
|
452
|
+ let allData = response.data
|
|
453
|
+ tempData = this.uniquepid(tempData)
|
|
454
|
+ //
|
|
455
|
+ let order_infos = []
|
|
456
|
+ //
|
|
457
|
+ for (let i = 0; i < tempData.length; i++) {
|
|
458
|
+ let obj = {
|
|
459
|
+ patient_id: tempData[i].p_id,
|
|
460
|
+ name: tempData[i].p_name,
|
|
461
|
+ orders: []
|
|
462
|
+ }
|
|
463
|
+ for (let b = 0; b < allData.length; b++) {
|
|
464
|
+ if (tempData[i].p_id == allData[b].p_id) {
|
|
465
|
+ obj.orders = obj.orders.concat(allData[b])
|
|
466
|
+ }
|
|
467
|
+ }
|
|
468
|
+ tempPatients.push(obj)
|
|
469
|
+ }
|
|
470
|
+ console.log(tempPatients)
|
|
471
|
+ //
|
|
472
|
+ for (let i = 0; i < tempPatients.length; i++) {
|
|
473
|
+ let obj = {
|
|
474
|
+ patient_id: tempPatients[i].patient_id,
|
|
475
|
+ name: tempPatients[i].name,
|
|
476
|
+ order_info: []
|
|
477
|
+ }
|
|
478
|
+ let orders = tempPatients[i].orders
|
|
479
|
+
|
|
480
|
+ for (let c = 0; c < orders.length; c++) {
|
|
481
|
+ let newObj = {}
|
|
482
|
+ newObj['count'] = orders[c].cnt
|
|
483
|
+ newObj['price'] = orders[c].pric
|
|
484
|
+ newObj['item_total'] = orders[c].det_item_fee_sumamt
|
|
485
|
+
|
|
486
|
+ if (orders[c].advice_id > 0 && orders[c].project_id == 0) {
|
|
487
|
+ newObj['type'] = 1
|
|
488
|
+ newObj['item_name'] = orders[c].item_name
|
|
489
|
+ newObj['item_id'] = orders[c].item_id
|
|
490
|
+
|
|
491
|
+ if (orders[c].min_unit != orders[c].dose_unit) {
|
|
492
|
+ newObj['item_spec'] = orders[c].dose + orders[c].dose_unit + '*' + orders[c].min_number + orders[c].min_unit + '/' + orders[c].max_unit
|
|
493
|
+ } else {
|
|
494
|
+
|
|
495
|
+ newObj['item_spec'] = ''
|
|
496
|
+ }
|
|
497
|
+
|
|
498
|
+ }
|
|
499
|
+ if (orders[c].advice_id == 0 && orders[c].project_id > 0) {
|
|
500
|
+ newObj['type'] = 2
|
|
501
|
+ newObj['item_id'] = orders[c].item_id
|
|
502
|
+
|
|
503
|
+ if (orders[c].p_type == 2) {
|
|
504
|
+ newObj['item_spec'] =""
|
|
505
|
+ newObj['item_name'] = orders[c].item_name
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+ } else if (orders[c].p_type == 3) {
|
|
509
|
+ newObj['item_spec'] = orders[c].specification_name
|
|
510
|
+ newObj['item_name'] = orders[c].item_name
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+ }
|
|
514
|
+ }
|
|
515
|
+ obj.order_info.push(newObj)
|
|
516
|
+ order_infos.push(orders.order_info)
|
|
517
|
+ }
|
|
518
|
+ tempPatientsTwo.push(obj)
|
|
519
|
+ }
|
|
520
|
+ console.log(tempPatientsTwo)
|
|
521
|
+
|
|
522
|
+ //
|
|
523
|
+ for (let d = 0; d < tempPatientsTwo.length; d++) {
|
|
524
|
+ tempPatientsTwo[d]['new_order_info'] = []
|
|
525
|
+ let project = []
|
|
526
|
+ let advice = []
|
|
527
|
+ for (let b = 0; b < tempPatientsTwo[d].order_info.length; b++) {
|
|
528
|
+ if (tempPatientsTwo[d].order_info[b].type == 1) {
|
|
529
|
+ advice.push(tempPatientsTwo[d].order_info[b])
|
|
530
|
+ } else {
|
|
531
|
+ project.push(tempPatientsTwo[d].order_info[b])
|
|
532
|
+ }
|
|
533
|
+ }
|
|
534
|
+ project = this.uniqueProjectAndAdvice(project)
|
|
535
|
+ advice = this.uniqueProjectAndAdvice(advice)
|
|
536
|
+
|
|
537
|
+ for (let i = 0; i < project.length; i++) {
|
|
538
|
+ let obj = {}
|
|
539
|
+ let count = 0
|
|
540
|
+ for (let a = 0; a < tempPatientsTwo[d].order_info.length; a++) {
|
|
541
|
+ if (project[i].item_id == tempPatientsTwo[d].order_info[a].item_id && project[i].price == tempPatientsTwo[d].order_info[a].price) {
|
|
542
|
+ count = count + tempPatientsTwo[d].order_info[a].count
|
|
543
|
+ }
|
|
544
|
+ }
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+ obj['price'] = project[i].price
|
|
549
|
+ obj['type'] = project[i].type
|
|
550
|
+ obj['item_name'] = project[i].item_name
|
|
551
|
+ obj['item_spec'] = project[i].item_spec
|
|
552
|
+ obj['item_total'] = project[i].item_total
|
|
553
|
+
|
|
554
|
+ obj['item_id'] = project[i].item_id
|
|
555
|
+ obj['name'] = tempPatientsTwo[d].name
|
|
556
|
+ obj['patient_id'] = tempPatientsTwo[d].patient_id
|
|
557
|
+ obj['count'] = count
|
|
558
|
+ tempPatientsTwo[d].new_order_info.push(obj)
|
|
559
|
+ }
|
|
560
|
+
|
|
561
|
+ for (let i = 0; i < advice.length; i++) {
|
|
562
|
+ let obj = {}
|
|
563
|
+ let count = 0
|
|
564
|
+ for (let a = 0; a < tempPatientsTwo[d].order_info.length; a++) {
|
|
565
|
+ if (advice[i].item_id == tempPatientsTwo[d].order_info[a].item_id && advice[i].price == tempPatientsTwo[d].order_info[a].price) {
|
|
566
|
+ count = count + tempPatientsTwo[d].order_info[a].count
|
|
567
|
+ }
|
|
568
|
+ }
|
|
569
|
+
|
|
570
|
+ obj['price'] = advice[i].price
|
|
571
|
+ obj['type'] = advice[i].type
|
|
572
|
+ obj['item_name'] = advice[i].item_name
|
|
573
|
+ obj['item_spec'] = advice[i].item_spec
|
|
574
|
+ obj['item_id'] = advice[i].item_id
|
|
575
|
+ obj['name'] = tempPatientsTwo[d].name
|
|
576
|
+ obj['item_total'] = advice[i].item_total
|
|
577
|
+ obj['patient_id'] = tempPatientsTwo[d].patient_id
|
|
578
|
+ obj['count'] = count
|
|
579
|
+ tempPatientsTwo[d].new_order_info.push(obj)
|
|
580
|
+ }
|
|
581
|
+
|
|
582
|
+ }
|
|
583
|
+ for (let i = 0; i < tempPatientsTwo.length; i++) {
|
|
584
|
+ let total = 0
|
|
585
|
+ for (let b = 0; b < tempPatientsTwo[i].new_order_info.length; b++) {
|
|
586
|
+ let new_name = tempPatientsTwo[i].new_order_info[b].item_name
|
|
587
|
+ if (new_name != undefined){
|
|
588
|
+ if (new_name.length != 0) {
|
|
589
|
+ console.log(parseFloat(tempPatientsTwo[i].new_order_info[b].count) * parseFloat(tempPatientsTwo[i].new_order_info[b].price))
|
|
590
|
+ total = parseFloat(total) + parseFloat((parseFloat(tempPatientsTwo[i].new_order_info[b].count) * parseFloat(tempPatientsTwo[i].new_order_info[b].price)).toFixed(2))
|
|
591
|
+ }
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+ }
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+ }
|
|
599
|
+ tempPatientsTwo[i]['total'] = total
|
|
600
|
+ }
|
|
601
|
+ for (let i = 0; i < tempPatientsTwo.length; i++) {
|
|
602
|
+ // console.log(111,tempPatientsTwo[i].total)
|
|
603
|
+ if (tempPatientsTwo[i].new_order_info.length > 0) {
|
|
604
|
+
|
|
605
|
+ for (let b = 0; b < tempPatientsTwo[i].new_order_info.length; b++) {
|
|
606
|
+ // let new_name = tempPatientsTwo[i].new_order_info[b].item_name
|
|
607
|
+ // console.log('2 ' + new_name)
|
|
608
|
+ //
|
|
609
|
+ // new_name = new_name.replace('( ', '')
|
|
610
|
+ // new_name = new_name.replace(' )', '')
|
|
611
|
+
|
|
612
|
+ let obj = {
|
|
613
|
+ name: tempPatientsTwo[i].name,
|
|
614
|
+ patient_id: tempPatientsTwo[i].patient_id,
|
|
615
|
+ price: tempPatientsTwo[i].new_order_info[b].price,
|
|
616
|
+ type: tempPatientsTwo[i].new_order_info[b].type,
|
|
617
|
+ item_name: tempPatientsTwo[i].new_order_info[b].item_name,
|
|
618
|
+ item_id: tempPatientsTwo[i].new_order_info[b].item_id,
|
|
619
|
+ count: tempPatientsTwo[i].new_order_info[b].count,
|
|
620
|
+ item_spec: tempPatientsTwo[i].new_order_info[b].item_spec
|
|
621
|
+ }
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+ // if(b == 0){
|
|
625
|
+ obj['total'] = tempPatientsTwo[i].total
|
|
626
|
+ // }else{
|
|
627
|
+ // obj['total'] = 0
|
|
628
|
+ // }
|
|
629
|
+ this.tableData.push(obj)
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+ }
|
|
635
|
+ }
|
|
636
|
+ }
|
|
637
|
+ console.log( this.tableData)
|
|
638
|
+ this.handleSpanTempArr()
|
|
639
|
+ // this.tableData = tempPatientsTwo
|
|
640
|
+
|
|
641
|
+ // console.log(tempPatientsTwo.length)
|
|
642
|
+ //
|
|
643
|
+ let advices = []
|
|
644
|
+ let projects = []
|
|
645
|
+ let goods = []
|
|
646
|
+ for(let i = 0; i < order_infos.length; i++){
|
|
647
|
+ if(order_infos[i].advice_id > 0 && order_infos[i].project_id == 0){
|
|
648
|
+ advices.push(order_infos[i].advice)
|
|
649
|
+ }
|
|
650
|
+ if(order_infos[i].advice_id == 0 && order_infos[i].project_id > 0){
|
|
651
|
+ if(order_infos[i].project.type == 3){
|
|
652
|
+ goods.push(order_infos[i].project)
|
|
653
|
+ }
|
|
654
|
+ }
|
|
655
|
+ if(order_infos[i].advice_id == 0 && order_infos[i].project_id > 0){
|
|
656
|
+ if(order_infos[i].project.type == 2){
|
|
657
|
+ projects.push(order_infos[i].project)
|
|
658
|
+ }
|
|
659
|
+ }
|
|
660
|
+ }
|
|
661
|
+
|
|
662
|
+ }
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+ //
|
|
668
|
+ // console.log('去重前')
|
|
669
|
+ // console.log(advice)
|
|
670
|
+ // console.log(project)
|
|
671
|
+ // //
|
|
672
|
+ // //
|
|
673
|
+
|
|
674
|
+ // //
|
|
675
|
+ // console.log('去重后')
|
|
676
|
+ //
|
|
677
|
+ // console.log(advice.length)
|
|
678
|
+ // console.log(project.length)
|
|
679
|
+ //
|
|
680
|
+ // for (let i = 0; i < project.length; i++) {
|
|
681
|
+ // let obj = {}
|
|
682
|
+ // let count = 0
|
|
683
|
+ // for (let a = 0; a < tempPatientsTwo.length; a++) {
|
|
684
|
+ // if (project[i].patient_id == tempPatientsTwo[a].patient_id && project[i].item_id == tempPatientsTwo[a].item_id && project[i].price == tempPatientsTwo[a].price) {
|
|
685
|
+ // count = count + tempPatientsTwo[a].count
|
|
686
|
+ // obj['count'] = count
|
|
687
|
+ //
|
|
688
|
+ // }
|
|
689
|
+ // obj['price'] = project[i].price
|
|
690
|
+ // obj['type'] = project[i].type
|
|
691
|
+ // obj['item_name'] = project[i].item_name
|
|
692
|
+ // obj['item_id'] = project[i].item_id
|
|
693
|
+ // obj['name'] = project[i].name
|
|
694
|
+ // obj['patient_id'] = project[i].patient_id
|
|
695
|
+ // obj['count'] = count
|
|
696
|
+ // this.tableData.push(obj)
|
|
697
|
+ // }
|
|
698
|
+ // }
|
|
699
|
+ //
|
|
700
|
+ //
|
|
701
|
+ // for (let i = 0; i < advice.length; i++) {
|
|
702
|
+ // let obj = {}
|
|
703
|
+ // let count = 0
|
|
704
|
+ // for (let a = 0; a < tempPatientsTwo.length; a++) {
|
|
705
|
+ // if (advice[i].patient_id == tempPatientsTwo[a].patient_id && advice[i].item_id == tempPatientsTwo[a].item_id && advice[i].price == tempPatientsTwo[a].price) {
|
|
706
|
+ // count = count + tempPatientsTwo[a].count
|
|
707
|
+ // obj['count'] = count
|
|
708
|
+ //
|
|
709
|
+ // }
|
|
710
|
+ // obj['price'] = advice[i].price
|
|
711
|
+ // obj['type'] = advice[i].type
|
|
712
|
+ // obj['item_name'] = advice[i].item_name
|
|
713
|
+ // obj['item_id'] = advice[i].item_id
|
|
714
|
+ // obj['name'] = advice[i].name
|
|
715
|
+ // obj['patient_id'] = advice[i].patient_id
|
|
716
|
+ // this.tableData.push(obj)
|
|
717
|
+ // }
|
|
718
|
+ // }
|
|
719
|
+ // console.log(this.tableData.length)
|
|
720
|
+ // this.tableData = this.sort(this.tableData)
|
|
721
|
+
|
|
722
|
+ })
|
|
723
|
+ }, uniqueProjectAndAdvice(array) {
|
|
724
|
+ // res用来存储结果
|
|
725
|
+ var res = []
|
|
726
|
+ for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
|
|
727
|
+ for (var j = 0, resLen = res.length; j < resLen; j++) {
|
|
728
|
+ if (array[i].item_id === res[j].item_id && array[i].price === res[j].price) {
|
|
729
|
+ break
|
|
730
|
+ }
|
|
731
|
+ }
|
|
732
|
+ // 如果array[i]是唯一的,那么执行完循环,j等于resLen
|
|
733
|
+ if (j === resLen) {
|
|
734
|
+ res.push(array[i])
|
|
735
|
+ }
|
|
736
|
+ }
|
|
737
|
+ return res
|
|
738
|
+ }, sort(arr) {
|
|
739
|
+ for (var i = 0; i < arr.length - 1; i++) {
|
|
740
|
+ for (var j = 0; j < arr.length - i - 1; j++) {
|
|
741
|
+ if (arr[j].patient_id > arr[j + 1].patient_id) {// 相邻元素两两对比
|
|
742
|
+ var hand = arr[j]
|
|
743
|
+ arr[j] = arr[j + 1]
|
|
744
|
+ arr[j + 1] = hand
|
|
745
|
+
|
|
746
|
+ }
|
|
747
|
+ }
|
|
748
|
+ }
|
|
749
|
+ return arr
|
|
750
|
+ }, handleSpanTempArr() {
|
|
751
|
+ this.tempArr = []
|
|
752
|
+
|
|
753
|
+ for (let i = 0; i < this.tableData.length; i++) {
|
|
754
|
+ if (i === 0) {
|
|
755
|
+ this.tempArr.push(1)
|
|
756
|
+ this.pos = 0
|
|
757
|
+ } else {
|
|
758
|
+ // 判断当前元素与上一个元素是否相同
|
|
759
|
+ if (this.tableData[i].patient_id === this.tableData[i - 1].patient_id) {
|
|
760
|
+ this.tempArr[this.pos] += 1
|
|
761
|
+ this.tempArr.push(0)
|
|
762
|
+ } else {
|
|
763
|
+ this.tempArr.push(1)
|
|
764
|
+ this.pos = i
|
|
765
|
+ }
|
|
766
|
+ }
|
|
767
|
+ }
|
|
768
|
+
|
|
769
|
+ let sameRowArr = [], sIdx = 0
|
|
770
|
+ this.tableData.forEach((item, index) => {
|
|
771
|
+ item.index = index
|
|
772
|
+ if (index === 0) {
|
|
773
|
+ sameRowArr.push([index])
|
|
774
|
+ } else {
|
|
775
|
+ if (item.patient_id === this.tableData[index - 1].patient_id) {
|
|
776
|
+ sameRowArr[sIdx].push(index)
|
|
777
|
+ } else {
|
|
778
|
+ sIdx = sIdx + 1
|
|
779
|
+ sameRowArr.push([index])
|
|
780
|
+ }
|
|
781
|
+ }
|
|
782
|
+ })
|
|
783
|
+ this.sameRowArr = sameRowArr
|
|
784
|
+ }, merge({ row, column, rowIndex, columnIndex }) {
|
|
785
|
+ if (columnIndex === 0 || columnIndex === 6) {
|
|
786
|
+ const _row = this.tempArr[rowIndex]
|
|
787
|
+ const _col = _row > 0 ? 1 : 0
|
|
788
|
+ return {
|
|
789
|
+ rowspan: _row,
|
|
790
|
+ colspan: _col
|
|
791
|
+ }
|
|
792
|
+ }
|
|
793
|
+ }, export_detail() {
|
|
794
|
+
|
|
795
|
+ let list = []
|
|
796
|
+ for (let i = 0; i < this.tableData.length; i++) {
|
|
797
|
+ let order = this.tableData[i]
|
|
798
|
+ let name = order.name
|
|
799
|
+ let item_name = order.item_name
|
|
800
|
+ let count = order.count
|
|
801
|
+ let price = order.price.toFixed(2)
|
|
802
|
+ let pay_sumamt = (order.price.toFixed(2) * order.count).toFixed(2)
|
|
803
|
+ let total = order.total.toFixed(2)
|
|
804
|
+
|
|
805
|
+ let obj = {
|
|
806
|
+ '患者姓名': name,
|
|
807
|
+ '项目名称': item_name,
|
|
808
|
+ '数量': count,
|
|
809
|
+ '单价': price,
|
|
810
|
+ '费用': pay_sumamt,
|
|
811
|
+ '费用总额': total
|
|
812
|
+ }
|
|
813
|
+ list.push(obj)
|
|
814
|
+ }
|
|
815
|
+ import('@/vendor/Export2Excel').then(excel => {
|
|
816
|
+ const tHeader = ['患者姓名', '项目名称', '数量', '单价', '费用', '费用总额']
|
|
817
|
+ const filterVal = ['患者姓名', '项目名称', '数量', '单价', '费用', '费用总额']
|
|
818
|
+ const data = this.formatJson(filterVal, list)
|
|
819
|
+ excel.export_json_to_excel1({
|
|
820
|
+ header: tHeader,
|
|
821
|
+ data,
|
|
822
|
+ filename: '明细',
|
|
823
|
+ ref: this.$refs['table'].$el
|
|
824
|
+ })
|
|
825
|
+ })
|
|
826
|
+
|
|
827
|
+ }, formatJson(filterVal, jsonData) {
|
|
828
|
+ return jsonData.map(v => filterVal.map(j => v[j]))
|
|
829
|
+ }, getTotal(param) {
|
|
830
|
+ const { columns, data } = param
|
|
831
|
+ const sums = []
|
|
832
|
+ columns.forEach((column, index) => {
|
|
833
|
+ if (index === 0) {
|
|
834
|
+ sums[index] = '合计'
|
|
835
|
+ return
|
|
836
|
+ }
|
|
837
|
+ const values = data.map(item => Number(item[column.property]))
|
|
838
|
+ if (column.property === 'total') {
|
|
839
|
+ // sums[index] = values.reduce((prev, curr) => {
|
|
840
|
+ // const value = Number(curr)
|
|
841
|
+ // if (!isNaN(value)) {
|
|
842
|
+ // return prev + curr
|
|
843
|
+ // } else {
|
|
844
|
+ // return prev
|
|
845
|
+ // }
|
|
846
|
+ // }, 0)
|
|
847
|
+ // sums[index] = sums[index].toFixed(2)
|
|
848
|
+ let num = 0
|
|
849
|
+ data.map(item => {
|
|
850
|
+ num += item.price * item.count
|
|
851
|
+ })
|
|
852
|
+ sums[index] = num.toFixed(2)
|
|
853
|
+ } else {
|
|
854
|
+ sums[index] = ''
|
|
855
|
+ }
|
|
856
|
+ })
|
|
857
|
+
|
|
858
|
+ return sums
|
|
859
|
+ }
|
|
860
|
+ },
|
|
861
|
+ created() {
|
|
862
|
+ this.getSummaryDetailList()
|
|
863
|
+
|
|
864
|
+ }
|
|
865
|
+}
|
|
866
|
+</script>
|