瀏覽代碼

Merge branch '20200710_pc_vue_new_branch' into 20200916_pc_vue_new_branch

csx 4 年之前
父節點
當前提交
cfef4e6b1a

+ 30 - 0
src/api/his/his.js 查看文件

80
 }
80
 }
81
 
81
 
82
 
82
 
83
+export function delHisPrescription(params) {
84
+  return request({
85
+    url: "/api/hisprescription/delete",
86
+    method: "post",
87
+    params:params,
88
+  });
89
+}
90
+
91
+export function delHisAdvice(params) {
92
+  return request({
93
+    url: "/api/advice/delete",
94
+    method: "post",
95
+    params:params,
96
+  });
97
+}
98
+
99
+export function delHisProject(params) {
100
+  return request({
101
+    url: "/api/project/delete",
102
+    method: "post",
103
+    params:params,
104
+  });
105
+}
106
+
107
+
108
+
109
+
110
+
111
+
112
+
83
 
113
 
84
 
114
 
85
 
115
 

+ 261 - 178
src/xt_pages/outpatientCharges/outpatientChargesManagement.vue 查看文件

5
         </div>
5
         </div>
6
         <div class="app-container" style="display:flex;flex: 1;padding: 20px 20px 0px 20px;">
6
         <div class="app-container" style="display:flex;flex: 1;padding: 20px 20px 0px 20px;">
7
             <div class="mainLeft">
7
             <div class="mainLeft">
8
-                <div class="mainCell" style="justify-content: space-between;">
9
-                    <p>未就诊:<span>1</span>人</p>
10
-                    <p>已就诊:<span>0</span>人</p>
11
-                </div>
12
-                <div class="mainCell">
13
-                    <el-radio-group v-model="radio" @change="changeRadio">
14
-                        <el-radio :label=1>未就诊</el-radio>
15
-                        <el-radio :label=2>已就诊</el-radio>
16
-                        <el-radio :label=3>全部</el-radio>
17
-                    </el-radio-group>
18
-                </div>
8
+                <!--<div class="mainCell" style="justify-content: space-between;">-->
9
+                    <!--<p>未就诊:<span>1</span>人</p>-->
10
+                    <!--<p>已就诊:<span>0</span>人</p>-->
11
+                <!--</div>-->
12
+                <!--<div class="mainCell">-->
13
+                    <!--<el-radio-group v-model="radio" @change="changeRadio">-->
14
+                        <!--<el-radio :label=1>未就诊</el-radio>-->
15
+                        <!--<el-radio :label=2>已就诊</el-radio>-->
16
+                        <!--<el-radio :label=3>全部</el-radio>-->
17
+                    <!--</el-radio-group>-->
18
+                <!--</div>-->
19
                 <div class="mainCell" style="margin-bottom:10px;">
19
                 <div class="mainCell" style="margin-bottom:10px;">
20
                     <el-input size="small" @keyup.enter.native='searchAction' v-model.trim="search_input" class="filter-item"/>
20
                     <el-input size="small" @keyup.enter.native='searchAction' v-model.trim="search_input" class="filter-item"/>
21
                     <el-button size="small" style="margin-left:10px;" class="filter-item" type="primary" @click="searchAction">搜索</el-button>
21
                     <el-button size="small" style="margin-left:10px;" class="filter-item" type="primary" @click="searchAction">搜索</el-button>
22
                 </div>
22
                 </div>
23
-                <div style="flex:1;overflow-y:auto;">
24
-                    <el-table :data="tableData" border  style="width: 100%;" :row-style="{ color: '#303133' }" 
25
-                    :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" 
26
-                    highlight-current-row ref="tab"
27
-                    @current-change="handleCurrentChange">
28
-                        <el-table-column align="center" prop="name" label="患者姓名">
29
-                            <template slot-scope="scope">{{ scope.row.name }}</template>
30
-                        </el-table-column>
31
-                        <el-table-column align="center" prop="name" label="就诊号" width="90">
32
-                            <template slot-scope="scope">3222</template>
33
-                        </el-table-column>
34
-                    </el-table>
35
-                </div>
23
+              <div style="flex:1;overflow-y:auto;">
24
+                <el-table :data="patientTableData" border style="width: 100%;" :row-style="{ color: '#303133' }"
25
+                          :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
26
+                          highlight-current-row ref="tab"
27
+                          @current-change="handleCurrentChange">
28
+                  <el-table-column align="center" prop="name" label="患者姓名">
29
+                    <template slot-scope="scope">{{ scope.row.patients.name }}</template>
30
+                  </el-table-column>
31
+                  <el-table-column align="center" prop="name" label="就诊号" width="90">
32
+                    <template slot-scope="scope">{{ scope.row.his_patient.number }}</template>
33
+                  </el-table-column>
34
+                </el-table>
35
+              </div>
36
             </div>
36
             </div>
37
             <div class="mainRight">
37
             <div class="mainRight">
38
-                 
39
-                <div class="mainCell" style="position: absolute;right: 30px;z-index:9;">
40
-                    <el-button size="small" @click="open(1)" type="primary" style="margin-left:10px;">打印处置单</el-button>
41
-                    <el-button size="small" @click="open(2)" type="primary">打印治疗单</el-button>
42
-                    <el-button size="small" @click="open(3)" type="primary">打印</el-button>
43
-                    <el-button size="small" @click="open(4)" type="primary">收费</el-button>
44
-                    <el-button size="small" v-if="state == '已收费'" @click="open(5)" type="primary">退费</el-button>
45
-                </div>
38
+
39
+              <div class="mainCell" style="margin-bottom:10px;flex-direction: row-reverse;">
40
+                <el-button size="small" @click="open(1)" type="primary" style="margin-left:10px;">打印处置单</el-button>
41
+                <el-button size="small" @click="open(2)" type="primary">打印治疗单</el-button>
42
+                <el-button size="small" @click="open(3)" type="primary">打印</el-button>
43
+                <el-button v-loading="loadingone" v-if="hisPatientInfo == null || hisPatientInfo.id == 0 " size="small" @click="open(6)"
44
+                           type="primary">挂号
45
+                </el-button>
46
+                <el-button v-loading="loadingtwo" v-if="hisPatientInfo != null && hisPatientInfo.id > 0 " size="small" @click="open(4)"
47
+                           type="primary">收费
48
+                </el-button>
49
+                <el-button size="small" @click="open(5)" type="primary">退费</el-button>
50
+              </div>
51
+
46
                 <div class="mainCenter">
52
                 <div class="mainCenter">
47
                     <el-tabs class="settlementTabs" v-model="activeName" @tab-click="handleClick">
53
                     <el-tabs class="settlementTabs" v-model="activeName" @tab-click="handleClick">
48
                         <el-tab-pane label="日结" name="first">
54
                         <el-tab-pane label="日结" name="first">
49
                             <div style="display:flex;height:100%;">
55
                             <div style="display:flex;height:100%;">
50
                                 <div class="centerLeft">
56
                                 <div class="centerLeft">
51
                                     <div class="tabsBox">
57
                                     <div class="tabsBox">
52
-                                        <el-button type="text" class="addTab" @click="addCharges" icon="el-icon-circle-plus">附加收费</el-button>
53
-                                        <el-tabs class="preTabs" v-model="editableTabsValue" type="card" closable @tab-remove="removeTab" :before-leave="moreState">
58
+                                        <!--<el-button type="text" class="addTab" @click="addCharges" icon="el-icon-circle-plus">附加收费</el-button>-->
59
+                                        <el-tabs class="preTabs" v-model="editableTabsValue" type="card" closable >
54
                                             <el-tab-pane
60
                                             <el-tab-pane
55
-                                                v-for="(item, index) in editableTabs"
61
+                                                v-for="(item, index) in prescriptions"
56
                                                 :key="index"
62
                                                 :key="index"
57
                                                 :label="item.title"
63
                                                 :label="item.title"
58
                                                 :name="item.name"
64
                                                 :name="item.name"
65
                                                     placeholder="选择日期">
71
                                                     placeholder="选择日期">
66
                                                     </el-date-picker>
72
                                                     </el-date-picker>
67
                                                 </div>
73
                                                 </div>
68
-                                                <prescription-table :preTableData='preTableData'></prescription-table>
69
                                             </el-tab-pane>
74
                                             </el-tab-pane>
70
-                                            <el-tab-pane name="more" closable><span slot="label"><i class="el-icon-plus" @click="addTab"></i></span></el-tab-pane>
75
+                                          <prescription-table ref="prescription_tables" :prescription="curPrescriptions"></prescription-table>
71
                                         </el-tabs>
76
                                         </el-tabs>
72
-                                        
77
+
73
                                     </div>
78
                                     </div>
74
                                     <div class="costBox">
79
                                     <div class="costBox">
75
-                                        <span>处方编号:2134348971237883</span>
76
-                                        <span>当前处方总费用:<span style="color:red;">{{ total }}元</span></span>
77
-                                        <span>{{ state }}</span>
80
+                                      <span>当前处方总费用:<span style="color:red;">{{ getTotal() }}元</span></span>
81
+                                      <span>{{ state }}</span>
78
                                     </div>
82
                                     </div>
79
                                 </div>
83
                                 </div>
80
                                 <div class="centerRight">
84
                                 <div class="centerRight">
81
                                     <p class="centerRightTitle">人员信息</p>
85
                                     <p class="centerRightTitle">人员信息</p>
82
                                     <div style="display:flex;justify-content: space-between;line-height:30px;">
86
                                     <div style="display:flex;justify-content: space-between;line-height:30px;">
83
                                         <span style="font-size:14px;">人员编码:</span>
87
                                         <span style="font-size:14px;">人员编码:</span>
84
-                                        <span style="font-size:14px;">日期:{{start_time}}</span>
88
+                                        <span style="font-size:14px;">日期:{{record_date}}</span>
85
                                     </div>
89
                                     </div>
86
                                     <ul class="basicUl">
90
                                     <ul class="basicUl">
87
-                                        <li style="width:50%;">姓名:{{ patientInfo.name }}</li>
88
-                                        <li style="width:50%;">性别:{{ patientInfo && patientInfo.gend == 1 ? '男' : "女" }}</li>
89
-                                        <li style="width:50%;">年龄:{{ patientInfo.age }}</li>
90
-                                        <li style="width:50%;">身高:</li>
91
-                                        <li style="width:50%;">体重:</li>
92
-                                        <li style="width:50%;">电话:</li>
93
-                                        <li style="width:100%;">地址:</li>
91
+                                      <li style="width:50%;">姓名:{{patientInfo.name}}</li>
92
+                                      <li style="width:50%;">性别:{{patientInfo.gender == 1 ? '男' : '女' }}</li>
93
+                                      <li style="width:50%;">年龄:{{patientInfo.age }}</li>
94
+                                      <li style="width:50%;">身高:{{patientInfo.height}}</li>
95
+                                      <li style="width:50%;">体重:{{patientInfo.weight}}</li>
96
+                                      <li style="width:50%;">电话:{{patientInfo.phone}}</li>
97
+                                      <li style="width:100%;">地址:{{patientInfo.home_address}}</li>
94
                                         <li style="width:100%;">过敏史:</li>
98
                                         <li style="width:100%;">过敏史:</li>
95
                                     </ul>
99
                                     </ul>
96
                                     <p class="centerRightTitle">诊断信息</p>
100
                                     <p class="centerRightTitle">诊断信息</p>
112
                             <div style="display:flex;height:100%;">
116
                             <div style="display:flex;height:100%;">
113
                                 <div class="centerLeft">
117
                                 <div class="centerLeft">
114
                                     <div class="tabsBox">
118
                                     <div class="tabsBox">
115
-                                        <el-button type="text" class="addTab" @click="addCharges" icon="el-icon-circle-plus">附加收费</el-button>
116
-                                        <el-tabs class="preTabs" v-model="editableTabsValue" type="card" closable @tab-remove="removeTab" :before-leave="moreState">
119
+                                        <!--<el-button type="text" class="addTab" @click="addCharges" icon="el-icon-circle-plus">附加收费</el-button>-->
120
+                                        <el-tabs class="preTabs" v-model="editableTabsValue" type="card" closable>
117
                                             <el-tab-pane
121
                                             <el-tab-pane
118
                                                 v-for="(item, index) in editableTabs"
122
                                                 v-for="(item, index) in editableTabs"
119
                                                 :key="index"
123
                                                 :key="index"
129
                                                     range-separator="至"
133
                                                     range-separator="至"
130
                                                     start-placeholder="开始日期"
134
                                                     start-placeholder="开始日期"
131
                                                     end-placeholder="结束日期">
135
                                                     end-placeholder="结束日期">
132
-                                                    </el-date-picker> 
136
+                                                    </el-date-picker>
133
                                                 </div>
137
                                                 </div>
134
                                                 <prescription-table :preTableData='preTableData'></prescription-table>
138
                                                 <prescription-table :preTableData='preTableData'></prescription-table>
135
                                             </el-tab-pane>
139
                                             </el-tab-pane>
136
-                                            <el-tab-pane name="more" closable><span slot="label"><i class="el-icon-plus" @click="addTab"></i></span></el-tab-pane>
140
+                                            <!--<el-tab-pane name="more" closable><span slot="label"><i class="el-icon-plus" @click="addTab"></i></span></el-tab-pane>-->
137
                                         </el-tabs>
141
                                         </el-tabs>
138
-                                        
142
+
139
                                     </div>
143
                                     </div>
140
                                     <div class="costBox">
144
                                     <div class="costBox">
141
                                         <span>处方编号:2134348971237883</span>
145
                                         <span>处方编号:2134348971237883</span>
175
                             </div>
179
                             </div>
176
                         </el-tab-pane>
180
                         </el-tab-pane>
177
                     </el-tabs>
181
                     </el-tabs>
178
-                    
179
-                    
182
+
183
+
180
                 </div>
184
                 </div>
181
             </div>
185
             </div>
182
         </div>
186
         </div>
183
-        <additionalCharges ref='additionalCharges'></additionalCharges>
187
+        <!--<additionalCharges ref='additionalCharges'></additionalCharges>-->
184
     </div>
188
     </div>
185
 </template>
189
 </template>
186
 
190
 
193
 import prescriptionTable from './components/prescriptionTable'
197
 import prescriptionTable from './components/prescriptionTable'
194
 import additionalCharges from './components/additionalCharges'
198
 import additionalCharges from './components/additionalCharges'
195
 import { getPatientList,getPatientInformation } from "@/api/project/project"
199
 import { getPatientList,getPatientInformation } from "@/api/project/project"
200
+import { getPatientInfo, getSchedulePatientList, register,upload } from '@/api/his/his'
201
+
196
 const moment = require('moment')
202
 const moment = require('moment')
197
 export default {
203
 export default {
198
     components:{
204
     components:{
205
     },
211
     },
206
     data(){
212
     data(){
207
         return{
213
         return{
208
-            crumbs: [
209
-                { path: false, name: '门诊收费' },
210
-                { path: false, name: '门诊收费管理' }
211
-            ],
212
-            tableData: [],
213
-            activeName:'first',
214
-            editableTabsValue: '1',
215
-            editableTabs: [{
214
+          crumbs: [
215
+            { path: false, name: '门诊收费' },
216
+            { path: false, name: '门诊收费管理' }
217
+          ],
218
+          activeName:"",
219
+          curPrescriptions: {},
220
+          prescriptions: [],
221
+          record_date: '',
222
+          tableData: [],
223
+          editableTabsValue: '1',
224
+          loadingone:false,
225
+          editableTabs: [{
216
             title: '处方1',
226
             title: '处方1',
217
-            name: '1',
218
-            }],
219
-            tabIndex: 1,
220
-
221
-            patientTableData:[{
222
-                name:'杨美英',
223
-                mdtrt_id:"1709946",
224
-            }],
225
-            patientInfo:{},
226
-            doctor:{},
227
-            total:0,
228
-            state:'未收费',
229
-            radio:1,
230
-            radioStatus:1,
231
-            search_input:"",
232
-            start_time:moment().locale('zh-cn').format('YYYY-MM-DD')
227
+            name: '1'
228
+          }],
229
+          tabIndex: 1,
230
+          hisPatientInfo: {},
231
+          loadingtwo:false,
232
+          patientTableData: [{
233
+            name: '杨美英',
234
+            mdtrt_id: '1709946'
235
+          }],
236
+          patientInfo: { id: 0 },
237
+          doctor: {},
238
+          total: 0,
239
+          state: '未收费',
240
+          radio: 1,
241
+          radioStatus: 1,
242
+          search_input: '',
243
+          start_time: moment().locale('zh-cn').format('YYYY-MM-DD')
233
         }
244
         }
234
     },
245
     },
235
     created(){
246
     created(){
236
-       
237
-       //获取患者信息
238
-       this.getPatientList()
247
+      var nowDate = new Date()
248
+      var nowYear = nowDate.getFullYear()
249
+      var nowMonth = nowDate.getMonth() + 1
250
+      var nowDay = nowDate.getDate()
251
+      this.record_date =
252
+        nowYear +
253
+        '-' +
254
+        (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
255
+        '-' +
256
+        (nowDay < 10 ? '0' + nowDay : nowDay)
257
+
258
+      //获取患者信息
259
+      this.getPatientList()
239
     },
260
     },
240
     methods:{
261
     methods:{
262
+      handleClick(){
263
+
264
+      },
265
+      searchAction(){
266
+
267
+
268
+      },
269
+      tabclickEvent(val) {
270
+        for (let i = 0; i < this.prescriptions.length; i++) {
271
+          if (this.prescriptions[i].name == val.name) {
272
+            this.curPrescriptions = {}
273
+            var temp = this.deepClone(this.prescriptions[i])
274
+            this.curPrescriptions = temp
275
+            console.log(this.curPrescriptions)
276
+          }
277
+        }
278
+      }, deepClone(source) {
279
+        if (!source && typeof source !== 'object') {
280
+          throw new Error('error arguments', 'shallowClone')
281
+        }
282
+        const targetObj = source.constructor === Array ? [] : {}
283
+        Object.keys(source).forEach((keys) => {
284
+          if (source[keys] && typeof source[keys] === 'object') {
285
+            targetObj[keys] = this.deepClone(source[keys])
286
+          } else {
287
+            targetObj[keys] = source[keys]
288
+          }
289
+        })
290
+        return targetObj
291
+      },
292
+      getTotal() {
293
+        var total = 0
294
+        console.log(this.prescriptions)
295
+        for (let i = 0; i < this.prescriptions.length; i++) {
296
+          if (this.prescriptions[i].advices != null) {
297
+            for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
298
+              total = total + this.prescriptions[i].advices[a].price * this.prescriptions[i].advices[a].prescribing_number
299
+            }
300
+          }
301
+          if (this.prescriptions[i].project != null) {
302
+            for (let b = 0; b < this.prescriptions[i].project.length; b++) {
303
+              total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].count
304
+            }
305
+          }
306
+        }
307
+        return total
308
+      },
241
         moreState(tab, event){
309
         moreState(tab, event){
242
           if(tab == 'more'){
310
           if(tab == 'more'){
243
             return false;
311
             return false;
244
           }
312
           }
245
         },
313
         },
246
-        open(index){
247
-            if(index == 1){
248
-            }else if(index == 2){
249
-                this.$router.push('/outpatientCharges/print')
250
-            }else if(index == 3){
251
-                this.$router.push('/outpatientCharges/treatPrint')
252
-            }else if(index == 4){
253
-                this.state = '已收费'
254
-                this.$message({message: '收费成功',type: 'success'});
255
-            }else if(index == 5){
256
-                this.$message({message: '退费成功',type: 'success'});
314
+      open(index) {
315
+        if (index == 1) {
316
+        } else if (index == 2) {
317
+
318
+        } else if (index == 4) {
319
+
320
+          let params = {
321
+            'id': this.patientInfo.id,
322
+            'record_time': this.record_date
323
+          }
324
+          this.loadingtwo = true
325
+          upload(params).then(response => {
326
+            if (response.data.state == 0) {
327
+              this.$message.error(response.data.msg)
328
+              this.loadingtwo = false
329
+
330
+              return false
331
+
332
+            } else {
333
+              this.loadingtwo = false
334
+
257
             }
335
             }
258
-            
259
-        },
260
-        addTab(targetName) {
261
-            let newTabName = ++this.tabIndex + '';
262
-            this.editableTabs.push({
263
-                title: '处方' + this.tabIndex,
264
-                name: newTabName,
265
-            });
266
-            this.editableTabsValue = newTabName;
267
-        },
268
-        removeTab(targetName) {
269
-            let tabs = this.editableTabs;
270
-            let activeName = this.editableTabsValue;
271
-            if (activeName === targetName) {
272
-            tabs.forEach((tab, index) => {
273
-                if (tab.name === targetName) {
274
-                let nextTab = tabs[index + 1] || tabs[index - 1];
275
-                if (nextTab) {
276
-                    activeName = nextTab.name;
277
-                }
278
-                }
279
-            });
336
+          })
337
+
338
+          this.state = '已收费'
339
+          this.$message({ message: '收费成功', type: 'success' })
340
+        } else if (index == 5) {
341
+          this.$message({ message: '退费成功', type: 'success' })
342
+        } else if (index == 6) {
343
+
344
+          if (this.patientInfo.id == 0) {
345
+            this.$message.error('请先选择要挂号的病人')
346
+            return
347
+          }
348
+          let params = {
349
+            'id': this.patientInfo.id,
350
+            'record_time': this.record_date
351
+          }
352
+          this.loadingone = true
353
+          register(params).then(response => {
354
+            if (response.data.state == 0) {
355
+              this.$message.error(response.data.msg)
356
+              this.loadingone = false
357
+
358
+              return false
359
+
360
+            } else {
361
+              this.loadingone = false
362
+              var his_info = response.data.data.his_info
363
+              this.hisPatientInfo = his_info
280
             }
364
             }
281
-            
282
-            this.editableTabsValue = activeName;
283
-            this.editableTabs = tabs.filter(tab => tab.name !== targetName);
284
-        },
285
-        addCharges(){
286
-            this.$refs.additionalCharges.show()
287
-        },
365
+          })
366
+        }
367
+      },
368
+
369
+        // addCharges(){
370
+        //     this.$refs.additionalCharges.show()
371
+        // },
288
         choosePatient(){
372
         choosePatient(){
289
-            let a = JSON.parse(localStorage.getItem("drugs"))
290
-            this.preTableData = a
291
-            this.preTableData.map(item => {
292
-                this.total += item.unitPrice
293
-            })
294
-            // this.patientInfo = {
295
-            //     certno:"440221195903290027",
296
-            //     psn_no:"0221201972",
297
-            //     gend:"2",
298
-            //     brdy:"1960-03-29",
299
-            //     naty:"01",
300
-            //     psn_cert_type:"01",
301
-            //     psn_name:"杨美英",
302
-            //     age:60.7
303
-            // }
304
-            // this.doctor = {
305
-            //     name:'刘志刚',
306
-            //     department:'血透中心',
307
-            //     total:20,
308
-            // }
373
+          console.log(id)
374
+          this.radioStatus = id
375
+          this.getPatientList()
309
         },
376
         },
310
-       changeRadio(id){ 
377
+       changeRadio(id){
311
          console.log(id)
378
          console.log(id)
312
          this.radioStatus = id
379
          this.radioStatus = id
313
          this.getPatientList()
380
          this.getPatientList()
315
 
382
 
316
         //患者列表
383
         //患者列表
317
         getPatientList(){
384
         getPatientList(){
318
-           getPatientList().then(response=>{
319
-               if(response.data.state == 1){
320
-                 var hisPatient = response.data.data.hisPatient
321
-                 console.log("his",hisPatient)
322
-                 var scheduleList = response.data.data.scheduleList
323
-                 hisPatient.push(...scheduleList)
324
-                 console.log("arrr",hisPatient)
325
-                 var tabArr = this.unique(hisPatient)
326
-                 console.log("22222",tabArr)
327
-                 if(this.radioStatus == 1){
328
-                    this.tableData = tabArr
329
-                    this.$refs.tab.setCurrentRow(this.tableData[0])
330
-                 }
331
-                 if(this.radioStatus == 2){
332
-                    var prescription = response.data.data.prescription
333
-                    this.tableData = prescription
334
-                    this.$refs.tab.setCurrentRow(this.tableData[0])
335
-                 }
336
-                
337
-               }  
338
-           })
385
+          let params = {
386
+            'record_date': this.record_date
387
+          }
388
+          getSchedulePatientList(params).then(response => {
389
+            if (response.data.state == 0) {
390
+              this.$message.error(response.data.msg)
391
+              return false
392
+            } else {
393
+              this.patientTableData = []
394
+              for (let i = 0; i < response.data.data.list.length; i++) {
395
+
396
+                if (response.data.data.list[i].prescription != null && response.data.data.list[i].prescription.length > 0) {
397
+                  this.patientTableData.push(response.data.data.list[i])
398
+                }
399
+              }
400
+            }
401
+          })
339
         },
402
         },
340
 
403
 
341
         unique(arr) {
404
         unique(arr) {
344
         },
407
         },
345
         handleCurrentChange(val){
408
         handleCurrentChange(val){
346
           console.log("val",val)
409
           console.log("val",val)
347
-          this.getPatientInformation(val.id)
410
+          this.getPatientInformation(val.patients.id)
348
         },
411
         },
349
-        
412
+
350
         //获取患者的基本信息
413
         //获取患者的基本信息
351
-        getPatientInformation(id){
352
-            console.log(id)
353
-            getPatientInformation(id).then(response=>{
354
-               if(response.data.state == 1){
355
-                  var information = response.data.data.information
356
-                  console.log("information",information)
357
-                  this.patientInfo = information
358
-               }
359
-            })
414
+      getPatientInformation(id) {
415
+        let params = {
416
+          'record_date': this.record_date,
417
+          'patient_id': id
360
         }
418
         }
419
+        getPatientInfo(params).then(response => {
420
+          if (response.data.state == 0) {
421
+            this.$message.error(response.data.msg)
422
+            return false
423
+          } else {
424
+            this.patientInfo = response.data.data.xt_info
425
+            this.hisPatientInfo = response.data.data.his_info
426
+            this.prescriptions = []
427
+            for (let i = 0; i < response.data.data.prescription.length; i++) {
428
+              var prescription = response.data.data.prescription[i]
429
+              let index = i + 1
430
+              let obj = {
431
+                name: '处方' + index,
432
+                advices: prescription.advices,
433
+                project: prescription.project,
434
+                type: response.data.data.prescription[i].type
435
+              }
436
+              this.prescriptions.push(obj)
437
+              this.curPrescriptions = this.prescriptions[0]
438
+
439
+            }
440
+            // this.$refs.prescriptions.setData(this.prescriptions)
441
+          }
442
+        })
443
+      }
361
     }
444
     }
362
 }
445
 }
363
 </script>
446
 </script>
378
         .el-radio{
461
         .el-radio{
379
             margin-right:5px;
462
             margin-right:5px;
380
         }
463
         }
381
-        
464
+
382
     }
465
     }
383
     .mainCell{
466
     .mainCell{
384
         height:36px;
467
         height:36px;

+ 134 - 39
src/xt_pages/outpatientDoctorStation/components/deskPrescription.vue 查看文件

88
             </el-option>
88
             </el-option>
89
           </el-select>
89
           </el-select>
90
           <span>总计:</span>
90
           <span>总计:</span>
91
-          <span style="color:red;">{{ total }}</span>元
91
+          <span style="color:red;">{{ getTotal() }}</span>元
92
         </div>
92
         </div>
93
       </div>
93
       </div>
94
       <div class='centerRight'>
94
       <div class='centerRight'>
155
           <div style="height:84%;overflow-y: auto;margin-bottom: 60px;" v-show="showTwo">
155
           <div style="height:84%;overflow-y: auto;margin-bottom: 60px;" v-show="showTwo">
156
             <el-tabs class="rightTabs" v-model="activeName">
156
             <el-tabs class="rightTabs" v-model="activeName">
157
               <el-tab-pane label="项目列表" name="1">
157
               <el-tab-pane label="项目列表" name="1">
158
-                <el-table :data="tabProject" border @select='selectChange' style="width: 100%;"
158
+                <el-table ref="tables" :data="tabProject" border @select='selectChange' style="width: 100%;"
159
                           :row-style="{ color: '#303133' }"
159
                           :row-style="{ color: '#303133' }"
160
                           @select-all="changeAllGoodInfoTableDataTwo"
160
                           @select-all="changeAllGoodInfoTableDataTwo"
161
                           :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
161
                           :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
216
 
216
 
217
 
217
 
218
 <script>
218
 <script>
219
-  import { createHisPrescription, getInitData, getPatientInfo, getSchedulePatientList } from '@/api/his/his'
219
+  import {
220
+    createHisPrescription,
221
+    delHisPrescription,
222
+    getInitData,
223
+    getPatientInfo,
224
+    getSchedulePatientList
225
+  } from '@/api/his/his'
220
   import { getDictionaryDataConfig } from '@/utils/data'
226
   import { getDictionaryDataConfig } from '@/utils/data'
221
   import prescriptionTable from './prescriptionTable'
227
   import prescriptionTable from './prescriptionTable'
222
   import selectTemplate from './selectTemplate'
228
   import selectTemplate from './selectTemplate'
230
       hisPatientInfo: Object,
236
       hisPatientInfo: Object,
231
       prescriptions: Array,
237
       prescriptions: Array,
232
       record_date: String,
238
       record_date: String,
233
-      other_sick:Array,
234
-      diagnoses:Array,
239
+      other_sick: {
240
+        type: Array,
241
+        default: []
242
+      },
243
+      diagnoses: {
244
+        type: Array,
245
+        default: []
246
+      }
235
     },
247
     },
236
     components: {
248
     components: {
237
       selectTemplate,
249
       selectTemplate,
279
         tabPrjectTeam: [],
291
         tabPrjectTeam: [],
280
         teamList: [],
292
         teamList: [],
281
         doctors: [],
293
         doctors: [],
282
-        departMent: []
294
+        departMent: [],
295
+        curStatus: 0
283
       }
296
       }
284
     }, mounted() {
297
     }, mounted() {
285
 
298
 
286
     },
299
     },
287
     methods: {
300
     methods: {
301
+      getTotal() {
302
+        var total = 0
303
+        for (let i = 0; i < this.prescriptions.length; i++) {
304
+          if (this.prescriptions[i].advices != null) {
305
+            for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
306
+              total = total + this.prescriptions[i].advices[a].price * this.prescriptions[i].advices[a].prescribing_number
307
+            }
308
+          }
309
+          if (this.prescriptions[i].project != null) {
310
+            for (let b = 0; b < this.prescriptions[i].project.length; b++) {
311
+              total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].count
312
+            }
313
+          }
314
+        }
315
+        return total
316
+      },
288
       createFilter(queryString) {
317
       createFilter(queryString) {
289
         return (restaurant) => {
318
         return (restaurant) => {
290
           return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
319
           return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
293
 
322
 
294
       querySearch(queryString, cb) {
323
       querySearch(queryString, cb) {
295
         var restaurants = this.diagnoses
324
         var restaurants = this.diagnoses
296
-        console.log(restaurants)
297
         restaurants.map(item => {
325
         restaurants.map(item => {
298
           item.value = item.name
326
           item.value = item.name
299
         })
327
         })
301
         // 调用 callback 返回建议列表的数据
329
         // 调用 callback 返回建议列表的数据
302
         cb(results)
330
         cb(results)
303
       },
331
       },
332
+
304
       querySearch2(queryString, cb) {
333
       querySearch2(queryString, cb) {
305
         var restaurants = this.other_sick
334
         var restaurants = this.other_sick
306
         restaurants.map(item => {
335
         restaurants.map(item => {
324
         }
353
         }
325
       },
354
       },
326
       getDictionaryDataConfig(module, filed_name) {
355
       getDictionaryDataConfig(module, filed_name) {
327
-        console.log(getDictionaryDataConfig(module, filed_name))
328
         return getDictionaryDataConfig(module, filed_name)
356
         return getDictionaryDataConfig(module, filed_name)
329
 
357
 
330
       },
358
       },
353
             //用来区分处方属于项目还是药品
381
             //用来区分处方属于项目还是药品
354
             if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
382
             if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
355
               this.customTabIndex = 1
383
               this.customTabIndex = 1
384
+              this.curStatus = 1
356
             }
385
             }
357
             if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
386
             if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
358
 
387
 
359
               this.customTabIndex = 2
388
               this.customTabIndex = 2
389
+              this.curStatus = 2
360
             }
390
             }
361
 
391
 
362
             if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
392
             if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
366
           }
396
           }
367
 
397
 
368
         }
398
         }
399
+      }, clearData() {
400
+
401
+        this.curPrescriptions = []
369
       },
402
       },
370
       setData(data) {
403
       setData(data) {
371
         this.prescriptions = data
404
         this.prescriptions = data
408
           let data = {
441
           let data = {
409
             'prescriptions': this.prescriptions
442
             'prescriptions': this.prescriptions
410
           }
443
           }
411
-          console.log('data', data)
412
-          console.log('params', params)
413
           createHisPrescription(data, params).then(response => {
444
           createHisPrescription(data, params).then(response => {
414
             if (response.data.state == 1) {
445
             if (response.data.state == 1) {
415
               this.prescriptions = []
446
               this.prescriptions = []
416
               this.$message.success('保存成功')
447
               this.$message.success('保存成功')
417
             }
448
             }
418
           })
449
           })
419
-          localStorage.setItem('drugs', JSON.stringify(this.preDrugs))
420
-          // this.$message({ message: '保存成功', type: 'success' })
421
         } else if (index == 2) {
450
         } else if (index == 2) {
422
           this.$router.push('/outpatientDoctorStation/print')
451
           this.$router.push('/outpatientDoctorStation/print')
423
         } else if (index == 4) {
452
         } else if (index == 4) {
431
         ++this.tabIndex
460
         ++this.tabIndex
432
         let newTabName = '处方' + this.tabIndex
461
         let newTabName = '处方' + this.tabIndex
433
         this.prescriptions.push({
462
         this.prescriptions.push({
463
+          id: 0,
434
           name: newTabName,
464
           name: newTabName,
435
           advices: [],
465
           advices: [],
436
           project: []
466
           project: []
438
         })
468
         })
439
         this.editableTabsValue = newTabName
469
         this.editableTabsValue = newTabName
440
         this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1]
470
         this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1]
471
+        this.curStatus = 0
441
       },
472
       },
442
       removeTab(targetName) {
473
       removeTab(targetName) {
474
+        let id = 0
475
+        for (let i = 0; i < this.prescriptions.length; i++) {
476
+          if (this.prescriptions[i].name == targetName) {
477
+            id = this.prescriptions[i].id
478
+          }
479
+        }
480
+
481
+        if (id == 0) {
482
+          let tabs = this.prescriptions
483
+          let activeName = this.editableTabsValue
484
+          if (activeName === targetName) {
485
+            tabs.forEach((tab, index) => {
486
+              if (tab.name === targetName) {
487
+                let nextTab = tabs[index + 1] || tabs[index - 1]
488
+                if (nextTab) {
489
+                  activeName = nextTab.name
490
+
491
+                }
492
+              }
493
+            })
494
+          }
495
+          this.editableTabsValue = activeName
496
+          this.prescriptions = tabs.filter(tab => tab.name !== targetName)
443
 
497
 
444
-        let tabs = this.prescriptions
445
-        let activeName = this.editableTabsValue
446
-        if (activeName === targetName) {
447
-          tabs.forEach((tab, index) => {
448
-            if (tab.name === targetName) {
449
-              let nextTab = tabs[index + 1] || tabs[index - 1]
450
-              if (nextTab) {
451
-                activeName = nextTab.name
498
+          for (let i = 0; i < this.prescriptions.length; i++) {
499
+            if (activeName == this.prescriptions[i].name) {
500
+              this.curPrescriptions = this.prescriptions[i]
501
+              if(this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0){
502
+                this.curStatus = 1
452
               }
503
               }
504
+              if(this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0){
505
+                this.curStatus = 2
506
+              }
507
+            }
508
+          }
509
+          if (this.prescriptions.length == 0) {
510
+            this.curPrescriptions = []
511
+            this.curStatus = 0
512
+          }
513
+        } else {
514
+          let params = {
515
+            'id': id
516
+          }
517
+          delHisPrescription(params).then(response => {
518
+            if (response.data.state == 1) {
519
+              this.$message.success('删除成功')
520
+            } else {
521
+              this.$message.success(response.data.msg)
453
             }
522
             }
454
           })
523
           })
455
         }
524
         }
456
-
457
-        this.editableTabsValue = activeName
458
-        this.prescriptions = tabs.filter(tab => tab.name !== targetName)
459
-        console.log(this.prescriptions)
460
       },
525
       },
461
       clickTab(index) {
526
       clickTab(index) {
462
         if (index == 1) {
527
         if (index == 1) {
499
         this.curDrugs = selection
564
         this.curDrugs = selection
500
       },
565
       },
501
       comfirm() {
566
       comfirm() {
502
-        this.preDrugs = this.curDrugs
503
-        console.log(this.prescriptions)
567
+        console.log(this.curStatus)
568
+        console.log(this.rightTab)
569
+        console.log(this.curPrescriptions)
570
+
571
+
572
+        if (this.curStatus == 1  && this.rightTab == 2) {
573
+          this.$message.error('改处方是药品,无法添加项目')
574
+          this.teamList = []
575
+          this.$refs.tables.clearSelection()
576
+          return
577
+        }
578
+
579
+        if (this.curStatus ==2 && this.rightTab == 1) {
580
+          this.$message.error('改处方是项目,无法添加药品')
581
+          this.curDrugs = []
582
+          this.$refs.multipleTable.clearSelection()
583
+          return
584
+        }
585
+
504
         for (let i = 0; i < this.prescriptions.length; i++) {
586
         for (let i = 0; i < this.prescriptions.length; i++) {
505
           if (this.prescriptions[i].name == this.editableTabsValue) {
587
           if (this.prescriptions[i].name == this.editableTabsValue) {
506
-            var temp = this.deepClone(this.preDrugs)
588
+            var temp = this.deepClone(this.curDrugs)
507
             var temp2 = this.deepClone(this.teamList)
589
             var temp2 = this.deepClone(this.teamList)
508
-            console.log(this.prescriptions[i].advices)
509
-            console.log(this.prescriptions[i].project)
510
-
511
-            console.log(temp)
512
-            console.log(temp2)
513
 
590
 
514
             if (temp.length > 0) {
591
             if (temp.length > 0) {
515
               for (let b = 0; b < temp.length; b++) {
592
               for (let b = 0; b < temp.length; b++) {
516
-                this.prescriptions[i].advices.push(temp[b])
593
+                let obj = {
594
+                  advice_id: 0,
595
+                  drug_name: temp[b].drug_name,
596
+                  single_dose: temp[b].single_dose,
597
+                  delivery_way: temp[b].delivery_way,
598
+                  execution_frequency: temp[b].execution_frequency,
599
+                  retail_price: temp[b].retail_price.toString(),
600
+                  remark: '',
601
+                  prescribing_number: temp[b].prescribing_number,
602
+                  single_dose_unit: temp[b].min_unit,
603
+                  prescribing_number_unit: temp[b].min_unit,
604
+                  min_unit: temp[b].min_unit
605
+
606
+                }
607
+                this.prescriptions[i].advices.push(obj)
517
               }
608
               }
609
+              this.curStatus = 1
518
             }
610
             }
611
+
519
             if (temp2.length > 0) {
612
             if (temp2.length > 0) {
520
               for (let b = 0; b < temp2.length; b++) {
613
               for (let b = 0; b < temp2.length; b++) {
521
-                this.prescriptions[i].project.concat(temp2[b])
614
+                this.prescriptions[i].project.push(temp2[b])
522
               }
615
               }
616
+              this.curStatus = 2
523
             }
617
             }
524
             this.curPrescriptions = this.prescriptions[i]
618
             this.curPrescriptions = this.prescriptions[i]
525
             this.$refs.multipleTable.clearSelection()
619
             this.$refs.multipleTable.clearSelection()
526
-            // this.$refs.prescription_tables.setNewData(this.prescriptions[i])
620
+            this.$refs.tables.clearSelection()
621
+
527
           }
622
           }
528
         }
623
         }
624
+        this.curDrugs = []
625
+        this.preDrugs = []
626
+        this.teamList = []
627
+
529
       }, changeAllGoodInfoTableDataTwo(row) {
628
       }, changeAllGoodInfoTableDataTwo(row) {
530
         this.teamList = row
629
         this.teamList = row
531
       },
630
       },
540
             this.tabProject = project
639
             this.tabProject = project
541
           }
640
           }
542
         })
641
         })
543
-      },
544
-      querySearch() {
545
-
546
       }, deepClone(source) {
642
       }, deepClone(source) {
547
         if (!source && typeof source !== 'object') {
643
         if (!source && typeof source !== 'object') {
548
           throw new Error('error arguments', 'shallowClone')
644
           throw new Error('error arguments', 'shallowClone')
609
       //获取所以项目组套
705
       //获取所以项目组套
610
       this.getAllProjectTeam()
706
       this.getAllProjectTeam()
611
 
707
 
612
-
613
     }
708
     }
614
   }
709
   }
615
 </script>
710
 </script>

+ 63 - 18
src/xt_pages/outpatientDoctorStation/components/prescriptionTable.vue 查看文件

26
       </el-table-column>
26
       </el-table-column>
27
       <el-table-column align="center" prop="name" width="50" label="频率">
27
       <el-table-column align="center" prop="name" width="50" label="频率">
28
         <template slot-scope="scope">
28
         <template slot-scope="scope">
29
-          <el-select v-model="scope.row.execution_frequency" placeholder="请选择">
29
+          <el-select v-model="scope.row.execution_frequency" placehold er="请选择">
30
             <el-option
30
             <el-option
31
-              v-for="item in efs"
31
+              v-for="item,index in efs"
32
               :key="index"
32
               :key="index"
33
               :label="item.name"
33
               :label="item.name"
34
               :value="item.name">
34
               :value="item.name">
57
       </el-table-column>
57
       </el-table-column>
58
       <el-table-column align="center" width="40" prop="name" label="操作">
58
       <el-table-column align="center" width="40" prop="name" label="操作">
59
         <template slot-scope="scope">
59
         <template slot-scope="scope">
60
-          <i class="el-icon-delete" @click="deleteDrug(scope.row)"></i>
60
+          <i class="el-icon-delete" @click="deleteDrug(scope.$index, scope.row)"></i>
61
         </template>
61
         </template>
62
       </el-table-column>
62
       </el-table-column>
63
     </el-table>
63
     </el-table>
140
 
140
 
141
 <script>
141
 <script>
142
   import { getDictionaryDataConfig} from "@/utils/data";
142
   import { getDictionaryDataConfig} from "@/utils/data";
143
-  import { getInitData } from '@/api/his/his'
143
+  import { getInitData,delHisAdvice,delHisProject } from '@/api/his/his'
144
 
144
 
145
   export default {
145
   export default {
146
     props: {
146
     props: {
195
           }
195
           }
196
         })
196
         })
197
 
197
 
198
-      },deleteDrug:function(row){
199
-        for (let i = 0; i < this.prescription.advices.length; i++){
200
-          if(this.prescription.advices[i].id == row.id){
201
-              this.prescription.advices.splice(i, 1)
198
+      },deleteDrug:function(index, row){
199
+        console.log(row)
200
+       console.log(index)
201
+
202
+       if(row.advice_id == 0){
203
+          this.prescription.advices.splice(index, 1)
204
+        }else{
205
+          let params = {
206
+            'id': row.advice_id,
202
           }
207
           }
208
+          delHisAdvice(params).then(response => {
209
+            if (response.data.state == 0) {
210
+              this.$message.error(response.data.msg)
211
+              return false
212
+            } else {
213
+              var temp2 = this.deepClone(this.prescription.advices)
214
+              temp2.splice(index, 1)
215
+              this.prescription.advices = temp2
216
+              this.$message.success(response.data.data.msg)
217
+            }
218
+          })
219
+
220
+
203
         }
221
         }
204
-      },
222
+
223
+      },deepClone(source) {
224
+       if (!source && typeof source !== 'object') {
225
+         throw new Error('error arguments', 'shallowClone')
226
+       }
227
+       const targetObj = source.constructor === Array ? [] : {}
228
+       Object.keys(source).forEach((keys) => {
229
+         if (source[keys] && typeof source[keys] === 'object') {
230
+           targetObj[keys] = this.deepClone(source[keys])
231
+         } else {
232
+           targetObj[keys] = source[keys]
233
+         }
234
+       })
235
+       return targetObj
236
+     },
205
 
237
 
206
       setNewData:function(data){
238
       setNewData:function(data){
239
+        this.prescription = data
207
 
240
 
208
         // this.prescription.advices = data.advices
241
         // this.prescription.advices = data.advices
209
       },
242
       },
222
          return name
255
          return name
223
       },
256
       },
224
       deleteProject(row){
257
       deleteProject(row){
258
+        if(row.id == 0){
259
+          this.prescription.project.splice(i, 1)
225
 
260
 
226
-        for (let i = 0; i < this.prescription.project.length; i++){
227
-          if(this.prescription.project[i].id == row.id){
228
-              this.prescription.project.splice(i, 1)
261
+        }else{
262
+          let params = {
263
+            'id': row.id,
229
           }
264
           }
265
+          delHisProject(params).then(response => {
266
+            if (response.data.state == 0) {
267
+              this.$message.error(response.data.msg)
268
+              return false
269
+            } else {
270
+              for (let i = 0; i < this.prescription.project.length; i++){
271
+                if(this.prescription.project[i].id == row.id){
272
+                  this.prescription.project.splice(i, 1)
273
+                }
274
+              }
275
+              this.$message.error(response.data.data.msg)
276
+            }
277
+          })
278
+
279
+
230
         }
280
         }
281
+
231
       },
282
       },
232
     },mounted(){
283
     },mounted(){
233
       this.getInitData()
284
       this.getInitData()
234
     },
285
     },
235
-    watch:{
236
-      prescription:function(){
237
-        console.log("8888888",this)
238
-        console.log("9999999",this.prescription)
239
-      }
240
-    }
241
   }
286
   }
242
 </script>
287
 </script>
243
 
288
 

+ 47 - 22
src/xt_pages/outpatientDoctorStation/doctorDesk.vue 查看文件

26
           <el-table :data="patientTableData" @row-click='choosePatient' border style="width: 100%;"
26
           <el-table :data="patientTableData" @row-click='choosePatient' border style="width: 100%;"
27
                     :row-style="{ color: '#303133' }"
27
                     :row-style="{ color: '#303133' }"
28
                     :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
28
                     :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
29
-                     highlight-current-row
29
+                    highlight-current-row
30
                     ref="tab"
30
                     ref="tab"
31
-                   >
31
+          >
32
             <el-table-column align="center" prop="name" label="患者姓名">
32
             <el-table-column align="center" prop="name" label="患者姓名">
33
-              <template slot-scope="scope">{{ scope.row.patients.name }}</template>
33
+              <template slot-scope="scope">{{scope.row.patients?scope.row.patients.name:''}}</template>
34
             </el-table-column>
34
             </el-table-column>
35
             <el-table-column align="center" prop="name" label="就诊号" width="90">
35
             <el-table-column align="center" prop="name" label="就诊号" width="90">
36
-              <template slot-scope="scope">{{ scope.row.his_patient.number }}</template>
36
+              <template slot-scope="scope">{{ scope.row.his_patient ?scope.row.his_patient.number:''}}</template>
37
             </el-table-column>
37
             </el-table-column>
38
           </el-table>
38
           </el-table>
39
         </div>
39
         </div>
46
           </el-radio-group>
46
           </el-radio-group>
47
         </div>
47
         </div>
48
         <!--<desk-prescription ref="prescriptions"   :prescriptions="prescriptions" :patientInfo="patientInfo" :hisPatientInfo="hisPatientInfo"-->
48
         <!--<desk-prescription ref="prescriptions"   :prescriptions="prescriptions" :patientInfo="patientInfo" :hisPatientInfo="hisPatientInfo"-->
49
-                   <!--v-if="titleType == '处方'" style="flex:1;"></desk-prescription>-->
50
-        <desk-prescription :diagnoses="diagnoses" :other_sick="other_sick" :record_date="record_date" ref="prescriptions"  :prescriptions="prescriptions" :patientInfo="patientInfo" :hisPatientInfo="hisPatientInfo"
49
+        <!--v-if="titleType == '处方'" style="flex:1;"></desk-prescription>-->
50
+        <desk-prescription :diagnoses="diagnoses" :other_sick="other_sick" :record_date="record_date"
51
+                           ref="prescriptions" :prescriptions="prescriptions" :patientInfo="patientInfo"
52
+                           :hisPatientInfo="hisPatientInfo"
51
                            v-if="titleType == '处方'" style="flex:1;"></desk-prescription>
53
                            v-if="titleType == '处方'" style="flex:1;"></desk-prescription>
52
         <desk-record :record_date="record_date" :case_history="case_history" :patientInfo="patientInfo"
54
         <desk-record :record_date="record_date" :case_history="case_history" :patientInfo="patientInfo"
53
                      :hisPatientInfo="hisPatientInfo" v-if="titleType == '病历'"></desk-record>
55
                      :hisPatientInfo="hisPatientInfo" v-if="titleType == '病历'"></desk-record>
95
         patientInfo: {},
97
         patientInfo: {},
96
         hisPatientInfo: {},
98
         hisPatientInfo: {},
97
         case_history: {},
99
         case_history: {},
98
-        patient_id:0,
99
-        diagnoses:[],
100
-        other_sick:[],
100
+        patient_id: 0,
101
+        diagnoses: [],
102
+        other_sick: []
101
 
103
 
102
       }
104
       }
103
     },
105
     },
128
             return false
130
             return false
129
           } else {
131
           } else {
130
             this.patientTableData = response.data.data.list
132
             this.patientTableData = response.data.data.list
131
-            console.log("222",this.patientTableData)
133
+            console.log('222', this.patientTableData)
132
             // this.$refs.tab.setCurrentRow(this.patientTableData[0])
134
             // this.$refs.tab.setCurrentRow(this.patientTableData[0])
133
             let cal_one = 0
135
             let cal_one = 0
134
             let cal_two = 0
136
             let cal_two = 0
140
                 cal_two = cal_two + 1
142
                 cal_two = cal_two + 1
141
               }
143
               }
142
             }
144
             }
143
-
145
+            this.$refs.tab.setCurrentRow(this.patientTableData[0])
146
+            console.log(this.patientTableData[0])
147
+            this.choosePatient(this.patientTableData[0])
144
             this.cal_one = cal_one
148
             this.cal_one = cal_one
145
             this.cal_two = cal_two
149
             this.cal_two = cal_two
146
           }
150
           }
151
           'record_date': this.record_date,
155
           'record_date': this.record_date,
152
           'patient_id': val.patients.id
156
           'patient_id': val.patients.id
153
         }
157
         }
158
+        console.log("-------")
154
         getPatientInfo(params).then(response => {
159
         getPatientInfo(params).then(response => {
155
           if (response.data.state == 0) {
160
           if (response.data.state == 0) {
156
             this.$message.error(response.data.msg)
161
             this.$message.error(response.data.msg)
157
             return false
162
             return false
158
           } else {
163
           } else {
164
+            console.log("999888811111")
165
+
166
+            this.prescriptions = []
167
+            this.$refs.prescriptions.clearData()
159
             this.patientInfo = response.data.data.xt_info
168
             this.patientInfo = response.data.data.xt_info
160
             this.hisPatientInfo = response.data.data.his_info
169
             this.hisPatientInfo = response.data.data.his_info
161
             this.case_history = response.data.data.case_history
170
             this.case_history = response.data.data.case_history
190
             } else {
199
             } else {
191
               this.case_history.is_infect = false
200
               this.case_history.is_infect = false
192
             }
201
             }
193
-            this.prescriptions = []
194
             if (response.data.data.prescription.length > 0) {
202
             if (response.data.data.prescription.length > 0) {
195
               for (let i = 0; i < response.data.data.prescription.length; i++) {
203
               for (let i = 0; i < response.data.data.prescription.length; i++) {
196
                 var prescription = response.data.data.prescription[i]
204
                 var prescription = response.data.data.prescription[i]
205
+                let tempAdvice = []
206
+                for (let b = 0; b < prescription.advices.length; b++) {
207
+                  let obj = {
208
+                    advice_id: prescription.advices[b].id,
209
+                    drug_name: prescription.advices[b].advice_name,
210
+                    single_dose: prescription.advices[b].single_dose,
211
+                    delivery_way: prescription.advices[b].delivery_way,
212
+                    execution_frequency: prescription.advices[b].execution_frequency,
213
+                    retail_price: prescription.advices[b].price.toString(),
214
+                    remark: prescription.advices[b].remark,
215
+                    prescribing_number:prescription.advices[b].prescribing_number,
216
+                    single_dose_unit:prescription.advices[b].single_dose_unit,
217
+                    prescribing_number_unit:prescription.advices[b].prescribing_number_unit,
218
+                    min_unit:prescription.advices[b].single_dose_unit
219
+
220
+                  }
221
+                  tempAdvice.push(obj)
222
+                }
197
                 let index = i + 1
223
                 let index = i + 1
198
                 let obj = {
224
                 let obj = {
199
-                  name: "处方" + index,
200
-                  advices: prescription.advices,
201
-                  project: prescription.project,
225
+                  id: prescription.id,
226
+                  name: '处方' + index,
227
+                  advices: tempAdvice,
228
+                  project: prescription.project
202
                 }
229
                 }
203
                 this.prescriptions.push(obj)
230
                 this.prescriptions.push(obj)
204
               }
231
               }
205
-            }else{
232
+            } else {
206
               let obj = {
233
               let obj = {
207
-                name: "处方" + 1,
234
+                id:0,
235
+                name: '处方' + 1,
208
                 advices: [],
236
                 advices: [],
209
-                project: [],
237
+                project: []
210
               }
238
               }
211
               this.prescriptions.push(obj)
239
               this.prescriptions.push(obj)
212
             }
240
             }
225
         //     psn_name:"杨美英",
253
         //     psn_name:"杨美英",
226
         //     age:60.7
254
         //     age:60.7
227
         // }
255
         // }
228
-      },
256
+      }
229
       // changePatient(val){
257
       // changePatient(val){
230
       //   console.log("患者val",val)
258
       //   console.log("患者val",val)
231
       //   this.hisPatientInfo = val.hisPatientInfo
259
       //   this.hisPatientInfo = val.hisPatientInfo
246
 
274
 
247
       this.diagnoses = this.getDictionaryDataConfig('system', 'diagnose')
275
       this.diagnoses = this.getDictionaryDataConfig('system', 'diagnose')
248
       this.other_sick = this.getDictionaryDataConfig('system', 'other_sick_history')
276
       this.other_sick = this.getDictionaryDataConfig('system', 'other_sick_history')
249
-      console.log(this.diagnoses)
250
-      console.log(this.other_sick)
251
 
277
 
252
-      console.log("111122222")
253
 
278
 
254
 
279
 
255
     }
280
     }