LIJU 1 month ago
parent
commit
119acf7cb4

+ 3 - 3
src/views/medical-insurance/inpatient/AdmRegistration.vue

@@ -12,7 +12,7 @@
         biztype="01103"
         @success="afterReadCard"
       />
-      <el-button icon="CreditCard" type="primary" @click="injurySicard">
+      <el-button v-if="injuryMode" icon="CreditCard" type="primary" @click="injurySicard">
         工伤读社保卡
       </el-button>
       <el-button icon="Top" type="success" @click="checkRegisterDatetime"
@@ -1411,7 +1411,7 @@ const handleClickInjuryinfo = row => {
           }
         }
       const businessParams = {
-        ipt_otp_no: patient.value.inpatientNo + '_' + patient.value.admissTimes,
+        ipt_otp_no: patient.value.inpatientNo + '_' + patient.value.admissTimes + '_' + patient.value.ledgerSn,
         med_type: patient.value.medType,
         adm_time: getCurrentDateTimeStr(),
         adm_diag_dscr: zyInYbDiags.value && zyInYbDiags.value.length && (zyInYbDiags.value.length > 0) && zyInYbDiags.value[0] && zyInYbDiags.value[0].icdCode ? zyInYbDiags.value[0].icdCode : '',
@@ -1464,7 +1464,7 @@ const handleClickInjuryinfo = row => {
                   //emp_name,
                   //psn_idet_type,//人员身份类别
                   //psn_type_lv,
-                  //mdtrt_id,//就诊ID                                 新增
+                  mdtrt_id: patient.value.inpatientNo + '_' + patient.value.admissTimes + '_' + patient.value.ledgerSn,//就诊ID 就是门诊/住院流水号                 新增
                   //setl_id,
                   //medins_setl_id,
                   //psn_cert_type,//人员证件类型

+ 362 - 15
src/views/medical-insurance/inpatient/AdmissVerification.vue

@@ -40,6 +40,7 @@
         <el-button style="margin-left: 10px" type="primary" icon="Tickets" @click="getPsnInsuinfo(1)">待遇检查</el-button>
         <el-button type="primary" icon="User" @click="checkIdCard">身份信息</el-button>
         <ReadCard :pat-no="patient.inpatientNo" biztype="01103" @success="afterReadCard" />
+        <el-button v-if="injuryMode" icon="CreditCard" type="primary" @click="injurySicard">工伤读社保卡</el-button>
         <el-button type="success" icon="Check" @click="beforeHandleApply(true)">审核通过</el-button>
         <el-button type="danger" icon="Close" @click="beforeHandleApply(false)">审核不通过</el-button>
         <el-button type="primary" icon="Document" @click="getRegInfo">登记信息</el-button>
@@ -286,29 +287,184 @@ const getPsnInsuinfo = (flag) => {
 }
 
 const handleClickInjuryinfo = (row) => {
-  ElMessageBox.confirm('审核通过将直接进行医保入院登记,确定审核通过?', '提示', {
+  // 检查是否已经进行工伤读卡
+  if (!patient.value.readCardResult || patient.value.mdtrtCertType !== 'injurySicard') {
+    ElMessage({
+      message: '请先进行工伤读社保卡操作!',
+      type: 'warning',
+      duration: 2500,
+      showClose: true,
+    })
+    return
+  }
+
+  ElMessageBox.confirm('审核通过将直接进行工伤入院登记,确定审核通过?', '提示', {
     type: 'warning',
     confirmButtonText: '确定',
     cancelButtonText: '取消',
-  }).then(() => {
-    row.patNo = patient.value.inpatientNo
-    row.times = patient.value.admissTimes
-    row.ledgerSn = patient.value.ledgerSn
-    row.aka130 = '42'
-    row.bka003 = '420'
-    inpatientRegister(row).then((res) => {
-      currentApply.value.status = 1
-      currentApply.value.handleComment = '同意办理'
-      handleApply(currentApply.value).then((res) => {
+  }).then(async () => {
+    // 解析 exam_ccls 字段
+    let QualificationId = ''
+    let injury_part_desc = ''
+    let visit_type = ''
+    if (patient.value.readCardResult.data.output.exam_ccls) {
+      // 格式:^工伤医疗费资格审核信息ID|受伤部位信息描述|就诊类型^
+      const match = patient.value.readCardResult.data.output.exam_ccls.match(/^\^?(.*?)\|(.*?)\|(.*?)\^?$/)
+      if (match) {
+        QualificationId = match[1]
+        injury_part_desc = match[2]
+        visit_type = match[3]
+      }
+    }
+
+    const businessParams = {
+      ipt_otp_no: patient.value.inpatientNo + '_' + patient.value.admissTimes + '_' + patient.value.ledgerSn,
+      med_type: patient.value.medType,
+      adm_time: getCurrentDateTimeStr(),
+      adm_diag_dscr: zyInYbDiags.value && zyInYbDiags.value.length && (zyInYbDiags.value.length > 0) && zyInYbDiags.value[0] && zyInYbDiags.value[0].icdCode ? zyInYbDiags.value[0].icdCode : '',
+      wardarea_name: patient.value.admissWardName,
+      adm_dept_codg: patient.value.admissWard,
+      adm_bed: patient.value.bedNo,
+      atddr_no: patient.value.admissPhysician,
+      tel: patient.value.contactPhone,
+      psn_no: patient.value.readCardResult.data.output.psn_no,
+      ipt_no: patient.value.inpatientNo,
+      qualification_id: QualificationId
+    }
+    const params = {
+      "action": "transaction",
+      "transactionName": "RegisterPatient",
+      "businessParams": businessParams
+    }
+
+    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(params),
+      })
+      const result = await response.json()
+      if (result && result.code === 1 && result.data && result.data.code === 200 && result.data.data.infcode == '0') {
+        // 调用 addOrEditTSiPatInfo 接口
+        try {
+          const responseThree = await fetch('http://130.150.161.72:9206/thyy/api/public/injury/addOrEditTSiPatInfo', {
+            method: 'POST',
+            headers: {
+              'Content-Type': 'application/json',
+            },
+            body: JSON.stringify({
+              pat_no: patient.value.inpatientNo,
+              times: patient.value.admissTimes,
+              ledger_sn: patient.value.ledgerSn,
+              psn_no: patient.value.readCardResult.data.output.psn_no,
+              med_type: patient.value.medType,
+              insuplc_admdvs: patient.value.readCardResult.data.output.insu_admdvs,
+              mdtrt_id: patient.value.inpatientNo + '_' + patient.value.admissTimes + '_' + patient.value.ledgerSn,//就诊ID 就是门诊/住院流水号                 新增
+              create_datetime: getCurrentDateTimeForCreate(),
+            }),
+          })
+          const resultThree = await responseThree.json()
+          if (!(resultThree && resultThree.code === 1)) {
+            ElMessage({
+              message: '工伤患者信息表保存失败',
+              type: 'error',
+              duration: 2500,
+              showClose: true,
+            })
+            return
+          }
+        } catch (e) {
+          ElMessage({
+            message: '工伤患者信息表保存接口异常',
+            type: 'error',
+            duration: 2500,
+            showClose: true,
+          })
+          return
+        }
+
+        // 调用 addWorkInjuryInterfaceLog 接口
+        try {
+          const responseTwo = await fetch('http://130.150.161.72:9206/thyy/api/public/injury/addWorkInjuryInterfaceLog', {
+            method: 'POST',
+            headers: {
+              'Content-Type': 'application/json',
+            },
+            body: JSON.stringify({
+              inpatient_no: patient.value.inpatientNo,
+              admiss_times: patient.value.admissTimes,
+              ledger_sn: patient.value.ledgerSn,
+              infno: result.data.transformed_parameters.infno,
+              msgid: result.data.transformed_parameters.msgid,
+              recer_sys_code: result.data.transformed_parameters.recer_sys_code,
+              infver: result.data.transformed_parameters.infver,
+              opter_type: result.data.transformed_parameters.opter_type,
+              opter: result.data.transformed_parameters.opter,
+              opter_name: result.data.transformed_parameters.opter_name,
+              inf_time: result.data.transformed_parameters.inf_time,
+              fixmedins_code: result.data.transformed_parameters.fixmedins_code,
+              sign_no: result.data.transformed_parameters.sign_no,
+              idfi_mode: result.data.transformed_parameters.idfi_mode,
+              input: JSON.stringify(result.data.transformed_parameters.input),
+              qrcode_info: result.data.transformed_parameters.qrcode_info,
+              infcode: result.data.data.infcode,
+              inf_refmsgid: result.data.data.inf_refmsgid,
+              refmsg_time: result.data.data.refmsg_time,
+              respond_time: result.data.data.respond_time,
+              err_msg: result.data.data.err_msg,
+              warn_msg: result.data.data.warn_msg,
+              output: JSON.stringify(result.data.data.output)
+            }),
+          })
+          const resultTwo = await responseTwo.json()
+          if (resultTwo && resultTwo.code === 1) {
+            currentApply.value.status = 1
+            currentApply.value.handleComment = '同意办理'
+            handleApply(currentApply.value).then((res) => {
+              ElMessage({
+                message: '审核已通过,工伤入院登记成功。',
+                type: 'success',
+                duration: 2500,
+                showClose: true,
+              })
+              showPsnInsuinfo.value = false
+            })
+          } else {
+            ElMessage({
+              message: '本地工伤入院登记接口异常,需要你进行冲正处理了',
+              type: 'error',
+              duration: 10000,
+              showClose: true,
+            })
+            return
+          }
+        } catch (e) {
+          ElMessage({
+            message: '本地工伤入院登记接口异常,需要你进行冲正处理了',
+            type: 'error',
+            duration: 10000,
+            showClose: true,
+          })
+          return
+        }
+      } else {
         ElMessage({
-          message: '审核已通过,医保入院登记成功。',
-          type: 'success',
+          message: result.message || '工伤入院登记失败',
+          type: 'error',
           duration: 2500,
           showClose: true,
         })
-        showPsnInsuinfo.value = false
+      }
+    } catch (e) {
+      ElMessage({
+        message: '工伤入院登记接口异常',
+        type: 'error',
+        duration: 2500,
+        showClose: true,
       })
-    })
+    }
   }).catch(() => {})
 }
 
@@ -408,6 +564,167 @@ const getRegInfo = () => {
   showRegisterInfo.value = true
 }
 
+// 新增:用于存储工伤读卡接口返回结果
+const injurySicardResult = ref({})
+
+// 工伤读社保卡功能
+const injurySicard = async () => {
+  if (!currentApply.value.patNo) {
+    ElMessage({
+      message: '请先选择患者',
+      type: 'warning',
+      duration: 2500,
+      showClose: true,
+    })
+    return
+  }
+  if (!patient.value.medType) {
+    ElMessage({
+      message: '请先选择医疗类别!',
+      type: 'warning',
+      duration: 2500,
+      showClose: true,
+    })
+    return
+  }
+  if (!(patient.value.medType && ((patient.value.medType === 'gs21') || (patient.value.medType === 'gs22') || (patient.value.medType === 'gs23')))) {
+    ElMessage({
+      message: '请先选择工伤相关的医疗类别!',
+      type: 'warning',
+      duration: 2500,
+      showClose: true,
+    })
+    return
+  }
+  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 && result.data.code === 200 && result.data.data.infcode == '0') {
+      if (result.data && result.data.data && result.data.data.output && result.data.data.output.certno && (result.data.data.output.certno !== patient.value.socialNo)) {
+        ElMessage({
+          message: '人证不符,请检查身份证号码!',
+          type: 'error',
+          duration: 2500,
+          showClose: true,
+        })
+        return
+      }
+      if (result.data && result.data.data && result.data.data.output && result.data.data.output.psn_name && (result.data.data.output.psn_name !== patient.value.name)) {
+        ElMessage({
+          message: '人证不符,请检查姓名!',
+          type: 'error',
+          duration: 2500,
+          showClose: true,
+        })
+        return
+      }
+      // 新增:调用 addWorkInjuryPatientRelation
+      try {
+        // 解析 exam_ccls 字段
+        let QualificationId = ''
+        let injury_part_desc = ''
+        let visit_type = ''
+        if (result.data.data.output.exam_ccls) {
+          // 格式:^工伤医疗费资格审核信息ID|受伤部位信息描述|就诊类型^
+          const match = result.data.data.output.exam_ccls.match(/^\^?(.*?)\|(.*?)\|(.*?)\^?$/)
+          if (match) {
+            QualificationId = match[1]
+            injury_part_desc = match[2]
+            visit_type = match[3]
+          }
+        }
+        const responseTwo = await fetch('http://130.150.161.72:9206/thyy/api/public/injury/addWorkInjuryPatientRelation', {
+          method: 'POST',
+          headers: {
+            'Content-Type': 'application/json',
+          },
+          body: JSON.stringify({
+            inpatient_no: patient.value.inpatientNo,
+            admiss_times: patient.value.admissTimes,
+            psn_no: result.data.data.output.psn_no,
+            emp_no: result.data.data.output.emp_no,
+            emp_name: result.data.data.output.emp_name,
+            certno: result.data.data.output.certno,
+            psn_name: result.data.data.output.psn_name,
+            gend: result.data.data.output.gend,
+            age: result.data.data.output.age,
+            psn_type: result.data.data.output.psn_type,
+            insu_admdvs: result.data.data.output.insu_admdvs,
+            inhosp_stas: result.data.data.output.inhosp_stas,
+            trt_chk_rslt: result.data.data.output.trt_chk_rslt,
+            exam_ccls: result.data.data.output.exam_ccls,
+            certificate_type: result.data.data.output.certificate_type,
+            birthday: result.data.data.output.birthday,
+            QualificationId,
+            injury_part_desc,
+            visit_type
+          }),
+        })
+        const resultTwo = await responseTwo.json()
+        if (!(resultTwo && resultTwo.code === 1)) {
+          ElMessage({
+            message: '本地录入工伤社保卡信息失败',
+            type: 'error',
+            duration: 2500,
+            showClose: true,
+          })
+          return
+        }
+      } catch (e) {
+        ElMessage({
+          message: '本地录入工伤社保卡信息失败',
+          type: 'error',
+          duration: 2500,
+          showClose: true,
+        })
+        return
+      }
+      injurySicardResult.value = result.data
+      patient.value.mdtrtCertType = 'injurySicard'
+      patient.value.readCardResult = injurySicardResult.value
+      patient.value.readCardBizType = '01103'
+      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()
+  }
+}
+
 onActivated(() => {
   selectUnhandledApplies().then((res) => {
     allApplies.value = res
@@ -440,6 +757,36 @@ function getStatusFlag(status, patNo) {
       return `<span style="color: red">${patNo}</span>`
   }
 }
+
+// 获取当前时间,格式为YYYYMMDDHH24MISS
+function getCurrentDateTimeStr() {
+  const now = new Date()
+  const pad = (n) => n < 10 ? '0' + n : n
+  return (
+    now.getFullYear().toString() +
+    pad(now.getMonth() + 1) +
+    pad(now.getDate()) +
+    pad(now.getHours()) +
+    pad(now.getMinutes()) +
+    pad(now.getSeconds())
+  )
+}
+
+// 获取当前时间,格式为YYYY-MM-DD HH:mm:ss.SSS
+function getCurrentDateTimeForCreate() {
+  const now = new Date()
+  const pad = (n) => n < 10 ? '0' + n : n
+  const pad3 = (n) => n < 10 ? '00' + n : n < 100 ? '0' + n : n
+  return (
+    now.getFullYear().toString() + '-' +
+    pad(now.getMonth() + 1) + '-' +
+    pad(now.getDate()) + ' ' +
+    pad(now.getHours()) + ':' +
+    pad(now.getMinutes()) + ':' +
+    pad(now.getSeconds()) + '.' +
+    pad3(now.getMilliseconds())
+  )
+}
 </script>
 
 <style scoped>