Kaynağa Gözat

过程指标

zhengchengwu 6 yıl önce
ebeveyn
işleme
536016bc3c

+ 7 - 0
src/api/qcd.js Dosyayı Görüntüle

@@ -6,4 +6,11 @@ export function getdialysistotaldata(params){
6 6
         method:'get',
7 7
         params:params
8 8
     })
9
+}
10
+export function GetProcessIndicatorsData(params){
11
+    return request({
12
+        url:'/api/qcd/processindicatorsdata',
13
+        method:'get',
14
+        params:params
15
+    })
9 16
 }

+ 108 - 0
src/xt_pages/qcd/components/PieChart.vue Dosyayı Görüntüle

@@ -0,0 +1,108 @@
1
+<template>
2
+  <div :class="className" :style="{height:height,width:width}"></div>
3
+</template>
4
+
5
+<script>
6
+import echarts from 'echarts'
7
+require('echarts/theme/macarons') // echarts theme
8
+import { debounce } from '@/utils'
9
+
10
+export default {
11
+  props: {
12
+    className: {
13
+      type: String,
14
+      default: 'chart'
15
+    },
16
+    width: {
17
+      type: String,
18
+      default: '100%'
19
+    },
20
+    height: {
21
+      type: String,
22
+      default: '320px'
23
+    },
24
+    title:{
25
+      type: String,
26
+      default: 'chart'
27
+    },
28
+    options:{
29
+      type:Object,
30
+      default:function(){
31
+        return {}
32
+      }
33
+    }
34
+  },
35
+  data() {
36
+    return {
37
+      chart: null,
38
+      chartOptions:{},
39
+    }
40
+  },
41
+  mounted() {
42
+    this.initChart()
43
+    this.__resizeHanlder = debounce(() => {
44
+      if (this.chart) {
45
+        this.chart.resize()
46
+      }
47
+    }, 100)
48
+    window.addEventListener('resize', this.__resizeHanlder)
49
+  },
50
+  beforeDestroy() {
51
+    if (!this.chart) {
52
+      return
53
+    }
54
+    window.removeEventListener('resize', this.__resizeHanlder)
55
+    this.chart.dispose()
56
+    this.chart = null
57
+  },
58
+  created(){
59
+    this.chartOptions = this.options;
60
+  },
61
+  methods: {
62
+    initChart() {
63
+      this.chart = echarts.init(this.$el, 'macarons')
64
+
65
+      this.chart.setOption({
66
+        title: {
67
+            text: this.title,
68
+        },
69
+        tooltip: {
70
+          trigger: 'item',
71
+          formatter: '{a} <br/>{b} : {c} ({d}%)'
72
+        },
73
+        legend: {
74
+          left: 'center',
75
+          bottom: '10',
76
+          data: this.chartOptions.legend,
77
+        },
78
+        calculable: true,
79
+        series: [
80
+          {
81
+            name: '',
82
+            type: 'pie',
83
+            roseType: 'radius',
84
+            radius: [15, 95],
85
+            center: ['50%', '38%'],
86
+            data: this.chartOptions.series,
87
+            animationEasing: 'cubicInOut',
88
+            animationDuration: 2600
89
+          }
90
+        ]
91
+      })
92
+    }
93
+  },
94
+  watch:{
95
+    "options":function(){
96
+      this.chartOptions = this.options;
97
+      this.initChart()
98
+      this.__resizeHanlder = debounce(() => {
99
+        if (this.chart) {
100
+          this.chart.resize() 
101
+        }
102
+      }, 100)
103
+      window.addEventListener('resize', this.__resizeHanlder)
104
+    }
105
+    
106
+  } 
107
+}
108
+</script>

+ 132 - 29
src/xt_pages/qcd/processIndicators.vue Dosyayı Görüntüle

@@ -68,8 +68,8 @@
68 68
         <span class="name">检验项目</span> :
69 69
       </label>
70 70
       <el-select v-model="listQuery.project_id" placeholder="请选择" @change="changeModel()">
71
-        <el-option label="全部" value></el-option>
72
-        <el-option v-for="item in projectOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
71
+        <el-option label="全部" value=""></el-option>
72
+        <el-option v-for="item in projectOptions" :key="item.project_id" :label="item.project_name" :value="item.project_id"></el-option>
73 73
       </el-select>
74 74
     </div>
75 75
 
@@ -78,7 +78,7 @@
78 78
     <el-row :gutter="32">
79 79
       <el-col :xs="24" :sm="24" :lg="24">
80 80
         <div class="chart-wrapper">
81
-            <bar-chart :title="'人次'" :options="modesData" />
81
+            <pie-chart title="完成情况" :options="CompletionOptions"/>
82 82
         </div>
83 83
       </el-col>
84 84
     </el-row>
@@ -88,13 +88,25 @@
88 88
     <el-table
89 89
       ref="multipleTable"
90 90
       :data="tableData"
91
+      :span-method="mergeSpan"
91 92
       border
92 93
       fit
93 94
       highlight-current-row
94 95
       style="width: 100%;margin-top: 10px;"
95 96
     >
96
-      <el-table-column label="日期" min-width="80" property="date" align="center"></el-table-column>
97
-      <el-table-column label="总数" min-width="80" property="total" align="center"></el-table-column>
97
+      
98
+      <el-table-column label="透析号" min-width="80" property="patient_id" align="center">
99
+        <template slot-scope="scope"><span>{{getPatientDialysisNo(scope.row.patient_id)}}</span></template>
100
+      </el-table-column>
101
+      <el-table-column label="姓名" min-width="80" property="patient_id" align="center">
102
+        <template slot-scope="scope"><span>{{getPatientName(scope.row.patient_id)}}</span></template>
103
+      </el-table-column>
104
+      <el-table-column label="检查项目" min-width="80" property="project_id" align="center">
105
+        <template slot-scope="scope"><span>{{getProjectName(scope.row.project_id)}}</span></template>
106
+      </el-table-column>
107
+      <el-table-column label="检查日期" min-width="80" property="inspect_date" align="center">
108
+        <template slot-scope="scope"><span>{{getTime(scope.row.inspect_date, '{y}{m}{d}')}}</span></template>
109
+      </el-table-column>
98 110
     </el-table>
99 111
 
100 112
     <!-- <pagi-nation title="分页"></pagi-nation> -->
@@ -115,40 +127,43 @@
115 127
 
116 128
 
117 129
 <script>
118
-import { getdialysistotaldata } from "@/api/qcd";
119
-import BarChart from "./components/BarChart";
130
+import { GetProcessIndicatorsData  } from "@/api/qcd";
131
+import PieChart from './components/PieChart'
132
+import {uParseTime} from "@/utils/tools";
120 133
 export default {
121
-  name: "processIndicators",
134
+  name: "dialysisTotal",
122 135
   data() {
123 136
     return {
124 137
       total: 0,
125
-      modesData: {
126
-        xAxis:[],
127
-        series:[],
128
-      },
138
+      projectOptions:{},
139
+      patientMap:{},
140
+        CompletionOptions:{
141
+            legend:[],
142
+            series:[],
143
+        },
129 144
       listQuery: {
130 145
         start_time: "",
131 146
         end_time: "",
132 147
         page: 1,
133 148
         limit: 10,
134 149
         lapseto: 0,
135
-        dialysis_age: 0,
136
-        mode_id: ""
150
+        project_id:'',
151
+        dialysis_age:0,
137 152
       },
138
-      projectOptions: {},
139 153
       tableData: [],
140
-      dialysisAge: 0,
141
-      dialysisAgeOptions: [
142
-        { value: 0, label: "全部" },
143
-        { value: 1, label: "大于三个月" },
144
-        { value: 2, label: "小于三个月" }
145
-      ],
154
+      tableRowData:[],
146 155
       lapsetoType: 0,
147 156
       lapsetoState: [
148 157
         { value: 0, label: "全部", source: 0, lapseto: 0 },
149 158
         { value: 1, label: "转出", source: 0, lapseto: 2 },
150 159
         { value: 2, label: "留治", source: 0, lapseto: 1 }
151 160
       ],
161
+      dialysisAge: 0,
162
+      dialysisAgeOptions: [
163
+        { value: 0, label: "全部" },
164
+        { value: 1, label: "大于三个月" },
165
+        { value: 2, label: "小于三个月" }
166
+      ],
152 167
       pickerOptions: {
153 168
         shortcuts: [
154 169
           {
@@ -209,28 +224,91 @@ export default {
209 224
   },
210 225
   methods: {
211 226
     getList() {
212
-      getdialysistotaldata(this.listQuery).then(response => {
227
+      GetProcessIndicatorsData(this.listQuery).then(response => {
213 228
         if (response.data.state == 0) {
214 229
           this.$message.error(response.data.msg);
215 230
           return false;
216 231
         } else {
232
+          this.tableData = [];
233
+          this.tableRowData = [];
234
+          this.total = response.data.data.total;
235
+          var unfinishedcount = response.data.data.unfinishedcount;
236
+          var finishedcount = this.total - unfinishedcount;
237
+          this.CompletionOptions = {
238
+            legend:[],
239
+            series:[],
240
+          };
241
+          this.CompletionOptions.legend.push('定时完成人次');
242
+          this.CompletionOptions.series.push({
243
+                value:finishedcount,name:'定时完成人次'
244
+            });
245
+          this.CompletionOptions.legend.push('未时完成人次');
246
+          this.CompletionOptions.series.push({
247
+                value:unfinishedcount,name:'未时完成人次'
248
+            });
249
+
217 250
           
251
+        
252
+          var references = response.data.data.references;
253
+          for (const index in references) {
254
+            if (references[index].project_id in this.projectOptions) {
255
+              continue;  
256
+            }
257
+            this.$set(this.projectOptions, references[index].project_id, references[index]);
258
+          }
259
+
260
+          var patients = response.data.data.patients;
261
+          for (const index in patients) {
262
+            if (patients[index].id in this.patientMap) {
263
+              continue;  
264
+            }
265
+            this.$set(this.patientMap, patients[index].id, patients[index]);
266
+          }
267
+          var temInspections = {};
268
+          var inspections = response.data.data.inspections;
269
+          for (const index in inspections) {
270
+            var key = inspections[index].inspect_date + '_' + inspections[index].patient_id;
271
+            if (!(key in temInspections)) {
272
+              temInspections[key] = {};
273
+            }
274
+            if (inspections[index].project_id in temInspections[key]) {
275
+              continue;
276
+            }
277
+            temInspections[key][inspections[index].project_id] = inspections[index];
278
+          }
279
+          var rowIndex = 0;
280
+          var childIndex = 0;
281
+          for (const key in temInspections) {
282
+            this.tableRowData.push(1);
283
+            var parentIndex = rowIndex;
284
+            childIndex = 0;
285
+            for (const child in temInspections[key]) {
286
+              this.tableData.push(temInspections[key][child]);
287
+              if(childIndex>0) {
288
+                this.tableRowData[parentIndex] += 1;
289
+                this.tableRowData.push(0);
290
+              }
291
+              childIndex++;
292
+              rowIndex++;
293
+            }
294
+          }
295
+
218 296
         }
219 297
       });
220 298
     },
221 299
     changeTime() {
222 300
       this.getList();
223 301
     },
224
-    selectdialysisAges(type) {
225
-      this.dialysisAge = type;
226
-      this.listQuery.dialysis_age = type;
227
-      this.getList();
228
-    },
229 302
     selectLapseTo(lapseto) {
230 303
       this.lapsetoType = lapseto;
231 304
       this.listQuery.lapseto = lapseto;
232 305
       this.getList();
233 306
     },
307
+    selectdialysisAges(type) {
308
+      this.dialysisAge = type;
309
+      this.listQuery.dialysis_age = type;
310
+      this.getList();
311
+    },
234 312
     changeModel() {
235 313
       this.getList();
236 314
     },
@@ -241,10 +319,35 @@ export default {
241 319
     handleCurrentChange(val) {
242 320
       this.listQuery.page = val;
243 321
       this.getList();
244
-    }
322
+    },
323
+    getTime(value, temp) {
324
+        if (value != undefined) {
325
+          return uParseTime(value, temp)
326
+        }
327
+        return ""
328
+    },
329
+    getProjectName(id) {
330
+      return (id in this.projectOptions) ? this.projectOptions[id].project_name:'';
331
+    },
332
+    getPatientName(id) {
333
+      return (id in this.patientMap) ? this.patientMap[id].name:'';
334
+    },
335
+    getPatientDialysisNo(id) {
336
+      return (id in this.patientMap) ? this.patientMap[id].dialysis_no:'';
337
+    },
338
+    mergeSpan({row, column, rowIndex, columnIndex}) {
339
+      if (columnIndex === 0 || columnIndex === 1 || columnIndex === 3) {
340
+        const _row = this.tableRowData[rowIndex];
341
+        const _col = _row > 0 ? 1 : 0;
342
+        return {
343
+          rowspan: _row,
344
+          colspan: _col
345
+        }
346
+      }
347
+    },
245 348
   },
246 349
   components: {
247
-    BarChart
350
+      PieChart
248 351
   }
249 352
 };
250 353
 </script>