Browse Source

打印功能

test_user 2 years ago
parent
commit
c8dcb266be
1 changed files with 24 additions and 5 deletions
  1. 24 5
      src/xt_pages/outpatientDoctorStation/checkTemplate/printOne.vue

+ 24 - 5
src/xt_pages/outpatientDoctorStation/checkTemplate/printOne.vue View File

@@ -61,11 +61,13 @@
61 61
             <span v-if="advicePrint[0].patient.gender == 1">男</span>
62 62
             <span v-if="advicePrint[0].patient.gender == 2">女</span>
63 63
           </div>
64
-          <div>
65
-            年龄:{{
66
-              advicePrint[0].patient.age ? advicePrint[0].patient.age : ""
67
-            }}岁
68
-          </div>
64
+<!--          <div>-->
65
+<!--            年龄:{{-->
66
+<!--              advicePrint[0].patient.age ? advicePrint[0].patient.age : ""-->
67
+<!--            }}岁-->
68
+<!--          </div>-->
69
+          <div>年龄:{{getAge(advicePrint[0].patient)?getAge(advicePrint[0].patient):""}}岁</div>
70
+
69 71
         </div>
70 72
         <div style="margin-bottom: 20px; padding: 10px 10px 0">
71 73
           病史摘要:{{
@@ -188,6 +190,23 @@ export default {
188 190
     };
189 191
   },
190 192
   methods: {
193
+    getAge(patient){
194
+      var thisLen = patient.id_card_no.length
195
+      var birth = ''
196
+      if (thisLen == 15) {
197
+        birth = '19' + patient.id_card_no.substr(6, 6)
198
+      } else {
199
+        birth = patient.id_card_no.substr(6, 8)
200
+      }
201
+      var births =
202
+        birth.substr(0, 4) +
203
+        '-' +
204
+        birth.substr(4, 2) +
205
+        '-' +
206
+        birth.substr(6, 2)
207
+      return jsGetAge(births, '-')
208
+
209
+    },
191 210
     getPatientCaseHistory() {
192 211
       const params = {
193 212
         patient_id: this.patient_id,