Browse Source

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

csx 4 years ago
parent
commit
32102544b6

+ 61 - 0
src/api/common/statistics.js View File

@@ -153,5 +153,66 @@ export function GetDefalutPatient() {
153 153
 
154 154
 
155 155
 
156
+export function GetInspectionIndexInit() {
157
+  return request({
158
+    url: '/api/inspectionindex/init',
159
+    method: 'get',
160
+  })
161
+}
162
+
163
+
164
+export function GetRangeValue(params) {
165
+  return request({
166
+    url: '/api/rangevalue/get',
167
+    method: 'get',
168
+    params:params,
169
+
170
+  })
171
+}
172
+
173
+
174
+
175
+export function GetInspectionIndexChart(params) {
176
+  return request({
177
+    url: '/api/inspectionindex/chart',
178
+    method: 'get',
179
+    params:params,
180
+
181
+  })
182
+}
183
+
184
+export function GetInspectionIndexTable(params) {
185
+  return request({
186
+    url: '/api/inspectionindex/table',
187
+    method: 'get',
188
+    params:params,
189
+
190
+  })
191
+}
192
+
193
+export function GetPatientInspectionIndexChart(params) {
194
+  return request({
195
+    url: '/api/patientinspectionindex/chart',
196
+    method: 'get',
197
+    params:params,
198
+
199
+  })
200
+}
201
+
202
+export function GetPatientInspectionIndexBarChart(params) {
203
+  return request({
204
+    url: '/api/patientinspectionindex/barchart',
205
+    method: 'get',
206
+    params:params,
207
+
208
+  })
209
+}
210
+
211
+
212
+
213
+
214
+
215
+
216
+
156 217
 
157 218
 

+ 388 - 245
src/xt_pages/qcd/indicatorControlAnalysis/components/office.vue View File

@@ -1,58 +1,51 @@
1 1
 <template>
2 2
   <div class="page_office">
3 3
     <div class="cell clearfix">
4
-      <el-select v-model="value" placeholder="请选择" style="width:120px;margin-right:20px">
4
+      <el-select v-model="query.project_id" placeholder="请选择" style="width:120px;margin-right:20px"
5
+                 @change="changeProject">
5 6
         <el-option
6
-          v-for="item in options"
7
-          :key="item.value"
8
-          :label="item.label"
9
-          :value="item.value"
7
+          v-for="item in project_columns"
8
+          :key="item.project_id"
9
+          :label="item.project_name"
10
+          :value="item.project_id"
10 11
         ></el-option>
11 12
       </el-select>
13
+
12 14
       <el-select
13
-        v-model="value"
15
+        v-model="query.item_id"
14 16
         placeholder="请选择"
15
-        @change="chooseType"
16 17
         style="width:120px;margin-right:20px"
18
+        @change="changeItem"
17 19
       >
18 20
         <el-option
19
-          v-for="item in options"
20
-          :key="item.value"
21
-          :label="item.label"
22
-          :value="item.value"
23
-        ></el-option>
24
-      </el-select>
25
-      <el-select v-model="value" placeholder="请选择" style="width:120px;margin-right:20px">
26
-        <el-option
27
-          v-for="item in options"
28
-          :key="item.value"
29
-          :label="item.label"
30
-          :value="item.value"
21
+          v-for="item in item_columns"
22
+          :key="item.id"
23
+          :label="item.item_name"
24
+          :value="item.id"
31 25
         ></el-option>
32 26
       </el-select>
33
-      <el-select
34
-        v-model="value"
35
-        placeholder="请选择"
36
-        @change="chooseType"
37
-        style="width:120px;margin-right:20px"
38
-      >
27
+
28
+      <el-select v-model="query.range_value" placeholder="请选择" style="width:120px;margin-right:20px"
29
+                 @change="changeRangeValue">
39 30
         <el-option
40
-          v-for="item in options"
41
-          :key="item.value"
42
-          :label="item.label"
43
-          :value="item.value"
31
+          v-for="item in range_value_columns"
32
+          :key="item"
33
+          :label="item"
34
+          :value="item"
44 35
         ></el-option>
45 36
       </el-select>
37
+
46 38
       <label class="title">
47 39
         <span class="name">日期查询</span> :
48 40
       </label>
49 41
       <el-date-picker
50
-        v-model="listQuery.start_time"
42
+        v-model="query.start_time"
51 43
         prefix-icon="el-icon-date"
52 44
         @change="changeTime"
53 45
         :editable="false"
54
-        style="width: 196px;"
46
+        style="width: 150px;"
55 47
         type="date"
48
+        :picker-options="pickerOptions"
56 49
         placeholder="选择日期时间"
57 50
         align="right"
58 51
         format="yyyy-MM-dd"
@@ -60,11 +53,12 @@
60 53
       ></el-date-picker>
61 54
       <span class>-</span>
62 55
       <el-date-picker
63
-        v-model="listQuery.end_time"
56
+        v-model="query.end_time"
64 57
         prefix-icon="el-icon-date"
65 58
         @change="changeEndTime"
66 59
         :editable="false"
67
-        style="width: 196px;"
60
+        :picker-options="pickerOptions"
61
+        style="width: 150px;"
68 62
         type="date"
69 63
         placeholder="选择日期时间"
70 64
         align="right"
@@ -74,29 +68,52 @@
74 68
     </div>
75 69
     <div class="tableTitle">统计图</div>
76 70
     <div>
77
-      <line-chart :options="chart"></line-chart>
71
+      <line-chart :options="options"></line-chart>
78 72
     </div>
79 73
     <div class="tableTitle">统计表</div>
80 74
     <div>
81
-      <el-table :data="tableData" style="width: 100%" border :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}">
82
-        <el-table-column fixed prop="date" label="日期"></el-table-column>
83
-        <el-table-column prop="name" label="姓名"></el-table-column>
84
-        <el-table-column prop="province" label="省份"></el-table-column>
85
-        <el-table-column prop="city" label="市区"></el-table-column>
86
-        <el-table-column prop="address" label="地址"></el-table-column>
87
-        <el-table-column prop="zip" label="邮编"></el-table-column>
88
-        <el-table-column label="操作">
75
+      <el-table :data="tableData" style="width: 100%" :height="tableHeight">
76
+
77
+
78
+        <el-table-column label="姓名" align="center">
89 79
           <template slot-scope="scope">
90
-            <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
80
+            {{scope.row.patient.name}}
91 81
           </template>
92 82
         </el-table-column>
83
+
84
+        <el-table-column fixed label="检查日期" align="center">
85
+          <template slot-scope="scope">
86
+            <!--{{getTime(scope.row.inspect_date)}}-->
87
+            {{scope.row.inspect_date | parseTime('{y}-{m}-{d}') }}
88
+
89
+          </template>
90
+        </el-table-column>
91
+
92
+
93
+        <el-table-column :label="item_name" align="center">
94
+          <template slot-scope="scope">
95
+            {{scope.row.inspect_value}}
96
+          </template>
97
+        </el-table-column>
98
+
99
+        <el-table-column fixed="right" label="趋势" align="center">
100
+          <template slot-scope="scope">
101
+            <el-button
102
+              @click.native.prevent="jumpDetail(scope.row)"
103
+              type="text"
104
+              size="small"
105
+            >详情
106
+            </el-button>
107
+          </template>
108
+        </el-table-column>
109
+
93 110
       </el-table>
94 111
 
95 112
       <el-pagination
96 113
         align="right"
97 114
         @size-change="handleSizeChange"
98 115
         @current-change="handleCurrentChange"
99
-        :current-page="listQuery.page"
116
+        :current-page="query.page"
100 117
         :page-sizes="[10, 20, 50, 100]"
101 118
         :page-size="10"
102 119
         background
@@ -110,228 +127,354 @@
110 127
 
111 128
 
112 129
 <script>
113
-import echarts from "echarts";
114
-import LineChart from "../../components/LineChart";
115
-export default {
116
-  components: {
117
-    LineChart
118
-  },
119
-  data() {
120
-    return {
121
-      listQuery: {
122
-        start_time: "",
123
-        end_time: "",
124
-        page: 1,
125
-        limit: 10
126
-      },
127
-      options: [
128
-        {
129
-          value: "选项1",
130
-          label: "黄金糕"
131
-        },
132
-        {
133
-          value: "选项2",
134
-          label: "双皮奶"
135
-        },
136
-        {
137
-          value: "选项3",
138
-          label: "蚵仔煎"
139
-        },
140
-        {
141
-          value: "选项4",
142
-          label: "龙须面"
143
-        },
144
-        {
145
-          value: "选项5",
146
-          label: "北京烤鸭"
147
-        }
148
-      ],
149
-      value: "请选项",
150
-      tableData: [
151
-        {
152
-          date: "2016-05-03",
153
-          name: "王小虎",
154
-          province: "上海",
155
-          city: "普陀区",
156
-          address: "上海市普陀区金沙江路 1518 弄",
157
-          zip: 200333
158
-        },
159
-        {
160
-          date: "2016-05-02",
161
-          name: "王小虎",
162
-          province: "上海",
163
-          city: "普陀区",
164
-          address: "上海市普陀区金沙江路 1518 弄",
165
-          zip: 200333
166
-        },
167
-        {
168
-          date: "2016-05-04",
169
-          name: "王小虎",
170
-          province: "上海",
171
-          city: "普陀区",
172
-          address: "上海市普陀区金沙江路 1518 弄",
173
-          zip: 200333
174
-        },
175
-        {
176
-          date: "2016-05-01",
177
-          name: "王小虎",
178
-          province: "上海",
179
-          city: "普陀区",
180
-          address: "上海市普陀区金沙江路 1518 弄",
181
-          zip: 200333
182
-        },
183
-        {
184
-          date: "2016-05-08",
185
-          name: "王小虎",
186
-          province: "上海",
187
-          city: "普陀区",
188
-          address: "上海市普陀区金沙江路 1518 弄",
189
-          zip: 200333
190
-        },
191
-        {
192
-          date: "2016-05-06",
193
-          name: "王小虎",
194
-          province: "上海",
195
-          city: "普陀区",
196
-          address: "上海市普陀区金沙江路 1518 弄",
197
-          zip: 200333
198
-        },
199
-        {
200
-          date: "2016-05-07",
201
-          name: "王小虎",
202
-          province: "上海",
203
-          city: "普陀区",
204
-          address: "上海市普陀区金沙江路 1518 弄",
205
-          zip: 200333
206
-        },
207
-        {
208
-          date: "2016-05-08",
209
-          name: "王小虎",
210
-          province: "上海",
211
-          city: "普陀区",
212
-          address: "上海市普陀区金沙江路 1518 弄",
213
-          zip: 200333
214
-        },
215
-        {
216
-          date: "2016-05-06",
217
-          name: "王小虎",
218
-          province: "上海",
219
-          city: "普陀区",
220
-          address: "上海市普陀区金沙江路 1518 弄",
221
-          zip: 200333
222
-        },
223
-        {
224
-          date: "2016-05-07",
225
-          name: "王小虎",
226
-          province: "上海",
227
-          city: "普陀区",
228
-          address: "上海市普陀区金沙江路 1518 弄",
229
-          zip: 200333
230
-        }
231
-      ],
232
-      chart: {
233
-        title: {
234
-          text: "ECharts 入门示例"
235
-        },
236
-        tooltip: {},
237
-        legend: {
238
-          data: ["次数"],
239
-          left: 0
130
+  import echarts from 'echarts'
131
+  import LineChart from '../../components/LineChart'
132
+  import {
133
+    GetInspectionIndexChart,
134
+    GetInspectionIndexInit,
135
+    GetInspectionIndexTable,
136
+    GetPatientInspectionIndexBarChart,
137
+    GetPatientInspectionIndexChart,
138
+    GetRangeValue
139
+  } from '@/api/common/statistics'
140
+  import { uParseTime } from '@/utils/tools'
141
+
142
+  export default {
143
+    components: {
144
+      LineChart
145
+    },
146
+    data() {
147
+      return {
148
+        pickerOptions: {
149
+          disabledDate(time) {
150
+            let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000
151
+            return time.getTime() > Date.now() || time.getTime() < threeMonths
152
+
153
+          }
240 154
         },
241
-        xAxis: {
242
-          data: ["达标", "未达标"]
155
+        item_name: '',
156
+        query: {
157
+          patient_id: '',
158
+          start_time: '',
159
+          end_time: '',
160
+          limit: 20,
161
+          page: 1,
162
+          project_id: '',
163
+          item_id: '',
164
+          range_type: '',
165
+          range_value: ''
243 166
         },
244
-        yAxis: {
245
-          axisLabel: {
246
-            formatter: "{value} %"
167
+        project_columns: [],
168
+        item_columns: [],
169
+        range_value_columns: [],
170
+
171
+        all_inspection_reference: [],
172
+
173
+        value: '请选项',
174
+        tableData: [],
175
+        options: {
176
+          title: {
177
+            text: 'ECharts 入门示例'
247 178
           },
248
-          show: false
249
-        },
250
-        series: [
251
-          {
252
-            name: "次数",
253
-            type: "bar",
254
-            data: ["78.57", "50"],
255
-            barWidth: 30,
256
-            label: {
257
-              normal: {
258
-                show: true,
259
-                position: "top",
260
-                formatter: "{c}次"
261
-              }
179
+          tooltip: {},
180
+          legend: {
181
+            data: [''],
182
+            left: 0
183
+          },
184
+          xAxis: {
185
+            data: ['达标', '未达标']
186
+          },
187
+          yAxis: {
188
+            axisLabel: {
189
+              formatter: '{value} %'
262 190
             },
263
-            //配置样式
264
-            itemStyle: {
265
-              //通常情况下:
266
-
267
-              //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
268
-              normal: {
269
-                color: function(params) {
270
-                  //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
271
-                  var colorList = [
272
-                    ["#A9E0F3", "#9FBDFC"],
273
-
274
-                    ["#FFD7C0", "#FF9994"]
275
-                  ];
276
-
277
-                  var index = params.dataIndex;
278
-                  if (params.dataIndex >= colorList.length) {
279
-                    index = params.dataIndex % colorList.length;
280
-                  }
191
+            show: false
192
+          },
281 193
 
282
-                  return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
283
-                    { offset: 0, color: colorList[index][0] },
284
-                    // { offset: 0.5, color: colorList[index][1] },
285
-                    { offset: 1, color: colorList[index][1] }
286
-                  ]);
287
-                },
288
-                barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
194
+          series: [
195
+            {
196
+              name: '',
197
+              type: 'bar',
198
+              data: ['78.57', '50'],
199
+              barWidth: 30,
200
+              label: {
201
+                normal: {
202
+                  show: true,
203
+                  position: 'top',
204
+                  formatter: '{c}'
205
+                }
289 206
               },
207
+              //配置样式
208
+              itemStyle: {
209
+                //通常情况下:
210
+
211
+                //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
212
+                normal: {
213
+                  color: function(params) {
214
+                    //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
215
+                    var colorList = ['#A9E0F3', '#9FBDFC']
216
+
217
+                    // var index = params.dataIndex;
218
+                    // if (params.dataIndex >= colorList.length) {
219
+                    //   index = params.dataIndex % colorList.length;
220
+                    // }
221
+
222
+                    return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
223
+                      { offset: 0, color: colorList[0] },
224
+                      // { offset: 0.5, color: colorList[index][1] },
225
+                      { offset: 1, color: colorList[1] }
226
+                    ])
227
+                  },
228
+                  barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
229
+                },
290 230
 
291
-              //鼠标悬停时:
292
-              emphasis: {
293
-                shadowBlur: 10,
294
-                shadowOffsetX: 0,
295
-                shadowColor: "rgba(0, 0, 0, 0.5)"
231
+                //鼠标悬停时:
232
+                emphasis: {
233
+                  shadowBlur: 10,
234
+                  shadowOffsetX: 0,
235
+                  shadowColor: 'rgba(0, 0, 0, 0.5)'
236
+                }
296 237
               }
297 238
             }
298
-          }
299
-        ]
239
+          ]
240
+        }
300 241
       }
301
-    };
302
-  },
303
-  methods: {
304
-    changeTime() {},
305
-    changeEndTime(val) {
306
-      var time =
307
-        this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
308
-      if (time < 0) {
309
-        this.$message.error("结束时间不能小于开始时间");
310
-        this.listQuery.end_time = "";
311
-      } else {
242
+    },
243
+    methods: {
244
+      handleSizeChange(limit) {
245
+        this.query.limit = limit
246
+        this.GetInspectionIndexTable(this.query)
247
+
248
+      },
249
+      handleCurrentChange(page) {
250
+        this.query.page = page
251
+        this.GetInspectionIndexTable(this.query)
252
+
253
+      },
254
+      changeProject(val) {
255
+        this.query.page = 1
256
+        let item_inspection_reference = []
257
+        for (let i = 0; i < this.all_inspection_reference.length; i++) {
258
+          if (this.all_inspection_reference[i].project_id == val) {
259
+            item_inspection_reference.push(this.all_inspection_reference[i])
260
+          }
261
+        }
262
+        this.item_columns = item_inspection_reference
263
+        var projectInfo = this.getPojectInfo(this.item_columns[0].project_id, this.item_columns[0].id)
264
+        this.query.project_id = projectInfo.project_id
265
+        this.query.item_id = projectInfo.id
266
+        this.item_name = projectInfo.item_name
267
+        this.query.range_type = projectInfo.range_type
268
+        this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.id)
269
+
270
+      }, changeItem(val) {
271
+        this.query.page = 1
272
+        this.query.item_id = val
273
+        var projectInfo = this.getPojectInfo(this.query.project_id, val)
274
+        console.log(projectInfo)
275
+        this.item_name = projectInfo.item_name
276
+
277
+        this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.id)
278
+
279
+      }, changeRangeValue(val) {
280
+        this.query.range_value = val
281
+        this.query.page = 1
282
+        this.GetInspectionIndexTable(this.query)
283
+
284
+      },
285
+      GetInspectionIndexInit() {
286
+        GetInspectionIndexInit()
287
+          .then(rs => {
288
+            var resp = rs.data
289
+            if (resp.state == 1) {
290
+              let project = []
291
+              let item = []
292
+              this.all_inspection_reference = resp.data.references
293
+
294
+              for (let i = 0; i < this.all_inspection_reference.length; i++) {
295
+                project.push(this.all_inspection_reference[i])
296
+              }
297
+              var obj = {}
298
+              //去重复
299
+              project = project.reduce((cur, next) => {
300
+                obj[next.project_id] ? '' : (obj[next.project_id] = true && cur.push(next))
301
+                return cur
302
+              }, [])
303
+
304
+              this.project_columns = project
305
+
306
+              for (let i = 0; i < this.all_inspection_reference.length; i++) {
307
+                if (this.all_inspection_reference[i].project_id == this.project_columns[0].project_id) {
308
+                  item.push(this.all_inspection_reference[i])
309
+                }
310
+              }
311
+              this.item_columns = item
312
+              this.item_name = item[0].item_name
313
+
314
+              var projectInfo = this.getPojectInfo(this.project_columns[0].project_id, this.item_columns[0].id)
315
+              this.query.project_id = projectInfo.project_id
316
+              this.query.item_id = projectInfo.id
317
+              this.query.range_type = projectInfo.range_type
318
+              this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.id)
319
+            } else {
320
+              this.$message.error(resp.msg)
321
+
322
+            }
323
+          })
324
+          .catch(error => {
325
+
326
+          })
327
+
328
+      },
329
+      getPojectInfo(project_id, item_id) {
330
+        for (let i = 0; i < this.all_inspection_reference.length; i++) {
331
+          if (this.all_inspection_reference[i].project_id == project_id && this.all_inspection_reference[i].id == item_id) {
332
+            return this.all_inspection_reference[i]
333
+          }
334
+        }
335
+        return null
336
+      },
337
+      changeTime(val) {
338
+        var time = this.getTimestamp(val) - this.getTimestamp(this.query.end_time)
339
+        if (time > 0) {
340
+          this.$message.error('结束时间不能小于开始时间')
341
+        } else {
342
+          // this.getDialysisList()
343
+          this.query.page = 1
344
+          this.GetInspectionIndexChart(this.query)
345
+          this.GetInspectionIndexTable(this.query)
346
+
347
+        }
348
+
349
+      },
350
+      changeEndTime(val) {
351
+        var time =
352
+          this.getTimestamp(val) - this.getTimestamp(this.query.start_time)
353
+        if (time < 0) {
354
+          this.$message.error('结束时间不能小于开始时间')
355
+        } else {
356
+          this.query.page = 1
357
+          this.GetInspectionIndexChart(this.query)
358
+          this.GetInspectionIndexTable(this.query)
359
+
360
+        }
361
+      },
362
+      handleClick(row) {
363
+        console.log(row)
364
+        this.$router.push({ path: '/qcd/analysisDetails' })
365
+      },
366
+      GetRangeValue(range_type, project_id, id) {
367
+        let params = {
368
+          range_type: range_type,
369
+          project_id: project_id,
370
+          item_id: id
371
+        }
372
+        GetRangeValue(params)
373
+          .then(rs => {
374
+              var resp = rs.data
375
+              if (resp.state == 1) {
376
+                if (range_type == 1) {
377
+                  this.range_value_columns = []
378
+                  this.range_value_columns.push('全部')
379
+                  this.range_value_columns.push('小于' + resp.data.range_vaule[0])
380
+                  this.range_value_columns.push(resp.data.range_vaule[0] + '~' + resp.data.range_vaule[1])
381
+                  this.range_value_columns.push('大于' + resp.data.range_vaule[1])
382
+                  this.query.range_value = '全部'
383
+
384
+                } else {
385
+                  this.range_value_columns = []
386
+                  this.range_value_columns.push('全部')
387
+                  for (let i = 0; i < resp.data.range_vaule.length; i++) {
388
+                    this.range_value_columns.push(resp.data.range_vaule[i])
389
+                  }
390
+                  this.query.range_value = '全部'
391
+                }
392
+                this.GetInspectionIndexChart(this.query)
393
+                this.GetInspectionIndexTable(this.query)
394
+              } else {
395
+                this.$message.error(resp.msg)
396
+
397
+              }
398
+            }
399
+          )
400
+          .catch(error => {
401
+
402
+          })
403
+      },
404
+      GetInspectionIndexChart(params) {
405
+        this.options.xAxis.data = []
406
+        this.options.series[0].data = []
407
+        GetInspectionIndexChart(params)
408
+          .then(rs => {
409
+            var resp = rs.data
410
+            if (resp.state == 1) {
411
+              for (let i = 0; i < resp.data.data.length; i++) {
412
+                this.options.xAxis.data.push(resp.data.data[i].name)
413
+                this.options.series[0].data.push(resp.data.data[i].total)
414
+              }
415
+            } else {
416
+              this.$message.error(resp.msg)
417
+            }
418
+          })
419
+          .catch(error => {
420
+
421
+          })
422
+      },
423
+      GetInspectionIndexTable(params) {
424
+        GetInspectionIndexTable(params)
425
+          .then(rs => {
426
+            var resp = rs.data
427
+            if (resp.state == 1) {
428
+              this.tableData = []
429
+              for (let i = 0; i < resp.data.data.length; i++) {
430
+                this.tableData.push(resp.data.data[i])
431
+              }
432
+
433
+            } else {
434
+              this.$toast({
435
+                message: resp.msg
436
+              })
437
+            }
438
+          })
439
+          .catch(error => {
440
+
441
+          })
442
+
312 443
       }
313 444
     },
314
-    handleClick(row) {
315
-      console.log(row);
316
-      this.$router.push({ path: "/qcd/analysisDetails" });
445
+    created() {
446
+      this.tableHeight = (document.documentElement.clientHeight - 44) + 'px'
447
+      var date = new Date()
448
+      var year = date.getFullYear() //获取完整的年份(4位)
449
+      var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
450
+      var day = date.getDate() < 0 ? '0' + date.getDate().toString() : date.getDate() //获取当前日(1-31)
451
+      var last_month = date.getMonth() < 10 ? '0' + date.getMonth().toString() : date.getMonth() //获取当前月份(0-11,0代表1月)
452
+      this.query.end_time = year + '-' + month + '-' + day
453
+      this.query.start_time = year + '-' + last_month + '-' + day
454
+      this.GetInspectionIndexInit()
455
+      // this.GetDialysisBloodPressureTableData(this.query)
456
+
317 457
     }
458
+
318 459
   }
319
-};
460
+
320 461
 </script>
321 462
 
322 463
 
323 464
 <style lang="scss" scoped>
324
-.tableTitle {
325
-  font-size: 16px;
326
-  color: #000;
327
-  font-weight: bold;
328
-  margin-bottom: 10px;
329
-}
465
+  .tableTitle {
466
+    font-size: 16px;
467
+    color: #000;
468
+    font-weight: bold;
469
+    margin-bottom: 10px;
470
+  }
330 471
 </style>
331 472
 <style lang="scss">
332
-.page_office {
473
+  .page_office {
474
+
333 475
   .cell {
334 476
     text-align: center;
335 477
   }
336
-}
478
+
479
+  }
337 480
 </style>

+ 519 - 265
src/xt_pages/qcd/indicatorControlAnalysis/components/personal.vue View File

@@ -1,64 +1,70 @@
1 1
 <template>
2 2
   <div class="page_personal">
3 3
     <div class="cell clearfix">
4
-      <el-form :inline="true" :model="listQuery">
4
+      <el-form :inline="true">
5 5
         <el-form-item label>
6
-          <el-input v-model.trim="listQuery.search" placeholder="姓名/透析号" style="width:110px"></el-input>
7
-          <el-button type="primary" @click="onSearch" icon="el-icon-search">搜索</el-button>
6
+          <el-autocomplete
7
+            class="checkSearch"
8
+            popper-class="my-autocomplete"
9
+            v-model="search_value"
10
+            :fetch-suggestions="querySearchAsync"
11
+            :trigger-on-focus="false"
12
+            placeholder="请输入病人名字"
13
+            @select="handleSelect"
14
+          >
15
+            <i class="el-icon-search el-input__icon" slot="suffix"></i>
16
+            <template slot-scope="{ item }">
17
+              <div class="name">{{ item.name }}</div>
18
+            </template>
19
+          </el-autocomplete>
20
+
8 21
         </el-form-item>
9 22
       </el-form>
10
-      <el-select v-model="value" placeholder="请选择" style="width:110px;margin-right:10px">
23
+      <el-select v-model="query.project_id" placeholder="请选择" style="width:120px;margin-right:20px"
24
+                 @change="changeProject">
11 25
         <el-option
12
-          v-for="item in options"
13
-          :key="item.value"
14
-          :label="item.label"
15
-          :value="item.value"
26
+          v-for="item in project_columns"
27
+          :key="item.project_id"
28
+          :label="item.project_name"
29
+          :value="item.project_id"
16 30
         ></el-option>
17 31
       </el-select>
32
+
18 33
       <el-select
19
-        v-model="value"
34
+        v-model="query.item_id"
20 35
         placeholder="请选择"
21
-        @change="chooseType"
22
-        style="width:110px;margin-right:10px"
36
+        style="width:120px;margin-right:20px"
37
+        @change="changeItem"
23 38
       >
24 39
         <el-option
25
-          v-for="item in options"
26
-          :key="item.value"
27
-          :label="item.label"
28
-          :value="item.value"
29
-        ></el-option>
30
-      </el-select>
31
-      <el-select v-model="value" placeholder="请选择" style="width:110px;margin-right:10px">
32
-        <el-option
33
-          v-for="item in options"
34
-          :key="item.value"
35
-          :label="item.label"
36
-          :value="item.value"
40
+          v-for="item in item_columns"
41
+          :key="item.id"
42
+          :label="item.item_name"
43
+          :value="item.id"
37 44
         ></el-option>
38 45
       </el-select>
39
-      <el-select
40
-        v-model="value"
41
-        placeholder="请选择"
42
-        @change="chooseType"
43
-        style="width:110px;margin-right:10px"
44
-      >
46
+
47
+      <el-select v-model="query.range_value" placeholder="请选择" style="width:120px;margin-right:20px"
48
+                 @change="changeRangeValue">
45 49
         <el-option
46
-          v-for="item in options"
47
-          :key="item.value"
48
-          :label="item.label"
49
-          :value="item.value"
50
+          v-for="item in range_value_columns"
51
+          :key="item"
52
+          :label="item"
53
+          :value="item"
50 54
         ></el-option>
51 55
       </el-select>
56
+
52 57
       <label class="title">
53 58
         <span class="name">日期查询</span> :
54 59
       </label>
55 60
       <el-date-picker
56
-        v-model="listQuery.start_time"
61
+        v-model="query.start_time"
57 62
         prefix-icon="el-icon-date"
58 63
         @change="changeTime"
59 64
         :editable="false"
60 65
         style="width: 150px;"
61 66
         type="date"
67
+        :picker-options="pickerOptions"
62 68
         placeholder="选择日期时间"
63 69
         align="right"
64 70
         format="yyyy-MM-dd"
@@ -66,10 +72,11 @@
66 72
       ></el-date-picker>
67 73
       <span class>-</span>
68 74
       <el-date-picker
69
-        v-model="listQuery.end_time"
75
+        v-model="query.end_time"
70 76
         prefix-icon="el-icon-date"
71 77
         @change="changeEndTime"
72 78
         :editable="false"
79
+        :picker-options="pickerOptions"
73 80
         style="width: 150px;"
74 81
         type="date"
75 82
         placeholder="选择日期时间"
@@ -81,20 +88,27 @@
81 88
     <el-container>
82 89
       <div style="width:150px">
83 90
         <div class="tableTitle">患者列表</div>
84
-        <el-table :data="tableData" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}">
85
-          <el-table-column prop="date" label="日期" width="70"></el-table-column>
86
-          <el-table-column prop="name" label="姓名" width="80"></el-table-column>
91
+        <el-table :data="patientsData" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }"
92
+                  :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
93
+                  highlight-current-row
94
+                  @current-change="handleChange">
95
+          <el-table-column prop="dialysis_no" label="透析号" width="80">
96
+            <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
97
+          </el-table-column>
98
+          <el-table-column prop="name" label="姓名" width="80">
99
+            <template slot-scope="scope">{{ scope.row.name }}</template>
100
+          </el-table-column>
87 101
         </el-table>
88 102
       </div>
89 103
       <div style="padding-left:10px;flex:1">
90 104
         <div class="tableTitle">统计图</div>
91 105
         <div>
92
-          <line-chart :options="chart"></line-chart>
106
+          <line-chart :options="options"></line-chart>
93 107
         </div>
94 108
         <div class="tableTitle">指标趋势</div>
95 109
         <div>
96 110
           <div>
97
-            <line-chart :options="chart1"></line-chart>
111
+            <line-chart :options="options2"></line-chart>
98 112
           </div>
99 113
         </div>
100 114
         <div></div>
@@ -105,267 +119,507 @@
105 119
 
106 120
 
107 121
 <script>
108
-import echarts from "echarts";
109
-import LineChart from "../../components/LineChart";
110
-export default {
111
-  components: {
112
-    LineChart
113
-  },
114
-  data() {
115
-    return {
116
-      listQuery: {
117
-        start_time: "",
118
-        end_time: "",
119
-        page: 1,
120
-        limit: 10
121
-      },
122
-      options: [
123
-        {
124
-          value: "选项1",
125
-          label: "黄金糕"
126
-        },
127
-        {
128
-          value: "选项2",
129
-          label: "双皮奶"
130
-        },
131
-        {
132
-          value: "选项3",
133
-          label: "蚵仔煎"
134
-        },
135
-        {
136
-          value: "选项4",
137
-          label: "龙须面"
138
-        },
139
-        {
140
-          value: "选项5",
141
-          label: "北京烤鸭"
142
-        }
143
-      ],
144
-      value: "请选项",
145
-      tableData: [
146
-        {
147
-          date: "2016",
148
-          name: "王小虎"
149
-        },
150
-        {
151
-          date: "2016",
152
-          name: "王小虎"
153
-        },
154
-        {
155
-          date: "2016",
156
-          name: "王小虎"
157
-        },
158
-        {
159
-          date: "2016",
160
-          name: "王小虎"
161
-        },
162
-        {
163
-          date: "2016",
164
-          name: "王小虎"
165
-        },
166
-        {
167
-          date: "2016",
168
-          name: "王小虎"
169
-        },
170
-        {
171
-          date: "2016",
172
-          name: "王小虎"
173
-        },
174
-        {
175
-          date: "2016",
176
-          name: "王小虎"
177
-        },
178
-        {
179
-          date: "2016",
180
-          name: "王小虎"
181
-        },
182
-        {
183
-          date: "2016",
184
-          name: "王小虎"
185
-        },
186
-        {
187
-          date: "2016",
188
-          name: "王小虎"
189
-        },
190
-        {
191
-          date: "2016",
192
-          name: "王小虎"
193
-        }
194
-      ],
195
-      chart: {
196
-        title: {
197
-          text: "ECharts 入门示例"
198
-        },
199
-        tooltip: {},
200
-        legend: {
201
-          data: ["次数"],
202
-          left: 0
122
+  import echarts from 'echarts'
123
+  import LineChart from '../../components/LineChart'
124
+  import {
125
+    GetInspectionIndexChart,
126
+    GetInspectionIndexInit,
127
+    GetInspectionIndexTable,
128
+    GetPatientInspectionIndexBarChart,
129
+    GetPatientInspectionIndexChart,
130
+    GetRangeValue,
131
+    GetDefalutPatient
132
+  } from '@/api/common/statistics'
133
+  import { uParseTime } from '@/utils/tools'
134
+  import { getCurrentOrgPatients } from '@/api/common/common'
135
+
136
+  import { PostSearch } from '@/api/patient'
137
+
138
+  export default {
139
+    components: {
140
+      LineChart
141
+    },
142
+    data() {
143
+      return {
144
+        pickerOptions: {
145
+          disabledDate(time) {
146
+            let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000
147
+            return time.getTime() > Date.now() || time.getTime() < threeMonths
148
+
149
+          }
203 150
         },
204
-        xAxis: {
205
-          data: ["达标", "未达标"]
151
+        item_name: '',
152
+        search_value: '',
153
+        query: {
154
+          patient_id: '',
155
+          start_time: '',
156
+          end_time: '',
157
+          limit: 20,
158
+          page: 1,
159
+          project_id: '',
160
+          item_id: '',
161
+          range_type: '',
162
+          range_value: ''
206 163
         },
207
-        yAxis: {
208
-          axisLabel: {
209
-            formatter: "{value} %"
164
+        project_columns: [],
165
+        item_columns: [],
166
+        range_value_columns: [],
167
+
168
+        all_inspection_reference: [],
169
+        patientsData: [],
170
+        value: '请选项',
171
+        tableData: [],
172
+        options: {
173
+          title: {
174
+            text: 'ECharts 入门示例'
210 175
           },
211
-          show: false
212
-        },
213
-        series: [
214
-          {
215
-            name: "次数",
216
-            type: "bar",
217
-            data: ["78.57", "50"],
218
-            barWidth: 30,
219
-            label: {
220
-              normal: {
221
-                show: true,
222
-                position: "top",
223
-                formatter: "{c}次"
224
-              }
176
+          tooltip: {},
177
+          legend: {
178
+            data: [''],
179
+            left: 0
180
+          },
181
+          xAxis: {
182
+            data: []
183
+          },
184
+          yAxis: {
185
+            axisLabel: {
186
+              formatter: '{value} %'
225 187
             },
226
-            //配置样式
227
-            itemStyle: {
228
-              //通常情况下:
229
-
230
-              //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
231
-              normal: {
232
-                color: function(params) {
233
-                  //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
234
-                  var colorList = [
235
-                    ["#A9E0F3", "#9FBDFC"],
236
-
237
-                    ["#FFD7C0", "#FF9994"]
238
-                  ];
239
-
240
-                  var index = params.dataIndex;
241
-                  if (params.dataIndex >= colorList.length) {
242
-                    index = params.dataIndex % colorList.length;
243
-                  }
188
+            show: false
189
+          },
190
+          series: [
191
+            {
192
+              name: '',
193
+              type: 'bar',
194
+              data: [],
195
+              barWidth: 30,
196
+              label: {
197
+                normal: {
198
+                  show: true,
199
+                  position: 'top',
200
+                  formatter: '{c}'
201
+                }
202
+              },
203
+              //配置样式
204
+              itemStyle: {
205
+                //通常情况下:
206
+
207
+                //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
208
+                normal: {
209
+                  color: function(params) {
210
+                    //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
211
+                    var colorList = [
212
+                      ['#A9E0F3', '#9FBDFC'],
244 213
 
245
-                  return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
246
-                    { offset: 0, color: colorList[index][0] },
247
-                    // { offset: 0.5, color: colorList[index][1] },
248
-                    { offset: 1, color: colorList[index][1] }
249
-                  ]);
214
+                      ['#FFD7C0', '#FF9994']
215
+                    ]
216
+
217
+                    var index = params.dataIndex
218
+                    if (params.dataIndex >= colorList.length) {
219
+                      index = params.dataIndex % colorList.length
220
+                    }
221
+
222
+                    return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
223
+                      { offset: 0, color: colorList[index][0] },
224
+                      // { offset: 0.5, color: colorList[index][1] },
225
+                      { offset: 1, color: colorList[index][1] }
226
+                    ])
227
+                  },
228
+                  barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
250 229
                 },
251
-                barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
252
-              },
253 230
 
254
-              //鼠标悬停时:
255
-              emphasis: {
256
-                shadowBlur: 10,
257
-                shadowOffsetX: 0,
258
-                shadowColor: "rgba(0, 0, 0, 0.5)"
231
+                //鼠标悬停时:
232
+                emphasis: {
233
+                  shadowBlur: 10,
234
+                  shadowOffsetX: 0,
235
+                  shadowColor: 'rgba(0, 0, 0, 0.5)'
236
+                }
259 237
               }
260 238
             }
261
-          }
262
-        ]
263
-      },
264
-      chart1: {
265
-        title: {
266
-          text: "ECharts 入门示例"
267
-        },
268
-        tooltip: {},
269
-        legend: {
270
-          data: ["次数"],
271
-          left: 0
239
+          ]
272 240
         },
273
-        xAxis: {
274
-          data: ["达标", "未达标"]
275
-        },
276
-        yAxis: {
277
-          axisLabel: {
278
-            formatter: "{value} %"
241
+        options2: {
242
+          title: {
243
+            text: 'ECharts 入门示例'
279 244
           },
280
-          show: false
281
-        },
282
-        series: [
283
-          {
284
-            name: "次数",
285
-            type: "line",
286
-            data: ["78.57", "50"],
287
-            barWidth: 30,
288
-            label: {
289
-              normal: {
290
-                show: true,
291
-                position: "top",
292
-                formatter: "{c}次"
245
+          tooltip: {},
246
+          legend: {
247
+            data: ['次数'],
248
+            left: 0
249
+          },
250
+          xAxis: {
251
+            data: [],
252
+            axisLine: {
253
+              lineStyle: {
254
+                color: '#FF0000',
255
+                width: 8 //这里是为了突出显示加上的
293 256
               }
294 257
             },
295
-            //配置样式
296
-            itemStyle: {
297
-              //通常情况下:
298
-
299
-              //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
300
-              normal: {
301
-                color: function(params) {
302
-                  //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
303
-                  var colorList = [
304
-                    ["#A9E0F3", "#9FBDFC"],
305
-
306
-                    ["#FFD7C0", "#FF9994"]
307
-                  ];
308
-
309
-                  var index = params.dataIndex;
310
-                  if (params.dataIndex >= colorList.length) {
311
-                    index = params.dataIndex % colorList.length;
258
+            axisLabel: {
259
+              interval: 0,
260
+              formatter: function(value) {
261
+                var ret = '' //拼接加\n返回的类目项
262
+                var maxLength = 8 //每项显示文字个数
263
+                var valLength = value.length //X轴类目项的文字个数
264
+                var rowN = Math.ceil(valLength / maxLength) //类目项需要换行的行数
265
+                if (rowN > 1) {
266
+                  //如果类目项的文字大于3,
267
+                  for (var i = 0; i < rowN; i++) {
268
+                    var temp = '' //每次截取的字符串
269
+                    var start = i * maxLength //开始截取的位置
270
+                    var end = start + maxLength //结束截取的位置
271
+                    //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
272
+                    temp = value.substring(start, end) + '\n'
273
+                    ret += temp //凭借最终的字符串
312 274
                   }
275
+                  return ret
276
+                } else {
277
+                  return value
278
+                }
279
+              }
280
+            }
281
+          },
282
+          yAxis: {
283
+            axisLabel: {
284
+              formatter: '{value} %'
285
+            },
286
+            show: false,
287
+            axisLine: {
288
+              lineStyle: {
289
+                color: '#00FF00',
290
+                width: 8 //这里是为了突出显示加上的
291
+              }
292
+            }
293
+          },
294
+          series: [
295
+            {
296
+              name: '',
297
+              type: 'line',
298
+              data: [],
299
+              barWidth: 30,
300
+              label: {
301
+                normal: {
302
+                  show: true,
303
+                  position: 'top',
304
+                  formatter: '{c}'
305
+                }
306
+              },
307
+              //配置样式
308
+              itemStyle: {
309
+                //通常情况下:
310
+
311
+                //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
312
+                normal: {
313
+                  color: function(params) {
314
+                    //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
315
+                    var colorList = [
316
+                      ['#A9E0F3', '#9FBDFC'],
317
+
318
+                      ['#FFD7C0', '#FF9994']
319
+                    ]
320
+
321
+                    var index = params.dataIndex
322
+                    if (params.dataIndex >= colorList.length) {
323
+                      index = params.dataIndex % colorList.length
324
+                    }
313 325
 
314
-                  return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
315
-                    { offset: 0, color: colorList[index][0] },
316
-                    // { offset: 0.5, color: colorList[index][1] },
317
-                    { offset: 1, color: colorList[index][1] }
318
-                  ]);
326
+                    return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
327
+                      { offset: 0, color: colorList[index][0] },
328
+                      // { offset: 0.5, color: colorList[index][1] },
329
+                      { offset: 1, color: colorList[index][1] }
330
+                    ])
331
+                  },
332
+                  barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
319 333
                 },
320
-                barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
321
-              },
322 334
 
323
-              //鼠标悬停时:
324
-              emphasis: {
325
-                shadowBlur: 10,
326
-                shadowOffsetX: 0,
327
-                shadowColor: "rgba(0, 0, 0, 0.5)"
335
+                //鼠标悬停时:
336
+                emphasis: {
337
+                  shadowBlur: 10,
338
+                  shadowOffsetX: 0,
339
+                  shadowColor: 'rgba(0, 0, 0, 0.5)'
340
+                }
328 341
               }
329 342
             }
330
-          }
331
-        ]
343
+          ]
344
+        }
345
+
332 346
       }
333
-    };
334
-  },
335
-  methods: {
336
-    changeTime() {},
337
-    changeEndTime(val) {
338
-      var time =
339
-        this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
340
-      if (time < 0) {
341
-        this.$message.error("结束时间不能小于开始时间");
342
-        this.listQuery.end_time = "";
343
-      } else {
347
+    },handleSelect(val) {
348
+      this.query.patient_id = val.id
349
+      this.query.page = 1
350
+      this.GetPatientInspectionIndexBarChart(this.query)
351
+      this.GetPatientInspectionIndexChart(this.query)
352
+    },
353
+    methods: {
354
+      querySearchAsync(keyword, cb) {
355
+        let key = ''
356
+        if (keyword != undefined) {
357
+          key = keyword
358
+        }
359
+        let searchArray = []
360
+        PostSearch(key).then(response => {
361
+          if (response.data.state == 1) {
362
+            searchArray = response.data.data.patient
363
+            cb(searchArray)
364
+          } else {
365
+            cb([])
366
+          }
367
+        })
368
+      },
369
+
370
+      getCurrentOrgPatients() {
371
+        getCurrentOrgPatients().then(response => {
372
+          if (response.data.state == 1) {
373
+            var patients = response.data.data.patients
374
+            this.patientsData = patients
375
+          }
376
+        })
377
+      },
378
+      changeProject(val) {
379
+        this.query.page = 1
380
+        let item_inspection_reference = []
381
+        for (let i = 0; i < this.all_inspection_reference.length; i++) {
382
+          if (this.all_inspection_reference[i].project_id == val) {
383
+            item_inspection_reference.push(this.all_inspection_reference[i])
384
+          }
385
+        }
386
+        this.item_columns = item_inspection_reference
387
+        var projectInfo = this.getPojectInfo(this.item_columns[0].project_id, this.item_columns[0].id)
388
+        this.query.project_id = projectInfo.project_id
389
+        this.query.item_id = projectInfo.id
390
+        this.item_name = projectInfo.item_name
391
+        this.query.range_type = projectInfo.range_type
392
+        this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.id)
393
+
394
+      }, changeItem(val) {
395
+        this.query.page = 1
396
+        this.query.item_id = val
397
+        var projectInfo = this.getPojectInfo(this.query.project_id, val)
398
+        console.log(projectInfo)
399
+        this.item_name = projectInfo.item_name
400
+
401
+        this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.id)
402
+
403
+      }, changeRangeValue(val) {
404
+        this.query.range_value = val
405
+        this.query.page = 1
406
+        this.GetInspectionIndexTable(this.query)
407
+
408
+      }, GetInspectionIndexInit() {
409
+        GetInspectionIndexInit()
410
+          .then(rs => {
411
+            var resp = rs.data
412
+            if (resp.state == 1) {
413
+              let project = []
414
+              let item = []
415
+              this.all_inspection_reference = resp.data.references
416
+
417
+              for (let i = 0; i < this.all_inspection_reference.length; i++) {
418
+                project.push(this.all_inspection_reference[i])
419
+              }
420
+              var obj = {}
421
+              //去重复
422
+              project = project.reduce((cur, next) => {
423
+                obj[next.project_id] ? '' : (obj[next.project_id] = true && cur.push(next))
424
+                return cur
425
+              }, [])
426
+
427
+              this.project_columns = project
428
+
429
+              for (let i = 0; i < this.all_inspection_reference.length; i++) {
430
+                if (this.all_inspection_reference[i].project_id == this.project_columns[0].project_id) {
431
+                  item.push(this.all_inspection_reference[i])
432
+                }
433
+              }
434
+              this.item_columns = item
435
+              this.item_name = item[0].item_name
436
+
437
+              var projectInfo = this.getPojectInfo(this.project_columns[0].project_id, this.item_columns[0].id)
438
+              this.query.project_id = projectInfo.project_id
439
+              this.query.item_id = projectInfo.id
440
+              this.query.range_type = projectInfo.range_type
441
+              this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.id)
442
+            } else {
443
+              this.$message.error(resp.msg)
444
+
445
+            }
446
+          })
447
+          .catch(error => {
448
+
449
+          })
450
+
451
+      },
452
+      getPojectInfo(project_id, item_id) {
453
+        for (let i = 0; i < this.all_inspection_reference.length; i++) {
454
+          if (this.all_inspection_reference[i].project_id == project_id && this.all_inspection_reference[i].id == item_id) {
455
+            return this.all_inspection_reference[i]
456
+          }
457
+        }
458
+        return null
459
+      }, changeTime(val) {
460
+        var time = this.getTimestamp(val) - this.getTimestamp(this.query.end_time)
461
+        if (time > 0) {
462
+          this.$message.error('结束时间不能小于开始时间')
463
+        } else {
464
+          // this.getDialysisList()
465
+          this.query.page = 1
466
+          this.GetInspectionIndexChart(this.query)
467
+          this.GetInspectionIndexTable(this.query)
468
+
469
+        }
470
+
471
+      },
472
+      changeEndTime(val) {
473
+        var time =
474
+          this.getTimestamp(val) - this.getTimestamp(this.query.start_time)
475
+        if (time < 0) {
476
+          this.$message.error('结束时间不能小于开始时间')
477
+        } else {
478
+          this.query.page = 1
479
+          this.GetInspectionIndexChart(this.query)
480
+          this.GetInspectionIndexTable(this.query)
481
+
482
+        }
483
+      }, GetRangeValue(range_type, project_id, id) {
484
+        let params = {
485
+          range_type: range_type,
486
+          project_id: project_id,
487
+          item_id: id
488
+        }
489
+        GetRangeValue(params)
490
+          .then(rs => {
491
+              var resp = rs.data
492
+              if (resp.state == 1) {
493
+                if (range_type == 1) {
494
+                  this.range_value_columns = []
495
+                  this.range_value_columns.push('全部')
496
+                  this.range_value_columns.push('小于' + resp.data.range_vaule[0])
497
+                  this.range_value_columns.push(resp.data.range_vaule[0] + '~' + resp.data.range_vaule[1])
498
+                  this.range_value_columns.push('大于' + resp.data.range_vaule[1])
499
+                  this.query.range_value = '全部'
500
+
501
+                } else {
502
+                  this.range_value_columns = []
503
+                  this.range_value_columns.push('全部')
504
+                  for (let i = 0; i < resp.data.range_vaule.length; i++) {
505
+                    this.range_value_columns.push(resp.data.range_vaule[i])
506
+                  }
507
+                  this.query.range_value = '全部'
508
+                }
509
+
510
+                this.GetPatientInspectionIndexBarChart(this.query)
511
+                this.GetPatientInspectionIndexChart(this.query)
512
+
513
+              } else {
514
+                this.$message.error(resp.msg)
515
+
516
+              }
517
+            }
518
+          )
519
+          .catch(error => {
520
+
521
+          })
522
+      },
523
+      GetPatientInspectionIndexBarChart(params) {
524
+        this.options.xAxis.data = []
525
+        this.options.series[0].data = []
526
+        GetPatientInspectionIndexBarChart(params)
527
+          .then(rs => {
528
+            var resp = rs.data
529
+            if (resp.state == 1) {
530
+              for (let i = 0; i < resp.data.data.length; i++) {
531
+                this.options.xAxis.data.push(resp.data.data[i].name)
532
+                this.options.series[0].data.push(resp.data.data[i].total)
533
+              }
534
+
535
+            } else {
536
+              this.$toast({
537
+                message: resp.msg
538
+              })
539
+            }
540
+          })
541
+          .catch(error => {
542
+
543
+          })
544
+
545
+      },
546
+      GetPatientInspectionIndexChart(params) {
547
+        this.options2.xAxis.data = []
548
+        this.options2.series[0].data = []
549
+        GetPatientInspectionIndexChart(params)
550
+          .then(rs => {
551
+            var resp = rs.data
552
+            if (resp.state == 1) {
553
+              for (let i = 0; i < resp.data.data.length; i++) {
554
+                this.options2.xAxis.data.push(resp.data.data[i].date)
555
+                this.options2.series[0].data.push(resp.data.data[i].value)
556
+              }
557
+
558
+            } else {
559
+              this.$toast({
560
+                message: resp.msg
561
+              })
562
+            }
563
+          })
564
+          .catch(error => {
565
+
566
+          })
567
+
344 568
       }
569
+
570
+    }, created() {
571
+      var date = new Date()
572
+      var year = date.getFullYear() //获取完整的年份(4位)
573
+      var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
574
+      var day = date.getDate() < 0 ? '0' + date.getDate().toString() : date.getDate() //获取当前日(1-31)
575
+      var last_month = date.getMonth() < 10 ? '0' + date.getMonth().toString() : date.getMonth() //获取当前月份(0-11,0代表1月)
576
+      this.query.end_time = year + '-' + month + '-' + day
577
+      this.query.start_time = year + '-' + last_month + '-' + day
578
+      GetDefalutPatient()
579
+        .then(rs => {
580
+          var resp = rs.data
581
+          if (resp.state == 1) {
582
+            this.query.patient_id =resp.data.patient.id
583
+            this.patient_name  = resp.data.patient.name
584
+            this.GetInspectionIndexInit()
585
+          } else {
586
+
587
+          }
588
+        })
589
+        .catch(error => {
590
+
591
+        })
592
+
593
+
594
+      this.getCurrentOrgPatients()
595
+
345 596
     }
346 597
   }
347
-};
348 598
 </script>
349 599
 
350 600
 
351 601
 <style lang="scss" scoped>
352
-.tableTitle {
353
-  font-size: 16px;
354
-  color: #000;
355
-  font-weight: bold;
356
-  margin-bottom: 10px;
357
-}
602
+  .tableTitle {
603
+    font-size: 16px;
604
+    color: #000;
605
+    font-weight: bold;
606
+    margin-bottom: 10px;
607
+  }
358 608
 </style>
359 609
 <style lang="scss">
360
-.page_personal {
610
+  .page_personal {
611
+
361 612
   .cell {
362 613
     text-align: center;
363 614
   }
615
+
364 616
   .el-button--medium {
365 617
     padding: 10px 8px;
366 618
   }
619
+
367 620
   .el-form-item {
368 621
     margin-bottom: 0;
369 622
   }
370
-}
623
+
624
+  }
371 625
 </style>