Selaa lähdekoodia

Merge branch '20201014_pc_vue_new_branch' of http://git.shengws.com/csx/Vue_New into 20201014_pc_vue_new_branch

csx 4 vuotta sitten
vanhempi
commit
722ee44ad1

+ 3 - 2
src/api/advice.js Näytä tiedosto

@@ -43,6 +43,7 @@ export function EditDoctorAdvice(patient, id, advice, mode) {
43 43
 }
44 44
 
45 45
 export function ExecDoctorAdvice(patient, id, time, mode) {
46
+
46 47
   var params = {
47 48
     id: id,
48 49
     patient: patient,
@@ -440,8 +441,8 @@ export function ExecGroupAdvice(groupno, time, mode) {
440 441
       time +
441 442
       "&mode=" +
442 443
       mode,
443
-    method: "Post",
444
-    headers: {
444
+      method: "Post",
445
+      headers: {
445 446
       Permission: 2
446 447
     }
447 448
   });

+ 210 - 0
src/api/drug/drug.js Näytä tiedosto

@@ -6,4 +6,214 @@ export function getCurrentPatient(params){
6 6
       methods:"get",
7 7
       params:params  
8 8
    })
9
+}
10
+
11
+export function getAllDrugName(params){
12
+   return request({
13
+     url:"/api/drug/getalldrugname",
14
+     methods:"get",
15
+     params:params
16
+   })
17
+}
18
+
19
+
20
+export function saveDrugName(params){
21
+  return request({
22
+     url:"/api/drug/savedrugname",
23
+     methods:"get",
24
+     params:params
25
+  })
26
+}
27
+
28
+export function getdrugNameList(params){ 
29
+  return request({
30
+     url:"/api/drug/getdrugnamelist",
31
+     methods:"get",
32
+     params:params
33
+  })
34
+}
35
+
36
+export function getRulleName(params){
37
+  return request({
38
+     url:"/api/drug/getrullename",
39
+     methods:"get",
40
+     params:params 
41
+   })
42
+}
43
+
44
+export function getUnitByBaseId(params){
45
+  return request({
46
+     url:"/api/drug/getunitbybaseid",
47
+     methods:"get",
48
+     params:params  
49
+  })
50
+}
51
+
52
+export function saveRulleName(params){
53
+  return request({
54
+     url:"/api/drug/saverullename",
55
+     methods:"get",
56
+     params:params
57
+  })
58
+}
59
+
60
+export function EditRullerName(params){
61
+   return request({
62
+     url:"/api/drug/editrullername",
63
+     methods:"get",
64
+     params:params
65
+   })
66
+}
67
+
68
+
69
+export function updatedRulleName(params){
70
+  
71
+  return request({
72
+    url:"/api/drug/updatedrullername",
73
+    methods:"get",
74
+    params:params
75
+  })
76
+}
77
+
78
+export function getAllDrugNameList(params){
79
+  
80
+  return request({
81
+     url:"/api/drug/getalldrugnamelist",
82
+     methods:"Get",
83
+     params:params
84
+  })
85
+}
86
+
87
+export function getRullListByDrugName(params){
88
+  
89
+   return request({
90
+       url:"/api/drug/getrulllistbydrugname",
91
+       methods:"Get",
92
+       params:params
93
+    })
94
+}
95
+
96
+export function SaveSelfMedicines(data){
97
+   
98
+   return request({
99
+      url:"/api/drug/saveselfmedicines",
100
+      method:"post",
101
+      data:data
102
+   })
103
+}
104
+
105
+export function getCurrentOrgAllStaff(params){
106
+   return request({
107
+      url:"/api/drug/getcurrentorgallstaff",
108
+      methods:"get",
109
+      params:params
110
+   })
111
+}
112
+
113
+
114
+export function saveStock(data,startime,adminuserid,patientid){
115
+  
116
+   return request({
117
+      url:"/api/drug/savestock?start_time="+startime+"&admin_user_id="+adminuserid+"&patient_id="+patientid,
118
+      method:"post",
119
+      data:data
120
+   })
121
+
122
+}
123
+
124
+export function saveOutStock(data,startime,adminuserid,patientid){
125
+   return request({
126
+      url:"/api/drug/saveoutstock?start_time="+startime+"&admin_user_id="+adminuserid+"&patient_id="+patientid,
127
+      method:"post",
128
+      data:data
129
+   })
130
+}
131
+
132
+export function DeleteDrugById(params){
133
+  
134
+   return request({
135
+      url:"/api/drug/deletedrugbyid",
136
+      method:"get",
137
+      params:params
138
+   })
139
+}
140
+
141
+export function saveRadio(params){
142
+  
143
+   return request({
144
+      url:"/api/drug/saveradio",
145
+      method:"get",
146
+      params:params
147
+   })
148
+}
149
+
150
+export function DeleteDrugStand(id,params){
151
+   
152
+   return request({
153
+      url:"/api/drug/deletedrugstand?id="+id,
154
+      method:"get",
155
+      params:params
156
+   })
157
+}
158
+
159
+export function getStockList(params){
160
+   
161
+   return request({
162
+      url:"/api/drug/getstocklist",
163
+      method:"get",
164
+      params:params
165
+   })
166
+}
167
+
168
+export function DeleteDrugName(params){
169
+  
170
+   return request({
171
+      url:"/api/drug/deletedrugname",
172
+      method:"get",
173
+      params:params
174
+   })
175
+}
176
+
177
+export function getDrugDetail(params){
178
+   return request({
179
+      url:"/api/drug/getdrugdetail",
180
+      method:"get",
181
+      params:params
182
+   })
183
+}
184
+
185
+export function getAllPatientStockList(params){
186
+   
187
+   return request({
188
+      url:"/api/drug/getallpatientstocklist",
189
+      method:"get",
190
+      params:params
191
+   })
192
+}
193
+
194
+export function getDrugDataByPatientId(params){
195
+  
196
+   return request({
197
+      url:"/api/drug/getdrugdatabypatientid",
198
+      method:"get",
199
+      params:params
200
+   })
201
+}
202
+
203
+export function getSelfMedicalList(params){
204
+   
205
+   return request({
206
+       url:"/api/drug/getselfmedicallist",
207
+       methods:"get",
208
+       params:params
209
+   })
210
+}
211
+
212
+export function getDrugDescByDrugName(params){
213
+
214
+   return request({
215
+      url:"/api/drug/getdrugdescbydrugname",
216
+      methods:"get",
217
+      params:params
218
+   })
9 219
 }

+ 1 - 1
src/api/manage.js Näytä tiedosto

@@ -97,7 +97,7 @@ export function getAllEquimentName(params) {
97 97
 }
98 98
 
99 99
 export function savePlan(data, id) {
100
-  console.log('data', data)
100
+  console.log('data====', data)
101 101
   return request({
102 102
     url: '/api/management/saveplan?id=' + id,
103 103
     method: 'Post',

+ 8 - 21
src/xt_pages/dialysis/details/dialog/DoctorAdviceDialog.vue Näytä tiedosto

@@ -98,10 +98,7 @@
98 98
         ></el-table-column>
99 99
         <el-table-column label="药品规格" align="center">
100 100
           <template slot-scope="scope">
101
-                <span v-if="scope.row.advice_desc"
102
-                >{{ scope.row.advice_desc
103
-                  }}{{ scope.row.drug_spec_unit }}</span
104
-                >
101
+             <span v-if="scope.row.advice_desc">{{ scope.row.advice_desc}}{{ scope.row.drug_spec_unit }}</span>
105 102
           </template>
106 103
         </el-table-column>
107 104
         <el-table-column
@@ -111,10 +108,7 @@
111 108
           align="center"
112 109
         >
113 110
           <template slot-scope="scope">
114
-                <span v-if="scope.row.prescribing_number != 0"
115
-                >{{ scope.row.prescribing_number
116
-                  }}{{ scope.row.prescribing_number_unit }}</span
117
-                >
111
+             <span v-if="scope.row.prescribing_number != 0">{{ scope.row.prescribing_number}}{{ scope.row.prescribing_number_unit }}</span>
118 112
           </template>
119 113
         </el-table-column>
120 114
         <el-table-column
@@ -124,10 +118,7 @@
124 118
           align="center"
125 119
         >
126 120
           <template slot-scope="scope">
127
-                <span v-if="scope.row.single_dose != 0"
128
-                >{{ scope.row.single_dose
129
-                  }}{{ scope.row.single_dose_unit }}</span
130
-                >
121
+              <span v-if="scope.row.single_dose != 0">{{ scope.row.single_dose}}{{ scope.row.single_dose_unit }}</span>
131 122
           </template>
132 123
         </el-table-column>
133 124
         <el-table-column
@@ -137,9 +128,7 @@
137 128
           align="center"
138 129
         >
139 130
           <template slot-scope="scope">
140
-                <span v-if="scope.row.parent_row == 0">{{
141
-                  scope.row.delivery_way
142
-                }}</span>
131
+            <span v-if="scope.row.parent_row == 0">{{scope.row.delivery_way}}</span>
143 132
           </template>
144 133
         </el-table-column>
145 134
 
@@ -150,9 +139,7 @@
150 139
           align="center"
151 140
         >
152 141
           <template slot-scope="scope">
153
-                <span v-if="scope.row.parent_row == 0">{{
154
-                  scope.row.execution_frequency
155
-                }}</span>
142
+             <span v-if="scope.row.parent_row == 0">{{scope.row.execution_frequency}}</span>
156 143
           </template>
157 144
         </el-table-column>
158 145
       </el-table>
@@ -1216,13 +1203,13 @@
1216 1203
         this.exceLoading = true
1217 1204
         let mode = '6'
1218 1205
 
1219
-        ExecDoctorAdvice(this.patient.id, this.currentRow.id, this.execTime, mode)
1220
-          .then(response => {
1206
+        ExecDoctorAdvice(this.patient.id, this.currentRow.id, this.execTime, mode).then(response => {
1221 1207
             if (response.data.state == 0) {
1222 1208
               this.$message.error(response.data.msg)
1223 1209
               this.exceLoading = false
1224 1210
               return false
1225 1211
             } else {
1212
+
1226 1213
               this.$notify({
1227 1214
                 title: '成功',
1228 1215
                 message: '执行医嘱成功',
@@ -2172,7 +2159,7 @@
2172 2159
       }
2173 2160
       ,
2174 2161
       objectSpanMethod({ row, column, rowIndex, columnIndex }) {
2175
-        console.log('columnIndex', columnIndex)
2162
+        // console.log('columnIndex', columnIndex)
2176 2163
         if (columnIndex === 0) {
2177 2164
           if (rowIndex % 2 === 0) {
2178 2165
             return {

+ 130 - 117
src/xt_pages/dialysis/details/dialog/adviceDialog/AddGroupAdvice.vue Näytä tiedosto

@@ -184,9 +184,7 @@
184 184
                 align="center"
185 185
               >
186 186
                 <template slot-scope="scope">
187
-                  <span v-if="scope.row.parent_row == 0">{{
188
-                    scope.row.execution_frequency
189
-                  }}</span>
187
+                  <span v-if="scope.row.parent_row == 0">{{scope.row.execution_frequency}}</span>
190 188
                 </template>
191 189
               </el-table-column>
192 190
 
@@ -259,10 +257,7 @@
259 257
             ></el-table-column>
260 258
             <el-table-column label="药品规格" align="center">
261 259
               <template slot-scope="scope">
262
-                <span v-if="scope.row.advice_desc"
263
-                  >{{ scope.row.advice_desc
264
-                  }}{{ scope.row.drug_spec_unit }}</span
265
-                >
260
+                <span v-if="scope.row.advice_desc">{{ scope.row.advice_desc}}{{ scope.row.drug_spec_unit }}</span>
266 261
               </template>
267 262
             </el-table-column>
268 263
             <el-table-column
@@ -272,10 +267,7 @@
272 267
               align="center"
273 268
             >
274 269
               <template slot-scope="scope">
275
-                <span v-if="scope.row.prescribing_number != 0"
276
-                  >{{ scope.row.prescribing_number
277
-                  }}{{ scope.row.prescribing_number_unit }}</span
278
-                >
270
+                <span v-if="scope.row.prescribing_number != 0">{{ scope.row.prescribing_number}}{{ scope.row.prescribing_number_unit }}</span>
279 271
               </template>
280 272
             </el-table-column>
281 273
             <el-table-column
@@ -285,10 +277,7 @@
285 277
               align="center"
286 278
             >
287 279
               <template slot-scope="scope">
288
-                <span v-if="scope.row.single_dose != 0"
289
-                  >{{ scope.row.single_dose
290
-                  }}{{ scope.row.single_dose_unit }}</span
291
-                >
280
+                <span v-if="scope.row.single_dose != 0">{{ scope.row.single_dose}}{{ scope.row.single_dose_unit }}</span>
292 281
               </template>
293 282
             </el-table-column>
294 283
             <el-table-column
@@ -298,9 +287,7 @@
298 287
               align="center"
299 288
             >
300 289
               <template slot-scope="scope">
301
-                <span v-if="scope.row.parent_row == 0">{{
302
-                  scope.row.delivery_way
303
-                }}</span>
290
+                <span v-if="scope.row.parent_row == 0">{{scope.row.delivery_way}}</span>
304 291
               </template>
305 292
             </el-table-column>
306 293
 
@@ -383,28 +370,65 @@
383 370
         <el-row>
384 371
           <el-col :span="24">
385 372
             <el-form-item label="医嘱内容 :" required prop="advice_name">
386
-              <el-input v-model="nameForm.advice_name"></el-input>
373
+              <!-- <el-input v-model="nameForm.advice_name"></el-input> -->
374
+               <el-select
375
+                v-model="nameForm.advice_name"
376
+                filterable
377
+                clearable
378
+                allow-create
379
+                :disabled="isChild"
380
+                placeholder="请选择(输入可搜索)"
381
+                style="width:200px"
382
+                @change="changeDrugName"
383
+              >
384
+                <el-option
385
+                  v-for="item in medicals"
386
+                  :key="item.id"
387
+                  :label="item.drug_name"
388
+                  :value="item.drug_name"
389
+                ></el-option>
390
+              </el-select>
387 391
             </el-form-item>
392
+
393
+            
388 394
           </el-col>
389 395
 
390 396
         </el-row>
391 397
         <el-row>
392
-          <el-col :span="12">
398
+          <el-col :span="13">
393 399
             <!--<el-form-item label="规格 :" prop="advice_desc">-->
394 400
             <!--<el-input v-model="nameForm.advice_desc"></el-input>-->
395 401
             <!--</el-form-item>-->
396 402
             <el-form-item label="药品规格 :" prop="advice_desc">
397
-              <el-col :span="8">
398
-                <el-input v-model="nameForm.advice_desc"></el-input>
403
+              <el-col :span="10">
404
+                <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
405
+                 <el-select
406
+                  v-model="nameForm.advice_desc"
407
+                  filterable
408
+                  clearable
409
+                  allow-create
410
+                  :disabled="isChild"
411
+                  placeholder="请选择(输入可搜索)"
412
+                  style="width:150px"
413
+                >
414
+                  <el-option
415
+                    v-for="item in drugSpec"
416
+                    :key="item.id"
417
+                    :label="item.drug_spec"
418
+                    :value="item.drug_spec"
419
+                  ></el-option>
420
+                 </el-select>
421
+
399 422
               </el-col>
400 423
               <el-col class="line" :span="2">&nbsp;</el-col>
401
-              <el-col :span="14">
424
+              <el-col :span="10">
402 425
                 <el-select
403 426
                   v-model="nameForm.drug_spec_unit"
404 427
                   filterable
405 428
                   clearable
406 429
                   allow-create
407 430
                   placeholder="选择"
431
+                  style="width:120px"
408 432
                 >
409 433
                   <el-option
410 434
                     v-for="item in unitsOption"
@@ -416,7 +440,7 @@
416 440
               </el-col>
417 441
             </el-form-item>
418 442
           </el-col>
419
-          <el-col :span="12">
443
+          <el-col :span="9">
420 444
             <el-form-item label="开药数量 :" prop="prescribing_number">
421 445
               <el-col :span="8">
422 446
                 <el-input v-model="nameForm.prescribing_number"></el-input>
@@ -543,6 +567,7 @@ import {
543 567
   StopDoctorAdvice
544 568
 } from "@/api/advice";
545 569
 
570
+import {getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
546 571
 export default {
547 572
   name: "AddGroupAdvice",
548 573
   data() {
@@ -608,7 +633,9 @@ export default {
608 633
       },
609 634
       selectedTemp: { id: 0, name: "", org_id: 0, list: [], rows: [] },
610 635
       selectedTemplate: [],
611
-      allSelectedTemplate: []
636
+      allSelectedTemplate: [],
637
+      medicals:[],
638
+      drugSpec:[],
612 639
     };
613 640
   },
614 641
   props: {
@@ -677,7 +704,8 @@ export default {
677 704
           }
678 705
           submitForm.adviceNames = adviceNames;
679 706
           let mode = "1";
680
-
707
+          
708
+        
681 709
           CreateGroupAdvice(this.patientID, 0, submitForm, mode).then(
682 710
             response => {
683 711
               if (response.data.state == 0) {
@@ -799,61 +827,36 @@ export default {
799 827
         .catch(() => {});
800 828
     },
801 829
     submitNameForm(formName) {
830
+      //截取自备药名称
831
+      var arr = this.nameForm.advice_name.split("(自备药)")
832
+      this.nameForm.advice_name = arr[0]
833
+
802 834
       var _this = this;
803 835
       this.$refs[formName].validate(valid => {
804 836
         if (valid) {
805 837
           if (_this.nameForm.isEdit) {
806 838
             var ale = _this.groupForm.adviceNames.length;
839
+            console.log("进来诶呦")
807 840
             if (_this.isChild) {
808 841
               for (let index = 0; index < ale; index++) {
809
-                if (
810
-                  _this.groupSelectRow.parent_row ==
811
-                  _this.groupForm.adviceNames[index].row_key
812
-                ) {
842
+                if (_this.groupSelectRow.parent_row ==_this.groupForm.adviceNames[index].row_key) {
813 843
                   var cle = _this.groupForm.adviceNames[index].children.length;
844
+              
814 845
                   var children = _this.groupForm.adviceNames[index].children;
815 846
                   for (let j = 0; j < ale; j++) {
816 847
                     if (_this.groupSelectRow.row_key == children[j].row_key) {
817
-                      _this.groupForm.adviceNames[index].children[
818
-                        j
819
-                      ].advice_name = _this.nameForm.advice_name;
820
-                      _this.groupForm.adviceNames[index].children[
821
-                        j
822
-                      ].advice_desc = _this.nameForm.advice_desc;
823
-                      _this.groupForm.adviceNames[index].children[
824
-                        j
825
-                      ].single_dose = "" + _this.nameForm.single_dose;
826
-                      _this.groupForm.adviceNames[index].children[
827
-                        j
828
-                      ].single_dose_unit = _this.nameForm.single_dose_unit;
829
-                      _this.groupForm.adviceNames[index].children[j].drug_spec =
830
-                        "" + _this.nameForm.drug_spec;
831
-                      _this.groupForm.adviceNames[index].children[
832
-                        j
833
-                      ].drug_spec_unit = _this.nameForm.drug_spec_unit;
834
-                      _this.groupForm.adviceNames[index].children[
835
-                        j
836
-                      ].prescribing_number =
837
-                        "" + _this.nameForm.prescribing_number;
838
-                      _this.groupForm.adviceNames[index].children[
839
-                        j
840
-                      ].prescribing_number_unit =
841
-                        _this.nameForm.prescribing_number_unit;
842
-                      _this.groupForm.adviceNames[index].children[
843
-                        j
844
-                      ].delivery_way = _this.nameForm.delivery_way;
845
-                      _this.groupForm.adviceNames[index].children[
846
-                        j
847
-                      ].execution_frequency =
848
-                        _this.nameForm.execution_frequency;
849
-
850
-                      _this.groupForm.adviceNames[index].children[j].remark =
851
-                        _this.nameForm.remark;
852
-
853
-                      _this.$set(
854
-                        _this.groupForm.adviceNames[index].children,
855
-                        j,
856
-                        _this.groupForm.adviceNames[index].children[j]
848
+                      _this.groupForm.adviceNames[index].children[j].advice_name = _this.nameForm.advice_name;
849
+                      _this.groupForm.adviceNames[index].children[j].advice_desc = _this.nameForm.advice_desc;
850
+                      _this.groupForm.adviceNames[index].children[j].single_dose = "" + _this.nameForm.single_dose;
851
+                      _this.groupForm.adviceNames[index].children[j].single_dose_unit = _this.nameForm.single_dose_unit;
852
+                      _this.groupForm.adviceNames[index].children[j].drug_spec = "" + _this.nameForm.drug_spec;
853
+                      _this.groupForm.adviceNames[index].children[j].drug_spec_unit = _this.nameForm.drug_spec_unit;
854
+                      _this.groupForm.adviceNames[index].children[j].prescribing_number ="" + _this.nameForm.prescribing_number;
855
+                      _this.groupForm.adviceNames[index].children[j].prescribing_number_unit = _this.nameForm.prescribing_number_unit;
856
+                      _this.groupForm.adviceNames[index].children[j].delivery_way = _this.nameForm.delivery_way;
857
+                      _this.groupForm.adviceNames[index].children[j].execution_frequency =_this.nameForm.execution_frequency;
858
+                      _this.groupForm.adviceNames[index].children[j].remark =_this.nameForm.remark;
859
+                      _this.$set(_this.groupForm.adviceNames[index].children,j,_this.groupForm.adviceNames[index].children[j]
857 860
                       );
858 861
                       break;
859 862
                     }
@@ -862,32 +865,18 @@ export default {
862 865
               }
863 866
             } else {
864 867
               for (let index = 0; index < ale; index++) {
865
-                if (
866
-                  _this.groupSelectRow.row_key ==
867
-                  _this.groupForm.adviceNames[index].row_key
868
-                ) {
869
-                  _this.groupForm.adviceNames[index].advice_name =
870
-                    _this.nameForm.advice_name;
871
-                  _this.groupForm.adviceNames[index].advice_desc =
872
-                    _this.nameForm.advice_desc;
873
-                  _this.groupForm.adviceNames[index].single_dose =
874
-                    "" + _this.nameForm.single_dose;
875
-                  _this.groupForm.adviceNames[index].single_dose_unit =
876
-                    _this.nameForm.single_dose_unit;
877
-                  _this.groupForm.adviceNames[index].drug_spec =
878
-                    "" + _this.nameForm.drug_spec;
879
-                  _this.groupForm.adviceNames[index].drug_spec_unit =
880
-                    _this.nameForm.drug_spec_unit;
881
-                  _this.groupForm.adviceNames[index].prescribing_number =
882
-                    "" + _this.nameForm.prescribing_number;
883
-                  _this.groupForm.adviceNames[index].prescribing_number_unit =
884
-                    _this.nameForm.prescribing_number_unit;
885
-                  _this.groupForm.adviceNames[index].delivery_way =
886
-                    _this.nameForm.delivery_way;
887
-                  _this.groupForm.adviceNames[index].execution_frequency =
888
-                    _this.nameForm.execution_frequency;
889
-                  _this.groupForm.adviceNames[index].remark =
890
-                    _this.nameForm.remark;
868
+                if ( _this.groupSelectRow.row_key ==_this.groupForm.adviceNames[index].row_key) {
869
+                  _this.groupForm.adviceNames[index].advice_name =_this.nameForm.advice_name;
870
+                  _this.groupForm.adviceNames[index].advice_desc =_this.nameForm.advice_desc;
871
+                  _this.groupForm.adviceNames[index].single_dose ="" + _this.nameForm.single_dose;
872
+                  _this.groupForm.adviceNames[index].single_dose_unit =_this.nameForm.single_dose_unit;
873
+                  _this.groupForm.adviceNames[index].drug_spec = "" + _this.nameForm.drug_spec;
874
+                  _this.groupForm.adviceNames[index].drug_spec_unit =_this.nameForm.drug_spec_unit;
875
+                  _this.groupForm.adviceNames[index].prescribing_number ="" + _this.nameForm.prescribing_number;
876
+                  _this.groupForm.adviceNames[index].prescribing_number_unit =_this.nameForm.prescribing_number_unit;
877
+                  _this.groupForm.adviceNames[index].delivery_way =_this.nameForm.delivery_way;
878
+                  _this.groupForm.adviceNames[index].execution_frequency =_this.nameForm.execution_frequency;
879
+                  _this.groupForm.adviceNames[index].remark =_this.nameForm.remark;
891 880
 
892 881
                   _this.$set(
893 882
                     _this.groupForm.adviceNames,
@@ -905,18 +894,9 @@ export default {
905 894
 
906 895
               var ale = _this.groupForm.adviceNames.length;
907 896
               for (let index = 0; index < ale; index++) {
908
-                if (
909
-                  _this.nameForm.parent_row ==
910
-                  _this.groupForm.adviceNames[index].row_key
911
-                ) {
912
-                  _this.groupForm.adviceNames[index].children.push(
913
-                    _this.nameForm
914
-                  );
915
-                  _this.$set(
916
-                    _this.groupForm.adviceNames,
917
-                    index,
918
-                    _this.groupForm.adviceNames[index]
919
-                  );
897
+                if (_this.nameForm.parent_row ==_this.groupForm.adviceNames[index].row_key) {
898
+                  _this.groupForm.adviceNames[index].children.push(_this.nameForm);
899
+                  _this.$set(_this.groupForm.adviceNames,index,_this.groupForm.adviceNames[index]);
920 900
                   break;
921 901
                 }
922 902
               }
@@ -929,7 +909,6 @@ export default {
929 909
           _this.nameFormVisible = false;
930 910
         }
931 911
       });
932
-      console.log(_this.groupForm.adviceNames);
933 912
     },
934 913
 
935 914
     openGroupChild() {
@@ -945,7 +924,7 @@ export default {
945 924
         return;
946 925
       }
947 926
       this.nameForm = {
948
-        advice_name: "",
927
+        advice_name:"",
949 928
         advice_desc: "",
950 929
         single_dose: "",
951 930
         single_dose_unit: "",
@@ -1039,7 +1018,7 @@ export default {
1039 1018
     selectAdvice(selection, row) {
1040 1019
       // this.selectedTemplate = [];
1041 1020
 
1042
-      console.log(selection);
1021
+      // console.log(selection);
1043 1022
 
1044 1023
       var adviceArray = this.adviceTemplateMaps[this.selectedTemp.id]
1045 1024
         .DoctorAdviceTemplate;
@@ -1057,7 +1036,7 @@ export default {
1057 1036
         }
1058 1037
       }
1059 1038
 
1060
-      console.log(adviceArray);
1039
+      // console.log(adviceArray);
1061 1040
 
1062 1041
       if (row.children.length > 0) {
1063 1042
         for (const index in row.children) {
@@ -1155,11 +1134,8 @@ export default {
1155 1134
               .DoctorAdviceTemplate[index].single_dose_unit,
1156 1135
             drug_spec:
1157 1136
               "" +
1158
-              this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
1159
-                .drug_spec,
1160
-            drug_spec_unit: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
1161
-              index
1162
-            ].drug_spec_unit,
1137
+              this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
1138
+            drug_spec_unit: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
1163 1139
             prescribing_number:
1164 1140
               "" +
1165 1141
               this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
@@ -1530,12 +1506,49 @@ export default {
1530 1506
           adviceTemplate.DoctorAdviceTemplate[index].selection = false;
1531 1507
         }
1532 1508
       }
1509
+    },
1510
+
1511
+    //
1512
+    getSelfMedicalList(){
1513
+        const params = {
1514
+          patient_id:this.$route.query.patient_id
1515
+        }
1516
+      getSelfMedicalList(params).then(response=>{
1517
+          if(response.data.state == 1){
1518
+            var medicalList =  response.data.data.medicalList
1519
+            for(let i=0;i<medicalList.length;i++){
1520
+               medicalList[i].drug_name = medicalList[i].drug_name+"(自备药)"
1521
+            }
1522
+            this.medicals = medicalList
1523
+          }
1524
+      })
1525
+    },
1526
+    changeDrugName(name){
1527
+       console.log("name",name)
1528
+      var arr = name.split("(自备药)");
1529
+        const params = {
1530
+          drug_name:arr[0],
1531
+          patient_id:this.$route.query.patient_id
1532
+        }
1533
+        console.log("params",params)
1534
+      getDrugDescByDrugName(params).then(response=>{
1535
+          if(response.data.state == 1){
1536
+             var drugspec = response.data.data.drugspec
1537
+             console.log("drugspec",drugspec)
1538
+             this.drugSpec = drugspec
1539
+          }
1540
+      })
1541
+    
1533 1542
     }
1534 1543
   },
1535 1544
   watch: {
1536 1545
     "selectedTemp.list": function() {
1537 1546
       this.calcselectedTemp();
1538 1547
     }
1548
+  },
1549
+  created(){
1550
+    //获取自备药
1551
+    this.getSelfMedicalList()
1539 1552
   }
1540 1553
 };
1541 1554
 </script>

+ 80 - 35
src/xt_pages/stock/selfPreparedMedicine/components/addMedicine.vue Näytä tiedosto

@@ -1,62 +1,57 @@
1 1
 <template>
2 2
     <el-dialog
3
-        :title="formTitle"
3
+        :title="title"
4 4
         width="900px"
5 5
         :visible.sync="visible"
6 6
         :before-close="_close"
7 7
     >
8 8
         <div style="display:flex;width:100%;">
9 9
             <div style="width:200px;">
10
-                <el-table :data="tableData" border style="width: 100%;" height="300" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
10
+              <el-table :data="tableData" border style="width: 100%;" height="300" :row-style="{ color: '#303133' }" 
11
+                 :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row
12
+                 ref="monthlyPlanTable" @current-change="handleCurrentChange" >
11 13
                     <el-table-column align="center" prop="name" label="药品名称">
12
-                        <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
14
+                        <template slot-scope="scope">
15
+                           {{scope.row.drug_name}}
16
+                         </template>
13 17
                     </el-table-column>
14 18
                 </el-table>
15 19
             </div>
16 20
             <div style="flex:1;padding-left:10px;">
17
-                <el-table :data="tableData" border style="width: 100%;" height="300" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
21
+                <el-table :data="tableDatatwo" border style="width: 100%;" height="300" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" 
22
+                 highlight-current-row  @selection-change="handleSelectionChange">
18 23
                     <el-table-column type="selection" align="center" width="55"></el-table-column>
19 24
                     <el-table-column align="center" prop="name" label="规格名称">
20
-                        <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
25
+                        <template slot-scope="scope">{{scope.row.drug_spec}}</template>
21 26
                     </el-table-column>
22 27
                 </el-table>
23 28
             </div>
24 29
         </div>
25 30
         <div slot="footer" class="dialog-footer">
26 31
             <el-button @click="hide">取 消</el-button>
27
-            <el-button type="primary" :loading="submitLoading" @click="submitAction()">保 存</el-button>
32
+            <el-button type="primary" @click="SaveSelfMedicines()">保 存</el-button>
28 33
         </div>
29 34
     </el-dialog>         
30 35
 </template>
31 36
 
32 37
 <script>
38
+import { getAllDrugNameList,getRullListByDrugName,SaveSelfMedicines } from "@/api/drug/drug"
33 39
 export default {
34 40
     data(){
35 41
         return{
36 42
             visible:false,
37 43
             formTitle:'',
38
-            tableData: [{
39
-            date: '2016-05-02',
40
-            name: '王小虎',
41
-            address: '上海市普陀区金沙江路 1518 弄',
42
-            }, {
43
-            date: '2016-05-04',
44
-            name: '王小虎',
45
-            address: '上海市普陀区金沙江路 1518 弄'
46
-            }, {
47
-            date: '2016-05-01',
48
-            name: '王小虎',
49
-            address: '上海市普陀区金沙江路 1518 弄',
50
-            }, {
51
-            date: '2016-05-03',
52
-            name: '王小虎',
53
-            address: '上海市普陀区金沙江路 1518 弄'
54
-            }]
44
+            tableData: [],
45
+            patient_name:"",
46
+            title:"",
47
+            currentRow:"",
48
+            tableDatatwo:[],
49
+            patient_id:0,
50
+            medicineData:[]
55 51
         }
56 52
     },
57 53
     methods:{
58 54
         _close: function(done) {
59
-            // this.clear()
60 55
             done()
61 56
         },
62 57
         clear: function() {
@@ -64,20 +59,70 @@ export default {
64 59
             this.form.name = "";
65 60
             this.form.intro = "";
66 61
         },
67
-        show(id) {
68
-            // this.clear()
69
-            this.visible = true
70
-            if(id == 0){
71
-                this.formTitle = '新增'
72
-            }else{
73
-                this.formTitle = '编辑'
62
+        show(name,id) {
63
+           this.patient_id = id
64
+           this.patient_name = name
65
+           this.title = "添加自备药"+"("+name+")"
66
+           this.visible = true
67
+           this.$nextTick(() => {
68
+            if( this.tableData.length > 0){
69
+                this.$refs.monthlyPlanTable.setCurrentRow(this.tableData[0])
74 70
             }
75
-        },
71
+          });
72
+         },
76 73
         hide() {
77
-            // this.clear()
78
-            this.visible = false
74
+           this.visible = false
75
+        },
76
+
77
+        getAllDrugNameList(){
78
+           getAllDrugNameList().then(response=>{
79
+             if(response.data.state == 1){
80
+               var rullername =  response.data.data.rullerName
81
+               this.tableData = rullername
82
+             }
83
+           }) 
84
+        },
85
+        handleCurrentChange(val){
86
+           console.log("val===",val)
87
+           this.currentRow = val
88
+           this.getRullListByDrugName(val.drug_name)
89
+        },
90
+        getRullListByDrugName(drugname){
91
+            const params = {
92
+              drug_name:drugname,
93
+            }
94
+           getRullListByDrugName(params).then(response=>{
95
+              if(response.data.state ==  1){
96
+                var drugName =  response.data.data.drugName
97
+                console.log("drugname",drugName)
98
+                this.tableDatatwo = drugName
99
+              }
100
+           })
101
+        },
102
+        handleSelectionChange(val){
103
+           this.medicineData = val
79 104
         },
80
-    }
105
+
106
+        SaveSelfMedicines(){
107
+          const params = {
108
+             patient_id:this.patient_id,
109
+             medicineData:this.medicineData
110
+          }
111
+         SaveSelfMedicines(params).then(response=>{
112
+             if(response.data.state == 1){
113
+                var msg = response.data.data.msg
114
+                this.$message.success("保存成功")
115
+                this.visible = false
116
+             }else {
117
+                this.$message.error("药品名称规格已存在")
118
+             }
119
+           })   
120
+        }
121
+    },
122
+  created(){
123
+       //获取所有药品名称
124
+      this.getAllDrugNameList()
125
+  },
81 126
 }
82 127
 </script>
83 128
 

+ 112 - 46
src/xt_pages/stock/selfPreparedMedicine/components/medicineDetail.vue Näytä tiedosto

@@ -6,7 +6,8 @@
6 6
         :before-close="_close"
7 7
     >
8 8
         <div style="margin-bottom:10px;">
9
-            <el-select v-model="value" placeholder="请选择">
9
+            <el-select v-model="type" placeholder="请选择"
10
+            @change="changOption">
10 11
                 <el-option
11 12
                 v-for="item in options"
12 13
                 :key="item.value"
@@ -26,7 +27,7 @@
26 27
                 value-format="yyyy-MM-dd">
27 28
             </el-date-picker>
28 29
                 <el-date-picker
29
-                v-model="start_time"
30
+                v-model="end_time"
30 31
                 prefix-icon="el-icon-date"
31 32
                 :editable="false"
32 33
                 style="width: 196px;margin-right:10px;"
@@ -39,67 +40,71 @@
39 40
         </div>
40 41
         <el-table :data="tableData" border style="width: 100%;" height="300" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
41 42
             <el-table-column align="center" prop="name" label="日期">
42
-                <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
43
+                <template slot-scope="scope">
44
+                    {{getTimes(scope.row.storck_time)}}
45
+                </template>
43 46
             </el-table-column>
44 47
             <el-table-column align="center" prop="name" label="操作类型">
45
-                <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
48
+                <template slot-scope="scope">
49
+                   <span v-if="scope.row.opration_type == 1">入库</span>
50
+                   <span v-if="scope.row.opration_type == 2">出库</span>
51
+              </template>
46 52
             </el-table-column>
47 53
             <el-table-column align="center" prop="name" label="数量">
48
-                <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
54
+                <template slot-scope="scope">
55
+                   <span v-if="scope.row.opration_type == 1">{{scope.row.store_number}}</span>
56
+                   <span v-if="scope.row.opration_type == 2">{{scope.row.outstore_number}}</span>
57
+                </template>
49 58
             </el-table-column>
50 59
             <el-table-column align="center" prop="name" label="操作人">
51
-                <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
60
+                <template slot-scope="scope">
61
+                    {{getName(scope.row.admin_user_id)}}
62
+               </template>
52 63
             </el-table-column>
53 64
             <el-table-column align="center" prop="name" label="出库方式">
54
-                <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
65
+                <template slot-scope="scope">
66
+                  <span v-if="scope.row.opration_type == 1 && scope.row.storage_mode == 1">手动入库</span>
67
+                  <span v-if="scope.row.opration_type == 2 && scope.row.exit_mode == 1">手动出库</span>
68
+                  <span v-if="scope.row.opration_type == 2 && scope.row.exit_mode == 2">自动出库</span>
69
+               </template>
55 70
             </el-table-column>
56 71
             <el-table-column align="center" prop="name" label="备注">
57
-                <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
72
+                <template slot-scope="scope">
73
+                    {{scope.row.remarks}}
74
+                </template>
58 75
             </el-table-column>
59 76
         </el-table>
60 77
     </el-dialog>         
61 78
 </template>
62 79
 
63 80
 <script>
81
+const moment = require('moment')
82
+import { uParseTime } from "@/utils/tools";
83
+import { getDrugDetail,getCurrentOrgAllStaff } from "@/api/drug/drug"
64 84
 export default {
65 85
     data(){
66 86
         return{
67 87
             visible:false,
68 88
             formTitle:'',
69
-            tableData: [{
70
-            date: '2016-05-02',
71
-            name: '王小虎',
72
-            address: '上海市普陀区金沙江路 1518 弄',
73
-            }, {
74
-            date: '2016-05-04',
75
-            name: '王小虎',
76
-            address: '上海市普陀区金沙江路 1518 弄'
77
-            }, {
78
-            date: '2016-05-01',
79
-            name: '王小虎',
80
-            address: '上海市普陀区金沙江路 1518 弄',
81
-            }, {
82
-            date: '2016-05-03',
83
-            name: '王小虎',
84
-            address: '上海市普陀区金沙江路 1518 弄'
85
-            }],
89
+            tableData: [],
86 90
             options: [{
87
-            value: '选项1',
88
-            label: '黄金糕'
91
+            value: 1,
92
+            label: '全部'
89 93
             }, {
90
-            value: '选项2',
91
-            label: '双皮奶'
94
+            value: 2,
95
+            label: '入库'
92 96
             }, {
93
-            value: '选项3',
94
-            label: '蚵仔煎'
95
-            }, {
96
-            value: '选项4',
97
-            label: '龙须面'
98
-            }, {
99
-            value: '选项5',
100
-            label: '北京烤鸭'
97
+            value: 3,
98
+            label: '出库'
101 99
             }],
102
-            value: ''
100
+            value: '',
101
+            drug_name:"",
102
+            drug_spec:"",
103
+            patient_id:"",
104
+            type:1,
105
+            start_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
106
+            end_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
107
+            staffList:[]
103 108
         }
104 109
     },
105 110
     methods:{
@@ -112,19 +117,80 @@ export default {
112 117
             this.form.name = "";
113 118
             this.form.intro = "";
114 119
         },
115
-        show(id) {
116
-            // this.clear()
117
-            this.visible = true
118
-            if(id == 0){
119
-                this.formTitle = '新增'
120
-            }else{
121
-                this.formTitle = '编辑'
122
-            }
120
+        show(name,drugspec,patientid) {
121
+          this.formTitle = "明细("+name+")" 
122
+          this.drug_name = name
123
+          this.drug_spec = drugspec
124
+          this.patient_id = patientid
125
+          this.visible = true
126
+          this.getDrugDetail()
123 127
         },
124 128
         hide() {
125 129
             // this.clear()
126 130
             this.visible = false
127 131
         },
132
+        changOption(){
133
+          this.getDrugDetail()
134
+        },
135
+        getDrugDetail(){
136
+            const params = {
137
+                drug_name:this.drug_name,
138
+                drug_spec:this.drug_spec,
139
+                patient_id:this.patient_id,
140
+                start_time:this.start_time,
141
+                end_time:this.end_time
142
+             }
143
+           getDrugDetail(params).then(response=>{
144
+              if(response.data.state == 1){
145
+                var stockDetail =  response.data.data.stockDetail
146
+                for(let i=0;i<stockDetail.length;i++){
147
+                    stockDetail[i].opration_type = 1
148
+                }
149
+                var outStockDetail = response.data.data.outStockDetail
150
+                for(let j=0;j<outStockDetail.length;j++){
151
+                   outStockDetail[j].opration_type = 2
152
+                }
153
+                if(this.type == 1){
154
+                   stockDetail.push(...outStockDetail)
155
+                   this.tableData = stockDetail
156
+                }
157
+                
158
+                if(this.type == 2){
159
+                   this.tableData = stockDetail
160
+                }
161
+                if(this.type == 3){
162
+                  this.tableData = outStockDetail
163
+                }
164
+              }
165
+          })
166
+        },
167
+
168
+         getCurrentOrgAllStaff(){
169
+           getCurrentOrgAllStaff().then(response=>{
170
+              if(response.data.state == 1){
171
+               var staff = response.data.data.staff
172
+               this.staffList = staff
173
+             }
174
+           })  
175
+        },
176
+
177
+        getName(adminUserId){
178
+          var user_name = ""
179
+          for(let i=0;i<this.staffList.length;i++){
180
+             if(this.staffList[i].admin_user_id == adminUserId){
181
+                user_name = this.staffList[i].user_name
182
+             }
183
+          }
184
+          return user_name
185
+        },
186
+
187
+       getTimes(time) {
188
+        return uParseTime(time, "{y}-{m}-{d}");
189
+      },
190
+    },
191
+
192
+    created(){
193
+      this.getCurrentOrgAllStaff() 
128 194
     }
129 195
 }
130 196
 </script>

+ 90 - 52
src/xt_pages/stock/selfPreparedMedicine/components/warehouseOut.vue Näytä tiedosto

@@ -17,76 +17,54 @@
17 17
                 format="yyyy-MM-dd"
18 18
                 value-format="yyyy-MM-dd"
19 19
             ></el-date-picker>
20
-            <el-select v-model="value" placeholder="请选择">
20
+            <el-select v-model="admin_user_id" placeholder="请选择">
21 21
                 <el-option
22
-                v-for="item in options"
23
-                :key="item.value"
24
-                :label="item.label"
25
-                :value="item.value">
22
+                v-for="item in staffTable"
23
+                :key="item.admin_user_id"
24
+                :label="item.user_name"
25
+                :value="item.admin_user_id">
26 26
                 </el-option>
27 27
             </el-select>
28 28
         </div>
29 29
         <el-table :data="tableData" border style="width: 100%;" height="300" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
30 30
             <el-table-column align="center" prop="name" label="药品名称">
31
-                <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
31
+                <template slot-scope="scope">{{scope.row.drug_name}}</template>
32 32
             </el-table-column>
33 33
             <el-table-column align="center" prop="name" label="规格名称">
34
-                <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
34
+                <template slot-scope="scope">{{scope.row.drug_name}}</template>
35 35
             </el-table-column>
36
-            <el-table-column align="center" prop="name" label="库数量">
36
+            <el-table-column align="center" prop="name" label="库数量">
37 37
                 <template slot-scope="scope">
38
-                    <el-input v-model="input" placeholder="请输入内容"></el-input>
38
+                    <el-input v-model="scope.row.outstore_number" placeholder="请输入内容"></el-input>
39 39
                 </template>
40 40
             </el-table-column>
41 41
             <el-table-column align="center" prop="name" label="备注">
42 42
                 <template slot-scope="scope">
43
-                    <el-input v-model="input" placeholder="请输入内容"></el-input>
43
+                    <el-input v-model="scope.row.remarks" placeholder="请输入内容"></el-input>
44 44
                 </template>
45 45
             </el-table-column>
46 46
         </el-table>
47
+        <div slot="footer" class="dialog-footer">
48
+            <el-button @click="hide">取 消</el-button>
49
+            <el-button type="primary" @click="saveOutStock">保 存</el-button>
50
+        </div>
47 51
     </el-dialog>         
48 52
 </template>
49 53
 
50 54
 <script>
55
+const moment = require('moment')
56
+import { getCurrentOrgAllStaff,getAllDrugNameList,saveOutStock,getDrugDataByPatientId  }  from '@/api/drug/drug'
51 57
 export default {
52 58
     data(){
53 59
         return{
54 60
             visible:false,
55 61
             formTitle:'',
56
-            tableData: [{
57
-            date: '2016-05-02',
58
-            name: '王小虎',
59
-            address: '上海市普陀区金沙江路 1518 弄',
60
-            }, {
61
-            date: '2016-05-04',
62
-            name: '王小虎',
63
-            address: '上海市普陀区金沙江路 1518 弄'
64
-            }, {
65
-            date: '2016-05-01',
66
-            name: '王小虎',
67
-            address: '上海市普陀区金沙江路 1518 弄',
68
-            }, {
69
-            date: '2016-05-03',
70
-            name: '王小虎',
71
-            address: '上海市普陀区金沙江路 1518 弄'
72
-            }],
73
-            options: [{
74
-            value: '选项1',
75
-            label: '黄金糕'
76
-            }, {
77
-            value: '选项2',
78
-            label: '双皮奶'
79
-            }, {
80
-            value: '选项3',
81
-            label: '蚵仔煎'
82
-            }, {
83
-            value: '选项4',
84
-            label: '龙须面'
85
-            }, {
86
-            value: '选项5',
87
-            label: '北京烤鸭'
88
-            }],
89
-            value: ''
62
+            tableData: [],
63
+            value: '',
64
+            start_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
65
+            staffTable:[],
66
+            admin_user_id:this.$store.getters.xt_user.user.id,
67
+            patient_id:""
90 68
         }
91 69
     },
92 70
     methods:{
@@ -99,19 +77,79 @@ export default {
99 77
             this.form.name = "";
100 78
             this.form.intro = "";
101 79
         },
102
-        show(id) {
103
-            // this.clear()
104
-            this.visible = true
105
-            if(id == 0){
106
-                this.formTitle = '新增'
107
-            }else{
108
-                this.formTitle = '编辑'
109
-            }
80
+        show(name,id) {
81
+          this.patient_id = id
82
+          this.formTitle = "自备药出库("+name+")"
83
+          this.visible = true
84
+          //根据患者ID 获取该患者的自备药
85
+          this.getDrugDataByPatientId()
110 86
         },
111 87
         hide() {
112 88
             // this.clear()
113 89
             this.visible = false
114 90
         },
91
+        getCurrentOrgAllStaff(){
92
+           getCurrentOrgAllStaff().then(response=>{
93
+              if(response.data.state == 1){
94
+               var staff = response.data.data.staff
95
+               this.staffTable = staff
96
+             }
97
+           })  
98
+        },
99
+
100
+        //  getAllDrugNameList(){
101
+        //   getAllDrugNameList().then(response=>{
102
+        //      if(response.data.state == 1){
103
+        //        var rullername =  response.data.data.rullerName
104
+        //        for(let i=0;i<rullername.length;i++){
105
+        //           rullername[i].outstore_number = ""
106
+        //           rullername[i].remarks = ""
107
+        //        }
108
+        //        this.tableData = rullername
109
+        //      }
110
+        //   })
111
+        // },
112
+       
113
+        saveOutStock(){
114
+            const params = {
115
+               outStocks:this.tableData,
116
+            }
117
+            console.log("outStocks",params)
118
+            if(this.admin_user_id ==''){
119
+              this.$message.error("请选择出库人")
120
+              return
121
+            }
122
+          saveOutStock(params,this.start_time,this.admin_user_id,this.patient_id).then(response=>{
123
+              if(response.data.state == 1){
124
+                 var msg = response.data.data.msg
125
+                 console.log("msg",msg)
126
+                 this.visible = false
127
+              }
128
+          })
129
+        },
130
+
131
+        getDrugDataByPatientId(){
132
+           const params = {
133
+              patient_id:this.patient_id
134
+           }
135
+           console.log("params",params)
136
+          getDrugDataByPatientId(params).then(response=>{
137
+             if(response.data.state == 1){
138
+               var medicalList = response.data.data.medicalList
139
+                for(let i=0;i<medicalList.length;i++){
140
+                  medicalList[i].store_number = ""
141
+                  medicalList[i].remarks = ""
142
+                }
143
+                this.tableData = medicalList
144
+             }
145
+          })  
146
+        }
147
+    },
148
+    created(){
149
+       //获取当前机构的所有人员
150
+       this.getCurrentOrgAllStaff() 
151
+
152
+    //    this.getAllDrugNameList()
115 153
     }
116 154
 }
117 155
 </script>

+ 94 - 56
src/xt_pages/stock/selfPreparedMedicine/components/warehousing.vue Näytä tiedosto

@@ -17,76 +17,55 @@
17 17
                 format="yyyy-MM-dd"
18 18
                 value-format="yyyy-MM-dd"
19 19
             ></el-date-picker>
20
-            <el-select v-model="value" placeholder="请选择">
20
+            <el-select v-model="admin_user_id" placeholder="请选择">
21 21
                 <el-option
22
-                v-for="item in options"
23
-                :key="item.value"
24
-                :label="item.label"
25
-                :value="item.value">
22
+                v-for="item in staffTable"
23
+                :key="item.admin_user_id"
24
+                :label="item.user_name"
25
+                :value="item.admin_user_id">
26 26
                 </el-option>
27 27
             </el-select>
28 28
         </div>
29 29
         <el-table :data="tableData" border style="width: 100%;" height="300" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
30
-            <el-table-column align="center" prop="name" label="药品名称">
31
-                <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
30
+            <el-table-column align="center" label="药品名称">
31
+                <template slot-scope="scope">{{scope.row.drug_name}}</template>
32 32
             </el-table-column>
33
-            <el-table-column align="center" prop="name" label="规格名称">
34
-                <!-- <template slot-scope="scope">{{scope.row.dialysis_no}}</template> -->
33
+            <el-table-column align="center" label="规格名称">
34
+                <template slot-scope="scope">{{scope.row.drug_spec}}</template>
35 35
             </el-table-column>
36
-            <el-table-column align="center" prop="name" label="入库数量">
36
+            <el-table-column align="center" label="入库数量">
37 37
                 <template slot-scope="scope">
38
-                    <el-input v-model="input" placeholder="请输入内容"></el-input>
38
+                    <el-input v-model="scope.row.store_number" placeholder="请输入内容"></el-input>
39 39
                 </template>
40 40
             </el-table-column>
41
-            <el-table-column align="center" prop="name" label="备注">
41
+            <el-table-column align="center" label="备注">
42 42
                 <template slot-scope="scope">
43
-                    <el-input v-model="input" placeholder="请输入内容"></el-input>
43
+                    <el-input v-model="scope.row.remarks" placeholder="请输入内容"></el-input>
44 44
                 </template>
45 45
             </el-table-column>
46 46
         </el-table>
47
+         <div slot="footer" class="dialog-footer">
48
+            <el-button @click="hide">取 消</el-button>
49
+            <el-button type="primary" @click="saveStock">保 存</el-button>
50
+        </div>
47 51
     </el-dialog>         
48 52
 </template>
49 53
 
50 54
 <script>
55
+const moment = require('moment')
56
+import {getCurrentOrgAllStaff,getAllDrugNameList,saveStock,getDrugDataByPatientId} from "@/api/drug/drug"
51 57
 export default {
52 58
     data(){
53 59
         return{
54 60
             visible:false,
55 61
             formTitle:'',
56
-            tableData: [{
57
-            date: '2016-05-02',
58
-            name: '王小虎',
59
-            address: '上海市普陀区金沙江路 1518 弄',
60
-            }, {
61
-            date: '2016-05-04',
62
-            name: '王小虎',
63
-            address: '上海市普陀区金沙江路 1518 弄'
64
-            }, {
65
-            date: '2016-05-01',
66
-            name: '王小虎',
67
-            address: '上海市普陀区金沙江路 1518 弄',
68
-            }, {
69
-            date: '2016-05-03',
70
-            name: '王小虎',
71
-            address: '上海市普陀区金沙江路 1518 弄'
72
-            }],
73
-            options: [{
74
-            value: '选项1',
75
-            label: '黄金糕'
76
-            }, {
77
-            value: '选项2',
78
-            label: '双皮奶'
79
-            }, {
80
-            value: '选项3',
81
-            label: '蚵仔煎'
82
-            }, {
83
-            value: '选项4',
84
-            label: '龙须面'
85
-            }, {
86
-            value: '选项5',
87
-            label: '北京烤鸭'
88
-            }],
89
-            value: ''
62
+            tableData: [],
63
+            staffTable: [],
64
+            value: '',
65
+            start_time: moment(new Date()).add('year',0).format("YYYY-MM-DD"),
66
+            admin_user_id:this.$store.getters.xt_user.user.id,
67
+            patient_name:"",
68
+            patient_id:""
90 69
         }
91 70
     },
92 71
     methods:{
@@ -99,19 +78,78 @@ export default {
99 78
             this.form.name = "";
100 79
             this.form.intro = "";
101 80
         },
102
-        show(id) {
103
-            // this.clear()
81
+        show(name,id) {
82
+            this.patient_id = id
83
+            this.formTitle = "自备药入库("+name+")"
104 84
             this.visible = true
105
-            if(id == 0){
106
-                this.formTitle = '新增'
107
-            }else{
108
-                this.formTitle = '编辑'
109
-            }
85
+           //根据患者ID 获取该患者的自备药
86
+            this.getDrugDataByPatientId()
110 87
         },
111 88
         hide() {
112
-            // this.clear()
113
-            this.visible = false
89
+           this.visible = false
90
+        },
91
+        getCurrentOrgAllStaff(){
92
+          getCurrentOrgAllStaff().then(response=>{
93
+             if(response.data.state == 1){
94
+               var staff = response.data.data.staff
95
+               this.staffTable = staff
96
+             }
97
+          })   
114 98
         },
99
+        // getAllDrugNameList(){
100
+        //   getAllDrugNameList().then(response=>{
101
+        //      if(response.data.state == 1){
102
+        //        var rullername =  response.data.data.rullerName
103
+        //        for(let i=0;i<rullername.length;i++){
104
+        //           rullername[i].store_number = ""
105
+        //           rullername[i].remarks = ""
106
+        //        }
107
+        //        this.tableData = rullername
108
+        //      }
109
+        //   })
110
+        // },
111
+        saveStock(){
112
+            const params ={
113
+               stocks:this.tableData
114
+            }
115
+            if(this.admin_user_id ==''){
116
+              this.$message.error("请选择入库人")
117
+              return
118
+            }
119
+           console.log("params",params)
120
+       
121
+          saveStock(params,this.start_time,this.admin_user_id,this.patient_id).then(response=>{
122
+              if(response.data.state == 1){
123
+                 var msg = response.data.data.msg
124
+                 this.$message.success("保存成功")
125
+                 this.visible = false
126
+              }
127
+          })
128
+        },
129
+
130
+        getDrugDataByPatientId(){
131
+           const params = {
132
+              patient_id:this.patient_id
133
+           }
134
+           console.log("params",params)
135
+          getDrugDataByPatientId(params).then(response=>{
136
+             if(response.data.state == 1){
137
+               var medicalList = response.data.data.medicalList
138
+                for(let i=0;i<medicalList.length;i++){
139
+                  medicalList[i].outstore_number = ""
140
+                  medicalList[i].remarks = ""
141
+                }
142
+                this.tableData = medicalList
143
+             }
144
+          })  
145
+        }
146
+    },
147
+    created(){
148
+      //获取当前机构的所有人员
149
+      this.getCurrentOrgAllStaff() 
150
+       //获取药品名称规格
151
+      // this.getAllDrugNameList()
152
+      
115 153
     }
116 154
 }
117 155
 </script>

+ 144 - 50
src/xt_pages/stock/selfPreparedMedicine/index.vue Näytä tiedosto

@@ -24,22 +24,24 @@
24 24
                 align="right"
25 25
                 format="yyyy-MM-dd"
26 26
                 value-format="yyyy-MM-dd"
27
+                @change="changeStartime"
27 28
                 ></el-date-picker>
28
-                <el-select v-model="value" placeholder="请选择">
29
+                <!-- <el-select v-model="value" placeholder="请选择">
29 30
                     <el-option
30 31
                     v-for="item in options"
31 32
                     :key="item.value"
32 33
                     :label="item.label"
33 34
                     :value="item.value">
34 35
                     </el-option>
35
-                </el-select>
36
+                </el-select> -->
36 37
                 <el-input style="width: 180px;margin:0 10px;" @keyup.enter.native='searchAction' v-model.trim="search_input" class="filter-item"/>
37 38
                 <el-button class="filter-item" type="primary" icon="el-icon-search" @click="searchAction">搜索</el-button>
38 39
             </div>
39 40
             <el-container>
40 41
                 <div style="width:160px;">
41 42
                     <div class="tablesTitle">患者列表</div>
42
-                    <el-table :data="tableData" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
43
+                    <el-table :data="tablePatient" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row
44
+                    @current-change="handleCurrentChange"  ref="monthlyPlanTable">
43 45
                         <el-table-column align="center" prop="dialysis_no" label="透析号" width="70">
44 46
                             <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
45 47
                         </el-table-column>
@@ -59,36 +61,36 @@
59 61
                     </div>
60 62
                     <el-table :data="tableData" border style="width: 100%;" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
61 63
                         <el-table-column align="center" prop="dialysis_no" label="药品名称" width="120">
62
-                            <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
64
+                            <template slot-scope="scope">{{scope.row.drug_name}}</template>
63 65
                         </el-table-column>
64 66
                         <el-table-column align="center" prop="name" label="规格名称">
65
-                            <template slot-scope="scope">{{ scope.row.name }}</template>
67
+                            <template slot-scope="scope">{{ scope.row.drug_spec }}</template>
66 68
                         </el-table-column>
67 69
                         <el-table-column align="center" prop="dialysis_no" label="单位" width="60">
68
-                            <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
70
+                            <template slot-scope="scope">{{scope.row.min_unit}}</template>
69 71
                         </el-table-column>
70 72
                         <el-table-column align="center" prop="name" label="自备数量" width="90">
71
-                            <template slot-scope="scope">{{ scope.row.name }}</template>
73
+                            <template slot-scope="scope">{{ scope.row.Total }}</template>
72 74
                         </el-table-column>
73 75
                         <el-table-column align="center" prop="name" label="已使用" width="90">
74
-                            <template slot-scope="scope">{{ scope.row.name }}</template>
76
+                            <template slot-scope="scope">{{getCount(scope.row.patient_id,scope.row.drug_name,scope.row.drug_spec)}}</template>
75 77
                         </el-table-column>
76 78
                         <el-table-column align="center" prop="name" label="剩余" width="90">
77
-                            <template slot-scope="scope">{{ scope.row.name }}</template>
79
+                            <template slot-scope="scope">{{scope.row.Total - getCount(scope.row.patient_id,scope.row.drug_name,scope.row.drug_spec)}}</template>
78 80
                         </el-table-column>
79
-                        <el-table-column align="center" prop="name" label="停用" width="90">
81
+                        <!-- <el-table-column align="center" prop="name" label="停用" width="90">
80 82
                             <template slot-scope="scope">
81 83
                                 <el-switch v-model="value1">
82 84
                                 </el-switch>
83 85
                             </template>
84
-                        </el-table-column>
86
+                        </el-table-column> -->
85 87
                         <el-table-column align="center" prop="name" label="备注">
86
-                            <template slot-scope="scope">{{ scope.row.name }}</template>
88
+                            <template slot-scope="scope">{{ scope.row.remarks }}</template>
87 89
                         </el-table-column>
88 90
                         <el-table-column align="center" prop="name" label="操作" width="180">
89 91
                             <template slot-scope="scope">
90
-                                <el-button size="mini" type="primary" @click="toDetail">明细</el-button>
91
-                                <el-button size="mini" type="danger">删除</el-button>
92
+                                <el-button size="mini" type="primary" @click="toDetail(scope.row.drug_name,scope.row.drug_spec,scope.row.patient_id)">明细</el-button>
93
+                                <el-button size="mini" type="danger" @click="DeleteDrugName(scope.row.drug_name,scope.row.patient_id)">删除</el-button>
92 94
                             </template>
93 95
                         </el-table-column>
94 96
                     </el-table>
@@ -106,7 +108,7 @@
106 108
             <el-radio v-model="radio" label="2">不开启</el-radio>
107 109
             <span slot="footer" class="dialog-footer">
108 110
                 <el-button @click="dialogVisible = false">取 消</el-button>
109
-                <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
111
+                <el-button type="primary" @click="saveRadio">确 定</el-button>
110 112
             </span>
111 113
         </el-dialog>
112 114
         <add-medicine ref="addMedicine"></add-medicine>
@@ -123,7 +125,8 @@ import addMedicine from "./components/addMedicine"
123 125
 import medicineDetail from "./components/medicineDetail"
124 126
 import warehousing from "./components/warehousing"
125 127
 import warehouseOut from "./components/warehouseOut"
126
-import {getCurrentPatient} from "@/api/drug/drug"
128
+const moment = require('moment')
129
+import { getCurrentPatient,saveRadio,getStockList,DeleteDrugName } from "@/api/drug/drug"
127 130
 export default {
128 131
     components:{
129 132
         BreadCrumb,
@@ -139,66 +142,157 @@ export default {
139 142
                 { path: false, name: "自备药管理" },
140 143
                 { path: false, name: "自备药管理" },
141 144
             ],
142
-            options: [{
143
-            value: '选项1',
144
-            label: '黄金糕'
145
-            }, {
146
-            value: '选项2',
147
-            label: '双皮奶'
148
-            }, {
149
-            value: '选项3',
150
-            label: '蚵仔煎'
151
-            }, {
152
-            value: '选项4',
153
-            label: '龙须面'
154
-            }, {
155
-            value: '选项5',
156
-            label: '北京烤鸭'
157
-            }],
145
+            // options: [{
146
+            // value: '1',
147
+            // label: '上午'
148
+            // }, {
149
+            // value: '2',
150
+            // label: '下午'
151
+            // }, {
152
+            // value: '3',
153
+            // label: '晚上'
154
+            // }],
158 155
             value: '',
159
-            tableData:[
160
-                {dialysis_no:123,name:'张三'},
161
-                {dialysis_no:123,name:'张三'},
162
-                {dialysis_no:123,name:'张三'},
163
-                {dialysis_no:123,name:'张三'},
164
-                {dialysis_no:123,name:'张三'},
165
-                {dialysis_no:123,name:'张三'},
166
-                {dialysis_no:123,name:'张三'},
167
-                {dialysis_no:123,name:'张三'},
168
-                {dialysis_no:123,name:'张三'},
169
-            ],
156
+            tableData:[],
170 157
             dialogVisible:false,
171
-            radio:'1'
158
+            radio:'2',
159
+            tablePatient:[],
160
+            disableBtton:false,
161
+            currentRow: null,
162
+            patient_name:"",
163
+            patient_id:"",
164
+            start_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
165
+            search_input:"",
166
+            patient_id:0,
167
+            outStocklist:[]
172 168
         }
173 169
     },
174 170
     methods:{
175 171
         setting(){
176 172
             this.dialogVisible = true
177 173
         },
174
+        handleCurrentChange(val){
175
+          this.currentRow = val
176
+          this.patient_name = val.name
177
+          this.patient_id = val.id
178
+          if(val.name !=""){
179
+            this.disableBtton = true
180
+          }
181
+           
182
+          this.getlist()
183
+        },
184
+        changeStartime(){
185
+           this.getlist()
186
+        },
187
+        handleClose(){
188
+          this.dialogVisible = false
189
+        },
178 190
         openForm(index){
179 191
             if(index == 1){
180
-                this.$refs.addMedicine.show();
192
+              if(this.disableBtton == true){
193
+                 this.$refs.addMedicine.show(this.patient_name,this.patient_id);
194
+              }
195
+              if(this.disableBtton == false){
196
+                 this.$message.error("请选择患者!")
197
+              }          
181 198
             }else if(index == 2){
182
-                this.$refs.warehousing.show();
199
+                this.$refs.warehousing.show(this.patient_name,this.patient_id);
183 200
             }else if(index == 3){
184
-                this.$refs.warehouseOut.show();
201
+                this.$refs.warehouseOut.show(this.patient_name,this.patient_id);
185 202
             }
186 203
             
187 204
         },
188
-        toDetail(){
189
-            this.$refs.medicineDetail.show();
205
+        toDetail(drugname,drugspec,patientid){
206
+            console.log("drugname",drugname)
207
+            console.log("drugspec",drugspec)
208
+            console.log("patientid",patientid)
209
+            this.$refs.medicineDetail.show(drugname,drugspec,patientid);
190 210
         },
191 211
 
192 212
         getCurrentPatient(){
193
-          getCurrentPatient().then(response=>{
213
+         getCurrentPatient().then(response=>{
214
+            if(response.data.state == 1){
215
+              this.tablePatient = response.data.data.patient
216
+            } 
217
+          })
218
+        },
219
+        searchAction(){
220
+          this.getlist()
221
+        },
222
+        saveRadio(){
223
+          const params = {
224
+            radio:this.radio
225
+          }
226
+         saveRadio(params).then(response=>{
227
+            if(response.data.state == 1){
228
+              var drugset = response.data.data.drugSet
229
+              console.log("drugset",drugset)
230
+              this.$message.success("保存成功")
231
+              this.dialogVisible = false
232
+            } 
233
+          }) 
234
+        },
235
+        getlist(){
236
+            const params = {
237
+               id:this.patient_id,
238
+               start_time:this.start_time,
239
+               keyword:this.search_input,
240
+            }
241
+          getStockList(params).then(response=>{
242
+             if(response.data.state == 1){
243
+                var stocklist =  response.data.data.stocklist
244
+                var outstocklist = response.data.data.outStocklist
245
+                this.outStocklist = outstocklist
246
+                this.tableData = stocklist
194 247
 
248
+              }
249
+          })  
250
+        },
251
+        DeleteDrugName(name,patientid){
252
+            this.$confirm('确认删除吗?', '删除', {
253
+            confirmButtonText: '确 定',
254
+            cancelButtonText: '取 消',
255
+            type: 'warning'
256
+         })
257
+          .then(() => {
258
+              const params = {
259
+                drugname:name,
260
+                patientid:patientid
261
+              }
262
+            DeleteDrugName(params).then(response => {
263
+              if (response.data.state == 1) {
264
+                  var msg = response.data.data.msg
265
+                  this.tableData.splice(index, 1);
266
+                  this.$message.success("删除成功")
267
+              } else {
268
+                  this.$message.error("药品已经出库不能删除")
269
+              }
270
+            })
271
+          })
272
+          .catch(() => {
195 273
           })
274
+        },
275
+        getCount(patientid,drugname,drugspec){
276
+            var total = 0
277
+           for(let i=0;i<this.outStocklist.length;i++){
278
+              if(patientid == this.outStocklist[i].patient_id && drugname == this.outStocklist[i].drug_name && drugspec == this.outStocklist[i].drug_spec){
279
+                  total = this.outStocklist[i].Count
280
+              }
281
+           }
282
+           return total
196 283
         }
197 284
     },
198 285
     created(){
199 286
       //获取当前机构下的所有患者
200 287
       this.getCurrentPatient()
288
+    },
289
+    watch: {
290
+     tablePatient: function() {
291
+      this.$nextTick(function() {
292
+        this.$refs.monthlyPlanTable.setCurrentRow(this.tablePatient[0])
293
+      })
201 294
     }
295
+  },
202 296
 }
203 297
 </script>
204 298
 

+ 476 - 38
src/xt_pages/stock/selfPreparedMedicine/info.vue Näytä tiedosto

@@ -17,18 +17,22 @@
17 17
                 <div style="width:250px;">
18 18
                     <div style="display:flex;justify-content: space-between;align-items: center;">
19 19
                         <div class="tablesTitle">药品名称</div>
20
-                        <el-button type="primary">新增</el-button>
20
+                        <el-button type="primary" @click="addDrug">新增</el-button>
21 21
                     </div>
22
-                    <el-table :data="tableData" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
23
-                        <el-table-column align="center" prop="dialysis_no" label="透析号" width="70">
24
-                            <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
22
+                    <el-table :data="tableData" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
23
+                     highlight-current-row
24
+                      @current-change="handleCurrentChange"  ref="monthlyPlanTable">
25
+                        <el-table-column align="center" prop="dialysis_no" label="序号" width="70">
26
+                            <template slot-scope="scope">
27
+                               {{scope.$index+1}} 
28
+                            </template>
25 29
                         </el-table-column>
26
-                        <el-table-column align="center" prop="name" label="姓名" width="90">
27
-                            <template slot-scope="scope">{{ scope.row.name }}</template>
30
+                        <el-table-column align="center" prop="name" label="名" width="90">
31
+                            <template slot-scope="scope">{{ scope.row.drug_name }}</template>
28 32
                         </el-table-column>
29 33
                         <el-table-column align="center" prop="name" label="操作" width="80">
30 34
                             <template slot-scope="scope">
31
-                                <el-button size="mini" type="danger">删除</el-button>
35
+                                <el-button size="mini" type="danger" @click="DeleteDrugById(scope.row.id,scope.row.drug_name)">删除</el-button>
32 36
                             </template>
33 37
                         </el-table-column>
34 38
                     </el-table>
@@ -37,35 +41,43 @@
37 41
                     <div style="display:flex;justify-content: space-between;align-items: center;">
38 42
                         <div class="tablesTitle">药品规格</div>
39 43
                         <div>
40
-                            <el-button type="primary">新增</el-button>
44
+                            <el-button type="primary" @click="addRule">新增</el-button>
41 45
                         </div>
42 46
                     </div>
43
-                    <el-table :data="tableData" border style="width: 100%;" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
47
+                    <el-table :data="rullerList" border style="width: 100%;" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
44 48
                         <el-table-column align="center" prop="dialysis_no" label="序号" width="60">
45
-                            <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
49
+                            <template slot-scope="scope">{{scope.$index+1}}</template>
46 50
                         </el-table-column>
47
-                        <el-table-column align="center" prop="name" label="规格名称">
48
-                            <template slot-scope="scope">{{ scope.row.name }}</template>
51
+                        <el-table-column align="center" prop="rull_name" label="规格名称">
52
+                            <template slot-scope="scope">
53
+                              {{ scope.row.drug_spec }}
54
+                            </template>
49 55
                         </el-table-column>
50
-                        <el-table-column align="center" prop="dialysis_no" label="单位" width="80">
51
-                            <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
56
+                        <el-table-column align="center" prop="unit" label="单位" width="80">
57
+                            <template slot-scope="scope">
58
+                              {{scope.row.min_unit}}
59
+                            </template>
52 60
                         </el-table-column>
53
-                        <el-table-column align="center" prop="name" label="价格" width="80">
54
-                            <template slot-scope="scope">{{ scope.row.name }}</template>
61
+                        <el-table-column align="center" prop="price" label="价格" width="80">
62
+                            <template slot-scope="scope">
63
+                              {{ scope.row.price }}
64
+                            </template>
55 65
                         </el-table-column>
56
-                        <el-table-column align="center" prop="name" label="库存警戒" width="90">
57
-                            <template slot-scope="scope">{{ scope.row.name }}</template>
66
+                        <el-table-column align="center" prop="drug_stock_limit" label="库存警戒" width="90">
67
+                            <template slot-scope="scope">
68
+                              {{ scope.row.drug_stock_limit }}
69
+                            </template>
58 70
                         </el-table-column>
59
-                        <el-table-column align="center" prop="name" label="停用" width="90">
71
+                        <!-- <el-table-column align="center" prop="name" label="停用" width="90">
60 72
                             <template slot-scope="scope">
61 73
                                 <el-switch v-model="value1">
62 74
                                 </el-switch>
63 75
                             </template>
64
-                        </el-table-column>
76
+                        </el-table-column> -->
65 77
                         <el-table-column align="center" prop="name" label="操作" width="180">
66 78
                             <template slot-scope="scope">
67
-                                <el-button size="mini" type="primary" @click="toDetail">编辑</el-button>
68
-                                <el-button size="mini" type="danger">删除</el-button>
79
+                                <el-button size="mini" type="primary" @click="toDetail(scope.row.id)">编辑</el-button>
80
+                                <el-button size="mini" type="danger" @click="DeleteDrugStand(scope.row.id,scope.$index)">删除</el-button>
69 81
                             </template>
70 82
                         </el-table-column>
71 83
                     </el-table>
@@ -86,6 +98,133 @@
86 98
                 <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
87 99
             </span>
88 100
         </el-dialog>
101
+       
102
+
103
+
104
+        <el-dialog
105
+        title="新增药品名称"
106
+        :visible.sync="drugDialogVisible"
107
+        width="50%"
108
+        :before-close="drughandleClose">
109
+        <span>
110
+           <el-form style="width:100%">
111
+              <el-row :span="24">
112
+                <el-col :span="24">
113
+                    <el-form-item label="药品名称:">
114
+                        <el-select v-model="drug_name" filterable placeholder="请选择">
115
+                            <el-option
116
+                            v-for="item in drugName"
117
+                            :key="item.id"
118
+                            :label="item.drug_name"
119
+                            :value="item.id">
120
+                            </el-option>
121
+                        </el-select>
122
+                    </el-form-item>
123
+                 </el-col>
124
+             </el-row> 
125
+          </el-form> 
126
+        </span>
127
+        <span slot="footer" class="dialog-footer">
128
+            <el-button @click="drugDialogVisible = false">取 消</el-button>
129
+            <el-button  @click="saveDrugName">保 存</el-button>
130
+            <el-button type="primary" @click="saveDrugNameTwo">保 存 并 继 续 新 增</el-button>
131
+        </span>
132
+        </el-dialog>
133
+        
134
+        
135
+        <el-dialog
136
+        title="新增药品规格"
137
+        :visible.sync="ruleDialogVisible"
138
+        width="75%"
139
+        :before-close="rullerhandleClose">
140
+        <span>
141
+           <el-form style="width:100%" :model="form">
142
+              <el-row :span="24">
143
+                <el-col :span="6">
144
+                    <el-form-item label="规格名称:">
145
+                       <el-select v-model="form.drug_name_id" filterable placeholder="请选择"
146
+                       style="width:150px"
147
+                        @change="changeRuleName">
148
+                            <el-option
149
+                            v-for="item in ruleName"
150
+                            :key="item.id"
151
+                            :label="item.drug_spec"
152
+                            :value="item.id">
153
+                            </el-option>
154
+                        </el-select>
155
+                    </el-form-item>
156
+                 </el-col>
157
+                  <el-col :span="6">
158
+                    <el-form-item label="单位:">
159
+                       <el-input v-model="form.unit" style="width:150px"></el-input>
160
+                    </el-form-item>
161
+                 </el-col>
162
+                  <el-col :span="6">
163
+                    <el-form-item label="价格:">
164
+                       <el-input v-model="form.price" style="width:150px"></el-input>
165
+                    </el-form-item>
166
+                 </el-col>
167
+                 <el-col :span="6">
168
+                    <el-form-item label="库存警戒:">
169
+                       <el-input v-model="form.drug_stock_limit" style="width:150px"></el-input>
170
+                    </el-form-item>
171
+                 </el-col>
172
+             </el-row> 
173
+          </el-form> 
174
+        </span>
175
+        <span slot="footer" class="dialog-footer">
176
+            <el-button @click="ruleDialogVisible = false">取 消</el-button>
177
+            <el-button  @click="saveRulleName">保 存</el-button>
178
+            <el-button type="primary" @click="saveRulleNameTwo">保 存 并 继 续 新 增</el-button>
179
+        </span>
180
+        </el-dialog>
181
+
182
+
183
+        <el-dialog
184
+        title="编辑药品规格"
185
+        :visible.sync="editRuleDialogVisible"
186
+        width="75%"
187
+        :before-close="EditRullerhandleClose">
188
+        <span>
189
+           <el-form style="width:100%" :model="form">
190
+              <el-row :span="24">
191
+                <el-col :span="6">
192
+                    <el-form-item label="规格名称:">
193
+                        <el-select v-model="editform.drug_name_id" filterable placeholder="请选择"
194
+                        @change="changeRuleNameTwo">
195
+                            <el-option
196
+                            v-for="item in ruleName"
197
+                            :key="item.id"
198
+                            :label="item.drug_spec"
199
+                            :value="item.id">
200
+                            </el-option>
201
+                        </el-select>
202
+                    </el-form-item>
203
+                 </el-col>
204
+                  <el-col :span="6">
205
+                    <el-form-item label="单位:">
206
+                       <el-input v-model="form.unit"></el-input>
207
+                    </el-form-item>
208
+                 </el-col>
209
+                  <el-col :span="6">
210
+                    <el-form-item label="价格:">
211
+                       <el-input v-model="form.price"></el-input>
212
+                    </el-form-item>
213
+                 </el-col>
214
+                 <el-col :span="6">
215
+                    <el-form-item label="库存警戒:">
216
+                       <el-input v-model="form.drug_stock_limit"></el-input>
217
+                    </el-form-item>
218
+                 </el-col>
219
+             </el-row> 
220
+          </el-form> 
221
+        </span>
222
+        <span slot="footer" class="dialog-footer">
223
+            <el-button @click="editRuleDialogVisible = false">取 消</el-button>
224
+            <el-button  @click="updatedRulleName">保 存</el-button>
225
+        </span>
226
+        </el-dialog>
227
+
89 228
         <add-medicine ref="addMedicine"></add-medicine>
90 229
         <medicine-detail ref="medicineDetail"></medicine-detail>
91 230
         <warehousing ref="warehousing"></warehousing>
@@ -100,13 +239,14 @@ import addMedicine from "./components/addMedicine"
100 239
 import medicineDetail from "./components/medicineDetail"
101 240
 import warehousing from "./components/warehousing"
102 241
 import warehouseOut from "./components/warehouseOut"
242
+import { getAllDrugName,saveDrugName,getdrugNameList,getRulleName,getUnitByBaseId,saveRulleName,EditRullerName,updatedRulleName,DeleteDrugById,DeleteDrugStand }  from "@/api/drug/drug"
103 243
 export default {
104 244
     components:{
105 245
         BreadCrumb,
106 246
         addMedicine,
107 247
         medicineDetail,
108 248
         warehousing,
109
-        warehouseOut
249
+        warehouseOut,
110 250
     },
111 251
     data(){
112 252
         return{
@@ -132,19 +272,29 @@ export default {
132 272
             label: '北京烤鸭'
133 273
             }],
134 274
             value: '',
135
-            tableData:[
136
-                {dialysis_no:123,name:'张三'},
137
-                {dialysis_no:123,name:'张三'},
138
-                {dialysis_no:123,name:'张三'},
139
-                {dialysis_no:123,name:'张三'},
140
-                {dialysis_no:123,name:'张三'},
141
-                {dialysis_no:123,name:'张三'},
142
-                {dialysis_no:123,name:'张三'},
143
-                {dialysis_no:123,name:'张三'},
144
-                {dialysis_no:123,name:'张三'},
145
-            ],
275
+            tableData:[],
146 276
             dialogVisible:false,
147
-            radio:'1'
277
+            radio:'1',
278
+            drugDialogVisible:false,
279
+            options:[],
280
+            drugName:[],
281
+            drug_name:"",
282
+            ruleDialogVisible:false,
283
+            ruleName:[],
284
+            rule_name:"",
285
+            name:"",
286
+            form:{
287
+              id:"",
288
+              drug_name_id:"",
289
+              unit:"", 
290
+              price:"",
291
+              drug_stock_limit:""
292
+            },
293
+            editform:{
294
+              drug_name_id:"",
295
+            },
296
+            rullerList:[],
297
+            editRuleDialogVisible:false,
148 298
         }
149 299
     },
150 300
     methods:{
@@ -161,10 +311,298 @@ export default {
161 311
             }
162 312
             
163 313
         },
164
-        toDetail(){
165
-            this.$refs.medicineDetail.show();
166
-        }
314
+        toDetail(id){
315
+          this.editRuleDialogVisible = true
316
+           const params = {
317
+             id:id
318
+           }
319
+          EditRullerName(params).then(response=>{
320
+            if(response.data.state == 1){
321
+              var rullerdetail =  response.data.data.rullerDetail
322
+              this.form.id = rullerdetail.id
323
+              this.editform.drug_name_id = rullerdetail.drug_spec
324
+              this.form.unit = rullerdetail.min_unit
325
+              this.form.price = rullerdetail.price
326
+              this.form.drug_stock_limit = rullerdetail.drug_stock_limit
327
+            }
328
+          })
329
+        },
330
+        addDrug(){
331
+          this.drugDialogVisible = true
332
+        },
333
+      
334
+       //获取所有药品名称
335
+        getAllDrugName(){
336
+          getAllDrugName().then(response=>{
337
+             if(response.data.state == 1){
338
+               var drugName  = response.data.data.drugName
339
+               this.drugName = drugName
340
+
341
+             }
342
+          })  
343
+        },
344
+        handleCurrentChange(val){
345
+          //获取药品规格名称
346
+          this.getRulleName(val.drug_name)
347
+
348
+        },
349
+       handleClose(){
350
+         this.dialogVisible = false
351
+       },
352
+       drughandleClose(){
353
+         this.drugDialogVisible = false
354
+       },
355
+       rullerhandleClose(){
356
+         this.ruleDialogVisible = false
357
+       },
358
+       EditRullerhandleClose(){
359
+         this.editRuleDialogVisible = false
360
+       },
361
+       saveDrugName(){
362
+           var name = ""
363
+           for(let i=0;i<this.drugName.length;i++){
364
+             if(this.drugName[i].id == this.drug_name){
365
+                name = this.drugName[i].drug_name
366
+             }
367
+           }
368
+           const params = {
369
+              drug_name:name,
370
+           }
371
+         saveDrugName(params).then(response=>{
372
+            if(response.data.state == 1){
373
+              var drugname =  response.data.data.drugName
374
+              this.getdrugNameList()
375
+              this.$message.success("保存成功")
376
+              this.drugDialogVisible = false
377
+            }else{
378
+              this.$message.error("药品名称已存在!")
379
+            }
380
+         })   
381
+       },
382
+       saveDrugNameTwo(){
383
+           var name = ""
384
+           for(let i=0;i<this.drugName.length;i++){
385
+             if(this.drugName[i].id == this.drug_name){
386
+                name = this.drugName[i].drug_name
387
+             }
388
+           }
389
+           const params = {
390
+              drug_name:name,
391
+           }
392
+         saveDrugName(params).then(response=>{
393
+            if(response.data.state == 1){
394
+              var drugname =  response.data.data.drugName
395
+              this.$message.success("保存成功")
396
+              this.getdrugNameList()
397
+            }else{
398
+              this.$message.error("药品名称已存在!")
399
+            }
400
+         })     
401
+       },
402
+       //获取所有药品
403
+       getdrugNameList(){
404
+         getdrugNameList().then(response=>{
405
+           if(response.data.state == 1){
406
+              var list =  response.data.data.list
407
+              this.tableData = list
408
+            }
409
+         })    
410
+       },
411
+
412
+       addRule(){
413
+          this.ruleDialogVisible = true   
414
+       },
415
+
416
+
417
+      //获取药品库的规格名称
418
+       getRulleName(name){
419
+          const params = {
420
+             name:name
421
+          }
422
+         getRulleName(params).then(response=>{
423
+            if(response.data.state == 1){
424
+              var rulleName = response.data.data.rulleName
425
+              this.ruleName = rulleName
426
+             
427
+              var rullerlist =  response.data.data.rullerList
428
+             
429
+              this.rullerList  = rullerlist
430
+            }
431
+         }) 
432
+       },
433
+       changeRuleName(id){
434
+         this.form.drug_name_id = id
435
+         this.getUnitByBaseId(id)
436
+       },
437
+       changeRuleNameTwo(id){
438
+         this.editform.drug_name_id = id
439
+         this.getUnitByBaseId(id)
440
+       },
441
+       getUnitByBaseId(id){
442
+           const params = {
443
+             id:id
444
+           }
445
+         getUnitByBaseId(params).then(response=>{
446
+            if(response.data.state == 1){
447
+              var baseList =  response.data.data.baseList
448
+              this.form.unit = baseList.min_unit
449
+              this.form.drug_stock_limit = baseList.drug_stock_limit,
450
+              this.form.price = baseList.retail_price
451
+              
452
+            }
453
+         })
454
+       },
455
+       saveRulleName(){
456
+           if(this.form.drug_name_id == ""){
457
+              this.$message.error("请选择药品规格")
458
+              return
459
+           }
460
+           var drug_spec = ""
461
+           var drug_name = ""
462
+           for(let i=0;i<this.ruleName.length;i++){
463
+              if(this.ruleName[i].id == this.form.drug_name_id){   
464
+                drug_spec = this.ruleName[i].drug_spec
465
+                drug_name = this.ruleName[i].drug_name
466
+              }
467
+           }
468
+           const params = {
469
+             drug_spec:drug_spec,
470
+             drug_name_id:this.form.drug_name_id,
471
+             unit:this.form.unit,
472
+             price:this.form.price,
473
+             drug_stock_limit:this.form.drug_stock_limit, 
474
+             drug_name:drug_name
475
+           }
476
+         saveRulleName(params).then(response=>{
477
+            if(response.data.state == 1){
478
+              var standName =  response.data.data.RullerName
479
+              this.$message.success("保存成功")
480
+              this.getRulleName(standName.drug_name)
481
+              this.ruleDialogVisible = false
482
+            }
483
+         })  
484
+       },
485
+
486
+       saveRulleNameTwo(){
487
+          if(this.form.drug_name_id == ""){
488
+              this.$message.error("请选择药品规格")
489
+              return
490
+           }
491
+           var drug_spec = ""
492
+           var drug_name = ""
493
+           for(let i=0;i<this.ruleName.length;i++){
494
+              if(this.ruleName[i].id == this.form.drug_name_id){   
495
+                drug_spec = this.ruleName[i].drug_spec
496
+                drug_name = this.ruleName[i].drug_name
497
+              }
498
+           }
499
+           const params = {
500
+             drug_spec:drug_spec,
501
+             drug_name_id:this.form.drug_name_id,
502
+             unit:this.form.unit,
503
+             price:this.form.price,
504
+             drug_stock_limit:this.form.drug_stock_limit, 
505
+             drug_name:drug_name
506
+           }
507
+         saveRulleName(params).then(response=>{
508
+            if(response.data.state == 1){
509
+              var RullerName =  response.data.data.RullerName
510
+              this.getRulleName(RullerName.drug_name)
511
+              this.$message.success("保存成功")
512
+            }
513
+         })    
514
+       },
515
+
516
+       updatedRulleName(){
517
+           var drug_spec = ""
518
+           var drug_name = ""
519
+           for(let i=0;i<this.ruleName.length;i++){
520
+              if(this.ruleName[i].id == this.editform.drug_name_id){   
521
+                drug_spec = this.ruleName[i].drug_spec
522
+                drug_name = this.ruleName[i].drug_name
523
+              }
524
+           }
525
+
526
+           const params = {
527
+             id:this.form.id,
528
+             drug_name_id:this.editform.drug_name_id,
529
+             drug_spec:drug_spec,
530
+             unit:this.form.unit,
531
+             price:this.form.price,
532
+             drug_stock_limit:this.form.drug_stock_limit, 
533
+             drug_name:drug_name
534
+           }
535
+           console.log("params999",params)
536
+         updatedRulleName(params).then(response=>{
537
+            if(response.data.state == 1){
538
+               var rullername = response.data.data.RullerName
539
+               this.$message.success("保存成功")
540
+               this.getRulleName(rullername.drug_name)
541
+               this.editRuleDialogVisible = false
542
+            }
543
+         })
544
+       },
545
+
546
+       DeleteDrugById(id,drugname){
547
+         this.$confirm('确认删除吗?', '删除', {
548
+          confirmButtonText: '确 定',
549
+          cancelButtonText: '取 消',
550
+          type: 'warning'
551
+        })
552
+          .then(() => {
553
+              const params ={
554
+                id:id,
555
+                drug_name:drugname
556
+              }
557
+            DeleteDrugById(params).then(response => {
558
+              if (response.data.state == 1) {
559
+                  var msg = response.data.data.msg
560
+                  this.$message.success("删除成功",msg)
561
+              } else {
562
+                  this.$message.error("该药品名称下有药品规格,不能删除")
563
+              }
564
+            })
565
+          })
566
+          .catch(() => {
567
+          })
568
+       },
569
+
570
+       DeleteDrugStand(id,index){
571
+          this.$confirm('确认删除吗?', '删除', {
572
+          confirmButtonText: '确 定',
573
+          cancelButtonText: '取 消',
574
+          type: 'warning'
575
+        })
576
+          .then(() => {
577
+            DeleteDrugStand(id,index).then(response => {
578
+              if (response.data.state == 1) {
579
+                  var msg = response.data.data.msg
580
+                  this.rullerList.splice(index, 1);
581
+                  this.$message.success("删除成功")
582
+              } else {
583
+                  this.$message.error("删除失败")
584
+              }
585
+            })
586
+          })
587
+          .catch(() => {
588
+          })
589
+       }
590
+    },
591
+    created(){
592
+       //获取药品库所有药品名称
593
+       this.getAllDrugName()
594
+
595
+       this.getdrugNameList()
596
+      
597
+     
598
+    },
599
+    watch: {
600
+     tableData: function() {
601
+      this.$nextTick(function() {
602
+        this.$refs.monthlyPlanTable.setCurrentRow(this.tableData[0])
603
+      })
167 604
     }
605
+  },
168 606
 }
169 607
 </script>
170 608
 

+ 154 - 39
src/xt_pages/stock/selfPreparedMedicine/query.vue Näytä tiedosto

@@ -5,7 +5,8 @@
5 5
             <div>
6 6
                 <el-button
7 7
                     size="small"
8
-                    @click="setting"
8
+                    :loading="downloadLoading"
9
+                    @click="exportList"
9 10
                     class="filter-item"
10 11
                     type="primary"
11 12
                     >导出
@@ -31,9 +32,10 @@
31 32
                 align="right"
32 33
                 format="yyyy-MM-dd"
33 34
                 value-format="yyyy-MM-dd"
35
+                @change="changeStartime"
34 36
                 ></el-date-picker>
35 37
                 <el-date-picker
36
-                v-model="start_time"
38
+                v-model="end_time"
37 39
                 prefix-icon="el-icon-date"
38 40
                 :editable="false"
39 41
                 style="width: 196px;margin-right:10px;"
@@ -42,21 +44,24 @@
42 44
                 align="right"
43 45
                 format="yyyy-MM-dd"
44 46
                 value-format="yyyy-MM-dd"
47
+                @change="changeEndtime"
45 48
                 ></el-date-picker>
46
-                <el-select v-model="value" placeholder="请选择" style="margin-right:10px;">
49
+                <el-select v-model="drug_name" placeholder="请选择" style="margin-right:10px;"
50
+                 @change="changeDrugName">
47 51
                     <el-option
48
-                    v-for="item in options"
49
-                    :key="item.value"
50
-                    :label="item.label"
51
-                    :value="item.value">
52
+                    v-for="item in drugName"
53
+                    :key="item.id"
54
+                    :label="item.drug_name"
55
+                    :value="item.id">
52 56
                     </el-option>
53 57
                 </el-select>
54
-                <el-select v-model="value" placeholder="请选择">
58
+                <el-select v-model="drug_spec" placeholder="请选择"
59
+                @change="changeRullName">
55 60
                     <el-option
56
-                    v-for="item in options"
57
-                    :key="item.value"
58
-                    :label="item.label"
59
-                    :value="item.value">
61
+                    v-for="item in rulleName"
62
+                    :key="item.id"
63
+                    :label="item.drug_spec"
64
+                    :value="item.id">
60 65
                     </el-option>
61 66
                 </el-select>
62 67
                 <el-input style="width: 180px;margin:0 10px;" @keyup.enter.native='searchAction' v-model.trim="search_input" class="filter-item"/>
@@ -64,31 +69,31 @@
64 69
             </div>
65 70
             <el-table :data="tableData" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
66 71
                 <el-table-column align="center" label="序号" width="60">
67
-                    <template slot-scope="scope">{{ scope.row.name }}</template>
72
+                    <template slot-scope="scope">{{ scope.$index +1 }}</template>
68 73
                 </el-table-column>
69 74
                 <el-table-column align="center" prop="name" label="透析号" width="80">
70
-                    <template slot-scope="scope">{{ scope.row.name }}</template>
75
+                    <template slot-scope="scope">{{ scope.row.dialysis_no }}</template>
71 76
                 </el-table-column>
72 77
                 <el-table-column align="center" prop="name" label="姓名" width="80">
73 78
                     <template slot-scope="scope">{{ scope.row.name }}</template>
74 79
                 </el-table-column>
75 80
                 <el-table-column align="center" prop="name" label="药品名称">
76
-                    <template slot-scope="scope">{{ scope.row.name }}</template>
81
+                    <template slot-scope="scope">{{ scope.row.drug_name }}</template>
77 82
                 </el-table-column>
78 83
                 <el-table-column align="center" prop="name" label="规格名称">
79
-                    <template slot-scope="scope">{{ scope.row.name }}</template>
84
+                    <template slot-scope="scope">{{ scope.row.drug_spec }}</template>
80 85
                 </el-table-column>
81 86
                 <el-table-column align="center" prop="name" label="单位" width="80">
82
-                    <template slot-scope="scope">{{ scope.row.name }}</template>
87
+                    <template slot-scope="scope">{{ scope.row.min_unit }}</template>
83 88
                 </el-table-column>
84
-                <el-table-column align="center" prop="name" label="自量" width="80">
85
-                    <template slot-scope="scope">{{ scope.row.name }}</template>
89
+                <el-table-column align="center" prop="name" label="自量" width="80">
90
+                    <template slot-scope="scope">{{ scope.row.store_number }}</template>
86 91
                 </el-table-column>
87 92
                 <el-table-column align="center" prop="name" label="已使用" width="80">
88
-                    <template slot-scope="scope">{{ scope.row.name }}</template>
93
+                    <template slot-scope="scope">{{ scope.row.Count }}</template>
89 94
                 </el-table-column>
90 95
                 <el-table-column align="center" prop="name" label="剩余" width="80">
91
-                    <template slot-scope="scope">{{ scope.row.name }}</template>
96
+                    <template slot-scope="scope">{{ scope.row.store_number - scope.row.Count }}</template>
92 97
                 </el-table-column>
93 98
             </el-table>
94 99
         </div>
@@ -97,6 +102,9 @@
97 102
 
98 103
 <script>
99 104
 import BreadCrumb from "../../components/bread-crumb";
105
+import { parseTime } from '@/utils'
106
+import { getAllDrugName,getRulleName,getAllPatientStockList } from "@/api/drug/drug"
107
+const moment = require('moment')
100 108
 export default {
101 109
     components:{
102 110
         BreadCrumb
@@ -108,29 +116,136 @@ export default {
108 116
                 { path: false, name: "自备药管理" },
109 117
                 { path: false, name: "自备药查询" },
110 118
             ],
111
-            tableData: [{
112
-                date: '2016-05-02',
113
-                name: '王小虎',
114
-                address: '上海市普陀区金沙江路 1518 弄'
115
-                }, {
116
-                date: '2016-05-04',
117
-                name: '王小虎',
118
-                address: '上海市普陀区金沙江路 1517 弄'
119
-                }, {
120
-                date: '2016-05-01',
121
-                name: '王小虎',
122
-                address: '上海市普陀区金沙江路 1519 弄'
123
-                }, {
124
-                date: '2016-05-03',
125
-                name: '王小虎',
126
-                address: '上海市普陀区金沙江路 1516 弄'
127
-            }]
119
+            tableData: [],
120
+            downloadLoading: false,
121
+            search_input:"",
122
+            options:[],
123
+            value:"",
124
+            // start_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
125
+            // end_time:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
126
+            start_time:"",
127
+            end_time:"",
128
+            drug_name:"",
129
+            drug_spec:"",
130
+            drugName:[],
131
+            rulleName:[]
128 132
         }
129 133
     },
130 134
     methods:{
131 135
         toPrint(){
132
-            this.$router.push({path: '/stock/selfPreparedMedicineQueryPrint'})
136
+          this.$router.push({path: '/stock/selfPreparedMedicineQueryPrint?start_time='+this.start_time+"&end_time="+this.end_time+"&drug_name="+this.drug_name+"&drug_spec="+this.drug_spec+"&keyword="+this.search_input})
137
+        },
138
+        exportList(){
139
+         import('@/vendor/Export2Excel').then(excel => {
140
+         const tHeader = ['序号', '透析号', '姓名','药品名称','规格名称','单位','自备量','已使用','剩余']
141
+         const filterVal = ['index', 'dialysis_no', 'name','drug_name','drug_spec','min_unit','Total','Count','margin']
142
+         for(let i=0;i<this.tableData.length;i++){
143
+            this.tableData[i].margin = this.tableData[i].Total - this.tableData[i].Count
144
+         }
145
+         const data = this.formatJson(filterVal, this.tableData)
146
+         excel.export_json_to_excel({
147
+           header: tHeader,
148
+           data,
149
+           filename: '自备药查询'
150
+         })
151
+          this.downloadLoading = false
152
+        })
153
+       },
154
+       formatJson(filterVal, jsonData) {
155
+        return jsonData.map(v => filterVal.map(j => v[j]));
156
+      },
157
+
158
+      changeStartime(){
159
+        this.getlist()
160
+      },
161
+      changeEndtime(){
162
+        this.getlist()
163
+      },
164
+
165
+      getAllDrugName(){
166
+        getAllDrugName().then(response=>{
167
+          if(response.data.state == 1){
168
+             var drugName =  response.data.data.drugName
169
+             console.log("drugName",drugName)
170
+             this.drugName = drugName
171
+
172
+             this.getlist()
173
+          }
174
+        })
175
+      },
176
+      getRulleName(name){
177
+          const params = {
178
+             name:name
179
+          }
180
+        getRulleName(params).then(response=>{
181
+           if(response.data.state == 1){
182
+             var rulleName = response.data.data.rulleName
183
+             console.log("rulleName",rulleName)
184
+             this.rulleName = rulleName
185
+           }
186
+        })  
187
+      },
188
+      searchAction(){
189
+        this.getlist()
190
+      },
191
+      changeDrugName(id){
192
+        var drug_name = ""
193
+        for(let i=0;i<this.drugName.length;i++){
194
+           if(id == this.drugName[i].id){
195
+             drug_name = this.drugName[i].drug_name
196
+           }
197
+        }
198
+        this.drug_name = drug_name
199
+        this.getRulleName(drug_name)
200
+        this.getlist()
201
+      },
202
+      changeRullName(id){
203
+        var drug_desc = ""
204
+        for(let i=0;i<this.rulleName.length;i++){
205
+           if(id == this.rulleName[i].id){
206
+             drug_desc = this.rulleName[i].drug_desc
207
+           }
133 208
         }
209
+        this.drug_desc = drug_desc
210
+        this.getlist()
211
+      },
212
+      getlist(){
213
+          const params = {
214
+            start_time:this.start_time,
215
+            end_time:this.end_time,
216
+            drug_name:this.drug_name,
217
+            drug_spec:this.drug_spec,
218
+            search_input:this.search_input
219
+          }
220
+          console.log("params====",params)
221
+        getAllPatientStockList(params).then(response=>{
222
+            if(response.data.state == 1){
223
+              var stocklist = response.data.data.stocklist
224
+              for(let i=0;i<stocklist.length;i++){
225
+                 stocklist[i].index = i+1
226
+                 stocklist[i].Count = 0
227
+              }
228
+              var outStockList =  response.data.data.outStockList
229
+              for(let i=0;i<stocklist.length;i++){
230
+                for(let j=0;j<outStockList.length;j++){
231
+                   if(stocklist[i].patient_id == outStockList[j].patient_id &&stocklist[i].drug_name == outStockList[j].drug_name && stocklist[i].drug_spec == outStockList[j].drug_spec){
232
+                       stocklist[i].Count = outStockList[j].Count
233
+                   }
234
+                }
235
+              }
236
+              console.log("stocklist3333",stocklist)
237
+              this.tableData = stocklist
238
+            }
239
+        })   
240
+      }
241
+    },
242
+    created(){
243
+      //获取所有药品名称
244
+      this.getAllDrugName()
245
+
246
+
247
+
248
+      
134 249
     }
135 250
 }
136 251
 </script>

+ 51 - 480
src/xt_pages/stock/selfPreparedMedicine/queryPrint.vue Näytä tiedosto

@@ -12,10 +12,10 @@
12 12
             <div id="print_content">
13 13
                 <div class="print_main_content">
14 14
                     <div class="order_title_panl">
15
-                        <span class="main_title">{{ $store.getters.xt_user.org.org_name }}医护排班表</span>
15
+                        <span class="main_title">自备药查询表</span>
16 16
                     </div>
17 17
                     <div style="text-align:right;margin-bottom:20px;font-size: 18px;">
18
-                      打印时间:
18
+                      打印时间:{{time_now}}
19 19
                     </div>
20 20
                     <div class="table_panel">
21 21
                         <table class="table">
@@ -33,16 +33,16 @@
33 33
                                 </tr>
34 34
                             </thead>
35 35
                             <tbody>
36
-                                <tr v-for='(item,index) in 8' :key="index">
37
-                                    <td>张三</td>
38
-                                    <td>张三</td>
39
-                                    <td>张三</td>
40
-                                    <td>张三</td>
41
-                                    <td>张三</td>
42
-                                    <td>张三</td>
43
-                                    <td>张三</td>
44
-                                    <td>张三</td>
45
-                                    <td>张三</td>
36
+                                <tr v-for='(item,index) in tableData' :key="index">
37
+                                    <td>{{index+1}}</td>
38
+                                    <td>{{item.dialysis_no}}</td>
39
+                                    <td>{{item.name}}</td>
40
+                                    <td>{{item.drug_name}}</td>
41
+                                    <td>{{item.drug_spec}}</td>
42
+                                    <td>{{item.min_unit}}</td>
43
+                                    <td>{{item.store_number}}</td>
44
+                                    <td>{{item.Count}}</td>
45
+                                    <td>{{item.store_number - item.Count}}</td>
46 46
                                 </tr>
47 47
                             </tbody>
48 48
                         </table>
@@ -55,8 +55,9 @@
55 55
 
56 56
 <script>
57 57
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
58
+import { getAllPatientStockList } from '@/api/drug/drug'
58 59
 import print from 'print-js'
59
-import { getDoctorList,getScheduleByDoctorId } from '@/api/doctorSchedule'
60
+const moment = require('moment')
60 61
 export default {
61 62
     components:{
62 63
         BreadCrumb
@@ -70,27 +71,16 @@ export default {
70 71
           ],
71 72
           start_time:"",
72 73
           end_time:"",
73
-
74
-          doctorlist:[],
74
+          drug_name:"",
75
+          drug_spec:"",
76
+          keyword:"",
75 77
           tableData:[],
76
-          arrZero:[],
77
-          arrOne:[],
78
-          arrTwo:[],
79
-          arrThree:[],
80
-          arrFour:[],
81
-          arrFive:[],
82
-          arrSix:[],
83
-          arrSeven:[],
84
-          typevalue:0,
85
-          
86
-          doctorTableData:[],
87
-          nurseTableData:[]
78
+          time_now:moment(new Date()).add('year',0).format("YYYY-MM-DD")
88 79
         }
89 80
     },
90 81
     methods:{
91 82
       printAction: function() {
92 83
           const style = '@media print { .print_main_content { background-color: white; width:960px;  margin:0 auto; padding: 0 0 20px 0; } .order_title_panl { text-align: center; } .main_title { font-size: 18px; line-height: 40px; font-weight: 500; } .table_panel { } .table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px; } thead tr td { border: 1px solid; text-align: center; font-size: 16px; padding: 15px 5px; } tbody tr td { border: 1px solid; text-align: center; font-size: 16px; padding: 10px 5px; white-space: pre-line;} .proj { padding: 5px 0; text-align: left; } .proj_title { font-size: 16px; font-weight: 500; line-height: 25px; } .proj_item { font-size: 15px; line-height: 20px; } .zone_name { font-weight: 500; } }'
93
-
94 84
           printJS({
95 85
           printable: 'print_content',
96 86
           type: 'html',
@@ -99,467 +89,48 @@ export default {
99 89
           scanStyles: false
100 90
           })
101 91
       },
102
-      getDoctorList(){
103
-        getDoctorList().then(response=>{
104
-          var list =  response.data.data.list
105
-          this.doctorlist = list
106
-          this.getScheduleByDoctorId()
107
-
108
-          //
109
-          var doctorlist =  response.data.data.doctorlist
110
-          let arr = []
111
-          for(let i=0;i<doctorlist.length;i++){
112
-              if(doctorlist[i].sort == 0){
113
-                doctorlist[i].sort = ""
114
-              }
115
-          }
116
-          console.log('doctorlist',doctorlist)
117
-          this.doctorTableData = doctorlist
118
-          var nurselist = response.data.data.nurselist
119
-          for(let i=0;i<nurselist.length;i++){
120
-              if(nurselist[i].sort == 0){
121
-                  nurselist[i].sort = ""
122
-              }
92
+        getlist(){
93
+          const params = {
94
+            start_time:this.start_time,
95
+            end_time:this.end_time,
96
+            drug_name:this.drug_name,
97
+            drug_spec:this.drug_spec,
98
+            search_input:this.keyword
123 99
           }
124
-          this.nurseTableData = nurselist
125
-        })
126
-      },
127
-      //获取本周的所有排班列表
128
-      getScheduleByDoctorId(){
129
-        const params = {
130
-          start_time:this.start_time,
131
-          end_time:this.end_time,
132
-          doctor_id:this.typevalue,
133
-        }
134
-        console.log("parasm",params)
135
-        getScheduleByDoctorId(params).then(response=>{
136
-          if(response.data.state == 1){
137
-              var staffList = response.data.data.staffList
138
-              console.log("stafflist",staffList)
139
-
140
-              var sevenStr = ""
141
-              var oneStr = ""
142
-              var twoStr = ""
143
-              var threeStr = ""
144
-              var fourStr = ""
145
-              var fiveStr = ""
146
-              var sixStr = ""
147
-              for(let i=0;i<staffList.length;i++){
148
-              if(staffList[i].schedule_week == 0){
149
-                  staffList[i].class_index = 0
150
-                    var arr = []
151
-                  this.arrZero.push(staffList[i].class_name)
152
-                  for(let i=0;i<this.arrZero.length;i++){
153
-                      if(this.arrZero[i]!=''){
154
-                        arr.push(this.arrZero[i])
155
-                      }
156
-                  }
157
-                  var countedNames = arr.reduce(function (allNames, name) { 
158
-                      if (name in allNames) {
159
-                          allNames[name]++;
160
-                      }
161
-                      else {
162
-                          allNames[name] = 1;
163
-                      }
164
-                      return allNames;
165
-                  }, {});
166
-                  let objKey = Object.keys(countedNames)
167
-                  let objVal = Object.values(countedNames)
168
-                  var zeroStr = ''
169
-                  objKey.map((item,index) => {
170
-                  let objVal = Object.values(countedNames)
171
-                      zeroStr += item + objVal[index] + '\n'
172
-                  })
173
-                  sevenStr = zeroStr
174
-              }
175
-              if(staffList[i].schedule_week == 1){
176
-                  staffList[i].class_index = 1
177
-                  var arr = []
178
-                  this.arrOne.push(staffList[i].class_name)
179
-                  for(let i=0;i<this.arrOne.length;i++){
180
-                      if(this.arrOne[i]!=''){
181
-                        arr.push(this.arrOne[i])
182
-                      }
183
-                  }
184
-                  var countedNames = arr.reduce(function (allNames, name) { 
185
-                      if (name in allNames) {
186
-                          allNames[name]++;
187
-                      }
188
-                      else {
189
-                          allNames[name] = 1;
190
-                      }
191
-                      return allNames;
192
-                  }, {});
193
-                  let objKey = Object.keys(countedNames)
194
-                  let objVal = Object.values(countedNames)
195
-                  let strOne = ''
196
-                  objKey.map((item,index) => {
197
-                  let objVal = Object.values(countedNames)
198
-                      strOne += item + objVal[index] + '\n'
199
-                  })
200
-                  oneStr  = strOne
100
+        getAllPatientStockList(params).then(response=>{
101
+            if(response.data.state == 1){
102
+              var stocklist = response.data.data.stocklist
103
+              for(let i=0;i<stocklist.length;i++){
104
+                 stocklist[i].index = i+1
105
+                 stocklist[i].Count = 0
201 106
               }
202
-              if(staffList[i].schedule_week == 2){
203
-                  staffList[i].class_index = 2
204
-                    var arr = []
205
-                  this.arrTwo.push(staffList[i].class_name)
206
-                  for(let i=0;i<this.arrTwo.length;i++){
207
-                      if(this.arrTwo[i]!=''){
208
-                        arr.push(this.arrTwo[i])
209
-                      }
210
-                  }
211
-                  var countedNames = arr.reduce(function (allNames, name) { 
212
-                      if (name in allNames) {
213
-                          allNames[name]++;
214
-                      }
215
-                      else {
216
-                          allNames[name] = 1;
217
-                      }
218
-                      return allNames;
219
-                  }, {});
220
-                  let objKey = Object.keys(countedNames)
221
-                  let objVal = Object.values(countedNames)
222
-                  let strTwo = ''
223
-                  objKey.map((item,index) => {
224
-                  let objVal = Object.values(countedNames)
225
-                      strTwo += item + objVal[index] + '\n'
226
-                  })
227
-                    twoStr = strTwo
228
-              }
229
-              if(staffList[i].schedule_week == 3){
230
-                  staffList[i].class_index = 3
231
-                    var arr = []
232
-                  this.arrThree.push(staffList[i].class_name)
233
-                  for(let i=0;i<this.arrThree.length;i++){
234
-                      if(this.arrThree[i]!=''){
235
-                        arr.push(this.arrThree[i])
236
-                      }
237
-                  }
238
-                  var countedNames = arr.reduce(function (allNames, name) { 
239
-                      if (name in allNames) {
240
-                          allNames[name]++;
241
-                      }
242
-                      else {
243
-                          allNames[name] = 1;
244
-                      }
245
-                      return allNames;
246
-                  }, {});
247
-                  let objKey = Object.keys(countedNames)
248
-                  let objVal = Object.values(countedNames)
249
-                  let strThree = ''
250
-                  objKey.map((item,index) => {
251
-                  let objVal = Object.values(countedNames)
252
-                      strThree += item + objVal[index] + '\n'
253
-                  })
254
-                  threeStr = strThree
255
-              }
256
-              if(staffList[i].schedule_week == 4){
257
-                  staffList[i].class_index = 4
258
-                  var arr = []
259
-                  this.arrFour.push(staffList[i].class_name)
260
-                  for(let i=0;i<this.arrFour.length;i++){
261
-                      if(this.arrFour[i]!=''){
262
-                        arr.push(this.arrFour[i])
263
-                      }
264
-                  }
265
-                  var countedNames = arr.reduce(function (allNames, name) { 
266
-                      if (name in allNames) {
267
-                          allNames[name]++;
268
-                      }
269
-                      else {
270
-                          allNames[name] = 1;
271
-                      }
272
-                      return allNames;
273
-                  }, {});
274
-                  let objKey = Object.keys(countedNames)
275
-                  let objVal = Object.values(countedNames)
276
-                  let strFour = ''
277
-                  objKey.map((item,index) => {
278
-                  let objVal = Object.values(countedNames)
279
-                      strFour += item + objVal[index] + '\n'
280
-                  })
281
-                  fourStr = strFour
282
-              }
283
-              if(staffList[i].schedule_week == 5){
284
-                  staffList[i].class_index = 5
285
-
286
-                    var arr = []
287
-                  this.arrFive.push(staffList[i].class_name)
288
-                  for(let i=0;i<this.arrFive.length;i++){
289
-                      if(this.arrFive[i]!=''){
290
-                        arr.push(this.arrFive[i])
291
-                      }
292
-                  }
293
-                  var countedNames = arr.reduce(function (allNames, name) { 
294
-                      if (name in allNames) {
295
-                          allNames[name]++;
296
-                      }
297
-                      else {
298
-                          allNames[name] = 1;
299
-                      }
300
-                      return allNames;
301
-                  }, {});
302
-                  let objKey = Object.keys(countedNames)
303
-                  let objVal = Object.values(countedNames)
304
-                  let strFive = ''
305
-                  objKey.map((item,index) => {
306
-                  let objVal = Object.values(countedNames)
307
-                      strFive += item + objVal[index] + '\n'
308
-                  })
309
-                    fiveStr = strFive
310
-              }
311
-              if(staffList[i].schedule_week == 6){
312
-                  staffList[i].class_index = 6
313
-                    var arr = []
314
-                  this.arrSix.push(staffList[i].class_name)
315
-                  for(let i=0;i<this.arrSix.length;i++){
316
-                      if(this.arrSix[i]!=''){
317
-                        arr.push(this.arrSix[i])
318
-                      }
319
-                  }
320
-                  var countedNames = arr.reduce(function (allNames, name) { 
321
-                      if (name in allNames) {
322
-                          allNames[name]++;
323
-                      }
324
-                      else {
325
-                          allNames[name] = 1;
326
-                      }
327
-                      return allNames;
328
-                  }, {});
329
-                  let objKey = Object.keys(countedNames)
330
-                  let objVal = Object.values(countedNames)
331
-                  let strSix = ''
332
-                  objKey.map((item,index) => {
333
-                  let objVal = Object.values(countedNames)
334
-                      strSix += item + objVal[index] + '\n'
335
-                  })
336
-                  sixStr = strSix
337
-                }
338
-              }
339
-              let tempArr = [], newArr = []
340
-              for (let i = 0; i < staffList.length; i++) {
341
-                if (tempArr.indexOf(staffList[i].user_name) === -1) {
342
-                  newArr.push({
343
-                    user_name: staffList[i].user_name,
344
-                    admin_user_id:staffList[i].admin_user_id,
345
-                    user_type:staffList[i].doctor_type,
346
-                    is_sort:staffList[i].is_sort,
347
-                    sort:staffList[i].sort,
348
-                    list: [{class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes}]
349
-                  })
350
-                  tempArr.push(staffList[i].user_name);
351
-                } else {
352
-                  for (let j = 0; j < newArr.length; j++) {
353
-                    if (newArr[j].user_name == staffList[i].user_name) {
354
-                      newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes})
355
-                    }
356
-                  }
357
-                }
358
-              }
359
-
360
-              let arr = [...newArr]
361
-              let newNurse = []
362
-              let newDoctor = []
363
-              arr.map(item => {
364
-                if(item.user_type == 2){
365
-                  newDoctor.push(item)
107
+              var outStockList =  response.data.data.outStockList
108
+              for(let i=0;i<stocklist.length;i++){
109
+                for(let j=0;j<outStockList.length;j++){
110
+                   if(stocklist[i].patient_id == outStockList[j].patient_id &&stocklist[i].drug_name == outStockList[j].drug_name && stocklist[i].drug_spec == outStockList[j].drug_spec){
111
+                       stocklist[i].Count = outStockList[j].Count
112
+                   }
366 113
                 }
367
-                if(item.user_type == 3){
368
-                  newNurse.push(item)
369
-                }
370
-              })
371
-
372
-              if(this.typevalue == 0){
373
-                //护士
374
-                newNurse.sort(this.compare('admin_user_id'))
375
-                let newNurseTableData = []
376
-                this.nurseTableData.map(item => {
377
-                    if(item.is_sort == 1){
378
-                        newNurseTableData.push(item)
379
-                    }
380
-                })
381
-                newNurseTableData.sort(this.compare('admin_user_id'))
382
-                newNurseTableData.map((item,index) => {
383
-                    if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
384
-                
385
-                    }else{
386
-                        newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
387
-                    }
388
-                })
389
-                newNurse.sort(this.compare('sort'))
390
-
391
-                //医生
392
-                newDoctor.sort(this.compare('admin_user_id'))
393
-                let newDoctorTableData = []
394
-                this.doctorTableData.map(item => {
395
-                    if(item.is_sort == 1){
396
-                        newDoctorTableData.push(item)
397
-                    }
398
-                })
399
-                newDoctorTableData.sort(this.compare('admin_user_id'))
400
-                newDoctorTableData.map((item,index) => {
401
-                    if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
402
-                
403
-                    }else{
404
-                        newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
405
-                    }
406
-                })
407
-                newDoctor.sort(this.compare('sort'))
408
-                
409
-                
410
-
411
-                let arr2 = []
412
-                arr2.push({class_name:oneStr,schedule_week:1})
413
-                arr2.push({class_name:twoStr,schedule_week:2})
414
-                arr2.push({class_name:threeStr,schedule_week:3})
415
-                arr2.push({class_name:fourStr,schedule_week:4})
416
-                arr2.push({class_name:fiveStr,schedule_week:5})
417
-                arr2.push({class_name:sixStr,schedule_week:6})
418
-                arr2.push({class_name:zeroStr,schedule_week:0})
419
-                var obj = {}
420
-                obj.admin_user_id = "1000000"
421
-                obj.user_name = "合计"
422
-                obj.user_type = 10
423
-                obj.list = arr2
424
-                arr.push(obj)
425
-
426
-                let data = []
427
-                data.push(...newNurse)
428
-                data.push(...newDoctor)
429
-                data.push(obj)
430
-                this.tableData = data
431
-              }
432
-              if(this.typevalue == 2){
433
-                newDoctor.sort(this.compare('admin_user_id'))
434
-                let newDoctorTableData = []
435
-                this.doctorTableData.map(item => {
436
-                    if(item.is_sort == 1){
437
-                        newDoctorTableData.push(item)
438
-                    }
439
-                })
440
-                newDoctorTableData.sort(this.compare('admin_user_id'))
441
-                newDoctorTableData.map((item,index) => {
442
-                    if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
443
-                
444
-                    }else{
445
-                        newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
446
-                    }
447
-                })
448
-                newDoctor.sort(this.compare('sort'))
449
-                
450
-                let arr2 = []
451
-                arr2.push({class_name:oneStr,schedule_week:1})
452
-                arr2.push({class_name:twoStr,schedule_week:2})
453
-                arr2.push({class_name:threeStr,schedule_week:3})
454
-                arr2.push({class_name:fourStr,schedule_week:4})
455
-                arr2.push({class_name:fiveStr,schedule_week:5})
456
-                arr2.push({class_name:sixStr,schedule_week:6})
457
-                arr2.push({class_name:zeroStr,schedule_week:0})
458
-                var obj = {}
459
-                obj.admin_user_id = "1000000"
460
-                obj.user_name = "合计"
461
-                obj.user_type = 10
462
-                obj.list = arr2
463
-                newDoctor.push(obj)
464
-                this.tableData = newDoctor
465
-              }
466
-              if(this.typevalue == 3){
467
-                newNurse.sort(this.compare('admin_user_id'))
468
-                let newNurseTableData = []
469
-                this.nurseTableData.map(item => {
470
-                    if(item.is_sort == 1){
471
-                        newNurseTableData.push(item)
472
-                    }
473
-                })
474
-                newNurseTableData.sort(this.compare('admin_user_id'))
475
-                newNurseTableData.map((item,index) => {
476
-                    if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
477
-                
478
-                    }else{
479
-                        newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
480
-                    }
481
-                })
482
-                newNurse.sort(this.compare('sort'))
483
-                let arr2 = []
484
-                arr2.push({class_name:oneStr,schedule_week:1})
485
-                arr2.push({class_name:twoStr,schedule_week:2})
486
-                arr2.push({class_name:threeStr,schedule_week:3})
487
-                arr2.push({class_name:fourStr,schedule_week:4})
488
-                arr2.push({class_name:fiveStr,schedule_week:5})
489
-                arr2.push({class_name:sixStr,schedule_week:6})
490
-                arr2.push({class_name:zeroStr,schedule_week:0})
491
-                var obj = {}
492
-                obj.admin_user_id = "1000000"
493
-                obj.user_name = "合计"
494
-                obj.user_type = 10
495
-                obj.list = arr2
496
-                newNurse.push(obj)
497
-                this.tableData = newNurse
498 114
               }
115
+              console.log("stocklist99999",stocklist)
116
+              this.tableData = stocklist
499 117
             }
500
-        })
501
-      },
502
-      getClass(name,index){
503
-        if(name != undefined){
504
-          let newClass = '';
505
-          this.tableData.map(item => {
506
-            if(item.user_name == name){
507
-              if(item.list){
508
-                item.list.map(it => {
509
-                  if(it.schedule_week == index){
510
-                    newClass = it.class_name
511
-                  }
512
-                })
513
-              } 
514
-            }
515
-          })
516
-          if(newClass && newClass.indexOf("(") > -1){
517
-            let num = newClass.indexOf("(")
518
-            let a = newClass.slice(0, num) + '\n' + newClass.slice(num)
519
-            return a
520
-          }else if(newClass && newClass.indexOf("(") > -1) {
521
-            let num = newClass.indexOf("(")
522
-            let a = newClass.slice(0, num) + '\n' + newClass.slice(num)
523
-            return a
524
-          }else{
525
-            return newClass
526
-          }
527
-          
528
-        }
529
-      },
530
-      getNowFormatDate() {
531
-        var date = new Date();
532
-        var seperator1 = "-";
533
-        var year = date.getFullYear();
534
-        var month = date.getMonth() + 1;
535
-        var strDate = date.getDate();
536
-        if (month >= 1 && month <= 9) {
537
-            month = "0" + month;
538
-        }
539
-        if (strDate >= 0 && strDate <= 9) {
540
-            strDate = "0" + strDate;
541
-        }
542
-        var currentdate = year + seperator1 + month + seperator1 + strDate;
543
-        return currentdate;
544
-      },
545
-      compare(property){
546
-        return function(a,b){
547
-            var value1 = a[property];
548
-            var value2 = b[property];
549
-            return value2 - value1;
550
-        }
551
-      },
118
+        })   
119
+      }
552 120
     },
553 121
     created(){
554
-      var starttime =  this.$route.query.starttime
122
+      var starttime =  this.$route.query.start_time
555 123
       this.start_time = starttime
556
-      var endtime =  this.$route.query.endtime
124
+      var endtime =  this.$route.query.end_time
557 125
       this.end_time = endtime
558
-      this.weekArr = this.$route.query.weekArr.split(',')
559
-      this.typevalue = parseInt(this.$route.query.typeValue)
560
-      
561
-      //获取该机构所有医护人员
562
-      this.getDoctorList()
126
+      var drugname = this.$route.query.drug_name
127
+      this.drug_name = drugname
128
+      var drug_spec = this.$route.query.drug_spec
129
+      this.drug_spec = drug_spec
130
+      var keyword = this.$route.query.keyword
131
+      this.keyword = keyword
132
+
133
+      this.getlist()
563 134
     }
564 135
 }
565 136
 </script>

+ 98 - 31
src/xt_pages/user/doctorAdvice.vue Näytä tiedosto

@@ -934,7 +934,7 @@
934 934
       <el-dialog
935 935
         :title="nameFormTitle"
936 936
         :visible.sync="nameFormVisible"
937
-        width="700px"
937
+        width="800px"
938 938
       >
939 939
         <el-form
940 940
           ref="nameForm"
@@ -943,19 +943,53 @@
943 943
           label-width="90px"
944 944
         >
945 945
           <el-row>
946
-            <el-col :span="12">
946
+            <el-col :span="10">
947 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
+
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.drug_name"
965
+                ></el-option>
966
+              </el-select>
949 967
               </el-form-item>
950 968
             </el-col>
951 969
 
952
-            <el-col :span="12">
970
+            <el-col :span="14">
953 971
               <el-form-item label="药品规格 :" prop="advice_desc">
954
-                <el-col :span="8">
955
-                  <el-input v-model="nameForm.advice_desc"></el-input>
972
+                <el-col :span="12">
973
+                  <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
974
+                    <el-select
975
+                      v-model="nameForm.advice_desc"
976
+                      filterable
977
+                      clearable
978
+                      allow-create
979
+                      :disabled="isChild"
980
+                      placeholder="请选择(输入可搜索)"
981
+                      style="width:190px"
982
+                  >
983
+                  <el-option
984
+                    v-for="item in drugSpec"
985
+                    :key="item.id"
986
+                    :label="item.drug_spec"
987
+                    :value="item.drug_spec"
988
+                  ></el-option>
989
+                 </el-select>  
956 990
                 </el-col>
957 991
                 <el-col class="line" :span="2">&nbsp;</el-col>
958
-                <el-col :span="14">
992
+                <el-col :span="6">
959 993
                   <el-select
960 994
                     v-model="nameForm.drug_spec_unit"
961 995
                     filterable
@@ -1942,7 +1976,7 @@ import { fetchPatient, PostRemind } from "@/api/patient";
1942 1976
 
1943 1977
 import { jsGetAge, uParseTime } from "@/utils/tools";
1944 1978
 import { getDataConfig } from "@/utils/data";
1945
-
1979
+import { getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
1946 1980
 let rowIndex = 1;
1947 1981
 const rowKey = 0;
1948 1982
 
@@ -2146,16 +2180,18 @@ export default {
2146 2180
       temp: null,
2147 2181
       schedulStatus: 0,
2148 2182
       doctorAdvice: [],
2149
-      dataAdvice: []
2183
+      dataAdvice: [],
2184
+      medicals:[],
2185
+      patient_id:"",
2186
+      drugSpec:[]
2150 2187
     };
2151 2188
   },
2152 2189
   methods: {
2153 2190
     clickuseradvicecell(row, column, cell, event) {
2154
-      console.log("row1", row);
2155
-      console.log("column", column);
2191
+      // console.log("row1", row);
2192
+      // console.log("column", column);
2156 2193
     },
2157 2194
     onTranPatient: function(tranPatient) {
2158
-      console.log("tranPatient", tranPatient);
2159 2195
       this.currentPatient = tranPatient;
2160 2196
     },
2161 2197
     adviceNameShow({ row, column, rowIndex, columnIndex }) {
@@ -2686,7 +2722,7 @@ export default {
2686 2722
         type: "warning"
2687 2723
       })
2688 2724
         .then(() => {
2689
-          console.log(row);
2725
+          // console.log(row);
2690 2726
 
2691 2727
           let mode = "";
2692 2728
           if (row.advice_type == 3) {
@@ -2849,7 +2885,7 @@ export default {
2849 2885
 
2850 2886
       this.temp = row;
2851 2887
 
2852
-      console.log(row);
2888
+      // console.log(row);
2853 2889
       this.stopForm = {
2854 2890
         id: row.parent_id > 0 ? row.parent_id : row.id,
2855 2891
         stop_time: "",
@@ -2903,7 +2939,7 @@ export default {
2903 2939
         remark: groups[0].remark,
2904 2940
         groupno: groupno
2905 2941
       };
2906
-      console.log(groups[0]);
2942
+      // console.log(groups[0]);
2907 2943
 
2908 2944
       var childMap = {};
2909 2945
       for (const index in groups) {
@@ -2975,7 +3011,7 @@ export default {
2975 3011
         this.groupForm.adviceNames.push(item);
2976 3012
       }
2977 3013
 
2978
-      console.log(this.groupForm);
3014
+      // console.log(this.groupForm);
2979 3015
 
2980 3016
       this.$refs.editGroupForm.open();
2981 3017
     },
@@ -2992,7 +3028,7 @@ export default {
2992 3028
       //     this.$message.error("不能修改非本人添加的医嘱!");
2993 3029
       //     return false;
2994 3030
       // }
2995
-      console.log(row);
3031
+      // console.log(row);
2996 3032
       this.setAdviceForm(row);
2997 3033
       this.dialogFormVisible = true;
2998 3034
     },
@@ -3291,7 +3327,6 @@ export default {
3291 3327
           //console.log("数据是什么", this.adviceTableData);
3292 3328
           var advice = response.data.data.advices;
3293 3329
           var one = response.data.data.advicetwo;
3294
-          console.log("advicetwo", one);
3295 3330
           let dataInfo = {};
3296 3331
           one.forEach((item, index) => {
3297 3332
             let { start_time } = item;
@@ -3324,10 +3359,10 @@ export default {
3324 3359
           this.childList = objarr;
3325 3360
           let arr = this.doctorAdvice;
3326 3361
           arr.push(...list.reverse());
3327
-          console.log("arr", arr);
3362
+          // console.log("arr", arr);
3328 3363
           this.doctorAdvice = arr;
3329 3364
           var total = response.data.data.total;
3330
-          console.log("total", total);
3365
+          // console.log("total", total);
3331 3366
           this.total = total;
3332 3367
           this.operators = response.data.data.operators;
3333 3368
           if (this.operators.length > 0) {
@@ -3399,7 +3434,7 @@ export default {
3399 3434
       this.multipleSelection = selection;
3400 3435
     },
3401 3436
     handleClick(val) {
3402
-      console.log("val", val);
3437
+      // console.log("val", val);
3403 3438
     },
3404 3439
     printThisInfo() {
3405 3440
       if (this.adviceType == 1) {
@@ -3516,7 +3551,7 @@ export default {
3516 3551
         }
3517 3552
       }
3518 3553
 
3519
-      console.log(this.selectedTemp.list);
3554
+      // console.log(this.selectedTemp.list);
3520 3555
     },
3521 3556
     spanselecttable({ row, column, rowIndex, columnIndex }) {
3522 3557
       if (columnIndex == 0) {
@@ -3667,7 +3702,7 @@ export default {
3667 3702
         for (const index in adviceTemplate.DoctorAdviceTemplate) {
3668 3703
           if (adviceTemplate.DoctorAdviceTemplate[index].selection) {
3669 3704
             thisRowKey++;
3670
-            console.log(adviceTemplate.DoctorAdviceTemplate[index].id);
3705
+            // console.log(adviceTemplate.DoctorAdviceTemplate[index].id);
3671 3706
             var item = {
3672 3707
               advice_name:
3673 3708
                 adviceTemplate.DoctorAdviceTemplate[index].advice_name,
@@ -3764,7 +3799,7 @@ export default {
3764 3799
           continue;
3765 3800
         }
3766 3801
         this.rowKey++;
3767
-        console.log(this.allSelectedTemplate[index]);
3802
+        // console.log(this.allSelectedTemplate[index]);
3768 3803
         var item = {
3769 3804
           template_id: this.allSelectedTemplate[index].template_id,
3770 3805
           advice_name: this.allSelectedTemplate[index].advice_name,
@@ -3824,7 +3859,7 @@ export default {
3824 3859
         this.groupForm.adviceNames.push(item);
3825 3860
       }
3826 3861
 
3827
-      console.log(this.groupForm);
3862
+      // console.log(this.groupForm);
3828 3863
 
3829 3864
       this.templateFormVisible = false;
3830 3865
       // 清除数据源的选中记录
@@ -3929,6 +3964,8 @@ export default {
3929 3964
       });
3930 3965
     },
3931 3966
     submitNameForm(formName) {
3967
+      var arr = this.nameForm.advice_name.split("(自备药)")
3968
+      this.nameForm.advice_name = arr[0]
3932 3969
       var _this = this;
3933 3970
       this.$refs[formName].validate(valid => {
3934 3971
         if (valid) {
@@ -4258,11 +4295,11 @@ export default {
4258 4295
       getPrintInfo({ ids: ids }).then(response => {
4259 4296
         if (response.data.state === 1) {
4260 4297
           var doctoradvice = response.data.data.doctoradvice;
4261
-          console.log("doctoradvice", doctoradvice);
4298
+          // console.log("doctoradvice", doctoradvice);
4262 4299
           this.dataAdvice = doctoradvice;
4263 4300
           if (this.adviceType === 3 || this.adviceType === 2) {
4264 4301
             this.lstableData = this.dataAdvice;
4265
-            console.log("---", this.multipleSelection);
4302
+            // console.log("---", this.multipleSelection);
4266 4303
           } else if (this.adviceType === 1) {
4267 4304
             this.cqtableData = doctoradvice;
4268 4305
           }
@@ -4282,13 +4319,13 @@ export default {
4282 4319
       getPatientSchedules(id).then(response => {
4283 4320
         if (response.data.state === 1) {
4284 4321
           var scheduls = response.data.data.scheduls;
4285
-          console.log("scheduls", scheduls);
4322
+          // console.log("scheduls", scheduls);
4286 4323
           this.schedulStatus = 1;
4287
-          console.log("sch22", this.schedulStatus);
4324
+          // console.log("sch22", this.schedulStatus);
4288 4325
         }
4289 4326
         if (response.data.state === 0) {
4290 4327
           this.schedulStatus = 2;
4291
-          console.log("sch23", this.schedulStatus);
4328
+          // console.log("sch23", this.schedulStatus);
4292 4329
         }
4293 4330
       });
4294 4331
     },
@@ -4305,6 +4342,34 @@ export default {
4305 4342
     handleSizeChange(limit) {
4306 4343
       this.listQuery.limit = limit;
4307 4344
       this.getList();
4345
+    },
4346
+
4347
+    getSelfMedicalList(id){
4348
+        const params = {
4349
+          patient_id:id
4350
+        }
4351
+      getSelfMedicalList(params).then(response=>{
4352
+         if(response.data.state == 1){
4353
+            var medicalList =  response.data.data.medicalList
4354
+            for(let i=0;i<medicalList.length;i++){
4355
+               medicalList[i].drug_name = medicalList[i].drug_name+"(自备药)"
4356
+            }
4357
+            this.medicals = medicalList
4358
+         }
4359
+      })
4360
+    },
4361
+    changeDrugName(name){
4362
+      var arr = name.split("(自备药)");
4363
+        const params = {
4364
+          drug_name:arr[0],
4365
+          patient_id:this.$route.params && this.$route.params.id
4366
+        }
4367
+      getDrugDescByDrugName(params).then(response=>{
4368
+          if(response.data.state == 1){
4369
+             var drugspec = response.data.data.drugspec
4370
+             this.drugSpec = drugspec
4371
+          }
4372
+      })
4308 4373
     }
4309 4374
   },
4310 4375
   watch: {
@@ -4336,7 +4401,6 @@ export default {
4336 4401
   },
4337 4402
   created() {
4338 4403
     const id = this.$route.params && this.$route.params.id;
4339
-    console.log("病人id", id);
4340 4404
     this.patientID = parseInt(id);
4341 4405
     if (isNaN(this.patientID) || this.patientID <= 0) {
4342 4406
       this.$notify.error({
@@ -4387,6 +4451,9 @@ export default {
4387 4451
     this.unitsOption = getDataConfig("hemodialysis", "units");
4388 4452
     //查询该病人是否有排班记录
4389 4453
     this.getPatientSchedules(id);
4454
+
4455
+
4456
+    this.getSelfMedicalList(id)
4390 4457
   }
4391 4458
 };
4392 4459
 </script>