yq1 преди 10 месеца
родител
ревизия
93dec72e22

Файловите разлики са ограничени, защото са твърде много
+ 727 - 714
package-lock.json


+ 1 - 0
package.json Целия файл

@@ -78,6 +78,7 @@
78 78
     "vue-clipboard2": "^0.3.1",
79 79
     "vue-count-to": "1.0.13",
80 80
     "vue-i18n": "7.3.2",
81
+    "vue-json-excel": "^0.3.0",
81 82
     "vue-multiselect": "2.0.8",
82 83
     "vue-quill-editor": "^3.0.6",
83 84
     "vue-router": "3.0.1",

+ 91 - 4
src/api/qcd.js Целия файл

@@ -134,7 +134,6 @@ export function GetAllQCStatistisData(params) {
134 134
 }
135 135
 
136 136
 
137
-
138 137
 export function GetFiveInstatistisc(params) {
139 138
   return request({
140 139
     url: '/api/qc/patientinspectionstatistis/get',
@@ -147,9 +146,6 @@ export function GetFiveInstatistisc(params) {
147 146
 
148 147
 
149 148
 
150
-
151
-
152
-
153 149
 export function GetAllCommonQCStatistisData(params) {
154 150
   return request({
155 151
     url: '/api/commonqc/statistiscall/get',
@@ -174,3 +170,94 @@ export function GetCommonQCPatientStatistiscPersonData(params) {
174 170
     params: params
175 171
   })
176 172
 }
173
+
174
+
175
+
176
+
177
+
178
+
179
+// 新质控
180
+// 透析总量分析
181
+export function Getdialysistotal(params) {
182
+  return request({
183
+    url: '/api/commonqc/dialysis/total',
184
+    method: 'get',
185
+    params: params
186
+  })
187
+}
188
+
189
+// 透析总量详情
190
+export function Getdialysisdetail(params) {
191
+  return request({
192
+    url: '/api/commonqc/dialysis/detail',
193
+    method: 'get',
194
+    params: params
195
+  })
196
+}
197
+// 透析总量详情明细
198
+export function Getdialysisdetailsinfo(params) {
199
+  return request({
200
+    url: '/api/commonqc/dialysis/detailsinfo',
201
+    method: 'get',
202
+    params: params
203
+  })
204
+}
205
+
206
+// 抗凝剂类型统计
207
+export function Getanticoagulant(params) {
208
+  return request({
209
+    url: '/api/commonqc/anticoagulant',
210
+    method: 'get',
211
+    params: params
212
+  })
213
+}
214
+// 抗凝剂详情
215
+export function Getdetail(params) {
216
+  return request({
217
+    url: '/api/commonqc/anticoagulant/detail',
218
+    method: 'get',
219
+    params: params
220
+  })
221
+}
222
+
223
+// 透析器分析
224
+export function Getdialyzer(params) {
225
+  return request({
226
+    url: '/api/commonqc/dialyzer',
227
+    method: 'get',
228
+    params: params
229
+  })
230
+}
231
+// 透析器详情
232
+export function Getdialyzerdetail(params) {
233
+  return request({
234
+    url: '/api/commonqc/dialyzer/detail',
235
+    method: 'get',
236
+    params: params
237
+  })
238
+}
239
+// 透析器名称
240
+export function Getdialyzerconfig(params) {
241
+  return request({
242
+    url: '/api/commonqc/dialyzer/config',
243
+    method: 'get',
244
+    params: params
245
+  })
246
+}
247
+
248
+// 透析完成率统计
249
+export function Getdialysistreatfinish(params) {
250
+  return request({
251
+    url: '/api/commonqc/dialysistreat/finish',
252
+    method: 'get',
253
+    params: params
254
+  })
255
+}
256
+// 透析器详情
257
+export function Getdialysistreatdetail(params) {
258
+  return request({
259
+    url: '/api/commonqc/dialysistreat/detail',
260
+    method: 'get',
261
+    params: params
262
+  })
263
+}

BIN
src/assets/img/xiang.png Целия файл


+ 559 - 0
src/xt_pages/Dialysisanalysis/new_otherIndicators/components/Total_analysis.vue Целия файл

@@ -0,0 +1,559 @@
1
+<template>
2
+  <div class="main-contain">
3
+    <div class="position">
4
+      <div>
5
+        <span>
6
+          <el-button @click="return_click" type="text" icon="el-icon-arrow-left">返回</el-button> 
7
+        </span>&nbsp;&nbsp;
8
+        <span>透析总量分析</span>
9
+      </div>
10
+    </div>
11
+    <div class="app-container">
12
+      <div class="page_patientControlAnalysis" style="position: relative;">
13
+        <div style="display: flex;">
14
+          <div>
15
+            日期:
16
+            <el-select v-model="date_value" this placeholder="请选择" style="width: 100px;">
17
+              <el-option
18
+                v-for="item in date_options"
19
+                :key="item.value"
20
+                :label="item.label"
21
+                :value="item.value"
22
+                >
23
+              </el-option>
24
+            </el-select>
25
+          </div>
26
+          <div style="margin:0 10px;">
27
+            <el-date-picker
28
+              v-model="start_date"
29
+              type="date"
30
+              value-format="yyyy-MM-dd"
31
+              placeholder="选择日期"
32
+              style="width: 150px;">
33
+            </el-date-picker>
34
+            <span>-</span>
35
+            <el-date-picker
36
+              v-model="end_date"
37
+              type="date"
38
+              value-format="yyyy-MM-dd"
39
+              placeholder="选择日期"
40
+              style="width: 150px;">
41
+            </el-date-picker>
42
+          </div>
43
+          <div>
44
+            透析模式:
45
+            <el-select v-model="mode" placeholder="请选择" style="width: 120px;">
46
+              <el-option :key='0' label="不限" :value="0">
47
+              </el-option>
48
+              <el-option
49
+                v-for="item in mode_options"
50
+                :key="item.id"
51
+                :label="item.name"
52
+                :value="item.id">
53
+              </el-option>
54
+            </el-select>
55
+
56
+            <el-select v-model="date_mode" :disabled="mode==0?true:false" placeholder="请选择" style="width: 100px;">
57
+              <el-option
58
+                v-for="item in date_mode_options"
59
+                :key="item.value"
60
+                :label="item.label"
61
+                :value="item.value">
62
+              </el-option>
63
+            </el-select>
64
+
65
+          </div>
66
+
67
+          <div style="margin:0 10px;">
68
+            数据来源:
69
+            <el-select v-model="source" placeholder="请选择" style="width: 130px;">
70
+              <el-option
71
+                v-for="item in source_options"
72
+                :key="item.value"
73
+                :label="item.label"
74
+                :value="item.value">
75
+              </el-option>
76
+            </el-select>
77
+          </div>
78
+
79
+          <div>
80
+            <el-button type="primary" @click="sete_click">查询</el-button>
81
+            <el-button type="primary" @click="Download_click">下载</el-button>
82
+          </div>
83
+        </div>
84
+        <!-- 图表 -->
85
+        <div ref="mychart">
86
+          <div class="echart" id="mychart"  style="width:100%;height:60vh"></div>
87
+        </div>
88
+          
89
+          <div style="position: fixed;right: 5%;top: 50vh;">
90
+            <el-popover
91
+              placement="left"
92
+              title="提示"
93
+              width="500"
94
+              trigger="click"
95
+              content="1.统计时间段内每个模式的透析例次,可以选择统计方式按天/按周/按月。
96
+                    2.数据来源选择【排班】时,以排班数据为准;数据来源选择【开始透析】时,以实际透析数据为准。">
97
+              <img src="@/assets/img/xiang.png" alt="" style="height: 20px;width: 20px;" slot="reference">
98
+              <!-- <el-button slot="reference">click 激活</el-button> -->
99
+            </el-popover>
100
+          </div>
101
+      </div>
102
+    </div>
103
+
104
+  </div>
105
+</template>
106
+<script>
107
+import * as echarts from 'echarts';
108
+import {Getdialysistotal} from '../../../../api/qcd'
109
+import { uParseTime } from "@/utils/tools";
110
+import html2canvas from "html2canvas"
111
+import { forEach } from 'jszip';
112
+  export default {
113
+    components:{
114
+    },
115
+    data(){
116
+      return{
117
+        date_value:4,
118
+        start_date:'',
119
+        end_date:this.getTime(new Date()),
120
+        mode:0,
121
+        date_mode:1,
122
+        source:1,
123
+        mode_options:[],
124
+        date_options:[{value:1,label:'最近七天'},{value:2,label:'本周'},{value:3,label:'上周'},{value:4,label:'本月'},
125
+                      {value:5,label:'上月'},{value:6,label:'本年'},{value:7,label:'上一年'}
126
+        ],
127
+        modearr:[{ id: 0, name: '不限' },{ id: 1, name: 'HD' },{ id: 2, name: 'HDF' },{ id: 3, name: 'HD + HP' },{ id: 4, name: 'HP' },
128
+          { id: 5, name: 'HF' },{ id: 6, name: 'SCUF' },{ id: 7, name: 'IUF' },{ id: 8, name: 'HFHD' },{ id: 9, name: 'HFHD+HP' },
129
+          { id: 10, name: 'PHF' },{ id: 11, name: 'HFR' },{ id: 12, name: 'HDF+HP' },{ id: 13, name: 'CRRT' },{ id: 14, name: '腹水回输' },
130
+          { id:19, name:"IUF+HD"},{ id:20, name:"UF"},{ id:21, name:"HD+"},{ id:22, name:"血浆胆红素吸附+HDF"},{ id:23, name:"血浆胆红素吸附"},
131
+          { id:24, name:"I-HDF"},{ id:25, name:"HD高通"},{ id:26, name:"CVVH"},{ id:27, name:"CVVHD"},{ id:28, name:"CVVHDF"},{ id:29, name:"PE"},
132
+          { id:30, name:"血浆胆红素吸附+HP"},{ id:31, name:"HPD"},{ id:32, name:"HDP"},{ id:33, name:"HFD"},{ id:34, name:"HDF100"},
133
+          { id:35, name:"HDF600"},{ id:36, name:"HDF800"},{ id:37, name:"HDF1000"},
134
+        ],
135
+        date_mode_options:[{value:1,label:'按周'},{value:2,label:'按天'},{value:3,label:'按月'},{value:4,label:'按年'}],
136
+        source_options:[{value:1,label:'以开始透析为准'},{value:2,label:'以排班为准'}],
137
+        bar_xAxis:[],
138
+        // bar: {
139
+        //   title: {
140
+        //     text: "ECharts 入门示例"
141
+        //   },
142
+        //   tooltip: {},
143
+        //   legend: {
144
+        //     data: [],
145
+        //     left: 0
146
+        //   },
147
+        //   xAxis: {
148
+        //     data: []
149
+        //   },
150
+        //   yAxis: {
151
+        //     axisLabel: {
152
+        //       formatter: "{value} %"
153
+        //     },
154
+        //     show: false
155
+        //   },
156
+        //   series: [
157
+        //     {
158
+        //       name: "",
159
+        //       type: "bar",
160
+        //       data: [],
161
+        //       barWidth: 30,
162
+        //       label: {
163
+        //         normal: {
164
+        //           show: true,
165
+        //           position: "top",
166
+        //           formatter: (params) => {
167
+        //             // if(this.percent.length > 0){
168
+        //             //   let str = ''
169
+        //             //   str = params.data + '('+ this.percent[params.dataIndex] +'%)'
170
+        //             //   return str
171
+        //             // }else{
172
+        //             //   let str = ''
173
+        //             //   str = params.data
174
+        //             //   return str
175
+        //             // }
176
+        //           }
177
+        //         }
178
+        //       },
179
+        //       //配置样式
180
+        //       itemStyle: {
181
+        //         //通常情况下:
182
+
183
+        //         //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
184
+        //         normal: {
185
+        //           color: function(params) {
186
+        //             //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
187
+        //             var colorList = [
188
+        //               ["#A9E0F3", "#9FBDFC"],
189
+
190
+        //               ["#FFD7C0", "#FF9994"]
191
+        //             ];
192
+
193
+        //             var index = params.dataIndex;
194
+        //             if (params.dataIndex >= colorList.length) {
195
+        //               index = params.dataIndex % colorList.length;
196
+        //             }
197
+
198
+        //             return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
199
+        //               { offset: 0, color: colorList[index][0] },
200
+        //               // { offset: 0.5, color: colorList[index][1] },
201
+        //               { offset: 1, color: colorList[index][1] }
202
+        //             ]);
203
+        //           },
204
+        //           barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
205
+        //         },
206
+
207
+        //         //鼠标悬停时:
208
+        //         emphasis: {
209
+        //           shadowBlur: 10,
210
+        //           shadowOffsetX: 0,
211
+        //           shadowColor: "rgba(0, 0, 0, 0.2)"
212
+        //         }
213
+        //       }
214
+        //     }
215
+        //   ],
216
+        //   dataZoom: [
217
+        //     {
218
+        //       // Y轴固定,让内容滚动
219
+        //       type: 'slider',
220
+        //       show: false,
221
+        //       xAxisIndex: [0],
222
+        //       start: 1,
223
+        //       end: 20, // 设置X轴刻度之间的间隔(根据数据量来调整)
224
+        //       zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
225
+        //     },
226
+        //     {
227
+        //       type: 'inside',
228
+        //       xAxisIndex: [0],
229
+        //       start: 1,
230
+        //       end: 20,
231
+        //       zoomLock: true // 锁定区域禁止缩放
232
+        //     }
233
+        //   ]
234
+        // }
235
+      }
236
+    },
237
+    methods:{
238
+      // 返回
239
+      return_click(){
240
+        this.$router.push('/Dialysisanalysis/qualitycontrol/new_otherIndicators')
241
+      },
242
+      // echarts图表
243
+      getecharts(){
244
+        var chartDom = document.getElementById('mychart')
245
+        var myChart = echarts.init(chartDom);
246
+        
247
+        const params={
248
+          start_date:this.start_date,
249
+          end_date:this.end_date,
250
+          mode:this.mode,
251
+          origin:this.source,
252
+          time_way:this.date_mode,
253
+        }
254
+        Getdialysistotal(params).then(response =>{
255
+          if(response.data.state ==1){
256
+            const modeoptions = []
257
+            const xAxis = []
258
+            var yAxis = [] 
259
+            const list = response.data.data.list
260
+            list.forEach(item =>{
261
+              const obj ={
262
+                id:item.mode_id,
263
+                name:this.getmodearr(item.mode_id)
264
+              }
265
+              yAxis.push(item.count)
266
+              xAxis.push(this.getmodearr(item.mode_id))
267
+              modeoptions.push(obj)
268
+            })
269
+            this.bar_xAxis = xAxis
270
+            this.mode_options = modeoptions
271
+            const option = {
272
+              xAxis: {
273
+                type: 'category',
274
+                data: this.bar_xAxis
275
+              },
276
+              yAxis: {
277
+                type: 'value'
278
+              },
279
+              series: [
280
+                {
281
+                  data: yAxis,
282
+                  type: 'bar',
283
+                  barWidth: '25%',
284
+                  label: {
285
+                    normal: {
286
+                      show: true,
287
+                      position: 'top',
288
+                      formatter: '{c}',
289
+                      textStyle:{
290
+                        color: 'black',//字体颜色
291
+                        fontSize: 13//字体大小
292
+                      }
293
+                    },
294
+                  },
295
+                  itemStyle:{
296
+                    normal:{
297
+                      color:function (params){
298
+                        // const colorarr=['#FFA333','#A155E8','#6D91FF','#A233A2'];
299
+                        var colorarr = [["#A9E0F3", "#9FBDFC"],["#FFD7C0", "#FF9994"]]
300
+                        var index = params.dataIndex;
301
+                        if (params.dataIndex >= colorarr.length) {
302
+                          index = params.dataIndex % colorarr.length;
303
+                        }
304
+                        return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
305
+                          { offset: 0, color: colorarr[index][0] },
306
+                          // { offset: 0.5, color: colorList[index][1] },
307
+                          { offset: 1, color: colorarr[index][1] }
308
+                        ]);
309
+                      }
310
+                    }
311
+                  }
312
+                }
313
+              ]
314
+            }
315
+            myChart.setOption(option);
316
+            // myChart.on('click',params =>{
317
+            //   console.log('params',params);
318
+            // })
319
+            console.log('this.mode_options',this.mode_options,this.bar_xAxis);
320
+          }
321
+        })
322
+      },
323
+      // 查询
324
+      sete_click(){
325
+        this.getecharts()
326
+      },
327
+      // 下载 
328
+      Download_click(){
329
+        const options ={
330
+          allowTaint: true,
331
+          useCORS: true
332
+        }
333
+        html2canvas(this.$refs.mychart,options).then(canvas =>{
334
+          // const imageSrc = canvas.toDataURL();
335
+          const imageUrl = canvas.toDataURL("image/png");
336
+          console.log('5555',imageUrl);
337
+        //   // const base = this.url.split(',')[1]
338
+        //   // console.log('2222',base);
339
+          const blob = this.dataURLtoBlob(imageUrl)
340
+          console.log('4444',blob);
341
+          const url = URL.createObjectURL(blob);
342
+          // const file = (this.url).blob();
343
+          console.log('1111',url);
344
+          var link= document.createElement("a");
345
+        //   //将生成的图片url赋值给a标签的href属性
346
+          link.href = url; 
347
+        //   //设置下载的文件名
348
+          link.download = "页面截图.jpg";
349
+          // // 将a标签插入dom中
350
+          console.log('link',link);
351
+          document.body.appendChild(link);
352
+          //模拟点击事件触发下载
353
+          link.click();
354
+          // 完成之后销毁创建的a标签
355
+          document.body.removeChild(link);
356
+
357
+        })
358
+      },
359
+      // 选项转换
360
+      getmodearr(ids){
361
+        const option = this.modearr
362
+        for(let i in option){
363
+          if(ids == option[i].id){
364
+            return option[i].name
365
+          }
366
+        }
367
+      },
368
+      // 转换时间
369
+      getTime(val) {
370
+        if(val < 0){
371
+          return ""
372
+        }
373
+        if(val == ""){
374
+          return ""
375
+        }else {
376
+          return uParseTime(val, '{y}-{m}-{d}')
377
+        }
378
+      },
379
+      // 选择日期
380
+      datachange(eve){
381
+        if(eve ==1){
382
+          this.start_date = this.getPreviousDate(7)
383
+          this.end_date = this.getTime(new Date())
384
+        }else if(eve==2){
385
+          this.start_date = this.getFirstDayOfWeek(new Date())
386
+          this.end_date = this.getTime(new Date())
387
+          console.log('this.start_date', this.start_date);
388
+        }else if(eve ==3){
389
+          var date=new Date()
390
+          date.setDate(date.getDate()-7 - date.getDay() + 1);
391
+          var m =''
392
+          var d = ''
393
+          if(date.getMonth() + 1<10){
394
+            m = '0'+(date.getMonth() + 1)
395
+          }else{
396
+             m = date.getMonth() + 1
397
+          }
398
+          if(date.getDate()<10){
399
+             d = '0'+date.getDate()
400
+          }else{
401
+            d = date.getDate()
402
+          }
403
+          // this.start_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() ;
404
+          this.start_date = date.getFullYear() + "-" + m + "-" + d ;
405
+          date.setDate(date.getDate() +6);
406
+          var mm = ''
407
+          var dd = ''
408
+          if(date.getMonth() + 1<10){
409
+            mm = '0'+(date.getMonth() + 1)
410
+          }else{
411
+            mm = date.getMonth() + 1
412
+          }
413
+          if(date.getDate()<10){
414
+            dd = '0'+date.getDate()
415
+          }else{
416
+            dd = date.getDate()
417
+          }
418
+          // if(date.getMonth() + 1<10)
419
+          // this.end_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
420
+          this.end_date = date.getFullYear() + "-" + mm + "-" + dd ;
421
+          console.log('this.end_date',this.end_date);
422
+          
423
+        }else if(eve ==4){
424
+          this.start_date = this.getFirstDayOfMonth(new Date())
425
+          this.end_date = this.getTime(new Date())
426
+        }else if(eve ==5){
427
+          this.gettopMonth()
428
+        }else if(eve == 6){
429
+          this.start_date = this.getFirstDayOfYear(new Date())
430
+          this.end_date = this.getTime(new Date())
431
+        }else if(eve == 7){
432
+          this.getLastYearFirstDay()
433
+          this.getLastYearLastDay()
434
+        }
435
+        console.log('eve',eve);
436
+      },
437
+      // 首先定义一个getPreviousDate函数,方便调用
438
+      getPreviousDate(numOfDays) {
439
+        var date = new Date();
440
+        date.setDate(date.getDate() - numOfDays);
441
+        var year = date.getFullYear();
442
+        if(date.getMonth() + 1<10){
443
+          var month = '0'+(date.getMonth() + 1);
444
+        }else{
445
+          var month = date.getMonth() + 1;
446
+        }
447
+
448
+        if(date.getDate()<10){
449
+          var day = '0'+date.getDate();
450
+        }else{
451
+          var day = date.getDate();
452
+        }
453
+        return year + "-" + month + "-" + day;
454
+      },
455
+      // 本周
456
+      getFirstDayOfWeek(date){
457
+        var weekday = date.getDay() 
458
+        date.setDate(date.getDate()-weekday+1);//往前算(weekday-1)天,年份、月份会自动变化
459
+        return this.timeFormat(date);
460
+      },
461
+      // 本月
462
+      getFirstDayOfMonth (date) {
463
+        date.setDate(1);
464
+        return this.timeFormat(date);
465
+      },
466
+      // 上个月
467
+      gettopMonth(){
468
+        var currentDate = new Date();
469
+        var month=currentDate.getMonth()+(-1);
470
+        if(month<0){
471
+          var n = parseInt((-month)/12);
472
+          month += n*12;
473
+          currentDate.setFullYear(currentDate.getFullYear()-n);
474
+        }
475
+        currentDate = new Date(currentDate.setMonth(month));
476
+        //获得当前月份0-11  
477
+        var currentMonth = currentDate.getMonth(); 
478
+        //获得当前年份4位年  
479
+        var currentYear = currentDate.getFullYear(); 
480
+        //获得上一个月的第一天  
481
+        this.start_date = this.getTime(new Date(currentYear, currentMonth-1,1)); 
482
+        //获得上一月的最后一天  
483
+        this.end_date = this.getTime(new Date(currentYear, currentMonth, 0));
484
+       console.log('11111',this.start_date);
485
+       console.log('22222',this.end_date);
486
+      },
487
+      // 本年
488
+      getFirstDayOfYear (date) {
489
+        date.setDate(1);
490
+        date.setMonth(0);
491
+        return this.timeFormat(date);
492
+      },
493
+      // 上一年第一天
494
+      getLastYearFirstDay() {  
495
+          let date = new Date();  
496
+         const year= date.setFullYear(date.getFullYear() - 1); // 设置年份为前一年  
497
+         const start_month= date.setMonth(0); // 设置月份为1月(注意月份是从0开始的)  
498
+         const start_day = date.setDate(1); // 设置日期为1日
499
+        //  const last_month = date.setMonth(11); // 设置月份为12月  
500
+        //  const last_day = date.setDate(0); // 设置日期为0,这将自动设置为该月的最后一天  
501
+        //  this.start_date = year+ "-" +start_month+ "-" +start_day
502
+         this.start_date = this.getTime(start_day)
503
+        //  return this.start_date
504
+      }, 
505
+      // 上一年最后一天
506
+      getLastYearLastDay() {  
507
+          let date = new Date();  
508
+          const year= date.setFullYear(date.getFullYear() - 1); // 设置年份为前一年  
509
+          const last_month = date.setMonth(12); // 设置月份为12月  
510
+          const last_day = date.setDate(0);// 设置日期为0,这将自动设置为该月的最后一天  
511
+          // this.end_date =  year+ "-" +last_month+ "-" +last_day
512
+          this.end_date = this.getTime(last_day)
513
+          console.log('this.end_date',this.end_date);
514
+          // return this.end_date;  
515
+      }, 
516
+      
517
+      // 日期格式化
518
+      timeFormat(date) {
519
+          if (!date || typeof(date) === "string") {
520
+            this.error("参数异常,请检查...");
521
+          }
522
+          var y = date.getFullYear(); //年
523
+          if(date.getMonth() + 1<10){
524
+            var m ='0'+(date.getMonth() + 1); //月
525
+          }else{
526
+            var m =date.getMonth() + 1; //月
527
+          }
528
+          if(date.getDate() + 1<10){
529
+            var d ='0'+date.getDate(); //日
530
+          }else{
531
+            var d = date.getDate(); //日
532
+          }
533
+          // var d = date.getDate(); //日
534
+
535
+          return y + "-" + m + "-" + d;
536
+      },
537
+      // 
538
+      dataURLtoBlob(dataURL) {
539
+        const arr = dataURL.split(',');
540
+        const mime = arr[0].match(/:(.*?);/)[1];
541
+        const bstr = atob(arr[1]);
542
+        let n = bstr.length;
543
+        const u8arr = new Uint8Array(n);
544
+        while (n--) {
545
+          u8arr[n] = bstr.charCodeAt(n);
546
+        }
547
+        return new Blob([u8arr], { type: mime });
548
+      },
549
+    },
550
+    mounted(){
551
+      this.getecharts()
552
+    },
553
+    created(){
554
+      this.start_date = this.getFirstDayOfMonth(new Date())
555
+      // this.gettotal()
556
+    },
557
+
558
+  }
559
+</script>

+ 724 - 0
src/xt_pages/Dialysisanalysis/new_otherIndicators/components/Total_table.vue Целия файл

@@ -0,0 +1,724 @@
1
+<template>
2
+  <div class="main-contain">
3
+    <div class="position">
4
+      <div>
5
+        <span>
6
+          <el-button @click="return_click" type="text" icon="el-icon-arrow-left">返回</el-button> 
7
+        </span>&nbsp;&nbsp;
8
+        <span>透析总量详情</span>
9
+      </div>
10
+    </div>
11
+    <div class="app-container">
12
+      <div class="page_patientControlAnalysis">
13
+        <div style="display: flex;">
14
+          <div >
15
+            日期:
16
+            <el-select v-model="date_value" @change="datachange" placeholder="请选择" style="width: 100px;">
17
+              <el-option
18
+                v-for="item in date_options"
19
+                :key="item.value"
20
+                :label="item.label"
21
+                :value="item.value">
22
+              </el-option>
23
+            </el-select>
24
+          </div>
25
+          <div style="margin: 0 10px;">
26
+            <el-date-picker
27
+              v-model="start_date"
28
+              type="date"
29
+              value-format="yyyy-MM-dd"
30
+              placeholder="选择日期"
31
+              style="width: 150px;">
32
+            </el-date-picker>
33
+            <span>-</span>
34
+            <el-date-picker
35
+              v-model="end_date"
36
+              type="date"
37
+              value-format="yyyy-MM-dd"
38
+              placeholder="选择日期"
39
+              style="width: 150px;">
40
+            </el-date-picker>
41
+          </div>
42
+          
43
+          <div>
44
+            透析模式:
45
+            <el-select v-model="mode"  placeholder="请选择" style="width: 120px;">
46
+              <el-option :key="0" label="不限" :value="0"></el-option>
47
+              <el-option
48
+                v-for="item in mode_options"
49
+                :key="item.id"
50
+                :label="item.name"
51
+                :value="item.id">
52
+              </el-option>
53
+            </el-select>
54
+
55
+            <el-select v-model="date_mode" :disabled="mode==0?true:false" placeholder="请选择" style="width: 100px;">
56
+              <el-option
57
+                v-for="item in date_mode_options"
58
+                :key="item.value"
59
+                :label="item.label"
60
+                :value="item.value">
61
+              </el-option>
62
+            </el-select>
63
+
64
+          </div>
65
+
66
+          <div style="margin: 0 10px;">
67
+            数据来源:
68
+            <el-select v-model="source" placeholder="请选择" style="width: 130px;">
69
+              <el-option
70
+                v-for="item in source_options"
71
+                :key="item.value"
72
+                :label="item.label"
73
+                :value="item.value">
74
+              </el-option>
75
+            </el-select>
76
+          </div>
77
+
78
+          <div>
79
+            <el-button type="primary" @click="sete_click">查询</el-button>
80
+            <el-button type="primary" @click="Download_click">下载</el-button>
81
+          </div>
82
+        </div>
83
+        <!-- 表格 -->
84
+        <div>
85
+          <el-table :data="patientTableData"
86
+            style="width: 100%;border-collapse: collapse;" height="400" border
87
+            @cell-click="cellclick">
88
+            <el-table-column v-for="column in columns" :key="column.prop" 
89
+              :prop="column.prop?column.prop:''" :label="column.label?column.label:''">
90
+            </el-table-column>
91
+            
92
+          </el-table>
93
+        </div>
94
+      </div>
95
+    </div>
96
+
97
+    <!-- 弹窗 -->
98
+    <div>
99
+      <el-dialog
100
+        title="提示"
101
+        :visible.sync="dialogVisible"
102
+        width="80%">
103
+        <div>
104
+          <div style="text-align: right;">
105
+            <el-button type="primary" @click="exportExcel">导出</el-button>
106
+          </div>
107
+          <div>
108
+            <el-table :data="tableData"
109
+              style="width: 100%">
110
+              <el-table-column
111
+                prop="index"
112
+                label="序号"
113
+                width="">
114
+              </el-table-column>
115
+              <el-table-column
116
+                prop="date"
117
+                label="日期"
118
+                width="">
119
+              </el-table-column>
120
+              <el-table-column
121
+                prop="dialysis_no"
122
+                label="透析号"
123
+                width="">
124
+              </el-table-column>
125
+              <el-table-column
126
+                prop="name"
127
+                label="患者姓名">
128
+              </el-table-column>
129
+              <el-table-column
130
+                prop="gender"
131
+                label="性别">
132
+              </el-table-column>
133
+              <el-table-column
134
+                prop="age"
135
+                label="年龄">
136
+              </el-table-column>
137
+              <el-table-column
138
+                prop="mode_id"
139
+                label="透析方式"
140
+                width="">
141
+              </el-table-column>
142
+              <el-table-column
143
+                prop="jihao"
144
+                label="机号"
145
+                width="">
146
+              </el-table-column>
147
+              <el-table-column
148
+                prop="doctor"
149
+                label="治疗医生"
150
+                width="">
151
+              </el-table-column>
152
+              <el-table-column
153
+                prop="nurse"
154
+                label="治疗护士">
155
+              </el-table-column>
156
+              <el-table-column
157
+                prop="start_time"
158
+                label="开始透析时间">
159
+              </el-table-column>
160
+              <el-table-column
161
+                prop="end_time"
162
+                label="结束透析时间">
163
+              </el-table-column>
164
+              <el-table-column
165
+                prop="shijia_time"
166
+                label="实际治疗时长">
167
+              </el-table-column>
168
+            </el-table>
169
+          </div>
170
+
171
+          <div style="text-align: right;margin-top: 10px;">
172
+            <el-pagination
173
+              @size-change="handleSizeChange"
174
+              @current-change="handleCurrentChange"
175
+              :current-page="currentPage"
176
+              :page-sizes="[50,100, 200, 300, 400]"
177
+              :page-size="limit"
178
+              layout="total, sizes, prev, pager, next, jumper"
179
+              :total="total">
180
+            </el-pagination>
181
+          </div>
182
+        </div>
183
+        <span slot="footer" class="dialog-footer">
184
+          <el-button @click="dialogVisible = false">取 消</el-button>
185
+          <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
186
+        </span>
187
+      </el-dialog>
188
+    </div>
189
+    
190
+  </div>
191
+</template>
192
+<script>
193
+import {Getdialysisdetail,Getdialysisdetailsinfo} from '../../../../api/qcd'
194
+import { uParseTime } from "@/utils/tools";
195
+import {getAllNurseList} from '@/api/fallassement'
196
+import { getAllDoctorList} from "@/api/device"
197
+import XLSX from 'xlsx';
198
+export default {
199
+  data(){
200
+    return{
201
+      date_value:4,
202
+      start_date:'',
203
+      end_date:this.getTime(new Date()),
204
+      mode:0,
205
+      date_mode:1,
206
+      source:1,
207
+      dialogVisible:false,
208
+      tableData:[],
209
+      columns:[],
210
+      patientTableData:[],
211
+      detilarr:[],
212
+      currentPage:1,
213
+      limit:50,
214
+      total:0,
215
+      nurseList:[],
216
+      operators:[],
217
+      docList:[],
218
+      date_options:[{value:1,label:'最近七天'},{value:2,label:'本周'},{value:3,label:'上周'},{value:4,label:'本月'},
219
+                    {value:5,label:'上月'},{value:6,label:'本年'},{value:7,label:'上一年'}
220
+      ],
221
+      mode_options:[{ id: 1, name: 'HD' },{ id: 2, name: 'HDF' },{ id: 3, name: 'HD + HP' },{ id: 4, name: 'HP' },
222
+        { id: 5, name: 'HF' },{ id: 6, name: 'SCUF' },{ id: 7, name: 'IUF' },{ id: 8, name: 'HFHD' },{ id: 9, name: 'HFHD+HP' },
223
+        { id: 10, name: 'PHF' },{ id: 11, name: 'HFR' },{ id: 12, name: 'HDF+HP' },{ id: 13, name: 'CRRT' },{ id: 14, name: '腹水回输' },
224
+        { id: 15, name: 'HD前置换' },{ id: 16, name: 'HD后置换' },{ id: 17, name: 'HDF前置换' },{ id: 18, name: 'HDF后置换' },
225
+        { id:19, name:"IUF+HD"},{ id:20, name:"UF"},{ id:21, name:"HD+"},{ id:22, name:"血浆胆红素吸附+HDF"},{ id:23, name:"血浆胆红素吸附"},
226
+        { id:24, name:"I-HDF"},{ id:25, name:"HD高通"},{ id:26, name:"CVVH"},{ id:27, name:"CVVHD"},{ id:28, name:"CVVHDF"},{ id:29, name:"PE"},
227
+      ],
228
+      date_mode_options:[{value:1,label:'按周'},{value:2,label:'按天'},{value:3,label:'按月'},{value:4,label:'按年'}],
229
+      source_options:[{value:1,label:'以开始透析为准'},{value:2,label:'以排班为准'}],
230
+      
231
+    }
232
+  },
233
+  methods:{
234
+    // 返回
235
+    return_click(){
236
+      this.$router.push('/Dialysisanalysis/qualitycontrol/new_otherIndicators')
237
+    },
238
+    // 数据源
239
+    getdetil(){
240
+      const params ={
241
+        start_date:this.start_date,
242
+        end_date:this.end_date,
243
+        mode:this.mode,
244
+        // mode:1,
245
+        origin:this.source,
246
+        time_way:this.date_mode,
247
+      }
248
+      Getdialysisdetail(params).then(response =>{
249
+        console.log('00000',response);
250
+        if(response.data.state == 1){
251
+          const list = response.data.data.list
252
+          this.patientTableData = list
253
+          // this.tableData = list
254
+          var column = []
255
+          column = Object.keys(response.data.data.list[0]).map(key => ({
256
+              prop: key,
257
+              label: key // 可以自定义表头名称
258
+            }));
259
+            // this.tableData = response.data.data.list
260
+            for(let i in column){
261
+              if(column[i].label == '日期'){
262
+                column.splice(i,1)
263
+              }
264
+
265
+            }
266
+            const arr={
267
+              label:'日期',
268
+              prop:'日期'
269
+            }
270
+            for(let i in column){
271
+              if(column[i].label == '合计'){
272
+                column.splice(i,1)
273
+              }
274
+            }
275
+            const arr1={
276
+              label:'合计',
277
+              prop:'合计'
278
+            }
279
+            column.unshift(arr)
280
+            column.push(arr1)
281
+            this.columns = column
282
+            
283
+            const detil = []
284
+            for(let i in this.columns){
285
+              detil.push(this.columns[i].label)
286
+            }
287
+            this.detilarr = detil
288
+            // this.tableData = response.data.data.list.map(row => {
289
+            //   let newRow = {};
290
+            //   for (let key in row) {
291
+            //     newRow[key] = row[key] === 0 ? '' : row[key];
292
+            //   }
293
+            //   return newRow;
294
+            // });
295
+            // console.log('tttt',this.tableData);
296
+            console.log('hhhhh',this.columns);
297
+        }
298
+
299
+      })
300
+    },
301
+    // 打开弹窗
302
+    cellclick(row, column, cell, event){
303
+      this.dialogVisible = true
304
+      const date =row['日期']
305
+      // const mode_name = column.label
306
+      var mode_id = ''
307
+      for(let i in this.mode_options){
308
+        if(column.label == this.mode_options[i].name){
309
+          mode_id = this.mode_options[i].id
310
+        }
311
+      }
312
+      const params={
313
+        date:date,
314
+        mode:mode_id,
315
+        origin:this.source,
316
+        page:this.currentPage,
317
+        limit:this.limit
318
+      }
319
+      this.Getdialysisdetailsinfo(params)
320
+      // console.log('row',row,this.date);
321
+      // console.log('column',column);
322
+      // console.log('cell',cell);
323
+      // console.log('event',event);
324
+    },
325
+    sete_click(){
326
+      this.getdetil()
327
+    },
328
+    // 详情数据源
329
+    Getdialysisdetailsinfo(params){
330
+      Getdialysisdetailsinfo(params).then(response =>{
331
+        if(response.data.state ==1){
332
+          const list = response.data.data.list
333
+          const table = []
334
+          list.forEach((item,index)=>{
335
+            const arr ={
336
+              index:index+1,
337
+              date:this.getTime(item.record_date),
338
+              dialysis_no:item.patient.dialysis_no,
339
+              name:item.patient.name,
340
+              gender:item.patient.gender==1?'男':'女',
341
+              age:this.analyzeIDCard(item.patient.id_card_no),
342
+              mode_id:this.getmode(item.mode_id),
343
+              jihao:item.order.DeviceNumber.number,
344
+              doctor:this.getdoctor(item.creater),
345
+              nurse:this.getnurse(item.order.finish_nurse),
346
+              start_time:this.getTime(item.order.dialysis_date),
347
+              end_time:this.getTime(item.order.end_time),
348
+              shijia_time:item.ad.actual_treatment_hour +'h'+item.ad.actual_treatment_minute+'min'
349
+            }
350
+            table.push(arr)
351
+          })
352
+          this.tableData = table
353
+          this.total = response.data.data.total
354
+        }
355
+        console.log('Getdialysisdetailsinfo',response);
356
+      })
357
+    },
358
+    //导出excel
359
+    exportExcel(){
360
+        let tableData = [ 
361
+          ['序号','日期', '透析号', '患者姓名', '性别','年龄','透析方式', '机号', '治疗医生','治疗护士', '开始透析时间','结束透析时间','实际治疗时长']//导出表头
362
+        ]
363
+        this.tableData.forEach((item,index) =>{
364
+          let rowdata=[]
365
+          rowdata=[
366
+            index+1,
367
+            item.date,
368
+            item.dialysis_no,
369
+            item.name,
370
+            item.gender,
371
+            item.age,
372
+            item.mode_id,
373
+            item.jihao,
374
+            item.doctor,
375
+            item.nurse,
376
+            item.start_time,
377
+            item.end_time,
378
+            item.shijia_time,
379
+          ]
380
+          tableData.push(rowdata)
381
+        })
382
+        let workSheet = XLSX.utils.aoa_to_sheet(tableData);
383
+        let bookNew = XLSX.utils.book_new();
384
+        XLSX.utils.book_append_sheet(bookNew, workSheet, '透析总量详情分析明细') // 工作簿名称
385
+        let name = '透析总量详情分析明细'+ '.xlsx'
386
+        XLSX.writeFile(bookNew, name) // 保存的文件名
387
+      },
388
+    //下载
389
+    Download_click(){
390
+        let patientTableData = [this.detilarr]
391
+        // console.log('tttt',tableData);
392
+        this.patientTableData.forEach((item,index) =>{
393
+          console.log('item',item);
394
+          let rowdata=[]
395
+          rowdata=[
396
+            item['日期'],
397
+            item.CRRT,
398
+            item.CVVH,
399
+            item.CVVHD,
400
+            item.CVVHDF,
401
+            item.HD,
402
+            item['HD+'],
403
+            item['HD+HP'],
404
+            item.HDF,
405
+            item['HDF+HP'],
406
+            item.HDP,
407
+            item.HD高通,
408
+            item.HF,
409
+            item.HFD,
410
+            item.HFD100,
411
+            item.HFD600,
412
+            item.HFD800,
413
+            item.HFD1000,
414
+            item['HFHD+HP'],
415
+            item.HFR,
416
+            item.HP,
417
+            item.HPD,
418
+            item['I-HDF'],
419
+            item.IUF,
420
+            item['IUF+HD'],
421
+            item.PE,
422
+            item.PHF,
423
+            item.SCUF,
424
+            item.UF,
425
+            item['腹水回输'],
426
+            item['血浆胆红素吸附'],
427
+            item['血浆胆红素吸附+HDF'],
428
+            item['血浆胆红素吸附+HP'],
429
+            item['合计'],
430
+          ]
431
+          patientTableData.push(rowdata)
432
+        })
433
+        let workSheet = XLSX.utils.aoa_to_sheet(patientTableData);
434
+        let bookNew = XLSX.utils.book_new();
435
+        XLSX.utils.book_append_sheet(bookNew, workSheet, '透析总量详情分析') // 工作簿名称
436
+        let name = '透析总量详情分析'+ '.xlsx'
437
+        XLSX.writeFile(bookNew, name) // 保存的文件名
438
+    },
439
+    // 首先定义一个getPreviousDate函数,方便调用
440
+     // 选择日期
441
+     datachange(eve){
442
+        if(eve ==1){
443
+          this.start_date = this.getPreviousDate(7)
444
+          this.end_date = this.getTime(new Date())
445
+        }else if(eve==2){
446
+          this.start_date = this.getFirstDayOfWeek(new Date())
447
+          this.end_date = this.getTime(new Date())
448
+          console.log('this.start_date', this.start_date);
449
+        }else if(eve ==3){
450
+          var date=new Date()
451
+          date.setDate(date.getDate()-7 - date.getDay() + 1);
452
+          var m =''
453
+          var d = ''
454
+          if(date.getMonth() + 1<10){
455
+            m = '0'+(date.getMonth() + 1)
456
+          }else{
457
+             m = date.getMonth() + 1
458
+          }
459
+          if(date.getDate()<10){
460
+             d = '0'+date.getDate()
461
+          }else{
462
+            d = date.getDate()
463
+          }
464
+          // this.start_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() ;
465
+          this.start_date = date.getFullYear() + "-" + m + "-" + d ;
466
+          date.setDate(date.getDate() +6);
467
+          var mm = ''
468
+          var dd = ''
469
+          if(date.getMonth() + 1<10){
470
+            mm = '0'+(date.getMonth() + 1)
471
+          }else{
472
+            mm = date.getMonth() + 1
473
+          }
474
+          if(date.getDate()<10){
475
+            dd = '0'+date.getDate()
476
+          }else{
477
+            dd = date.getDate()
478
+          }
479
+          // if(date.getMonth() + 1<10)
480
+          // this.end_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
481
+          this.end_date = date.getFullYear() + "-" + mm + "-" + dd ;
482
+          console.log('this.end_date',this.end_date);
483
+          
484
+        }else if(eve ==4){
485
+          this.start_date = this.getFirstDayOfMonth(new Date())
486
+          this.end_date = this.getTime(new Date())
487
+        }else if(eve ==5){
488
+          this.gettopMonth()
489
+        }else if(eve == 6){
490
+          this.start_date = this.getFirstDayOfYear(new Date())
491
+          this.end_date = this.getTime(new Date())
492
+        }else if(eve == 7){
493
+          this.getLastYearFirstDay()
494
+          this.getLastYearLastDay()
495
+        }
496
+        console.log('eve',eve);
497
+      },
498
+    getPreviousDate(numOfDays) {
499
+      var date = new Date();
500
+      date.setDate(date.getDate() - numOfDays);
501
+      var year = date.getFullYear();
502
+      if(date.getMonth() + 1<10){
503
+        var month = '0'+(date.getMonth() + 1);
504
+      }else{
505
+        var month = date.getMonth() + 1;
506
+      }
507
+
508
+      if(date.getDate()<10){
509
+        var day = '0'+date.getDate();
510
+      }else{
511
+        var day = date.getDate();
512
+      }
513
+      return year + "-" + month + "-" + day;
514
+    },
515
+    // 本周
516
+    getFirstDayOfWeek(date){
517
+      var weekday = date.getDay() 
518
+      date.setDate(date.getDate()-weekday+1);//往前算(weekday-1)天,年份、月份会自动变化
519
+      return this.timeFormat(date);
520
+    },
521
+    // 本月
522
+    getFirstDayOfMonth (date) {
523
+      date.setDate(1);
524
+      return this.timeFormat(date);
525
+    },
526
+    // 上个月
527
+    gettopMonth(){
528
+      var currentDate = new Date();
529
+      var month=currentDate.getMonth()+(-1);
530
+      if(month<0){
531
+        var n = parseInt((-month)/12);
532
+        month += n*12;
533
+        currentDate.setFullYear(currentDate.getFullYear()-n);
534
+      }
535
+      currentDate = new Date(currentDate.setMonth(month));
536
+      //获得当前月份0-11  
537
+      var currentMonth = currentDate.getMonth(); 
538
+      //获得当前年份4位年  
539
+      var currentYear = currentDate.getFullYear(); 
540
+      //获得上一个月的第一天  
541
+      this.start_date = this.getTime(new Date(currentYear, currentMonth-1,1)); 
542
+      //获得上一月的最后一天  
543
+      this.end_date = this.getTime(new Date(currentYear, currentMonth, 0));
544
+      console.log('11111',this.start_date);
545
+      console.log('22222',this.end_date);
546
+    },
547
+    // 本年
548
+    getFirstDayOfYear (date) {
549
+      date.setDate(1);
550
+      date.setMonth(0);
551
+      return this.timeFormat(date);
552
+    },
553
+    // 上一年第一天
554
+    getLastYearFirstDay() {  
555
+        let date = new Date();  
556
+        const year= date.setFullYear(date.getFullYear() - 1); // 设置年份为前一年  
557
+        const start_month= date.setMonth(0); // 设置月份为1月(注意月份是从0开始的)  
558
+        const start_day = date.setDate(1); // 设置日期为1日
559
+      //  const last_month = date.setMonth(11); // 设置月份为12月  
560
+      //  const last_day = date.setDate(0); // 设置日期为0,这将自动设置为该月的最后一天  
561
+      //  this.start_date = year+ "-" +start_month+ "-" +start_day
562
+        this.start_date = this.getTime(start_day)
563
+      //  return this.start_date
564
+    }, 
565
+    // 上一年最后一天
566
+    getLastYearLastDay() {  
567
+        let date = new Date();  
568
+        const year= date.setFullYear(date.getFullYear() - 1); // 设置年份为前一年  
569
+        const last_month = date.setMonth(12); // 设置月份为12月  
570
+        const last_day = date.setDate(0);// 设置日期为0,这将自动设置为该月的最后一天  
571
+        // this.end_date =  year+ "-" +last_month+ "-" +last_day
572
+        this.end_date = this.getTime(last_day)
573
+        console.log('this.end_date',this.end_date);
574
+        // return this.end_date;  
575
+    }, 
576
+    
577
+    // 日期格式化
578
+    timeFormat(date) {
579
+        if (!date || typeof(date) === "string") {
580
+          this.error("参数异常,请检查...");
581
+        }
582
+        var y = date.getFullYear(); //年
583
+        if(date.getMonth() + 1<10){
584
+          var m ='0'+(date.getMonth() + 1); //月
585
+        }else{
586
+          var m =date.getMonth() + 1; //月
587
+        }
588
+        if(date.getDate() + 1<10){
589
+          var d ='0'+date.getDate(); //日
590
+        }else{
591
+          var d = date.getDate(); //日
592
+        }
593
+        // var d = date.getDate(); //日
594
+
595
+        return y + "-" + m + "-" + d;
596
+    },
597
+    // 
598
+    dataURLtoBlob(dataURL) {
599
+      const arr = dataURL.split(',');
600
+      const mime = arr[0].match(/:(.*?);/)[1];
601
+      const bstr = atob(arr[1]);
602
+      let n = bstr.length;
603
+      const u8arr = new Uint8Array(n);
604
+      while (n--) {
605
+        u8arr[n] = bstr.charCodeAt(n);
606
+      }
607
+      return new Blob([u8arr], { type: mime });
608
+    },
609
+    // 转换时间
610
+    getTime(val) {
611
+      if(val < 0){
612
+        return ""
613
+      }
614
+      if(val == ""){
615
+        return ""
616
+      }else {
617
+        return uParseTime(val, '{y}-{m}-{d}')
618
+      }
619
+    },
620
+     // 计算年龄
621
+    analyzeIDCard(IDCard){
622
+      var age = 0,yearBirth,monthBirth,dayBirth;
623
+      //获取用户身份证号码
624
+      var userCard = IDCard;
625
+      //如果身份证号码为undefind则返回空
626
+      if(!userCard){
627
+        return age;
628
+      }
629
+      var reg = /(^\d{15}$)|(^\d{17}([0-9]|X)$)/; //验证身份证号码的正则
630
+      if (reg.test(userCard)) {
631
+        if (userCard.length == 15) {
632
+            var org_birthday = userCard.substring(6, 12);
633
+            //获取出生年月日
634
+            yearBirth = "19" + org_birthday.substring(0, 2);
635
+            monthBirth = org_birthday.substring(2, 4);
636
+            dayBirth = org_birthday.substring(4, 6);
637
+            } else if (userCard.length == 18) {
638
+            //获取出生年月日
639
+            yearBirth = userCard.substring(6,10);
640
+            monthBirth = userCard.substring(10,12);
641
+            dayBirth = userCard.substring(12,14);
642
+            
643
+          }
644
+          //获取当前年月日并计算年龄
645
+          var myDate = new Date();
646
+          var monthNow = myDate.getMonth() + 1;
647
+          var dayNow = myDate.getDate();
648
+          var age = myDate.getFullYear() - yearBirth;
649
+          if(monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)){
650
+            age--;
651
+          }
652
+          //返回年龄
653
+          return age;
654
+      } else {
655
+        return ''
656
+      }
657
+      
658
+    },
659
+    getmode(ids){
660
+      const option = this.mode_options
661
+      for(let i in option){
662
+        if(option[i].id == ids){
663
+          return option[i].name
664
+        }
665
+      }
666
+    },
667
+     // 分页每页条数
668
+    handleSizeChange(val){
669
+      console.log('333',val);
670
+      this.limit = val
671
+      this.getGetdetail()
672
+    },
673
+    // 当前页
674
+    handleCurrentChange(val){
675
+      console.log('4444',val);
676
+      this.currentPage = val
677
+      this.getGetdetail()
678
+    },
679
+    // 护士
680
+    getAllNurseList(){
681
+      getAllNurseList().then(response=>{
682
+          if(response.data.state ==1){
683
+            var nurseList  = response.data.data.nurseList
684
+          console.log('0000',nurseList);
685
+            this.nurseList =nurseList
686
+          }
687
+      })
688
+    },
689
+    // 医生
690
+    getAllDoctorList(){
691
+      getAllDoctorList().then(response=>{
692
+        if(response.data.state == 1){
693
+            var list = response.data.data.list
694
+            console.log("list222222",list)
695
+            this.docList = list
696
+            this.operators = response.data.data.operators
697
+        }
698
+      })  
699
+    },
700
+    getnurse(ids){
701
+      const nurse = this.nurseList
702
+      for(let i in nurse){
703
+        if(ids==nurse[i].admin_user_id){
704
+          return nurse[i].user_name
705
+        }
706
+      }
707
+    },
708
+    getdoctor(ids){
709
+      const doctor = this.docList
710
+      for(let i in doctor){
711
+        if(ids == doctor[i].admin_user_id){
712
+          return doctor[i].user_name
713
+        }
714
+      }
715
+    }
716
+  },
717
+  created(){
718
+    this.start_date = this.getFirstDayOfMonth(new Date())
719
+    this.getdetil()
720
+    this.getAllNurseList()
721
+    this.getAllDoctorList()
722
+  }
723
+}
724
+</script>

+ 653 - 0
src/xt_pages/Dialysisanalysis/new_otherIndicators/components/anticoagulant.vue Целия файл

@@ -0,0 +1,653 @@
1
+<template>
2
+  <div class="main-contain">
3
+    <div class="position">
4
+      <div>
5
+        <span>
6
+          <el-button @click="return_click" type="text" icon="el-icon-arrow-left">返回</el-button> 
7
+        </span>&nbsp;&nbsp;
8
+        <span>抗凝剂类型统计</span>
9
+      </div>
10
+    </div>
11
+    <div class="app-container">
12
+      <div class="page_patientControlAnalysis">
13
+        <div style="display: flex;">
14
+          <div>
15
+            日期:
16
+            <el-select v-model="date_value" @change="datachange" placeholder="请选择" style="width: 100px;">
17
+              <el-option
18
+                v-for="item in date_options"
19
+                :key="item.value"
20
+                :label="item.label"
21
+                :value="item.value">
22
+              </el-option>
23
+            </el-select>
24
+          </div>
25
+          <div style="margin: 0 10px;">
26
+            <el-date-picker
27
+              v-model="start_date"
28
+              type="date"
29
+              value-format="yyyy-MM-dd"
30
+              placeholder="选择日期"
31
+              style="width: 150px;">
32
+            </el-date-picker>
33
+            <span>-</span>
34
+            <el-date-picker
35
+              v-model="end_date"
36
+              type="date"
37
+              value-format="yyyy-MM-dd"
38
+              placeholder="选择日期"
39
+              style="width: 150px;">
40
+            </el-date-picker>
41
+          </div>
42
+          <div>
43
+            <el-button type="primary" @click="sete_click">查询</el-button>
44
+            <el-button type="primary" @click="Download_click">下载</el-button>
45
+          </div>
46
+        </div>
47
+        <!-- 图表 -->
48
+        <div ref="mychart">
49
+          <div class="echart" id="mychart"  style="width:100%;height:60vh"></div>
50
+        </div>
51
+          <div style="position: fixed;right: 5%;top: 50vh;">
52
+            <el-popover
53
+              placement="left"
54
+              title="提示"
55
+              width="500"
56
+              trigger="click"
57
+              content="1.统计时间段内,所有患者的抗凝剂使用情况,低分子肝素 x 例次,普通肝素 x 例次、无肝素 x 例次。
58
+                       2.一个患者多次使用低分子肝素时,算多个例次,其他图例同理。">
59
+              <img src="@/assets/img/xiang.png" alt="" style="height: 20px;width: 20px;" slot="reference">
60
+              <!-- <el-button slot="reference">click 激活</el-button> -->
61
+            </el-popover>
62
+          </div>
63
+      </div>
64
+    </div>
65
+
66
+    <!-- 弹窗 -->
67
+    <div>
68
+      <el-dialog
69
+        title="详情"
70
+        :visible.sync="anticoagulant_dialog"
71
+        width="80%">
72
+        <div>
73
+          <div style="display: flex;margin-bottom: 20px;">
74
+            <div style="flex: 2;display: flex;">
75
+              <div>
76
+                日期:
77
+                <el-select v-model="date_value" @change="datachange" placeholder="请选择" style="width: 100px;">
78
+                  <el-option
79
+                    v-for="item in date_options"
80
+                    :key="item.value"
81
+                    :label="item.label"
82
+                    :value="item.value">
83
+                  </el-option>
84
+                </el-select>
85
+              </div>
86
+              <div style="margin: 0 10px;">
87
+                <el-date-picker
88
+                  v-model="start_date"
89
+                  type="date"
90
+                  value-format="yyyy-MM-dd"
91
+                  placeholder="选择日期"
92
+                  style="width: 150px;">
93
+                </el-date-picker>
94
+                <span>-</span>
95
+                <el-date-picker
96
+                  v-model="end_date"
97
+                  type="date"
98
+                  value-format="yyyy-MM-dd"
99
+                  placeholder="选择日期"
100
+                  style="width: 150px;">
101
+                </el-date-picker>
102
+              </div>
103
+
104
+              <div>
105
+                抗凝剂类型:
106
+                <el-select v-model="dialyze_value" placeholder="请选择" style="width: 130px;">
107
+                  <el-option :key="0" label="不限" :value="0"></el-option>
108
+                  <el-option
109
+                    v-for="item in dialyze_options"
110
+                    :key="item.id"
111
+                    :label="item.name"
112
+                    :value="item.id">
113
+                  </el-option>
114
+                </el-select>
115
+              </div>
116
+            </div>
117
+            <div style="flex: 1;">
118
+              <div>
119
+                <el-button type="primary" @click="deil_click">查询</el-button>
120
+                <el-button type="primary" @click="exportExcel">导出</el-button>
121
+              </div>
122
+            </div>
123
+          </div>
124
+
125
+          <el-table :data="tableData" border style="width: 100%"
126
+          :header-cell-style="{textAlign: 'center'}"
127
+          :cell-style="{ textAlign: 'center' }"
128
+          height="380">
129
+            <el-table-column
130
+              prop="index"
131
+              label="序号"
132
+              width="80">
133
+            </el-table-column>
134
+            <el-table-column
135
+              prop="dialysis_no"
136
+              label="透析号"
137
+              width="120">
138
+            </el-table-column>
139
+            <el-table-column
140
+              prop="name"
141
+              label="患者姓名"
142
+              width="120">
143
+            </el-table-column>
144
+            <el-table-column
145
+              prop="dialysis_date"
146
+              label="透析日期"
147
+              width="150">
148
+            </el-table-column>
149
+            <el-table-column
150
+              prop="mode_name"
151
+              label="透析模式"
152
+              width="100">
153
+            </el-table-column>
154
+            <el-table-column
155
+              prop="anticoagulant"
156
+              label="抗凝剂(首剂)(维持/追加)(总量)">
157
+              <template slot-scope="scope">
158
+                {{ scope.row.anticoagulant }}({{ scope.row.shouji }})
159
+                ({{ scope.row.weichi }})({{ scope.row.zongliang }})
160
+              </template>
161
+            </el-table-column>
162
+            
163
+          </el-table>
164
+          <div style="text-align: right;margin-top: 10px;">
165
+            <el-pagination
166
+              @size-change="handleSizeChange"
167
+              @current-change="handleCurrentChange"
168
+              :current-page="currentPage"
169
+              :page-sizes="[50,100, 200, 300, 400]"
170
+              :page-size="limit"
171
+              layout="total, sizes, prev, pager, next, jumper"
172
+              :total="total">
173
+            </el-pagination>
174
+          </div>
175
+          
176
+        </div>
177
+        <span slot="footer" class="dialog-footer">
178
+          <el-button @click="anticoagulant_dialog = false">取 消</el-button>
179
+          <el-button type="primary" @click="anticoagulant_dialog = false">确 定</el-button>
180
+        </span>
181
+      </el-dialog>
182
+    </div>
183
+  </div>
184
+</template>
185
+<script>
186
+import * as echarts from 'echarts';
187
+import XLSX from 'xlsx';
188
+import {Getanticoagulant,Getdetail} from '../../../../api/qcd'
189
+import { uParseTime } from "@/utils/tools";
190
+import html2canvas from "html2canvas"
191
+  export default {
192
+    components:{
193
+      // LineChart,
194
+      // line_echart
195
+    },
196
+    data(){
197
+      return{
198
+        date_value:4,
199
+        start_date:'',
200
+        end_date:this.getTime(new Date()),
201
+        mode:'',
202
+        date_mode:'',
203
+        source:'',
204
+        dialyze_value:0,
205
+        anticoagulant_dialog:false,
206
+        currentPage:1,
207
+        limit:50,
208
+        dialyze_options:[],//抗凝剂选项数组
209
+        anticoagulant:[],//全部抗凝剂数组
210
+        tableData:[],
211
+        total:'',
212
+       
213
+        date_options:[{value:1,label:'最近七天'},{value:2,label:'本周'},{value:3,label:'上周'},{value:4,label:'本月'},
214
+                      {value:5,label:'上月'},{value:6,label:'本年'},{value:7,label:'上一年'}
215
+        ],
216
+        modearr:[{ id: 1, name: 'HD' },{ id: 2, name: 'HDF' },{ id: 3, name: 'HD + HP' },{ id: 4, name: 'HP' },
217
+          { id: 5, name: 'HF' },{ id: 6, name: 'SCUF' },{ id: 7, name: 'IUF' },{ id: 8, name: 'HFHD' },{ id: 9, name: 'HFHD+HP' },
218
+          { id: 10, name: 'PHF' },{ id: 11, name: 'HFR' },{ id: 12, name: 'HDF+HP' },{ id: 13, name: 'CRRT' },{ id: 14, name: '腹水回输' },
219
+          { id:19, name:"IUF+HD"},{ id:20, name:"UF"},{ id:21, name:"HD+"},{ id:22, name:"血浆胆红素吸附+HDF"},{ id:23, name:"血浆胆红素吸附"},
220
+          { id:24, name:"I-HDF"},{ id:25, name:"HD高通"},{ id:26, name:"CVVH"},{ id:27, name:"CVVHD"},{ id:28, name:"CVVHDF"},{ id:29, name:"PE"},
221
+          { id:30, name:"血浆胆红素吸附+HP"},{ id:31, name:"HPD"},{ id:32, name:"HDP"},{ id:33, name:"HFD"},{ id:34, name:"HDF100"},
222
+          { id:35, name:"HDF600"},{ id:36, name:"HDF800"},{ id:37, name:"HDF1000"},
223
+        ],
224
+        date_mode_options:[{value:1,label:'按周'},{value:2,label:'按天'},{value:3,label:'按月'},{value:4,label:'按年'}],
225
+        source_options:[{value:1,label:'以开始透析为准'},{value:2,label:'以排班为准'}],
226
+        bar_xAxis:[],
227
+      }
228
+    },
229
+    methods:{
230
+      // 返回
231
+      return_click(){
232
+        this.$router.push('/Dialysisanalysis/qualitycontrol/new_otherIndicators')
233
+      },
234
+      // 数据源
235
+      getecharts(){
236
+        var chartDom = document.getElementById('mychart')
237
+        var myChart = echarts.init(chartDom);
238
+        const params = {
239
+          start_date:this.start_date,
240
+          end_date:this.end_date
241
+        }
242
+        Getanticoagulant(params).then(response =>{
243
+          if(response.data.state ==1){
244
+            const list = response.data.data.data
245
+            const xAxis = []
246
+            const yAxis = []
247
+            const bili = []
248
+            list.forEach(item =>{
249
+              xAxis.push(item.name)
250
+              yAxis.push(item.count)
251
+              bili.push((item.percentage).toFixed(2))
252
+            })
253
+            this.bar_xAxis = xAxis
254
+            console.log('bili',this.bar_xAxis);
255
+            const option = {
256
+              xAxis: {
257
+                type: 'category',
258
+                data: xAxis
259
+              },
260
+              yAxis: {
261
+                type: 'value'
262
+              },
263
+              series: [
264
+                {
265
+                  data:yAxis,
266
+                  type: 'bar',
267
+                  barWidth: '25%',
268
+                  label: {
269
+                    normal: {
270
+                      show: true,
271
+                      position: 'top',
272
+                      formatter: '{c}',
273
+                      textStyle:{
274
+                        color: 'black',//字体颜色
275
+                        fontSize: 13//字体大小
276
+                      }
277
+                    },
278
+                  },
279
+                  itemStyle:{
280
+                    normal:{
281
+                      color:function (params){
282
+                        // const colorarr=['#FFA333','#A155E8','#6D91FF','#A233A2'];
283
+                        var colorarr = [["#A9E0F3", "#9FBDFC"],["#FFD7C0", "#FF9994"]]
284
+                        var index = params.dataIndex;
285
+                        if (params.dataIndex >= colorarr.length) {
286
+                          index = params.dataIndex % colorarr.length;
287
+                        }
288
+                        return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
289
+                          { offset: 0, color: colorarr[index][0] },
290
+                          // { offset: 0.5, color: colorList[index][1] },
291
+                          { offset: 1, color: colorarr[index][1] }
292
+                        ]);
293
+                      }
294
+                    }
295
+                  }
296
+
297
+                }
298
+              ]
299
+            }
300
+            myChart.setOption(option);
301
+            myChart.on('click',params =>{
302
+              this.anticoagulant_dialog = true
303
+              this.getGetdetail()
304
+              this.getbarxAxis()
305
+              console.log('params',params);
306
+            })
307
+          }
308
+          console.log('response',response);
309
+        })
310
+        
311
+      },
312
+      // 详情数据源
313
+      getGetdetail(){
314
+        const params ={
315
+          anticoagulant:this.dialyze_value,
316
+          start_date:this.start_date,
317
+          end_date:this.end_date,
318
+          page:this.currentPage,
319
+          limit:this.limit,
320
+        }
321
+        Getdetail(params).then(response =>{
322
+          if(response.data.state ==1){
323
+            const list = response.data.data.prescriptions
324
+            const table = []
325
+            list.forEach((item,index) =>{
326
+              const obj ={
327
+                index:index+1,
328
+                dialysis_no:item.patient.dialysis_no,
329
+                name:item.patient.name,
330
+                dialysis_date:this.getTime(item.record_date),
331
+                mode_name:this.getmode(item.mode_id),
332
+                anticoagulant:this.getanticoagulant(item.anticoagulant),
333
+                shouji:item.anticoagulant_shouji,
334
+                weichi:item.anticoagulant_weichi,
335
+                zongliang:item.anticoagulant_zongliang
336
+              }
337
+              table.push(obj)
338
+            })
339
+            this.tableData = table
340
+            this.total = response.data.data.total
341
+          }
342
+        })
343
+      },
344
+      
345
+      // 查询
346
+      sete_click(){
347
+        this.getecharts()
348
+      },
349
+      // 详情查询
350
+      deil_click(){
351
+        this.getGetdetail()
352
+      },
353
+      //导出excel
354
+      exportExcel(){
355
+        let tableData = [ 
356
+          ['序号', '透析号', '患者姓名', '透析日期','透析模式', '抗凝剂', '首剂','维持/追加', '总量',]//导出表头
357
+        ]
358
+        this.tableData.forEach((item,index) =>{
359
+          let rowdata=[]
360
+          rowdata=[
361
+            index+1,
362
+            item.dialysis_no,
363
+            item.name,
364
+            item.dialysis_date,
365
+            item.mode_name,
366
+            item.anticoagulant,
367
+            item.shouji,
368
+            item.weichi,
369
+            item.zongliang,
370
+          ]
371
+          tableData.push(rowdata)
372
+        })
373
+        let workSheet = XLSX.utils.aoa_to_sheet(tableData);
374
+        let bookNew = XLSX.utils.book_new();
375
+        XLSX.utils.book_append_sheet(bookNew, workSheet, '抗凝剂类型统计') // 工作簿名称
376
+        let name = '抗凝剂类型统计'+ '.xlsx'
377
+        XLSX.writeFile(bookNew, name) // 保存的文件名
378
+      },
379
+       // 下载 
380
+      Download_click(){
381
+        const options ={
382
+          allowTaint: true,
383
+          useCORS: true
384
+        }
385
+        html2canvas(this.$refs.mychart,options).then(canvas =>{
386
+          // const imageSrc = canvas.toDataURL();
387
+          const imageUrl = canvas.toDataURL("image/png");
388
+          // console.log('5555',imageUrl);
389
+        //   // const base = this.url.split(',')[1]
390
+        //   // console.log('2222',base);
391
+          const blob = this.dataURLtoBlob(imageUrl)
392
+          // console.log('4444',blob);
393
+          const url = URL.createObjectURL(blob);
394
+          // const file = (this.url).blob();
395
+          // console.log('1111',url);
396
+          var link= document.createElement("a");
397
+        //   //将生成的图片url赋值给a标签的href属性
398
+          link.href = url; 
399
+        //   //设置下载的文件名
400
+          link.download = "抗凝剂类型统计.jpg";
401
+          // // 将a标签插入dom中
402
+          console.log('link',link);
403
+          document.body.appendChild(link);
404
+          //模拟点击事件触发下载
405
+          link.click();
406
+          // 完成之后销毁创建的a标签
407
+          document.body.removeChild(link);
408
+
409
+        })
410
+      },
411
+       // 选择日期
412
+       datachange(eve){
413
+        if(eve ==1){
414
+          this.start_date = this.getPreviousDate(7)
415
+          this.end_date = this.getTime(new Date())
416
+        }else if(eve==2){
417
+          this.start_date = this.getFirstDayOfWeek(new Date())
418
+          this.end_date = this.getTime(new Date())
419
+          console.log('this.start_date', this.start_date);
420
+        }else if(eve ==3){
421
+          var date=new Date()
422
+          date.setDate(date.getDate()-7 - date.getDay() + 1);
423
+          var m =''
424
+          var d = ''
425
+          if(date.getMonth() + 1<10){
426
+            m = '0'+(date.getMonth() + 1)
427
+          }else{
428
+             m = date.getMonth() + 1
429
+          }
430
+          if(date.getDate()<10){
431
+             d = '0'+date.getDate()
432
+          }else{
433
+            d = date.getDate()
434
+          }
435
+          // this.start_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() ;
436
+          this.start_date = date.getFullYear() + "-" + m + "-" + d ;
437
+          date.setDate(date.getDate() +6);
438
+          var mm = ''
439
+          var dd = ''
440
+          if(date.getMonth() + 1<10){
441
+            mm = '0'+(date.getMonth() + 1)
442
+          }else{
443
+            mm = date.getMonth() + 1
444
+          }
445
+          if(date.getDate()<10){
446
+            dd = '0'+date.getDate()
447
+          }else{
448
+            dd = date.getDate()
449
+          }
450
+          // if(date.getMonth() + 1<10)
451
+          // this.end_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
452
+          this.end_date = date.getFullYear() + "-" + mm + "-" + dd ;
453
+          console.log('this.end_date',this.end_date);
454
+          
455
+        }else if(eve ==4){
456
+          this.start_date = this.getFirstDayOfMonth(new Date())
457
+          this.end_date = this.getTime(new Date())
458
+        }else if(eve ==5){
459
+          this.gettopMonth()
460
+        }else if(eve == 6){
461
+          this.start_date = this.getFirstDayOfYear(new Date())
462
+          this.end_date = this.getTime(new Date())
463
+        }else if(eve == 7){
464
+          this.getLastYearFirstDay()
465
+          this.getLastYearLastDay()
466
+        }
467
+        console.log('eve',eve);
468
+      },
469
+      // 首先定义一个getPreviousDate函数,方便调用
470
+      getPreviousDate(numOfDays) {
471
+        var date = new Date();
472
+        date.setDate(date.getDate() - numOfDays);
473
+        var year = date.getFullYear();
474
+        if(date.getMonth() + 1<10){
475
+          var month = '0'+(date.getMonth() + 1);
476
+        }else{
477
+          var month = date.getMonth() + 1;
478
+        }
479
+
480
+        if(date.getDate()<10){
481
+          var day = '0'+date.getDate();
482
+        }else{
483
+          var day = date.getDate();
484
+        }
485
+        return year + "-" + month + "-" + day;
486
+      },
487
+      // 本周
488
+      getFirstDayOfWeek(date){
489
+        var weekday = date.getDay() 
490
+        date.setDate(date.getDate()-weekday+1);//往前算(weekday-1)天,年份、月份会自动变化
491
+        return this.timeFormat(date);
492
+      },
493
+      // 本月
494
+      getFirstDayOfMonth (date) {
495
+        date.setDate(1);
496
+        return this.timeFormat(date);
497
+      },
498
+      // 上个月
499
+      gettopMonth(){
500
+        var currentDate = new Date();
501
+        var month=currentDate.getMonth()+(-1);
502
+        if(month<0){
503
+          var n = parseInt((-month)/12);
504
+          month += n*12;
505
+          currentDate.setFullYear(currentDate.getFullYear()-n);
506
+        }
507
+        currentDate = new Date(currentDate.setMonth(month));
508
+        //获得当前月份0-11  
509
+        var currentMonth = currentDate.getMonth(); 
510
+        //获得当前年份4位年  
511
+        var currentYear = currentDate.getFullYear(); 
512
+        //获得上一个月的第一天  
513
+        this.start_date = this.getTime(new Date(currentYear, currentMonth-1,1)); 
514
+        //获得上一月的最后一天  
515
+        this.end_date = this.getTime(new Date(currentYear, currentMonth, 0));
516
+       console.log('11111',this.start_date);
517
+       console.log('22222',this.end_date);
518
+      },
519
+      // 本年
520
+      getFirstDayOfYear (date) {
521
+        date.setDate(1);
522
+        date.setMonth(0);
523
+        return this.timeFormat(date);
524
+      },
525
+      // 上一年第一天
526
+      getLastYearFirstDay() {  
527
+          let date = new Date();  
528
+         const year= date.setFullYear(date.getFullYear() - 1); // 设置年份为前一年  
529
+         const start_month= date.setMonth(0); // 设置月份为1月(注意月份是从0开始的)  
530
+         const start_day = date.setDate(1); // 设置日期为1日
531
+        //  const last_month = date.setMonth(11); // 设置月份为12月  
532
+        //  const last_day = date.setDate(0); // 设置日期为0,这将自动设置为该月的最后一天  
533
+        //  this.start_date = year+ "-" +start_month+ "-" +start_day
534
+         this.start_date = this.getTime(start_day)
535
+        //  return this.start_date
536
+      }, 
537
+      // 上一年最后一天
538
+      getLastYearLastDay() {  
539
+          let date = new Date();  
540
+          const year= date.setFullYear(date.getFullYear() - 1); // 设置年份为前一年  
541
+          const last_month = date.setMonth(12); // 设置月份为12月  
542
+          const last_day = date.setDate(0);// 设置日期为0,这将自动设置为该月的最后一天  
543
+          // this.end_date =  year+ "-" +last_month+ "-" +last_day
544
+          this.end_date = this.getTime(last_day)
545
+          console.log('this.end_date',this.end_date);
546
+          // return this.end_date;  
547
+      }, 
548
+      // 日期格式化
549
+      timeFormat(date) {
550
+          if (!date || typeof(date) === "string") {
551
+            this.error("参数异常,请检查...");
552
+          }
553
+          var y = date.getFullYear(); //年
554
+          if(date.getMonth() + 1<10){
555
+            var m ='0'+(date.getMonth() + 1); //月
556
+          }else{
557
+            var m =date.getMonth() + 1; //月
558
+          }
559
+          if(date.getDate() + 1<10){
560
+            var d ='0'+date.getDate(); //日
561
+          }else{
562
+            var d = date.getDate(); //日
563
+          }
564
+          // var d = date.getDate(); //日
565
+
566
+          return y + "-" + m + "-" + d;
567
+      },
568
+      // 分页每页条数
569
+      handleSizeChange(val){
570
+        console.log('333',val);
571
+        this.limit = val
572
+        this.getGetdetail()
573
+      },
574
+      // 当前页
575
+      handleCurrentChange(val){
576
+        console.log('4444',val);
577
+        this.currentPage = val
578
+        this.getGetdetail()
579
+      },
580
+      // 转换时间
581
+      getTime(val) {
582
+        if(val < 0){
583
+          return ""
584
+        }
585
+        if(val == ""){
586
+          return ""
587
+        }else {
588
+          return uParseTime(val, '{y}-{m}-{d}')
589
+        }
590
+      },
591
+      // 获取抗凝剂选项
592
+      getbarxAxis(){
593
+        for(let j in this.bar_xAxis){
594
+          for(let i in this.anticoagulant){
595
+            if(this.bar_xAxis[j]==this.anticoagulant[i].name){
596
+              console.log('tttt',this.anticoagulant[i]);
597
+               this.dialyze_options.push(this.anticoagulant[i])
598
+            }
599
+          }
600
+        }
601
+      },
602
+      getmode(ids){
603
+        const modes=this.modearr
604
+        for(let i in modes){
605
+          if(ids == modes[i].id){
606
+            return modes[i].name
607
+          }
608
+        }
609
+      },
610
+      getanticoagulant(ids){
611
+        const option = this.anticoagulant
612
+        for(let i in option){
613
+          if(option[i].id == ids){
614
+            return option[i].name
615
+          }
616
+        }
617
+      },
618
+      dataURLtoBlob(dataURL) {
619
+        const arr = dataURL.split(',');
620
+        const mime = arr[0].match(/:(.*?);/)[1];
621
+        const bstr = atob(arr[1]);
622
+        let n = bstr.length;
623
+        const u8arr = new Uint8Array(n);
624
+        while (n--) {
625
+          u8arr[n] = bstr.charCodeAt(n);
626
+        }
627
+        return new Blob([u8arr], { type: mime });
628
+      },
629
+    },
630
+    mounted(){
631
+      this.getecharts()
632
+    },
633
+    created(){
634
+      this.start_date = this.getFirstDayOfMonth(new Date())
635
+      const anticoagulantsarr = this.$store.getters.anticoagulants_confit
636
+      var arr =[]
637
+      for(let i in anticoagulantsarr){
638
+        const obj ={
639
+          id:anticoagulantsarr[i].id,
640
+          name:anticoagulantsarr[i].name
641
+        }
642
+        arr.push(obj)
643
+      }
644
+      this.anticoagulant = arr
645
+      console.log('this.$',this.anticoagulant);
646
+      // var may = document.getElementById('mychart')
647
+      // console.log('document.getElementById(mychart)',this.$refs.mychart);
648
+      // this.getecharts()
649
+      // this.bar.xAxis.data= this.bar_xAxis
650
+    },
651
+
652
+  }
653
+</script>

+ 724 - 0
src/xt_pages/Dialysisanalysis/new_otherIndicators/components/complete.vue Целия файл

@@ -0,0 +1,724 @@
1
+<template>
2
+  <div class="main-contain">
3
+    <div class="position">
4
+      <div>
5
+        <span>
6
+          <el-button @click="return_click" type="text" icon="el-icon-arrow-left">返回</el-button> 
7
+        </span>&nbsp;&nbsp;
8
+        <span>透析治疗完成率</span>
9
+      </div>
10
+    </div>
11
+    <div class="app-container">
12
+      <div class="page_patientControlAnalysis">
13
+        <div style="display: flex;">
14
+          <div>
15
+            日期:
16
+            <el-select v-model="date_value" @change="datachange" placeholder="请选择" style="width: 100px;">
17
+              <el-option
18
+                v-for="item in date_options"
19
+                :key="item.value"
20
+                :label="item.label"
21
+                :value="item.value">
22
+              </el-option>
23
+            </el-select>
24
+          </div>
25
+          <div style="margin:0 10px">
26
+            <el-date-picker
27
+              v-model="start_date"
28
+              type="date"
29
+              value-format="yyyy-MM-dd"
30
+              placeholder="选择日期"
31
+              style="width: 150px;">
32
+            </el-date-picker>
33
+            <span>-</span>
34
+            <el-date-picker
35
+              v-model="end_date"
36
+              type="date"
37
+              value-format="yyyy-MM-dd"
38
+              placeholder="选择日期"
39
+              style="width: 150px;">
40
+            </el-date-picker>
41
+          </div>
42
+          <div>
43
+            <el-button type="primary" @click="sete_click">查询</el-button>
44
+            <el-button type="primary" @click="Download_click">下载</el-button>
45
+          </div>
46
+        </div>
47
+        <!-- 图表 -->
48
+        <div ref="mychart">
49
+          <div class="echart" id="mychart"  style="width:100%;height:60vh"></div>
50
+        </div>
51
+
52
+          <div style="position: fixed;right: 5%;top: 50vh;">
53
+            <el-popover
54
+              placement="left"
55
+              title="提示"
56
+              width="500"
57
+              trigger="click"
58
+              content="1. 患者来源的筛选以患者单次透析治疗时的状态为准。
59
+                        2.统计实际透析时长是否达到处方透析时长,只要实际时长与处方时长的差不超过处方时长±15 分钟,都算达到。
60
+                        3.只统计完成结束透析且透后评估有确认的透析例次。">
61
+              <img src="@/assets/img/xiang.png" alt="" style="height: 20px;width: 20px;" slot="reference">
62
+              <!-- <el-button slot="reference">click 激活</el-button> -->
63
+            </el-popover>
64
+          </div>
65
+      </div>
66
+    </div>
67
+
68
+    <!-- 弹窗 -->
69
+    <div>
70
+      <el-dialog
71
+        title="提示"
72
+        :visible.sync="complete_dialog"
73
+        width="80%">
74
+        <div>
75
+          <div style="display: flex;margin-bottom: 20px;">
76
+            <div style="flex: 2;display: flex;">
77
+              <div>
78
+                日期:
79
+                <el-select v-model="date_value" placeholder="请选择" style="width: 100px;">
80
+                  <el-option
81
+                    v-for="item in date_options"
82
+                    :key="item.value"
83
+                    :label="item.label"
84
+                    :value="item.value">
85
+                  </el-option>
86
+                </el-select>
87
+              </div>
88
+              <div style="margin:0 10px">
89
+                <el-date-picker
90
+                  v-model="start_date"
91
+                  type="date"
92
+                  value-format="yyyy-MM-dd"
93
+                  placeholder="选择日期"
94
+                  style="width: 150px;">
95
+                </el-date-picker>
96
+                <span>-</span>
97
+                <el-date-picker
98
+                  v-model="end_date"
99
+                  type="date"
100
+                  value-format="yyyy-MM-dd"
101
+                  placeholder="选择日期"
102
+                  style="width: 150px;">
103
+                </el-date-picker>
104
+              </div>
105
+
106
+              <div>
107
+                状态:
108
+                <el-select v-model="status_value" placeholder="请选择" style="width: 130px;">
109
+                  <el-option :key="0" label="不限" :value="0"></el-option>
110
+                  <el-option
111
+                    v-for="item in status_options"
112
+                    :key="item.value"
113
+                    :label="item.label"
114
+                    :value="item.value">
115
+                  </el-option>
116
+                </el-select>
117
+              </div>
118
+            </div>
119
+            <div style="flex: 1;">
120
+              <div>
121
+                <el-button type="primary" @click="detil_click">查询</el-button>
122
+                
123
+                <el-button type="primary" @click="derive_click">导出</el-button>
124
+              </div>
125
+            </div>
126
+          </div>
127
+          <div>
128
+            <el-table :data="tableData"
129
+              border
130
+              style="width: 100%"
131
+              height="380">
132
+              <el-table-column
133
+                prop="index"
134
+                label="序号"
135
+                width="">
136
+              </el-table-column>
137
+              <el-table-column
138
+                prop="dialysis_no"
139
+                label="透析号"
140
+                width="">
141
+              </el-table-column>
142
+              <el-table-column
143
+                prop="patient_name"
144
+                label="患者姓名">
145
+              </el-table-column>
146
+              <el-table-column
147
+                prop="age"
148
+                label="年龄">
149
+              </el-table-column>
150
+              <el-table-column
151
+                prop="dialysis_date"
152
+                label="透析日期"
153
+                width="">
154
+              </el-table-column>
155
+              <el-table-column
156
+                prop="dialysis_duration"
157
+                label="处方透析时长"
158
+                width="">
159
+              </el-table-column>
160
+              <el-table-column
161
+                prop="actual_duration"
162
+                label="实际透析时长"
163
+                width="">
164
+              </el-table-column>
165
+              <el-table-column
166
+                prop="diff"
167
+                label="实际差(min)"
168
+                width="">
169
+              </el-table-column>
170
+              <el-table-column
171
+                prop="doctor"
172
+                label="主治医生"
173
+                width="">
174
+              </el-table-column>
175
+              <el-table-column
176
+                prop="nurse"
177
+                label="主治护士">
178
+              </el-table-column>
179
+            </el-table>
180
+          </div>
181
+          <div style="text-align: right;margin-top: 10px;">
182
+            <el-pagination
183
+              @size-change="handleSizeChange"
184
+              @current-change="handleCurrentChange"
185
+              :current-page="currentPage"
186
+              :page-sizes="[50,100, 200, 300, 400]"
187
+              :page-size="limit"
188
+              layout="total, sizes, prev, pager, next, jumper"
189
+              :total="total">
190
+            </el-pagination>
191
+          </div>
192
+        </div>
193
+        <span slot="footer" class="dialog-footer">
194
+          <el-button @click="complete_dialog = false">取 消</el-button>
195
+          <el-button type="primary" @click="complete_dialog = false">确 定</el-button>
196
+        </span>
197
+      </el-dialog>
198
+    </div>
199
+  </div>
200
+</template>
201
+<script>
202
+import * as echarts from 'echarts';
203
+import XLSX from 'xlsx';
204
+import { uParseTime } from "@/utils/tools";
205
+import {Getdialysistreatfinish,Getdialysistreatdetail} from '../../../../api/qcd'
206
+import {getAllNurseList} from '@/api/fallassement'
207
+import { getAllDoctorList} from "@/api/device"
208
+import html2canvas from "html2canvas"
209
+  export default {
210
+    components:{
211
+    },
212
+    data(){
213
+      return{
214
+        date_value:4,
215
+        start_date:'',
216
+        end_date:this.getTime(new Date()),
217
+        mode:'',
218
+        date_mode:'',
219
+        source:'',
220
+        status_value:0,
221
+        complete_dialog:false,
222
+        currentPage:1,
223
+        limit:50,
224
+        total:0,
225
+        tableData:[],
226
+        status_options:[],
227
+        nurseList:[],
228
+        operators:[],
229
+        docList:[],
230
+        date_options:[{value:1,label:'最近七天'},{value:2,label:'本周'},{value:3,label:'上周'},{value:4,label:'本月'},
231
+                      {value:5,label:'上月'},{value:6,label:'本年'},{value:7,label:'上一年'}
232
+        ],
233
+        mode_options:[{ id: 1, name: 'HD' },{ id: 2, name: 'HDF' },{ id: 3, name: 'HD + HP' },{ id: 4, name: 'HP' },
234
+          { id: 5, name: 'HF' },{ id: 6, name: 'SCUF' },{ id: 7, name: 'IUF' },{ id: 8, name: 'HFHD' },{ id: 9, name: 'HFHD+HP' },
235
+          { id: 10, name: 'PHF' },{ id: 11, name: 'HFR' },{ id: 12, name: 'HDF+HP' },{ id: 13, name: 'CRRT' },{ id: 14, name: '腹水回输' },
236
+          { id: 15, name: 'HD前置换' },{ id: 16, name: 'HD后置换' },{ id: 17, name: 'HDF前置换' },{ id: 18, name: 'HDF后置换' },
237
+          { id:19, name:"IUF+HD"},{ id:20, name:"UF"},{ id:21, name:"HD+"},{ id:22, name:"血浆胆红素吸附+HDF"},{ id:23, name:"血浆胆红素吸附"},
238
+          { id:24, name:"I-HDF"},{ id:25, name:"HD高通"},{ id:26, name:"CVVH"},{ id:27, name:"CVVHD"},{ id:28, name:"CVVHDF"},{ id:29, name:"PE"},
239
+        ],
240
+        date_mode_options:[{value:1,label:'按周'},{value:2,label:'按天'},{value:3,label:'按月'},{value:4,label:'按年'}],
241
+        source_options:[{value:1,label:'以开始透析为准'},{value:2,label:'以排班为准'}],
242
+        bar_xAxis:['HD','HDF','HD + HP','HP','HF','SCUF','IUF'],
243
+      }
244
+    },
245
+    methods:{
246
+      // 返回
247
+      return_click(){
248
+        this.$router.push('/Dialysisanalysis/qualitycontrol/new_otherIndicators')
249
+      },
250
+      // 数据源
251
+      getecharts(){
252
+        var chartDom = document.getElementById('mychart')
253
+        var myChart = echarts.init(chartDom);
254
+        const params={
255
+          start_date:this.start_date,
256
+          end_date:this.end_date
257
+        }
258
+        Getdialysistreatfinish(params).then(response =>{
259
+          if(response.data.state ==1){
260
+            const list = response.data.data.data
261
+            const xAxis = []
262
+            const yAxis = []
263
+
264
+            const total = response.data.data.total
265
+            for(let key in list){
266
+              const obj={
267
+                name:key,
268
+                value:list[key]
269
+              }
270
+              xAxis.push(obj)
271
+              yAxis.push(key)
272
+            }
273
+            const status = []
274
+            for(let i in yAxis){
275
+              const obj ={
276
+                value:(i*1)+1,
277
+                label:yAxis[i]
278
+              }
279
+              status.push(obj)
280
+            }
281
+            this.status_options = status
282
+            const option = {
283
+                title:{
284
+                  text:'总数'+total,
285
+                  left:'5%',
286
+                  bottom:'5%',
287
+                  textStyle:{
288
+                    fontSize:30
289
+                  }
290
+                },
291
+                tooltip: {
292
+                  trigger: 'item',
293
+
294
+                },
295
+                legend: {
296
+                  data:yAxis,
297
+                  left: '10%',
298
+                  top: '30%',
299
+                  orient: 'vertical'
300
+                },
301
+                series: [
302
+                  {
303
+                    name: 'Access From',
304
+                    type: 'pie',
305
+                    radius: ['40%', '70%'],
306
+                    avoidLabelOverlap: false,
307
+                    itemStyle: {
308
+                      borderRadius: 10,
309
+                      borderColor: '#fff',
310
+                      borderWidth: 2
311
+                    },
312
+                    label: {
313
+                      show: true,
314
+                      position: 'center',
315
+                      normal : {
316
+                        formatter: '{b}:{c}: ({d}%)',
317
+                        textStyle : {
318
+                          fontWeight : 'normal',
319
+                          fontSize : 15,
320
+                          color : "black"
321
+                        }
322
+                      }
323
+                    },
324
+                    emphasis: {
325
+                      label: {
326
+                        show: true,
327
+                        fontSize: 40,
328
+                        fontWeight: 'bold'
329
+                      }
330
+                    },
331
+                    labelLine: {
332
+                      show: false
333
+                    },
334
+                    data: xAxis
335
+                  }
336
+                ]
337
+              };
338
+            myChart.setOption(option);
339
+            myChart.on('click',params =>{
340
+              this.complete_dialog = true
341
+              console.log('bbbb',params);
342
+              var status_id =''
343
+              for(let i in this.status_options){
344
+                if(params.data.name == this.status_options[i].label){
345
+                  status_id = this.status_options[i].value
346
+                }
347
+              }
348
+              this.getdetail(status_id)
349
+            })
350
+          }
351
+        })
352
+        
353
+      },
354
+      // 查询
355
+      sete_click(){
356
+        this.getecharts()
357
+      },
358
+      // 详情查询
359
+      detil_click(){
360
+        this.getdetail()
361
+      },
362
+       // 下载 
363
+      Download_click(){
364
+        const options ={
365
+          allowTaint: true,
366
+          useCORS: true
367
+        }
368
+        html2canvas(this.$refs.mychart,options).then(canvas =>{
369
+          // const imageSrc = canvas.toDataURL();
370
+          const imageUrl = canvas.toDataURL("image/png");
371
+          const blob = this.dataURLtoBlob(imageUrl)
372
+          const url = URL.createObjectURL(blob);
373
+          var link= document.createElement("a");
374
+        //   //将生成的图片url赋值给a标签的href属性
375
+          link.href = url; 
376
+        //   //设置下载的文件名
377
+          link.download = "透析完成率统计.jpg";
378
+          // // 将a标签插入dom中
379
+          console.log('link',link);
380
+          document.body.appendChild(link);
381
+          //模拟点击事件触发下载
382
+          link.click();
383
+          // 完成之后销毁创建的a标签
384
+          document.body.removeChild(link);
385
+
386
+        })
387
+      },
388
+      // 导出excel
389
+      derive_click(){
390
+        let tableData = [ 
391
+          ['序号', '透析号', '患者姓名', '年龄','透析日期', '处方透析时长', '实际透析时长', '实际差(min)', '主治医生', '主治护士']//导出表头
392
+        ]
393
+        this.tableData.forEach((item,index) =>{
394
+          let rowdata=[]
395
+          rowdata=[
396
+            item.index,
397
+            item.dialysis_no,
398
+            item.patient_name,
399
+            item.age,
400
+            item.dialysis_date,
401
+            item.dialysis_duration,
402
+            item.actual_duration,
403
+            item.diff,
404
+            item.doctor,
405
+            item.nurse,
406
+          ]
407
+          tableData.push(rowdata)
408
+        })
409
+        let workSheet = XLSX.utils.aoa_to_sheet(tableData);
410
+        let bookNew = XLSX.utils.book_new();
411
+        XLSX.utils.book_append_sheet(bookNew, workSheet, '透析治疗完成率') // 工作簿名称
412
+        let name = '透析治疗完成率'+ '.xlsx'
413
+        XLSX.writeFile(bookNew, name) // 保存的文件名
414
+      },
415
+      // 详情数据源
416
+      getdetail(mode){
417
+        const params ={
418
+          start_date:this.start_date,
419
+          end_date:this.end_date,
420
+          mode:mode||this.status_value,
421
+          page:this.currentPage,
422
+          limit:this.limit,
423
+        }
424
+        Getdialysistreatdetail(params).then(response =>{
425
+          if(response.data.state){
426
+            const list = response.data.data.list
427
+            const xAxis = []
428
+            const table = []
429
+            list.forEach((item,index) =>{ 
430
+              const obj={
431
+                index:index+1,
432
+                dialysis_no:item.dialysis_no,     
433
+                patient_name:item.patient_name,
434
+                age:this.analyzeIDCard(item.id_card_no),
435
+                dialysis_date:item.dialysis_date.split('T')[0],
436
+                dialysis_duration:item.dialysis_duration,
437
+                actual_duration:item.actual_duration,
438
+                diff:item.diff,
439
+                doctor:this.getdoctor(item.doctor), 
440
+                nurse:this.getnurse(item.nurse)
441
+              }
442
+              table.push(obj)
443
+            })
444
+            this.tableData = table
445
+            this.total = response.data.data.total
446
+          }
447
+          console.log('55555',response);
448
+        })
449
+      },
450
+      // 选择日期
451
+      datachange(eve){
452
+        if(eve ==1){
453
+          this.start_date = this.getPreviousDate(7)
454
+          this.end_date = this.getTime(new Date())
455
+        }else if(eve==2){
456
+          this.start_date = this.getFirstDayOfWeek(new Date())
457
+          this.end_date = this.getTime(new Date())
458
+          console.log('this.start_date', this.start_date);
459
+        }else if(eve ==3){
460
+          var date=new Date()
461
+          date.setDate(date.getDate()-7 - date.getDay() + 1);
462
+          var m =''
463
+          var d = ''
464
+          if(date.getMonth() + 1<10){
465
+            m = '0'+(date.getMonth() + 1)
466
+          }else{
467
+             m = date.getMonth() + 1
468
+          }
469
+          if(date.getDate()<10){
470
+             d = '0'+date.getDate()
471
+          }else{
472
+            d = date.getDate()
473
+          }
474
+          // this.start_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() ;
475
+          this.start_date = date.getFullYear() + "-" + m + "-" + d ;
476
+          date.setDate(date.getDate() +6);
477
+          var mm = ''
478
+          var dd = ''
479
+          if(date.getMonth() + 1<10){
480
+            mm = '0'+(date.getMonth() + 1)
481
+          }else{
482
+            mm = date.getMonth() + 1
483
+          }
484
+          if(date.getDate()<10){
485
+            dd = '0'+date.getDate()
486
+          }else{
487
+            dd = date.getDate()
488
+          }
489
+          // if(date.getMonth() + 1<10)
490
+          // this.end_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
491
+          this.end_date = date.getFullYear() + "-" + mm + "-" + dd ;
492
+          console.log('this.end_date',this.end_date);
493
+          
494
+        }else if(eve ==4){
495
+          this.start_date = this.getFirstDayOfMonth(new Date())
496
+          this.end_date = this.getTime(new Date())
497
+        }else if(eve ==5){
498
+          this.gettopMonth()
499
+        }else if(eve == 6){
500
+          this.start_date = this.getFirstDayOfYear(new Date())
501
+          this.end_date = this.getTime(new Date())
502
+        }else if(eve == 7){
503
+          this.getLastYearFirstDay()
504
+          this.getLastYearLastDay()
505
+        }
506
+        console.log('eve',eve);
507
+      },
508
+      // 首先定义一个getPreviousDate函数,方便调用
509
+      getPreviousDate(numOfDays) {
510
+        var date = new Date();
511
+        date.setDate(date.getDate() - numOfDays);
512
+        var year = date.getFullYear();
513
+        if(date.getMonth() + 1<10){
514
+          var month = '0'+(date.getMonth() + 1);
515
+        }else{
516
+          var month = date.getMonth() + 1;
517
+        }
518
+
519
+        if(date.getDate()<10){
520
+          var day = '0'+date.getDate();
521
+        }else{
522
+          var day = date.getDate();
523
+        }
524
+        return year + "-" + month + "-" + day;
525
+      },
526
+      // 本周
527
+      getFirstDayOfWeek(date){
528
+        var weekday = date.getDay() 
529
+        date.setDate(date.getDate()-weekday+1);//往前算(weekday-1)天,年份、月份会自动变化
530
+        return this.timeFormat(date);
531
+      },
532
+      // 本月
533
+      getFirstDayOfMonth (date) {
534
+        date.setDate(1);
535
+        return this.timeFormat(date);
536
+      },
537
+      // 上个月
538
+      gettopMonth(){
539
+        var currentDate = new Date();
540
+        var month=currentDate.getMonth()+(-1);
541
+        if(month<0){
542
+          var n = parseInt((-month)/12);
543
+          month += n*12;
544
+          currentDate.setFullYear(currentDate.getFullYear()-n);
545
+        }
546
+        currentDate = new Date(currentDate.setMonth(month));
547
+        //获得当前月份0-11  
548
+        var currentMonth = currentDate.getMonth(); 
549
+        //获得当前年份4位年  
550
+        var currentYear = currentDate.getFullYear(); 
551
+        //获得上一个月的第一天  
552
+        this.start_date = this.getTime(new Date(currentYear, currentMonth-1,1)); 
553
+        //获得上一月的最后一天  
554
+        this.end_date = this.getTime(new Date(currentYear, currentMonth, 0));
555
+       console.log('11111',this.getTime(new Date(currentYear, currentMonth-1,1)));
556
+       console.log('22222',this.getTime(new Date(currentYear, currentMonth, 0)));
557
+      },
558
+      // 本年
559
+      getFirstDayOfYear (date) {
560
+        date.setDate(1);
561
+        date.setMonth(0);
562
+        return this.timeFormat(date);
563
+      },
564
+      // 上一年第一天
565
+      getLastYearFirstDay() {  
566
+          let date = new Date();  
567
+         const year= date.setFullYear(date.getFullYear() - 1); // 设置年份为前一年  
568
+         const start_month= date.setMonth(0); // 设置月份为1月(注意月份是从0开始的)  
569
+         const start_day = date.setDate(1); // 设置日期为1日
570
+        //  const last_month = date.setMonth(11); // 设置月份为12月  
571
+        //  const last_day = date.setDate(0); // 设置日期为0,这将自动设置为该月的最后一天  
572
+        //  this.start_date = year+ "-" +start_month+ "-" +start_day
573
+         this.start_date = this.getTime(start_day)
574
+        //  return this.start_date
575
+      }, 
576
+      // 上一年最后一天
577
+      getLastYearLastDay() {  
578
+          let date = new Date();  
579
+          const year= date.setFullYear(date.getFullYear() - 1); // 设置年份为前一年  
580
+          const last_month = date.setMonth(12); // 设置月份为12月  
581
+          const last_day = date.setDate(0);// 设置日期为0,这将自动设置为该月的最后一天  
582
+          // this.end_date =  year+ "-" +last_month+ "-" +last_day
583
+          this.end_date = this.getTime(last_day)
584
+          console.log('this.end_date',this.end_date);
585
+          // return this.end_date;  
586
+      }, 
587
+      // 日期格式化
588
+      timeFormat(date) {
589
+          if (!date || typeof(date) === "string") {
590
+            this.error("参数异常,请检查...");
591
+          }
592
+          var y = date.getFullYear(); //年
593
+          if(date.getMonth() + 1<10){
594
+            var m ='0'+(date.getMonth() + 1); //月
595
+          }else{
596
+            var m =date.getMonth() + 1; //月
597
+          }
598
+          if(date.getDate() + 1<10){
599
+            var d ='0'+date.getDate(); //日
600
+          }else{
601
+            var d = date.getDate(); //日
602
+          }
603
+          // var d = date.getDate(); //日
604
+
605
+          return y + "-" + m + "-" + d;
606
+      },
607
+      handleCurrentChange(val){
608
+        this.currentPage = val
609
+        this.getdetail()
610
+      },
611
+      handleSizeChange(val){
612
+        this.limit = val
613
+        this.getdetail()
614
+      },
615
+       // 转换时间
616
+      getTime(val) {
617
+        if(val < 0){
618
+          return ""
619
+        }
620
+        if(val == ""){
621
+          return ""
622
+        }else {
623
+          return uParseTime(val, '{y}-{m}-{d}')
624
+        }
625
+      },
626
+      dataURLtoBlob(dataURL) {
627
+        const arr = dataURL.split(',');
628
+        const mime = arr[0].match(/:(.*?);/)[1];
629
+        const bstr = atob(arr[1]);
630
+        let n = bstr.length;
631
+        const u8arr = new Uint8Array(n);
632
+        while (n--) {
633
+          u8arr[n] = bstr.charCodeAt(n);
634
+        }
635
+        return new Blob([u8arr], { type: mime });
636
+      },
637
+      // 计算年龄
638
+      analyzeIDCard(IDCard){
639
+        var age = 0,yearBirth,monthBirth,dayBirth;
640
+        //获取用户身份证号码
641
+        var userCard = IDCard;
642
+        //如果身份证号码为undefind则返回空
643
+        if(!userCard){
644
+          return age;
645
+        }
646
+        var reg = /(^\d{15}$)|(^\d{17}([0-9]|X)$)/; //验证身份证号码的正则
647
+        if (reg.test(userCard)) {
648
+          if (userCard.length == 15) {
649
+              var org_birthday = userCard.substring(6, 12);
650
+              //获取出生年月日
651
+              yearBirth = "19" + org_birthday.substring(0, 2);
652
+              monthBirth = org_birthday.substring(2, 4);
653
+              dayBirth = org_birthday.substring(4, 6);
654
+              } else if (userCard.length == 18) {
655
+              //获取出生年月日
656
+              yearBirth = userCard.substring(6,10);
657
+              monthBirth = userCard.substring(10,12);
658
+              dayBirth = userCard.substring(12,14);
659
+              
660
+            }
661
+            //获取当前年月日并计算年龄
662
+            var myDate = new Date();
663
+            var monthNow = myDate.getMonth() + 1;
664
+            var dayNow = myDate.getDate();
665
+            var age = myDate.getFullYear() - yearBirth;
666
+            if(monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)){
667
+              age--;
668
+            }
669
+            //返回年龄
670
+            return age;
671
+        } else {
672
+          return ''
673
+        }
674
+        
675
+      },
676
+      // 护士
677
+      getAllNurseList(){
678
+        getAllNurseList().then(response=>{
679
+           if(response.data.state ==1){
680
+             var nurseList  = response.data.data.nurseList
681
+            console.log('0000',nurseList);
682
+             this.nurseList =nurseList
683
+           }
684
+        })
685
+      },
686
+      // 医生
687
+      getAllDoctorList(){
688
+        getAllDoctorList().then(response=>{
689
+          if(response.data.state == 1){
690
+              var list = response.data.data.list
691
+              console.log("list222222",list)
692
+              this.docList = list
693
+              this.operators = response.data.data.operators
694
+          }
695
+        })  
696
+      },
697
+      getnurse(ids){
698
+        const nurse = this.nurseList
699
+        for(let i in nurse){
700
+          if(ids==nurse[i].admin_user_id){
701
+            return nurse[i].user_name
702
+          }
703
+        }
704
+      },
705
+      getdoctor(ids){
706
+        const doctor = this.docList
707
+        for(let i in doctor){
708
+          if(ids == doctor[i].admin_user_id){
709
+            return doctor[i].user_name
710
+          }
711
+        }
712
+      }
713
+    },
714
+    mounted(){
715
+      this.getecharts()
716
+    },
717
+    created(){
718
+      this.start_date = this.getFirstDayOfMonth(new Date())
719
+      this.getAllNurseList()
720
+      this.getAllDoctorList()
721
+    },
722
+
723
+  }
724
+</script>

+ 656 - 0
src/xt_pages/Dialysisanalysis/new_otherIndicators/components/dialyzer.vue Целия файл

@@ -0,0 +1,656 @@
1
+<template>
2
+  <div class="main-contain">
3
+    <div class="position">
4
+      <div>
5
+        <span>
6
+          <el-button @click="return_click" type="text" icon="el-icon-arrow-left">返回</el-button> 
7
+        </span>&nbsp;&nbsp;
8
+        <span>透析器使用统计</span>
9
+      </div>
10
+    </div>
11
+    <div class="app-container">
12
+      <div class="page_patientControlAnalysis">
13
+        <div style="display: flex;">
14
+          <div>
15
+            日期:
16
+            <el-select v-model="date_value" @change="datachange" placeholder="请选择" style="width: 100px;">
17
+              <el-option
18
+                v-for="item in date_options"
19
+                :key="item.value"
20
+                :label="item.label"
21
+                :value="item.value">
22
+              </el-option>
23
+            </el-select>
24
+          </div>
25
+          <div style="margin: 0 10px;">
26
+            <el-date-picker
27
+              v-model="start_date"
28
+              type="date"
29
+              value-format="yyyy-MM-dd"
30
+              placeholder="选择日期"
31
+              style="width: 150px;">
32
+            </el-date-picker>
33
+            <span>-</span>
34
+            <el-date-picker
35
+              v-model="end_date"
36
+              type="date"
37
+              value-format="yyyy-MM-dd"
38
+              placeholder="选择日期"
39
+              style="width: 150px;">
40
+            </el-date-picker>
41
+          </div>
42
+          <!-- <div>
43
+            透析模式:
44
+            <el-select v-model="mode" placeholder="请选择" style="width: 120px;">
45
+              <el-option
46
+                v-for="item in mode_options"
47
+                :key="item.id"
48
+                :label="item.name"
49
+                :value="item.id">
50
+              </el-option>
51
+            </el-select>
52
+
53
+            <el-select v-model="date_mode" placeholder="请选择" style="width: 120px;">
54
+              <el-option
55
+                v-for="item in date_mode_options"
56
+                :key="item.value"
57
+                :label="item.label"
58
+                :value="item.value">
59
+              </el-option>
60
+            </el-select>
61
+
62
+          </div>
63
+
64
+          <div>
65
+            数据来源:
66
+            <el-select v-model="source" placeholder="请选择" style="width: 100px;">
67
+              <el-option
68
+                v-for="item in source_options"
69
+                :key="item.value"
70
+                :label="item.label"
71
+                :value="item.value">
72
+              </el-option>
73
+            </el-select>
74
+          </div> -->
75
+
76
+          <div>
77
+            <el-button type="primary" @click="sete_click">查询</el-button>
78
+            <el-button type="primary" @click="Download_click">下载</el-button>
79
+          </div>
80
+        </div>
81
+        <!-- 图表 -->
82
+        <div ref="mychart">
83
+          <div class="echart" id="mychart"  style="width:100%;height:60vh"></div>
84
+        </div>
85
+        
86
+        <div style="position: fixed;right: 5%;top: 50vh;">
87
+          <el-popover
88
+            placement="left"
89
+            title="提示"
90
+            width="500"
91
+            trigger="click"
92
+            content="1.统计时间段内,所有患者的抗凝剂使用情况,低分子肝素 x 例次,普通肝素 x 例次、无肝素 x 例次。
93
+                      2.一个患者多次使用低分子肝素时,算多个例次,其他图例同理。">
94
+            <img src="@/assets/img/xiang.png" alt="" style="height: 20px;width: 20px;" slot="reference">
95
+            <!-- <el-button slot="reference">click 激活</el-button> -->
96
+          </el-popover>
97
+        </div>
98
+      </div>
99
+    </div>
100
+
101
+    <!-- 弹窗 -->
102
+    <div>
103
+      <el-dialog
104
+        title="详情"
105
+        :visible.sync="dialyze_dialog"
106
+        width="80%">
107
+        <div>
108
+          <div style="display: flex;margin-bottom: 20px;">
109
+            <div style="flex: 2;display: flex;">
110
+              <div>
111
+                日期:
112
+                <el-select v-model="date_value" @change="datachange" placeholder="请选择" style="width: 100px;">
113
+                  <el-option
114
+                    v-for="item in date_options"
115
+                    :key="item.value"
116
+                    :label="item.label"
117
+                    :value="item.value">
118
+                  </el-option>
119
+                </el-select>
120
+              </div>
121
+              <div style="margin:0 10px;">
122
+                <el-date-picker
123
+                  v-model="start_date"
124
+                  type="date"
125
+                  value-format="yyyy-MM-dd"
126
+                  placeholder="选择日期"
127
+                  style="width: 150px;">
128
+                </el-date-picker>
129
+                <span>-</span>
130
+                <el-date-picker
131
+                  v-model="end_date"
132
+                  type="date"
133
+                  value-format="yyyy-MM-dd"
134
+                  placeholder="选择日期"
135
+                  style="width: 150px;">
136
+                </el-date-picker>
137
+              </div>
138
+
139
+              <div>
140
+                透析器:
141
+                <el-select v-model="dialyze_value" placeholder="请选择" style="width: 100px;">
142
+                  <el-option :key="0" label="不限" :value="0"></el-option>
143
+                  <el-option
144
+                    v-for="item in dialyze_options"
145
+                    :key="item.id"
146
+                    :label="item.name"
147
+                    :value="item.id">
148
+                  </el-option>
149
+                </el-select>
150
+              </div>
151
+            </div>
152
+            <div style="flex: 1;">
153
+              <div>
154
+                <el-button type="primary" @click="deil_click">查询</el-button>
155
+                <el-button type="primary" @click="exportExcel">导出</el-button>
156
+              </div>
157
+            </div>
158
+          </div>
159
+
160
+          <el-table :data="tableData" border style="width: 100%"
161
+          :header-cell-style="{textAlign: 'center'}"
162
+          :cell-style="{ textAlign: 'center' }"
163
+          height="380">
164
+            <el-table-column
165
+              prop="index"
166
+              label="序号"
167
+              width="">
168
+            </el-table-column>
169
+            <el-table-column
170
+              prop="dialysis_no"
171
+              label="透析号"
172
+              width="">
173
+            </el-table-column>
174
+            <el-table-column
175
+              prop="name"
176
+              label="患者姓名">
177
+            </el-table-column>
178
+            <el-table-column
179
+              prop="date"
180
+              label="透析日期"
181
+              width="">
182
+            </el-table-column>
183
+            <el-table-column
184
+              prop="mode_name"
185
+              label="透析模式"
186
+              width="">
187
+            </el-table-column>
188
+            <el-table-column
189
+              prop="dialyszers"
190
+              label="透析器">
191
+            </el-table-column>
192
+          </el-table>
193
+          <div style="text-align: right;margin-top: 10px;">
194
+            <el-pagination
195
+              @size-change="handleSizeChange"
196
+              @current-change="handleCurrentChange"
197
+              :current-page="currentPage"
198
+              :page-sizes="[50,100, 200, 300, 400]"
199
+              :page-size="limit"
200
+              layout="total, sizes, prev, pager, next, jumper"
201
+              :total="total">
202
+            </el-pagination>
203
+          </div>
204
+          
205
+        </div>
206
+        <span slot="footer" class="dialog-footer">
207
+          <el-button @click="dialyze_dialog = false">取 消</el-button>
208
+          <el-button type="primary" @click="dialyze_dialog = false">确 定</el-button>
209
+        </span>
210
+      </el-dialog>
211
+    </div>
212
+  </div>
213
+</template>
214
+<script>
215
+import * as echarts from 'echarts';
216
+import XLSX from 'xlsx';
217
+import { uParseTime } from "@/utils/tools";
218
+import {Getdialyzer,Getdialyzerdetail,Getdialyzerconfig} from '../../../../api/qcd'
219
+import { forEach } from 'jszip';
220
+import html2canvas from "html2canvas"
221
+  export default {
222
+    components:{
223
+    },
224
+    data(){
225
+      return{
226
+        date_value:4,
227
+        start_date:'',
228
+        end_date:this.getTime(new Date()),
229
+        mode:'',
230
+        date_mode:'',
231
+        source:'',
232
+        dialyze_value:0,
233
+        dialyze_dialog:false,
234
+        currentPage:1,
235
+        limit:50,
236
+        total:0,
237
+        tableData:[],
238
+        dialyze_options:[],
239
+        date_options:[{value:1,label:'最近七天'},{value:2,label:'本周'},{value:3,label:'上周'},{value:4,label:'本月'},
240
+                      {value:5,label:'上月'},{value:6,label:'本年'},{value:7,label:'上一年'}
241
+        ],
242
+        modearr:[{ id: 1, name: 'HD' },{ id: 2, name: 'HDF' },{ id: 3, name: 'HD + HP' },{ id: 4, name: 'HP' },
243
+          { id: 5, name: 'HF' },{ id: 6, name: 'SCUF' },{ id: 7, name: 'IUF' },{ id: 8, name: 'HFHD' },{ id: 9, name: 'HFHD+HP' },
244
+          { id: 10, name: 'PHF' },{ id: 11, name: 'HFR' },{ id: 12, name: 'HDF+HP' },{ id: 13, name: 'CRRT' },{ id: 14, name: '腹水回输' },
245
+          { id:19, name:"IUF+HD"},{ id:20, name:"UF"},{ id:21, name:"HD+"},{ id:22, name:"血浆胆红素吸附+HDF"},{ id:23, name:"血浆胆红素吸附"},
246
+          { id:24, name:"I-HDF"},{ id:25, name:"HD高通"},{ id:26, name:"CVVH"},{ id:27, name:"CVVHD"},{ id:28, name:"CVVHDF"},{ id:29, name:"PE"},
247
+          { id:30, name:"血浆胆红素吸附+HP"},{ id:31, name:"HPD"},{ id:32, name:"HDP"},{ id:33, name:"HFD"},{ id:34, name:"HDF100"},
248
+          { id:35, name:"HDF600"},{ id:36, name:"HDF800"},{ id:37, name:"HDF1000"},
249
+        ],
250
+        date_mode_options:[{value:1,label:'按周'},{value:2,label:'按天'},{value:3,label:'按月'},{value:4,label:'按年'}],
251
+        source_options:[{value:1,label:'以开始透析为准'},{value:2,label:'以排班为准'}],
252
+        bar_xAxis:['HD','HDF','HD + HP','HP','HF','SCUF','IUF'],
253
+ 
254
+      }
255
+    },
256
+    methods:{
257
+      // 返回
258
+      return_click(){
259
+        this.$router.push('/Dialysisanalysis/qualitycontrol/new_otherIndicators')
260
+      },
261
+      // 数据源
262
+      getecharts(){
263
+        var chartDom = document.getElementById('mychart')
264
+        var myChart = echarts.init(chartDom);
265
+        const params ={
266
+          start_date:this.start_date,
267
+          end_date:this.end_date,
268
+        }
269
+        Getdialyzer(params).then(response =>{
270
+          if(response.data.state ==1){
271
+            const list = response.data.data.data
272
+            const xAxis =[]
273
+            const yAxis = []
274
+            list.forEach(item =>{
275
+              xAxis.push(item.name)
276
+              yAxis.push(item.count)
277
+            })
278
+            this.bar_xAxis = xAxis
279
+            const options = []
280
+            for(let i in xAxis){
281
+              const arr ={
282
+                id:i+1,
283
+                name:xAxis[i]
284
+              }
285
+              options.push(arr)
286
+            }
287
+            this.dialyze_options = options
288
+            const option = {
289
+              xAxis: {
290
+                type: 'category',
291
+                data: xAxis,
292
+              },
293
+              yAxis: {
294
+                type: 'value'
295
+              },
296
+              series: [
297
+                {
298
+                  data:yAxis ,
299
+                  type: 'bar',
300
+                  barWidth: '25%',
301
+                  label: {
302
+                    normal: {
303
+                      show: true,
304
+                      position: 'top',
305
+                      formatter: '{c}',
306
+                      textStyle:{
307
+                        color: 'black',//字体颜色
308
+                        fontSize: 13//字体大小
309
+                      }
310
+                    },
311
+                  },
312
+                  itemStyle:{
313
+                    normal:{
314
+                      color:function (params){
315
+                        // const colorarr=['#FFA333','#A155E8','#6D91FF','#A233A2'];
316
+                        var colorarr = [["#A9E0F3", "#9FBDFC"],["#FFD7C0", "#FF9994"]]
317
+                        var index = params.dataIndex;
318
+                        if (params.dataIndex >= colorarr.length) {
319
+                          index = params.dataIndex % colorarr.length;
320
+                        }
321
+                        return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
322
+                          { offset: 0, color: colorarr[index][0] },
323
+                          // { offset: 0.5, color: colorList[index][1] },
324
+                          { offset: 1, color: colorarr[index][1] }
325
+                        ]);
326
+                      }
327
+                    }
328
+                  }
329
+                }
330
+              ]
331
+            }
332
+            myChart.setOption(option);
333
+            myChart.on('click',params =>{
334
+              this.dialyze_dialog = true
335
+              console.log('vvvvv',params);
336
+              this.Getdialyzerdetail(params.name)
337
+            })
338
+          }
339
+          console.log('ressponse',response.data.data);
340
+        })
341
+       
342
+      },
343
+      // 导出excel
344
+      exportExcel(){
345
+        let tableData = [ 
346
+          ['序号', '透析号', '患者姓名', '透析日期','透析模式', '透析器']//导出表头
347
+        ]
348
+        this.tableData.forEach((item,index) =>{
349
+          let rowdata=[]
350
+          rowdata=[
351
+            item.index,
352
+            item.dialysis_no,
353
+            item.name,
354
+            item.date,
355
+            item.mode_name,
356
+            item.dialyszers,
357
+          ]
358
+          tableData.push(rowdata)
359
+        })
360
+        let workSheet = XLSX.utils.aoa_to_sheet(tableData);
361
+        let bookNew = XLSX.utils.book_new();
362
+        XLSX.utils.book_append_sheet(bookNew, workSheet, '透析器使用统计') // 工作簿名称
363
+        let name = '透析器使用统计'+ '.xlsx'
364
+        XLSX.writeFile(bookNew, name) // 保存的文件名
365
+      },
366
+      // 查询
367
+      sete_click(){
368
+        this.getecharts()
369
+      },
370
+      // 详情查询
371
+      deil_click(){
372
+        this.Getdialyzerdetail()
373
+      },
374
+       // 下载 
375
+      Download_click(){
376
+        const options ={
377
+          allowTaint: true,
378
+          useCORS: true
379
+        }
380
+        html2canvas(this.$refs.mychart,options).then(canvas =>{
381
+          // const imageSrc = canvas.toDataURL();
382
+          const imageUrl = canvas.toDataURL("image/png");
383
+          // console.log('5555',imageUrl);
384
+        //   // const base = this.url.split(',')[1]
385
+        //   // console.log('2222',base);
386
+          const blob = this.dataURLtoBlob(imageUrl)
387
+          // console.log('4444',blob);
388
+          const url = URL.createObjectURL(blob);
389
+          // const file = (this.url).blob();
390
+          // console.log('1111',url);
391
+          var link= document.createElement("a");
392
+        //   //将生成的图片url赋值给a标签的href属性
393
+          link.href = url; 
394
+        //   //设置下载的文件名
395
+          link.download = "透析器使用统计.jpg";
396
+          // // 将a标签插入dom中
397
+          console.log('link',link);
398
+          document.body.appendChild(link);
399
+          //模拟点击事件触发下载
400
+          link.click();
401
+          // 完成之后销毁创建的a标签
402
+          document.body.removeChild(link);
403
+
404
+        })
405
+      },
406
+      // 选择日期
407
+      datachange(eve){
408
+        if(eve ==1){
409
+          this.start_date = this.getPreviousDate(7)
410
+          this.end_date = this.getTime(new Date())
411
+        }else if(eve==2){
412
+          this.start_date = this.getFirstDayOfWeek(new Date())
413
+          this.end_date = this.getTime(new Date())
414
+          console.log('this.start_date', this.start_date);
415
+        }else if(eve ==3){
416
+          var date=new Date()
417
+          date.setDate(date.getDate()-7 - date.getDay() + 1);
418
+          var m =''
419
+          var d = ''
420
+          if(date.getMonth() + 1<10){
421
+            m = '0'+(date.getMonth() + 1)
422
+          }else{
423
+             m = date.getMonth() + 1
424
+          }
425
+          if(date.getDate()<10){
426
+             d = '0'+date.getDate()
427
+          }else{
428
+            d = date.getDate()
429
+          }
430
+          // this.start_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() ;
431
+          this.start_date = date.getFullYear() + "-" + m + "-" + d ;
432
+          date.setDate(date.getDate() +6);
433
+          var mm = ''
434
+          var dd = ''
435
+          if(date.getMonth() + 1<10){
436
+            mm = '0'+(date.getMonth() + 1)
437
+          }else{
438
+            mm = date.getMonth() + 1
439
+          }
440
+          if(date.getDate()<10){
441
+            dd = '0'+date.getDate()
442
+          }else{
443
+            dd = date.getDate()
444
+          }
445
+          // if(date.getMonth() + 1<10)
446
+          // this.end_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
447
+          this.end_date = date.getFullYear() + "-" + mm + "-" + dd ;
448
+          console.log('this.end_date',this.end_date);
449
+          
450
+        }else if(eve ==4){
451
+          this.start_date = this.getFirstDayOfMonth(new Date())
452
+          this.end_date = this.getTime(new Date())
453
+        }else if(eve ==5){
454
+          this.gettopMonth()
455
+        }else if(eve == 6){
456
+          this.start_date = this.getFirstDayOfYear(new Date())
457
+          this.end_date = this.getTime(new Date())
458
+        }else if(eve == 7){
459
+          this.getLastYearFirstDay()
460
+          this.getLastYearLastDay()
461
+        }
462
+        console.log('eve',eve);
463
+      },
464
+      // 详情数据源
465
+      Getdialyzerdetail(name){
466
+        const params={
467
+          dialyzer:name||this.getdialyze(this.dialyze_value),
468
+          start_date:this.start_date,
469
+          end_date:this.end_date,
470
+          page:this.currentPage,
471
+          limit:this.limit,
472
+        }
473
+        Getdialyzerdetail(params).then(response =>{
474
+          if(response.data.state == 1){
475
+            const list = response.data.data.prescriptions
476
+            const table=[]
477
+            list.forEach((item,index)=>{
478
+              const obj ={
479
+                index:index+1,
480
+                dialysis_no:item.patient.dialysis_no,
481
+                name:item.patient.name,
482
+                date:this.getTime(item.record_date),
483
+                mode_name:this.getmode(item.mode_id),
484
+                dialyszers:item.dialysis_dialyszers
485
+              }
486
+              table.push(obj)
487
+            })
488
+            this.tableData = table
489
+            this.total = response.data.data.total
490
+          }
491
+          console.log('77777',response);
492
+        })
493
+      },
494
+       // 首先定义一个getPreviousDate函数,方便调用
495
+      getPreviousDate(numOfDays) {
496
+        var date = new Date();
497
+        date.setDate(date.getDate() - numOfDays);
498
+        var year = date.getFullYear();
499
+        if(date.getMonth() + 1<10){
500
+          var month = '0'+(date.getMonth() + 1);
501
+        }else{
502
+          var month = date.getMonth() + 1;
503
+        }
504
+
505
+        if(date.getDate()<10){
506
+          var day = '0'+date.getDate();
507
+        }else{
508
+          var day = date.getDate();
509
+        }
510
+        return year + "-" + month + "-" + day;
511
+      },
512
+      // 本周
513
+      getFirstDayOfWeek(date){
514
+        var weekday = date.getDay() 
515
+        date.setDate(date.getDate()-weekday+1);//往前算(weekday-1)天,年份、月份会自动变化
516
+        return this.timeFormat(date);
517
+      },
518
+      // 本月
519
+      getFirstDayOfMonth (date) {
520
+        date.setDate(1);
521
+        return this.timeFormat(date);
522
+      },
523
+      // 上个月
524
+      gettopMonth(){
525
+        var currentDate = new Date();
526
+        var month=currentDate.getMonth()+(-1);
527
+        if(month<0){
528
+          var n = parseInt((-month)/12);
529
+          month += n*12;
530
+          currentDate.setFullYear(currentDate.getFullYear()-n);
531
+        }
532
+        currentDate = new Date(currentDate.setMonth(month));
533
+        //获得当前月份0-11  
534
+        var currentMonth = currentDate.getMonth(); 
535
+        //获得当前年份4位年  
536
+        var currentYear = currentDate.getFullYear(); 
537
+        //获得上一个月的第一天  
538
+        this.start_date = this.getTime(new Date(currentYear, currentMonth-1,1)); 
539
+        //获得上一月的最后一天  
540
+        this.end_date = this.getTime(new Date(currentYear, currentMonth, 0));
541
+       console.log('11111',this.start_date);
542
+       console.log('22222',this.end_date);
543
+      },
544
+      // 本年
545
+      getFirstDayOfYear (date) {
546
+        date.setDate(1);
547
+        date.setMonth(0);
548
+        return this.timeFormat(date);
549
+      },
550
+      // 上一年第一天
551
+      getLastYearFirstDay() {  
552
+          let date = new Date();  
553
+         const year= date.setFullYear(date.getFullYear() - 1); // 设置年份为前一年  
554
+         const start_month= date.setMonth(0); // 设置月份为1月(注意月份是从0开始的)  
555
+         const start_day = date.setDate(1); // 设置日期为1日
556
+        //  const last_month = date.setMonth(11); // 设置月份为12月  
557
+        //  const last_day = date.setDate(0); // 设置日期为0,这将自动设置为该月的最后一天  
558
+        //  this.start_date = year+ "-" +start_month+ "-" +start_day
559
+         this.start_date = this.getTime(start_day)
560
+        //  return this.start_date
561
+      }, 
562
+      // 上一年最后一天
563
+      getLastYearLastDay() {  
564
+          let date = new Date();  
565
+          const year= date.setFullYear(date.getFullYear() - 1); // 设置年份为前一年  
566
+          const last_month = date.setMonth(12); // 设置月份为12月  
567
+          const last_day = date.setDate(0);// 设置日期为0,这将自动设置为该月的最后一天  
568
+          // this.end_date =  year+ "-" +last_month+ "-" +last_day
569
+          this.end_date = this.getTime(last_day)
570
+          console.log('this.end_date',this.end_date);
571
+          // return this.end_date;  
572
+      }, 
573
+      // 日期格式化
574
+      timeFormat(date) {
575
+          if (!date || typeof(date) === "string") {
576
+            this.error("参数异常,请检查...");
577
+          }
578
+          var y = date.getFullYear(); //年
579
+          if(date.getMonth() + 1<10){
580
+            var m ='0'+(date.getMonth() + 1); //月
581
+          }else{
582
+            var m =date.getMonth() + 1; //月
583
+          }
584
+          if(date.getDate() + 1<10){
585
+            var d ='0'+date.getDate(); //日
586
+          }else{
587
+            var d = date.getDate(); //日
588
+          }
589
+          // var d = date.getDate(); //日
590
+
591
+          return y + "-" + m + "-" + d;
592
+      },
593
+      handleCurrentChange(val){
594
+        this.currentPage = val
595
+        this.Getdialyzerdetail()
596
+      },
597
+      handleSizeChange(val){
598
+        this.limit = val
599
+        this.Getdialyzerdetail()
600
+      },
601
+      // 透析模式
602
+      getmode(ids){
603
+        const modes=this.modearr
604
+        for(let i in modes){
605
+          if(ids == modes[i].id){
606
+            return modes[i].name
607
+          }
608
+        }
609
+      },
610
+       // 转换时间
611
+      getTime(val) {
612
+        if(val < 0){
613
+          return ""
614
+        }
615
+        if(val == ""){
616
+          return ""
617
+        }else {
618
+          return uParseTime(val, '{y}-{m}-{d}')
619
+        }
620
+      },
621
+      dataURLtoBlob(dataURL) {
622
+        const arr = dataURL.split(',');
623
+        const mime = arr[0].match(/:(.*?);/)[1];
624
+        const bstr = atob(arr[1]);
625
+        let n = bstr.length;
626
+        const u8arr = new Uint8Array(n);
627
+        while (n--) {
628
+          u8arr[n] = bstr.charCodeAt(n);
629
+        }
630
+        return new Blob([u8arr], { type: mime });
631
+      },
632
+      // 全部透析器
633
+      Getdialyzerconfig(){
634
+        Getdialyzerconfig().then(response =>{
635
+          console.log('666666',response);
636
+        })
637
+      },
638
+      getdialyze(val){
639
+        const option = this.dialyze_options
640
+        for(let i in option){
641
+          if(val == option[i].id){
642
+            return option[i].name
643
+          }
644
+        }
645
+      }
646
+    },
647
+    mounted(){
648
+      this.getecharts()
649
+    },
650
+    created(){
651
+      this.start_date = this.getFirstDayOfMonth(new Date())
652
+      this.Getdialyzerconfig()
653
+    },
654
+
655
+  }
656
+</script>

+ 253 - 0
src/xt_pages/Dialysisanalysis/new_otherIndicators/index.vue Целия файл

@@ -0,0 +1,253 @@
1
+<!-- 其他指标 -->
2
+<template>
3
+  <div class="main-contain">
4
+    <div class="position">
5
+<!--        <bread-crumb :crumbs="crumbs"></bread-crumb>-->
6
+    </div>
7
+    <div class="app-container">
8
+      <div class="page_patientControlAnalysis">
9
+        <div class="photos">
10
+          <div v-for="(item,index) in indicators" :key="index"  @click="echart_click(item)"
11
+            style="width: 280px;height: 300px;border:1px solid gainsboro;border-radius: 8px;margin: 0 0 30px 28px"
12
+          >
13
+            <!-- <div v-if="" class="background date_type1" style="background-repeat: no-repeat;"></div>
14
+            <div v-if="item.check_type == 1" class="background date_type2" style="background-repeat: no-repeat;"></div>
15
+            <div v-if="item.check_type == 2" class="background date_type3" style="background-repeat: no-repeat;"></div>
16
+            <p class="title">{{item.item_name}}</p> -->
17
+            <div :class="[item.sub_check_type ==1 ? 'date_type1 background' : item.sub_check_type ==2 ?'date_type2 background':item.sub_check_type ==3 ?'date_type3 background':'']" style="background-repeat: no-repeat;"></div>
18
+            <!-- <div v-if="item.check_type == 1" class="background date_type2" style="background-repeat: no-repeat;"></div>
19
+            <div v-if="item.check_type == 2" class="background date_type3" style="background-repeat: no-repeat;"></div> -->
20
+            <!-- <div v-if="item.check_type == 1" class="background date_type1" style="background-repeat: no-repeat;"></div> -->
21
+            
22
+            <p class="title">{{item.item_name}}</p>
23
+           
24
+          </div>
25
+        </div>
26
+      </div>
27
+    </div>
28
+  </div>
29
+</template>
30
+
31
+<script>
32
+import BreadCrumb from '@/xt_pages/components/bread-crumb'
33
+import { getStatisticsList } from '../../../api/statistics'
34
+export default {
35
+  name:'index',
36
+  components: {
37
+      BreadCrumb,
38
+  },
39
+  data() {
40
+      return {
41
+        indicators:[],
42
+          activeName: 'first'
43
+      }
44
+  },
45
+  methods:{
46
+    getStatisticsList(){
47
+      let params = {
48
+      }
49
+      this.indicators = []
50
+      getStatisticsList(params).then(response => {
51
+        if (response.data.state == 1) {
52
+          this.indicators  =  this.indicators.concat(response.data.data.configurationlist)
53
+          console.log('444444444',this.indicators);
54
+          for(let i = 0; i < this.indicators.length; i++){
55
+            this.indicators[i]["check_type"] = 1
56
+            this.indicators[i]["sub_check_type"] = 1
57
+          }
58
+          let obj = {
59
+            "check_type":1,
60
+            "item_name":"透析总量分析",
61
+            "sub_check_type":1
62
+          }
63
+          this.indicators.push(obj)
64
+          let obj2 = {
65
+            "check_type":2,
66
+            "item_name":"透析总量详情",
67
+            "sub_check_type":3
68
+          }
69
+          this.indicators.push(obj2)
70
+          let obj3 = {
71
+            "check_type":3,
72
+            "item_name":"抗凝剂类型统计",
73
+            "sub_check_type":1
74
+          }
75
+          this.indicators.push(obj3)
76
+
77
+          let obj4 = {
78
+            "check_type":4,
79
+            "item_name":"透析器使用统计",
80
+            "sub_check_type":1
81
+
82
+          }
83
+          this.indicators.push(obj4)
84
+          let obj5 = {
85
+            "check_type":5,
86
+            "item_name":"透析治疗完成率",
87
+            "sub_check_type":2
88
+
89
+          }
90
+          this.indicators.push(obj5)
91
+
92
+
93
+          console.log( this.indicators)
94
+          // this.indicators.push("")
95
+        } else {
96
+          this.$message.error(response.data.msg)
97
+        }
98
+      })
99
+    },
100
+    echart_click(item){
101
+      if(item.check_type == 1){
102
+        this.$router.push('/Dialysisanalysis/qualitycontrol/new_otherIndicators/Total_analysis')
103
+      }else if(item.check_type == 2){
104
+        this.$router.push('/Dialysisanalysis/qualitycontrol/new_otherIndicators/Total_table')
105
+      }else if (item.check_type == 3){
106
+        this.$router.push('/Dialysisanalysis/qualitycontrol/new_otherIndicators/anticoagulant')
107
+      }else if (item.check_type == 4){
108
+        this.$router.push('/Dialysisanalysis/qualitycontrol/new_otherIndicators/dialyzer')
109
+      }
110
+      else if(item.check_type == 5){
111
+        this.$router.push('/Dialysisanalysis/qualitycontrol/new_otherIndicators/complete')
112
+      }
113
+      console.log('item',item);
114
+    }
115
+    // jump(project_id, item_id,project_type){
116
+    //   this.$router.push('/Dialysisanalysis/qualitycontrol/Indicatorsdetail?project_id='+project_id+"&item_id="+item_id+"&project_type="+parseInt(project_type))
117
+    // },
118
+    // handleClick(tab, event) {
119
+    //   console.log(tab, event);
120
+    // },
121
+    // echart_click(item){
122
+    //   // if(item.check_type == 1){
123
+    //   //   if(item.sub_check_type == 1){
124
+    //   //     this.$router.push('/Dialysisanalysis/qualitycontrol/Indicatorsdetail?project_id='+item.inspection_major+"&item_id="+item.inspection_minor+"&project_type="+parseInt(item.id))
125
+
126
+    //   //     // this.$router.push('/Dialysisanalysis/qualitycontrol/otherIndicators/components/columnarTotal')
127
+
128
+    //   //   }else if(item.sub_check_type == 2){
129
+    //   //     this.$router.push('/Dialysisanalysis/qualitycontrol/platelets')
130
+    //   //   }
131
+    //   // }else if(item.check_type == 2){
132
+    //   //   this.$router.push('/Dialysisanalysis/qualitycontrol/summary')
133
+    //   // }
134
+
135
+
136
+    // }
137
+  },
138
+  created(){
139
+  this.getStatisticsList()
140
+
141
+}
142
+}
143
+</script>
144
+
145
+<style lang="scss" scoped>
146
+
147
+.page_patientControlAnalysis{
148
+.background{
149
+  height: 180px;
150
+  width: 100%;
151
+  background-repeat:no-repeat;
152
+}
153
+.date_type1{
154
+  background: url('../../../assets/img/zhuzhuantu.png');
155
+}
156
+.date_type2{
157
+  background: url('../../../assets/img/bingzhuantua.png');
158
+}
159
+.date_type3{
160
+  background: url('../../../assets/img/biaoge.png');
161
+}
162
+
163
+.title{
164
+  font-size: 18px;
165
+  margin: 15px 10px;
166
+  color: #333333;
167
+  text-overflow: ellipsis;
168
+  overflow: hidden;
169
+  white-space: nowrap;
170
+}
171
+.tag {
172
+  margin-left: 10px;
173
+  height: 82px;
174
+  overflow: auto;
175
+}
176
+.use {
177
+  font-size: 14px;
178
+  color: #999;
179
+  margin-left: 10px;
180
+}
181
+// .shoucang{
182
+//   width: 20px;
183
+//   height: 20px;
184
+//   margin-right: 15px;
185
+//   float: right;
186
+//   background:url('../../../assets/img/xingixnghuise.png')
187
+// }
188
+.tags{
189
+  font-size: 14px;
190
+  font-family: Microsoft YaHei;
191
+  color: #477ac5;
192
+  background: #edf4ff;
193
+  margin-right: 3px;
194
+  margin-top: 3px;
195
+  padding: 1px 6px;
196
+  border-radius: 5px;
197
+}
198
+.photos{
199
+  display: flex;
200
+  justify-content: flex-start;
201
+  flex-wrap: wrap;
202
+}
203
+
204
+}
205
+// .page_patientControlAnalysis {
206
+
207
+// .pointTitle {
208
+//   font-size: 13px;
209
+// }
210
+
211
+// .chartTitle {
212
+//   font-size: 16px;
213
+//   font-weight: bold;
214
+//   color: #000000;
215
+// }
216
+
217
+// .point {
218
+//   width: 13px;
219
+//   height: 13px;
220
+//   background: linear-gradient(
221
+//       0deg,
222
+//       rgba(169, 224, 243, 1),
223
+//       rgba(159, 189, 252, 1)
224
+//   );
225
+//   border-radius: 7px;
226
+//   margin-right: 8px;
227
+// }
228
+
229
+// .pointTitle {
230
+//   font-size: 13px;
231
+// }
232
+
233
+// }
234
+
235
+</style>
236
+
237
+<style lang="scss">
238
+// .page_patientControlAnalysis {
239
+
240
+// .el-form-item {
241
+//   margin-bottom: 0;
242
+// }
243
+
244
+// .cell {
245
+//   text-align: center;
246
+// }
247
+
248
+// ::-webkit-scrollbar {
249
+//   height: 15px !important;
250
+// }
251
+
252
+// }
253
+</style>