Browse Source

自备药

XMLWAN 4 years ago
parent
commit
9849d24b8c

+ 2 - 1
src/xt_pages/dialysis/details/dialog/DoctorAdviceDialog.vue View File

@@ -768,6 +768,7 @@
768 768
         this.form['dialysis_order_id'] = this.dialysis_order.id
769 769
       },
770 770
       doctor_advices: function() {
771
+       
771 772
         this.handleSpanTempArr()
772 773
         this.hoverOrderArr = []
773 774
         this.handleStyle()
@@ -840,6 +841,7 @@
840 841
               adviceNames: this.other_doctor_advices,
841 842
               remark: ''
842 843
             }
844
+         
843 845
             let mode = '1'
844 846
             CreateGroupAdvice(this.patientid, 0, submitForm, mode).then(
845 847
               response => {
@@ -1176,7 +1178,6 @@
1176 1178
         }
1177 1179
         this.exceLoading = true
1178 1180
         let mode = '6'
1179
-
1180 1181
         ExecDoctorAdvice(this.patient.id, this.currentRow.id, this.execTime, mode).then(response => {
1181 1182
             if (response.data.state == 0) {
1182 1183
               this.$message.error(response.data.msg)

+ 124 - 56
src/xt_pages/dialysis/details/dialog/adviceDialog/AddGroupAdvice.vue View File

@@ -385,7 +385,7 @@
385 385
                   v-for="item in medicals"
386 386
                   :key="item.id"
387 387
                   :label="item.drug_name"
388
-                  :value="item.drug_name"
388
+                  :value="item.id"
389 389
                 ></el-option>
390 390
               </el-select>
391 391
             </el-form-item>
@@ -568,6 +568,7 @@ import {
568 568
 } from "@/api/advice";
569 569
 
570 570
 import {getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
571
+import { duration } from 'moment';
571 572
 export default {
572 573
   name: "AddGroupAdvice",
573 574
   data() {
@@ -611,7 +612,9 @@ export default {
611 612
         isEdit: 0,
612 613
         index: 0,
613 614
         id: 0,
614
-        children: []
615
+        children: [],
616
+        drug_id:"",
617
+        way:"",
615 618
       },
616 619
       submitGroupForm: {
617 620
         advice_type: "",
@@ -629,13 +632,15 @@ export default {
629 632
         adviceNames: [],
630 633
         advice_doctor: "",
631 634
         remark: "",
632
-        parent_id: 0
635
+        parent_id: 0,
636
+        drug_id:"",
637
+        way:"",
633 638
       },
634 639
       selectedTemp: { id: 0, name: "", org_id: 0, list: [], rows: [] },
635 640
       selectedTemplate: [],
636 641
       allSelectedTemplate: [],
637 642
       medicals:[],
638
-      drugSpec:[],
643
+      drugSpec:[]
639 644
     };
640 645
   },
641 646
   props: {
@@ -686,6 +691,7 @@ export default {
686 691
   },
687 692
   methods: {
688 693
     submitgroupAdvice(formName) {
694
+      
689 695
       this.$refs[formName].validate(valid => {
690 696
         if (valid) {
691 697
           var submitForm = {
@@ -697,7 +703,8 @@ export default {
697 703
             remark: this.groupForm.remark,
698 704
             parent_id: this.groupForm.parent_id
699 705
           };
700
-
706
+          
707
+          console.log("888888",this.groupForm.adviceNames)
701 708
           var adviceNames = [];
702 709
           for (const index in this.groupForm.adviceNames) {
703 710
             adviceNames.unshift(this.groupForm.adviceNames[index]);
@@ -705,7 +712,9 @@ export default {
705 712
           submitForm.adviceNames = adviceNames;
706 713
           let mode = "1";
707 714
           
708
-        
715
+     
716
+          console.log("88888888",submitForm)
717
+ 
709 718
           CreateGroupAdvice(this.patientID, 0, submitForm, mode).then(
710 719
             response => {
711 720
               if (response.data.state == 0) {
@@ -827,16 +836,40 @@ export default {
827 836
         .catch(() => {});
828 837
     },
829 838
     submitNameForm(formName) {
830
-      //截取自备药名称
831
-      var arr = this.nameForm.advice_name.split("(自备药)")
832
-      this.nameForm.advice_name = arr[0]
839
+      
840
+      if(typeof(this.nameForm.advice_name) == "string"){
841
+         
842
+          this.nameForm.advice_name == this.nameForm.advice_name
843
+      }
833 844
 
845
+      if(typeof(this.nameForm.advice_name) == "number"){
846
+          var drug_name = ""
847
+          var name = ""
848
+          var way = 0
849
+          this.nameForm.drug_id = this.nameForm.advice_name
850
+          for(let i=0;i<this.medicals.length;i++){
851
+            if(this.nameForm.advice_name == this.medicals[i].id){
852
+              name = this.medicals[i].drug_name
853
+              way  = this.medicals[i].way
854
+            }
855
+          }
856
+          if(way == 1){
857
+            drug_name = name
858
+          }
859
+          if(way == 2){
860
+            var arr = name.split("(自备药)")
861
+            drug_name = arr[0]
862
+          }
863
+          
864
+          this.nameForm.advice_name = drug_name
865
+          this.nameForm.way = way
866
+      }
867
+      
834 868
       var _this = this;
835 869
       this.$refs[formName].validate(valid => {
836 870
         if (valid) {
837 871
           if (_this.nameForm.isEdit) {
838
-            var ale = _this.groupForm.adviceNames.length;
839
-            console.log("进来诶呦")
872
+            var ale = _this.groupForm.adviceNames.length; 
840 873
             if (_this.isChild) {
841 874
               for (let index = 0; index < ale; index++) {
842 875
                 if (_this.groupSelectRow.parent_row ==_this.groupForm.adviceNames[index].row_key) {
@@ -856,7 +889,10 @@ export default {
856 889
                       _this.groupForm.adviceNames[index].children[j].delivery_way = _this.nameForm.delivery_way;
857 890
                       _this.groupForm.adviceNames[index].children[j].execution_frequency =_this.nameForm.execution_frequency;
858 891
                       _this.groupForm.adviceNames[index].children[j].remark =_this.nameForm.remark;
892
+                      _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
893
+                      _this.groupForm.adviceNames[index].children[j].way = this.nameForm.way;
859 894
                       _this.$set(_this.groupForm.adviceNames[index].children,j,_this.groupForm.adviceNames[index].children[j]
895
+                     
860 896
                       );
861 897
                       break;
862 898
                     }
@@ -877,7 +913,8 @@ export default {
877 913
                   _this.groupForm.adviceNames[index].delivery_way =_this.nameForm.delivery_way;
878 914
                   _this.groupForm.adviceNames[index].execution_frequency =_this.nameForm.execution_frequency;
879 915
                   _this.groupForm.adviceNames[index].remark =_this.nameForm.remark;
880
-
916
+                  _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
917
+                  _this.groupForm.adviceNames[index].children[j].way = this.nameForm.way;
881 918
                   _this.$set(
882 919
                     _this.groupForm.adviceNames,
883 920
                     index,
@@ -1271,8 +1308,6 @@ export default {
1271 1308
               }
1272 1309
               this.$set(item, "children", item.children);
1273 1310
             }
1274
-            console.log("11122333")
1275
-            console.log(item)
1276 1311
             this.allSelectedTemplate.unshift(item);
1277 1312
             adviceTemplate.DoctorAdviceTemplate[index].selection = false;
1278 1313
           }
@@ -1359,40 +1394,16 @@ export default {
1359 1394
             for (const index in _this.adviceTemplateMaps[mapid]
1360 1395
               .DoctorAdviceTemplate) {
1361 1396
               this.editRowKey++;
1362
-              var item = {
1363
-                advice_name:
1364
-                  _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
1365
-                    .advice_name,
1366
-                advice_desc:
1367
-                  _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
1368
-                    .advice_desc,
1369
-                single_dose:
1370
-                  "" +
1371
-                  _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
1372
-                    .single_dose,
1373
-                single_dose_unit:
1374
-                  _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
1375
-                    .single_dose_unit,
1376
-                drug_spec:
1377
-                  "" +
1378
-                  _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
1379
-                    .drug_spec,
1380
-                drug_spec_unit:
1381
-                  _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
1382
-                    .drug_spec_unit,
1383
-                prescribing_number:
1384
-                  "" +
1385
-                  _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
1386
-                    .prescribing_number,
1387
-                prescribing_number_unit:
1388
-                  _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
1389
-                    .prescribing_number_unit,
1390
-                delivery_way:
1391
-                  _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
1392
-                    .delivery_way,
1393
-                execution_frequency:
1394
-                  _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
1395
-                    .execution_frequency,
1397
+              var item = {advice_name:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_name,
1398
+                advice_desc:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_desc,
1399
+                single_dose:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose,
1400
+                single_dose_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose_unit,
1401
+                drug_spec:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
1402
+                drug_spec_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
1403
+                prescribing_number:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number,
1404
+                prescribing_number_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number_unit,
1405
+                delivery_way:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].delivery_way,
1406
+                execution_frequency:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
1396 1407
                 isEdit: 0,
1397 1408
                 id: 0,
1398 1409
                 children: [],
@@ -1516,25 +1527,82 @@ export default {
1516 1527
       getSelfMedicalList(params).then(response=>{
1517 1528
           if(response.data.state == 1){
1518 1529
             var medicalList =  response.data.data.medicalList
1530
+            //way字段区分数据源:1代表来自基础库  2代表来自药品库
1531
+            for(let i=0;i<medicalList.length;i++){
1532
+               medicalList[i].way = 2
1533
+            }
1519 1534
             for(let i=0;i<medicalList.length;i++){
1520 1535
                medicalList[i].drug_name = medicalList[i].drug_name+"(自备药)"
1521 1536
             }
1522
-            this.medicals = medicalList
1537
+            var drugname = response.data.data.drugName
1538
+            for(let i=0;i<drugname.length;i++){
1539
+               drugname[i].way = 1
1540
+            }
1541
+
1542
+            drugname.push(...medicalList)
1543
+            
1544
+            this.medicals = drugname
1523 1545
           }
1524 1546
       })
1525 1547
     },
1526
-    changeDrugName(name){
1527
-       console.log("name",name)
1528
-      var arr = name.split("(自备药)");
1548
+    changeDrugName(id){
1549
+      var drug_name = ""
1550
+      var name = ""
1551
+      var way = 0
1552
+      for(let i=0;i<this.medicals.length;i++){
1553
+        if(id == this.medicals[i].id){
1554
+          name = this.medicals[i].drug_name
1555
+          way  = this.medicals[i].way
1556
+        }
1557
+      }
1558
+      if(way == 1){
1559
+        drug_name = name
1560
+      }
1561
+      if(way == 2){
1562
+        var arr = name.split("(自备药)")
1563
+        drug_name = arr[0]
1564
+      }
1529 1565
         const params = {
1530
-          drug_name:arr[0],
1531
-          patient_id:this.$route.query.patient_id
1566
+          drug_name:drug_name,
1567
+          patient_id:this.$route.query.patient_id,
1568
+          way:way,
1569
+          id:id,
1532 1570
         }
1533
-        console.log("params",params)
1534 1571
       getDrugDescByDrugName(params).then(response=>{
1535 1572
           if(response.data.state == 1){
1536 1573
              var drugspec = response.data.data.drugspec
1537
-             console.log("drugspec",drugspec)
1574
+          
1575
+             if(drugspec[0].drug_spec !=0){
1576
+                this.nameForm.advice_desc = drugspec[0].drug_spec
1577
+             }
1578
+             if(drugspec[0].min_unit!=0){
1579
+                 this.nameForm.drug_spec_unit = drugspec[0].min_unit
1580
+             }
1581
+             if(drugspec[0].delivery_way!=0){
1582
+                 this.nameForm.delivery_way = drugspec[0].delivery_way
1583
+             }
1584
+             if(drugspec[0].execution_frequency!=0){
1585
+                this.nameForm.execution_frequency = drugspec[0].execution_frequency
1586
+             }
1587
+             if(drugspec[0].single_dose !=0){
1588
+                this.nameForm.single_dose = drugspec[0].single_dose.toString()
1589
+             } 
1590
+             if(drugspec[0].min_unit !=0){
1591
+               this.nameForm.single_dose_unit = drugspec[0].min_unit
1592
+             }
1593
+             if(drugspec[0].min_unit!=0){
1594
+               this.nameForm.prescribing_number_unit = drugspec[0].min_unit
1595
+             }
1596
+              
1597
+             if( drugspec[0].prescribing_number!=0){
1598
+                this.nameForm.prescribing_number = drugspec[0].prescribing_number.toString()
1599
+             }
1600
+             var countInfo = response.data.data.countInfo
1601
+             console.log("countInfo",countInfo)
1602
+             var countOut = response.data.data.countout
1603
+             console.log("countout",countOut)
1604
+             var arr = countInfo[0].Count - countOut[0].Count
1605
+             console.log("arr222",arr)
1538 1606
              this.drugSpec = drugspec
1539 1607
           }
1540 1608
       })

+ 166 - 10
src/xt_pages/dialysis/details/dialog/adviceDialog/EditGroupAdvice.vue View File

@@ -358,30 +358,63 @@
358 358
     <el-dialog
359 359
       :title="nameFormTitle"
360 360
       :visible.sync="nameFormVisible"
361
-      width="700px"
361
+      width="800px"
362 362
     >
363 363
       <el-form
364 364
         ref="nameForm"
365 365
         :rules="nameRules"
366 366
         :model="nameForm"
367
-        label-width="90px"
367
+        label-width="120px"
368 368
       >
369 369
         <el-row>
370
-          <el-col :span="12">
370
+          <el-col :span="10">
371 371
             <el-form-item label="医嘱内容 :" required prop="advice_name">
372
-              <el-input v-model="nameForm.advice_name"></el-input>
372
+              <!-- <el-input v-model="nameForm.advice_name"></el-input> -->
373
+               <el-select
374
+                v-model="nameForm.advice_name"
375
+                filterable
376
+                clearable
377
+                allow-create
378
+                :disabled="isChild"
379
+                placeholder="请选择(输入可搜索)"
380
+                style="width:200px"
381
+                @change="changeDrugName"
382
+              >
383
+                <el-option
384
+                  v-for="item in medicals"
385
+                  :key="item.id"
386
+                  :label="item.drug_name"
387
+                  :value="item.id"
388
+                ></el-option>
389
+              </el-select>
373 390
             </el-form-item>
374 391
           </el-col>
375
-          <el-col :span="12">
392
+          <el-col :span="14">
376 393
             <!--<el-form-item label="规格 :" prop="advice_desc">-->
377 394
             <!--<el-input v-model="nameForm.advice_desc"></el-input>-->
378 395
             <!--</el-form-item>-->
379 396
             <el-form-item label="药品规格 :" prop="advice_desc">
380
-              <el-col :span="8">
381
-                <el-input v-model="nameForm.advice_desc"></el-input>
397
+              <el-col :span="10">
398
+                <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
399
+                 <el-select
400
+                  v-model="nameForm.advice_desc"
401
+                  filterable
402
+                  clearable
403
+                  allow-create
404
+                  :disabled="isChild"
405
+                  placeholder="请选择(输入可搜索)"
406
+                  style="width:150px"
407
+                >
408
+                  <el-option
409
+                    v-for="item in drugSpec"
410
+                    :key="item.id"
411
+                    :label="item.drug_spec"
412
+                    :value="item.drug_spec"
413
+                  ></el-option>
414
+                 </el-select>
382 415
               </el-col>
383 416
               <el-col class="line" :span="2">&nbsp;</el-col>
384
-              <el-col :span="14">
417
+              <el-col :span="10">
385 418
                 <el-select
386 419
                   v-model="nameForm.drug_spec_unit"
387 420
                   filterable
@@ -520,7 +553,7 @@ import {
520 553
   SaveEditAdvices
521 554
 } from "@/api/advice";
522 555
 import { jsGetAge, uParseTime } from "@/utils/tools";
523
-
556
+import { getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
524 557
 export default {
525 558
   name: "AddGroupAdvice",
526 559
   data() {
@@ -585,7 +618,9 @@ export default {
585 618
       adminusername: "",
586 619
       selectedTemp: { id: 0, name: "", org_id: 0, list: [], rows: [] },
587 620
       selectedTemplate: [],
588
-      allSelectedTemplate: []
621
+      allSelectedTemplate: [],
622
+      medicals:[],
623
+      drugSpec:[]
589 624
     };
590 625
   },
591 626
   props: {
@@ -794,6 +829,33 @@ export default {
794 829
         .catch(() => {});
795 830
     },
796 831
     submitNameForm(formName) {
832
+       if(typeof(this.nameForm.advice_name) == "string"){
833
+         
834
+          this.nameForm.advice_name == this.nameForm.advice_name
835
+      }
836
+
837
+      if(typeof(this.nameForm.advice_name) == "number"){
838
+          var drug_name = ""
839
+          var name = ""
840
+          var way = 0
841
+          this.nameForm.drug_id = this.nameForm.advice_name
842
+          for(let i=0;i<this.medicals.length;i++){
843
+            if(this.nameForm.advice_name == this.medicals[i].id){
844
+              name = this.medicals[i].drug_name
845
+              way  = this.medicals[i].way
846
+            }
847
+          }
848
+          if(way == 1){
849
+            drug_name = name
850
+          }
851
+          if(way == 2){
852
+            var arr = name.split("(自备药)")
853
+            drug_name = arr[0]
854
+          }
855
+          
856
+          this.nameForm.advice_name = drug_name
857
+          this.nameForm.way = way
858
+      }
797 859
       var _this = this;
798 860
       this.$refs[formName].validate(valid => {
799 861
         if (valid) {
@@ -2161,12 +2223,106 @@ export default {
2161 2223
           this.groupEditFormVisible = false;
2162 2224
         }
2163 2225
       });
2226
+    },
2227
+   getSelfMedicalList(){
2228
+        const params = {
2229
+          patient_id:this.$route.query.patient_id
2230
+        }
2231
+      getSelfMedicalList(params).then(response=>{
2232
+          if(response.data.state == 1){
2233
+            var medicalList =  response.data.data.medicalList
2234
+            //way字段区分数据源:1代表来自基础库  2代表来自药品库
2235
+            for(let i=0;i<medicalList.length;i++){
2236
+               medicalList[i].way = 2
2237
+            }
2238
+            for(let i=0;i<medicalList.length;i++){
2239
+               medicalList[i].drug_name = medicalList[i].drug_name+"(自备药)"
2240
+            }
2241
+            var drugname = response.data.data.drugName
2242
+            for(let i=0;i<drugname.length;i++){
2243
+               drugname[i].way = 1
2244
+            }
2245
+
2246
+            drugname.push(...medicalList)
2247
+            console.log("222222222我的",drugname)
2248
+            this.medicals = drugname
2249
+          }
2250
+      })
2251
+    },
2252
+  changeDrugName(id){
2253
+      var drug_name = ""
2254
+      var name = ""
2255
+      var way = 0
2256
+      for(let i=0;i<this.medicals.length;i++){
2257
+        if(id == this.medicals[i].id){
2258
+          name = this.medicals[i].drug_name
2259
+          way  = this.medicals[i].way
2260
+        }
2261
+      }
2262
+      if(way == 1){
2263
+        drug_name = name
2264
+      }
2265
+      if(way == 2){
2266
+        var arr = name.split("(自备药)")
2267
+        drug_name = arr[0]
2268
+      }
2269
+        const params = {
2270
+          drug_name:drug_name,
2271
+          patient_id:this.$route.query.patient_id,
2272
+          way:way,
2273
+        }
2274
+      getDrugDescByDrugName(params).then(response=>{
2275
+          if(response.data.state == 1){
2276
+             var drugspec = response.data.data.drugspec
2277
+             console.log("drugspec999",drugspec)
2278
+             if(drugspec[0].drug_spec !=0){
2279
+                this.nameForm.advice_desc = ""
2280
+                this.nameForm.advice_desc = drugspec[0].drug_spec
2281
+             }
2282
+             if(drugspec[0].min_unit!=0){
2283
+                 this.nameForm.drug_spec_unit = ""
2284
+                 this.nameForm.drug_spec_unit = drugspec[0].min_unit
2285
+             }
2286
+             if(drugspec[0].delivery_way!=0){
2287
+                 this.nameForm.delivery_way = ""
2288
+                 this.nameForm.delivery_way = drugspec[0].delivery_way
2289
+             }
2290
+             if(drugspec[0].execution_frequency!=0){
2291
+                this.nameForm.execution_frequency = ""
2292
+                this.nameForm.execution_frequency = drugspec[0].execution_frequency
2293
+             }
2294
+             if(drugspec[0].single_dose !=0){
2295
+                this.nameForm.single_dose = ""
2296
+                this.nameForm.single_dose = drugspec[0].single_dose.toString()
2297
+             } 
2298
+             if(drugspec[0].min_unit !=0){
2299
+              this.nameForm.single_dose_unit = ""
2300
+               this.nameForm.single_dose_unit = drugspec[0].min_unit
2301
+             }
2302
+             if(drugspec[0].min_unit!=0){
2303
+               this.nameForm.prescribing_number_unit = ""
2304
+               this.nameForm.prescribing_number_unit = drugspec[0].min_unit
2305
+             }
2306
+              
2307
+             if( drugspec[0].prescribing_number!=0){
2308
+               this.nameForm.prescribing_number = ""
2309
+                this.nameForm.prescribing_number = drugspec[0].prescribing_number.toString()
2310
+             }
2311
+          
2312
+             this.drugSpec = drugspec
2313
+          }
2314
+      })
2315
+    
2164 2316
     }
2165 2317
   },
2166 2318
   watch: {
2167 2319
     "selectedTemp.list": function() {
2168 2320
       this.calcselectedTemp();
2169 2321
     }
2322
+  },
2323
+  created(){
2324
+     //获取自备药
2325
+    this.getSelfMedicalList()
2170 2326
   }
2171 2327
 };
2172 2328
 </script>

+ 1 - 1
src/xt_pages/dialysis/details/dialog/dialysisPrescriptionDialog.vue View File

@@ -1370,7 +1370,7 @@
1370 1370
       },
1371 1371
       setLastRecord: function(schedual,lastAssessmentAfterDislysis,lastPredialysisEvaluation,lastDialysisPrescribe,lastDryWeightDislysis,system_prescribe) {
1372 1372
         
1373
-        console.log("德玛西亚22222",schedual)
1373
+       
1374 1374
         this.treatment_mode = this.$store.getters.treatment_mode
1375 1375
         console.log("99999",this.treatment_mode)
1376 1376
         this.perfusion_apparatus = getDataConfig(

+ 164 - 11
src/xt_pages/user/components/EditGroupAdvice.vue View File

@@ -371,30 +371,65 @@
371 371
     <el-dialog
372 372
       :title="nameFormTitle"
373 373
       :visible.sync="nameFormVisible"
374
-      width="700px"
374
+      width="800px"
375 375
     >
376 376
       <el-form
377 377
         ref="nameForm"
378 378
         :rules="nameRules"
379 379
         :model="nameForm"
380
-        label-width="90px"
380
+        label-width="120px"
381 381
       >
382 382
         <el-row>
383
-          <el-col :span="12">
383
+          <el-col :span="10">
384 384
             <el-form-item label="医嘱内容 :" required prop="advice_name">
385
-              <el-input v-model="nameForm.advice_name"></el-input>
385
+              <!-- <el-input v-model="nameForm.advice_name"></el-input> -->
386
+
387
+              <el-select
388
+                v-model="nameForm.advice_name"
389
+                filterable
390
+                clearable
391
+                allow-create
392
+                :disabled="isChild"
393
+                placeholder="请选择(输入可搜索)"
394
+                style="width:200px"
395
+                @change="changeDrugName"
396
+              >
397
+                <el-option
398
+                  v-for="item in medicals"
399
+                  :key="item.id"
400
+                  :label="item.drug_name"
401
+                  :value="item.id"
402
+                ></el-option>
403
+              </el-select>
386 404
             </el-form-item>
387 405
           </el-col>
388
-          <el-col :span="12">
406
+          <el-col :span="14">
389 407
             <!--<el-form-item label="规格 :" prop="advice_desc">-->
390 408
             <!--<el-input v-model="nameForm.advice_desc"></el-input>-->
391 409
             <!--</el-form-item>-->
392 410
             <el-form-item label="药品规格 :" prop="advice_desc">
393
-              <el-col :span="8">
394
-                <el-input v-model="nameForm.advice_desc"></el-input>
411
+              <el-col :span="10">
412
+                <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
413
+
414
+                <el-select
415
+                  v-model="nameForm.advice_desc"
416
+                  filterable
417
+                  clearable
418
+                  allow-create
419
+                  :disabled="isChild"
420
+                  placeholder="请选择(输入可搜索)"
421
+                  style="width:150px"
422
+                >
423
+                  <el-option
424
+                    v-for="item in drugSpec"
425
+                    :key="item.id"
426
+                    :label="item.drug_spec"
427
+                    :value="item.drug_spec"
428
+                  ></el-option>
429
+                 </el-select>
395 430
               </el-col>
396 431
               <el-col class="line" :span="2">&nbsp;</el-col>
397
-              <el-col :span="14">
432
+              <el-col :span="10">
398 433
                 <el-select
399 434
                   v-model="nameForm.drug_spec_unit"
400 435
                   filterable
@@ -564,7 +599,7 @@ import {
564 599
   getDoctorAdviceList,
565 600
   StopDoctorAdvice
566 601
 } from "@/api/advice";
567
-
602
+import { getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
568 603
 export default {
569 604
   name: "EditGroupAdvice",
570 605
   data() {
@@ -607,7 +642,9 @@ export default {
607 642
         isEdit: 0,
608 643
         index: 0,
609 644
         id: 0,
610
-        children: []
645
+        children: [],
646
+        way:"",
647
+        drug_id:""
611 648
       },
612 649
 
613 650
       drugOptions: [],
@@ -626,7 +663,9 @@ export default {
626 663
       selectedTemp: { id: 0, name: "", org_id: 0, list: [], rows: [] },
627 664
       selectedTemplate: [],
628 665
       allSelectedTemplate: [],
629
-      adviceTemplateMaps: {}
666
+      adviceTemplateMaps: {},
667
+      medicals:[],
668
+      drugSpec:[]
630 669
     };
631 670
   },
632 671
   props: {
@@ -813,6 +852,33 @@ export default {
813 852
         .catch(() => {});
814 853
     },
815 854
     submitNameForm(formName) {
855
+       if(typeof(this.nameForm.advice_name) == "string"){
856
+         
857
+          this.nameForm.advice_name == this.nameForm.advice_name
858
+      }
859
+
860
+      if(typeof(this.nameForm.advice_name) == "number"){
861
+          var drug_name = ""
862
+          var name = ""
863
+          var way = 0
864
+          this.nameForm.drug_id = this.nameForm.advice_name
865
+          for(let i=0;i<this.medicals.length;i++){
866
+            if(this.nameForm.advice_name == this.medicals[i].id){
867
+              name = this.medicals[i].drug_name
868
+              way  = this.medicals[i].way
869
+            }
870
+          }
871
+          if(way == 1){
872
+            drug_name = name
873
+          }
874
+          if(way == 2){
875
+            var arr = name.split("(自备药)")
876
+            drug_name = arr[0]
877
+          }
878
+          
879
+          this.nameForm.advice_name = drug_name
880
+          this.nameForm.way = way
881
+      }
816 882
       var _this = this;
817 883
       this.$refs[formName].validate(valid => {
818 884
         if (valid) {
@@ -2319,6 +2385,89 @@ export default {
2319 2385
           }
2320 2386
         }
2321 2387
       });
2388
+    },
2389
+
2390
+     getSelfMedicalList(){
2391
+        const params = {
2392
+          patient_id:this.patientID
2393
+        }
2394
+      getSelfMedicalList(params).then(response=>{
2395
+          if(response.data.state == 1){
2396
+            var medicalList =  response.data.data.medicalList
2397
+            //way字段区分数据源:1代表来自基础库  2代表来自药品库
2398
+            for(let i=0;i<medicalList.length;i++){
2399
+               medicalList[i].way = 2
2400
+            }
2401
+            for(let i=0;i<medicalList.length;i++){
2402
+               medicalList[i].drug_name = medicalList[i].drug_name+"(自备药)"
2403
+            }
2404
+            var drugname = response.data.data.drugName
2405
+            for(let i=0;i<drugname.length;i++){
2406
+               drugname[i].way = 1
2407
+            }
2408
+
2409
+            drugname.push(...medicalList)
2410
+          
2411
+            this.medicals = drugname
2412
+          }
2413
+      })
2414
+    },
2415
+    changeDrugName(id){
2416
+      var drug_name = ""
2417
+      var name = ""
2418
+      var way = 0
2419
+      for(let i=0;i<this.medicals.length;i++){
2420
+        if(id == this.medicals[i].id){
2421
+          name = this.medicals[i].drug_name
2422
+          way  = this.medicals[i].way
2423
+        }
2424
+      }
2425
+      if(way == 1){
2426
+        drug_name = name
2427
+      }
2428
+      if(way == 2){
2429
+        var arr = name.split("(自备药)")
2430
+        drug_name = arr[0]
2431
+      }
2432
+        const params = {
2433
+          drug_name:drug_name,
2434
+          patient_id:this.$route.query.patient_id,
2435
+          way:way,
2436
+        }
2437
+      getDrugDescByDrugName(params).then(response=>{
2438
+          if(response.data.state == 1){
2439
+             var drugspec = response.data.data.drugspec
2440
+          
2441
+             if(drugspec[0].drug_spec !=0){
2442
+                this.nameForm.advice_desc = drugspec[0].drug_spec
2443
+             }
2444
+             if(drugspec[0].min_unit!=0){
2445
+                 this.nameForm.drug_spec_unit = drugspec[0].min_unit
2446
+             }
2447
+             if(drugspec[0].delivery_way!=0){
2448
+                 this.nameForm.delivery_way = drugspec[0].delivery_way
2449
+             }
2450
+             if(drugspec[0].execution_frequency!=0){
2451
+                this.nameForm.execution_frequency = drugspec[0].execution_frequency
2452
+             }
2453
+             if(drugspec[0].single_dose !=0){
2454
+                this.nameForm.single_dose = drugspec[0].single_dose.toString()
2455
+             } 
2456
+             if(drugspec[0].min_unit !=0){
2457
+               this.nameForm.single_dose_unit = drugspec[0].min_unit
2458
+             }
2459
+             if(drugspec[0].min_unit!=0){
2460
+               this.nameForm.prescribing_number_unit = drugspec[0].min_unit
2461
+             }
2462
+              
2463
+             if( drugspec[0].prescribing_number!=0){
2464
+                this.nameForm.prescribing_number = drugspec[0].prescribing_number.toString()
2465
+             }
2466
+          
2467
+             this.drugSpec = drugspec
2468
+          }
2469
+      })
2470
+    
2322 2471
     }
2323 2472
   },
2324 2473
   watch: {
@@ -2328,6 +2477,10 @@ export default {
2328 2477
     "selectedTemp.list": function() {
2329 2478
       this.calcselectedTemp();
2330 2479
     }
2480
+  },
2481
+  created(){
2482
+    //获取自备药
2483
+    this.getSelfMedicalList()
2331 2484
   }
2332 2485
 };
2333 2486
 </script>

+ 99 - 44
src/xt_pages/user/doctorAdvice.vue View File

@@ -961,7 +961,7 @@
961 961
                   v-for="item in medicals"
962 962
                   :key="item.id"
963 963
                   :label="item.drug_name"
964
-                  :value="item.drug_name"
964
+                  :value="item.id"
965 965
                 ></el-option>
966 966
               </el-select>
967 967
               </el-form-item>
@@ -2610,6 +2610,8 @@ export default {
2610 2610
           drug_spec_unit: this.groupSelectRow.drug_spec_unit,
2611 2611
           prescribing_number: this.groupSelectRow.prescribing_number,
2612 2612
           prescribing_number_unit: this.groupSelectRow.prescribing_number_unit,
2613
+          way:this.groupSelectRow.way,
2614
+          drug_id:this.groupSelectRow.drug_id,
2613 2615
           delivery_way: this.isChild ? "" : this.groupSelectRow.delivery_way,
2614 2616
           execution_frequency: this.isChild
2615 2617
             ? ""
@@ -2650,7 +2652,9 @@ export default {
2650 2652
           index: 0,
2651 2653
           id: 0,
2652 2654
           children: [],
2653
-          parent_row: 0
2655
+          parent_row: 0,
2656
+          way:"",
2657
+          drug_id:''
2654 2658
         };
2655 2659
         this.nameFormTitle = "新增医嘱内容";
2656 2660
       }
@@ -3964,8 +3968,26 @@ export default {
3964 3968
       });
3965 3969
     },
3966 3970
     submitNameForm(formName) {
3967
-      var arr = this.nameForm.advice_name.split("(自备药)")
3968
-      this.nameForm.advice_name = arr[0]
3971
+      var drug_name = ""
3972
+      var name = ""
3973
+      var way = 0
3974
+      this.nameForm.drug_id = this.nameForm.advice_name
3975
+      for(let i=0;i<this.medicals.length;i++){
3976
+        if(this.nameForm.advice_name == this.medicals[i].id){
3977
+          name = this.medicals[i].drug_name
3978
+          way  = this.medicals[i].way
3979
+        }
3980
+      }
3981
+      if(way == 1){
3982
+        drug_name = name
3983
+      }
3984
+      if(way == 2){
3985
+        var arr = name.split("(自备药)")
3986
+        drug_name = arr[0]
3987
+      }
3988
+      
3989
+      this.nameForm.advice_name = drug_name
3990
+      this.nameForm.way = way
3969 3991
       var _this = this;
3970 3992
       this.$refs[formName].validate(valid => {
3971 3993
         if (valid) {
@@ -3980,40 +4002,18 @@ export default {
3980 4002
                   var cle = _this.groupForm.adviceNames[index].children.length;
3981 4003
                   var children = _this.groupForm.adviceNames[index].children;
3982 4004
                   for (let j = 0; j < ale; j++) {
3983
-                    if (_this.groupSelectRow.row_key == children[j].row_key) {
3984
-                      _this.groupForm.adviceNames[index].children[
3985
-                        j
3986
-                      ].advice_name = _this.nameForm.advice_name;
3987
-                      _this.groupForm.adviceNames[index].children[
3988
-                        j
3989
-                      ].advice_desc = _this.nameForm.advice_desc;
3990
-                      _this.groupForm.adviceNames[index].children[
3991
-                        j
3992
-                      ].single_dose = "" + _this.nameForm.single_dose;
3993
-                      _this.groupForm.adviceNames[index].children[
3994
-                        j
3995
-                      ].single_dose_unit = _this.nameForm.single_dose_unit;
3996
-                      _this.groupForm.adviceNames[index].children[j].drug_spec =
3997
-                        "" + _this.nameForm.drug_spec;
3998
-                      _this.groupForm.adviceNames[index].children[
3999
-                        j
4000
-                      ].drug_spec_unit = _this.nameForm.drug_spec_unit;
4001
-                      _this.groupForm.adviceNames[index].children[
4002
-                        j
4003
-                      ].prescribing_number =
4004
-                        "" + _this.nameForm.prescribing_number;
4005
-                      _this.groupForm.adviceNames[index].children[
4006
-                        j
4007
-                      ].prescribing_number_unit =
4008
-                        _this.nameForm.prescribing_number_unit;
4009
-                      _this.groupForm.adviceNames[index].children[
4010
-                        j
4011
-                      ].delivery_way = _this.nameForm.delivery_way;
4012
-                      _this.groupForm.adviceNames[index].children[
4013
-                        j
4014
-                      ].execution_frequency =
4015
-                        _this.nameForm.execution_frequency;
4016
-
4005
+                    if (_this.groupSelectRow.row_key == children[j].row_key) {_this.groupForm.adviceNames[index].children[j].advice_name = _this.nameForm.advice_name;
4006
+                      _this.groupForm.adviceNames[index].children[j].advice_desc = _this.nameForm.advice_desc;
4007
+                      _this.groupForm.adviceNames[index].children[j].single_dose = "" + _this.nameForm.single_dose;
4008
+                      _this.groupForm.adviceNames[index].children[j].single_dose_unit = _this.nameForm.single_dose_unit;
4009
+                      _this.groupForm.adviceNames[index].children[j].drug_spec ="" + _this.nameForm.drug_spec;
4010
+                      _this.groupForm.adviceNames[index].children[j].drug_spec_unit = _this.nameForm.drug_spec_unit;
4011
+                      _this.groupForm.adviceNames[index].children[j].prescribing_number ="" + _this.nameForm.prescribing_number;
4012
+                      _this.groupForm.adviceNames[index].children[j].prescribing_number_unit =_this.nameForm.prescribing_number_unit;
4013
+                      _this.groupForm.adviceNames[index].children[j].delivery_way = _this.nameForm.delivery_way;
4014
+                      _this.groupForm.adviceNames[index].children[j].execution_frequency =_this.nameForm.execution_frequency;
4015
+                      _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
4016
+                      _this.groupForm.adviceNames[index].children[j].way = this.nameForm.way;
4017 4017
                       _this.$set(
4018 4018
                         _this.groupForm.adviceNames[index].children,
4019 4019
                         j,
@@ -4348,25 +4348,80 @@ export default {
4348 4348
         const params = {
4349 4349
           patient_id:id
4350 4350
         }
4351
+      console.log("params9999999999",params)
4351 4352
       getSelfMedicalList(params).then(response=>{
4352 4353
          if(response.data.state == 1){
4354
+
4353 4355
             var medicalList =  response.data.data.medicalList
4356
+            //way字段区分数据源:1代表来自基础库  2代表来自药品库
4357
+            for(let i=0;i<medicalList.length;i++){
4358
+               medicalList[i].way = 2
4359
+            }
4354 4360
             for(let i=0;i<medicalList.length;i++){
4355 4361
                medicalList[i].drug_name = medicalList[i].drug_name+"(自备药)"
4356 4362
             }
4357
-            this.medicals = medicalList
4363
+            var drugname = response.data.data.drugName
4364
+            for(let i=0;i<drugname.length;i++){
4365
+               drugname[i].way = 1
4366
+            }
4367
+
4368
+            drugname.push(...medicalList)
4369
+            this.medicals = drugname
4358 4370
          }
4359 4371
       })
4360 4372
     },
4361
-    changeDrugName(name){
4362
-      var arr = name.split("(自备药)");
4373
+    changeDrugName(id){
4374
+      var drug_name = ""
4375
+      var name = ""
4376
+      var way = 0
4377
+      for(let i=0;i<this.medicals.length;i++){
4378
+        if(id == this.medicals[i].id){
4379
+          name = this.medicals[i].drug_name
4380
+          way  = this.medicals[i].way
4381
+        }
4382
+      }
4383
+      if(way == 1){
4384
+        drug_name = name
4385
+      }
4386
+      if(way == 2){
4387
+        var arr = name.split("(自备药)")
4388
+        drug_name = arr[0]
4389
+      }
4363 4390
         const params = {
4364
-          drug_name:arr[0],
4365
-          patient_id:this.$route.params && this.$route.params.id
4391
+          drug_name:drug_name,
4392
+          patient_id:this.$route.query.patient_id,
4393
+          way:way,
4366 4394
         }
4367 4395
       getDrugDescByDrugName(params).then(response=>{
4368 4396
           if(response.data.state == 1){
4369
-             var drugspec = response.data.data.drugspec
4397
+            var drugspec = response.data.data.drugspec
4398
+          
4399
+             if(drugspec[0].drug_spec !=0){
4400
+                this.nameForm.advice_desc = drugspec[0].drug_spec
4401
+             }
4402
+             if(drugspec[0].min_unit!=0){
4403
+                 this.nameForm.drug_spec_unit = drugspec[0].min_unit
4404
+             }
4405
+             if(drugspec[0].delivery_way!=0){
4406
+                 this.nameForm.delivery_way = drugspec[0].delivery_way
4407
+             }
4408
+             if(drugspec[0].execution_frequency!=0){
4409
+                this.nameForm.execution_frequency = drugspec[0].execution_frequency
4410
+             }
4411
+             if(drugspec[0].single_dose !=0){
4412
+                this.nameForm.single_dose = drugspec[0].single_dose
4413
+             } 
4414
+             if(drugspec[0].min_unit !=0){
4415
+               this.nameForm.single_dose_unit = drugspec[0].min_unit
4416
+             }
4417
+             if(drugspec[0].min_unit!=0){
4418
+               this.nameForm.prescribing_number_unit = drugspec[0].min_unit
4419
+             }
4420
+              
4421
+             if( drugspec[0].prescribing_number!=0){
4422
+                this.nameForm.prescribing_number = drugspec[0].prescribing_number
4423
+             }
4424
+          
4370 4425
              this.drugSpec = drugspec
4371 4426
           }
4372 4427
       })

+ 1 - 1
src/xt_pages/user/patients.vue View File

@@ -1267,7 +1267,7 @@
1267 1267
             return false
1268 1268
           } else {
1269 1269
             this.tableData = response.data.data.patients
1270
-           console.log('病人是', this.tableData)
1270
+          //  console.log('病人是', this.tableData)
1271 1271
             this.pageTotal = this.tableData.length
1272 1272
             this.total = response.data.data.total
1273 1273
           }