Browse Source

自备药

XMLWAN 4 years ago
parent
commit
7cec3a2e8c

+ 4 - 2
src/api/advice.js View File

187
   });
187
   });
188
 }
188
 }
189
 
189
 
190
-export function UpdateAdviceTemplate(id, data) {
190
+export function UpdateAdviceTemplate(id, data,drug_id) {
191
+  
191
   return request({
192
   return request({
192
-    url: "/api/advicetemplate/update?id=" + id,
193
+    url: "/api/advicetemplate/update?id=" + id+"&drug_id="+drug_id,
193
     method: "put",
194
     method: "put",
194
     data: data
195
     data: data
195
   });
196
   });
285
 }
286
 }
286
 
287
 
287
 export function CreateSubAdvice(params) {
288
 export function CreateSubAdvice(params) {
289
+  
288
   return request({
290
   return request({
289
     url: "/api/subadvice/create",
291
     url: "/api/subadvice/create",
290
     method: "post",
292
     method: "post",

+ 351 - 36
src/xt_pages/data/druguseTemplate.vue View File

45
               >{{$t('table.add')}}
45
               >{{$t('table.add')}}
46
               </el-button>
46
               </el-button>
47
             </div>
47
             </div>
48
+
49
+
50
+
48
             <el-table
51
             <el-table
49
               :data="adviceTemplates"
52
               :data="adviceTemplates"
50
               border
53
               border
297
                 <el-button type="primary" @click="submitTableTemplate('form')">保 存</el-button>
300
                 <el-button type="primary" @click="submitTableTemplate('form')">保 存</el-button>
298
               </div>
301
               </div>
299
             </el-dialog>
302
             </el-dialog>
300
-            <el-dialog :title="dialogTitle" :visible.sync="templateFormVisible" width="700px">
303
+            <el-dialog :title="dialogTitle" :visible.sync="templateFormVisible" width="854px">
301
               <el-form
304
               <el-form
302
                 ref="templateForm"
305
                 ref="templateForm"
303
                 :rules="templateRules"
306
                 :rules="templateRules"
305
                 label-width="90px"
308
                 label-width="90px"
306
               >
309
               >
307
 
310
 
308
-                <el-row>
309
-                  <el-col :span="12">
310
-                    <el-form-item label="医嘱内容 :" required prop="advice_name">
311
-                      <el-input v-model="templateForm.advice_name"></el-input>
311
+                <el-row >
312
+                  <el-col :span="24">
313
+                    <el-form-item label="医嘱内容:" required prop="advice_name">
314
+                      <!-- <el-input v-model="templateForm.advice_name"></el-input> -->
315
+
316
+                      <el-select
317
+                        v-model="templateForm.advice_name"
318
+                        filterable
319
+                        clearable
320
+                        allow-create
321
+                        placeholder="请选择(输入可搜索)"
322
+                        style="width:200px"
323
+                        @change="changeDrugName"
324
+                    >
325
+                      <el-option
326
+                        v-for="(item,index) in all_drug"
327
+                        :key="index"
328
+                        :label="item.drug_name"
329
+                        :value="item.drug_name"
330
+                      ></el-option>
331
+                     </el-select>
312
                     </el-form-item>
332
                     </el-form-item>
313
                   </el-col>
333
                   </el-col>
314
 
334
 
315
 
335
 
316
 
336
 
317
-                  <el-col :span="12">
337
+                  <el-col :span="15">
318
                     <el-form-item label="药品规格 :" prop="advice_desc">
338
                     <el-form-item label="药品规格 :" prop="advice_desc">
319
                       <el-col :span="8">
339
                       <el-col :span="8">
320
-                        <el-input v-model="templateForm.advice_desc"></el-input>
340
+                        <!-- <el-input v-model="templateForm.advice_desc"></el-input> -->
341
+                         <el-select
342
+                          v-model="templateForm.advice_desc"
343
+                          filterable
344
+                          clearable
345
+                          allow-create
346
+                          placeholder="请选择(输入可搜索)"
347
+                          style="width:150px"
348
+                          @change="changeDrugDesc"
349
+                        >
350
+                        <el-option
351
+                          v-for="item in drugSpec"
352
+                          :key="item.id"
353
+                          :label="item.drug_spec"
354
+                          :value="item.drug_spec"
355
+                        ></el-option>
356
+                        </el-select>
321
                       </el-col>
357
                       </el-col>
322
                       <el-col class="line" :span="2">&nbsp;</el-col>
358
                       <el-col class="line" :span="2">&nbsp;</el-col>
323
                       <el-col :span="14">
359
                       <el-col :span="14">
468
             <!--TODO-->
504
             <!--TODO-->
469
 
505
 
470
 
506
 
471
-            <el-dialog :title="editDialogTitle" :visible.sync="templateEditFormVisible" width="700px">
507
+            <el-dialog :title="editDialogTitle" :visible.sync="templateEditFormVisible" width="854px">
472
               <el-form
508
               <el-form
473
                 ref="templateFormEdit"
509
                 ref="templateFormEdit"
474
                 :rules="templateEditRules"
510
                 :rules="templateEditRules"
476
                 label-width="90px"
512
                 label-width="90px"
477
               >
513
               >
478
                 <el-row>
514
                 <el-row>
479
-                  <el-col :span="12">
515
+                  <el-col :span="24">
480
                     <el-form-item :label="edit_advice_name" required prop="advice_name">
516
                     <el-form-item :label="edit_advice_name" required prop="advice_name">
481
-                      <el-input v-model="templateFormEdit.advice_name"></el-input>
517
+                      <!-- <el-input v-model="templateFormEdit.advice_name"></el-input> -->
518
+                       <el-select
519
+                            v-model="templateFormEdit.advice_name"
520
+                            filterable
521
+                            clearable
522
+                            allow-create
523
+                            placeholder="请选择(输入可搜索)"
524
+                            style="width:200px"
525
+                            @change="changeDrugNameTwo"
526
+                          >
527
+                            <el-option
528
+                              v-for="(item,index) in all_drug"
529
+                              :key="index"
530
+                              :label="item.drug_name"
531
+                              :value="item.drug_name"
532
+                            ></el-option>
533
+                          </el-select>
482
                     </el-form-item>
534
                     </el-form-item>
483
                   </el-col>
535
                   </el-col>
484
-                  <el-col :span="12">
536
+                  <el-col :span="15">
485
 
537
 
486
                     <el-form-item label="药品规格 :" prop="advice_desc">
538
                     <el-form-item label="药品规格 :" prop="advice_desc">
487
                       <el-col :span="8">
539
                       <el-col :span="8">
488
-                        <el-input v-model="templateFormEdit.advice_desc"></el-input>
540
+                        <!-- <el-input v-model="templateFormEdit.advice_desc"></el-input> -->
541
+                           <el-select
542
+                              v-model="templateFormEdit.advice_desc"
543
+                              filterable
544
+                              clearable
545
+                              allow-create
546
+                              placeholder="请选择(输入可搜索)"
547
+                              style="width:150px"
548
+                              @change="changeDrugDescTwo"
549
+                            >
550
+                              <el-option
551
+                                v-for="item in drugSpec"
552
+                                :key="item.id"
553
+                                :label="item.drug_spec"
554
+                                :value="item.drug_spec"
555
+                              ></el-option>
556
+                           </el-select>
489
                       </el-col>
557
                       </el-col>
490
                       <el-col class="line" :span="1">&nbsp;</el-col>
558
                       <el-col class="line" :span="1">&nbsp;</el-col>
491
                       <el-col :span="14">
559
                       <el-col :span="14">
708
             </el-dialog>
776
             </el-dialog>
709
 
777
 
710
 
778
 
711
-            <el-dialog title="新增医嘱" :visible.sync="templateFormTwoVisible" width="700px">
779
+            <el-dialog title="新增医嘱" :visible.sync="templateFormTwoVisible" width="854px">
712
               <el-form
780
               <el-form
713
                 ref="templateForm"
781
                 ref="templateForm"
714
                 :rules="templateEditRules"
782
                 :rules="templateEditRules"
716
                 label-width="90px"
784
                 label-width="90px"
717
               >
785
               >
718
                 <el-row>
786
                 <el-row>
719
-                  <el-col :span="12">
787
+                  <el-col :span="24">
720
                     <el-form-item label="医嘱内容 :" required prop="advice_name">
788
                     <el-form-item label="医嘱内容 :" required prop="advice_name">
721
-                      <el-input v-model="templateForm.advice_name"></el-input>
789
+                      <!-- <el-input v-model="templateForm.advice_name"></el-input> -->
790
+                    <el-select
791
+                        v-model="templateForm.advice_name"
792
+                        filterable
793
+                        clearable
794
+                        allow-create
795
+                        placeholder="请选择(输入可搜索)"
796
+                        style="width:200px"
797
+                        @change="changeDrugName"
798
+                    >
799
+                      <el-option
800
+                        v-for="(item,index) in all_drug"
801
+                        :key="index"
802
+                        :label="item.drug_name"
803
+                        :value="item.drug_name"
804
+                      ></el-option>
805
+                     </el-select>
722
                     </el-form-item>
806
                     </el-form-item>
723
                   </el-col>
807
                   </el-col>
724
-                  <el-col :span="12">
808
+                  <el-col :span="15">
725
 
809
 
726
                     <el-form-item label="药品规格 :" prop="advice_desc">
810
                     <el-form-item label="药品规格 :" prop="advice_desc">
727
                       <el-col :span="9">
811
                       <el-col :span="9">
728
-                        <el-input v-model="templateForm.advice_desc"></el-input>
812
+                        <!-- <el-input v-model="templateForm.advice_desc"></el-input> -->
813
+                      <el-select
814
+                          v-model="templateForm.advice_desc"
815
+                          filterable
816
+                          clearable
817
+                          allow-create
818
+                          placeholder="请选择(输入可搜索)"
819
+                          style="width:150px"
820
+                          @change="changeDrugDesc"
821
+                        >
822
+                        <el-option
823
+                          v-for="item in drugSpec"
824
+                          :key="item.id"
825
+                          :label="item.drug_spec"
826
+                          :value="item.drug_spec"
827
+                        ></el-option>
828
+                        </el-select>
729
                       </el-col>
829
                       </el-col>
730
                       <el-col class="line" :span="1">&nbsp;</el-col>
830
                       <el-col class="line" :span="1">&nbsp;</el-col>
731
                       <el-col :span="14">
831
                       <el-col :span="14">
1202
   import BreadCrumb from '@/xt_pages/components/bread-crumb'
1302
   import BreadCrumb from '@/xt_pages/components/bread-crumb'
1203
 
1303
 
1204
   import { getDataConfig } from '@/utils/data'
1304
   import { getDataConfig } from '@/utils/data'
1205
-
1305
+  import { getSelfMedicalList } from "@/api/drug/drug"
1206
   export default {
1306
   export default {
1207
     name: 'tab',
1307
     name: 'tab',
1208
     components: { BreadCrumb },
1308
     components: { BreadCrumb },
1295
           prescribing_number_unit: '',
1395
           prescribing_number_unit: '',
1296
           delivery_way: '',
1396
           delivery_way: '',
1297
           execution_frequency: '',
1397
           execution_frequency: '',
1298
-          id: 0
1398
+          id: 0,
1399
+          drug_id:"",
1400
+          way:""
1299
         },
1401
         },
1300
         dialogConfigVisible:false,
1402
         dialogConfigVisible:false,
1301
         templateFormEdit: {
1403
         templateFormEdit: {
1354
           { lable: 14, name: '外用溶液' },
1456
           { lable: 14, name: '外用溶液' },
1355
           { lable: 15, name: '软膏剂' },
1457
           { lable: 15, name: '软膏剂' },
1356
           { lable: 16, name: '胶剂' }
1458
           { lable: 16, name: '胶剂' }
1357
-        ]
1459
+        ],
1460
+         medicals:[],
1461
+         drugSpec:[],
1462
+         all_drug:[],
1463
+         current_drug_name:"",
1464
+         current_drug_spec: "",
1465
+         drug_id: 0,
1466
+         src_type:"",
1467
+         way:""
1358
       }
1468
       }
1359
     },
1469
     },
1360
     created() {
1470
     created() {
1362
       this.unitsOption = getDataConfig('hemodialysis', 'units')
1472
       this.unitsOption = getDataConfig('hemodialysis', 'units')
1363
       this.getDoctorAdviceConfig()
1473
       this.getDoctorAdviceConfig()
1364
       this.getDoctorInitConfig()
1474
       this.getDoctorInitConfig()
1475
+
1476
+       //获取自备药
1477
+      this.getSelfMedicalList()
1365
     },
1478
     },
1366
     methods: {
1479
     methods: {
1367
       initAdvice(){
1480
       initAdvice(){
1493
       },
1606
       },
1494
       onRowClick(row, event, column) {
1607
       onRowClick(row, event, column) {
1495
         this.table_current_index = row.index
1608
         this.table_current_index = row.index
1496
-      }, modifyRecordAction: function() {
1609
+      }, 
1610
+      modifyRecordAction: function() {
1497
         if (this.table_current_index == -1) {
1611
         if (this.table_current_index == -1) {
1498
           this.$message.error('请选择一条医嘱记录')
1612
           this.$message.error('请选择一条医嘱记录')
1499
           return
1613
           return
1522
           this.templateTableVisible = false
1636
           this.templateTableVisible = false
1523
         }).catch(() => {
1637
         }).catch(() => {
1524
         })
1638
         })
1525
-      }, submitTableTemplate(formName) {
1639
+      }, 
1640
+
1641
+      //添加医嘱模版
1642
+      submitTableTemplate(formName) {
1526
         if (this.adviceTableData.length <= 0) {
1643
         if (this.adviceTableData.length <= 0) {
1527
           this.$message.error('至少添加一条医嘱信息')
1644
           this.$message.error('至少添加一条医嘱信息')
1528
           return
1645
           return
1531
         const params = {
1648
         const params = {
1532
           'data': this.adviceTableData
1649
           'data': this.adviceTableData
1533
         }
1650
         }
1534
-        // this.form.name =  encodeURIComponent(this.form.name)
1651
+      
1535
         let name = encodeURIComponent(this.form.name)
1652
         let name = encodeURIComponent(this.form.name)
1653
+        console.log("params",params)
1654
+     
1536
         postAdviceTemplate(params, name, this.form.advice_type).then(response => {
1655
         postAdviceTemplate(params, name, this.form.advice_type).then(response => {
1656
+
1537
           if (response.data.state == 0) {
1657
           if (response.data.state == 0) {
1538
             this.$message.error(response.data.msg)
1658
             this.$message.error(response.data.msg)
1539
             return false
1659
             return false
1660
         })
1780
         })
1661
       },
1781
       },
1662
       submitTemplate(formName) {
1782
       submitTemplate(formName) {
1783
+
1784
+        
1785
+        if(this.src_type == ""){
1786
+            this.templateForm.way = 0
1787
+            this.templateForm.drug_id = 0
1788
+        }
1789
+
1790
+        if(this.src_type == 2){ //自备药
1791
+            var arr = this.templateForm.advice_name.split("(自备药)")
1792
+            this.templateForm.advice_name = arr[0]
1793
+        }
1794
+        
1663
         this.$refs[formName].validate(valid => {
1795
         this.$refs[formName].validate(valid => {
1664
           this.templateForm.single_dose = parseFloat(this.templateForm.single_dose)
1796
           this.templateForm.single_dose = parseFloat(this.templateForm.single_dose)
1665
           this.templateForm.prescribing_number = parseFloat(this.templateForm.prescribing_number)
1797
           this.templateForm.prescribing_number = parseFloat(this.templateForm.prescribing_number)
1685
             templateFormTwo.delivery_way = this.templateForm.delivery_way
1817
             templateFormTwo.delivery_way = this.templateForm.delivery_way
1686
             templateFormTwo.execution_frequency = this.templateForm.execution_frequency
1818
             templateFormTwo.execution_frequency = this.templateForm.execution_frequency
1687
             templateFormTwo.parent_id = this.parent_id
1819
             templateFormTwo.parent_id = this.parent_id
1820
+            templateFormTwo.drug_id = this.templateForm.drug_id
1821
+            templateFormTwo.way   = this.templateForm.way
1688
 
1822
 
1689
             if (this.isAddChild) {
1823
             if (this.isAddChild) {
1690
               CreateSubAdvice(templateFormTwo).then(response => {
1824
               CreateSubAdvice(templateFormTwo).then(response => {
1739
               templateFormTwo.delivery_way = this.templateForm.delivery_way
1873
               templateFormTwo.delivery_way = this.templateForm.delivery_way
1740
               templateFormTwo.execution_frequency = this.templateForm.execution_frequency
1874
               templateFormTwo.execution_frequency = this.templateForm.execution_frequency
1741
               templateFormTwo.parent_id = this.parent_id
1875
               templateFormTwo.parent_id = this.parent_id
1876
+              templateFormTwo.drug_id = this.templateForm.drug_id
1877
+              templateFormTwo.way  = this.templateForm.way
1742
 
1878
 
1743
               if (this.templateForm.frequency_type == 1) {
1879
               if (this.templateForm.frequency_type == 1) {
1744
                 templateFormTwo.frequency_type = this.templateForm.frequency_type
1880
                 templateFormTwo.frequency_type = this.templateForm.frequency_type
1783
                     this.adviceTableData[i].frequency_type = templateFormTwo.frequency_type
1919
                     this.adviceTableData[i].frequency_type = templateFormTwo.frequency_type
1784
                     this.adviceTableData[i].day_count = templateFormTwo.day_count
1920
                     this.adviceTableData[i].day_count = templateFormTwo.day_count
1785
                     this.adviceTableData[i].weekdays = templateFormTwo.weekdays
1921
                     this.adviceTableData[i].weekdays = templateFormTwo.weekdays
1922
+                    this.adviceTableData[i].drug_id =  templateFormTwo.drug_id
1923
+                    this.adviceTableData[i].way   = templateFormTwo.way
1924
+                    
1786
                   }
1925
                   }
1787
                 }
1926
                 }
1788
               } else {
1927
               } else {
1981
                 object['template_id'] = response.data.data.advice_templates[i].id
2120
                 object['template_id'] = response.data.data.advice_templates[i].id
1982
                 this.adviceTemplates.push(object)
2121
                 this.adviceTemplates.push(object)
1983
               }
2122
               }
1984
-
2123
+              
1985
               // 非空模版的处理
2124
               // 非空模版的处理
1986
               for (let y = 0; y < response.data.data.advice_templates[i].DoctorAdviceTemplate.length; y++) {
2125
               for (let y = 0; y < response.data.data.advice_templates[i].DoctorAdviceTemplate.length; y++) {
1987
                 if (response.data.data.advice_templates[i].id == response.data.data.advice_templates[i].DoctorAdviceTemplate[y].template_id) {
2126
                 if (response.data.data.advice_templates[i].id == response.data.data.advice_templates[i].DoctorAdviceTemplate[y].template_id) {
2011
       }, cancelEditHandle() {
2150
       }, cancelEditHandle() {
2012
         // this.templateTableVisible = true
2151
         // this.templateTableVisible = true
2013
         this.templateEditFormVisible = false
2152
         this.templateEditFormVisible = false
2014
-      }, submitEditTemplate(formName) {
2153
+      }, 
2154
+      
2155
+      //编辑医嘱
2156
+      submitEditTemplate(formName) {
2157
+         
2158
+         var drug_id = ""
2159
+         for(let i=0;i<this.all_drug.length;i++){
2160
+           if(this.templateFormEdit.advice_name == this.all_drug[i].drug_name){
2161
+              drug_id = this.all_drug[i].id
2162
+           }
2163
+         } 
2164
+        this.templateFormEdit.drug_id = drug_id
2165
+       
2166
+        
2015
         this.$refs[formName].validate(valid => {
2167
         this.$refs[formName].validate(valid => {
2016
           this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
2168
           this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
2017
           this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
2169
           this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
2040
                 return s && s.trim()
2192
                 return s && s.trim()
2041
               }).join(',')
2193
               }).join(',')
2042
             }
2194
             }
2043
-
2044
-            UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit).then(
2195
+           
2196
+            UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit,this.templateFormEdit.drug_id).then(
2045
               response => {
2197
               response => {
2046
                 if (response.data.state == 0) {
2198
                 if (response.data.state == 0) {
2047
                   this.$message.error(response.data.msg)
2199
                   this.$message.error(response.data.msg)
2064
                   this.adviceTemplates[this.currentIndex].day_count = template.day_count
2216
                   this.adviceTemplates[this.currentIndex].day_count = template.day_count
2065
                   this.adviceTemplates[this.currentIndex].week_days = template.week_days
2217
                   this.adviceTemplates[this.currentIndex].week_days = template.week_days
2066
                   this.adviceTemplates[this.currentIndex].frequency_type = template.frequency_type
2218
                   this.adviceTemplates[this.currentIndex].frequency_type = template.frequency_type
2219
+                  // this.adviceTemplates[this.currentIndex].drug_id = template.drug_id
2067
                   this.currentIndex = -1
2220
                   this.currentIndex = -1
2068
                   return false
2221
                   return false
2069
                 }
2222
                 }
2156
         this.table_current_index_two = row.index
2309
         this.table_current_index_two = row.index
2157
       }, cancelHandleTwo() {
2310
       }, cancelHandleTwo() {
2158
         this.templateFormTwoVisible = false
2311
         this.templateFormTwoVisible = false
2159
-      }, submitTemplateTwo(formName) {
2312
+      }, 
2313
+      submitTemplateTwo(formName) {
2314
+       
2160
         this.templateForm['template_id'] = this.current_template_id
2315
         this.templateForm['template_id'] = this.current_template_id
2161
         this.templateForm['advice_type'] = this.form.advice_type
2316
         this.templateForm['advice_type'] = this.form.advice_type
2162
-
2317
+       
2318
+      
2163
         if (this.templateForm.frequency_type == 1) {
2319
         if (this.templateForm.frequency_type == 1) {
2164
           this.templateForm.day_count = 0
2320
           this.templateForm.day_count = 0
2165
           this.templateForm.week_days = ''
2321
           this.templateForm.week_days = ''
2172
             return s && s.trim()
2328
             return s && s.trim()
2173
           }).join(',')
2329
           }).join(',')
2174
         }
2330
         }
2331
+
2332
+        // 编辑创建医嘱模版
2175
         CreateSingleAdviceTemplate(this.templateForm).then(response => {
2333
         CreateSingleAdviceTemplate(this.templateForm).then(response => {
2176
           if (response.data.state == 0) {
2334
           if (response.data.state == 0) {
2177
             this.$message.error(response.data.msg)
2335
             this.$message.error(response.data.msg)
2202
         this.adviceTableDataTwo = []
2360
         this.adviceTableDataTwo = []
2203
       }, cancelEditHandleTwo() {
2361
       }, cancelEditHandleTwo() {
2204
         this.templateEditFormTwoVisible = false
2362
         this.templateEditFormTwoVisible = false
2205
-      }, submitEditTemplateTwo(formName) {
2363
+      }, 
2364
+      submitEditTemplateTwo(formName) {
2206
         this.$refs[formName].validate(valid => {
2365
         this.$refs[formName].validate(valid => {
2207
           this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
2366
           this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
2208
           this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
2367
           this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
2290
         }
2449
         }
2291
       }, cellMouseLeave: function(row, column, cell, event) {
2450
       }, cellMouseLeave: function(row, column, cell, event) {
2292
         this.hoverOrderArr = []
2451
         this.hoverOrderArr = []
2293
-      }, openEdit(index, row) {
2294
-        console.log(row)
2452
+      },
2453
+
2454
+      // 修改医嘱模版
2455
+       openEdit(index, row) {
2456
+        console.log("row22222",row)
2295
         this.hoverOrderArr = []
2457
         this.hoverOrderArr = []
2296
         this.currentIndex = index
2458
         this.currentIndex = index
2297
         this.templateFormEdit.drug_spec_unit = row.drug_spec_unit
2459
         this.templateFormEdit.drug_spec_unit = row.drug_spec_unit
2309
         this.templateFormEdit.day_count = row.day_count
2471
         this.templateFormEdit.day_count = row.day_count
2310
         this.templateFormEdit.frequency_type = row.frequency_type
2472
         this.templateFormEdit.frequency_type = row.frequency_type
2311
         this.templateFormEdit.weekday = row.week_days.split(',')
2473
         this.templateFormEdit.weekday = row.week_days.split(',')
2312
-
2474
+        this.templateFormEdit.drug_id = row.drug_id
2475
+        this.templateFormEdit.way  = row.way
2313
         this.templateEditFormVisible = true
2476
         this.templateEditFormVisible = true
2314
         if (row.parent_id > 0) {
2477
         if (row.parent_id > 0) {
2315
           this.editDialogTitle = '编辑子药'
2478
           this.editDialogTitle = '编辑子药'
2318
           this.editDialogTitle = '编辑医嘱'
2481
           this.editDialogTitle = '编辑医嘱'
2319
           this.edit_advice_name = '医嘱内容'
2482
           this.edit_advice_name = '医嘱内容'
2320
         }
2483
         }
2321
-      }, openDelete(index, row) {
2484
+      }, 
2485
+      openDelete(index, row) {
2322
         this.hoverOrderArr = []
2486
         this.hoverOrderArr = []
2323
 
2487
 
2324
         this.$confirm('删除记录', '是否删除该医嘱', {
2488
         this.$confirm('删除记录', '是否删除该医嘱', {
2481
           }
2645
           }
2482
         })
2646
         })
2483
         this.sameRowArr = sameRowArr
2647
         this.sameRowArr = sameRowArr
2484
-      }, handleUpdateAdviceTemplate(row, index) {
2648
+      },
2649
+       handleUpdateAdviceTemplate(row, index) {
2485
         this.current_template_id = row.template_id
2650
         this.current_template_id = row.template_id
2486
         this.current_template_name = row.name
2651
         this.current_template_name = row.name
2487
         this.form.name = row.name
2652
         this.form.name = row.name
2493
             this.adviceTableDataTwo.push(this.adviceTemplates[i])
2658
             this.adviceTableDataTwo.push(this.adviceTemplates[i])
2494
           }
2659
           }
2495
         }
2660
         }
2496
-      }, modifyTemplateName() {
2661
+      }, 
2662
+      modifyTemplateName() {
2497
         const params = {
2663
         const params = {
2498
           template_name: this.form.name,
2664
           template_name: this.form.name,
2499
           template_id: this.current_template_id
2665
           template_id: this.current_template_id
2500
         }
2666
         }
2667
+        console.log("params---",params)
2668
+        return 
2501
         updateTemplateName(params).then(response => {
2669
         updateTemplateName(params).then(response => {
2502
           if (response.data.state == 0) {
2670
           if (response.data.state == 0) {
2503
             this.$message.error(response.data.msg)
2671
             this.$message.error(response.data.msg)
2534
         })
2702
         })
2535
 
2703
 
2536
       },
2704
       },
2705
+
2706
+      rand(min, max) {
2707
+        return Math.floor(Math.random() * (max - min)) + min;
2708
+     },
2709
+    //
2710
+    getSelfMedicalList(){
2711
+        const params = {
2712
+          patient_id:this.$route.query.patient_id
2713
+        }
2714
+      getSelfMedicalList(params).then(response=>{
2715
+         if (response.data.state == 1) {
2716
+            this.arr_drug = []
2717
+            var medicalList = response.data.data.private_drug_list
2718
+            var base_drug_list = response.data.data.base_drug_list
2719
+            var base_drug_cofig = response.data.data.base_drug_config
2720
+            var private_drug_cofig = response.data.data.private_drug_config
2721
+
2722
+
2723
+            if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
2724
+
2725
+              for (let i = 0; i < medicalList.length; i++) {
2726
+                if(medicalList[i].drug_specs != null) {
2727
+                  for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
2728
+                    medicalList[i].drug_specs[a]['type'] = 2
2729
+                  }
2730
+                }
2731
+                let obj = {
2732
+                  drug_name: "",
2733
+                  drug_desc: "",
2734
+                  delivery_way: "",
2735
+                  execution_frequency: "",
2736
+                  single_dose: "",
2737
+                  single_dose_unit: "",
2738
+                  prescribing_number: "",
2739
+                  prescribing_number_unit: "",
2740
+                  type_id: "",
2741
+                  type: "",
2742
+                  custom_id: "",
2743
+                  drug_specs: [],
2744
+                  id:"",
2745
+                }
2746
+
2747
+                medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
2748
+                obj.drug_name = medicalList[i].drug_name
2749
+                obj.delivery_way = medicalList[i].delivery_way
2750
+                obj.execution_frequency = medicalList[i].execution_frequency
2751
+                obj.single_dose = medicalList[i].single_dose
2752
+                obj.prescribing_number = medicalList[i].prescribing_number
2753
+                obj.type_id = medicalList[i].id
2754
+                obj.type = 2
2755
+                obj.custom_id = this.rand(10000000, 99999999)
2756
+                obj.drug_specs = medicalList[i].drug_specs
2757
+                obj.id = medicalList[i].id
2758
+                this.all_drug.push(obj)
2759
+              }
2760
+            }
2761
+
2762
+
2763
+            for (let i = 0; i < base_drug_list.length; i++) {
2764
+              if(base_drug_list[i].drug_specs != null) {
2765
+                for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
2766
+                  base_drug_list[i].drug_specs[a]['type'] = 1
2767
+                }
2768
+              }
2769
+                let obj = {
2770
+                  drug_name: "",
2771
+                  drug_desc: "",
2772
+                  delivery_way: "",
2773
+                  execution_frequency: "",
2774
+                  single_dose: "",
2775
+                  single_dose_unit: "",
2776
+                  prescribing_number: "",
2777
+                  prescribing_number_unit: "",
2778
+                  type_id: "",
2779
+                  type: "",
2780
+                  custom_id: "",
2781
+                  drug_specs: [],
2782
+                  id:""
2783
+                }
2784
+
2785
+                obj.drug_name = base_drug_list[i].drug_name
2786
+                obj.delivery_way = base_drug_list[i].delivery_way
2787
+                obj.execution_frequency = base_drug_list[i].execution_frequency
2788
+                obj.single_dose = base_drug_list[i].single_dose
2789
+                obj.prescribing_number = base_drug_list[i].prescribing_number
2790
+                obj.type_id = base_drug_list[i].id
2791
+                obj.type = 1
2792
+                obj.custom_id = this.rand(10000000, 99999999)
2793
+                obj.drug_specs = base_drug_list[i].drug_specs
2794
+                obj.id = base_drug_list[i].id
2795
+                this.all_drug.push(obj)
2796
+              }
2797
+            }   
2798
+        })
2799
+       
2800
+    },
2801
+    changeDrugName(name){
2802
+       this.current_drug_name = name
2803
+       this.templateForm.advice_desc = ''
2804
+      this.drugSpec = []
2805
+      for (let i = 0; i < this.all_drug.length; i++) {
2806
+        if (this.all_drug[i].drug_name == name) {
2807
+            this.drugSpec = this.all_drug[i].drug_specs
2808
+          }
2809
+       }
2810
+    },
2811
+    changeDrugDesc(name) {
2812
+        this.current_drug_spec = name
2813
+        for (let i = 0; i < this.drugSpec.length; i++) {
2814
+          if (this.drugSpec[i].drug_spec == name) {
2815
+            this.templateForm.advice_desc = this.drugSpec[i].drug_spec
2816
+            this.templateForm.prescribing_number = this.drugSpec[i].prescribing_number.toString()
2817
+            this.templateForm.single_dose = this.drugSpec[i].single_dose.toString()
2818
+            this.templateForm.delivery_way = this.drugSpec[i].delivery_way.toString()
2819
+            this.templateForm.execution_frequency = this.drugSpec[i].execution_frequency.toString()
2820
+            this.drug_id = this.drugSpec[i].id
2821
+            this.src_type = this.drugSpec[i].type
2822
+            this.templateForm.drug_id = this.drugSpec[i].id
2823
+            this.templateForm.way = this.drugSpec[i].type
2824
+          }
2825
+        }
2826
+      },
2827
+
2828
+      changeDrugNameTwo(name){
2829
+        this.current_drug_name = name
2830
+        this.templateFormEdit.advice_desc = ''
2831
+        this.drugSpec = []
2832
+        for (let i = 0; i < this.all_drug.length; i++) {
2833
+          if (this.all_drug[i].drug_name == name) {
2834
+              this.drugSpec = this.all_drug[i].drug_specs
2835
+            }
2836
+        }
2837
+      },
2838
+
2839
+      changeDrugDescTwo(name) {
2840
+        this.current_drug_spec = name
2841
+        for (let i = 0; i < this.drugSpec.length; i++) {
2842
+          if (this.drugSpec[i].drug_spec == name) {
2843
+            this.templateFormEdit.advice_desc = this.drugSpec[i].drug_spec
2844
+            this.templateFormEdit.prescribing_number = this.drugSpec[i].prescribing_number.toString()
2845
+            this.templateFormEdit.single_dose = this.drugSpec[i].single_dose.toString()
2846
+            this.templateFormEdit.delivery_way = this.drugSpec[i].delivery_way.toString()
2847
+            this.templateFormEdit.execution_frequency = this.drugSpec[i].execution_frequency.toString()
2848
+          }
2849
+        }
2850
+      },
2851
+
2537
     }
2852
     }
2538
   }
2853
   }
2539
 </script>
2854
 </script>

+ 2 - 28
src/xt_pages/dialysis/details/dialog/adviceDialog/AddGroupAdvice.vue View File

844
         .catch(() => {});
844
         .catch(() => {});
845
     },
845
     },
846
     submitNameForm(formName) {
846
     submitNameForm(formName) {
847
-      console.log("=====",this.src_type)
847
+      
848
        if(this.src_type == ""){
848
        if(this.src_type == ""){
849
           this.nameForm.way = 0
849
           this.nameForm.way = 0
850
           this.nameForm.drug_id = 0
850
           this.nameForm.drug_id = 0
854
           var arr = this.nameForm.advice_name.split("(自备药)")
854
           var arr = this.nameForm.advice_name.split("(自备药)")
855
           this.nameForm.advice_name = arr[0]
855
           this.nameForm.advice_name = arr[0]
856
        }
856
        }
857
-      // if(typeof(this.nameForm.advice_name) == "string"){
858
-         
859
-      //     this.nameForm.advice_name == this.nameForm.advice_name
860
-      // }
861
-
862
-      // if(typeof(this.nameForm.advice_name) == "number"){
863
-      //     var drug_name = ""
864
-      //     var name = ""
865
-      //     var way = 0
866
-      //     this.nameForm.drug_id = this.nameForm.advice_name
867
-      //     for(let i=0;i<this.medicals.length;i++){
868
-      //       if(this.nameForm.advice_name == this.medicals[i].id){
869
-      //         name = this.medicals[i].drug_name
870
-      //         way  = this.medicals[i].way
871
-      //       }
872
-      //     }
873
-      //     if(way == 1){
874
-      //       drug_name = name
875
-      //     }
876
-      //     if(way == 2){
877
-      //       var arr = name.split("(自备药)")
878
-      //       drug_name = arr[0]
879
-      //     }
880
-          
881
-      //     this.nameForm.advice_name = drug_name
882
-      //     this.nameForm.way = way
883
-      // }
857
+   
884
       
858
       
885
       var _this = this;
859
       var _this = this;
886
       this.$refs[formName].validate(valid => {
860
       this.$refs[formName].validate(valid => {

+ 5 - 1
src/xt_pages/stock/selfPreparedMedicine/components/medicineDetail.vue View File

104
             drug_spec:"",
104
             drug_spec:"",
105
             patient_id:"",
105
             patient_id:"",
106
             type:1,
106
             type:1,
107
-            start_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
107
+            // start_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
108
+            start_time: moment(new Date()).subtract(30,'days').format('YYYY-MM-DD'),
108
             end_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
109
             end_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
109
             staffList:[]
110
             staffList:[]
110
         }
111
         }
200
     },
201
     },
201
 
202
 
202
     created(){
203
     created(){
204
+    
203
       this.getCurrentOrgAllStaff() 
205
       this.getCurrentOrgAllStaff() 
206
+
207
+
204
     }
208
     }
205
 }
209
 }
206
 </script>
210
 </script>

+ 20 - 11
src/xt_pages/stock/selfPreparedMedicine/query.vue View File

125
             // end_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
125
             // end_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
126
             start_time:"",
126
             start_time:"",
127
             end_time:"",
127
             end_time:"",
128
-            drug_name:"全部",
128
+            drug_name:0,
129
             drug_spec:"",
129
             drug_spec:"",
130
             drugName:[],
130
             drugName:[],
131
             rulleName:[]
131
             rulleName:[]
203
         this.getlist()
203
         this.getlist()
204
       },
204
       },
205
       changeDrugName(id){
205
       changeDrugName(id){
206
-        var drug_name = ""
207
-        for(let i=0;i<this.drugName.length;i++){
208
-          if(id == this.drugName[i].id){
209
-             drug_name = this.drugName[i].drug_name
206
+        if(id == 0){
207
+          this.drug_name = 0
208
+        }
209
+        if(id != 0 ){
210
+          var drug_name = ""
211
+          for(let i=0;i<this.drugName.length;i++){
212
+            if(id == this.drugName[i].id){
213
+              drug_name = this.drugName[i].drug_name
214
+            }
210
           }
215
           }
216
+          this.drug_name = drug_name
217
+          this.getRulleName(id)  
211
         }
218
         }
212
-        this.drug_name = drug_name
213
-        this.getRulleName(id)
214
         this.getlist()
219
         this.getlist()
215
       },
220
       },
216
       changeRullName(id){
221
       changeRullName(id){
225
         this.getlist()
230
         this.getlist()
226
       },
231
       },
227
       getlist(){
232
       getlist(){
228
-          if(this.drug_name == "全部"){
229
-            this.drug_name = ""
233
+         var name = ""
234
+          if(this.drug_name == 0){
235
+             name = ""
236
+          }
237
+          if(this.drug_name != 0){
238
+             name = this.drug_name
230
           }
239
           }
231
           if(this.drug_spec == "全部"){
240
           if(this.drug_spec == "全部"){
232
             this.drug_spec = ""
241
             this.drug_spec = ""
234
           const params = {
243
           const params = {
235
             start_time:this.start_time,
244
             start_time:this.start_time,
236
             end_time:this.end_time,
245
             end_time:this.end_time,
237
-            drug_name:this.drug_name,
246
+            drug_name:name,
238
             drug_spec:this.drug_spec,
247
             drug_spec:this.drug_spec,
239
             search_input:this.search_input
248
             search_input:this.search_input
240
           }
249
           }
241
-         
250
+         console.log("params9999999",params)
242
         getAllPatientStockList(params).then(response=>{
251
         getAllPatientStockList(params).then(response=>{
243
             if(response.data.state == 1){
252
             if(response.data.state == 1){
244
               var stocklist = response.data.data.stocklist
253
               var stocklist = response.data.data.stocklist