mainqaq 2 years ago
parent
commit
5c0c07cee9

+ 241 - 5
src/xt_pages/Pharmacy/DrugDispensing.vue View File

114
       </div>
114
       </div>
115
       <div class="mainRight">
115
       <div class="mainRight">
116
         <div class="titlelist">
116
         <div class="titlelist">
117
+          班次:
118
+          <el-select v-model="shift" placeholder="请选择" @change="getdrugsdetails">
119
+            <el-option
120
+              v-for="item in banshift"
121
+              :key="item.value"
122
+              :label="item.text"
123
+              :value="item.value">
124
+            </el-option>
125
+          </el-select>
126
+          分区:
127
+          <el-select v-model="partition" placeholder="请选择" @change="getdrugsdetails">
128
+            <el-option
129
+              v-for="item in fen"
130
+              :key="item.id"
131
+              :label="item.name"
132
+              :value="item.id">
133
+            </el-option>
134
+          </el-select>
135
+          给药途径:
136
+          <el-select v-model="deliveryway" placeholder="请选择" @change="getdruglist">
137
+            <el-option
138
+              v-for="item in routeofadministration"
139
+              :key="item.name"
140
+              :label="item.name"
141
+              :value="item.name">
142
+            </el-option>
143
+          </el-select>
144
+          <el-button type="primary" @click="toExport" v-if="state == 2">导出</el-button>
117
           <!--          <el-button type="primary" @click="tt">调试</el-button>-->
145
           <!--          <el-button type="primary" @click="tt">调试</el-button>-->
118
           <el-button type="primary" @click="dispense" v-if="state == 1"
146
           <el-button type="primary" @click="dispense" v-if="state == 1"
119
             >发药</el-button
147
             >发药</el-button
120
           >
148
           >
121
           <el-button type="primary" @click="toPrint">打印</el-button>
149
           <el-button type="primary" @click="toPrint">打印</el-button>
122
-          <!--          <el-button @click="tt">调试</el-button>-->
123
-          <!--          <el-button type="primary" @click="toSetting">设置</el-button>-->
150
+<!--                    <el-button @click="tt">调试</el-button>-->
151
+
124
         </div>
152
         </div>
125
         <el-divider></el-divider>
153
         <el-divider></el-divider>
126
         <div>
154
         <div>
319
             </el-table-column>
347
             </el-table-column>
320
           </el-table>
348
           </el-table>
321
         </div>
349
         </div>
350
+        <div>合计  {{total}}</div>
322
         <div style="margin-top: 25px" v-if="state == 1">
351
         <div style="margin-top: 25px" v-if="state == 1">
323
           领药人:
352
           领药人:
324
           <el-select v-model="admin_user_id" placeholder="请选择">
353
           <el-select v-model="admin_user_id" placeholder="请选择">
384
   getpatientswithdrugs,
413
   getpatientswithdrugs,
385
   medicinedeparture,
414
   medicinedeparture,
386
   getcurrentname,
415
   getcurrentname,
416
+  getpartitionlist,
417
+  routeofadministration,
387
 } from "@/api/pharmacy";
418
 } from "@/api/pharmacy";
388
 const moment = require("moment");
419
 const moment = require("moment");
389
 export default {
420
 export default {
419
       issued_drug: [], //已发药列表
450
       issued_drug: [], //已发药列表
420
       currentRow: null,
451
       currentRow: null,
421
       tmp: 0,
452
       tmp: 0,
453
+      banshift:[
454
+        {value:0,text:'全部班'},
455
+        {value:1,text:'上午'},
456
+        {value:2,text: '下午'},
457
+        {value:3,text: '晚上'}
458
+      ],
459
+      shift:0,//班次
460
+      fen:[],
461
+      partition:0,//分区
462
+      routeofadministration:[],
463
+      deliveryway:"全部",//给药途径
464
+      total:"",//合计
422
     };
465
     };
423
   },
466
   },
424
 
467
 
425
   methods: {
468
   methods: {
426
     tt() {
469
     tt() {
427
-      console.log("this.currentRow", this.currentRow);
428
-      this.$router.go(0);
470
+      console.log("this.state", this.state);
471
+      console.log("this.tableData", this.tableData);
472
+      console.log("this.deliveryway", this.deliveryway);
429
     },
473
     },
430
     async fun3() {
474
     async fun3() {
431
       console.log("fun3");
475
       console.log("fun3");
467
         }
511
         }
468
         console.log(data, "合计data1");
512
         console.log(data, "合计data1");
469
         const values = data.map((item) => Number(item[column.property]));
513
         const values = data.map((item) => Number(item[column.property]));
470
-        
514
+
471
         if (!values.every((value) => isNaN(value))) {
515
         if (!values.every((value) => isNaN(value))) {
472
           sums[index] = values.reduce((prev, curr) => {
516
           sums[index] = values.reduce((prev, curr) => {
473
             const value = Number(curr);
517
             const value = Number(curr);
525
         this.start_time
569
         this.start_time
526
       );
570
       );
527
     },
571
     },
572
+    toExport() {
573
+      if (this.state == 1 && this.multipleSelection.length == 0) {
574
+        this.$message.error("未选择任何数据");
575
+        return;
576
+      }
577
+      if (this.state == 2 && this.tableData == null) {
578
+        this.$message.error("未选择任何数据");
579
+        return;
580
+      }
581
+      // for (let i = 0; i < this.tableData.length; i++) {
582
+      //   this.tableData[i].index = i + 1;
583
+      //   this.tableData[i].name = this.tableData[i].dose + this.tableData[i].dose_unit + "*" + this.tableData[i].min_number + this.tableData[i].min_unit +
584
+      //     "/" +
585
+      //     this.tableData[i].max_unit;
586
+      //
587
+      //   this.tableData[i].total_price = (
588
+      //     this.tableData[i].warehousing_count * this.exportList[i].price
589
+      //   ).toFixed(2);
590
+      //   for (let j = 0; j < this.manufacturerList.length; j++) {
591
+      //     if (this.exportList[i].manufacturer == this.manufacturerList[j].id) {
592
+      //       this.exportList[i].manufacturer =
593
+      //         this.manufacturerList[j].manufacturer_name;
594
+      //     }
595
+      //     if (this.exportList[i].manufacturer == 0) {
596
+      //       this.exportList[i].manufacturer = "";
597
+      //     }
598
+      //   }
599
+      //
600
+      //   for (let z = 0; z < this.dealerList.length; z++) {
601
+      //     if (this.exportList[i].dealer == this.dealerList[z].id) {
602
+      //       this.exportList[i].dealer = this.dealerList[z].dealer_name;
603
+      //     }
604
+      //     if (this.exportList[i].dealer == 0) {
605
+      //       this.exportList[i].dealer = "";
606
+      //     }
607
+      //   }
608
+      // }
609
+
610
+      if(this.state == 1){
611
+        import("@/vendor/Export2Excel").then((excel) => {
612
+          for (let i = 0; i < this.multipleSelection.length; i++) {
613
+            this.multipleSelection[i].index = i + 1;
614
+            this.multipleSelection[i].time = this.start_time
615
+            this.multipleSelection[i].yname = this.currentRow.name
616
+          }
617
+
618
+          const tHeader = [
619
+            "序号",
620
+            "时间",
621
+            "患者名称",
622
+            "药品名称",
623
+            "单次用量",
624
+            "用法",
625
+            "频率",
626
+            "天数",
627
+            "总量",
628
+            "数据来源",
629
+          ];
630
+          const filterVal = [
631
+            "index",
632
+            "time",
633
+            "name",
634
+            "yname",
635
+            "single_dosage",
636
+            "usage",
637
+            "frequency",
638
+            "days",
639
+            "total",
640
+            "data_sources",
641
+          ];
642
+
643
+          const data = this.formatJson(filterVal, this.multipleSelection);
644
+          excel.export_json_to_excel({
645
+            header: tHeader,
646
+            data,
647
+            filename: "发药单详情",
648
+          });
649
+          this.downloadLoading = false;
650
+        });
651
+      }else if(this.state == 2){
652
+        import("@/vendor/Export2Excel").then((excel) => {
653
+          for (let i = 0; i < this.tableData.length; i++) {
654
+            this.tableData[i].index = i + 1;
655
+            this.tableData[i].time = this.start_time
656
+            this.tableData[i].yname = this.currentRow.name
657
+          }
658
+
659
+          const tHeader = [
660
+            "序号",
661
+            "日期",
662
+            "患者名称",
663
+            "药品名称",
664
+            "单次用量",
665
+            "用法",
666
+            "频率",
667
+            "天数",
668
+            "总量",
669
+            "数据来源",
670
+            "领药人",
671
+          ];
672
+          const filterVal = [
673
+            "index",
674
+            "time",
675
+            "name",
676
+            "yname",
677
+            "single_dosage",
678
+            "usage",
679
+            "frequency",
680
+            "days",
681
+            "total",
682
+            "data_sources",
683
+            "people",
684
+          ];
685
+
686
+          const data = this.formatJson(filterVal, this.tableData);
687
+          excel.export_json_to_excel({
688
+            header: tHeader,
689
+            data,
690
+            filename: "发药单详情",
691
+          });
692
+          this.downloadLoading = false;
693
+        });
694
+      }else{
695
+        this.$message.error("药品状态异常");
696
+        return;
697
+      }
698
+      // import("@/vendor/Export2Excel").then((excel) => {
699
+      //   // for (let i = 0; i < this.tableData.length; i++) {
700
+      //   //   for (let j = 0; j < this.drugTypeList.length; j++) {
701
+      //   //     if (this.exportList[i].drug_type == this.drugTypeList[j].id) {
702
+      //   //       this.exportList[i].drug_type = this.drugTypeList[j].name;
703
+      //   //     }
704
+      //   //   }
705
+      //   // }
706
+      //
707
+      //   const tHeader = [
708
+      //     "序号",
709
+      //     "患者名称",
710
+      //     "单次用量",
711
+      //     "用法",
712
+      //     "频率",
713
+      //     "天数",
714
+      //     "总量",
715
+      //     "数据来源",
716
+      //   ];
717
+      //   const filterVal = [
718
+      //     "index",
719
+      //     "drug_name",
720
+      //     "drug_type",
721
+      //     "unit",
722
+      //     "batch_number",
723
+      //     "warehousing_count",
724
+      //     "price",
725
+      //     "total_price",
726
+      //   ];
727
+      //
728
+      //   const data = this.tableData;
729
+      //   excel.export_json_to_excel({
730
+      //     header: tHeader,
731
+      //     data,
732
+      //     filename: "药品入库单详情",
733
+      //   });
734
+      //   this.downloadLoading = false;
735
+      // });
736
+    },
737
+    formatJson(filterVal, jsonData) {
738
+      return jsonData.map((v) => filterVal.map((j) => v[j]));
739
+    },
528
     //列表选择
740
     //列表选择
529
     handleSelectionChange(val) {
741
     handleSelectionChange(val) {
530
       this.multipleSelection = val;
742
       this.multipleSelection = val;
598
       var params = {
810
       var params = {
599
         keyword: this.keywords,
811
         keyword: this.keywords,
600
         time: this.start_time,
812
         time: this.start_time,
813
+        deliveryway: this.deliveryway,
601
       };
814
       };
602
       waitingmedicine(params).then((res) => {
815
       waitingmedicine(params).then((res) => {
603
         if (res.data.state == 1) {
816
         if (res.data.state == 1) {
614
       var params = {
827
       var params = {
615
         keyword: this.keywords,
828
         keyword: this.keywords,
616
         time: this.start_time,
829
         time: this.start_time,
830
+        deliveryway: this.deliveryway,
617
       };
831
       };
618
       await waitingmedicine(params).then((res) => {
832
       await waitingmedicine(params).then((res) => {
619
         if (res.data.state == 1) {
833
         if (res.data.state == 1) {
663
     },
877
     },
664
     handleCurrentChange(val) {
878
     handleCurrentChange(val) {
665
       this.currentRow = val;
879
       this.currentRow = val;
880
+      console.log("currentRow",this.currentRow)
881
+      this.total = ""
666
       if (this.state == 1) {
882
       if (this.state == 1) {
667
         this.getdrugsdetails(0);
883
         this.getdrugsdetails(0);
668
       }
884
       }
675
         drug_id: this.currentRow.id,
891
         drug_id: this.currentRow.id,
676
         is_medicine: val,
892
         is_medicine: val,
677
         time: this.start_time,
893
         time: this.start_time,
894
+        shift: this.shift,
895
+        partition: this.partition,
896
+        deliveryway: this.deliveryway,
678
       };
897
       };
679
       getpatientswithdrugs(params).then((res) => {
898
       getpatientswithdrugs(params).then((res) => {
680
         if (res.data.state == 1) {
899
         if (res.data.state == 1) {
681
           this.tableData = res.data.data.list; //列表数据
900
           this.tableData = res.data.data.list; //列表数据
901
+          this.total = res.data.data.total;//合计
682
         } else {
902
         } else {
683
           this.$message.error(res.data.msg);
903
           this.$message.error(res.data.msg);
684
         }
904
         }
706
         }
926
         }
707
       });
927
       });
708
     },
928
     },
929
+    getrouteofadministration(){
930
+      var params = {}
931
+      routeofadministration(params).then((res) =>{
932
+        if(res.data.state == 1){
933
+          this.routeofadministration = res.data.data.list;
934
+        }
935
+      })
936
+    },
937
+    getgetpartitionlist(){
938
+      var params = {}
939
+      getpartitionlist(params).then((res) =>{
940
+        this.fen = res.data.data.list;
941
+      })
942
+    },
709
     getUserlist(drug_id) {
943
     getUserlist(drug_id) {
710
       var params = {
944
       var params = {
711
         start_time: this.start_time,
945
         start_time: this.start_time,
736
     this.getlist();
970
     this.getlist();
737
     // this.getdruglist();
971
     // this.getdruglist();
738
     this.fun3();
972
     this.fun3();
973
+    this.getrouteofadministration();
974
+    this.getgetpartitionlist();
739
   },
975
   },
740
 };
976
 };
741
 </script>
977
 </script>

+ 97 - 2
src/xt_pages/Pharmacy/PatientDispensing.vue View File

112
       </div>
112
       </div>
113
       <div class="mainRight">
113
       <div class="mainRight">
114
         <div class="titlelist">
114
         <div class="titlelist">
115
+          班次:
116
+          <el-select v-model="shift" placeholder="请选择" @change="searchAction">
117
+            <el-option
118
+              v-for="item in banshift"
119
+              :key="item.value"
120
+              :label="item.text"
121
+              :value="item.value">
122
+            </el-option>
123
+          </el-select>
124
+          分区:
125
+          <el-select v-model="partition" placeholder="请选择" @change="searchAction">
126
+            <el-option
127
+              v-for="item in fen"
128
+              :key="item.id"
129
+              :label="item.name"
130
+              :value="item.id">
131
+            </el-option>
132
+          </el-select>
133
+          <el-button type="primary" @click="toExport" v-if="state == 2">导出</el-button>
115
           <el-button type="primary" @click="dispense" v-if="state == 1"
134
           <el-button type="primary" @click="dispense" v-if="state == 1"
116
             >发药</el-button
135
             >发药</el-button
117
           >
136
           >
119
             >退药</el-button
138
             >退药</el-button
120
           >
139
           >
121
           <el-button type="primary" @click="toPrint">打印</el-button>
140
           <el-button type="primary" @click="toPrint">打印</el-button>
122
-          <!--          <el-button @click="tiaoshi">调试</el-button>-->
141
+<!--                    <el-button @click="tiaoshi">调试</el-button>-->
123
           <el-button type="primary" v-if="state == 1" @click="toSetting"
142
           <el-button type="primary" v-if="state == 1" @click="toSetting"
124
             >设置</el-button
143
             >设置</el-button
125
           >
144
           >
243
   getpharmacycontent,
262
   getpharmacycontent,
244
   dispensingmedicine,
263
   dispensingmedicine,
245
   drugwithdrawal,
264
   drugwithdrawal,
265
+  getpartitionlist,
246
 } from "@/api/pharmacy";
266
 } from "@/api/pharmacy";
247
 const moment = require("moment");
267
 const moment = require("moment");
248
 export default {
268
 export default {
272
       currentRow: null,
292
       currentRow: null,
273
       dialogVisible: false,
293
       dialogVisible: false,
274
       is_open: "2",
294
       is_open: "2",
295
+      banshift:[
296
+        {value:0,text:'全部班'},
297
+        {value:1,text:'上午'},
298
+        {value:2,text: '下午'},
299
+        {value:3,text: '晚上'}
300
+        ],
301
+      shift:0,//班次
302
+      fen:[],
303
+      partition:0,//分区
275
     };
304
     };
276
   },
305
   },
277
   watch: {},
306
   watch: {},
279
     this.init();
308
     this.init();
280
     this.gettodaynumber();
309
     this.gettodaynumber();
281
     this.fun3();
310
     this.fun3();
311
+    this.getgetpartitionlist();
282
     // this.getwaitmount();//fun3
312
     // this.getwaitmount();//fun3
283
     // this.selectedbydefault();
313
     // this.selectedbydefault();
284
   },
314
   },
285
   methods: {
315
   methods: {
316
+    getgetpartitionlist(){
317
+      var params = {}
318
+      getpartitionlist(params).then((res) =>{
319
+        if(res.data.state == 1){
320
+          this.fen = res.data.data.list
321
+        }
322
+      })
323
+    },
286
     tiaoshi() {
324
     tiaoshi() {
287
-      console.log("this.tableData", this.tableData);
325
+      console.log("this.partition", this.partition);
288
     },
326
     },
289
     async fun3() {
327
     async fun3() {
290
       console.log("fun3");
328
       console.log("fun3");
344
       this.state = 1;
382
       this.state = 1;
345
       this.tableData = null;
383
       this.tableData = null;
346
       this.currentRow = null;
384
       this.currentRow = null;
385
+      this.partition = 0;
386
+      this.shift = 0;
347
     },
387
     },
348
     testsss() {
388
     testsss() {
349
       this.state = 1;
389
       this.state = 1;
397
       var params = {
437
       var params = {
398
         keyword: this.keywords,
438
         keyword: this.keywords,
399
         time: this.start_time,
439
         time: this.start_time,
440
+        shift: this.shift,
441
+        partition: this.partition,
400
       };
442
       };
401
       waitingdrug(params).then((res) => {
443
       waitingdrug(params).then((res) => {
402
         if (res.data.state == 1) {
444
         if (res.data.state == 1) {
415
       var params = {
457
       var params = {
416
         keyword: this.keywords,
458
         keyword: this.keywords,
417
         time: this.start_time,
459
         time: this.start_time,
460
+        shift: this.shift,
461
+        partition: this.partition,
418
       };
462
       };
419
       await waitingdrug(params).then((res) => {
463
       await waitingdrug(params).then((res) => {
420
         if (res.data.state == 1) {
464
         if (res.data.state == 1) {
460
         this.start_time
504
         this.start_time
461
       );
505
       );
462
     },
506
     },
507
+    toExport() {
508
+
509
+      import("@/vendor/Export2Excel").then((excel) => {
510
+          for (let i = 0; i < this.tableData.length; i++) {
511
+            this.tableData[i].index = i + 1;
512
+            this.tableData[i].time = this.start_time
513
+            this.tableData[i].uname = this.currentRow.Name
514
+          }
515
+
516
+          const tHeader = [
517
+            "序号",
518
+            "日期",
519
+            "患者名称",
520
+            "名称",
521
+            "单次用量",
522
+            "用法",
523
+            "频率",
524
+            "天数",
525
+            "总量",
526
+            "开立医生",
527
+            "数据来源",
528
+            "备注",
529
+          ];
530
+          const filterVal = [
531
+            "index",
532
+            "time",
533
+            "uname",
534
+            "Name",
535
+            "SingleDosage",
536
+            "Usage",
537
+            "Frequency",
538
+            "Days",
539
+            "Total",
540
+            "Doctor",
541
+            "DataSources",
542
+            "Remarks",
543
+          ];
544
+
545
+          const data = this.formatJson(filterVal, this.tableData);
546
+          excel.export_json_to_excel({
547
+            header: tHeader,
548
+            data,
549
+            filename: "领药单",
550
+          });
551
+          this.downloadLoading = false;
552
+        });
553
+
554
+    },
555
+    formatJson(filterVal, jsonData) {
556
+      return jsonData.map((v) => filterVal.map((j) => v[j]));
557
+    },
463
 
558
 
464
     // 搜索患者
559
     // 搜索患者
465
     searchAction() {
560
     searchAction() {

+ 4 - 0
src/xt_pages/stock/drugs/drugStockInOrder.vue View File

112
         <el-button size="small" type="primary" @click="toExport()"
112
         <el-button size="small" type="primary" @click="toExport()"
113
           >导出</el-button
113
           >导出</el-button
114
         >
114
         >
115
+        <el-button @click="lili">调试</el-button>
115
         <div>
116
         <div>
116
           <span>&nbsp;&nbsp;</span>
117
           <span>&nbsp;&nbsp;</span>
117
           <label class="title"><span class="name">审核状态</span> :</label>
118
           <label class="title"><span class="name">审核状态</span> :</label>
997
       });
998
       });
998
     },
999
     },
999
 
1000
 
1001
+    lili(){
1002
+      console.log("exportList",this.exportList)
1003
+    },
1000
     toExport() {
1004
     toExport() {
1001
       if (this.order_id == "") {
1005
       if (this.order_id == "") {
1002
         this.$message.error("请勾选入库单");
1006
         this.$message.error("请勾选入库单");