Browse Source

完成检验检查预约功能。

lighter 4 years ago
parent
commit
4f85a93ecb

+ 8 - 0
src/api/bookable.js

@@ -8,6 +8,14 @@ export function getBookableData(tableName) {
   })
 }
 
+export function getFullScheduleOfMedicalForPlatform(data) {
+  return request({
+    url: '/bookable/getFullScheduleOfMedicalForPlatform',
+    method: 'post',
+    data,
+  })
+}
+
 export function saveBookPrescription(data) {
   return request({
     url: '/bookable/saveBookPrescription',

+ 15 - 8
src/router/index.js

@@ -157,18 +157,25 @@ export const constantRoutes = [
   },
   {
     path: '/healthCartCategory/:patientId',
-    component: () => import('../views/hospital-service/health-cart/HealthCartCategory.vue'),
-    meta: { title: '自助类别' },
+    component: () => import('../views/hospital-service/health-cart/ExaminationCategory.vue'),
+    meta: { title: '类别选择' },
   },
   {
-    path: '/physicalExaminationPackage/:patientId',
-    component: () => import('../views/hospital-service/health-cart/PhysicalExamination.vue'),
-    meta: { title: '检查项目' },
+    path: '/bookableExaminations/:flag/:patientId',
+    component: () => import('../views/hospital-service/health-cart/BookableExaminations.vue'),
+    meta: { title: '可预约项目' },
   },
   {
-    path: '/vaccine/:patientId',
-    component: () => import('../views/hospital-service/health-cart/ChemicalExamination.vue'),
-    meta: { title: '检验项目' },
+    path: '/selectBookDate',
+    name: 'selectBookDate',
+    component: () => import('../views/hospital-service/health-cart/SelectBookDate.vue'),
+    meta: { title: '可预约时间' },
+  },
+  {
+    path: '/bookExam',
+    name: 'bookExam',
+    component: () => import('../views/hospital-service/health-cart/BookExam.vue'),
+    meta: { title: '预约详情' },
   },
   {
     path: '/selectCovidBranch/:patientId',

+ 5 - 0
src/store/index.js

@@ -13,6 +13,7 @@ export default createStore({
     currentExamDate: null,
     examDateRange: [],
     examIndexArray: [],
+    currentBook: {},
   },
   mutations: {
     SET_LOADING: (state, payload) => (state.loading = payload),
@@ -23,6 +24,7 @@ export default createStore({
     SET_CURRENTEXAMDATE: (state, payload) => (state.currentExamDate = payload),
     SET_EXAMDATERANGE: (state, payload) => (state.examDateRange = payload),
     SET_EXAMINDEXARRAY: (state, payload) => (state.examIndexArray = payload),
+    SET_CURRENTBOOK: (state, payload) => (state.currentBook = payload),
   },
   actions: {
     SET_LOADING({ commit }, payload) {
@@ -49,5 +51,8 @@ export default createStore({
     SET_EXAMINDEXARRAY({ commit }, payload) {
       commit('SET_EXAMINDEXARRAY', payload)
     },
+    SET_CURRENTBOOK({ commit }, payload) {
+      commit('SET_CURRENTBOOK', payload)
+    },
   },
 })

+ 9 - 0
src/utils/check-patient-id.js

@@ -30,3 +30,12 @@ export function getLocalOpenId() {
   openId = openId ? openId : localStorage.openId
   return openId
 }
+
+export function getPatientNameByPatientId(patientId) {
+  const cards = store.state.patientCards
+  for (let i = 0; i < cards.length; i++) {
+    if (cards[i].patientId === patientId) {
+      return cards[i].name
+    }
+  }
+}

+ 2 - 2
src/utils/request.js

@@ -3,8 +3,8 @@ import { Toast, Dialog } from 'vant'
 import store from '../store/index'
 
 const service = axios.create({
-  // baseURL: 'http://172.16.30.26:8805/wxserver/', // dev
-  baseURL: 'http://218.104.151.241:8805/wxserver', // prod
+  baseURL: 'http://172.16.30.26:8805/wxserver/', // dev
+  // baseURL: 'http://218.104.151.241:8805/wxserver', // prod
   withCredentials: true,
   timeout: 0,
 })

+ 1 - 4
src/views/hospital-service/appointment/SelectDoctorAndDate.vue

@@ -23,7 +23,7 @@
       </van-grid-item>
     </van-grid>
     <div style="height: 5px"></div>
-    <van-tag type="primary" plain style="margin-left: 5px">{{ selectDate }}</van-tag>
+    <van-tag type="primary" plain style="margin-left: 5px">{{ data.dateSelected }}</van-tag>
     <div style="height: 5px"></div>
     <div v-for="(item, index) in data.doctorSources" :key="index">
       <van-cell center :title="item.doctorName + ' | ' + item.chargeType" is-link @click="toDoctorArangement(item)">
@@ -68,7 +68,6 @@ export default {
     }
     const router = useRouter()
     const deptCode = router.currentRoute.value.params.deptCode
-    const selectDate = ref('')
     const data = reactive({
       currentIndex: 0,
       oneWeekText: getOneWeekText(),
@@ -103,7 +102,6 @@ export default {
         date: data.dateSelected,
         deptCode: deptCode,
       }
-      selectDate.value = param.date
       getDoctorSources(param)
         .then((res) => {
           data.doctorSources = res
@@ -136,7 +134,6 @@ export default {
     })
     return {
       empty,
-      selectDate,
       deptCode,
       getOneWeekText,
       handleClickDate,

+ 32 - 0
src/views/hospital-service/health-cart/BookExam.vue

@@ -0,0 +1,32 @@
+<template>
+  <window-size>
+    <van-cell title="项目名称" :value="bookItem.name"></van-cell>
+    <van-cell title="执行科室" :value="bookItem.execUnitName"></van-cell>
+    <van-cell title="预约人" :value="bookItem.patientName"></van-cell>
+    <van-cell title="预约日期" :value="bookItem.recordDate"></van-cell>
+    <van-cell title="预约时间段" :value="bookItem.beginTime + ' - ' + bookItem.endTime"></van-cell>
+    <div style="height: 8px"></div>
+    <van-button block type="primary" icon="passed" @click="executeBook">执行预约</van-button>
+  </window-size>
+</template>
+
+<script>
+import { Toast } from 'vant'
+import { saveBookPrescription } from '../../../api/bookable'
+import router from '../../../router'
+export default {
+  setup() {
+    const bookItem = router.currentRoute.value.params
+    const executeBook = () => {
+      saveBookPrescription(bookItem).then(() => {
+        Toast.success('自助开单成功。')
+        router.push('/unPaidList/' + bookItem.patientId)
+      })
+    }
+    return {
+      bookItem,
+      executeBook,
+    }
+  },
+}
+</script>

+ 67 - 0
src/views/hospital-service/health-cart/BookableExaminations.vue

@@ -0,0 +1,67 @@
+<template>
+  <window-size>
+    <van-field v-model="searchContent" label="检索" placeholder="请输入项目名称" left-icon="search"></van-field>
+    <van-empty v-if="examItems.length === 0" description="暂时没有可以预约的项目"></van-empty>
+    <div v-else :style="scrollStyle">
+      <van-cell
+        v-for="item in cptExamItems.slice((currentPage - 1) * pageSize, currentPage * pageSize)"
+        :key="item.code"
+        :title="item.name"
+        is-link
+        :value="item.execUnitName"
+        @click="routeToSelectDate(item)"
+      ></van-cell>
+      <van-pagination v-model="currentPage" :total-items="cptExamItems.length" :items-per-page="10" />
+    </div>
+  </window-size>
+</template>
+
+<script>
+import { computed, onMounted, ref } from 'vue'
+import { getBookableData } from '../../../api/bookable'
+import router from '../../../router'
+import { getPatientNameByPatientId } from '../../../utils/check-patient-id'
+import store from '../../../store'
+export default {
+  setup() {
+    const windowSize = store.state.windowSize
+    const scrollStyle = {
+      marginTop: '4px',
+      height: windowSize.h - 140 + 'px',
+      overflowY: 'auto',
+    }
+    const currentPage = ref(1)
+    const pageSize = 20
+    const flag = router.currentRoute.value.params.flag
+    const patientId = router.currentRoute.value.params.patientId
+    const tableName = flag === 'jc' ? 'jc_zd_item' : 'jy_zd_item'
+    const searchContent = ref('')
+    const examItems = ref([])
+    const cptExamItems = computed(() => {
+      return examItems.value.filter((item) => {
+        return item.name.indexOf(searchContent.value) !== -1
+      })
+    })
+    const routeToSelectDate = (item) => {
+      item.patientId = patientId
+      item.patientName = getPatientNameByPatientId(patientId)
+      store.commit('SET_CURRENTBOOK', item)
+      router.push('/selectBookDate')
+    }
+    onMounted(() => {
+      getBookableData(tableName).then((res) => {
+        examItems.value = res
+      })
+    })
+    return {
+      scrollStyle,
+      currentPage,
+      pageSize,
+      searchContent,
+      examItems,
+      cptExamItems,
+      routeToSelectDate,
+    }
+  },
+}
+</script> 

+ 0 - 34
src/views/hospital-service/health-cart/ChemicalExamination.vue

@@ -1,34 +0,0 @@
-<template>
-  <window-size>
-    <van-field v-model="searchContent" label="检索" placeholder="请输入检验名称" left-icon="search"></van-field>
-    <div v-for="item in cptExamItems" :key="item.code">
-      <van-cell :title="item.name" is-link :label="'执行科室:' + item.execUnitName"></van-cell>
-    </div>
-  </window-size>
-</template>
-
-<script>
-import { computed, onMounted, ref } from 'vue'
-import { getBookableData } from '../../../api/bookable'
-export default {
-  setup() {
-    const tableName = 'jy_zd_item'
-    const searchContent = ref('')
-    const examItems = ref([])
-    const cptExamItems = computed(() => {
-      return examItems.value.filter((item) => {
-        return item.name.indexOf(searchContent.value) !== -1
-      })
-    })
-    onMounted(() => {
-      getBookableData(tableName).then((res) => {
-        examItems.value = res
-      })
-    })
-    return {
-      searchContent,
-      cptExamItems,
-    }
-  },
-}
-</script> 

+ 2 - 2
src/views/hospital-service/health-cart/HealthCartCategory.vue → src/views/hospital-service/health-cart/ExaminationCategory.vue

@@ -1,7 +1,7 @@
 <template>
   <window-size>
-    <van-cell title="检查" is-link :to="'/physicalExaminationPackage/' + patientId"></van-cell>
-    <van-cell title="检验" is-link :to="'/vaccine/' + patientId"></van-cell>
+    <van-cell title="检查" is-link :to="'/bookableExaminations/jc/' + patientId"></van-cell>
+    <van-cell title="检验" is-link :to="'/bookableExaminations/jy/' + patientId"></van-cell>
   </window-size>
 </template>
 

+ 0 - 45
src/views/hospital-service/health-cart/PhysicalExamination.vue

@@ -1,45 +0,0 @@
-<template>
-  <window-size>
-    <van-field v-model="searchContent" label="检索" placeholder="请输入检查名称" left-icon="search"></van-field>
-    <div v-for="item in cptExamItems" :key="item.code">
-      <van-cell :title="item.name" is-link :label="'执行科室:' + item.execUnitName" @click="bookExam(item)"></van-cell>
-    </div>
-  </window-size>
-</template>
-
-<script>
-import { computed, onMounted, ref } from 'vue'
-import { getBookableData, saveBookPrescription } from '../../../api/bookable'
-import router from '../../../router'
-import { Toast } from 'vant'
-export default {
-  setup() {
-    const patientId = router.currentRoute.value.params.patientId
-    const tableName = 'jc_zd_item'
-    const searchContent = ref('')
-    const examItems = ref([])
-    const cptExamItems = computed(() => {
-      return examItems.value.filter((item) => {
-        return item.name.indexOf(searchContent.value) !== -1
-      })
-    })
-    const bookExam = (item) => {
-      item.patientId = patientId
-      saveBookPrescription(item).then(() => {
-        Toast.success('自助开单成功。')
-        router.push('/unPaidList/' + patientId)
-      })
-    }
-    onMounted(() => {
-      getBookableData(tableName).then((res) => {
-        examItems.value = res
-      })
-    })
-    return {
-      searchContent,
-      cptExamItems,
-      bookExam,
-    }
-  },
-}
-</script> 

+ 115 - 0
src/views/hospital-service/health-cart/SelectBookDate.vue

@@ -0,0 +1,115 @@
+<template>
+  <window-size>
+    <van-grid direction="horizontal" :column-num="7">
+      <van-grid-item v-for="item in data.oneWeekText" :key="item" :text="'周' + item" />
+    </van-grid>
+    <van-grid direction="horizontal" :column-num="7">
+      <van-grid-item v-for="(item, index) in data.nextSevenDate" :key="index">
+        <van-badge :content="hasSource(index)" :color="badgeColor(index)">
+          <van-button
+            :disabled="disabledBtn(index)"
+            :type="getType(index)"
+            size="small"
+            round
+            @click="handleClickDate(index)"
+            >{{ item.date }}</van-button
+          >
+        </van-badge>
+      </van-grid-item>
+    </van-grid>
+    <div style="height: 5px"></div>
+    <van-tag type="primary" plain style="margin-left: 5px">{{ data.dateSelected }}</van-tag>
+    <div style="height: 5px"></div>
+    <van-empty description="暂无可预约项目" v-if="currentSources.length === 0" />
+    <div v-else :style="scrollStyle">
+      <van-cell
+        v-for="(item, index) in currentSources"
+        :key="index"
+        :title="item.jcxm"
+        :value="item.deptName"
+        :label="'时段:' + item.beginTime + ' - ' + item.endTime"
+        is-link
+        center
+        @click="routeToBookDetail(item)"
+      ></van-cell>
+    </div>
+  </window-size>
+</template>
+
+<script>
+import { onMounted, reactive, ref } from 'vue'
+import router from '../../../router'
+import { getFullScheduleOfMedicalForPlatform } from '../../../api/bookable'
+import { getOneWeekText, getNextSevenDate } from '../../../utils/date'
+import store from '../../../store'
+
+export default {
+  setup() {
+    const windowSize = store.state.windowSize
+    const scrollStyle = {
+      height: windowSize.h - 190 + 'px',
+      overflowY: 'auto',
+    }
+    const bookItem = store.state.currentBook
+    const currentSources = ref([])
+    const data = reactive({
+      currentIndex: 0,
+      oneWeekText: getOneWeekText(),
+      nextSevenDate: getNextSevenDate(),
+      sources: {},
+      statuses: [],
+      dateSelected: '',
+    })
+    const getType = (index) => {
+      return index === data.currentIndex ? 'primary' : 'default'
+    }
+    const hasSource = (index) => {
+      return data.statuses[index] === 1 ? '有' : '无'
+    }
+    const badgeColor = (index) => {
+      return data.statuses[index] === 1 ? 'green' : 'red'
+    }
+    const disabledBtn = (index) => {
+      return data.statuses[index] === 0
+    }
+    const handleClickDate = (index) => {
+      data.currentIndex = index
+      data.dateSelected = data.nextSevenDate[index].fullDate
+      currentSources.value = data.sources[data.dateSelected] || []
+    }
+
+    const routeToBookDetail = (item) => {
+      bookItem.recordDate = item.recordDate
+      bookItem.beginTime = item.beginTime
+      bookItem.endTime = item.endTime
+      bookItem.id = item.id
+      router.push({ name: 'bookExam', params: bookItem })
+    }
+
+    onMounted(() => {
+      getFullScheduleOfMedicalForPlatform(bookItem).then((res) => {
+        data.sources = res.sources
+        data.statuses = res.statuses
+        for (let i = 0; i < 7; i++) {
+          handleClickDate(i)
+          if (res.statuses[i] === 1) {
+            break
+          }
+        }
+      })
+    })
+
+    return {
+      scrollStyle,
+      data,
+      getType,
+      hasSource,
+      badgeColor,
+      disabledBtn,
+      routeToBookDetail,
+      handleClickDate,
+      currentSources,
+    }
+  },
+}
+</script>