浏览代码

自备药

XMLWAN 4 年前
父节点
当前提交
2aaf3a2e3b

+ 32 - 4
src/api/drug/drug.js 查看文件

130
 }
130
 }
131
 
131
 
132
 export function DeleteDrugById(params){
132
 export function DeleteDrugById(params){
133
-  
134
    return request({
133
    return request({
135
       url:"/api/drug/deletedrugbyid",
134
       url:"/api/drug/deletedrugbyid",
136
       method:"get",
135
       method:"get",
147
    })
146
    })
148
 }
147
 }
149
 
148
 
150
-export function DeleteDrugStand(id,params){
151
-   
149
+export function DeleteDrugStand(id,name){
150
+    const params = {
151
+      id:id,
152
+      name:name
153
+    }
152
    return request({
154
    return request({
153
-      url:"/api/drug/deletedrugstand?id="+id,
155
+      url:"/api/drug/deletedrugstand",
154
       method:"get",
156
       method:"get",
155
       params:params
157
       params:params
156
    })
158
    })
227
    })
229
    })
228
 }
230
 }
229
 
231
 
232
+export function getAllMedicalList(params){
233
+  
234
+   return request({
235
+      url:"/api/drug/getallmedicallist",
236
+      methods:"get",
237
+      params:params,
238
+   })
239
+}
240
+
241
+export function getStandName(params){
242
+  
243
+   return request({
244
+     url:"/api/drug/getstandname",
245
+     methods:"get",
246
+     params:params
247
+   })
248
+}
249
+
250
+export function getRullerList(params){
251
+  
252
+   return request({
253
+      url:"/api/drug/getrullerlist",
254
+      methods:"get",
255
+      params:params
256
+   })
257
+}

+ 2 - 1
src/xt_pages/data/components/addDrugs.vue 查看文件

460
       getDictionaryDataConfig(module, filed_name) {
460
       getDictionaryDataConfig(module, filed_name) {
461
         return getDictionaryDataConfig(module, filed_name)
461
         return getDictionaryDataConfig(module, filed_name)
462
 
462
 
463
-      },getDataConfig(module, filed_name){
463
+      },
464
+      getDataConfig(module, filed_name){
464
         return getDataConfig(module, filed_name)
465
         return getDataConfig(module, filed_name)
465
 
466
 
466
       },
467
       },

+ 180 - 19
src/xt_pages/dialysis/details/dialog/DoctorAdviceDialog.vue 查看文件

438
 
438
 
439
           <el-col :span="8">
439
           <el-col :span="8">
440
             <el-form-item label="医嘱名称:">
440
             <el-form-item label="医嘱名称:">
441
-              <el-input v-model="form.advice_name"></el-input>
442
-            </el-form-item>
443
-          </el-col>
444
-
445
-          <el-col :span="8">
446
-            <el-form-item label="药品规格:">
447
-              <el-input v-model="form.advice_desc" style="width: 40%;"></el-input>
441
+              <!-- <el-input v-model="form.advice_name"></el-input> -->
448
               <el-select
442
               <el-select
449
-                v-model="form.drug_spec_unit"
450
-                style="width: 56%;"
443
+                v-model="form.advice_name"
451
                 filterable
444
                 filterable
452
-                placeholder="选择"
445
+                clearable
446
+                allow-create
447
+                placeholder="请选择(输入可搜索)"
448
+                style="width:200px"
449
+                @change="changeDrugName"
453
               >
450
               >
454
                 <el-option
451
                 <el-option
455
-                  v-for="item in unitsOption"
456
-                  :key="item.id"
457
-                  :label="item.name"
458
-                  :value="item.name"
452
+                  v-for="(item,index) in all_drug"
453
+                  :key="index"
454
+                  :label="item.drug_name"
455
+                  :value="item.drug_name"
459
                 ></el-option>
456
                 ></el-option>
460
               </el-select>
457
               </el-select>
461
             </el-form-item>
458
             </el-form-item>
462
           </el-col>
459
           </el-col>
460
+
461
+          <el-col :span="8">
462
+            <el-form-item label="药品规格:">
463
+              <!-- <el-input v-model="form.advice_desc" style="width: 40%;"></el-input> -->
464
+
465
+               <el-select
466
+                  v-model="form.advice_desc"
467
+                  filterable
468
+                  clearable
469
+                  allow-create
470
+                  placeholder="请选择(输入可搜索)"
471
+                  style="width:150px"
472
+                  @change="changeDrugDesc"
473
+                >
474
+                  <el-option
475
+                    v-for="item in drugSpec"
476
+                    :key="item.id"
477
+                    :label="item.drug_spec"
478
+                    :value="item.drug_spec"
479
+                  ></el-option>
480
+                 </el-select>
481
+                <el-select
482
+                  v-model="form.drug_spec_unit"
483
+                  style="width: 56%;"
484
+                  filterable
485
+                  placeholder="选择"
486
+                >
487
+                  <el-option
488
+                    v-for="item in unitsOption"
489
+                    :key="item.id"
490
+                    :label="item.name"
491
+                    :value="item.name"
492
+                  ></el-option>
493
+                </el-select>
494
+            </el-form-item>
495
+          </el-col>
463
         </el-row>
496
         </el-row>
464
 
497
 
465
         <el-row :gutter="20">
498
         <el-row :gutter="20">
621
 
654
 
622
   import request from '@/utils/request'
655
   import request from '@/utils/request'
623
   import { getDialysisScheduleDetail } from '@/api/dialysis_record'
656
   import { getDialysisScheduleDetail } from '@/api/dialysis_record'
624
-
657
+  import { getSelfMedicalList } from "@/api/drug/drug"
625
   export default {
658
   export default {
626
     name: 'DoctorAdviceDialog',
659
     name: 'DoctorAdviceDialog',
627
     props: {
660
     props: {
753
 
786
 
754
         templateForm: { id: '' },
787
         templateForm: { id: '' },
755
         doctorAdvices: [],
788
         doctorAdvices: [],
756
-        patientid: ''
789
+        patientid: '',
790
+        drugSpec:[],
791
+        medicals:[],
792
+        all_drug:[],
793
+        current_drug_name:"",
794
+        current_drug_spec: "",
795
+        drug_id: 0,
796
+        src_type:""
757
       }
797
       }
758
     },
798
     },
759
     watch: {
799
     watch: {
882
         }
922
         }
883
       },
923
       },
884
       submitEditAdvice() {
924
       submitEditAdvice() {
925
+        console.log("this.form",this.form)
885
         if (this.form.advice_name.length == 0) {
926
         if (this.form.advice_name.length == 0) {
886
           this.$message.error('请填写医嘱名称')
927
           this.$message.error('请填写医嘱名称')
887
           return
928
           return
1242
           return false
1283
           return false
1243
         }
1284
         }
1244
         let mode = '1'
1285
         let mode = '1'
1245
-
1286
+       
1246
         CreateDoctorAdvice(this.patient.id, this.form, mode)
1287
         CreateDoctorAdvice(this.patient.id, this.form, mode)
1247
           .then(response => {
1288
           .then(response => {
1248
             this.loading = false
1289
             this.loading = false
1413
           execution_frequency: row.execution_frequency,
1454
           execution_frequency: row.execution_frequency,
1414
           advice_doctor: row.advice_doctor,
1455
           advice_doctor: row.advice_doctor,
1415
           remark: row.remark,
1456
           remark: row.remark,
1416
-          parent_id: row.parent_id
1457
+          parent_id: row.parent_id,
1458
+          drug_id:"",
1459
+          way:"",
1417
         }
1460
         }
1418
       }
1461
       }
1419
       ,
1462
       ,
2235
           this.GetLastOrNextDoctorAdvice(params)
2278
           this.GetLastOrNextDoctorAdvice(params)
2236
 
2279
 
2237
         }
2280
         }
2238
-      }
2281
+      },
2282
+
2283
+    getSelfMedicalList(){
2284
+        const params = {
2285
+          patient_id:this.$route.query.patient_id
2286
+        }
2287
+      getSelfMedicalList(params).then(response=>{
2288
+         if (response.data.state == 1) {
2289
+            this.arr_drug = []
2290
+            var medicalList = response.data.data.private_drug_list
2291
+            var base_drug_list = response.data.data.base_drug_list
2292
+            var base_drug_cofig = response.data.data.base_drug_config
2293
+            var private_drug_cofig = response.data.data.private_drug_config
2294
+
2295
+
2296
+            if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
2297
+
2298
+              for (let i = 0; i < medicalList.length; i++) {
2299
+                if(medicalList[i].drug_specs != null) {
2300
+                  for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
2301
+                    medicalList[i].drug_specs[a]['type'] = 2
2302
+                  }
2303
+                }
2304
+                let obj = {
2305
+                  drug_name: "",
2306
+                  drug_desc: "",
2307
+                  delivery_way: "",
2308
+                  execution_frequency: "",
2309
+                  single_dose: "",
2310
+                  single_dose_unit: "",
2311
+                  prescribing_number: "",
2312
+                  prescribing_number_unit: "",
2313
+                  type_id: "",
2314
+                  type: "",
2315
+                  custom_id: "",
2316
+                  drug_specs: [],
2317
+                }
2318
+
2319
+                medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
2320
+                obj.drug_name = medicalList[i].drug_name
2321
+                obj.delivery_way = medicalList[i].delivery_way
2322
+                obj.execution_frequency = medicalList[i].execution_frequency
2323
+                obj.single_dose = medicalList[i].single_dose
2324
+                obj.prescribing_number = medicalList[i].prescribing_number
2325
+                obj.type_id = medicalList[i].id
2326
+                obj.type = 2
2327
+                obj.custom_id = this.rand(10000000, 99999999)
2328
+                obj.drug_specs = medicalList[i].drug_specs
2329
+                this.all_drug.push(obj)
2330
+              }
2331
+            }
2332
+
2333
+
2334
+            for (let i = 0; i < base_drug_list.length; i++) {
2335
+              if(base_drug_list[i].drug_specs != null) {
2336
+                for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
2337
+                  base_drug_list[i].drug_specs[a]['type'] = 1
2338
+                }
2339
+              }
2340
+                let obj = {
2341
+                  drug_name: "",
2342
+                  drug_desc: "",
2343
+                  delivery_way: "",
2344
+                  execution_frequency: "",
2345
+                  single_dose: "",
2346
+                  single_dose_unit: "",
2347
+                  prescribing_number: "",
2348
+                  prescribing_number_unit: "",
2349
+                  type_id: "",
2350
+                  type: "",
2351
+                  custom_id: "",
2352
+                  drug_specs: [],
2353
+                }
2354
+
2355
+                obj.drug_name = base_drug_list[i].drug_name
2356
+                obj.delivery_way = base_drug_list[i].delivery_way
2357
+                obj.execution_frequency = base_drug_list[i].execution_frequency
2358
+                obj.single_dose = base_drug_list[i].single_dose
2359
+                obj.prescribing_number = base_drug_list[i].prescribing_number
2360
+                obj.type_id = base_drug_list[i].id
2361
+                obj.type = 1
2362
+                obj.custom_id = this.rand(10000000, 99999999)
2363
+                obj.drug_specs = base_drug_list[i].drug_specs
2364
+                this.all_drug.push(obj)
2365
+              }
2366
+            }
2367
+        })
2368
+     },
2369
+    changeDrugName(name){
2370
+      this.current_drug_name = name
2371
+      this.form.advice_desc = ''
2372
+      this.drugSpec = []
2373
+      for (let i = 0; i < this.all_drug.length; i++) {
2374
+        if (this.all_drug[i].drug_name == name) {
2375
+            this.drugSpec = this.all_drug[i].drug_specs
2376
+          }
2377
+       }
2378
+    },
2379
+    changeDrugDesc(name) {
2380
+        this.current_drug_spec = name
2381
+        for (let i = 0; i < this.drugSpec.length; i++) {
2382
+          if (this.drugSpec[i].drug_spec == name) {
2383
+            this.form.advice_desc = this.drugSpec[i].drug_spec
2384
+            this.form.prescribing_number = this.drugSpec[i].prescribing_number.toString()
2385
+            this.form.single_dose = this.drugSpec[i].single_dose.toString()
2386
+            this.form.delivery_way = this.drugSpec[i].delivery_way.toString()
2387
+            this.form.execution_frequency = this.drugSpec[i].execution_frequency.toString()
2388
+            this.form.drug_id = this.drugSpec[i].id
2389
+            this.src_type = this.drugSpec[i].type
2390
+            this.form.drug_id = this.drugSpec[i].id
2391
+            this.form.way = this.drugSpec[i].type
2392
+          }
2393
+        }
2394
+      },
2395
+      rand(min, max) {
2396
+        return Math.floor(Math.random() * (max - min)) + min;
2397
+      },
2239
     },
2398
     },
2240
     created() {
2399
     created() {
2241
       var date = this.$route.query && this.$route.query.date
2400
       var date = this.$route.query && this.$route.query.date
2248
       this.request_record_date = this.record_date
2407
       this.request_record_date = this.record_date
2249
 
2408
 
2250
       this.getDialysisScheduleDetail()
2409
       this.getDialysisScheduleDetail()
2410
+       //获取自备药
2411
+      this.getSelfMedicalList()
2251
     },
2412
     },
2252
     components: {
2413
     components: {
2253
       AddGroupAdvice,
2414
       AddGroupAdvice,

+ 154 - 112
src/xt_pages/dialysis/details/dialog/adviceDialog/AddGroupAdvice.vue 查看文件

370
         <el-row>
370
         <el-row>
371
           <el-col :span="24">
371
           <el-col :span="24">
372
             <el-form-item label="医嘱内容 :" required prop="advice_name">
372
             <el-form-item label="医嘱内容 :" required prop="advice_name">
373
-              <!-- <el-input v-model="nameForm.advice_name"></el-input> -->
374
                <el-select
373
                <el-select
375
                 v-model="nameForm.advice_name"
374
                 v-model="nameForm.advice_name"
376
                 filterable
375
                 filterable
382
                 @change="changeDrugName"
381
                 @change="changeDrugName"
383
               >
382
               >
384
                 <el-option
383
                 <el-option
385
-                  v-for="item in medicals"
386
-                  :key="item.id"
384
+                  v-for="(item,index) in all_drug"
385
+                  :key="index"
387
                   :label="item.drug_name"
386
                   :label="item.drug_name"
388
-                  :value="item.id"
387
+                  :value="item.drug_name"
389
                 ></el-option>
388
                 ></el-option>
390
               </el-select>
389
               </el-select>
391
             </el-form-item>
390
             </el-form-item>
412
                   :disabled="isChild"
411
                   :disabled="isChild"
413
                   placeholder="请选择(输入可搜索)"
412
                   placeholder="请选择(输入可搜索)"
414
                   style="width:150px"
413
                   style="width:150px"
414
+                  @change="changeDrugDesc"
415
                 >
415
                 >
416
                   <el-option
416
                   <el-option
417
                     v-for="item in drugSpec"
417
                     v-for="item in drugSpec"
642
       selectedTemplate: [],
642
       selectedTemplate: [],
643
       allSelectedTemplate: [],
643
       allSelectedTemplate: [],
644
       medicals:[],
644
       medicals:[],
645
-      drugSpec:[]
645
+      drugSpec:[],
646
+      all_drug:[],
647
+      current_drug_name:"",
648
+      current_drug_spec: "",
649
+      drug_id: 0,
650
+      src_type:""
646
     };
651
     };
647
   },
652
   },
648
   props: {
653
   props: {
689
       default: function() {
694
       default: function() {
690
         return [];
695
         return [];
691
       }
696
       }
692
-    }
697
+    },
698
+   
693
   },
699
   },
694
   methods: {
700
   methods: {
695
     submitgroupAdvice(formName) {
701
     submitgroupAdvice(formName) {
716
           
722
           
717
      
723
      
718
           console.log("88888888",submitForm)
724
           console.log("88888888",submitForm)
719
- 
725
+          
720
           CreateGroupAdvice(this.patientID, 0, submitForm, mode).then(
726
           CreateGroupAdvice(this.patientID, 0, submitForm, mode).then(
721
             response => {
727
             response => {
722
               if (response.data.state == 0) {
728
               if (response.data.state == 0) {
838
         .catch(() => {});
844
         .catch(() => {});
839
     },
845
     },
840
     submitNameForm(formName) {
846
     submitNameForm(formName) {
841
-      
842
-      if(typeof(this.nameForm.advice_name) == "string"){
847
+      console.log("=====",this.src_type)
848
+       if(this.src_type == ""){
849
+          this.nameForm.way = 0
850
+          this.nameForm.drug_id = 0
851
+       }
852
+
853
+       if(this.src_type == 2){ //自备药
854
+          var arr = this.nameForm.advice_name.split("(自备药)")
855
+          this.nameForm.advice_name = arr[0]
856
+       }
857
+      // if(typeof(this.nameForm.advice_name) == "string"){
843
          
858
          
844
-          this.nameForm.advice_name == this.nameForm.advice_name
845
-      }
859
+      //     this.nameForm.advice_name == this.nameForm.advice_name
860
+      // }
846
 
861
 
847
-      if(typeof(this.nameForm.advice_name) == "number"){
848
-          var drug_name = ""
849
-          var name = ""
850
-          var way = 0
851
-          this.nameForm.drug_id = this.nameForm.advice_name
852
-          for(let i=0;i<this.medicals.length;i++){
853
-            if(this.nameForm.advice_name == this.medicals[i].id){
854
-              name = this.medicals[i].drug_name
855
-              way  = this.medicals[i].way
856
-            }
857
-          }
858
-          if(way == 1){
859
-            drug_name = name
860
-          }
861
-          if(way == 2){
862
-            var arr = name.split("(自备药)")
863
-            drug_name = arr[0]
864
-          }
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
+      //     }
865
           
880
           
866
-          this.nameForm.advice_name = drug_name
867
-          this.nameForm.way = way
868
-      }
881
+      //     this.nameForm.advice_name = drug_name
882
+      //     this.nameForm.way = way
883
+      // }
869
       
884
       
870
       var _this = this;
885
       var _this = this;
871
       this.$refs[formName].validate(valid => {
886
       this.$refs[formName].validate(valid => {
892
                       _this.groupForm.adviceNames[index].children[j].execution_frequency =_this.nameForm.execution_frequency;
907
                       _this.groupForm.adviceNames[index].children[j].execution_frequency =_this.nameForm.execution_frequency;
893
                       _this.groupForm.adviceNames[index].children[j].remark =_this.nameForm.remark;
908
                       _this.groupForm.adviceNames[index].children[j].remark =_this.nameForm.remark;
894
                       _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
909
                       _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
895
-                      _this.groupForm.adviceNames[index].children[j].way = this.nameForm.way;
910
+                      _this.groupForm.adviceNames[index].children[j].way = _this.nameForm.way;
896
                       _this.$set(_this.groupForm.adviceNames[index].children,j,_this.groupForm.adviceNames[index].children[j]
911
                       _this.$set(_this.groupForm.adviceNames[index].children,j,_this.groupForm.adviceNames[index].children[j]
897
                      
912
                      
898
                       );
913
                       );
916
                   _this.groupForm.adviceNames[index].execution_frequency =_this.nameForm.execution_frequency;
931
                   _this.groupForm.adviceNames[index].execution_frequency =_this.nameForm.execution_frequency;
917
                   _this.groupForm.adviceNames[index].remark =_this.nameForm.remark;
932
                   _this.groupForm.adviceNames[index].remark =_this.nameForm.remark;
918
                   _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
933
                   _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
919
-                  _this.groupForm.adviceNames[index].children[j].way = this.nameForm.way;
934
+                  _this.groupForm.adviceNames[index].children[j].way = _this.nameForm.way;
920
                   _this.$set(
935
                   _this.$set(
921
                     _this.groupForm.adviceNames,
936
                     _this.groupForm.adviceNames,
922
                     index,
937
                     index,
1520
         }
1535
         }
1521
       }
1536
       }
1522
     },
1537
     },
1523
-
1538
+    rand(min, max) {
1539
+        return Math.floor(Math.random() * (max - min)) + min;
1540
+     },
1524
     //
1541
     //
1525
     getSelfMedicalList(){
1542
     getSelfMedicalList(){
1526
         const params = {
1543
         const params = {
1527
           patient_id:this.$route.query.patient_id
1544
           patient_id:this.$route.query.patient_id
1528
         }
1545
         }
1529
       getSelfMedicalList(params).then(response=>{
1546
       getSelfMedicalList(params).then(response=>{
1530
-          if(response.data.state == 1){
1531
-            var medicalList =  response.data.data.medicalList
1532
-            //way字段区分数据源:1代表来自基础库  2代表来自药品库
1533
-            for(let i=0;i<medicalList.length;i++){
1534
-               medicalList[i].way = 2
1535
-            }
1536
-            for(let i=0;i<medicalList.length;i++){
1537
-               medicalList[i].drug_name = medicalList[i].drug_name+"(自备药)"
1538
-            }
1539
-            var drugname = response.data.data.drugName
1540
-            for(let i=0;i<drugname.length;i++){
1541
-               drugname[i].way = 1
1547
+         if (response.data.state == 1) {
1548
+            this.arr_drug = []
1549
+            var medicalList = response.data.data.private_drug_list
1550
+            var base_drug_list = response.data.data.base_drug_list
1551
+            var base_drug_cofig = response.data.data.base_drug_config
1552
+            var private_drug_cofig = response.data.data.private_drug_config
1553
+
1554
+
1555
+            if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
1556
+
1557
+              for (let i = 0; i < medicalList.length; i++) {
1558
+                if(medicalList[i].drug_specs != null) {
1559
+                  for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
1560
+                    medicalList[i].drug_specs[a]['type'] = 2
1561
+                  }
1562
+                }
1563
+                let obj = {
1564
+                  drug_name: "",
1565
+                  drug_desc: "",
1566
+                  delivery_way: "",
1567
+                  execution_frequency: "",
1568
+                  single_dose: "",
1569
+                  single_dose_unit: "",
1570
+                  prescribing_number: "",
1571
+                  prescribing_number_unit: "",
1572
+                  type_id: "",
1573
+                  type: "",
1574
+                  custom_id: "",
1575
+                  drug_specs: [],
1576
+                }
1577
+
1578
+                medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
1579
+                obj.drug_name = medicalList[i].drug_name
1580
+                obj.delivery_way = medicalList[i].delivery_way
1581
+                obj.execution_frequency = medicalList[i].execution_frequency
1582
+                obj.single_dose = medicalList[i].single_dose
1583
+                obj.prescribing_number = medicalList[i].prescribing_number
1584
+                obj.type_id = medicalList[i].id
1585
+                obj.type = 2
1586
+                obj.custom_id = this.rand(10000000, 99999999)
1587
+                obj.drug_specs = medicalList[i].drug_specs
1588
+                this.all_drug.push(obj)
1589
+              }
1542
             }
1590
             }
1543
 
1591
 
1544
-            drugname.push(...medicalList)
1545
-            
1546
-            this.medicals = drugname
1592
+
1593
+            for (let i = 0; i < base_drug_list.length; i++) {
1594
+              if(base_drug_list[i].drug_specs != null) {
1595
+                for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
1596
+                  base_drug_list[i].drug_specs[a]['type'] = 1
1597
+                }
1598
+              }
1599
+                let obj = {
1600
+                  drug_name: "",
1601
+                  drug_desc: "",
1602
+                  delivery_way: "",
1603
+                  execution_frequency: "",
1604
+                  single_dose: "",
1605
+                  single_dose_unit: "",
1606
+                  prescribing_number: "",
1607
+                  prescribing_number_unit: "",
1608
+                  type_id: "",
1609
+                  type: "",
1610
+                  custom_id: "",
1611
+                  drug_specs: [],
1612
+                }
1613
+
1614
+                obj.drug_name = base_drug_list[i].drug_name
1615
+                obj.delivery_way = base_drug_list[i].delivery_way
1616
+                obj.execution_frequency = base_drug_list[i].execution_frequency
1617
+                obj.single_dose = base_drug_list[i].single_dose
1618
+                obj.prescribing_number = base_drug_list[i].prescribing_number
1619
+                obj.type_id = base_drug_list[i].id
1620
+                obj.type = 1
1621
+                obj.custom_id = this.rand(10000000, 99999999)
1622
+                obj.drug_specs = base_drug_list[i].drug_specs
1623
+                this.all_drug.push(obj)
1624
+              }
1625
+            }   
1626
+        })
1627
+       
1628
+    },
1629
+    changeDrugName(name){
1630
+       this.current_drug_name = name
1631
+       this.nameForm.advice_desc = ''
1632
+      this.drugSpec = []
1633
+      for (let i = 0; i < this.all_drug.length; i++) {
1634
+        if (this.all_drug[i].drug_name == name) {
1635
+            this.drugSpec = this.all_drug[i].drug_specs
1547
           }
1636
           }
1548
-      })
1637
+       }
1549
     },
1638
     },
1550
-    changeDrugName(id){
1551
-      var drug_name = ""
1552
-      var name = ""
1553
-      var way = 0
1554
-      for(let i=0;i<this.medicals.length;i++){
1555
-        if(id == this.medicals[i].id){
1556
-          name = this.medicals[i].drug_name
1557
-          way  = this.medicals[i].way
1639
+    changeDrugDesc(name) {
1640
+        this.current_drug_spec = name
1641
+        for (let i = 0; i < this.drugSpec.length; i++) {
1642
+          if (this.drugSpec[i].drug_spec == name) {
1643
+            this.nameForm.advice_desc = this.drugSpec[i].drug_spec
1644
+            this.nameForm.prescribing_number = this.drugSpec[i].prescribing_number.toString()
1645
+            this.nameForm.single_dose = this.drugSpec[i].single_dose.toString()
1646
+            this.nameForm.delivery_way = this.drugSpec[i].delivery_way.toString()
1647
+            this.nameForm.execution_frequency = this.drugSpec[i].execution_frequency.toString()
1648
+            this.drug_id = this.drugSpec[i].id
1649
+            this.src_type = this.drugSpec[i].type
1650
+            this.nameForm.drug_id = this.drugSpec[i].id
1651
+            this.nameForm.way = this.drugSpec[i].type
1652
+          }
1558
         }
1653
         }
1559
       }
1654
       }
1560
-      if(way == 1){
1561
-        drug_name = name
1562
-      }
1563
-      if(way == 2){
1564
-        var arr = name.split("(自备药)")
1565
-        drug_name = arr[0]
1566
-      }
1567
-        const params = {
1568
-          drug_name:drug_name,
1569
-          patient_id:this.$route.query.patient_id,
1570
-          way:way,
1571
-          id:id,
1572
-        }
1573
-      getDrugDescByDrugName(params).then(response=>{
1574
-          if(response.data.state == 1){
1575
-             var drugspec = response.data.data.drugspec
1576
-          
1577
-             if(drugspec[0].drug_spec !=0){
1578
-                this.nameForm.advice_desc = drugspec[0].drug_spec
1579
-             }
1580
-             if(drugspec[0].min_unit!=0){
1581
-                 this.nameForm.drug_spec_unit = drugspec[0].min_unit
1582
-             }
1583
-             if(drugspec[0].delivery_way!=0){
1584
-                 this.nameForm.delivery_way = drugspec[0].delivery_way
1585
-             }
1586
-             if(drugspec[0].execution_frequency!=0){
1587
-                this.nameForm.execution_frequency = drugspec[0].execution_frequency
1588
-             }
1589
-             if(drugspec[0].single_dose !=0){
1590
-                this.nameForm.single_dose = drugspec[0].single_dose.toString()
1591
-             } 
1592
-             if(drugspec[0].min_unit !=0){
1593
-               this.nameForm.single_dose_unit = drugspec[0].min_unit
1594
-             }
1595
-             if(drugspec[0].min_unit!=0){
1596
-               this.nameForm.prescribing_number_unit = drugspec[0].min_unit
1597
-             }
1598
-              
1599
-             if( drugspec[0].prescribing_number!=0){
1600
-                this.nameForm.prescribing_number = drugspec[0].prescribing_number.toString()
1601
-             }
1602
-             var countInfo = response.data.data.countInfo
1603
-             console.log("countInfo",countInfo)
1604
-             var countOut = response.data.data.countout
1605
-             console.log("countout",countOut)
1606
-             var arr = countInfo[0].Count - countOut[0].Count
1607
-             console.log("arr222",arr)
1608
-             this.drugSpec = drugspec
1609
-          }
1610
-      })
1611
-    
1612
-    }
1613
   },
1655
   },
1614
   watch: {
1656
   watch: {
1615
     "selectedTemp.list": function() {
1657
     "selectedTemp.list": function() {

+ 117 - 85
src/xt_pages/dialysis/details/dialog/adviceDialog/EditGroupAdvice.vue 查看文件

381
                 @change="changeDrugName"
381
                 @change="changeDrugName"
382
               >
382
               >
383
                 <el-option
383
                 <el-option
384
-                  v-for="item in medicals"
385
-                  :key="item.id"
384
+                  v-for="(item,index) in all_drug"
385
+                  :key="index"
386
                   :label="item.drug_name"
386
                   :label="item.drug_name"
387
-                  :value="item.id"
387
+                  :value="item.drug_name"
388
                 ></el-option>
388
                 ></el-option>
389
               </el-select>
389
               </el-select>
390
             </el-form-item>
390
             </el-form-item>
396
             <el-form-item label="药品规格 :" prop="advice_desc">
396
             <el-form-item label="药品规格 :" prop="advice_desc">
397
               <el-col :span="10">
397
               <el-col :span="10">
398
                 <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
398
                 <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
399
-                 <el-select
399
+                <el-select
400
                   v-model="nameForm.advice_desc"
400
                   v-model="nameForm.advice_desc"
401
                   filterable
401
                   filterable
402
                   clearable
402
                   clearable
404
                   :disabled="isChild"
404
                   :disabled="isChild"
405
                   placeholder="请选择(输入可搜索)"
405
                   placeholder="请选择(输入可搜索)"
406
                   style="width:150px"
406
                   style="width:150px"
407
+                  @change="changeDrugDesc"
407
                 >
408
                 >
408
                   <el-option
409
                   <el-option
409
                     v-for="item in drugSpec"
410
                     v-for="item in drugSpec"
620
       selectedTemplate: [],
621
       selectedTemplate: [],
621
       allSelectedTemplate: [],
622
       allSelectedTemplate: [],
622
       medicals:[],
623
       medicals:[],
623
-      drugSpec:[]
624
+      drugSpec:[],
625
+      all_drug:[],
626
+      current_drug_name:"",
627
+      current_drug_spec: "",
628
+      drug_id: 0,
629
+      src_type:""
624
     };
630
     };
625
   },
631
   },
626
   props: {
632
   props: {
2229
           patient_id:this.$route.query.patient_id
2235
           patient_id:this.$route.query.patient_id
2230
         }
2236
         }
2231
       getSelfMedicalList(params).then(response=>{
2237
       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
2238
+         if (response.data.state == 1) {
2239
+            this.arr_drug = []
2240
+            var medicalList = response.data.data.private_drug_list
2241
+            var base_drug_list = response.data.data.base_drug_list
2242
+            var base_drug_cofig = response.data.data.base_drug_config
2243
+            var private_drug_cofig = response.data.data.private_drug_config
2244
+
2245
+
2246
+            if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
2247
+
2248
+              for (let i = 0; i < medicalList.length; i++) {
2249
+                if(medicalList[i].drug_specs != null) {
2250
+                  for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
2251
+                    medicalList[i].drug_specs[a]['type'] = 2
2252
+                  }
2253
+                }
2254
+                let obj = {
2255
+                  drug_name: "",
2256
+                  drug_desc: "",
2257
+                  delivery_way: "",
2258
+                  execution_frequency: "",
2259
+                  single_dose: "",
2260
+                  single_dose_unit: "",
2261
+                  prescribing_number: "",
2262
+                  prescribing_number_unit: "",
2263
+                  type_id: "",
2264
+                  type: "",
2265
+                  custom_id: "",
2266
+                  drug_specs: [],
2267
+                }
2268
+
2269
+                medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
2270
+                obj.drug_name = medicalList[i].drug_name
2271
+                obj.delivery_way = medicalList[i].delivery_way
2272
+                obj.execution_frequency = medicalList[i].execution_frequency
2273
+                obj.single_dose = medicalList[i].single_dose
2274
+                obj.prescribing_number = medicalList[i].prescribing_number
2275
+                obj.type_id = medicalList[i].id
2276
+                obj.type = 2
2277
+                obj.custom_id = this.rand(10000000, 99999999)
2278
+                obj.drug_specs = medicalList[i].drug_specs
2279
+                this.all_drug.push(obj)
2280
+              }
2244
             }
2281
             }
2245
 
2282
 
2246
-            drugname.push(...medicalList)
2247
-            console.log("222222222我的",drugname)
2248
-            this.medicals = drugname
2283
+
2284
+            for (let i = 0; i < base_drug_list.length; i++) {
2285
+              if(base_drug_list[i].drug_specs != null) {
2286
+                for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
2287
+                  base_drug_list[i].drug_specs[a]['type'] = 1
2288
+                }
2289
+              }
2290
+                let obj = {
2291
+                  drug_name: "",
2292
+                  drug_desc: "",
2293
+                  delivery_way: "",
2294
+                  execution_frequency: "",
2295
+                  single_dose: "",
2296
+                  single_dose_unit: "",
2297
+                  prescribing_number: "",
2298
+                  prescribing_number_unit: "",
2299
+                  type_id: "",
2300
+                  type: "",
2301
+                  custom_id: "",
2302
+                  drug_specs: [],
2303
+                }
2304
+
2305
+                obj.drug_name = base_drug_list[i].drug_name
2306
+                obj.delivery_way = base_drug_list[i].delivery_way
2307
+                obj.execution_frequency = base_drug_list[i].execution_frequency
2308
+                obj.single_dose = base_drug_list[i].single_dose
2309
+                obj.prescribing_number = base_drug_list[i].prescribing_number
2310
+                obj.type_id = base_drug_list[i].id
2311
+                obj.type = 1
2312
+                obj.custom_id = this.rand(10000000, 99999999)
2313
+                obj.drug_specs = base_drug_list[i].drug_specs
2314
+                this.all_drug.push(obj)
2315
+              }
2316
+            }   
2317
+        })
2318
+       
2319
+    },
2320
+    changeDrugName(name){
2321
+       this.current_drug_name = name
2322
+       this.nameForm.advice_desc = ''
2323
+      this.drugSpec = []
2324
+      for (let i = 0; i < this.all_drug.length; i++) {
2325
+        if (this.all_drug[i].drug_name == name) {
2326
+            this.drugSpec = this.all_drug[i].drug_specs
2249
           }
2327
           }
2250
-      })
2328
+       }
2251
     },
2329
     },
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
2330
+    changeDrugDesc(name) {
2331
+        this.current_drug_spec = name
2332
+        for (let i = 0; i < this.drugSpec.length; i++) {
2333
+          if (this.drugSpec[i].drug_spec == name) {
2334
+            this.nameForm.advice_desc = this.drugSpec[i].drug_spec
2335
+            this.nameForm.prescribing_number = this.drugSpec[i].prescribing_number.toString()
2336
+            this.nameForm.single_dose = this.drugSpec[i].single_dose.toString()
2337
+            this.nameForm.delivery_way = this.drugSpec[i].delivery_way.toString()
2338
+            this.nameForm.execution_frequency = this.drugSpec[i].execution_frequency.toString()
2339
+            this.drug_id = this.drugSpec[i].id
2340
+            this.src_type = this.drugSpec[i].type
2341
+            this.nameForm.drug_id = this.drugSpec[i].id
2342
+            this.nameForm.way = this.drugSpec[i].type
2313
           }
2343
           }
2314
-      })
2315
-    
2316
-    }
2344
+        }
2345
+    },
2346
+    rand(min, max) {
2347
+        return Math.floor(Math.random() * (max - min)) + min;
2348
+     },
2317
   },
2349
   },
2318
   watch: {
2350
   watch: {
2319
     "selectedTemp.list": function() {
2351
     "selectedTemp.list": function() {

+ 97 - 37
src/xt_pages/stock/selfPreparedMedicine/info.vue 查看文件

74
                         <el-table-column align="center" prop="name" label="操作" width="180">
74
                         <el-table-column align="center" prop="name" label="操作" width="180">
75
                             <template slot-scope="scope">
75
                             <template slot-scope="scope">
76
                                 <el-button size="mini" type="primary" @click="toDetail(scope.row.id)">编辑</el-button>
76
                                 <el-button size="mini" type="primary" @click="toDetail(scope.row.id)">编辑</el-button>
77
-                                <el-button size="mini" type="danger" @click="DeleteDrugStand(scope.row.id,scope.$index)">删除</el-button>
77
+                                <el-button size="mini" type="danger" @click="DeleteDrugStand(scope.row.id,scope.row.drug_name,scope.$index)">删除</el-button>
78
                             </template>
78
                             </template>
79
                         </el-table-column>
79
                         </el-table-column>
80
                     </el-table>
80
                     </el-table>
153
                  </el-col>
153
                  </el-col>
154
                   <el-col :span="6">
154
                   <el-col :span="6">
155
                     <el-form-item label="单位:">
155
                     <el-form-item label="单位:">
156
-                       <el-input v-model="form.unit" style="width:150px"></el-input>
156
+                       <el-select v-model="form.unit" style="width:160px;" placeholder="请选择">
157
+                        <el-option
158
+                          v-for="(item,index) in getDataConfig('hemodialysis','units')"
159
+                          :key="index"
160
+                          :label="item.name"
161
+                          :value="item.id">
162
+                        </el-option>
163
+                     </el-select>
157
                     </el-form-item>
164
                     </el-form-item>
158
                  </el-col>
165
                  </el-col>
159
                   <el-col :span="6">
166
                   <el-col :span="6">
187
               <el-row :span="24">
194
               <el-row :span="24">
188
                 <el-col :span="6">
195
                 <el-col :span="6">
189
                     <el-form-item label="规格名称:">
196
                     <el-form-item label="规格名称:">
190
-                        <el-select v-model="editform.drug_name_id" filterable placeholder="请选择"
197
+                      <el-select v-model="editform.drug_name_id" filterable placeholder="请选择"
198
+                        style="width:150px" 
191
                         @change="changeRuleNameTwo">
199
                         @change="changeRuleNameTwo">
192
                             <el-option
200
                             <el-option
193
                             v-for="item in ruleName"
201
                             v-for="item in ruleName"
200
                  </el-col>
208
                  </el-col>
201
                   <el-col :span="6">
209
                   <el-col :span="6">
202
                     <el-form-item label="单位:">
210
                     <el-form-item label="单位:">
203
-                       <el-input v-model="form.unit"></el-input>
211
+                       <el-select v-model="form.unit" style="width:160px;" placeholder="请选择">
212
+                        <el-option
213
+                          v-for="(item,index) in getDataConfig('hemodialysis','units')"
214
+                          :key="index"
215
+                          :label="item.name"
216
+                          :value="item.id">
217
+                        </el-option>
218
+                     </el-select>
204
                     </el-form-item>
219
                     </el-form-item>
205
                  </el-col>
220
                  </el-col>
206
                   <el-col :span="6">
221
                   <el-col :span="6">
207
                     <el-form-item label="价格:">
222
                     <el-form-item label="价格:">
208
-                       <el-input v-model="form.price"></el-input>
223
+                       <el-input v-model="form.price" style="width:150px"></el-input>
209
                     </el-form-item>
224
                     </el-form-item>
210
                  </el-col>
225
                  </el-col>
211
                  <el-col :span="6">
226
                  <el-col :span="6">
212
                     <el-form-item label="库存警戒:">
227
                     <el-form-item label="库存警戒:">
213
-                       <el-input v-model="form.drug_stock_limit"></el-input>
228
+                       <el-input v-model="form.drug_stock_limit" style="width:150px"></el-input>
214
                     </el-form-item>
229
                     </el-form-item>
215
                  </el-col>
230
                  </el-col>
216
              </el-row> 
231
              </el-row> 
218
         </span>
233
         </span>
219
         <span slot="footer" class="dialog-footer">
234
         <span slot="footer" class="dialog-footer">
220
             <el-button @click="editRuleDialogVisible = false">取 消</el-button>
235
             <el-button @click="editRuleDialogVisible = false">取 消</el-button>
221
-            <el-button  @click="updatedRulleName">保 存</el-button>
236
+            <el-button  @click="updatedRulleName" type="primary">保 存</el-button>
222
         </span>
237
         </span>
223
         </el-dialog>
238
         </el-dialog>
224
 
239
 
236
 import medicineDetail from "./components/medicineDetail"
251
 import medicineDetail from "./components/medicineDetail"
237
 import warehousing from "./components/warehousing"
252
 import warehousing from "./components/warehousing"
238
 import warehouseOut from "./components/warehouseOut"
253
 import warehouseOut from "./components/warehouseOut"
239
-import { getAllDrugName,saveDrugName,getdrugNameList,getRulleName,getUnitByBaseId,saveRulleName,EditRullerName,updatedRulleName,DeleteDrugById,DeleteDrugStand,saveRadio,getDrugSet }  from "@/api/drug/drug"
254
+import { getAllDrugName,saveDrugName,getdrugNameList,getStandName,getUnitByBaseId,saveRulleName,EditRullerName,updatedRulleName,DeleteDrugById,DeleteDrugStand,saveRadio,getDrugSet,getRullerList }  from "@/api/drug/drug"
255
+ import {getDataConfig } from "@/utils/data";
240
 export default {
256
 export default {
241
     components:{
257
     components:{
242
         BreadCrumb,
258
         BreadCrumb,
290
             },
306
             },
291
             editform:{
307
             editform:{
292
               drug_name_id:"",
308
               drug_name_id:"",
309
+              drug_id:""
293
             },
310
             },
294
             rullerList:[],
311
             rullerList:[],
295
             editRuleDialogVisible:false,
312
             editRuleDialogVisible:false,
313
+            untis:[]
296
         }
314
         }
297
     },
315
     },
298
     methods:{
316
     methods:{
317
           EditRullerName(params).then(response=>{
335
           EditRullerName(params).then(response=>{
318
             if(response.data.state == 1){
336
             if(response.data.state == 1){
319
               var rullerdetail =  response.data.data.rullerDetail
337
               var rullerdetail =  response.data.data.rullerDetail
338
+              console.log("rullerdetail222",rullerdetail)
320
               this.form.id = rullerdetail.id
339
               this.form.id = rullerdetail.id
321
-              this.editform.drug_name_id = rullerdetail.drug_spec
322
-              this.form.unit = rullerdetail.min_unit
340
+              this.editform.drug_name_id = rullerdetail.drug_name_id
341
+              this.editform.drug_id = rullerdetail.drug_id
342
+              var id = 0
343
+              for(let i=0;i<this.untis.length;i++){
344
+                 if(rullerdetail.min_unit == this.untis[i].name){
345
+                   id = this.untis[i].id
346
+                 }
347
+              }
348
+              this.form.unit = id
323
               this.form.price = rullerdetail.price
349
               this.form.price = rullerdetail.price
324
               this.form.drug_stock_limit = rullerdetail.drug_stock_limit
350
               this.form.drug_stock_limit = rullerdetail.drug_stock_limit
325
             }
351
             }
341
           })  
367
           })  
342
         },
368
         },
343
         handleCurrentChange(val){
369
         handleCurrentChange(val){
370
+          console.log("val===",val)
344
           this.form.drug_id = val.id
371
           this.form.drug_id = val.id
345
           //获取药品规格名称
372
           //获取药品规格名称
346
-          this.getRulleName(val.drug_name)
373
+          this.getStandName(val.drug_name)
374
+          this.getRullerList(val.id)
347
 
375
 
348
         },
376
         },
349
        handleClose(){
377
        handleClose(){
407
          getdrugNameList().then(response=>{
435
          getdrugNameList().then(response=>{
408
            if(response.data.state == 1){
436
            if(response.data.state == 1){
409
               var list =  response.data.data.list
437
               var list =  response.data.data.list
438
+              console.log("lsit",list)
410
               this.tableData = list
439
               this.tableData = list
411
             }
440
             }
412
          })    
441
          })    
418
 
447
 
419
 
448
 
420
       //获取药品库的规格名称
449
       //获取药品库的规格名称
421
-       getRulleName(name){
450
+       getStandName(name){
422
           const params = {
451
           const params = {
423
              name:name
452
              name:name
424
           }
453
           }
425
-         getRulleName(params).then(response=>{
454
+         getStandName(params).then(response=>{
426
             if(response.data.state == 1){
455
             if(response.data.state == 1){
427
-              var rulleName = response.data.data.rulleName
428
-              this.ruleName = rulleName
429
-             
430
-              var rullerlist =  response.data.data.rullerList
431
-             
432
-              this.rullerList  = rullerlist
456
+              var ruleName =  response.data.data.rullerlist
457
+              console.log("ruleName22222",ruleName)
458
+              this.ruleName  = ruleName
433
             }
459
             }
434
          }) 
460
          }) 
435
        },
461
        },
448
          getUnitByBaseId(params).then(response=>{
474
          getUnitByBaseId(params).then(response=>{
449
             if(response.data.state == 1){
475
             if(response.data.state == 1){
450
               var baseList =  response.data.data.baseList
476
               var baseList =  response.data.data.baseList
451
-              this.form.unit = baseList.min_unit
477
+              this.form.unit = parseInt(baseList.min_unit)
452
               this.form.drug_stock_limit = baseList.drug_stock_limit,
478
               this.form.drug_stock_limit = baseList.drug_stock_limit,
453
               this.form.price = baseList.retail_price
479
               this.form.price = baseList.retail_price
454
               
480
               
468
                 drug_name = this.ruleName[i].drug_name
494
                 drug_name = this.ruleName[i].drug_name
469
               }
495
               }
470
            }
496
            }
497
+           var unit = ""
498
+           for(let i=0;i<this.untis.length;i++){
499
+             if(this.form.unit == this.untis[i].id){
500
+                unit = this.untis[i].name
501
+             }
502
+           }
471
            const params = {
503
            const params = {
472
              drug_spec:drug_spec,
504
              drug_spec:drug_spec,
473
              drug_name_id:this.form.drug_name_id,
505
              drug_name_id:this.form.drug_name_id,
474
              drug_id:this.form.drug_id,
506
              drug_id:this.form.drug_id,
475
-             unit:this.form.unit,
507
+             unit:unit,
476
              price:this.form.price,
508
              price:this.form.price,
477
              drug_stock_limit:this.form.drug_stock_limit, 
509
              drug_stock_limit:this.form.drug_stock_limit, 
478
              drug_name:drug_name
510
              drug_name:drug_name
479
            }
511
            }
480
-      
481
          saveRulleName(params).then(response=>{
512
          saveRulleName(params).then(response=>{
482
             if(response.data.state == 1){
513
             if(response.data.state == 1){
483
               var standName =  response.data.data.RullerName
514
               var standName =  response.data.data.RullerName
484
               this.$message.success("保存成功")
515
               this.$message.success("保存成功")
485
-              this.getRulleName(standName.drug_name)
516
+              this.getRullerList(standName.drug_id)
486
               this.ruleDialogVisible = false
517
               this.ruleDialogVisible = false
487
               this.form.drug_name_id = ""
518
               this.form.drug_name_id = ""
488
               this.form.unit = ""
519
               this.form.unit = ""
504
                 drug_name = this.ruleName[i].drug_name
535
                 drug_name = this.ruleName[i].drug_name
505
               }
536
               }
506
            }
537
            }
538
+           var unit = ""
539
+           for(let i=0;i<this.untis.length;i++){
540
+             if(this.form.unit == this.untis[i].id){
541
+                unit = this.untis[i].name
542
+             }
543
+           }
507
            const params = {
544
            const params = {
508
              drug_spec:drug_spec,
545
              drug_spec:drug_spec,
509
              drug_name_id:this.form.drug_name_id,
546
              drug_name_id:this.form.drug_name_id,
510
-             unit:this.form.unit,
547
+             unit:unit,
511
              price:this.form.price,
548
              price:this.form.price,
512
              drug_stock_limit:this.form.drug_stock_limit, 
549
              drug_stock_limit:this.form.drug_stock_limit, 
513
              drug_name:drug_name,
550
              drug_name:drug_name,
514
              drug_id:this.form.drug_id,
551
              drug_id:this.form.drug_id,
515
            }
552
            }
553
+           
516
          saveRulleName(params).then(response=>{
554
          saveRulleName(params).then(response=>{
517
             if(response.data.state == 1){
555
             if(response.data.state == 1){
518
               var RullerName =  response.data.data.RullerName
556
               var RullerName =  response.data.data.RullerName
519
-              this.getRulleName(RullerName.drug_name)
557
+              this.getRullerList(RullerName.drug_id)
520
               this.$message.success("保存成功")
558
               this.$message.success("保存成功")
521
               this.form.drug_name_id = ""
559
               this.form.drug_name_id = ""
522
               this.form.unit = ""
560
               this.form.unit = ""
534
                 drug_name = this.ruleName[i].drug_name
572
                 drug_name = this.ruleName[i].drug_name
535
               }
573
               }
536
            }
574
            }
537
-
575
+           var unit = ""
576
+           for(let i=0;i<this.untis.length;i++){
577
+             if(this.form.unit == this.untis[i].id){
578
+                unit = this.untis[i].name
579
+             }
580
+           }
538
            const params = {
581
            const params = {
539
              id:this.form.id,
582
              id:this.form.id,
540
              drug_name_id:this.editform.drug_name_id,
583
              drug_name_id:this.editform.drug_name_id,
541
              drug_spec:drug_spec,
584
              drug_spec:drug_spec,
542
-             unit:this.form.unit,
585
+             unit:unit,
543
              price:this.form.price,
586
              price:this.form.price,
544
              drug_stock_limit:this.form.drug_stock_limit, 
587
              drug_stock_limit:this.form.drug_stock_limit, 
545
-             drug_name:drug_name
588
+             drug_name:drug_name,
589
+             drug_id:this.editform.drug_id
546
            }
590
            }
547
-         
548
          updatedRulleName(params).then(response=>{
591
          updatedRulleName(params).then(response=>{
549
             if(response.data.state == 1){
592
             if(response.data.state == 1){
550
                var rullername = response.data.data.RullerName
593
                var rullername = response.data.data.RullerName
594
+               console.log("rullername",rullername)
551
                this.$message.success("保存成功")
595
                this.$message.success("保存成功")
552
-               this.getRulleName(rullername.drug_name)
596
+               this.getRullerList(rullername.drug_id)
553
                this.editRuleDialogVisible = false
597
                this.editRuleDialogVisible = false
598
+            }else {
599
+               this.$message.error("药品规格名称已存在")
554
             }
600
             }
555
          })
601
          })
556
        },
602
        },
566
                 id:id,
612
                 id:id,
567
                 drug_name:drugname
613
                 drug_name:drugname
568
               }
614
               }
615
+           
569
             DeleteDrugById(params).then(response => {
616
             DeleteDrugById(params).then(response => {
570
               if (response.data.state == 1) {
617
               if (response.data.state == 1) {
571
                   var msg = response.data.data.msg
618
                   var msg = response.data.data.msg
580
           })
627
           })
581
        },
628
        },
582
 
629
 
583
-       DeleteDrugStand(id,index){
630
+       DeleteDrugStand(id,drug_name,index){
584
           this.$confirm('确认删除吗?', '删除', {
631
           this.$confirm('确认删除吗?', '删除', {
585
           confirmButtonText: '确 定',
632
           confirmButtonText: '确 定',
586
           cancelButtonText: '取 消',
633
           cancelButtonText: '取 消',
587
           type: 'warning'
634
           type: 'warning'
588
-        })
589
-          .then(() => {
590
-            DeleteDrugStand(id,index).then(response => {
635
+        }).then(() => {
636
+            DeleteDrugStand(id,drug_name,index).then(response => {
591
               if (response.data.state == 1) {
637
               if (response.data.state == 1) {
592
                   var msg = response.data.data.msg
638
                   var msg = response.data.data.msg
593
                   this.rullerList.splice(index, 1);
639
                   this.rullerList.splice(index, 1);
594
                   this.$message.success("删除成功")
640
                   this.$message.success("删除成功")
595
               } else {
641
               } else {
596
-                  this.$message.error("删除失败")
642
+                  this.$message.error("该药品信息已经为患者添加自备药不能删除")
597
               }
643
               }
598
             })
644
             })
599
           })
645
           })
621
               this.radio  = drugset.drug_start.toString()
667
               this.radio  = drugset.drug_start.toString()
622
             }
668
             }
623
          })
669
          })
624
-        }
670
+        },
671
+        getRullerList(id){
672
+           const params = {
673
+             id:id
674
+           }
675
+           getRullerList(params).then(response=>{
676
+             if(response.data.state == 1){
677
+              this.rullerList =  response.data.data.rullerlist
678
+             }
679
+           })
680
+        },
681
+      getDataConfig(module, filed_name){
682
+        return getDataConfig(module, filed_name)
683
+      },
625
     },
684
     },
626
     created(){
685
     created(){
627
        //获取药品库所有药品名称
686
        //获取药品库所有药品名称
630
 
689
 
631
        //获取设置
690
        //获取设置
632
        this.getDrugSet()
691
        this.getDrugSet()
633
-      
692
+       this.untis =  getDataConfig('hemodialysis','units')
693
+       console.log("this.untis2222",this.untis)
634
      
694
      
635
     },
695
     },
636
     watch: {
696
     watch: {

+ 29 - 16
src/xt_pages/stock/selfPreparedMedicine/query.vue 查看文件

103
 <script>
103
 <script>
104
 import BreadCrumb from "../../components/bread-crumb";
104
 import BreadCrumb from "../../components/bread-crumb";
105
 import { parseTime } from '@/utils'
105
 import { parseTime } from '@/utils'
106
-import { getAllDrugName,getRulleName,getAllPatientStockList } from "@/api/drug/drug"
106
+import { getAllMedicalList,getRulleName,getAllPatientStockList } from "@/api/drug/drug"
107
 const moment = require('moment')
107
 const moment = require('moment')
108
 export default {
108
 export default {
109
     components:{
109
     components:{
162
         this.getlist()
162
         this.getlist()
163
       },
163
       },
164
 
164
 
165
-      getAllDrugName(){
166
-        getAllDrugName().then(response=>{
165
+      getAllMedicalList(){
166
+        getAllMedicalList().then(response=>{
167
           if(response.data.state == 1){
167
           if(response.data.state == 1){
168
              var drugName =  response.data.data.drugName  
168
              var drugName =  response.data.data.drugName  
169
              var obj = {
169
              var obj = {
180
           }
180
           }
181
         })
181
         })
182
       },
182
       },
183
-      getRulleName(name){
183
+      getRulleName(id){
184
           const params = {
184
           const params = {
185
-             name:name
185
+             id:id
186
           }
186
           }
187
         getRulleName(params).then(response=>{
187
         getRulleName(params).then(response=>{
188
            if(response.data.state == 1){
188
            if(response.data.state == 1){
189
-             var rulleName = response.data.data.rulleName
190
-             this.rulleName = rulleName
189
+             var rulleName = response.data.data.rullerList
190
+             var obj = {
191
+               id:0,
192
+               drug_spec:"全部"
193
+             }
194
+             var arr = []
195
+             arr.push(obj)
196
+             arr.push(...rulleName)
197
+             console.log("rulleName",arr)
198
+             this.rulleName = arr
191
            }
199
            }
192
         })  
200
         })  
193
       },
201
       },
197
       changeDrugName(id){
205
       changeDrugName(id){
198
         var drug_name = ""
206
         var drug_name = ""
199
         for(let i=0;i<this.drugName.length;i++){
207
         for(let i=0;i<this.drugName.length;i++){
200
-           if(id == this.drugName[i].id){
208
+          if(id == this.drugName[i].id){
201
              drug_name = this.drugName[i].drug_name
209
              drug_name = this.drugName[i].drug_name
202
-           }
210
+          }
203
         }
211
         }
204
         this.drug_name = drug_name
212
         this.drug_name = drug_name
205
-        this.getRulleName(drug_name)
213
+        this.getRulleName(id)
206
         this.getlist()
214
         this.getlist()
207
       },
215
       },
208
       changeRullName(id){
216
       changeRullName(id){
209
-        var drug_desc = ""
217
+        var drug_spec = ""
210
         for(let i=0;i<this.rulleName.length;i++){
218
         for(let i=0;i<this.rulleName.length;i++){
211
            if(id == this.rulleName[i].id){
219
            if(id == this.rulleName[i].id){
212
-             drug_desc = this.rulleName[i].drug_desc
213
-           }
220
+              drug_spec = this.rulleName[i].drug_spec
221
+            }
214
         }
222
         }
215
-        this.drug_desc = drug_desc
223
+
224
+        this.drug_spec = drug_spec
216
         this.getlist()
225
         this.getlist()
217
       },
226
       },
218
       getlist(){
227
       getlist(){
219
           if(this.drug_name == "全部"){
228
           if(this.drug_name == "全部"){
220
             this.drug_name = ""
229
             this.drug_name = ""
221
           }
230
           }
231
+          if(this.drug_spec == "全部"){
232
+            this.drug_spec = ""
233
+          }
222
           const params = {
234
           const params = {
223
             start_time:this.start_time,
235
             start_time:this.start_time,
224
             end_time:this.end_time,
236
             end_time:this.end_time,
226
             drug_spec:this.drug_spec,
238
             drug_spec:this.drug_spec,
227
             search_input:this.search_input
239
             search_input:this.search_input
228
           }
240
           }
241
+         
229
         getAllPatientStockList(params).then(response=>{
242
         getAllPatientStockList(params).then(response=>{
230
             if(response.data.state == 1){
243
             if(response.data.state == 1){
231
               var stocklist = response.data.data.stocklist
244
               var stocklist = response.data.data.stocklist
232
-              console.log("stocklist3333",stocklist)
245
+              
233
               for(let i=0;i<stocklist.length;i++){
246
               for(let i=0;i<stocklist.length;i++){
234
                  stocklist[i].index = i+1
247
                  stocklist[i].index = i+1
235
                  stocklist[i].Count = 0
248
                  stocklist[i].Count = 0
250
     },
263
     },
251
     created(){
264
     created(){
252
       //获取所有药品名称
265
       //获取所有药品名称
253
-      this.getAllDrugName()
266
+      this.getAllMedicalList()
254
 
267
 
255
 
268
 
256
 
269
 

+ 158 - 109
src/xt_pages/user/components/EditGroupAdvice.vue 查看文件

382
         <el-row>
382
         <el-row>
383
           <el-col :span="10">
383
           <el-col :span="10">
384
             <el-form-item label="医嘱内容 :" required prop="advice_name">
384
             <el-form-item label="医嘱内容 :" required prop="advice_name">
385
-              <!-- <el-input v-model="nameForm.advice_name"></el-input> -->
386
-
387
               <el-select
385
               <el-select
388
                 v-model="nameForm.advice_name"
386
                 v-model="nameForm.advice_name"
389
                 filterable
387
                 filterable
395
                 @change="changeDrugName"
393
                 @change="changeDrugName"
396
               >
394
               >
397
                 <el-option
395
                 <el-option
398
-                  v-for="item in medicals"
399
-                  :key="item.id"
396
+                  v-for="(item,index) in all_drug"
397
+                  :key="index"
400
                   :label="item.drug_name"
398
                   :label="item.drug_name"
401
-                  :value="item.id"
399
+                  :value="item.drug_name"
402
                 ></el-option>
400
                 ></el-option>
403
               </el-select>
401
               </el-select>
404
               
402
               
410
             <!--</el-form-item>-->
408
             <!--</el-form-item>-->
411
             <el-form-item label="药品规格 :" prop="advice_desc">
409
             <el-form-item label="药品规格 :" prop="advice_desc">
412
               <el-col :span="10">
410
               <el-col :span="10">
413
-                <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
414
-
415
-                <el-select
411
+                 <el-select
416
                   v-model="nameForm.advice_desc"
412
                   v-model="nameForm.advice_desc"
417
                   filterable
413
                   filterable
418
                   clearable
414
                   clearable
420
                   :disabled="isChild"
416
                   :disabled="isChild"
421
                   placeholder="请选择(输入可搜索)"
417
                   placeholder="请选择(输入可搜索)"
422
                   style="width:150px"
418
                   style="width:150px"
419
+                  @change="changeDrugDesc"
423
                 >
420
                 >
424
                   <el-option
421
                   <el-option
425
                     v-for="item in drugSpec"
422
                     v-for="item in drugSpec"
645
         id: 0,
642
         id: 0,
646
         children: [],
643
         children: [],
647
         way:"",
644
         way:"",
648
-        drug_id:""
645
+        drug_id:"",
646
+        src_type:""
649
       },
647
       },
650
 
648
 
651
       drugOptions: [],
649
       drugOptions: [],
666
       allSelectedTemplate: [],
664
       allSelectedTemplate: [],
667
       adviceTemplateMaps: {},
665
       adviceTemplateMaps: {},
668
       medicals:[],
666
       medicals:[],
669
-      drugSpec:[]
667
+      drugSpec:[],
668
+      all_drug:[],
669
+      current_drug_name:"",
670
+      current_drug_spec: "",
671
+      drug_id: 0,
672
+      src_type:""
670
     };
673
     };
671
   },
674
   },
672
   props: {
675
   props: {
853
         .catch(() => {});
856
         .catch(() => {});
854
     },
857
     },
855
     submitNameForm(formName) {
858
     submitNameForm(formName) {
856
-       if(typeof(this.nameForm.advice_name) == "string"){
859
+     
860
+      if(this.src_type == ""){
861
+          this.nameForm.way = 0
862
+          this.nameForm.drug_id = 0
863
+       }
864
+
865
+       if(this.src_type == 2){ //自备药
866
+          var arr = this.nameForm.advice_name.split("(自备药)")
867
+          this.nameForm.advice_name = arr[0]
868
+       }
869
+
870
+      //  if(typeof(this.nameForm.advice_name) == "string"){
857
          
871
          
858
-          this.nameForm.advice_name == this.nameForm.advice_name
859
-      }
860
-
861
-      if(typeof(this.nameForm.advice_name) == "number"){
862
-          var drug_name = ""
863
-          var name = ""
864
-          var way = 0
865
-          this.nameForm.drug_id = this.nameForm.advice_name
866
-          for(let i=0;i<this.medicals.length;i++){
867
-            if(this.nameForm.advice_name == this.medicals[i].id){
868
-              name = this.medicals[i].drug_name
869
-              way  = this.medicals[i].way
870
-            }
871
-          }
872
-          if(way == 1){
873
-            drug_name = name
874
-          }
875
-          if(way == 2){
876
-            var arr = name.split("(自备药)")
877
-            drug_name = arr[0]
878
-          }
872
+      //     this.nameForm.advice_name == this.nameForm.advice_name
873
+      // }
874
+
875
+      // if(typeof(this.nameForm.advice_name) == "number"){
876
+      //     var drug_name = ""
877
+      //     var name = ""
878
+      //     var way = 0
879
+      //     this.nameForm.drug_id = this.nameForm.advice_name
880
+      //     for(let i=0;i<this.medicals.length;i++){
881
+      //       if(this.nameForm.advice_name == this.medicals[i].id){
882
+      //         name = this.medicals[i].drug_name
883
+      //         way  = this.medicals[i].way
884
+      //       }
885
+      //     }
886
+      //     if(way == 1){
887
+      //       drug_name = name
888
+      //     }
889
+      //     if(way == 2){
890
+      //       var arr = name.split("(自备药)")
891
+      //       drug_name = arr[0]
892
+      //     }
879
           
893
           
880
-          this.nameForm.advice_name = drug_name
881
-          this.nameForm.way = way
882
-      }
894
+      //     this.nameForm.advice_name = drug_name
895
+      //     this.nameForm.way = way
896
+      // }
883
       var _this = this;
897
       var _this = this;
884
       this.$refs[formName].validate(valid => {
898
       this.$refs[formName].validate(valid => {
885
         if (valid) {
899
         if (valid) {
2388
       });
2402
       });
2389
     },
2403
     },
2390
 
2404
 
2391
-     getSelfMedicalList(){
2405
+    rand(min, max) {
2406
+        return Math.floor(Math.random() * (max - min)) + min;
2407
+     },
2408
+    //
2409
+    getSelfMedicalList(){
2392
         const params = {
2410
         const params = {
2393
-          patient_id:this.patientID
2411
+          patient_id:this.$route.query.patient_id
2394
         }
2412
         }
2395
       getSelfMedicalList(params).then(response=>{
2413
       getSelfMedicalList(params).then(response=>{
2396
-          if(response.data.state == 1){
2397
-            var medicalList =  response.data.data.medicalList
2398
-            //way字段区分数据源:1代表来自基础库  2代表来自药品库
2399
-            for(let i=0;i<medicalList.length;i++){
2400
-               medicalList[i].way = 2
2401
-            }
2402
-            for(let i=0;i<medicalList.length;i++){
2403
-               medicalList[i].drug_name = medicalList[i].drug_name+"(自备药)"
2404
-            }
2405
-            var drugname = response.data.data.drugName
2406
-            for(let i=0;i<drugname.length;i++){
2407
-               drugname[i].way = 1
2414
+         if (response.data.state == 1) {
2415
+            this.arr_drug = []
2416
+            var medicalList = response.data.data.private_drug_list
2417
+            var base_drug_list = response.data.data.base_drug_list
2418
+            var base_drug_cofig = response.data.data.base_drug_config
2419
+            var private_drug_cofig = response.data.data.private_drug_config
2420
+
2421
+
2422
+            if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
2423
+
2424
+              for (let i = 0; i < medicalList.length; i++) {
2425
+                if(medicalList[i].drug_specs != null) {
2426
+                  for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
2427
+                    medicalList[i].drug_specs[a]['type'] = 2
2428
+                  }
2429
+                }
2430
+                let obj = {
2431
+                  drug_name: "",
2432
+                  drug_desc: "",
2433
+                  delivery_way: "",
2434
+                  execution_frequency: "",
2435
+                  single_dose: "",
2436
+                  single_dose_unit: "",
2437
+                  prescribing_number: "",
2438
+                  prescribing_number_unit: "",
2439
+                  type_id: "",
2440
+                  type: "",
2441
+                  custom_id: "",
2442
+                  drug_specs: [],
2443
+                }
2444
+
2445
+                medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
2446
+                obj.drug_name = medicalList[i].drug_name
2447
+                obj.delivery_way = medicalList[i].delivery_way
2448
+                obj.execution_frequency = medicalList[i].execution_frequency
2449
+                obj.single_dose = medicalList[i].single_dose
2450
+                obj.prescribing_number = medicalList[i].prescribing_number
2451
+                obj.type_id = medicalList[i].id
2452
+                obj.type = 2
2453
+                obj.custom_id = this.rand(10000000, 99999999)
2454
+                obj.drug_specs = medicalList[i].drug_specs
2455
+                this.all_drug.push(obj)
2456
+              }
2408
             }
2457
             }
2409
 
2458
 
2410
-            drugname.push(...medicalList)
2411
-          
2412
-            this.medicals = drugname
2459
+
2460
+            for (let i = 0; i < base_drug_list.length; i++) {
2461
+              if(base_drug_list[i].drug_specs != null) {
2462
+                for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
2463
+                  base_drug_list[i].drug_specs[a]['type'] = 1
2464
+                }
2465
+              }
2466
+                let obj = {
2467
+                  drug_name: "",
2468
+                  drug_desc: "",
2469
+                  delivery_way: "",
2470
+                  execution_frequency: "",
2471
+                  single_dose: "",
2472
+                  single_dose_unit: "",
2473
+                  prescribing_number: "",
2474
+                  prescribing_number_unit: "",
2475
+                  type_id: "",
2476
+                  type: "",
2477
+                  custom_id: "",
2478
+                  drug_specs: [],
2479
+                }
2480
+
2481
+                obj.drug_name = base_drug_list[i].drug_name
2482
+                obj.delivery_way = base_drug_list[i].delivery_way
2483
+                obj.execution_frequency = base_drug_list[i].execution_frequency
2484
+                obj.single_dose = base_drug_list[i].single_dose
2485
+                obj.prescribing_number = base_drug_list[i].prescribing_number
2486
+                obj.type_id = base_drug_list[i].id
2487
+                obj.type = 1
2488
+                obj.custom_id = this.rand(10000000, 99999999)
2489
+                obj.drug_specs = base_drug_list[i].drug_specs
2490
+                this.all_drug.push(obj)
2491
+              }
2492
+            }   
2493
+        })
2494
+       
2495
+    },
2496
+    changeDrugName(name){
2497
+       this.current_drug_name = name
2498
+       this.nameForm.advice_desc = ''
2499
+      this.drugSpec = []
2500
+      for (let i = 0; i < this.all_drug.length; i++) {
2501
+        if (this.all_drug[i].drug_name == name) {
2502
+            this.drugSpec = this.all_drug[i].drug_specs
2413
           }
2503
           }
2414
-      })
2504
+       }
2415
     },
2505
     },
2416
-    changeDrugName(id){
2417
-      var drug_name = ""
2418
-      var name = ""
2419
-      var way = 0
2420
-      for(let i=0;i<this.medicals.length;i++){
2421
-        if(id == this.medicals[i].id){
2422
-          name = this.medicals[i].drug_name
2423
-          way  = this.medicals[i].way
2506
+    changeDrugDesc(name) {
2507
+        this.current_drug_spec = name
2508
+        for (let i = 0; i < this.drugSpec.length; i++) {
2509
+          if (this.drugSpec[i].drug_spec == name) {
2510
+            this.nameForm.advice_desc = this.drugSpec[i].drug_spec
2511
+            this.nameForm.prescribing_number = this.drugSpec[i].prescribing_number.toString()
2512
+            this.nameForm.single_dose = this.drugSpec[i].single_dose.toString()
2513
+            this.nameForm.delivery_way = this.drugSpec[i].delivery_way.toString()
2514
+            this.nameForm.execution_frequency = this.drugSpec[i].execution_frequency.toString()
2515
+            this.drug_id = this.drugSpec[i].id
2516
+            this.src_type = this.drugSpec[i].type
2517
+            this.nameForm.drug_id = this.drugSpec[i].id
2518
+            this.nameForm.way = this.drugSpec[i].type
2519
+          }
2424
         }
2520
         }
2425
       }
2521
       }
2426
-      if(way == 1){
2427
-        drug_name = name
2428
-      }
2429
-      if(way == 2){
2430
-        var arr = name.split("(自备药)")
2431
-        drug_name = arr[0]
2432
-      }
2433
-        const params = {
2434
-          drug_name:drug_name,
2435
-          patient_id:this.$route.query.patient_id,
2436
-          way:way,
2437
-        }
2438
-      getDrugDescByDrugName(params).then(response=>{
2439
-          if(response.data.state == 1){
2440
-             var drugspec = response.data.data.drugspec
2441
-          
2442
-             if(drugspec[0].drug_spec !=0){
2443
-                this.nameForm.advice_desc = drugspec[0].drug_spec
2444
-             }
2445
-             if(drugspec[0].min_unit!=0){
2446
-                 this.nameForm.drug_spec_unit = drugspec[0].min_unit
2447
-             }
2448
-             if(drugspec[0].delivery_way!=0){
2449
-                 this.nameForm.delivery_way = drugspec[0].delivery_way
2450
-             }
2451
-             if(drugspec[0].execution_frequency!=0){
2452
-                this.nameForm.execution_frequency = drugspec[0].execution_frequency
2453
-             }
2454
-             if(drugspec[0].single_dose !=0){
2455
-                this.nameForm.single_dose = drugspec[0].single_dose.toString()
2456
-             } 
2457
-             if(drugspec[0].min_unit !=0){
2458
-               this.nameForm.single_dose_unit = drugspec[0].min_unit
2459
-             }
2460
-             if(drugspec[0].min_unit!=0){
2461
-               this.nameForm.prescribing_number_unit = drugspec[0].min_unit
2462
-             }
2463
-              
2464
-             if( drugspec[0].prescribing_number!=0){
2465
-                this.nameForm.prescribing_number = drugspec[0].prescribing_number.toString()
2466
-             }
2467
-          
2468
-             this.drugSpec = drugspec
2469
-          }
2470
-      })
2471
-    
2472
-    }
2473
   },
2522
   },
2474
   watch: {
2523
   watch: {
2475
     rowKey: function() {
2524
     rowKey: function() {
2481
   },
2530
   },
2482
   created(){
2531
   created(){
2483
     //获取自备药
2532
     //获取自备药
2484
-    this.getSelfMedicalList()
2533
+     this.getSelfMedicalList()
2485
   }
2534
   }
2486
 };
2535
 };
2487
 </script>
2536
 </script>

+ 173 - 117
src/xt_pages/user/doctorAdvice.vue 查看文件

944
         >
944
         >
945
           <el-row>
945
           <el-row>
946
             <el-col :span="10">
946
             <el-col :span="10">
947
-              <el-form-item label="医嘱内容 :" required prop="advice_name">
947
+              <el-form-item label="医嘱内容:" required prop="advice_name">
948
                 <!-- <el-input v-model="nameForm.advice_name"></el-input> -->
948
                 <!-- <el-input v-model="nameForm.advice_name"></el-input> -->
949
 
949
 
950
                 <el-select
950
                 <el-select
951
-                v-model="nameForm.advice_name"
952
-                filterable
953
-                clearable
954
-                allow-create
955
-                :disabled="isChild"
956
-                placeholder="请选择(输入可搜索)"
957
-                style="width:200px"
958
-                @change="changeDrugName"
959
-              >
960
-                <el-option
961
-                  v-for="item in medicals"
962
-                  :key="item.id"
963
-                  :label="item.drug_name"
964
-                  :value="item.id"
965
-                ></el-option>
966
-              </el-select>
951
+                  v-model="nameForm.advice_name"
952
+                  filterable
953
+                  clearable
954
+                  allow-create
955
+                  :disabled="isChild"
956
+                  placeholder="请选择(输入可搜索)"
957
+                  style="width:200px"
958
+                  @change="changeDrugName"
959
+                >
960
+                  <el-option
961
+                    v-for="(item,index) in all_drug"
962
+                    :key="index"
963
+                    :label="item.drug_name"
964
+                    :value="item.drug_name"
965
+                  ></el-option>
966
+                </el-select>
967
               <!-- <div style="color:red;font-size:12px;">
967
               <!-- <div style="color:red;font-size:12px;">
968
                 库存不足50
968
                 库存不足50
969
               </div> -->
969
               </div> -->
975
                 <el-col :span="12">
975
                 <el-col :span="12">
976
                   <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
976
                   <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
977
                     <el-select
977
                     <el-select
978
-                      v-model="nameForm.advice_desc"
979
-                      filterable
980
-                      clearable
981
-                      allow-create
982
-                      :disabled="isChild"
983
-                      placeholder="请选择(输入可搜索)"
984
-                      style="width:190px"
985
-                  >
978
+                    v-model="nameForm.advice_desc"
979
+                    filterable
980
+                    clearable
981
+                    allow-create
982
+                    :disabled="isChild"
983
+                    placeholder="请选择(输入可搜索)"
984
+                    style="width:150px"
985
+                    @change="changeDrugDesc"
986
+                >
986
                   <el-option
987
                   <el-option
987
                     v-for="item in drugSpec"
988
                     v-for="item in drugSpec"
988
                     :key="item.id"
989
                     :key="item.id"
989
                     :label="item.drug_spec"
990
                     :label="item.drug_spec"
990
                     :value="item.drug_spec"
991
                     :value="item.drug_spec"
991
                   ></el-option>
992
                   ></el-option>
992
-                 </el-select>  
993
+                 </el-select>
994
+
993
                 </el-col>
995
                 </el-col>
994
                 <el-col class="line" :span="2">&nbsp;</el-col>
996
                 <el-col class="line" :span="2">&nbsp;</el-col>
995
                 <el-col :span="6">
997
                 <el-col :span="6">
2187
       dataAdvice: [],
2189
       dataAdvice: [],
2188
       medicals:[],
2190
       medicals:[],
2189
       patient_id:"",
2191
       patient_id:"",
2190
-      drugSpec:[]
2192
+      drugSpec:[],
2193
+      all_drug:[],
2194
+      current_drug_name:"",
2195
+      current_drug_spec: "",
2196
+      drug_id: 0,
2197
+      src_type:""
2191
     };
2198
     };
2192
   },
2199
   },
2193
   methods: {
2200
   methods: {
3972
       });
3979
       });
3973
     },
3980
     },
3974
     submitNameForm(formName) {
3981
     submitNameForm(formName) {
3975
-      var drug_name = ""
3976
-      var name = ""
3977
-      var way = 0
3978
-      this.nameForm.drug_id = this.nameForm.advice_name
3979
-      for(let i=0;i<this.medicals.length;i++){
3980
-        if(this.nameForm.advice_name == this.medicals[i].id){
3981
-          name = this.medicals[i].drug_name
3982
-          way  = this.medicals[i].way
3983
-        }
3984
-      }
3985
-      if(way == 1){
3986
-        drug_name = name
3987
-      }
3988
-      if(way == 2){
3989
-        var arr = name.split("(自备药)")
3990
-        drug_name = arr[0]
3991
-      }
3982
+
3983
+       if(this.src_type == ""){
3984
+          this.nameForm.way = 0
3985
+          this.nameForm.drug_id = 0
3986
+       }
3987
+
3988
+       if(this.src_type == 2){ //自备药
3989
+          var arr = this.nameForm.advice_name.split("(自备药)")
3990
+          this.nameForm.advice_name = arr[0]
3991
+       }
3992
+      // var drug_name = ""
3993
+      // var name = ""
3994
+      // var way = 0
3995
+      // this.nameForm.drug_id = this.nameForm.advice_name
3996
+      // for(let i=0;i<this.medicals.length;i++){
3997
+      //   if(this.nameForm.advice_name == this.medicals[i].id){
3998
+      //     name = this.medicals[i].drug_name
3999
+      //     way  = this.medicals[i].way
4000
+      //   }
4001
+      // }
4002
+      // if(way == 1){
4003
+      //   drug_name = name
4004
+      // }
4005
+      // if(way == 2){
4006
+      //   var arr = name.split("(自备药)")
4007
+      //   drug_name = arr[0]
4008
+      // }
3992
       
4009
       
3993
-      this.nameForm.advice_name = drug_name
3994
-      this.nameForm.way = way
4010
+      // this.nameForm.advice_name = drug_name
4011
+      // this.nameForm.way = way
3995
       var _this = this;
4012
       var _this = this;
3996
       this.$refs[formName].validate(valid => {
4013
       this.$refs[formName].validate(valid => {
3997
         if (valid) {
4014
         if (valid) {
4352
         const params = {
4369
         const params = {
4353
           patient_id:id
4370
           patient_id:id
4354
         }
4371
         }
4355
-      console.log("params9999999999",params)
4372
+    
4356
       getSelfMedicalList(params).then(response=>{
4373
       getSelfMedicalList(params).then(response=>{
4357
-         if(response.data.state == 1){
4374
+         if (response.data.state == 1) {
4375
+            this.arr_drug = []
4376
+            var medicalList = response.data.data.private_drug_list
4377
+            var base_drug_list = response.data.data.base_drug_list
4378
+            var base_drug_cofig = response.data.data.base_drug_config
4379
+            var private_drug_cofig = response.data.data.private_drug_config
4358
 
4380
 
4359
-            var medicalList =  response.data.data.medicalList
4360
-            //way字段区分数据源:1代表来自基础库  2代表来自药品库
4361
-            for(let i=0;i<medicalList.length;i++){
4362
-               medicalList[i].way = 2
4363
-            }
4364
-            for(let i=0;i<medicalList.length;i++){
4365
-               medicalList[i].drug_name = medicalList[i].drug_name+"(自备药)"
4366
-            }
4367
-            var drugname = response.data.data.drugName
4368
-            for(let i=0;i<drugname.length;i++){
4369
-               drugname[i].way = 1
4381
+
4382
+            if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
4383
+
4384
+              for (let i = 0; i < medicalList.length; i++) {
4385
+                if(medicalList[i].drug_specs != null) {
4386
+                  for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
4387
+                    medicalList[i].drug_specs[a]['type'] = 2
4388
+                  }
4389
+                }
4390
+                let obj = {
4391
+                  drug_name: "",
4392
+                  drug_desc: "",
4393
+                  delivery_way: "",
4394
+                  execution_frequency: "",
4395
+                  single_dose: "",
4396
+                  single_dose_unit: "",
4397
+                  prescribing_number: "",
4398
+                  prescribing_number_unit: "",
4399
+                  type_id: "",
4400
+                  type: "",
4401
+                  custom_id: "",
4402
+                  drug_specs: [],
4403
+                }
4404
+
4405
+                medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
4406
+                obj.drug_name = medicalList[i].drug_name
4407
+                obj.delivery_way = medicalList[i].delivery_way
4408
+                obj.execution_frequency = medicalList[i].execution_frequency
4409
+                obj.single_dose = medicalList[i].single_dose
4410
+                obj.prescribing_number = medicalList[i].prescribing_number
4411
+                obj.type_id = medicalList[i].id
4412
+                obj.type = 2
4413
+                obj.custom_id = this.rand(10000000, 99999999)
4414
+                obj.drug_specs = medicalList[i].drug_specs
4415
+                this.all_drug.push(obj)
4416
+              }
4370
             }
4417
             }
4371
 
4418
 
4372
-            drugname.push(...medicalList)
4373
-            this.medicals = drugname
4374
-         }
4419
+
4420
+            for (let i = 0; i < base_drug_list.length; i++) {
4421
+              if(base_drug_list[i].drug_specs != null) {
4422
+                for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
4423
+                  base_drug_list[i].drug_specs[a]['type'] = 1
4424
+                }
4425
+              }
4426
+                let obj = {
4427
+                  drug_name: "",
4428
+                  drug_desc: "",
4429
+                  delivery_way: "",
4430
+                  execution_frequency: "",
4431
+                  single_dose: "",
4432
+                  single_dose_unit: "",
4433
+                  prescribing_number: "",
4434
+                  prescribing_number_unit: "",
4435
+                  type_id: "",
4436
+                  type: "",
4437
+                  custom_id: "",
4438
+                  drug_specs: [],
4439
+                }
4440
+
4441
+                obj.drug_name = base_drug_list[i].drug_name
4442
+                obj.delivery_way = base_drug_list[i].delivery_way
4443
+                obj.execution_frequency = base_drug_list[i].execution_frequency
4444
+                obj.single_dose = base_drug_list[i].single_dose
4445
+                obj.prescribing_number = base_drug_list[i].prescribing_number
4446
+                obj.type_id = base_drug_list[i].id
4447
+                obj.type = 1
4448
+                obj.custom_id = this.rand(10000000, 99999999)
4449
+                obj.drug_specs = base_drug_list[i].drug_specs
4450
+                this.all_drug.push(obj)
4451
+              }
4452
+            }
4453
+            console.log("999999999",this.all_drug)
4454
+            console.log("medicalist",this.medicalList)
4455
+            console.log("base_drug_list",base_drug_list)
4456
+            console.log("private_drug_config",private_drug_cofig)
4457
+            console.log("base",base_drug_cofig)
4375
       })
4458
       })
4376
     },
4459
     },
4377
-    changeDrugName(id){
4378
-      var drug_name = ""
4379
-      var name = ""
4380
-      var way = 0
4381
-      for(let i=0;i<this.medicals.length;i++){
4382
-        if(id == this.medicals[i].id){
4383
-          name = this.medicals[i].drug_name
4384
-          way  = this.medicals[i].way
4385
-        }
4386
-      }
4387
-      if(way == 1){
4388
-        drug_name = name
4389
-      }
4390
-      if(way == 2){
4391
-        var arr = name.split("(自备药)")
4392
-        drug_name = arr[0]
4393
-      }
4394
-        const params = {
4395
-          drug_name:drug_name,
4396
-          patient_id:this.$route.query.patient_id,
4397
-          way:way,
4398
-        }
4399
-      getDrugDescByDrugName(params).then(response=>{
4400
-          if(response.data.state == 1){
4401
-            var drugspec = response.data.data.drugspec
4402
-          
4403
-             if(drugspec[0].drug_spec !=0){
4404
-                this.nameForm.advice_desc = drugspec[0].drug_spec
4405
-             }
4406
-             if(drugspec[0].min_unit!=0){
4407
-                 this.nameForm.drug_spec_unit = drugspec[0].min_unit
4408
-             }
4409
-             if(drugspec[0].delivery_way!=0){
4410
-                 this.nameForm.delivery_way = drugspec[0].delivery_way
4411
-             }
4412
-             if(drugspec[0].execution_frequency!=0){
4413
-                this.nameForm.execution_frequency = drugspec[0].execution_frequency
4414
-             }
4415
-             if(drugspec[0].single_dose !=0){
4416
-                this.nameForm.single_dose = drugspec[0].single_dose
4417
-             } 
4418
-             if(drugspec[0].min_unit !=0){
4419
-               this.nameForm.single_dose_unit = drugspec[0].min_unit
4420
-             }
4421
-             if(drugspec[0].min_unit!=0){
4422
-               this.nameForm.prescribing_number_unit = drugspec[0].min_unit
4423
-             }
4424
-              
4425
-             if( drugspec[0].prescribing_number!=0){
4426
-                this.nameForm.prescribing_number = drugspec[0].prescribing_number
4427
-             }
4428
-          
4429
-             this.drugSpec = drugspec
4460
+   changeDrugName(name){
4461
+       this.current_drug_name = name
4462
+       this.nameForm.advice_desc = ''
4463
+      this.drugSpec = []
4464
+      for (let i = 0; i < this.all_drug.length; i++) {
4465
+        if (this.all_drug[i].drug_name == name) {
4466
+            this.drugSpec = this.all_drug[i].drug_specs
4430
           }
4467
           }
4431
-      })
4432
-    }
4468
+       }
4469
+    },
4470
+    changeDrugDesc(name) {
4471
+        this.current_drug_spec = name
4472
+        for (let i = 0; i < this.drugSpec.length; i++) {
4473
+          if (this.drugSpec[i].drug_spec == name) {
4474
+            this.nameForm.advice_desc = this.drugSpec[i].drug_spec
4475
+            this.nameForm.prescribing_number = this.drugSpec[i].prescribing_number.toString()
4476
+            this.nameForm.single_dose = this.drugSpec[i].single_dose.toString()
4477
+            this.nameForm.delivery_way = this.drugSpec[i].delivery_way.toString()
4478
+            this.nameForm.execution_frequency = this.drugSpec[i].execution_frequency.toString()
4479
+            this.drug_id = this.drugSpec[i].id
4480
+            this.src_type = this.drugSpec[i].type
4481
+            this.nameForm.drug_id = this.drugSpec[i].id
4482
+            this.nameForm.way = this.drugSpec[i].type
4483
+          }
4484
+        }
4485
+    },
4486
+    rand(min, max) {
4487
+        return Math.floor(Math.random() * (max - min)) + min;
4488
+    },
4433
   },
4489
   },
4434
   watch: {
4490
   watch: {
4435
     adviceTableData: function() {
4491
     adviceTableData: function() {