Pārlūkot izejas kodu

Merge branch '20230223_pc_vue_new_branch' of http://git.shengws.com/csx/Vue_New into 20230223_pc_vue_new_branch

28169 10 mēnešus atpakaļ
vecāks
revīzija
8b0f599876

+ 10 - 0
src/api/his/his.js Parādīt failu

869
 
869
 
870
 
870
 
871
 
871
 
872
+export function GetPSummaryDetail(params) {
873
+  return request({
874
+    url: '/api/his/prescription/detail',
875
+    method: 'get',
876
+    params: params
877
+  })
878
+}
879
+
880
+
881
+
872
 
882
 
873
 
883
 
874
 
884
 

+ 9 - 0
src/api/his/his_tools.js Parādīt failu

84
 }
84
 }
85
 
85
 
86
 
86
 
87
+export function getPrescriptionInitdata() {
88
+  return request({
89
+    url: '/api/his/prescription/initdata',
90
+    method: 'get',
91
+  })
92
+}
93
+
94
+
95
+
87
 
96
 
88
 
97
 
89
 
98
 

+ 2 - 1
src/lang/zh.js Parādīt failu

291
 
291
 
292
     DepositManagement: '押金管理',
292
     DepositManagement: '押金管理',
293
 
293
 
294
-    summary_tool: '项目消费明细汇总',
294
+    summary_tool: '结算明细汇总',
295
+    p_summary_tool: '处方明细汇总',
295
     labelPrint: '标签打印',
296
     labelPrint: '标签打印',
296
     faPiao: '发票设置',
297
     faPiao: '发票设置',
297
     chargeDetailManagement: '收费明细',
298
     chargeDetailManagement: '收费明细',

+ 5 - 0
src/router/modules/hisTool.js Parādīt failu

77
       component: () => import('@/xt_pages/outpatientTool/summary'),
77
       component: () => import('@/xt_pages/outpatientTool/summary'),
78
       name: 'summary_tool',
78
       name: 'summary_tool',
79
       meta: { title: 'summary_tool', noCache: true }
79
       meta: { title: 'summary_tool', noCache: true }
80
+    }, {
81
+      path: '/hisTool/p_summary',
82
+      component: () => import('@/xt_pages/outpatientTool/PrescriptionSmmary'),
83
+      name: 'p_summary_tool',
84
+      meta: { title: 'p_summary_tool', noCache: true }
80
     },
85
     },
81
     {
86
     {
82
       path: '/hisTool/print',
87
       path: '/hisTool/print',

+ 4 - 2
src/xt_pages/hospitalStation/inHospitalHistory.vue Parādīt failu

72
           <template slot-scope="scope">
72
           <template slot-scope="scope">
73
             <div v-if="scope.row.med_type == 11">普通住院</div>
73
             <div v-if="scope.row.med_type == 11">普通住院</div>
74
             <div v-if="scope.row.med_type == 14">门诊特殊病</div>
74
             <div v-if="scope.row.med_type == 14">门诊特殊病</div>
75
+            <div v-if="scope.row.med_type == 240101">门诊视同住院</div>
75
           </template>
76
           </template>
76
         </el-table-column>
77
         </el-table-column>
77
 
78
 
86
         </el-table-column>
87
         </el-table-column>
87
         <el-table-column align="center" prop="name" label="状态" width="70">
88
         <el-table-column align="center" prop="name" label="状态" width="70">
88
           <template slot-scope="scope">
89
           <template slot-scope="scope">
89
-            <div v-if="scope.row.in_hospital_status == 1 && scope.row.out_hospital_status == 0">{{"在院"}}</div>
90
-            <div v-if="scope.row.in_hospital_status == 1 && scope.row.out_hospital_status == 1">{{"已出院"}}</div>
90
+            <div v-if="scope.row.status == 0">{{"已经撤销出院"}}</div>
91
+            <div v-if="scope.row.status == 1 &&  scope.row.in_hospital_status == 1 && scope.row.out_hospital_status == 0">{{"在院"}}</div>
92
+            <div v-if="scope.row.status == 1 &&  scope.row.in_hospital_status == 1 && scope.row.out_hospital_status == 1">{{"已出院"}}</div>
91
           </template>
93
           </template>
92
         </el-table-column>
94
         </el-table-column>
93
 <!--        <el-table-column align="center" prop="name" label="操作" width="180">-->
95
 <!--        <el-table-column align="center" prop="name" label="操作" width="180">-->

+ 57 - 0
src/xt_pages/outpatientDoctorStation/doctorDesk.vue Parādīt failu

976
             }
976
             }
977
           }
977
           }
978
 
978
 
979
+          for (let i = 0; i < response.data.data.list_three.length; i++) {
980
+            //已就诊
981
+            if (response.data.data.list_three[i].prescription.length > 0) {
982
+              let obj = {
983
+                name: response.data.data.list_three[i].name,
984
+                number: "",
985
+                id: response.data.data.list_three[i].id,
986
+                his_patient_id: 0,
987
+                first_letter: response.data.data.list_three[i].first_letter
988
+              }
989
+              this.cure_data.push(obj)
990
+            }
991
+          }
992
+
979
           this.all_data = this.all_data.concat(this.cure_data)
993
           this.all_data = this.all_data.concat(this.cure_data)
980
           this.all_data = this.all_data.concat(this.un_cure_data)
994
           this.all_data = this.all_data.concat(this.un_cure_data)
981
 
995
 
1155
             }
1169
             }
1156
           }
1170
           }
1157
 
1171
 
1172
+
1158
           //排班
1173
           //排班
1159
           for (let i = 0; i < response.data.data.list_two.length; i++) {
1174
           for (let i = 0; i < response.data.data.list_two.length; i++) {
1160
             // console.log('hahhahahahahahahah', response.data.data.list_two)
1175
             // console.log('hahhahahahahahahah', response.data.data.list_two)
1183
               this.cure_data.push(obj)
1198
               this.cure_data.push(obj)
1184
             }
1199
             }
1185
           }
1200
           }
1201
+          for (let i = 0; i < response.data.data.list_three.length; i++) {
1202
+            //已就诊
1203
+            if (response.data.data.list_three[i].prescription.length > 0) {
1204
+              let obj = {
1205
+                name: response.data.data.list_three[i].name,
1206
+                number: "",
1207
+                id: response.data.data.list_three[i].id,
1208
+                his_patient_id: 0,
1209
+                first_letter: response.data.data.list_three[i].first_letter
1210
+              }
1211
+              this.cure_data.push(obj)
1212
+            }
1213
+          }
1214
+
1186
           // console.log('gggg',this.un_cure_data);
1215
           // console.log('gggg',this.un_cure_data);
1187
           this.all_data = this.all_data.concat(this.cure_data)
1216
           this.all_data = this.all_data.concat(this.cure_data)
1188
           this.all_data = this.all_data.concat(this.un_cure_data)
1217
           this.all_data = this.all_data.concat(this.un_cure_data)
1285
             }
1314
             }
1286
           }
1315
           }
1287
 
1316
 
1317
+          for (let i = 0; i < response.data.data.list_three.length; i++) {
1318
+            //已就诊
1319
+            if (response.data.data.list_three[i].prescription.length > 0) {
1320
+              let obj = {
1321
+                name: response.data.data.list_three[i].name,
1322
+                number: "",
1323
+                id: response.data.data.list_three[i].id,
1324
+                his_patient_id: 0,
1325
+                first_letter: response.data.data.list_three[i].first_letter
1326
+              }
1327
+              this.cure_data.push(obj)
1328
+            }
1329
+          }
1330
+
1288
           this.all_data = this.all_data.concat(this.cure_data)
1331
           this.all_data = this.all_data.concat(this.cure_data)
1289
           this.all_data = this.all_data.concat(this.un_cure_data)
1332
           this.all_data = this.all_data.concat(this.un_cure_data)
1290
 
1333
 
1795
             }
1838
             }
1796
           }
1839
           }
1797
 
1840
 
1841
+          for (let i = 0; i < response.data.data.list_three.length; i++) {
1842
+              //已就诊
1843
+              if (response.data.data.list_three[i].prescription.length > 0) {
1844
+                let obj = {
1845
+                  name: response.data.data.list_three[i].name,
1846
+                  number: "",
1847
+                  id: response.data.data.list_three[i].id,
1848
+                  his_patient_id: 0,
1849
+                  first_letter: response.data.data.list_three[i].first_letter
1850
+                }
1851
+                this.cure_data.push(obj)
1852
+              }
1853
+          }
1854
+
1798
           this.all_data = this.all_data.concat(this.cure_data)
1855
           this.all_data = this.all_data.concat(this.cure_data)
1799
           this.all_data = this.all_data.concat(this.un_cure_data)
1856
           this.all_data = this.all_data.concat(this.un_cure_data)
1800
 
1857
 

+ 0 - 10
src/xt_pages/outpatientTool/PrescriptionSmmary.vue Parādīt failu

10
           <el-tab-pane label="明细" name="明细"></el-tab-pane>
10
           <el-tab-pane label="明细" name="明细"></el-tab-pane>
11
           <el-tab-pane label="汇总" name="汇总"></el-tab-pane>
11
           <el-tab-pane label="汇总" name="汇总"></el-tab-pane>
12
         </el-tabs>
12
         </el-tabs>
13
-<!--        <detail v-if="titleType == '明细'"></detail>-->
14
-<!--        <gather v-if="titleType == '汇总'"></gather>-->
15
         <pdetail v-if="titleType == '明细'"></pdetail>
13
         <pdetail v-if="titleType == '明细'"></pdetail>
16
         <pgather  v-if="titleType == '汇总'"></pgather>
14
         <pgather  v-if="titleType == '汇总'"></pgather>
17
       </div>
15
       </div>
23
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
21
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
24
 import Pdetail from './components/pdetail.vue'
22
 import Pdetail from './components/pdetail.vue'
25
 import Pgather from './components/pgather.vue'
23
 import Pgather from './components/pgather.vue'
26
-
27
-
28
 const moment = require('moment')
24
 const moment = require('moment')
29
-
30
 export default {
25
 export default {
31
   components: {
26
   components: {
32
     Pgather,
27
     Pgather,
33
     Pdetail,
28
     Pdetail,
34
-    Gather,
35
-    Settle,
36
-    Detail,
37
-    SummaryDetail,
38
     BreadCrumb
29
     BreadCrumb
39
-
40
   },
30
   },
41
   data() {
31
   data() {
42
     return {
32
     return {

+ 3 - 6
src/xt_pages/outpatientTool/components/detail.vue Parādīt failu

30
 
30
 
31
             <el-select size="small" v-model="item_time_type" placeholder="请选择"
31
             <el-select size="small" v-model="item_time_type" placeholder="请选择"
32
                        style="width:150px;margin-left:10px;" @change="changeTimeItem">
32
                        style="width:150px;margin-left:10px;" @change="changeTimeItem">
33
-              <el-option
34
-                label="处方时间"
35
-                value="0">
36
-              </el-option>
37
               <el-option
33
               <el-option
38
                 label="结算时间"
34
                 label="结算时间"
39
                 value="1">
35
                 value="1">
150
       tableData: [],
146
       tableData: [],
151
       chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
147
       chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
152
       item_type: '0',
148
       item_type: '0',
153
-      item_time_type:'0',
149
+      item_time_type:'1',
154
       items: [
150
       items: [
155
         { id: 1, name: '药品' },
151
         { id: 1, name: '药品' },
156
         { id: 2, name: '项目' },
152
         { id: 2, name: '项目' },
770
           colspan: _col
766
           colspan: _col
771
         }
767
         }
772
       }
768
       }
773
-    }, export_detail() {
769
+    },
770
+    export_detail() {
774
 
771
 
775
       let list = []
772
       let list = []
776
       for (let i = 0; i < this.tableData.length; i++) {
773
       for (let i = 0; i < this.tableData.length; i++) {

+ 2 - 5
src/xt_pages/outpatientTool/components/gather.vue Parādīt failu

26
         </el-select>
26
         </el-select>
27
         <el-select size="small" v-model="item_time_type" placeholder="请选择"
27
         <el-select size="small" v-model="item_time_type" placeholder="请选择"
28
                    style="width:150px;margin-left:10px;" @change="changeTimeItem">
28
                    style="width:150px;margin-left:10px;" @change="changeTimeItem">
29
-          <el-option
30
-            label="处方时间"
31
-            value="0">
32
-          </el-option>
29
+
33
           <el-option
30
           <el-option
34
             label="结算时间"
31
             label="结算时间"
35
             value="1">
32
             value="1">
116
       tableData: [],
113
       tableData: [],
117
       chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
114
       chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
118
       item_type: '0',
115
       item_type: '0',
119
-      item_time_type:'0',
116
+      item_time_type:'1',
120
       items: [
117
       items: [
121
         { id: 1, name: '药品' },
118
         { id: 1, name: '药品' },
122
         { id: 2, name: '所有项目' },
119
         { id: 2, name: '所有项目' },

+ 255 - 347
src/xt_pages/outpatientTool/components/pdetail.vue Parādīt failu

6
   <div>
6
   <div>
7
     <div style="display: flex;justify-content: space-between;margin-bottom:10px;">
7
     <div style="display: flex;justify-content: space-between;margin-bottom:10px;">
8
       <div>
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"/>
9
+
10
+        <el-autocomplete
11
+          class="checkSearch"
12
+          popper-class="my-autocomplete"
13
+          v-model="search_value"
14
+          :fetch-suggestions="querySearchAsync"
15
+          :trigger-on-focus="false"
16
+          placeholder="病人透析号/姓名"
17
+          @select="handleSelect"
18
+        >
19
+          <i class="el-icon-search el-input__icon" slot="suffix"></i>
20
+          <template slot-scope="{ item }">
21
+            <div class="name">{{ item.name }}</div>
22
+          </template>
23
+        </el-autocomplete>
24
+
25
+
17
         <el-select size="small" v-model="item_type" placeholder="请选择"
26
         <el-select size="small" v-model="item_type" placeholder="请选择"
18
-                   style="width:150px;margin-left:10px;" @change="changeItem">
27
+                   style="width:150px;margin-left:10px;" >
19
           <el-option
28
           <el-option
20
-            label="全部"
29
+            label="不限"
21
             value="0">
30
             value="0">
22
           </el-option>
31
           </el-option>
23
           <el-option
32
           <el-option
28
           </el-option>
37
           </el-option>
29
         </el-select>
38
         </el-select>
30
 
39
 
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
 
40
 
43
         <el-date-picker
41
         <el-date-picker
44
           v-model="chargeDate"
42
           v-model="chargeDate"
46
           value-format="yyyy-MM-dd"
44
           value-format="yyyy-MM-dd"
47
           range-separator="至"
45
           range-separator="至"
48
           start-placeholder="开始日期"
46
           start-placeholder="开始日期"
49
-          @change="handleDateChange"
50
           end-placeholder="结束日期">
47
           end-placeholder="结束日期">
51
         </el-date-picker>
48
         </el-date-picker>
52
         <!--<el-radio v-model="radio" label="1">明细</el-radio>-->
49
         <!--<el-radio v-model="radio" label="1">明细</el-radio>-->
62
           <el-button slot="reference" style="margin:0 10px;" type="primary" size="small">打印</el-button>
59
           <el-button slot="reference" style="margin:0 10px;" type="primary" size="small">打印</el-button>
63
 
60
 
64
         </el-popover> -->
61
         </el-popover> -->
65
-        <el-button size="small" type="primary" @click="export_detail">报表下载</el-button>
62
+        <el-button size="small" type="primary" @click="getSummaryDetailList">查询</el-button>
63
+        <el-button size="small" type="primary" @click="export_detail">下载报表</el-button>
64
+
66
       </div>
65
       </div>
67
     </div>
66
     </div>
68
     <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="table"
67
     <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="table"
69
               :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
68
               :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"
69
               max-height="600"
74
-
75
               v-loading="detail_loading"
70
               v-loading="detail_loading"
76
               highlight-current-row>
71
               highlight-current-row>
77
 
72
 
79
         <template slot-scope="scope">{{ scope.row.name }}</template>
74
         <template slot-scope="scope">{{ scope.row.name }}</template>
80
       </el-table-column>
75
       </el-table-column>
81
       <el-table-column align="center" prop="name" label="处方日期">
76
       <el-table-column align="center" prop="name" label="处方日期">
82
-        <template slot-scope="scope">{{ scope.row.name }}</template>
77
+        <template slot-scope="scope">{{ scope.row.record_date }}</template>
83
       </el-table-column>
78
       </el-table-column>
84
       <!--<el-table-column align="center" prop="name" label="患者类型">-->
79
       <!--<el-table-column align="center" prop="name" label="患者类型">-->
85
       <!--<template slot-scope="scope"></template>-->
80
       <!--<template slot-scope="scope"></template>-->
86
       <!--</el-table-column>-->
81
       <!--</el-table-column>-->
87
       <el-table-column align="center" prop="name" label="费用类型">
82
       <el-table-column align="center" prop="name" label="费用类型">
88
-        <template slot-scope="scope">{{ scope.row.name }}</template>
83
+        <template slot-scope="scope">
84
+          <div v-if="scope.row.type == 1">{{getDrugType(scope.row.item_cost_type)}}</div>
85
+          <div v-if="scope.row.type == 2">{{getCostType(scope.row.item_cost_type)}}</div>
86
+          <div v-if="scope.row.type == 3">耗材</div>
87
+
88
+        </template>
89
       </el-table-column>
89
       </el-table-column>
90
 
90
 
91
       <el-table-column align="center" prop="name" label="处方类型">
91
       <el-table-column align="center" prop="name" label="处方类型">
92
-        <template slot-scope="scope">{{ scope.row.name }}</template>
92
+        <template slot-scope="scope">
93
+          <div v-if="scope.row.med_type == 11">普通门诊</div>
94
+          <div v-if="scope.row.med_type == 14">门诊特殊病</div>
95
+        </template>
93
       </el-table-column>
96
       </el-table-column>
94
 
97
 
95
 
98
 
106
       </el-table-column>
109
       </el-table-column>
107
 
110
 
108
       <el-table-column align="center" prop="name" label="单位">
111
       <el-table-column align="center" prop="name" label="单位">
109
-        <template slot-scope="scope">{{scope.row.count}}</template>
112
+        <template slot-scope="scope">{{scope.row.unit}}</template>
110
       </el-table-column>
113
       </el-table-column>
111
 
114
 
112
       <el-table-column align="center" prop="name" label="单价">
115
       <el-table-column align="center" prop="name" label="单价">
113
         <template slot-scope="scope">{{scope.row.price.toFixed(2)}}</template>
116
         <template slot-scope="scope">{{scope.row.price.toFixed(2)}}</template>
114
       </el-table-column>
117
       </el-table-column>
115
 
118
 
116
-      <el-table-column align="center" prop="name" label="金额">
119
+      <el-table-column align="center" prop="sum" label="金额">
117
         <template slot-scope="scope">
120
         <template slot-scope="scope">
118
           <div>{{((scope.row.price*scope.row.count).toFixed(2))}}</div>
121
           <div>{{((scope.row.price*scope.row.count).toFixed(2))}}</div>
119
         </template>
122
         </template>
120
       </el-table-column>
123
       </el-table-column>
121
 
124
 
122
       <el-table-column align="center" prop="name" label="是否结算">
125
       <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>
126
+        <template slot-scope="scope">{{scope.row.order_status == 2?'已结算':'未结算'}}</template>
129
       </el-table-column>
127
       </el-table-column>
130
 
128
 
131
     </el-table>
129
     </el-table>
137
 
135
 
138
 <script>
136
 <script>
139
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
137
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
140
-import { GetSummaryDetail } from '@/api/his/his'
138
+import { GetPSummaryDetail } from '@/api/his/his'
139
+import { getPrescriptionInitdata } from '@/api/his/his_tools'
140
+
141
+import { PostSearch } from '@/api/patient'
142
+
141
 import { uParseTime } from '@/utils/tools'
143
 import { uParseTime } from '@/utils/tools'
142
 import axios from 'axios'
144
 import axios from 'axios'
143
 import pako from 'pako';
145
 import pako from 'pako';
166
       detail_loading: false,
168
       detail_loading: false,
167
       tempArr: [],
169
       tempArr: [],
168
       pos: 0,
170
       pos: 0,
169
-
171
+      patient_id:0,
170
       sameRowArr: [],
172
       sameRowArr: [],
171
       keywords: '',
173
       keywords: '',
174
+      search_value:"",
175
+      drugTypeList:[],
176
+      costClassifyList:[],
172
       tableData: [],
177
       tableData: [],
173
       chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
178
       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',
179
       item_type: '0',
181
     }
186
     }
182
   },
187
   },
183
   methods: {
188
   methods: {
189
+    export_detail() {
190
+
191
+      let list = []
192
+      for (let i = 0; i < this.tableData.length; i++) {
193
+        let order = this.tableData[i]
194
+        let name = order.name
195
+        let item_name = order.item_name
196
+        let count = order.count
197
+        let price = order.price.toFixed(2)
198
+        let pay_sumamt = (order.price.toFixed(2) * order.count).toFixed(2)
199
+        let total = order.total.toFixed(2)
200
+
201
+        let obj = {
202
+          '患者姓名': name,
203
+          '项目名称': item_name,
204
+          '数量': count,
205
+          '单价': price,
206
+          '费用': pay_sumamt,
207
+          '费用总额': total
208
+        }
209
+        list.push(obj)
210
+      }
211
+      import('@/vendor/Export2Excel').then(excel => {
212
+        const tHeader = ['患者姓名', '项目名称', '数量', '单价', '费用', '费用总额']
213
+        const filterVal = ['患者姓名', '项目名称', '数量', '单价', '费用', '费用总额']
214
+        const data = this.formatJson(filterVal, list)
215
+        excel.export_json_to_excel1({
216
+          header: tHeader,
217
+          data,
218
+          filename: '明细',
219
+          ref: this.$refs['table'].$el
220
+        })
221
+      })
222
+
223
+    },
224
+    getCostType(type){
225
+      console.log(this.costClassifyList)
226
+      console.log(type)
227
+      var name = "";
228
+      for (let i = 0; i < this.costClassifyList.length; i++) {
229
+        if (type == this.costClassifyList[i].value) {
230
+          name = this.costClassifyList[i].name;
231
+        }
232
+      }
233
+      return name;
234
+    },
235
+    getDrugType(type){
236
+      console.log(this.drugTypeList)
237
+      console.log(type)
238
+
239
+      var name = "";
240
+      for (let i = 0; i < this.drugTypeList.length; i++) {
241
+        if (type == this.drugTypeList[i].value) {
242
+          name = this.drugTypeList[i].name;
243
+        }
244
+      }
245
+      return name;
246
+    },
247
+    handleSelect(val) {
248
+      this.patient_id = val.id
249
+      this.search_value = val.name
250
+    },
251
+    querySearchAsync(keyword, cb) {
252
+      let key = ''
253
+      if (keyword != undefined) {
254
+        key = keyword
255
+      }
256
+      let searchArray = []
257
+      PostSearch(key).then(response => {
258
+        if (response.data.state == 1) {
259
+          searchArray = response.data.data.patient
260
+          cb(searchArray)
261
+        } else {
262
+          cb([])
263
+        }
264
+      })
265
+    },
184
     handleDateChangetwo(value) {
266
     handleDateChangetwo(value) {
185
       this.$confirm('提示', '接口优化升级,如有数据需要,请联系客服!', {
267
       this.$confirm('提示', '接口优化升级,如有数据需要,请联系客服!', {
186
         confirmButtonText: '确 定',
268
         confirmButtonText: '确 定',
188
         type: 'warning'
270
         type: 'warning'
189
       }).then(() => {
271
       }).then(() => {
190
 
272
 
191
-
192
       }).catch(() => {
273
       }).catch(() => {
193
       })
274
       })
194
 
275
 
224
       // }else{
305
       // }else{
225
       //   this.getSummaryDetailListtwo()
306
       //   this.getSummaryDetailListtwo()
226
       // }
307
       // }
227
-      this.getSummaryDetailList()
228
-
308
+      // this.getSummaryDetailList()
229
 
309
 
230
     },
310
     },
231
-    Action(){
311
+    Action() {
232
       var that = this
312
       var that = this
233
       axios.get('http://127.0.0.1:9531/handelExcel', {
313
       axios.get('http://127.0.0.1:9531/handelExcel', {
234
         params: {}
314
         params: {}
237
           if (response.data.state == 0) {
317
           if (response.data.state == 0) {
238
             that.$message.error(response.data.msg)
318
             that.$message.error(response.data.msg)
239
 
319
 
240
-
241
             return false
320
             return false
242
           } else {
321
           } else {
243
 
322
 
244
             var list = []
323
             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++){
324
+            for (let i = 0; i < response.data.data.list.length; i++) {
325
+              let team = response.data.data.list[i]
326
+              for (let b = 0; b < team.list.length; b++) {
248
                 let name = ""
327
                 let name = ""
249
-                if(team.list[b].type == 2){
328
+                if (team.list[b].type == 2) {
250
                   name = team.list[b].project.project_name
329
                   name = team.list[b].project.project_name
251
-                }else{
330
+                } else {
252
 
331
 
253
                   name = team.list[b].good_info.good_name
332
                   name = team.list[b].good_info.good_name
254
 
333
 
270
             }
349
             }
271
 
350
 
272
             import('@/vendor/Export2Excel').then(excel => {
351
             import('@/vendor/Export2Excel').then(excel => {
273
-              const tHeader = [ '客户组合编码', '客户组合名称', '客户单项编码', '客户单项名称', '中心组合编码', '中心组合名称', '中心单项编码', '中心单项名称']
274
-              const filterVal = [ '客户组合编码', '客户组合名称', '客户单项编码', '客户单项名称', '中心组合编码', '中心组合名称', '中心单项编码', '中心单项名称']
352
+              const tHeader = ['客户组合编码', '客户组合名称', '客户单项编码', '客户单项名称', '中心组合编码', '中心组合名称', '中心单项编码', '中心单项名称']
353
+              const filterVal = ['客户组合编码', '客户组合名称', '客户单项编码', '客户单项名称', '中心组合编码', '中心组合名称', '中心单项编码', '中心单项名称']
275
               const data = that.formatJson(filterVal, list)
354
               const data = that.formatJson(filterVal, list)
276
               excel.export_json_to_excel({
355
               excel.export_json_to_excel({
277
                 header: tHeader,
356
                 header: tHeader,
280
               })
359
               })
281
             })
360
             })
282
 
361
 
283
-
284
           }
362
           }
285
         })
363
         })
286
         .catch(function(error) {
364
         .catch(function(error) {
287
 
365
 
288
         })
366
         })
289
 
367
 
290
-
291
-
292
-
293
-    },formatJson(filterVal, jsonData) {
368
+    }, formatJson(filterVal, jsonData) {
294
       return jsonData.map(v => filterVal.map(j => v[j]))
369
       return jsonData.map(v => filterVal.map(j => v[j]))
295
     },
370
     },
296
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
371
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
321
     },
396
     },
322
     changeItem() {
397
     changeItem() {
323
       this.getSummaryDetailList()
398
       this.getSummaryDetailList()
324
-    },changeTimeItem(){
399
+    }, changeTimeItem() {
325
 
400
 
326
       this.getSummaryDetailList()
401
       this.getSummaryDetailList()
327
 
402
 
403
+    }, uniqueProjectAndAdvice(array) {
404
+      // res用来存储结果
405
+      var res = []
406
+      for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
407
+        for (var j = 0, resLen = res.length; j < resLen; j++) {
408
+          if (array[i].item_id === res[j].item_id && array[i].price === res[j].price) {
409
+            break
410
+          }
411
+        }
412
+        // 如果array[i]是唯一的,那么执行完循环,j等于resLen
413
+        if (j === resLen) {
414
+          res.push(array[i])
415
+        }
416
+      }
417
+      return res
328
     },
418
     },
329
     searchAction() {
419
     searchAction() {
330
       this.item_type = '0'
420
       this.item_type = '0'
331
       this.getSummaryDetailList()
421
       this.getSummaryDetailList()
332
 
422
 
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
423
+    },handleSpanTempArr() {
424
+      this.tempArr = []
425
+
426
+      for (let i = 0; i < this.tableData.length; i++) {
427
+        if (i === 0) {
428
+          this.tempArr.push(1)
429
+          this.pos = 0
430
+        } else {
431
+          // 判断当前元素与上一个元素是否相同
432
+          if (this.tableData[i].patient_id === this.tableData[i - 1].patient_id) {
433
+            this.tempArr[this.pos] += 1
434
+            this.tempArr.push(0)
435
+          } else {
436
+            this.tempArr.push(1)
437
+            this.pos = i
438
+          }
439
+        }
342
       }
440
       }
343
-      GetSummaryDetail(params).then(response => {
441
+
442
+      let sameRowArr = [], sIdx = 0
443
+      this.tableData.forEach((item, index) => {
444
+        item.index = index
445
+        if (index === 0) {
446
+          sameRowArr.push([index])
447
+        } else {
448
+          if (item.patient_id === this.tableData[index - 1].patient_id) {
449
+            sameRowArr[sIdx].push(index)
450
+          } else {
451
+            sIdx = sIdx + 1
452
+            sameRowArr.push([index])
453
+          }
454
+        }
455
+      })
456
+      this.sameRowArr = sameRowArr
457
+    },getInit(){
458
+      getPrescriptionInitdata().then(response => {
344
         if (response.data.state == 0) {
459
         if (response.data.state == 0) {
345
           this.detail_loading = false
460
           this.detail_loading = false
346
 
461
 
347
           this.$message.error(response.data.msg)
462
           this.$message.error(response.data.msg)
348
           return false
463
           return false
349
         } else {
464
         } 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
-
465
+          this.drugTypeList = response.data.data.drugTypeList;
466
+          this.costClassifyList = response.data.data.costClassifyList;
363
         }
467
         }
364
 
468
 
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
       })
469
       })
470
+
424
     },
471
     },
425
     getSummaryDetailList() {
472
     getSummaryDetailList() {
473
+      if(this.search_value.length == 0){
474
+        this.patient_id = 0
475
+      }
426
       this.detail_loading = true
476
       this.detail_loading = true
427
       let start_time = this.chargeDate[0]
477
       let start_time = this.chargeDate[0]
428
       let end_time = this.chargeDate[1]
478
       let end_time = this.chargeDate[1]
430
         start_time: start_time,
480
         start_time: start_time,
431
         end_time: end_time,
481
         end_time: end_time,
432
         type: this.item_type,
482
         type: this.item_type,
433
-        keyword: this.keywords,
434
-        time_type:this.item_time_type
483
+        patient_id: this.patient_id,
435
       }
484
       }
436
-      GetSummaryDetail(params).then(response => {
485
+      GetPSummaryDetail(params).then(response => {
437
         if (response.data.state == 0) {
486
         if (response.data.state == 0) {
438
           this.detail_loading = false
487
           this.detail_loading = false
439
 
488
 
440
           this.$message.error(response.data.msg)
489
           this.$message.error(response.data.msg)
441
           return false
490
           return false
442
         } else {
491
         } else {
443
-
444
-
445
           this.detail_loading = false
492
           this.detail_loading = false
446
-
447
           this.tableData = []
493
           this.tableData = []
448
           let tempPatients = []
494
           let tempPatients = []
449
           let tempPatientsTwo = []
495
           let tempPatientsTwo = []
450
           //
496
           //
451
           let tempData = response.data
497
           let tempData = response.data
452
-          let allData =  response.data
498
+          let allData = response.data
453
           tempData = this.uniquepid(tempData)
499
           tempData = this.uniquepid(tempData)
454
           //
500
           //
455
           let order_infos = []
501
           let order_infos = []
476
               order_info: []
522
               order_info: []
477
             }
523
             }
478
             let orders = tempPatients[i].orders
524
             let orders = tempPatients[i].orders
479
-
480
             for (let c = 0; c < orders.length; c++) {
525
             for (let c = 0; c < orders.length; c++) {
481
               let newObj = {}
526
               let newObj = {}
482
               newObj['count'] = orders[c].cnt
527
               newObj['count'] = orders[c].cnt
483
               newObj['price'] = orders[c].pric
528
               newObj['price'] = orders[c].pric
484
-              newObj['item_total'] = orders[c].det_item_fee_sumamt
529
+
530
+              newObj['order_status'] = orders[c].order_status
531
+              newObj['med_type'] = orders[c].med_type
532
+              newObj['record_date'] = orders[c].record_date
533
+              newObj['unit'] = orders[c].unit
534
+
535
+              newObj['item_cost_type'] = orders[c].item_cost_type
536
+
537
+              // newObj['item_total'] = orders[c].det_item_fee_sumamt
485
 
538
 
486
               if (orders[c].advice_id > 0 && orders[c].project_id == 0) {
539
               if (orders[c].advice_id > 0 && orders[c].project_id == 0) {
487
                 newObj['type'] = 1
540
                 newObj['type'] = 1
488
                 newObj['item_name'] = orders[c].item_name
541
                 newObj['item_name'] = orders[c].item_name
489
                 newObj['item_id'] = orders[c].item_id
542
                 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
-
543
+                newObj['item_spec'] = orders[c].spec
498
               }
544
               }
499
               if (orders[c].advice_id == 0 && orders[c].project_id > 0) {
545
               if (orders[c].advice_id == 0 && orders[c].project_id > 0) {
500
-                newObj['type'] = 2
501
                 newObj['item_id'] = orders[c].item_id
546
                 newObj['item_id'] = orders[c].item_id
502
-
503
                 if (orders[c].p_type == 2) {
547
                 if (orders[c].p_type == 2) {
504
-                  newObj['item_spec'] =""
505
-                  newObj['item_name'] = orders[c].item_name
506
-
548
+                  newObj['type'] = 2
507
 
549
 
550
+                  newObj['item_spec'] = ""
551
+                  newObj['item_name'] = orders[c].item_name
508
                 } else if (orders[c].p_type == 3) {
552
                 } else if (orders[c].p_type == 3) {
509
-                  newObj['item_spec'] =  orders[c].specification_name
553
+                  newObj['type'] = 3
554
+                  newObj['item_spec'] = orders[c].spec
510
                   newObj['item_name'] = orders[c].item_name
555
                   newObj['item_name'] = orders[c].item_name
511
-
512
-
513
                 }
556
                 }
514
               }
557
               }
515
               obj.order_info.push(newObj)
558
               obj.order_info.push(newObj)
517
             }
560
             }
518
             tempPatientsTwo.push(obj)
561
             tempPatientsTwo.push(obj)
519
           }
562
           }
520
-          console.log(tempPatientsTwo)
521
 
563
 
522
-          //
523
           for (let d = 0; d < tempPatientsTwo.length; d++) {
564
           for (let d = 0; d < tempPatientsTwo.length; d++) {
524
             tempPatientsTwo[d]['new_order_info'] = []
565
             tempPatientsTwo[d]['new_order_info'] = []
525
             let project = []
566
             let project = []
543
                 }
584
                 }
544
               }
585
               }
545
 
586
 
546
-
547
-
548
               obj['price'] = project[i].price
587
               obj['price'] = project[i].price
549
               obj['type'] = project[i].type
588
               obj['type'] = project[i].type
550
               obj['item_name'] = project[i].item_name
589
               obj['item_name'] = project[i].item_name
551
               obj['item_spec'] = project[i].item_spec
590
               obj['item_spec'] = project[i].item_spec
552
-              obj['item_total'] = project[i].item_total
591
+
592
+              obj['order_status'] = project[i].order_status
593
+              obj['med_type'] = project[i].med_type
594
+              obj['record_date'] = project[i].record_date
595
+              obj['item_cost_type'] = project[i].item_cost_type
596
+              obj['unit'] = project[i].unit
597
+
598
+
599
+              // obj['item_total'] = project[i].item_total
553
 
600
 
554
               obj['item_id'] = project[i].item_id
601
               obj['item_id'] = project[i].item_id
555
               obj['name'] = tempPatientsTwo[d].name
602
               obj['name'] = tempPatientsTwo[d].name
572
               obj['item_name'] = advice[i].item_name
619
               obj['item_name'] = advice[i].item_name
573
               obj['item_spec'] = advice[i].item_spec
620
               obj['item_spec'] = advice[i].item_spec
574
               obj['item_id'] = advice[i].item_id
621
               obj['item_id'] = advice[i].item_id
622
+              obj['unit'] = advice[i].unit
623
+
575
               obj['name'] = tempPatientsTwo[d].name
624
               obj['name'] = tempPatientsTwo[d].name
576
-              obj['item_total'] = advice[i].item_total
625
+              obj['order_status'] = advice[i].order_status
626
+              obj['med_type'] = advice[i].med_type
627
+              obj['record_date'] = advice[i].record_date
628
+              obj['item_cost_type'] = advice[i].item_cost_type
629
+              // obj['item_total'] = advice[i].item_total
577
               obj['patient_id'] = tempPatientsTwo[d].patient_id
630
               obj['patient_id'] = tempPatientsTwo[d].patient_id
578
               obj['count'] = count
631
               obj['count'] = count
579
               tempPatientsTwo[d].new_order_info.push(obj)
632
               tempPatientsTwo[d].new_order_info.push(obj)
584
             let total = 0
637
             let total = 0
585
             for (let b = 0; b < tempPatientsTwo[i].new_order_info.length; b++) {
638
             for (let b = 0; b < tempPatientsTwo[i].new_order_info.length; b++) {
586
               let new_name = tempPatientsTwo[i].new_order_info[b].item_name
639
               let new_name = tempPatientsTwo[i].new_order_info[b].item_name
587
-              if (new_name != undefined){
640
+              if (new_name != undefined) {
588
                 if (new_name.length != 0) {
641
                 if (new_name.length != 0) {
589
                   console.log(parseFloat(tempPatientsTwo[i].new_order_info[b].count) * parseFloat(tempPatientsTwo[i].new_order_info[b].price))
642
                   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))
643
                   total = parseFloat(total) + parseFloat((parseFloat(tempPatientsTwo[i].new_order_info[b].count) * parseFloat(tempPatientsTwo[i].new_order_info[b].price)).toFixed(2))
591
                 }
644
                 }
592
 
645
 
593
-
594
-
595
               }
646
               }
596
 
647
 
597
-
598
             }
648
             }
599
             tempPatientsTwo[i]['total'] = total
649
             tempPatientsTwo[i]['total'] = total
600
           }
650
           }
603
             if (tempPatientsTwo[i].new_order_info.length > 0) {
653
             if (tempPatientsTwo[i].new_order_info.length > 0) {
604
 
654
 
605
               for (let b = 0; b < tempPatientsTwo[i].new_order_info.length; b++) {
655
               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
 
656
 
612
                 let obj = {
657
                 let obj = {
613
                   name: tempPatientsTwo[i].name,
658
                   name: tempPatientsTwo[i].name,
617
                   item_name: tempPatientsTwo[i].new_order_info[b].item_name,
662
                   item_name: tempPatientsTwo[i].new_order_info[b].item_name,
618
                   item_id: tempPatientsTwo[i].new_order_info[b].item_id,
663
                   item_id: tempPatientsTwo[i].new_order_info[b].item_id,
619
                   count: tempPatientsTwo[i].new_order_info[b].count,
664
                   count: tempPatientsTwo[i].new_order_info[b].count,
620
-                  item_spec: tempPatientsTwo[i].new_order_info[b].item_spec
621
-                }
665
+                  item_spec: tempPatientsTwo[i].new_order_info[b].item_spec,
666
+                  order_status: tempPatientsTwo[i].new_order_info[b].order_status,
667
+                  med_type: tempPatientsTwo[i].new_order_info[b].med_type,
668
+                  record_date: tempPatientsTwo[i].new_order_info[b].record_date,
669
+                  item_cost_type: tempPatientsTwo[i].new_order_info[b].item_cost_type,
670
+                  unit: tempPatientsTwo[i].new_order_info[b].unit,
622
 
671
 
623
 
672
 
624
-                // if(b == 0){
673
+                }
625
                 obj['total'] = tempPatientsTwo[i].total
674
                 obj['total'] = tempPatientsTwo[i].total
626
-                // }else{
627
-                //   obj['total'] = 0
628
-                // }
629
                 this.tableData.push(obj)
675
                 this.tableData.push(obj)
630
 
676
 
631
-
632
-
633
-
634
               }
677
               }
635
             }
678
             }
636
           }
679
           }
637
-          console.log( this.tableData)
680
+          console.log(this.tableData)
638
           this.handleSpanTempArr()
681
           this.handleSpanTempArr()
682
+          console.log(this.tableData)
683
+
639
           // this.tableData = tempPatientsTwo
684
           // this.tableData = tempPatientsTwo
640
 
685
 
641
           // console.log(tempPatientsTwo.length)
686
           // console.log(tempPatientsTwo.length)
642
           //
687
           //
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
-          }
688
+          // let advices = []
689
+          // let projects = []
690
+          // let goods = []
691
+          // for (let i = 0; i < order_infos.length; i++) {
692
+          //   if (order_infos[i].advice_id > 0 && order_infos[i].project_id == 0) {
693
+          //     advices.push(order_infos[i].advice)
694
+          //   }
695
+          //   if (order_infos[i].advice_id == 0 && order_infos[i].project_id > 0) {
696
+          //     if (order_infos[i].project.type == 3) {
697
+          //       goods.push(order_infos[i].project)
698
+          //     }
699
+          //   }
700
+          //   if (order_infos[i].advice_id == 0 && order_infos[i].project_id > 0) {
701
+          //     if (order_infos[i].project.type == 2) {
702
+          //       projects.push(order_infos[i].project)
703
+          //     }
704
+          //   }
705
+          // }
661
 
706
 
662
         }
707
         }
663
 
708
 
664
-
665
-
666
-
667
         //
709
         //
668
         // console.log('去重前')
710
         // console.log('去重前')
669
         // console.log(advice)
711
         // console.log(advice)
720
         // this.tableData = this.sort(this.tableData)
762
         // this.tableData = this.sort(this.tableData)
721
 
763
 
722
       })
764
       })
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
-    }
765
+    },
860
   },
766
   },
767
+
861
   created() {
768
   created() {
769
+    this.getInit()
862
     this.getSummaryDetailList()
770
     this.getSummaryDetailList()
863
 
771
 
864
   }
772
   }

+ 310 - 311
src/xt_pages/outpatientTool/components/pgather.vue Parādīt failu

6
         <!--@click="Action">-->
6
         <!--@click="Action">-->
7
         <!--导出-->
7
         <!--导出-->
8
         <!--</el-button>-->
8
         <!--</el-button>-->
9
-        <el-input size="small" style="width:150px;" v-model="keywords" @input="searchAction"
10
-                  @keyup.enter.native='searchAction'
11
-                  placeholder="请输入患者姓名"
9
+        <el-autocomplete
10
+          class="checkSearch"
11
+          popper-class="my-autocomplete"
12
+          v-model="search_value"
13
+          :fetch-suggestions="querySearchAsync"
14
+          :trigger-on-focus="false"
15
+          placeholder="病人透析号/姓名"
16
+          @select="handleSelect"
17
+        >
18
+          <i class="el-icon-search el-input__icon" slot="suffix"></i>
19
+          <template slot-scope="{ item }">
20
+            <div class="name">{{ item.name }}</div>
21
+          </template>
22
+        </el-autocomplete>
12
 
23
 
13
-                  class="filter-item"/>
14
         <el-select size="small" v-model="item_type" placeholder="请选择"
24
         <el-select size="small" v-model="item_type" placeholder="请选择"
15
-                   style="width:150px;margin-left:10px;" @change="changeItem">
25
+                   style="width:150px;margin-left:10px;" >
16
           <el-option
26
           <el-option
17
-            label="全部"
27
+            label="不限"
18
             value="0">
28
             value="0">
19
           </el-option>
29
           </el-option>
20
           <el-option
30
           <el-option
24
             :value="item.id">
34
             :value="item.id">
25
           </el-option>
35
           </el-option>
26
         </el-select>
36
         </el-select>
27
-        <el-select size="small" v-model="item_time_type" placeholder="请选择"
28
-                   style="width:150px;margin-left:10px;" @change="changeTimeItem">
29
-          <el-option
30
-            label="处方时间"
31
-            value="0">
32
-          </el-option>
33
-          <el-option
34
-            label="结算时间"
35
-            value="1">
36
-          </el-option>
37
-        </el-select>
37
+
38
+
38
         <el-date-picker
39
         <el-date-picker
39
           v-model="chargeDate"
40
           v-model="chargeDate"
40
           type="daterange"
41
           type="daterange"
41
           value-format="yyyy-MM-dd"
42
           value-format="yyyy-MM-dd"
42
           range-separator="至"
43
           range-separator="至"
43
           start-placeholder="开始日期"
44
           start-placeholder="开始日期"
44
-          @change="changeDate"
45
           end-placeholder="结束日期">
45
           end-placeholder="结束日期">
46
         </el-date-picker>
46
         </el-date-picker>
47
-        <!--<el-radio v-model="radio" label="1">明细</el-radio>-->
48
-        <!--<el-radio v-model="radio" label="2">汇总</el-radio>-->
49
       </div>
47
       </div>
50
       <div>
48
       <div>
51
-        <!-- <el-popover
52
-          placement="bottom"
53
-          width="210"
54
-          trigger="click">
55
-          <el-button size="small" ref="button_two" @click="open(1)">打印清单</el-button>
56
-          <el-button size="small" ref="button_six" @click="open(2)">打印汇总</el-button>
57
-          <el-button slot="reference" style="margin:0 10px;" type="primary" size="small">打印</el-button>
58
-
59
-        </el-popover> -->
49
+        <el-button size="small" type="primary" @click="getSummaryDetailList">查询</el-button>
60
         <el-button size="small" type="primary" @click="export_detail">报表下载</el-button>
50
         <el-button size="small" type="primary" @click="export_detail">报表下载</el-button>
61
       </div>
51
       </div>
62
     </div>
52
     </div>
63
     <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="tables"
53
     <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="tables"
64
               :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
54
               :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
65
               v-loading="gather_loading"
55
               v-loading="gather_loading"
66
-              show-summary
67
               max-height="600"
56
               max-height="600"
68
-              :span-method="merge"
69
-              :summary-method="getTotal"
70
               highlight-current-row>
57
               highlight-current-row>
71
 
58
 
72
       <el-table-column align="center" prop="name" label="费用分类">
59
       <el-table-column align="center" prop="name" label="费用分类">
73
-        <template slot-scope="scope">{{ scope.row.name }}</template>
60
+        <template slot-scope="scope">
61
+          <div v-if="scope.row.type == 1">{{getDrugType(scope.row.item_cost_type)}}</div>
62
+          <div v-if="scope.row.type == 2">{{getCostType(scope.row.item_cost_type)}}</div>
63
+          <div v-if="scope.row.type == 3">耗材</div>
64
+        </template>
74
       </el-table-column>
65
       </el-table-column>
75
-      <!--<el-table-column align="center" prop="name" label="患者类型">-->
76
-      <!--<template slot-scope="scope"></template>-->
77
-      <!--</el-table-column>-->
78
 
66
 
79
-      <el-table-column align="center" prop="item_name" label="处方类型">
80
-        <template slot-scope="scope">{{scope.row.item_name}}</template>
67
+      <el-table-column align="center" prop="name" label="处方类型">
68
+        <template slot-scope="scope">
69
+          <div v-if="scope.row.med_type == 11">普通门诊</div>
70
+          <div v-if="scope.row.med_type == 14">门诊特殊病</div>
71
+        </template>
81
       </el-table-column>
72
       </el-table-column>
82
       <el-table-column align="center" prop="price" label="项目名称">
73
       <el-table-column align="center" prop="price" label="项目名称">
83
-        <template slot-scope="scope">{{scope.row.price.toFixed(2)}}</template>
74
+        <template slot-scope="scope">{{scope.row.item_name}}</template>
84
       </el-table-column>
75
       </el-table-column>
85
-      <el-table-column align="center" prop="sum" label="费用总额">
86
-        <template slot-scope="scope">
87
-          <div>{{scope.row.sum.toFixed(2)}}</div>
88
-        </template>
76
+      <el-table-column align="center" prop="price" label="规格型号">
77
+        <template slot-scope="scope">{{scope.row.spec}}</template>
78
+      </el-table-column>
79
+      <el-table-column align="center" prop="price" label="数量">
80
+        <template slot-scope="scope">{{scope.row.count}}</template>
81
+      </el-table-column>
82
+      <el-table-column align="center" prop="price" label="单位">
83
+        <template slot-scope="scope">{{scope.row.unit}}</template>
84
+      </el-table-column>
85
+      <el-table-column align="center" prop="price" label="单价">
86
+        <template slot-scope="scope">{{scope.row.price}}</template>
87
+      </el-table-column>
88
+      <el-table-column align="center" prop="sum" label="金额">
89
+        <template slot-scope="scope">{{(scope.row.count * scope.row.price).toFixed(2)}}</template>
90
+      </el-table-column>
91
+      <el-table-column align="center" prop="settle" label="已结算金额">
92
+        <template slot-scope="scope">{{scope.row.total_settle.toFixed(2)}}</template>
93
+      </el-table-column>
94
+      <el-table-column align="center" prop="un_settle" label="未结算金额">
95
+        <template slot-scope="scope">{{scope.row.total_un_settle.toFixed(2)}}</template>
89
       </el-table-column>
96
       </el-table-column>
90
 
97
 
91
     </el-table>
98
     </el-table>
95
 
102
 
96
 <script>
103
 <script>
97
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
104
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
98
-import { GetSummaryDetail } from '@/api/his/his'
105
+import { GetPSummaryDetail } from '@/api/his/his'
106
+import { PostSearch } from '@/api/patient'
107
+import { getPrescriptionInitdata } from '@/api/his/his_tools'
108
+
99
 import { uParseTime } from '@/utils/tools'
109
 import { uParseTime } from '@/utils/tools'
100
 // import NewStatementPrint from './newStatementPrint'
110
 // import NewStatementPrint from './newStatementPrint'
101
 const moment = require('moment')
111
 const moment = require('moment')
112
       sameRowArr: [],
122
       sameRowArr: [],
113
       keywords: '',
123
       keywords: '',
114
       pos:0,
124
       pos:0,
115
-
125
+      costClassifyList:[],
126
+      drugTypeList:[],
127
+      search_value:"",
116
       tableData: [],
128
       tableData: [],
117
       chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
129
       chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
118
       item_type: '0',
130
       item_type: '0',
131
+      patient_id:0,
119
       item_time_type:'0',
132
       item_time_type:'0',
120
       items: [
133
       items: [
121
-        { id: 1, name: '药品' },
122
-        { id: 2, name: '所有项目' },
123
-        { id: 4, name: '检验费' },
124
-        { id: 5, name: '治疗费' },
125
-        { id: 6, name: '护理费' },
126
-        { id: 7, name: '其他' },
127
-
128
-        { id: 3, name: '耗材' },
134
+        { id: 1, name: '未结算' },
135
+        { id: 2, name: '结算' },
129
 
136
 
130
       ]
137
       ]
131
 
138
 
132
     }
139
     }
133
   },
140
   },
134
   methods: {
141
   methods: {
142
+    getInit(){
143
+      getPrescriptionInitdata().then(response => {
144
+        if (response.data.state == 0) {
145
+          this.detail_loading = false
135
 
146
 
147
+          this.$message.error(response.data.msg)
148
+          return false
149
+        } else {
150
+          this.drugTypeList = response.data.data.drugTypeList;
151
+          this.costClassifyList = response.data.data.costClassifyList;
152
+        }
153
+
154
+      })
155
+
156
+    },
157
+    getCostType(type){
158
+      console.log(this.costClassifyList)
159
+      console.log(type)
160
+      var name = "";
161
+      for (let i = 0; i < this.costClassifyList.length; i++) {
162
+        if (type == this.costClassifyList[i].value) {
163
+          name = this.costClassifyList[i].name;
164
+        }
165
+      }
166
+      return name;
167
+    },
168
+    getDrugType(type){
169
+      console.log(this.drugTypeList)
170
+      console.log(type)
171
+
172
+      var name = "";
173
+      for (let i = 0; i < this.drugTypeList.length; i++) {
174
+        if (type == this.drugTypeList[i].value) {
175
+          name = this.drugTypeList[i].name;
176
+        }
177
+      }
178
+      return name;
179
+    },
180
+    handleSelect(val) {
181
+      this.patient_id = val.id
182
+      this.search_value = val.name
183
+    },
184
+    querySearchAsync(keyword, cb) {
185
+      let key = ''
186
+      if (keyword != undefined) {
187
+        key = keyword
188
+      }
189
+      let searchArray = []
190
+      PostSearch(key).then(response => {
191
+        if (response.data.state == 1) {
192
+          searchArray = response.data.data.patient
193
+          cb(searchArray)
194
+        } else {
195
+          cb([])
196
+        }
197
+      })
198
+    },
136
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
199
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
137
       if (columnIndex === 0) {
200
       if (columnIndex === 0) {
138
         if (rowIndex % 2 === 0) {
201
         if (rowIndex % 2 === 0) {
169
       this.getSummaryDetailList()
232
       this.getSummaryDetailList()
170
     },
233
     },
171
     getSummaryDetailList() {
234
     getSummaryDetailList() {
235
+      console.log(this.search_value)
236
+      if(this.search_value.length == 0){
237
+        this.patient_id = 0
238
+      }
172
       this.gather_loading = true
239
       this.gather_loading = true
173
       let start_time = this.chargeDate[0]
240
       let start_time = this.chargeDate[0]
174
       let end_time = this.chargeDate[1]
241
       let end_time = this.chargeDate[1]
176
         start_time: start_time,
243
         start_time: start_time,
177
         end_time: end_time,
244
         end_time: end_time,
178
         type: this.item_type,
245
         type: this.item_type,
179
-        keyword: this.keywords,
180
-        time_type:this.item_time_type,
246
+        patient_id:this.patient_id
181
       }
247
       }
182
-      GetSummaryDetail(params).then(response => {
248
+      GetPSummaryDetail(params).then(response => {
183
         if (response.data.state == 0) {
249
         if (response.data.state == 0) {
184
           this.gather_loading = false
250
           this.gather_loading = false
185
-
186
           this.$message.error(response.data.msg)
251
           this.$message.error(response.data.msg)
187
           return false
252
           return false
188
         } else {
253
         } else {
189
           this.gather_loading = false
254
           this.gather_loading = false
190
-
191
-          let tempPatients = []
192
-          let tempPatientsTwo = []
193
           this.tableData = []
255
           this.tableData = []
194
           let tempData = response.data
256
           let tempData = response.data
195
-          let data = response.data
196
-          let orders = this.uniquepid(tempData)
197
-          console.log(orders)
198
-
199
-          for (let i = 0; i < orders.length; i++) {
200
-            let obj = {
201
-              patient_id: orders[i].p_id,
202
-              name: orders[i].p_name,
203
-              orders: []
204
-            }
205
-            for (let b = 0; b < data.length; b++) {
206
-              if (orders[i].p_id == data[b].p_id) {
207
-                obj.orders = obj.orders.concat(data[b])
208
-              }
209
-            }
210
-            tempPatients.push(obj)
211
-          }
212
-          console.log(tempPatients)
213
-
214
-          for (let i = 0; i < tempPatients.length; i++) {
215
-            let obj = {
216
-              patient_id: tempPatients[i].patient_id,
217
-              name: tempPatients[i].name,
218
-              order_info: []
219
-            }
220
-            let orders = tempPatients[i].orders
221
-            for (let c = 0; c < orders.length; c++) {
222
-              let newObj = {}
223
-
224
-              newObj['count'] = orders[c].cnt
225
-              newObj['price'] = orders[c].pric
226
-              if (orders[c].advice_id > 0 && orders[c].project_id == 0) {
227
-                newObj['type'] = 1
228
-                newObj['item_name'] = orders[c].item_name
229
-                newObj['item_id'] = orders[c].item_id
230
-
231
-              }
232
-              if (orders[c].advice_id == 0 && orders[c].project_id > 0) {
233
-                newObj['item_id'] = orders[c].item_id
234
-                if (orders[c].p_type == 2) {
235
-                  newObj['type'] = 2
236
-                  newObj['item_name'] = orders[c].item_name
237
-                } else if (orders[c].p_type == 3) {
238
-                  newObj['type'] = 3
239
-                  newObj['item_name'] = orders[c].item_name
240
-                }
241
-              }
242
-              obj.order_info.push(newObj)
243
-            }
244
-            tempPatientsTwo.push(obj)
245
-          }
246
-          console.log(tempPatientsTwo)
247
-
248
-          for (let d = 0; d < tempPatientsTwo.length; d++) {
249
-            tempPatientsTwo[d]['new_order_info'] = []
250
-            let project = []
251
-            let advice = []
252
-            for (let b = 0; b < tempPatientsTwo[d].order_info.length; b++) {
253
-              if (tempPatientsTwo[d].order_info[b].type == 1) {
254
-                advice.push(tempPatientsTwo[d].order_info[b])
255
-              } else {
256
-                project.push(tempPatientsTwo[d].order_info[b])
257
-              }
258
-            }
259
-            // project = this.uniqueProjectAndAdvice(project)
260
-            // advice = this.uniqueProjectAndAdvice(advice)
261
-
262
-            let obj = {}
263
-            let price = 0
264
-
265
-            let obj2 = {}
266
-            let price2 = 0
267
-
268
-            let obj3 = {}
269
-            let price3 = 0
270
-
271
-            for (let i = 0; i < project.length; i++) {
272
-              if (project[i].type == 2) {
273
-                price = parseFloat(price.toString()) + parseFloat((parseFloat(project[i].count.toString()) * parseFloat(project[i].price.toString()).toFixed(2)).toString())
274
-              } else if (project[i].type == 3) {
275
-                price3 = parseFloat(price3.toString()) + parseFloat((parseFloat(project[i].count.toString()) * parseFloat(project[i].price.toString()).toFixed(2)).toString())
276
-              }
277
-            }
278
-
279
-
280
-            for (let i = 0; i < advice.length; i++) {
281
-              price2 = parseFloat(price2.toString()) + parseFloat((parseFloat(advice[i].count.toString()) * parseFloat(advice[i].price.toString()).toFixed(2)).toString())
282
-            }
283
-
284
-
285
-            switch (parseInt(this.item_type)) {
286
-              case 0:
287
-
288
-                obj['sum'] = price + price2 + price3
289
-                obj['price'] = price
290
-                obj['item_name'] = '项目'
291
-                obj['name'] = tempPatientsTwo[d].name
292
-                obj['patient_id'] = tempPatientsTwo[d].patient_id
293
-                this.tableData.push(obj)
294
-
295
-                obj2['sum'] = 0
296
-                obj2['price'] = price2
297
-                obj2['item_name'] = '药品'
298
-                obj2['name'] = tempPatientsTwo[d].name
299
-                obj2['patient_id'] = tempPatientsTwo[d].patient_id
300
-                this.tableData.push(obj2)
301
-
302
-                obj3['sum'] = 0
303
-                obj3['price'] = price3
304
-                obj3['item_name'] = '耗材'
305
-                obj3['name'] = tempPatientsTwo[d].name
306
-                obj3['patient_id'] = tempPatientsTwo[d].patient_id
307
-                this.tableData.push(obj3)
308
-                break
309
-              case 1:
310
-                obj2['sum'] = price2
311
-                obj2['price'] = price2
312
-                obj2['item_name'] = '药品'
313
-                obj2['name'] = tempPatientsTwo[d].name
314
-                obj2['patient_id'] = tempPatientsTwo[d].patient_id
315
-                this.tableData.push(obj2)
316
-                break
317
-              case 2:
318
-
319
-                obj['sum'] = price
320
-                obj['price'] = price
321
-                obj['item_name'] = '项目'
322
-                obj['name'] = tempPatientsTwo[d].name
323
-                obj['patient_id'] = tempPatientsTwo[d].patient_id
324
-                this.tableData.push(obj)
325
-                break
326
-              case 3:
327
-                obj3['sum'] = price3
328
-                obj3['price'] = price3
329
-                obj3['item_name'] = '耗材'
330
-                obj3['name'] = tempPatientsTwo[d].name
331
-                obj3['patient_id'] = tempPatientsTwo[d].patient_id
332
-                this.tableData.push(obj3)
333
-                break
334
-              case 4:
335
-
336
-                obj['sum'] = price
337
-                obj['price'] = price
338
-                obj['item_name'] = '检验'
339
-                obj['name'] = tempPatientsTwo[d].name
340
-                obj['patient_id'] = tempPatientsTwo[d].patient_id
341
-                this.tableData.push(obj)
342
-                break
343
-              case 5:
344
-
345
-                obj['sum'] = price
346
-                obj['price'] = price
347
-                obj['item_name'] = '治疗'
348
-                obj['name'] = tempPatientsTwo[d].name
349
-                obj['patient_id'] = tempPatientsTwo[d].patient_id
350
-                this.tableData.push(obj)
351
-                break
352
-              case 6:
353
-
354
-                obj['sum'] = price
355
-                obj['price'] = price
356
-                obj['item_name'] = '护理'
357
-                obj['name'] = tempPatientsTwo[d].name
358
-                obj['patient_id'] = tempPatientsTwo[d].patient_id
359
-                this.tableData.push(obj)
360
-                break
361
-              case 7:
362
-
363
-                obj['sum'] = price
364
-                obj['price'] = price
365
-                obj['item_name'] = '其他'
366
-                obj['name'] = tempPatientsTwo[d].name
367
-                obj['patient_id'] = tempPatientsTwo[d].patient_id
368
-                this.tableData.push(obj)
369
-                break
370
-
371
-            }
372
-
373
-
374
-
375
-          }
376
-
377
-          this.handleSpanTempArr()
378
-          // this.tableData = tempPatientsTwo
379
-
380
-          // console.log(tempPatientsTwo.length)
381
-          //
257
+          this.setMonthPrescription(tempData)
382
 
258
 
383
         }
259
         }
384
-        //
385
-        // console.log('去重前')
386
-        // console.log(advice)
387
-        // console.log(project)
388
-        // //
389
-        // //
390
-
391
-        // //
392
-        // console.log('去重后')
393
-        //
394
-        // console.log(advice.length)
395
-        // console.log(project.length)
396
-        //
397
-        // for (let i = 0; i < project.length; i++) {
398
-        //   let obj = {}
399
-        //   let count = 0
400
-        //   for (let a = 0; a < tempPatientsTwo.length; a++) {
401
-        //     if (project[i].patient_id == tempPatientsTwo[a].patient_id && project[i].item_id == tempPatientsTwo[a].item_id && project[i].price == tempPatientsTwo[a].price) {
402
-        //       count = count + tempPatientsTwo[a].count
403
-        //       obj['count'] = count
404
-        //
405
-        //     }
406
-        //     obj['price'] = project[i].price
407
-        //     obj['type'] = project[i].type
408
-        //     obj['item_name'] = project[i].item_name
409
-        //     obj['item_id'] = project[i].item_id
410
-        //     obj['name'] = project[i].name
411
-        //     obj['patient_id'] = project[i].patient_id
412
-        //     obj['count'] = count
413
-        //     this.tableData.push(obj)
414
-        //   }
415
-        // }
416
-        //
417
-        //
418
-        // for (let i = 0; i < advice.length; i++) {
419
-        //   let obj = {}
420
-        //   let count = 0
421
-        //   for (let a = 0; a < tempPatientsTwo.length; a++) {
422
-        //     if (advice[i].patient_id == tempPatientsTwo[a].patient_id && advice[i].item_id == tempPatientsTwo[a].item_id && advice[i].price == tempPatientsTwo[a].price) {
423
-        //       count = count + tempPatientsTwo[a].count
424
-        //       obj['count'] = count
425
-        //
426
-        //     }
427
-        //     obj['price'] = advice[i].price
428
-        //     obj['type'] = advice[i].type
429
-        //     obj['item_name'] = advice[i].item_name
430
-        //     obj['item_id'] = advice[i].item_id
431
-        //     obj['name'] = advice[i].name
432
-        //     obj['patient_id'] = advice[i].patient_id
433
-        //     this.tableData.push(obj)
434
-        //   }
435
-        // }
436
-        // console.log(this.tableData.length)
437
-        // this.tableData = this.sort(this.tableData)
438
 
260
 
439
       })
261
       })
440
     }, uniqueProjectAndAdvice(array) {
262
     }, uniqueProjectAndAdvice(array) {
517
         }
339
         }
518
         console.log(data)
340
         console.log(data)
519
         const values = data.map(item => Number(item[column.property]))
341
         const values = data.map(item => Number(item[column.property]))
520
-        if (column.property === 'sum') {
342
+        if (column.property === 'settle' || column.property === 'un_settle') {
521
           sums[index] = values.reduce((prev, curr) => {
343
           sums[index] = values.reduce((prev, curr) => {
522
             const value = Number(curr)
344
             const value = Number(curr)
523
             if (!isNaN(value)) {
345
             if (!isNaN(value)) {
538
       let list = []
360
       let list = []
539
       for (let i = 0; i < this.tableData.length; i++) {
361
       for (let i = 0; i < this.tableData.length; i++) {
540
         let order = this.tableData[i]
362
         let order = this.tableData[i]
541
-        let name = order.name
542
-        let item_name = order.item_name
543
-        let pay_sumamt = order.price.toFixed(2)
544
-        let total = order.sum.toFixed(2)
363
+        // let name = order.name
364
+        // let item_name = order.item_name
365
+        // let pay_sumamt = order.price.toFixed(2)
366
+        // let total = order.sum.toFixed(2)
545
 
367
 
546
 
368
 
547
         let obj = {
369
         let obj = {
548
-          '患者姓名': name,
549
-          '项目类别': item_name,
550
-          '费用': pay_sumamt,
551
-          '费用总额':total,
370
+          '患者姓名': "",
371
+          '项目类别': "",
372
+          '费用': "",
373
+          '费用总额':"",
552
         }
374
         }
553
         list.push(obj)
375
         list.push(obj)
554
       }
376
       }
566
 
388
 
567
     }, formatJson(filterVal, jsonData) {
389
     }, formatJson(filterVal, jsonData) {
568
       return jsonData.map(v => filterVal.map(j => v[j]))
390
       return jsonData.map(v => filterVal.map(j => v[j]))
569
-    }
391
+
392
+    }, setMonthPrescription(prescriptions) {
393
+
394
+      for (let a = 0; a < prescriptions.length; a++) {
395
+        if(prescriptions[a].order_status == 4){
396
+          prescriptions[a].order_status = 1
397
+        }
398
+      }
399
+
400
+        var advices = []
401
+      var projects = []
402
+      var goods = []
403
+      var ad_ids = []
404
+      var pro_ids = []
405
+      var gd_ids = []
406
+
407
+
408
+      for (let a = 0; a < prescriptions.length; a++) {
409
+        if(prescriptions[a].p_type == 1){
410
+          advices.push(prescriptions[a])
411
+          let obj = {
412
+            item_id:prescriptions[a].item_id,
413
+            price:prescriptions[a].pric,
414
+            med_type:prescriptions[a].med_type,
415
+            order_status:prescriptions[a].order_status,
416
+
417
+          }
418
+          ad_ids.push(obj)
419
+        }
420
+
421
+        if(prescriptions[a].p_type == 2){
422
+          projects.push(prescriptions[a])
423
+          let obj = {
424
+            item_id:prescriptions[a].item_id,
425
+            price:prescriptions[a].pric,
426
+            med_type:prescriptions[a].med_type,
427
+            order_status:prescriptions[a].order_status,
428
+
429
+          }
430
+          pro_ids.push(obj)
431
+
432
+        }
433
+
434
+        if(prescriptions[a].p_type == 3){
435
+          goods.push(prescriptions[a])
436
+          let obj = {
437
+            item_id:prescriptions[a].item_id,
438
+            price:prescriptions[a].pric,
439
+            med_type:prescriptions[a].med_type,
440
+            order_status:prescriptions[a].order_status,
441
+
442
+
443
+          }
444
+          gd_ids.push(obj)
445
+        }
446
+      }
447
+
448
+      let drug_ids = this.unique_two(ad_ids)
449
+      let project_ids = this.unique_two(pro_ids)
450
+      let goods_ids = this.unique_two(gd_ids)
451
+
452
+      for (let i = 0; i < drug_ids.length; i++) {
453
+          let obj = {}
454
+          let count = 0
455
+          let total_settle = 0
456
+          let total_un_settle = 0
457
+
458
+          for (let a = 0; a < prescriptions.length; a++) {
459
+            if (drug_ids[i].price == prescriptions[a].pric && drug_ids[i].item_id == prescriptions[a].item_id &&drug_ids[i].med_type == prescriptions[a].med_type &&drug_ids[i].order_status == prescriptions[a].order_status) {
460
+              obj['item_cost_type'] = prescriptions[a].item_cost_type
461
+              obj['unit'] = prescriptions[a].unit
462
+              obj['med_type'] =  prescriptions[a].med_type
463
+              obj['type'] =  prescriptions[a].p_type
464
+
465
+              obj['item_name'] =prescriptions[a].item_name
466
+              obj['spec'] = prescriptions[a].spec
467
+              obj['unit'] = prescriptions[a].unit
468
+              obj['price'] = prescriptions[a].pric
469
+              count = count + prescriptions[a].cnt
470
+              if(prescriptions[a].order_status == 2){
471
+                total_settle = total_settle + (prescriptions[a].pric * prescriptions[a].cnt)
472
+              }else{
473
+                total_un_settle = total_un_settle + (prescriptions[a].pric * prescriptions[a].cnt)
474
+              }
475
+            }
476
+          }
477
+          obj['count'] = count
478
+          obj['total_settle'] = total_settle
479
+          obj['total_un_settle'] = total_un_settle
480
+          this.tableData.push(obj)
481
+        }
482
+
483
+      for (let i = 0; i < project_ids.length; i++) {
484
+        let obj = {}
485
+        let count = 0
486
+        let total_settle = 0
487
+        let total_un_settle = 0
488
+
489
+        for (let a = 0; a < prescriptions.length; a++) {
490
+          if (project_ids[i].price == prescriptions[a].pric && project_ids[i].item_id == prescriptions[a].item_id &&project_ids[i].med_type == prescriptions[a].med_type&&project_ids[i].order_status == prescriptions[a].order_status) {
491
+            obj['item_cost_type'] = prescriptions[a].item_cost_type
492
+            obj['unit'] = prescriptions[a].unit
493
+            obj['med_type'] =  prescriptions[a].med_type
494
+            obj['type'] =  prescriptions[a].p_type
495
+
496
+
497
+            obj['item_name'] =prescriptions[a].item_name
498
+            obj['spec'] = prescriptions[a].spec
499
+            obj['unit'] = prescriptions[a].unit
500
+            obj['price'] = prescriptions[a].pric
501
+            count = count + prescriptions[a].cnt
502
+            if(prescriptions[a].order_status == 2){
503
+              total_settle = total_settle + (prescriptions[a].pric * prescriptions[a].cnt)
504
+            }else{
505
+              total_un_settle = total_un_settle + (prescriptions[a].pric * prescriptions[a].cnt)
506
+            }
507
+          }
508
+        }
509
+        obj['count'] = count
510
+        obj['total_settle'] = total_settle
511
+        obj['total_un_settle'] = total_un_settle
512
+        this.tableData.push(obj)
513
+      }
514
+
515
+      for (let i = 0; i < goods_ids.length; i++) {
516
+        let obj = {}
517
+        let count = 0
518
+        let total_settle = 0
519
+        let total_un_settle = 0
520
+
521
+        for (let a = 0; a < prescriptions.length; a++) {
522
+          if (goods_ids[i].price == prescriptions[a].pric && goods_ids[i].item_id == prescriptions[a].item_id &&goods_ids[i].med_type == prescriptions[a].med_type&&goods_ids[i].order_status == prescriptions[a].order_status) {
523
+            obj['item_cost_type'] = prescriptions[a].item_cost_type
524
+            obj['unit'] = prescriptions[a].unit
525
+            obj['med_type'] =  prescriptions[a].med_type
526
+            obj['type'] =  prescriptions[a].p_type
527
+
528
+            obj['item_name'] =prescriptions[a].item_name
529
+            obj['spec'] = prescriptions[a].spec
530
+            obj['unit'] = prescriptions[a].unit
531
+            obj['price'] = prescriptions[a].pric
532
+            count = count + prescriptions[a].cnt
533
+            if(prescriptions[a].order_status == 2){
534
+              total_settle = total_settle + (prescriptions[a].pric * prescriptions[a].cnt)
535
+            }else{
536
+              total_un_settle = total_un_settle + (prescriptions[a].pric * prescriptions[a].cnt)
537
+            }
538
+          }
539
+        }
540
+        obj['count'] = count
541
+        obj['total_settle'] = total_settle
542
+        obj['total_un_settle'] = total_un_settle
543
+        this.tableData.push(obj)
544
+      }
545
+
546
+
547
+
548
+
549
+
550
+
551
+    },  unique_two(array) {
552
+      // res用来存储结果
553
+      var res = []
554
+      for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
555
+        for (var j = 0, resLen = res.length; j < resLen; j++) {
556
+          if (array[i].item_id === res[j].item_id && array[i].price === res[j].price && array[i].med_type === res[j].med_type && array[i].order_status === res[j].order_status) {
557
+            break
558
+          }
559
+        }
560
+        // 如果array[i]是唯一的,那么执行完循环,j等于resLen
561
+        if (j === resLen) {
562
+          res.push(array[i])
563
+        }
564
+      }
565
+      return res
566
+    },
570
   },
567
   },
571
   created() {
568
   created() {
569
+    this.getInit()
570
+
572
     this.getSummaryDetailList()
571
     this.getSummaryDetailList()
573
 
572
 
574
   }
573
   }