Browse Source

添加日志分析功能

lighter 3 years ago
parent
commit
784a876400

+ 9 - 0
src/api/medical-insurance/si-log.js

@@ -0,0 +1,9 @@
+import request from '../../utils/request'
+
+export function selectSiLogs(data) {
+  return request({
+    url: '/siLog/selectSiLogs',
+    method: 'post',
+    data,
+  })
+}

+ 2 - 2
src/data/index.js

@@ -280,7 +280,7 @@ export const decTypes = [
 ]
 
 export const infnos = {
-  zy: [
+  1: [
     { code: '2401', name: '入院登记' },
     { code: '2404', name: '撤销入院登记' },
     { code: '2302', name: '撤销费用上传' },
@@ -291,7 +291,7 @@ export const infnos = {
     { code: '2305', name: '撤销出院结算' },
     { code: '4101', name: '结算清单上传' },
   ],
-  mz: [
+  2: [
     { code: '2503', name: '慢特病备案' },
     { code: '2504', name: '撤销慢特病备案' },
     { code: '2201', name: '门诊挂号' },

+ 101 - 5
src/views/medical-insurance/allpatient/LogAnalyse.vue

@@ -2,10 +2,10 @@
   <el-container>
     <el-header style="height: 35px; margin-top: 8px">
       <el-select v-model="headerParam.logType" style="width: 80px" @change="headerParam.infno = null">
-        <el-option label="住院" value="zy"></el-option>
-        <el-option label="门诊" value="mz"></el-option>
+        <el-option label="住院" :value="1"></el-option>
+        <el-option label="门诊" :value="2"></el-option>
       </el-select>
-      <el-select v-model="headerParam.infno" style="width: 135px" clearable>
+      <el-select v-model="headerParam.infno" style="width: 145px" clearable>
         <el-option v-for="itm in currentInfnos" :key="itm.code" :value="itm.code" :label="itm.name"></el-option>
       </el-select>
       <el-date-picker
@@ -17,9 +17,38 @@
         end-placeholder="结束日期"
         style="width: 220px"
       ></el-date-picker>
+      <el-divider direction="vertical"></el-divider>
+      <el-button type="primary" icon="el-icon-search" @click="fetchSiLogs">检索</el-button>
     </el-header>
     <el-main>
-      <el-table :data="logs"></el-table>
+      <el-table :data="logs" :height="tableHeight" stripe highlight-current-row @row-dblclick="formatBodyResult">
+        <el-table-column prop="msgid" label="报文ID" width="230"></el-table-column>
+        <el-table-column prop="insuplcAdmdvs" label="参保区划" width="60"></el-table-column>
+        <el-table-column prop="opter" label="操作员" width="70"></el-table-column>
+        <el-table-column prop="createDatetime" label="操作时间" width="130"></el-table-column>
+        <el-table-column prop="patNo" label="患者ID" width="70"></el-table-column>
+        <el-table-column prop="times" label="次数" width="50"></el-table-column>
+        <el-table-column label="报文原文">
+          <template #default="scope">
+            <div class="ellipsis-text" :title="scope.row.body">{{ scope.row.body }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="返回原文">
+          <template #default="scope">
+            <div class="ellipsis-text" :title="scope.row.result">{{ scope.row.result }}</div>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-drawer v-model="showFormatModal" :with-header="false" :size="drawerWidth">
+        <div :style="formattedStyle">
+          <div :style="formattedChildStyle">
+            <pre :style="preStyle" class="formatted-body">{{ formattedBody }}</pre>
+          </div>
+          <div :style="formattedChildStyle">
+            <pre :style="preStyle" class="formatted-result">{{ formattedResult }}</pre>
+          </div>
+        </div>
+      </el-drawer>
     </el-main>
   </el-container>
 </template>
@@ -29,12 +58,34 @@ import { computed, reactive, ref } from 'vue'
 import { useStore } from 'vuex'
 import { setlShtcuts } from '@/data/shortcuts'
 import { infnos } from '@/data/index'
+import { selectSiLogs } from '../../../api/medical-insurance/si-log'
+import { getDateRangeFormatDate } from '../../../utils/date'
 export default {
   setup() {
     const store = useStore()
     const windowSize = store.state.app.windowSize
     const tableHeight = windowSize.h - 80
     const dateRange = ref(null)
+
+    const fullWidth = window.innerWidth
+    const drawerWidth = fullWidth * 0.66
+
+    const formattedStyle = {
+      display: 'flex',
+      height: window.innerHeight + 'px',
+    }
+
+    const formattedChildStyle = {
+      width: drawerWidth / 2 - 10 + 'px',
+      padding: '0 10px 0 10px',
+    }
+
+    const preStyle = {
+      width: drawerWidth / 2 - 60 + 'px',
+      height: window.innerHeight - 50 + 'px',
+      overflowY: 'auto',
+    }
+
     const currentInfnos = computed(() => {
       return infnos[headerParam.logType]
     })
@@ -42,20 +93,65 @@ export default {
     const headerParam = reactive({
       begntime: null,
       endtime: null,
-      logType: 'zy',
+      logType: 1,
       infno: null,
     })
     const logs = ref([])
+    const showFormatModal = ref(false)
+    const formattedBody = ref(null)
+    const formattedResult = ref(null)
+    const formatBodyResult = (row) => {
+      formattedBody.value = JSON.stringify(JSON.parse(row.body), null, 2)
+      formattedResult.value = JSON.stringify(JSON.parse(row.result), null, 2)
+      showFormatModal.value = true
+    }
+
+    const fetchSiLogs = () => {
+      if (dateRange.value) {
+        const dtrge = getDateRangeFormatDate(dateRange.value)
+        headerParam.begntime = dtrge.startTime
+        headerParam.endtime = dtrge.endTime
+      }
+      selectSiLogs(headerParam).then((res) => {
+        logs.value = res
+      })
+    }
 
     return {
       tableHeight,
+      drawerWidth,
       dateRange,
+      formattedStyle,
+      formattedChildStyle,
+      preStyle,
       infnos,
       currentInfnos,
       headerParam,
       setlShtcuts,
       logs,
+      showFormatModal,
+      formattedBody,
+      formattedResult,
+      fetchSiLogs,
+      formatBodyResult,
     }
   },
 }
 </script>
+
+<style scoped>
+pre {
+  white-space: pre-wrap;
+  word-wrap: break-word;
+}
+.formatted-body {
+  background: #60a6ec8a;
+  border-radius: 8px;
+  padding: 10px;
+}
+.formatted-result {
+  background: #90da6b7a;
+  border-radius: 8px;
+  padding: 10px;
+}
+</style>