LIJU 1 month ago
parent
commit
9f2f51bba0
1 changed files with 54 additions and 0 deletions
  1. 54 0
      src/views/medical-insurance/inpatient/AdmRegistration.vue

+ 54 - 0
src/views/medical-insurance/inpatient/AdmRegistration.vue

@@ -12,6 +12,9 @@
         biztype="01103"
         @success="afterReadCard"
       />
+      <el-button icon="CreditCard" type="primary" @click="injurySicard">
+        工伤读社保卡
+      </el-button>
       <el-button icon="Top" type="success" @click="checkRegisterDatetime"
         >医保入院登记
       </el-button>
@@ -931,6 +934,57 @@ const formatYbRegisterDate = () => {
 
 const admissApply = ref({});
 const showAdmissApplyForm = ref(false);
+
+// 新增:用于存储工伤读卡接口返回结果
+const injurySicardResult = ref({});
+
+const injurySicard = async () => {
+  const loading = ElMessage({
+    message: '正在读取社保卡,请稍候...',
+    type: 'info',
+    duration: 0,
+    showClose: true,
+    grouping: true,
+  });
+  try {
+    const response = await fetch('http://130.150.161.72:9206/thyy/api/public/injury/workinjury', {
+      method: 'POST',
+      headers: {
+        'Content-Type': 'application/json',
+      },
+      body: JSON.stringify({
+        action: 'transaction',
+        transactionName: 'ReadCard',
+      }),
+    });
+    const result = await response.json();
+    if (result && result.code === 1 && result.data) {
+      injurySicardResult.value = result.data;
+      ElMessage({
+        message: '工伤读社保卡成功',
+        type: 'success',
+        duration: 2500,
+        showClose: true,
+      });
+    } else {
+      ElMessage({
+        message: result.message || '工伤读社保卡失败',
+        type: 'error',
+        duration: 2500,
+        showClose: true,
+      });
+    }
+  } catch (error) {
+    ElMessage({
+      message: '工伤读社保卡接口异常',
+      type: 'error',
+      duration: 2500,
+      showClose: true,
+    });
+  } finally {
+    loading.close && loading.close();
+  }
+};
 const checkRegisterDatetime = () => {
   if (nullPatient()) {
     return;