Sfoglia il codice sorgente

12月3 阶段小结

yq1 6 mesi fa
parent
commit
65d8206436
1 ha cambiato i file con 459 aggiunte e 262 eliminazioni
  1. 459 262
      src/xt_pages/user/courseOfDisease_new.vue

+ 459 - 262
src/xt_pages/user/courseOfDisease_new.vue Vedi File

@@ -1,8 +1,11 @@
1 1
 <template>
2
- 
2
+  <!-- <div class="main-contain">
3
+      <div class="position">
4
+         <bread-crumb></bread-crumb>
5
+      </div> -->
3 6
   <div class="patient-container">
4 7
     <PatientSidebar :id="patient_id" defaultActive="3-5"></PatientSidebar>
5
-   
8
+    <!-- <div class="app-container"> -->
6 9
     <div v-loading="loading">
7 10
       <div class="patient-app-container advice-container app-container" style="">
8 11
         <div style="display: flex;">
@@ -20,23 +23,25 @@
20 23
                 ref="phy_table"
21 24
                 :data="tableData"
22 25
                 :highlight-current-row="true"
23
-                @current-change="getCurrentChangeOne"
26
+                @row-click="rowclick"
24 27
                 style="width: 100%">
25
-                
26
-                <el-table-column prop="index" label="序号" width="50">
27
-                  <template slot-scope="scope">
28
-                     {{ scope.$index + 1 }}
29
-                  </template>
28
+                <el-table-column
29
+                  type="selection"
30
+                  width="55">
31
+                </el-table-column>
32
+                <el-table-column
33
+                  prop="index"
34
+                  label="序号"
35
+                  width="50">
30 36
                 </el-table-column>
31
-                <el-table-column prop="date" label="时间" width="">
32
-                  <template slot-scope="scope">
33
-                      {{ getTime(scope.row.record_time) }}
34
-                    </template>
37
+                <el-table-column
38
+                  prop="date"
39
+                  label="时间"
40
+                  width="">
35 41
                 </el-table-column>
36
-                <el-table-column prop="doctor" label="医生">
37
-                  <template slot-scope="scope">
38
-                    {{ getDocName(scope.row.recorder) }}
39
-                  </template>
42
+                <el-table-column
43
+                  prop="doctor"
44
+                  label="医生">
40 45
                 </el-table-column>
41 46
               </el-table>
42 47
             </div>
@@ -53,7 +58,7 @@
53 58
                   <el-button type="primary" size="small" @click="prints">打印</el-button>
54 59
                 </div>
55 60
                 <div v-if="add_index == 1">
56
-                  <el-button type="primary" size="small" @click="showSave">保存2</el-button>
61
+                  <el-button type="primary" size="small" @click="showSave">保存</el-button>
57 62
                   <el-button size="small" @click="showCancel">取消</el-button>
58 63
                 </div>
59 64
               </div>
@@ -61,19 +66,21 @@
61 66
             <div style="display: flex;margin: 10px 0;">
62 67
               <div style="flex: 1;">
63 68
                 记录时间:
64
-                <el-date-picker v-model="record_date" prefix-icon="el-icon-date" :editable="false"
65
-                              style="width: 250px;"
66
-                              type="datetime" placeholder="选择日期时间" align="right" format="yyyy-MM-dd HH:mm:ss"
67
-                              value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
69
+                <el-date-picker
70
+                  v-model="value1"
71
+                  :disabled="disabled"
72
+                  type="datetime"
73
+                  placeholder="选择日期时间">
74
+                </el-date-picker>
68 75
               </div>
69 76
               <div style="flex: 1;">
70 77
                 病程医生:
71
-                <el-select v-model="admin_user_id" placeholder="请选择" :disabled="disabled">
78
+                <el-select v-model="value" placeholder="请选择" :disabled="disabled">
72 79
                   <el-option
73
-                    v-for="item in doctorOptions"
74
-                    :key="item.id"
75
-                    :label="item.name"
76
-                    :value="item.id">
80
+                    v-for="item in options"
81
+                    :key="item.value"
82
+                    :label="item.label"
83
+                    :value="item.value">
77 84
                   </el-option>
78 85
                 </el-select>
79 86
               </div>
@@ -90,14 +97,11 @@
90 97
                   自动生成
91 98
                 </el-button>
92 99
               </div>
93
-             
94
-              <ueditor ref="editor" id="editors" :content="new_content"></ueditor>
100
+              <ueditor ref="ue" :content="new_content" id="editor"></ueditor>
95 101
             </div>
96 102
           </div>
97 103
         </div>
98 104
       </div>
99
-
100
-
101 105
       <el-dialog
102 106
         title="设置模板"
103 107
         :visible.sync="template_dialog"
@@ -105,38 +109,36 @@
105 109
         center>
106 110
         <div>
107 111
           模板名称:
108
-          <el-input v-model="title" placeholder="请输入内容" style="width: 160px;"></el-input>
112
+          <el-input v-model="template_name" placeholder="请输入内容" style="width: 160px;"></el-input>
109 113
         </div>
110 114
         <span slot="footer" class="dialog-footer">
111 115
           <el-button @click="template_dialog = false">取 消</el-button>
112
-          <el-button type="primary" @click="saveTemplate">确 定</el-button>
116
+          <el-button type="primary" @click="template_save">确 定</el-button>
113 117
         </span>
114 118
       </el-dialog>
115 119
       <el-dialog
116 120
         title="模板库"
117 121
         :visible.sync="library_dialog"
118 122
         width="70%"
119
-        class="lirary"
123
+        class="lirary "
120 124
         >
121 125
         <div>
122 126
           <div style="display: flex;">
123 127
             <div style="width: 27%;">
124 128
               <el-table
125
-                :data="templateList"
129
+                :data="tableData"
126 130
                 :highlight-current-row="true"
127 131
                 @row-click="rowclick"
128
-                 ref="record_table_one"
129
-                 @current-change="getCurrentChangeTwo"
130 132
                 style="width: 100%">
131
-                <el-table-column prop="index" label="序号"  width="">
132
-                  <template slot-scope="scope">
133
-                       {{ scope.$index + 1 }}
134
-                   </template>
133
+                <el-table-column
134
+                  prop="index"
135
+                  label="序号"
136
+                  width="">
135 137
                 </el-table-column>
136
-                <el-table-column prop="name" label="模板名称" width="">
137
-                  <template slot-scope="scope">
138
-                       {{ scope.row.title }}
139
-                   </template>
138
+                <el-table-column
139
+                  prop="name"
140
+                  label="模板名称"
141
+                  width="">
140 142
                 </el-table-column>
141 143
               </el-table>
142 144
             </div>
@@ -144,7 +146,7 @@
144 146
               <div class="Second_title">模板内容</div>
145 147
               <div style="">
146 148
                 <keep-alive>
147
-                  <ueditor ref="editorOne" id="editors" :content="new_content"></ueditor>
149
+                  <ueditor ref="ue" :content="new_content" id="editor"></ueditor>
148 150
                 </keep-alive>
149 151
               </div>
150 152
             </div>
@@ -153,21 +155,24 @@
153 155
         <span slot="footer" class="dialog-footer" style="text-align: center;">
154 156
           <el-button type="danger" @click="template_dele">删除模板</el-button>
155 157
           <el-button type="primary" @click="template_save">保存模板</el-button>
156
-          <el-button type="primary" @click="toContentPint">应用</el-button>
158
+          <el-button type="primary" @click="template_save">应用</el-button>
157 159
           <el-button @click="library_dialog = false">取消</el-button>
158 160
         </span>
159 161
       </el-dialog>
162
+
160 163
       <el-dialog
161 164
         title="提示"
162 165
         :visible.sync="auto_dialog"
163 166
         width="70%"
164 167
         top="0"
165
-        >
168
+        class="course"
169
+
170
+      >
166 171
         <div>
167
-          <div style="display:flex">
172
+          <div style="display:flex;position: absolute;top: 20px;left: 20%;">
168 173
             <div>
169 174
               取值时间:
170
-              <el-select v-model="quzhi_date" placeholder="请选择" style="width: 120px;">
175
+              <el-select v-model="quzhi_date" @change="datachange" placeholder="请选择" style="width: 120px;">
171 176
                 <el-option
172 177
                   v-for="item in quzhi_options"
173 178
                   :key="item.value"
@@ -202,19 +207,113 @@
202 207
               </el-button>
203 208
             </div>
204 209
           </div>
210
+          <div v-html="table"></div>
205 211
         </div>
206
-       
212
+        <!-- <span slot="footer" class="dialog-footer">
213
+          <el-button @click="auto_dialog = false">取 消</el-button>
214
+          <el-button type="primary" @click="auto_dialog = false">确 定</el-button>
215
+        </span> -->
207 216
       </el-dialog>
208 217
 
209 218
 
210 219
 
211 220
 
212
-    
213
- 
221
+      <!-- </div> -->
222
+      <el-dialog title="新增病程记录" class="eldialog" width="70%" top="5vh" :visible.sync="show_dialog">
223
+        <div>
224
+          <div class="new_record_form">
225
+            <div class="cell clearfix">
226
+              <label class="title"><span class="name">病程日期</span> : </label>
227
+              <el-date-picker v-model="course_of_disease_time" prefix-icon="el-icon-date" :editable="false"
228
+                              style="width: 250px;"
229
+                              type="datetime" placeholder="选择日期时间" align="right" format="yyyy-MM-dd HH:mm:ss"
230
+                              value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
231
+
232
+              <label class="title"><span class="name">日常病程</span> : </label>
233
+              <el-select v-model="select_template" placeholder="可选择病程模板" @change="didSelectTemplate">
234
+                <el-option v-for="(option, index) in templates" :key="index" :label="option.title"
235
+                           :value="option.content"></el-option>
236
+              </el-select>
237
+            </div>
238
+
239
+            <div class="cell clearfix" style="margin-top: 10px">
240
+              <label class="title"><span class="name">病程标题</span> : </label>
241
+              <el-input v-model="title" style="width: 420px"></el-input>
242
+            </div>
243
+
244
+            <div style="margin-top: 10px;">
245
+              <el-button type="primary" size="small" @click="toAuto" v-if="org_id == 3877 || org_id == 10440" >自动生成</el-button>
246
+            </div>
247
+            <div class="textarea_panel">
248
+              <keep-alive>
249
+                <editor ref="editor"
250
+                        id="editors"
251
+                        style="width: 80%"
252
+                        v-bind:r_content="new_content"
253
+                        >
254
+                </editor>
255
+              </keep-alive>
256
+            </div>
257
+
258
+            <div style="text-align: right; padding-right: 0px; padding-top: 10px; padding-bottom: 10px;">
259
+              <el-button @click="show_dialog = false">取消</el-button>
260
+              <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary"
261
+                         @click="createAction" :loading="uploading_new_record">保存
262
+              </el-button>
263
+            </div>
264
+          </div>
265
+        </div>
266
+      </el-dialog>
267
+
268
+
269
+      <el-dialog title="修改病程记录" class="eldialog" width="70%" top="5vh" :visible.sync="show_edit_dialog" style="">
270
+        <div>
271
+          <div class="new_record_form">
272
+            <div class="cell clearfix">
273
+              <label class="title"><span class="name">病程日期</span> : </label>
274
+              <el-date-picker v-model="edit_course_of_disease_time" prefix-icon="el-icon-date" :editable="false"
275
+                              style="width: 200px;"
276
+                              type="datetime"
277
+                              placeholder="选择日期时间" align="right" format="yyyy-MM-dd HH:mm:ss"
278
+                              value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
279
+
280
+              <label class="title"><span class="name">日常病程</span> : </label>
281
+              <el-select v-model="select_template" placeholder="可选择病程模板" @change="didEditSelectTemplate">
282
+                <el-option v-for="(option, index) in templates" :key="index" :label="option.title"
283
+                           :value="option.content"></el-option>
284
+              </el-select>
285
+            </div>
286
+
287
+
288
+            <div class="cell clearfix" style="margin-top: 10px">
289
+              <label class="title"><span class="name">病程标题</span> : </label>
290
+              <el-input v-model="edit_title" style="width: 420px"></el-input>
291
+            </div>
292
+
293
+            <div class="textarea_panel">
294
+              <!--<el-input v-model="edit_new_content" type="textarea" rows="6" resize="none"></el-input>-->
295
+              <keep-alive>
296
+                <editor ref="edit_neditor"
297
+                        id="edit_editor"
298
+                        style="width: 80%"
299
+                        v-bind:r_content="edit_new_content">
300
+                </editor>
301
+              </keep-alive>
302
+            </div>
303
+
304
+            <div style="text-align: right; padding-right: 0px; padding-top: 10px; padding-bottom: 10px;">
305
+              <el-button @click="show_edit_dialog = false">取消</el-button>
306
+              <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary"
307
+                         @click="modifyAction" :loading="uploading_new_record">保存
308
+              </el-button>
309
+            </div>
310
+          </div>
311
+        </div>
312
+      </el-dialog>
214 313
     </div>
215 314
   </div>
216 315
 
217
-
316
+  <!-- </div> -->
218 317
 </template>
219 318
 
220 319
 <script>
@@ -225,19 +324,17 @@
225 324
   const moment = require('moment')
226 325
   import { getDataConfig } from "@/utils/data";
227 326
   import {
228
-    createNewCourseOfDiseaseRecord,
229
-    deleteNewCouseOfDisease,
327
+    createCourseOfDiseaseRecord,
328
+    deleteCourseOfDiseaseRecords,
329
+    getCourseOfDiseaseRecords,
230 330
     modifyCourseOfDiseaseRecord,
231
-    getPatientCourseOfDiseaseList,
232
-    saveCoureseTemplateTitle,
233
-    getPatientCoureOfTempalate,
234
-    saveCourseOfNewTemplate,
235
-    deleteCourseTempalte
331
+    GetCoursePrintData,
332
+    getPatientDialysisInfor
236 333
   } from '@/api/patient'
237
-  import { fetchAllDoctorAndNurse } from "@/api/doctor";
238 334
   import { parseTime } from '@/utils'
239 335
   import BreadCrumb from '@/xt_pages/components/bread-crumb'
240 336
   import { uParseTime } from '@/utils/tools'
337
+  var ceshi = `asdfsafsfddf${ceshi}`
241 338
   export default {
242 339
     name: 'CourseOfDisease',
243 340
     components: {
@@ -249,6 +346,7 @@
249 346
     },
250 347
     data() {
251 348
       return {
349
+        ceshi:2345,
252 350
         loading: false,
253 351
         title: '',
254 352
         patient_id: 0,
@@ -274,6 +372,8 @@
274 372
         ids:"",
275 373
         idArr:[],
276 374
         org_id:0,
375
+
376
+
277 377
         add_index:0,
278 378
         disabled:true,
279 379
         template_dialog:false,
@@ -282,22 +382,16 @@
282 382
         quzhi_date:1,
283 383
         start_date:'',
284 384
         end_date:'',
285
-        quzhi_options:[{value:1,label:'本周'},{value:2,label:'上周'},{value:3,label:'本月'},{value:4,label:'上周'},],
286
-        tableData:[],
287
-        admin_user_id:0,
288
-        record_date:moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
289
-        template_name:"",
290
-        id:0,
291
-        doctorOptions:[],
292
-        template_content:"",
293
-        template_id:0,
294
-        title:"",
295
-        templateList:[]
385
+        quzhi_options:[{value:1,label:'本周'},{value:2,label:'上周'},{value:3,label:'本月'},{value:4,label:'上月'},],
386
+        tableData:[{index:1,date:'2024-11-12',doctor:'王启年'}],
387
+        table:'',
388
+        cesh:'',
296 389
       }
297 390
     },
391
+    beforeCreate(){
392
+      // this.cesh =`asdfffgfdgadas${this.ceshi}`
393
+    },
298 394
     created() {
299
-      this.admin_user_id = this.$store.getters.xt_user.user.id
300
-    
301 395
       this.patient_id = parseInt(this.$route.query.id)
302 396
       this.org_id = this.$store.getters.xt_user.template_info.org_id;
303 397
       if (isNaN(this.patient_id) || this.patient_id <= 0) {
@@ -308,115 +402,31 @@
308 402
         this.$router.push('/patients/patients')
309 403
         return
310 404
       }
405
+      this.table = ceshi
406
+      // var now = new Date()
407
+      // this.date = [now.getTime() - (7 * 24 * 60 * 60 * 1000), now.getTime()]
311 408
 
312
-      this.fetchAllDoctorAndNurse()
313
-      this.getlist()
314
-     
409
+      // var nowDate = new Date()
410
+      // var nowYear = nowDate.getFullYear()
411
+      // var nowMonth = nowDate.getMonth() + 1
412
+      // var nowDay = nowDate.getDate()
413
+      // this.end_time =nowYear +'-' +(nowMonth < 10 ? '0' + nowMonth : nowMonth) +'-' +(nowDay < 10 ? '0' + nowDay : nowDay)
414
+      // nowDate.setMonth(nowDate.getMonth() - 1)
415
+      // nowYear = nowDate.getFullYear() -1
416
+      // nowMonth = nowDate.getMonth() + 1
417
+      // nowDay = nowDate.getDate()
418
+      // this.start_time = nowYear +'-' +(nowMonth < 10 ? '0' + nowMonth : nowMonth) +'-' +(nowDay < 10 ? '0' + nowDay : nowDay)
419
+      this.start_time = moment().month(moment().month() - 6).startOf('month').format('YYYY-MM-DD');
420
+      console.log("start_time",this.start_time)
421
+      this.end_time = moment().endOf('month').format('YYYY-MM-DD');
422
+      console.log("end_time",this.end_time)
423
+      this.requestCourseRecords()
315 424
 
316 425
     },
317 426
     methods: {
318
-
319
-      toContentPint(){
320
-        this.$refs.editor.contents = this.template_content
321
-        this.library_dialog = false
322
-      },
323
-      getCurrentChangeOne(val){
324
-        this.$refs.editor.contents = val.content
325
-        this.record_date = this.getTime(val.record_time)
326
-        this.id = val.id
327
-      },
328
-      getCurrentChangeTwo(val){
329
-   
330
-        this.$refs.editorOne.contents = val.content
331
-        this.template_content = ""
332
-        this.template_content = val.content
333
-        this.template_id = val.id
334
-     },
335
-     template_dele(){
336
-       deleteCourseTempalte(this.template_id).then(response=>{
337
-        if(response.data.state == 1){
338
-          var msg =  response.data.data.msg
339
-          this.$message.success("删除成功!")
340
-          this.library_dialog = false
341
-          this.getPatientCoureOfTempalateOne()
342
-        }
343
-      })
344
-     },
345
-     getPatientCoureOfTempalateOne(){
346
-
347
-     },
348
-     rowclick(){
349
-
350
-      },
351
-      prints(){
352
-
353
-      },
354
-      saveTemplate(){
355
-   
356
-        var params = {
357
-          title:this.title,
358
-          content: this.$refs.editor.contents,
359
-        }
360
-      saveCoureseTemplateTitle(params).then(response=>{
361
-        if(response.data.state == 1){
362
-          var courseTemplate =  response.data.data.courseTemplate
363
-          this.$message.success("保存成功!")
364
-          this.template_dialog = false
365
-        }
366
-        })
367
-      },
368
-      template_save(){
369
-        var params = {
370
-         template_id:this.template_id,
371
-         content:this.$refs.editorOne.contents
372
-        }
373
-      
374
-        saveCourseOfNewTemplate(params).then(response=>{
375
-           if(response.data.state == 1){
376
-              var msg = response.data.data.msg
377
-              this.$message.success("保存成功")
378
-              this.library_dialog = false
379
-           }
380
-        })
381
-      },
382
-      getDocName(admin_user_id){
383
-        var user_name = ""
384
-        for(let i=0;i<this.doctorOptions.length;i++){
385
-          if(admin_user_id == this.doctorOptions[i].id){
386
-              user_name = this.doctorOptions[i].name
387
-          }
388
-        }
389
-       return user_name
390
-     },
391
-      getlist(){
392
-          var params = {
393
-            patient_id:this.patient_id
394
-          }
395
-        getPatientCourseOfDiseaseList(params).then(response=>{
396
-            if(response.data.state == 1){
397
-               var list = response.data.data.list
398
-              this.tableData = []
399
-              this.tableData = list
400
-             
401
-            }
402
-        })
403
-     },
404
-     fetchAllDoctorAndNurse() {
405
-       fetchAllDoctorAndNurse().then(response => {
406
-        if (response.data.state == 1) {
407
-          this.doctorOptions= []
408
-          this.doctorOptions = response.data.data.doctors;
409
-        }
410
-       });
411
-      },
412 427
       add_click(){
413
-        this.admin_user_id = ""
414
-        this.admin_user_id = this.$store.getters.xt_user.user.id
415
-        this.fetchAllDoctorAndNurse()
416
-        this.$refs.editor.contents = ""
417
-        this.id = 0
418
-        this.disabled = false
419 428
         this.add_index = 1
429
+        this.disabled = false
420 430
       },
421 431
       showCancel(){
422 432
         this.add_index = 0
@@ -425,30 +435,6 @@
425 435
       showSave(){
426 436
         this.add_index = 0
427 437
         this.disabled = true
428
-        console.log("haaaaaaaaaaaaaaa",this.$refs)
429
-        this.new_content = this.$refs.editor.contents
430
-        if (this.new_content.length == 0) {
431
-          this.$message.error('请填写病程内容')
432
-          return
433
-        }
434
-        var params = {
435
-          id:this.id,
436
-          patient_id:this.patient_id,
437
-          record_date:this.record_date,
438
-          content:this.new_content,
439
-          admin_user_id:this.admin_user_id,
440
-        }
441
-        console.log("params",params)
442
-        createNewCourseOfDiseaseRecord(params).then(response => {
443
-         if(response.data.state == 1){
444
-           var msg = response.data.data.msg
445
-           this.$message.success("保存成功!")
446
-           this.getlist()
447
-         }
448
-
449
-        }).catch(error => {
450
-         
451
-        })
452 438
       },
453 439
       template_click(){
454 440
         console.log('this.add_index',this.add_index);
@@ -456,27 +442,123 @@
456 442
         if(this.add_index ==0){
457 443
           this.template_dialog = true
458 444
         }else{
459
-         getPatientCoureOfTempalate().then(response=>{
460
-          if(response.data.state == 1){
461
-            this.library_dialog = true
462
-            this.templateList = response.data.data.templateList
463
-            console.log("hahhahahaha",this.$refs)
464
-            if(this.templateList!=null && this.templateList.length>0){
465
-              this.$refs.record_table_one.setCurrentRow(this.templateList[0])
466
-            }
467
-            console.log("haaaaaaaaaaaaa",this.templateList)
468
-            
469
-          }
470
-        })
471
-     
472
-       }
445
+          this.library_dialog = true
446
+        }
473 447
       },
474 448
       auto_click(){
449
+        this.start_date = this.getFirstDayOfWeek(new Date())
450
+        this.end_date = this.getTime(new Date())
475 451
         this.auto_dialog = true
476 452
       },
477 453
       autotext_click(){
478 454
         this.auto_dialog = false
479 455
       },
456
+      datachange(val){
457
+        if(val ==1){
458
+          this.start_date = this.getFirstDayOfWeek(new Date())
459
+          this.end_date = this.getTime(new Date())
460
+        }else if(val ==2){
461
+          this.getlastweek(new Date())
462
+        }else if(val ==3){
463
+          this.start_date = this.getFirstDayOfMonth(new Date())
464
+          this.end_date = this.getTime(new Date())
465
+        }else if(val ==4){
466
+          this.getLastMonthFirstDay()
467
+          this.getLastMonthLastDay()
468
+        }
469
+      },
470
+
471
+
472
+      // 本周
473
+      getFirstDayOfWeek(date){
474
+        var weekday = date.getDay()
475
+        date.setDate(date.getDate()-weekday+1);//往前算(weekday-1)天,年份、月份会自动变化
476
+        return this.timeFormat(date);
477
+      },
478
+      // 上周
479
+      getlastweek(date){
480
+        date.setDate(date.getDate()-7 - date.getDay() + 1);
481
+        var m =''
482
+        var d = ''
483
+        if(date.getMonth() + 1<10){
484
+          m = '0'+(date.getMonth() + 1)
485
+        }else{
486
+            m = date.getMonth() + 1
487
+        }
488
+        if(date.getDate()<10){
489
+            d = '0'+date.getDate()
490
+        }else{
491
+          d = date.getDate()
492
+        }
493
+        // this.start_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() ;
494
+        this.start_date = date.getFullYear() + "-" + m + "-" + d ;
495
+        date.setDate(date.getDate() +6);
496
+        var mm = ''
497
+        var dd = ''
498
+        if(date.getMonth() + 1<10){
499
+          mm = '0'+(date.getMonth() + 1)
500
+        }else{
501
+          mm = date.getMonth() + 1
502
+        }
503
+        if(date.getDate()<10){
504
+          dd = '0'+date.getDate()
505
+        }else{
506
+          dd = date.getDate()
507
+        }
508
+        // if(date.getMonth() + 1<10)
509
+        // this.end_date = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
510
+        this.end_date = date.getFullYear() + "-" + mm + "-" + dd ;
511
+        console.log('this.end_date',this.end_date);
512
+      },
513
+      // 本月
514
+      getFirstDayOfMonth (date) {
515
+        date.setDate(1);
516
+        return this.timeFormat(date);
517
+      },
518
+       //上个月第一天
519
+      getLastMonthFirstDay() {
520
+          var date = new Date();
521
+          date.setDate(0);
522
+          var y = date.getFullYear(); //获取年份
523
+          var m = date.getMonth() + 1; //获取月份
524
+          m = m < 10 ? "0" + m : m;
525
+          this.start_date = [y, m, '01'].join("-")
526
+          // return [y, m, '01'].join("-");
527
+      },
528
+      // 上个月最后一天
529
+      getLastMonthLastDay() {
530
+          var date = new Date();
531
+          date.setDate(0);
532
+          var y = date.getFullYear(); //获取年份
533
+          var m = date.getMonth() + 1; //获取月份
534
+          var d = new Date(y, m, 0).getDate(); //获取当月最后一日
535
+          m = m < 10 ? "0" + m : m; //月份补 0
536
+          d = d < 10 ? "0" + d : d; //日数补 0
537
+          this.end_date = [y, m, d].join("-")
538
+          // return [y, m, d].join("-");
539
+      },
540
+      // 日期格式化
541
+      timeFormat(date) {
542
+          if (!date || typeof(date) === "string") {
543
+            this.error("参数异常,请检查...");
544
+          }
545
+          var y = date.getFullYear(); //年
546
+          if(date.getMonth() + 1<10){
547
+            var m ='0'+(date.getMonth() + 1); //月
548
+          }else{
549
+            var m =date.getMonth() + 1; //月
550
+          }
551
+          if(date.getDate()<10){
552
+            var d ='0'+date.getDate(); //日
553
+          }else{
554
+            var d = date.getDate(); //日
555
+          }
556
+          // var d = date.getDate(); //日
557
+
558
+          return y + "-" + m + "-" + d;
559
+      },
560
+
561
+
480 562
       requestCourseRecords: function() {
481 563
         this.loading = true
482 564
         getCourseOfDiseaseRecords(this.patient_id, this.start_time, this.end_time).then(rs => {
@@ -547,30 +629,34 @@
547 629
 
548 630
       },
549 631
 
550
-      createAction() {
551
-        console.log("haaaaaaaaaaaaaaa",this.$refs)
552
-        this.new_content = this.$refs.editor.contents
553
-        
632
+      createAction: function() {
633
+        this.new_content = this.$refs.editor.content
634
+        console.log("hhhhh2h3h232323232",this.new_content)
554 635
         if (this.new_content.length == 0) {
555 636
           this.$message.error('请填写病程内容')
556 637
           return
557 638
         }
558
-        var params = {
559
-          id:this.id,
560
-          patient_id:this.patient_id,
561
-          record_date:this.record_date,
562
-          content:this.new_content,
563
-          admin_user_id:this.admin_user_id,
564
-        }
565
-        console.log("params",params)
566
-        createNewCourseOfDiseaseRecord(params).then(response => {
567
-         if(response.data.state == 1){
568
-           var msg = response.data.data.msg
569
-           this.$message.success("保存成功!")
570
-         }
639
+        this.uploading_new_record = true
640
+
641
+        createCourseOfDiseaseRecord(this.patient_id, this.new_content, this.course_of_disease_time, this.title).then(rs => {
642
+          this.uploading_new_record = false
643
+          var resp = rs.data
644
+          if (resp.state == 1) {
645
+            this.records.unshift(resp.data.record)
646
+            // this.$refs.record_table.setCurrentRow()
647
+            // this.$refs.record_table.setCurrentRow(this.records[0])
648
+            // this.current_select_record = this.records[0]
649
+            this.show_dialog = false
650
+            this.new_content = ''
651
+            this.title = ''
652
+
653
+          } else {
654
+            this.$message.error(resp.msg)
655
+          }
571 656
 
572 657
         }).catch(error => {
573
-         
658
+          this.uploading_new_record = false
659
+          this.$message.error(error)
574 660
         })
575 661
       },
576 662
       didSelectTemplate: function(templateContent) {
@@ -591,33 +677,54 @@
591 677
         console.log("select23322332",this.ids)
592 678
         this.selectingRows = selectRows
593 679
       },
594
-      deleteAction(){
595
-        if(this.id == 0){
596
-          this.$message.error("请选择要删除的信息!")
597
-          return false
598
-        }
599
-        this.$confirm('确定要取消吗?', '提示', {
600
-          confirmButtonText: '确定',
601
-          cancelButtonText: '取消',
602
-          type: 'warning'
603
-        }).then(() => {
604
-          deleteNewCouseOfDisease(this.id).then(response=>{
605
-            if (response.data.state==1) {
606
-              var msg = response.data.data.msg
607
-              this.$message.success("删除成功!")
608
-              this.getlist()
680
+      deleteAction: function() {
681
+        if (this.selectingRows.length == 0) {
682
+          return
683
+        }
684
+        var ids = []
685
+        for (let index = 0; index < this.selectingRows.length; index++) {
686
+          const row = this.selectingRows[index]
687
+          ids.push(row.id)
688
+        }
689
+        var ids_str = ids.join(',')
690
+        this.loading = true
691
+        deleteCourseOfDiseaseRecords(this.patient_id, ids_str).then(rs => {
692
+          var resp = rs.data
693
+          if (resp.state == 1) {
694
+            for (let id_index = 0; id_index < ids.length; id_index++) {
695
+              for (let record_index = 0; record_index < this.records.length; record_index++) {
696
+                if (ids[id_index] == this.records[record_index].id) {
697
+                  this.records.splice(record_index, 1)
698
+                  break
699
+                }
700
+              }
609 701
             }
610
-          });
611
-        }).catch(() => {
612
-
613
-        });
614
-
702
+            this.selectingRows = []
703
+            this.$message.success('已删除')
615 704
 
616
-      },
617
-      showEdit() {
618
-       
619
-        this.add_index =1
620
-        this.disabled = false
705
+          } else {
706
+            this.$message.error(resp.msg)
707
+          }
708
+          this.loading = false
709
+        }).catch(err => {
710
+          this.loading = false
711
+          this.$message.error(err)
712
+        })
713
+      }, startTimeChange(val) {
714
+        this.requestCourseRecords()
715
+      }, endTimeChange(val) {
716
+        this.requestCourseRecords()
717
+      }, showEdit() {
718
+        if (this.table_current_index == -1) {
719
+          this.$message.error('请选择要修改的病程内容')
720
+          return
721
+        }
722
+        this.show_edit_dialog = true
723
+        this.edit_course_of_disease_time = this.recordTime(this.records[this.table_current_index].record_time)
724
+        this.edit_new_content = this.records[this.table_current_index].content
725
+        this.edit_current_id = this.records[this.table_current_index].id
726
+        this.edit_title = this.records[this.table_current_index].title
727
+        this.$refs.record_table.setCurrentRow(null)
621 728
 
622 729
       }, tableRow({ row, rowIndex }) {
623 730
         // 把每一行的索引放进row
@@ -633,6 +740,92 @@
633 740
         this.$router.push({ path: "/course/print?ids="+this.ids+"&patient_id="+this.patient_id});
634 741
 
635 742
       },
743
+      toAuto(){
744
+
745
+         var params=  {
746
+           patient_id:parseInt(this.$route.query.id),
747
+           record_date:this.course_of_disease_time.slice(0,10),
748
+         }
749
+         console.log("param2222owoowwow",params)
750
+        getPatientDialysisInfor(params).then(response=>{
751
+          if(response.data.state== 1){
752
+            var patient = response.data.data.patient
753
+            var prescription = response.data.data.prescription
754
+            var predialysis_evaluation =  response.data.data.assessmentBefor
755
+            var dialysis_order =  response.data.data.order
756
+            var monitors = response.data.data.monitor
757
+            var doctor_advices = response.data.data.advice
758
+            var assessment_after_dislysis =  response.data.data.afterDislysis
759
+
760
+           var str_one = ""
761
+          if(dialysis_order!=null){
762
+            if(dialysis_order.puncture_nurse_id >0){
763
+              str_one = "护士穿刺成功!"
764
+            }
765
+          }
766
+
767
+          var total =0
768
+          if(predialysis_evaluation!=null){
769
+            total = (predialysis_evaluation.weight_before - predialysis_evaluation.dry_weight).toFixed(1)
770
+          }
771
+
772
+
773
+        var monitor_one =[]
774
+        var monitor_two = []
775
+        var monitor_three = []
776
+
777
+        if(monitors!=null && monitors.length > 0){
778
+          var monitor_one =  monitors.sort(function (a,b) {
779
+            return b.systolic_bp - a.systolic_bp
780
+          })
781
+          var monitor_two =  monitors.sort(function (a,b) {
782
+            return b.diastolic_bp - a.diastolic_bp
783
+          })
784
+
785
+          var monitor_three = monitors.sort(function (a,b) {
786
+            return b.pulse_frequency - a.pulse_frequency
787
+          })
788
+
789
+        }
790
+
791
+        var doc_str = ""
792
+
793
+        if(doctor_advices!=null && doctor_advices.length > 0){
794
+
795
+
796
+          for(let i=0;i<doctor_advices.length;i++){
797
+            doc_str +=doctor_advices[i].advice_name +" "+doctor_advices[i].prescribing_number+doctor_advices[i].prescribing_number_unit+" "+doctor_advices[i].delivery_way
798
+          }
799
+        }
800
+
801
+        if(predialysis_evaluation.blood_access_part_id == -2){
802
+          predialysis_evaluation.blood_access_part_id = ""
803
+        }
804
+
805
+        var str = " 患者今日来我科行血液透析治疗,血管通路选择:"+predialysis_evaluation.blood_access_part_id+ " "+this.QueryOperaById(predialysis_evaluation.blood_access_part_opera_id) +",透析模式:"+this.getModeId(prescription.mode_id)+
806
+        ",透前检查:"+predialysis_evaluation.internal_fistula +predialysis_evaluation.catheter + str_one +" "+ ",透析器:"+prescription.dialyzer_perfusion_apparatus + ",抗凝剂:"+this.GetAnticoagulant(prescription.anticoagulant) +",总量:"+prescription.anticoagulant_zongliang+"iu"+
807
+        ",透前体重:"+predialysis_evaluation.weight_before+"kg"+",间期体重增长:"+total +"kg"+",目标脱水量:"+prescription.target_ultrafiltration +"ml" +",血流量:"+prescription.blood_flow_volume+"ml/min" + ",透析开始时间:"+this.getTime(dialysis_order.start_time) +",透析过程中血压波动,"+"最大收缩压:"+monitor_one[0].systolic_blood_pressure+"mmHg"+",最小收缩压:"+monitor_one[monitor_one.length-1].systolic_blood_pressure
808
+        +"mmHg" +",最小舒张压:" +monitor_two[0].diastolic_blood_pressure+"mmHg" + ",最大舒张压:" + monitor_two[monitor_two.length-1].diastolic_blood_pressure +"mmHg" + ",最大脉搏:"+monitor_three[0].pulse_frequency+"次/分"+",最小脉搏:"+monitor_three[monitor_three.length-1].pulse_frequency+"次/分"+",透析结束时间:"+this.getTime(dialysis_order.end_time) +
809
+        ",实际治疗时长:"+ assessment_after_dislysis.actual_treatment_hour +"时"+assessment_after_dislysis.actual_treatment_minute+"分" +",实际超滤量:"+assessment_after_dislysis.actual_ultrafiltration+"ml"+",透后体重:"+assessment_after_dislysis.weight_after+"kg"+",透析过程顺利,安全下机" + " "
810
+        +",今日使用药品:"+doc_str +",患者下机后测血压,"+"收缩压:"+assessment_after_dislysis.systolic_blood_pressure+"mmHg"+",舒张压:"+assessment_after_dislysis.diastolic_blood_pressure+"mmHg"+",脉搏:"+assessment_after_dislysis.pulse_frequency +"次/分"
811
+
812
+        console.log("str000000000000000000222o2o2",str)
813
+           this.new_content =str
814
+          }
815
+        })
816
+
817
+      },
818
+
819
+      QueryOperaById(val){
820
+        var blood_access_part_opera = getDataConfig('hemodialysis', 'vascular_access_desc')
821
+        var name = ""
822
+        for(let i=0;i<blood_access_part_opera.length;i++){
823
+          if(val == blood_access_part_opera[i].id){
824
+              name = blood_access_part_opera[i].name
825
+          }
826
+        }
827
+        return name
828
+      },
636 829
       getModeId(mode_id){
637 830
         var mode_name = ""
638 831
         if(mode_id == 1){
@@ -776,10 +969,7 @@
776 969
         return anticoagulant_name
777 970
       },
778 971
       getTime (time) {
779
-      return uParseTime(time, '{y}-{m}-{d} {h}:{i}:{s}')
780
-      },
781
-      getTimeOne (time) {
782
-      return uParseTime(time, '{y}-{m}-{d}')
972
+      return uParseTime(time, '{y}-{m}-{d} {h}:{i}')
783 973
       },
784 974
     }
785 975
   }
@@ -882,4 +1072,11 @@
882 1072
       text-align: center;
883 1073
     }
884 1074
   }
1075
+  .course{
1076
+    .el-dialog{
1077
+      height: 90%;
1078
+      // position: fixed !important;
1079
+      // top: 10% !important;
1080
+    }
1081
+  }
885 1082
 </style>