Browse Source

优化查询体检报告

lighter 3 years ago
parent
commit
a77f78f26f

+ 16 - 0
src/api/physical-exam.js

@@ -1,5 +1,21 @@
 import request from '../utils/request'
 
+export function getIdCard(patientId) {
+    return request({
+        url: '/physicalCheck/getIdCard',
+        method: 'get',
+        params: {patientId},
+    })
+}
+
+export function getPhysicalCheckIndex(idCard, pageNo) {
+    return request({
+        url: '/physicalCheck/getPhysicalCheckIndex',
+        method: 'get',
+        params: {idCard, pageNo},
+    })
+}
+
 export function getPhysicalCheckResult(tjid) {
     return request({
         url: '/physicalCheck/getPhysicalCheckResult',

+ 11 - 1
src/router/index.js

@@ -109,7 +109,17 @@ export const constantRoutes = [
     meta: { title: '报告详情' },
   },
   {
-    path: '/physicalExamination',
+    path: '/selectPhysicalExamPatient',
+    component: () => import('../views/hospital-service/physical-exam/PhysicalExamPatient.vue'),
+    meta: { title: '选择就诊人' },
+  },
+  {
+    path: '/physicalExamIndex/:patientId',
+    component: () => import('../views/hospital-service/physical-exam/PhysicalExamIndex.vue'),
+    meta: { title: '体检报告' },
+  },
+  {
+    path: '/physicalExamination/:tjid?',
     component: () => import('../views/hospital-service/physical-exam/PhysicalExamination.vue'),
     meta: { title: '体检报告' },
   },

+ 21 - 0
src/store/index.js

@@ -17,6 +17,10 @@ export default createStore({
     covidExamIndexes: [],
     currentBook: {},
     yjReqNo: null,
+    physicalExamNextPage: 1,
+    physicalExamListFinished: false,
+    physicalExamIndexes: [],
+    currentTjid: null,
   },
   mutations: {
     SET_LOADING: (state, payload) => (state.loading = payload),
@@ -31,6 +35,11 @@ export default createStore({
     SET_COVIDEXAMINDEXES: (state, payload) => (state.covidExamIndexes = payload),
     SET_CURRENTBOOK: (state, payload) => (state.currentBook = payload),
     SET_YJREQNO: (state, payload) => (state.yjReqNo = payload),
+    SET_PHYSICALEXAMNEXTPAGE: (state, payload) => (state.physicalExamNextPage = payload),
+    SET_PHYSICALEXAMLISTFINISHED: (state, payload) => (state.physicalExamListFinished = payload),
+    SET_PHYSICALEXAMINDEXES: (state, payload) => (state.physicalExamIndexes = payload),
+    SET_CURRENTTJID: (state, payload) => (state.currentTjid = payload),
+
   },
   actions: {
     SET_LOADING({ commit }, payload) {
@@ -69,5 +78,17 @@ export default createStore({
     SET_YJREQNO({ commit }, payload) {
       commit('SET_YJREQNO', payload)
     },
+    SET_PHYSICALEXAMNEXTPAGE({ commit }, payload) {
+      commit('SET_PHYSICALEXAMNEXTPAGE', payload)
+    },
+    SET_PHYSICALEXAMLISTFINISHED({ commit }, payload) {
+      commit('SET_PHYSICALEXAMLISTFINISHED', payload)
+    },
+    SET_PHYSICALEXAMINDEXES({ commit }, payload) {
+      commit('SET_PHYSICALEXAMINDEXES', payload)
+    },
+    SET_CURRENTTJID({ commit }, payload) {
+      commit('SET_CURRENTTJID', payload)
+    }
   },
 })

+ 1 - 1
src/views/hospital-service/HospitalServiceHome.vue

@@ -46,7 +46,7 @@
           <img src="../../assets/hospital-service/wenjuandiaocha.png" />
           <div class="icon-label">问卷调查</div>
         </van-col>
-        <van-col span="6" @click="routeTo('/physicalExamination')">
+        <van-col span="6" @click="routeTo(filterPath('/physicalExamIndex', '/selectPhysicalExamPatient'))">
           <img src="../../assets/hospital-service/tijianbaogao.png" />
           <div class="icon-label">体检报告</div>
         </van-col>

+ 99 - 0
src/views/hospital-service/physical-exam/PhysicalExamIndex.vue

@@ -0,0 +1,99 @@
+<template>
+  <window-size>
+    <van-field v-model="idCardOrTjid" center label="身份证/体检id" placeholder="请输入身份证/体检id">
+      <template #button>
+        <van-button size="small" type="primary" icon="search" @click="handleClickSearch">查询</van-button>
+      </template>
+    </van-field>
+
+      <van-list :style="listBoxStyle" id="listWrapper" v-model:loading="listLoading" :finished="listFinished" finished-text="没有更多了" @load="onLoadingList">
+        <van-cell v-for="item in examIndexes" :key="item.条码号" :title="'体检id:' + item.条码号" :value="item.checkTime"
+                  :label="item.工作单位" center clickable @click="handleClickIndex(item.条码号)"></van-cell>
+      </van-list>
+
+  </window-size>
+</template>
+<script setup lang="ts">
+import {getIdCard, getPhysicalCheckIndex} from '../../../api/physical-exam'
+import {RouteParamValue, useRouter} from "vue-router";
+import {onMounted, ref, Ref} from "vue";
+import {useStore} from "vuex";
+
+const store: object = useStore();
+const router: object = useRouter();
+const patientId: string | RouteParamValue[] = router.currentRoute.value.params.patientId;
+
+const listBoxStyle: object = {
+  height: store.state.windowSize.h - 100 + 'px',
+  overflowY: 'scroll'
+}
+
+const idCardOrTjid: Ref<string> = ref();
+const idCardTemp: Ref<string> = ref();
+const nextPage: Ref<number> = ref(1);
+
+const listLoading: Ref<boolean> = ref(false);
+const listFinished: Ref<boolean> = ref(false);
+const examIndexes: Ref<[]> = ref([]);
+
+const onLoadingList = (): void => {
+  if (idCardOrTjid.value) {
+    fetchIndexData()
+  } else {
+    listLoading.value = false
+  }
+};
+
+const handleClickSearch = (): void => {
+  if (idCardOrTjid.value !== idCardTemp.value) {
+    listFinished.value = false
+    nextPage.value = 1
+    examIndexes.value = []
+  }
+  if (listFinished.value) {
+    return
+  }
+  idCardTemp.value = idCardOrTjid.value
+
+  if (idCardOrTjid.value.trim().length > 15) {
+    fetchIndexData()
+  } else {
+    handleClickIndex(idCardOrTjid.value)
+  }
+}
+
+const fetchIndexData = (): void => {
+  getPhysicalCheckIndex(idCardOrTjid.value, nextPage.value).then(index => {
+    listLoading.value = false
+    listFinished.value = index.pageInfo.nextPage === 0;
+    examIndexes.value = examIndexes.value.concat(index.rows)
+    if (index.pageInfo.nextPage > 0) {
+      nextPage.value = index.pageInfo.nextPage
+      store.commit('SET_PHYSICALEXAMNEXTPAGE', nextPage.value)
+    }
+    store.commit('SET_PHYSICALEXAMLISTFINISHED', listFinished.value)
+    store.commit('SET_PHYSICALEXAMINDEXES', examIndexes.value)
+  });
+}
+
+const handleClickIndex = (tjid:string): void => {
+  store.commit('SET_CURRENTTJID', tjid)
+  router.push('/physicalExamination/' + tjid)
+}
+
+onMounted((): void => {
+  getIdCard(patientId).then(res => {
+    idCardOrTjid.value = res
+  })
+  nextPage.value = store.state.physicalExamNextPage
+  examIndexes.value = store.state.physicalExamIndexes
+  listFinished.value = store.state.physicalExamListFinished
+  const currentTjid = store.state.currentTjid
+  if (currentTjid && examIndexes.value.length > 0) {
+    const currentIndex = examIndexes.value.findIndex((item) => {
+      return item['条码号'] === currentTjid
+    })
+    document.getElementById('listWrapper').scrollTop = 66 * currentIndex - 100
+  }
+})
+</script>

+ 5 - 0
src/views/hospital-service/physical-exam/PhysicalExamPatient.vue

@@ -0,0 +1,5 @@
+<template>
+  <window-size>
+    <select-card to="physicalExamIndex"></select-card>
+  </window-size>
+</template>

+ 12 - 27
src/views/hospital-service/physical-exam/PhysicalExamination.vue

@@ -1,16 +1,11 @@
 <template>
   <window-size>
-    <van-field ref="tjidRef" v-model="tjid" center label="体检id" placeholder="请输入体检id">
-      <template #button>
-        <van-button size="small" type="primary" icon="search" @click="fetchResult">查询</van-button>
-      </template>
-    </van-field>
-    <div style="border-bottom: 1px solid cornflowerblue">
-    </div>
     <van-empty description="暂无数据" v-show="!examPackageData.checkItems"></van-empty>
-    <van-cell v-for="item in examPackageData.checkItems" :title="item.name" :value="item.checkTime" is-link
+    <div style="height: 5px"></div>
+    <van-tag type="success" size="large" v-show="examPackageData.checkItems" round plain>已发布体检</van-tag>
+    <van-cell v-for="item in examPackageData.checkItems" :title="item.体检单元名称" :value="item.checkTime" is-link
               @click="handleClickExamItem(item)"></van-cell>
-    <van-cell v-show="examPackageData.checkItems" title="体检总结" is-link @click="showSummary"></van-cell>
+    <van-cell v-show="examPackageData.summary" title="体检总结" is-link @click="showSummary"></van-cell>
 
     <div class="exam-item-result" v-show="currentExamTitle">
       <van-nav-bar :title="currentExamTitle" left-text="返回" left-arrow @click-left="currentExamTitle = null"
@@ -58,39 +53,26 @@
 <script setup lang="ts">
 import {onMounted, ref, Ref} from "vue";
 import {getPhysicalCheckResult} from '../../../api/physical-exam'
-import {Dialog, Toast} from "vant";
+import {Dialog} from "vant";
 import {useStore} from "vuex";
+import {useRouter} from "vue-router";
 
+const router = useRouter()
 const store = useStore()
 const itemResultStyle = {
   height: store.state.windowSize['h'] - 48 + 'px',
   overflowY: 'auto'
 }
 
-const tjidRef = ref(null)
-
-const tjid: Ref<string> = ref()
 const examPackageData: Ref<object> = ref({})
 
-const fetchResult = (): void => {
-  if (!tjid.value) {
-    Toast({
-      message: '请输入体检id'
-    })
-    return
-  }
-  getPhysicalCheckResult(tjid.value).then(res => {
-    examPackageData.value = res
-  })
-}
-
 const currentExamTitle: Ref<string> = ref()
 const currentDiagnose: Ref<string> = ref()
 const currentExamResult: Ref<[]> = ref([])
 
 const handleClickExamItem = (checkItem: object): void => {
   checkItem.color = '#00c278'
-  currentExamTitle.value = checkItem.name
+  currentExamTitle.value = checkItem['体检单元名称']
   currentDiagnose.value = checkItem['诊断内容']
   currentExamResult.value = examPackageData.value['examResult'][currentExamTitle.value]
 }
@@ -106,7 +88,10 @@ const showSummary = (): void => {
 const showSwitchItem:Ref<boolean> = ref(false)
 
 onMounted(() => {
-  tjidRef.value.focus()
+  const tjid = <string> router.currentRoute.value.params.tjid;
+  getPhysicalCheckResult(tjid).then(res => {
+    examPackageData.value = res
+  })
 })
 
 </script>