|
@@ -0,0 +1,436 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="main-contain">
|
|
3
|
+ <div class="position">
|
|
4
|
+ <bread-crumb :crumbs="crumbs"></bread-crumb>
|
|
5
|
+ </div>
|
|
6
|
+
|
|
7
|
+ <div class="app-container">
|
|
8
|
+ <div class="cell clearfix" style="margin-bottom:0px;">
|
|
9
|
+ <el-date-picker
|
|
10
|
+ v-model="start_time"
|
|
11
|
+ prefix-icon="el-icon-date"
|
|
12
|
+ :editable="false"
|
|
13
|
+ style="width: 160px;margin-right:10px;"
|
|
14
|
+ type="date"
|
|
15
|
+ placeholder="选择日期时间"
|
|
16
|
+ align="right"
|
|
17
|
+ format="yyyy-MM-dd"
|
|
18
|
+ value-format="yyyy-MM-dd"
|
|
19
|
+ @change="changeStartime"
|
|
20
|
+ ></el-date-picker>
|
|
21
|
+ -
|
|
22
|
+ <el-date-picker
|
|
23
|
+ v-model="end_time"
|
|
24
|
+ prefix-icon="el-icon-date"
|
|
25
|
+ :editable="false"
|
|
26
|
+ style="width: 160px;margin-right:10px;"
|
|
27
|
+ type="date"
|
|
28
|
+ placeholder="选择日期时间"
|
|
29
|
+ align="right"
|
|
30
|
+ format="yyyy-MM-dd"
|
|
31
|
+ value-format="yyyy-MM-dd"
|
|
32
|
+ @change="changeEndtime"
|
|
33
|
+ ></el-date-picker>
|
|
34
|
+ <el-autocomplete
|
|
35
|
+ style="margin:16px 5px"
|
|
36
|
+ popper-class="my-autocomplete"
|
|
37
|
+ v-model.trim="search_input"
|
|
38
|
+ :fetch-suggestions="querySearchAsync"
|
|
39
|
+ :trigger-on-focus="false"
|
|
40
|
+ placeholder="病人名字或者透析号"
|
|
41
|
+ @select="handleSelect"
|
|
42
|
+ >
|
|
43
|
+ <i class="el-icon-search el-input__icon" slot="suffix"> </i>
|
|
44
|
+ <template slot-scope="{ item }">
|
|
45
|
+ <div class="name">{{ item.name }}</div>
|
|
46
|
+ </template>
|
|
47
|
+ </el-autocomplete>
|
|
48
|
+ <el-button type="primary" @click="toSeachPatient">搜索</el-button>
|
|
49
|
+ </div>
|
|
50
|
+ <el-container>
|
|
51
|
+ <div style="width:160px;">
|
|
52
|
+ <div class="tablesTitle">患者列表</div>
|
|
53
|
+ <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
|
|
54
|
+ @current-change="handleCurrentChange" ref="monthlyPlanTable"
|
|
55
|
+ >
|
|
56
|
+ <el-table-column align="center" prop="dialysis_no" label="透析号" width="70">
|
|
57
|
+ <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
|
|
58
|
+ </el-table-column>
|
|
59
|
+ <el-table-column align="center" prop="name" label="姓名" width="90">
|
|
60
|
+ <template slot-scope="scope">{{ scope.row.name }}</template>
|
|
61
|
+ </el-table-column>
|
|
62
|
+ </el-table>
|
|
63
|
+ </div>
|
|
64
|
+ <div style="flex:1;margin-left:20px;">
|
|
65
|
+ <!-- <div style="display:flex;justify-content: space-between;align-items: center;">
|
|
66
|
+ <div class="tablesTitle">自备药列表</div>
|
|
67
|
+ <div>
|
|
68
|
+
|
|
69
|
+ <el-button type="primary" size="mini" @click="openForm(2)">打印</el-button>
|
|
70
|
+ <el-button type="primary" size="mini" @click="openForm(3)">出库</el-button>
|
|
71
|
+ </div>
|
|
72
|
+ </div> -->
|
|
73
|
+ <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>
|
|
74
|
+ <el-table-column align="center" prop="dialysis_no" label="药品名称">
|
|
75
|
+ <template slot-scope="scope">
|
|
76
|
+ {{ scope.row.advice_name }}
|
|
77
|
+ </template>
|
|
78
|
+ </el-table-column>
|
|
79
|
+ <el-table-column align="center" prop="name" label="规格名称">
|
|
80
|
+ <template slot-scope="scope">{{ scope.row.specification_name }}</template>
|
|
81
|
+ </el-table-column>
|
|
82
|
+
|
|
83
|
+ <el-table-column align="center" prop="name" label="开药数量">
|
|
84
|
+ <template slot-scope="scope">
|
|
85
|
+ {{getTotal(scope.row.child)}}
|
|
86
|
+ </template>
|
|
87
|
+ </el-table-column>
|
|
88
|
+ <el-table-column align="center" prop="dialysis_no" label="单位">
|
|
89
|
+ <template slot-scope="scope">{{scope.row.prescribing_number_unit}}</template>
|
|
90
|
+ </el-table-column>
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+ <el-table-column align="center" prop="name" label="操作">
|
|
94
|
+ <template slot-scope="scope">
|
|
95
|
+ <el-button size="mini" type="primary" @click="toDetail(scope.row.advice_name,scope.row.patient_id)">明细</el-button>
|
|
96
|
+ </template>
|
|
97
|
+ </el-table-column>
|
|
98
|
+ </el-table>
|
|
99
|
+ </div>
|
|
100
|
+ </el-container>
|
|
101
|
+ </div>
|
|
102
|
+
|
|
103
|
+ <el-dialog
|
|
104
|
+ title="使用详情"
|
|
105
|
+ :visible.sync="adviceDialogVisible"
|
|
106
|
+ width="50%">
|
|
107
|
+ <span>
|
|
108
|
+ <el-table :data="tableList" border style="width: 100%;" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
|
|
109
|
+ <el-table-column align="center" prop="dialysis_no" label="患者姓名">
|
|
110
|
+ <template slot-scope="scope">
|
|
111
|
+ {{getPatientName(scope.row.patient_id)}}
|
|
112
|
+ </template>
|
|
113
|
+ </el-table-column>
|
|
114
|
+ <el-table-column align="center" prop="name" label="使用时间">
|
|
115
|
+ <template slot-scope="scope">{{getTime(scope.row.advice_date)}}</template>
|
|
116
|
+ </el-table-column>
|
|
117
|
+
|
|
118
|
+ <el-table-column align="center" prop="name" label="开药数量">
|
|
119
|
+ <template slot-scope="scope">
|
|
120
|
+ {{scope.row.prescribing_number}}
|
|
121
|
+ </template>
|
|
122
|
+ </el-table-column>
|
|
123
|
+ <el-table-column align="center" prop="dialysis_no" label="单位">
|
|
124
|
+ <template slot-scope="scope">{{scope.row.prescribing_number_unit}}</template>
|
|
125
|
+ </el-table-column>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+ </el-table>
|
|
129
|
+ </span>
|
|
130
|
+ <span slot="footer" class="dialog-footer">
|
|
131
|
+ <el-button @click="adviceDialogVisible = false">取 消</el-button>
|
|
132
|
+ <el-button type="primary" @click="adviceDialogVisible = false">确 定</el-button>
|
|
133
|
+ </span>
|
|
134
|
+ </el-dialog>
|
|
135
|
+ </div>
|
|
136
|
+</template>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+<script>
|
|
140
|
+
|
|
141
|
+import BreadCrumb from "@/xt_pages/components/bread-crumb";
|
|
142
|
+const moment = require('moment')
|
|
143
|
+import { PostSearch } from '@/api/patient'
|
|
144
|
+import { getCurrentPatient,saveRadio,getPatientAdviceList,DeleteDrugNameById,getDrugSet,getPatientDetail,getPatientAdviceListDetail} from "@/api/drug/drug"
|
|
145
|
+import { TimeSelect } from "element-ui";
|
|
146
|
+import { uParseTime } from '@/utils/tools'
|
|
147
|
+export default {
|
|
148
|
+ components:{
|
|
149
|
+ BreadCrumb,
|
|
150
|
+ },
|
|
151
|
+ data(){
|
|
152
|
+ return{
|
|
153
|
+ crumbs: [
|
|
154
|
+ { path: false, name: "库存管理" },
|
|
155
|
+ { path: false, name: "自备药管理" },
|
|
156
|
+ { path: false, name: "自备药管理" },
|
|
157
|
+ ],
|
|
158
|
+ value: '',
|
|
159
|
+ tableData:[],
|
|
160
|
+ dialogVisible:false,
|
|
161
|
+ radio:'2',
|
|
162
|
+ tablePatient:[],
|
|
163
|
+ disableBtton:false,
|
|
164
|
+ currentRow: null,
|
|
165
|
+ patient_name:"",
|
|
166
|
+ patient_id:"",
|
|
167
|
+ start_time:moment().startOf('month').format('YYYY-MM-DD'),
|
|
168
|
+ end_time:moment().endOf('month').format('YYYY-MM-DD'),
|
|
169
|
+ search_input:"",
|
|
170
|
+ patient_id:0,
|
|
171
|
+ stockList:[],
|
|
172
|
+ outStocklist:[],
|
|
173
|
+ outList:[],
|
|
174
|
+ tableList:[],
|
|
175
|
+ adviceDialogVisible:false
|
|
176
|
+ }
|
|
177
|
+ },
|
|
178
|
+ methods:{
|
|
179
|
+ setting(){
|
|
180
|
+ this.dialogVisible = true
|
|
181
|
+ },
|
|
182
|
+ handleCurrentChange(val){
|
|
183
|
+ this.currentRow = val
|
|
184
|
+ this.patient_name = val.name
|
|
185
|
+ this.patient_id = val.id
|
|
186
|
+ if(val.name !=""){
|
|
187
|
+ this.disableBtton = true
|
|
188
|
+ }
|
|
189
|
+
|
|
190
|
+ this.getlist()
|
|
191
|
+ },
|
|
192
|
+ changeStartime(){
|
|
193
|
+ this.getlist()
|
|
194
|
+ },
|
|
195
|
+ changeEndtime(){
|
|
196
|
+ this.getlist()
|
|
197
|
+ },
|
|
198
|
+ handleClose(){
|
|
199
|
+ this.dialogVisible = false
|
|
200
|
+ },
|
|
201
|
+ openForm(index){
|
|
202
|
+ if(index == 1){
|
|
203
|
+ if(this.disableBtton == true){
|
|
204
|
+ this.$refs.addMedicine.show(this.patient_name,this.patient_id);
|
|
205
|
+ }
|
|
206
|
+ if(this.disableBtton == false){
|
|
207
|
+ this.$message.error("请选择患者!")
|
|
208
|
+ }
|
|
209
|
+ }else if(index == 2){
|
|
210
|
+ this.$refs.warehousing.show(this.patient_name,this.patient_id);
|
|
211
|
+ }else if(index == 3){
|
|
212
|
+ this.$refs.warehouseOut.show(this.patient_name,this.patient_id);
|
|
213
|
+ }
|
|
214
|
+
|
|
215
|
+ },
|
|
216
|
+ toDetail(advice_name,patientid){
|
|
217
|
+ var params = {
|
|
218
|
+ advice_name:advice_name,
|
|
219
|
+ patient_id:patientid,
|
|
220
|
+ start_time:this.start_time,
|
|
221
|
+ end_time:this.end_time
|
|
222
|
+ }
|
|
223
|
+ getPatientAdviceListDetail(params).then(response=>{
|
|
224
|
+ if(response.data.state == 1){
|
|
225
|
+ var advicelist = response.data.data.adviceList
|
|
226
|
+ this.tableList = []
|
|
227
|
+ this.tableList = advicelist
|
|
228
|
+ console.log("hhhhhhhhhhhhhhhhhhhhhhh",this.tableList)
|
|
229
|
+ this.adviceDialogVisible = true
|
|
230
|
+ }
|
|
231
|
+ })
|
|
232
|
+ },
|
|
233
|
+
|
|
234
|
+ getCurrentPatient(){
|
|
235
|
+ getCurrentPatient().then(response=>{
|
|
236
|
+ if(response.data.state == 1){
|
|
237
|
+ this.tablePatient = response.data.data.patient
|
|
238
|
+ }
|
|
239
|
+ })
|
|
240
|
+ },
|
|
241
|
+ searchAction(){
|
|
242
|
+ this.patient_id = 0
|
|
243
|
+ this.getlist()
|
|
244
|
+ },
|
|
245
|
+ saveRadio(){
|
|
246
|
+ const params = {
|
|
247
|
+ radio:this.radio
|
|
248
|
+ }
|
|
249
|
+ saveRadio(params).then(response=>{
|
|
250
|
+ if(response.data.state == 1){
|
|
251
|
+ var drugset = response.data.data.drugSet
|
|
252
|
+ this.$message.success("保存成功")
|
|
253
|
+ this.dialogVisible = false
|
|
254
|
+ }
|
|
255
|
+ })
|
|
256
|
+ },
|
|
257
|
+ getlist(){
|
|
258
|
+ const params = {
|
|
259
|
+ patient_id:this.patient_id,
|
|
260
|
+ start_time:this.start_time,
|
|
261
|
+ end_time:this.end_time,
|
|
262
|
+ keyword:this.search_input,
|
|
263
|
+ }
|
|
264
|
+
|
|
265
|
+ getPatientAdviceList(params).then(response=>{
|
|
266
|
+ if(response.data.state == 1){
|
|
267
|
+
|
|
268
|
+ var advicelist = response.data.data.adviceList
|
|
269
|
+
|
|
270
|
+ if(advicelist!=null && advicelist.length>0){
|
|
271
|
+ let dataInfo = {}
|
|
272
|
+ advicelist.forEach((item, index) => {
|
|
273
|
+ let { advice_name } = item
|
|
274
|
+ if (!dataInfo[advice_name]) {
|
|
275
|
+ dataInfo[advice_name] = {
|
|
276
|
+ advice_name:item.advice_name.replace(/\s+/g, ''),
|
|
277
|
+ child: [],
|
|
278
|
+ count:0,
|
|
279
|
+ drug_id:item.drug_id,
|
|
280
|
+ specification_name:item.advice_desc +item.drug_spec_unit,
|
|
281
|
+ patient_id:item.patient_id,
|
|
282
|
+ prescribing_number_unit:item.prescribing_number_unit,
|
|
283
|
+ }
|
|
284
|
+ }
|
|
285
|
+ })
|
|
286
|
+ let arr = Object.values(dataInfo)
|
|
287
|
+ console.log("new_ar=====================",arr)
|
|
288
|
+ for(let i=0;i<arr.length;i++){
|
|
289
|
+ for(let j=0;j<advicelist.length;j++){
|
|
290
|
+ if(arr[i].advice_name == advicelist[j].advice_name){
|
|
291
|
+ arr[i].child.push(advicelist[j])
|
|
292
|
+ }
|
|
293
|
+ }
|
|
294
|
+ }
|
|
295
|
+ this.tableData = []
|
|
296
|
+ this.tableData = arr
|
|
297
|
+ }
|
|
298
|
+
|
|
299
|
+ }
|
|
300
|
+ })
|
|
301
|
+ },
|
|
302
|
+
|
|
303
|
+ getCount(patientid,drugname,drugspec){
|
|
304
|
+ var total = 0
|
|
305
|
+ for(let i=0;i<this.outStocklist.length;i++){
|
|
306
|
+ if(patientid == this.outStocklist[i].patient_id && drugname == this.outStocklist[i].drug_name && drugspec == this.outStocklist[i].drug_spec){
|
|
307
|
+ total = this.outStocklist[i].Count
|
|
308
|
+ }
|
|
309
|
+ }
|
|
310
|
+ return total
|
|
311
|
+ },
|
|
312
|
+
|
|
313
|
+ getCountTwo(patientid,drugname,drugspec){
|
|
314
|
+ var total = 0
|
|
315
|
+ for(let i=0;i<this.outList.length;i++){
|
|
316
|
+ if(patientid == this.outList[i].patient_id && drugname == this.outList[i].drug_name && drugspec == this.outList[i].drug_spec){
|
|
317
|
+ total += this.outList[i].outstore_number
|
|
318
|
+ }
|
|
319
|
+ }
|
|
320
|
+ return total
|
|
321
|
+ },
|
|
322
|
+
|
|
323
|
+ getDrugSet(){
|
|
324
|
+ getDrugSet().then(response=>{
|
|
325
|
+ if(response.data.state == 1){
|
|
326
|
+ var drugset = response.data.data.drugSet
|
|
327
|
+ this.radio = drugset.drug_start.toString()
|
|
328
|
+ }
|
|
329
|
+ })
|
|
330
|
+ },
|
|
331
|
+
|
|
332
|
+ getTotal(val){
|
|
333
|
+ var total = 0
|
|
334
|
+ for(let i=0;i<val.length;i++){
|
|
335
|
+ total += val[i].prescribing_number
|
|
336
|
+ }
|
|
337
|
+ return total
|
|
338
|
+ },
|
|
339
|
+ getRemarks(patientid,id){
|
|
340
|
+ var remarks = ""
|
|
341
|
+ for(let i=0;i<this.stockList.length;i++){
|
|
342
|
+ if(patientid == this.stockList[i].patient_id && id == this.stockList[i].medic_id){
|
|
343
|
+ remarks = this.stockList[i].remarks
|
|
344
|
+ }
|
|
345
|
+ }
|
|
346
|
+ return remarks
|
|
347
|
+ },
|
|
348
|
+
|
|
349
|
+ querySearchAsync(keyword, cb) {
|
|
350
|
+ let key = ''
|
|
351
|
+ if (keyword != undefined) {
|
|
352
|
+ key = keyword
|
|
353
|
+ }
|
|
354
|
+ let searchArray = []
|
|
355
|
+ console.log("key",key)
|
|
356
|
+ PostSearch(key).then(response => {
|
|
357
|
+ if (response.data.state == 1) {
|
|
358
|
+ searchArray = response.data.data.patient
|
|
359
|
+ console.log("searchArray",searchArray)
|
|
360
|
+
|
|
361
|
+ cb(searchArray)
|
|
362
|
+ }
|
|
363
|
+ })
|
|
364
|
+ return searchArray
|
|
365
|
+ },
|
|
366
|
+ handleSelect(val){
|
|
367
|
+ this.search_input = val.name
|
|
368
|
+ for(let i=0;i<this.tablePatient.length;i++){
|
|
369
|
+ if(this.tablePatient[i].id == val.id){
|
|
370
|
+ this.$refs.monthlyPlanTable.setCurrentRow(this.tablePatient[i])
|
|
371
|
+ }
|
|
372
|
+ }
|
|
373
|
+ this.getlist()
|
|
374
|
+ this.getPatientDetail(val.id)
|
|
375
|
+ },
|
|
376
|
+
|
|
377
|
+ getPatientDetail(id){
|
|
378
|
+ getPatientDetail(id).then(response=>{
|
|
379
|
+ if(response.data.state == 1){
|
|
380
|
+ var patientDetail = response.data.data.patientDetail
|
|
381
|
+ console.log("patientDetail",patientDetail)
|
|
382
|
+ var arr = []
|
|
383
|
+ arr.push(patientDetail)
|
|
384
|
+ this.tablePatient = arr
|
|
385
|
+ }
|
|
386
|
+ })
|
|
387
|
+ },
|
|
388
|
+ toSeachPatient(){
|
|
389
|
+ this.getCurrentPatient()
|
|
390
|
+ },
|
|
391
|
+ getPatientName(id){
|
|
392
|
+ var name = ""
|
|
393
|
+ for(let i=0;i<this.tablePatient.length;i++){
|
|
394
|
+ if(id == this.tablePatient[i].id){
|
|
395
|
+ name = this.tablePatient[i].name
|
|
396
|
+ }
|
|
397
|
+ }
|
|
398
|
+ return name
|
|
399
|
+ },
|
|
400
|
+ getTime(val) {
|
|
401
|
+ if(val < 0){
|
|
402
|
+ return ""
|
|
403
|
+ }
|
|
404
|
+ if(val == ""){
|
|
405
|
+ return ""
|
|
406
|
+ }else {
|
|
407
|
+ return uParseTime(val, '{y}-{m}-{d}')
|
|
408
|
+ }
|
|
409
|
+ },
|
|
410
|
+
|
|
411
|
+ },
|
|
412
|
+ created(){
|
|
413
|
+ //获取当前机构下的所有患者
|
|
414
|
+ this.getCurrentPatient()
|
|
415
|
+ this.getDrugSet()
|
|
416
|
+ },
|
|
417
|
+ watch: {
|
|
418
|
+ tablePatient: function() {
|
|
419
|
+ this.$nextTick(function() {
|
|
420
|
+ this.$refs.monthlyPlanTable.setCurrentRow(this.tablePatient[0])
|
|
421
|
+ })
|
|
422
|
+ }
|
|
423
|
+ },
|
|
424
|
+}
|
|
425
|
+</script>
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+<style lang="scss" scoped>
|
|
429
|
+.tablesTitle{
|
|
430
|
+ font-size: 16px;
|
|
431
|
+ color: #000;
|
|
432
|
+ font-weight: bold;
|
|
433
|
+ height: 40px;
|
|
434
|
+ line-height: 40px;
|
|
435
|
+}
|
|
436
|
+</style>
|