Browse Source

预约核酸检测前需要挂简易门诊号

lighter 2 years ago
parent
commit
cb3eb2fb3e

+ 8 - 0
src/api/order-covid-exam.js

@@ -1,5 +1,13 @@
 import request from '../utils/request'
 
+export function selectValidRegForCovidExam(patNo) {
+  return request({
+    url: '/orderCovid/selectValidRegForCovidExam',
+    method: 'get',
+    params: { patNo},
+  })
+}
+
 export function savePrescription(patientId, type) {
   return request({
     url: '/orderCovid/savePrescription',

+ 8 - 2
src/utils/date.js

@@ -1,3 +1,4 @@
+const WEEKS = ['日', '一', '二', '三', '四', '五', '六']
 export function getDate() {
   const date = new Date()
   const year = date.getFullYear()
@@ -12,6 +13,12 @@ export function getDate() {
   return year + '-' + month + '-' + day
 }
 
+export function getTodayAndWeek() {
+  const today = getDate()
+  const week = '星期' + WEEKS[new Date().getDay()]
+  return { today, week }
+}
+
 export function formatDate(date) {
   const year = date.getFullYear()
   let month = date.getMonth() + 1
@@ -72,11 +79,10 @@ export function getAWeekFromNow() {
 
 export function getOneWeekText() {
   const day = new Date().getDay()
-  const weeks = ['日', '一', '二', '三', '四', '五', '六']
   const arr = new Array(7)
   for (let index = 0; index < 7; index++) {
     let tempDay = (day + index) % 7
-    arr[index] = weeks[tempDay]
+    arr[index] = WEEKS[tempDay]
   }
   return arr
 }

+ 8 - 1
src/views/hospital-service/appointment/PayAppointmentFee.vue

@@ -49,6 +49,7 @@ import { getLocalOpenId } from '../../../utils/check-patient-id'
 import { wxPay } from '../../../utils/wx-pay'
 import { Toast } from 'vant'
 import router from '../../../router'
+import {savePrescription} from "../../../api/order-covid-exam";
 export default {
   name: 'PayAppointmentFee',
   setup() {
@@ -71,7 +72,13 @@ export default {
       wxPay(param)
         .then((result) => {
           Toast.success(result)
-          router.push('/hospitalService')
+          if (data.appointment.extra === 'covid19-exam') {
+            savePrescription(data.appointment.patientId, 1).then(() => {
+              router.push(`/unPaidList/${data.appointment.patientId}`)
+            })
+          } else {
+            router.push('/hospitalService');
+          }
         })
         .catch((result) => {
           Toast.success(result)

+ 65 - 0
src/views/hospital-service/health-cart/ExaminationCategory.vue

@@ -2,17 +2,82 @@
   <window-size>
     <van-cell title="检查" is-link :to="'/bookableExaminations/jc/' + patientId"></van-cell>
     <van-cell title="检验" is-link :to="'/bookableExaminations/jy/' + patientId"></van-cell>
+    <van-cell title="核酸检测" is-link @click="beforeCovidExam"></van-cell>
   </window-size>
 </template>
 
 <script>
 import { useRouter } from 'vue-router'
+import {Dialog} from "vant";
+import store from "../../../store";
+import {getDoctorSources} from "../../../api/appointment.js";
+import {getTodayAndWeek} from "../../../utils/date";
+import {selectValidRegForCovidExam,savePrescription} from "../../../api/order-covid-exam";
+import {getPatientNameByPatientId} from "../../../utils/check-patient-id";
 export default {
   setup() {
     const router = useRouter()
     const patientId = router.currentRoute.value.params.patientId
+    const dateAndWeek = getTodayAndWeek()
+    const beforeCovidExam = () => {
+      Dialog.confirm({
+        title: '温馨提示',
+        message: '核酸检测前需要挂号简易门诊,是否继续?',
+        confirmButtonText: '继续',
+        cancelButtonText: '取消'
+      }).then(() => {
+        getTodaySimpleClinic()
+      }).catch(() => {
+      })
+    }
+
+    const getTodaySimpleClinic = () => {
+      selectValidRegForCovidExam(patientId).then(res => {
+        if (res === 0) {
+          const params = {date: dateAndWeek.today, deptCode: '3110000'}
+          getDoctorSources(params).then(res2 => {
+            simpleClinic(res2[0])
+          }).catch(() => {
+            Dialog.alert({
+              title: '提示',
+              message: '没有获取到今日简易门诊号源,请稍后再试。',
+            }).then(() => {})
+          })
+        } else {
+          savePrescription(patientId, 1).then(() => {
+            router.push(`/unPaidList/${patientId}`)
+          })
+        }
+      })
+    }
+
+    const simpleClinic = (row) => {
+      const appointment = {
+        leftNum: row.leftNum,
+        doctorName: '自助',
+        doctorTitle: '无',
+        ampm: '全天',
+        fee: row.fee,
+        doctorCode: '99999',
+        chargeType: '简易门诊号',
+        deptCode: '3110000',
+        deptName: '简易门诊',
+        date: dateAndWeek.today,
+        week: dateAndWeek.week,
+        startTime: '00:00',
+        endTime: '00:00',
+        patientId: patientId,
+        patientName: getPatientNameByPatientId(patientId),
+        extra: 'covid19-exam',
+        mzyRequestId: row.mzyRequestId
+      }
+      store.commit('SET_APPOINTMENTINFO', appointment)
+      router.push('/payAppointmentFee')
+    }
+
     return {
       patientId,
+      beforeCovidExam,
     }
   },
 }

+ 1 - 6
src/views/hospital-service/physical-exam/PhysicalExamIndex.vue

@@ -19,7 +19,7 @@
   </window-size>
 </template>
 <script setup lang="ts">
-import {getIdCard, getPhysicalCheckIndex} from '../../../api/physical-exam.js'
+import {getPhysicalCheckIndex} from '../../../api/physical-exam.js'
 import {RouteParamValue, useRouter} from "vue-router";
 import {onMounted, ref, Ref} from "vue";
 import {useStore} from "vuex";
@@ -113,11 +113,6 @@ const judgeWeChatBrowser = () => {
 
 onMounted((): void => {
   isWxBrowser.value = judgeWeChatBrowser()
-  if (isWxBrowser.value && !idCard.value) {
-    getIdCard({patNo: patientId, openId: localStorage.getItem('openId')}).then(res => {
-      idCard.value = res.toString()
-    })
-  }
   nextPage.value = store.state.physicalExamNextPage;
   examIndexes.value = store.state.physicalExamIndexes
   listFinished.value = store.state.physicalExamListFinished