‘chenzhilei’ 1 сар өмнө
parent
commit
87323dd8f5

+ 8 - 0
src/api/appointment.js

@@ -116,4 +116,12 @@ export function getDeptPos(deptCode, ampm) {
     method: 'get',
     params: { deptCode, ampm },
   })
+}
+
+export function getRequestByTimes(data) {
+  return request({
+    url: '/appointment/getRequestByTimes',
+    method: 'post',
+    data,
+  })
 }

+ 0 - 1
src/components/select-card/index.vue

@@ -35,5 +35,4 @@ const props = defineProps({
 const cards = computed(() => {
   return store.state.patientCards
 })
-
 </script>

+ 88 - 0
src/utils/identityCard.js

@@ -0,0 +1,88 @@
+export function getGenderCodeFromIdCard(idCard) {
+    if (!idCard) return 0;
+    
+    const cleanIdCard = idCard.toString().trim();
+    
+    if (cleanIdCard.length !== 15 && cleanIdCard.length !== 18) {
+        return 0;
+    }
+    
+    let genderDigit;
+    
+    if (cleanIdCard.length === 15) {
+        genderDigit = parseInt(cleanIdCard.charAt(14));
+    } else {
+        genderDigit = parseInt(cleanIdCard.charAt(16));
+    }
+    
+    if (isNaN(genderDigit)) {
+        return 0;
+    }
+    // 1: '男',
+    //     2: '女',
+    //     0: '未知'
+    return genderDigit % 2 === 1 ? 1 : 2;
+}
+
+/**
+ * 从身份证号码获取年龄
+ * @param {string} idCard - 身份证号码
+ * @returns {number} - 年龄(周岁),如果无法计算返回-1
+ */
+export function getAgeFromIdCard(idCard) {
+    if (!idCard) return -1;
+    
+    const cleanIdCard = idCard.toString().trim();
+    
+    // 验证身份证长度
+    if (cleanIdCard.length !== 15 && cleanIdCard.length !== 18) {
+        return -1;
+    }
+    
+    let birthDateStr;
+    
+    if (cleanIdCard.length === 15) {
+        // 15位身份证:7-12位是生日,格式:YYMMDD
+        birthDateStr = '19' + cleanIdCard.substr(6, 6);
+    } else {
+        // 18位身份证:7-14位是生日,格式:YYYYMMDD
+        birthDateStr = cleanIdCard.substr(6, 8);
+    }
+    
+    // 解析生日
+    const year = parseInt(birthDateStr.substr(0, 4));
+    const month = parseInt(birthDateStr.substr(4, 2)) - 1; // 月份从0开始
+    const day = parseInt(birthDateStr.substr(6, 2));
+    
+    if (isNaN(year) || isNaN(month) || isNaN(day)) {
+        return -1;
+    }
+    
+    const birthDate = new Date(year, month, day);
+    const today = new Date();
+    
+    // 检查日期是否有效
+    if (birthDate.getFullYear() !== year || 
+        birthDate.getMonth() !== month || 
+        birthDate.getDate() !== day) {
+        return -1;
+    }
+    
+    // 计算周岁年龄
+    let age = today.getFullYear() - birthDate.getFullYear();
+    
+    // 如果今年生日还没过,年龄减1
+    const currentMonth = today.getMonth();
+    const currentDay = today.getDate();
+    
+    if (currentMonth < month || (currentMonth === month && currentDay < day)) {
+        age--;
+    }
+    
+    // 年龄合理性检查
+    if (age < 0 || age > 150) {
+        return -1;
+    }
+    
+    return age;
+}

+ 9 - 9
src/utils/validate.js

@@ -206,14 +206,14 @@ export function validateBindPatientId(card) {
   if (card.cardType === '2' && !isValidIdcard(card.cardNo)) {
     return '请填写正确的身份证号!'
   }
-  if (!isValidPhone(card.phone)) {
-    return '请填写正确的手机号!'
-  }
-  if (!card.province || !card.city || !card.district) {
-    return '请选择住址所在地区!'
-  }
-  if (!card.street) {
-    return '请填写街道、小区信息!'
-  }
+  // if (!isValidPhone(card.phone)) {
+  //   return '请填写正确的手机号!'
+  // }
+  // if (!card.province || !card.city || !card.district) {
+  //   return '请选择住址所在地区!'
+  // }
+  // if (!card.street) {
+  //   return '请填写街道、小区信息!'
+  // }
   return 'success'
 }

+ 47 - 4
src/views/hospital-service/appointment/AppointmentConfirm.vue

@@ -28,7 +28,7 @@
       <van-cell-group>
         <div v-for="item in patientCards" :key="item.patientId">
           <van-cell center icon="user-o" :label="item.patientId" clickable
-                    @click="changePatient(item.patientId)">
+                    @click="changePatient(item)">
             <template #title>
               <span class="custom-title">{{ item.name }}</span>
               &nbsp;
@@ -56,6 +56,7 @@
 import store from '@/store'
 import {computed, onMounted, ref} from 'vue'
 import {checkAppointmentRequirements, getGhFee} from '@/api/appointment'
+import {getGenderCodeFromIdCard, getAgeFromIdCard} from '@/utils/identityCard'
 import router from '@/router'
 import {showConfirmDialog, showToast} from 'vant'
 import Cookies from 'js-cookie'
@@ -66,8 +67,9 @@ const patientCards = computed(() => {
   return store.state.patientCards
 })
 
-const changePatient = (patientId) => {
-  appointment.patientId = patientId
+const changePatient = (val) => {
+  appointment.patientId = val.patientId
+  appointment.social = val.social
   queryAppointmentCost()
 }
 
@@ -88,8 +90,47 @@ const queryAppointmentCost = () => {
   })
 }
 
+const confirmAppointmentValidate = () => {
+  let sex = getGenderCodeFromIdCard()
+  let age = getAgeFromIdCard()
+  //校验男性挂妇产科/校验成年挂儿科
+  return validateSexForWomanClass(appointment.classCode,sex) && validateAgeForChildClass(appointment.classCode,age)
+}
+//校验男性挂妇产科
+const validateSexForWomanClass = (classCode,sex) => {
+  if (classCode == "04" || classCode == "05") {
+    if (sex != 2) {
+      showToast({
+        message: '男性病人无法在妇产科就诊,请重新挂号',
+        position: 'top'
+      })
+      return false
+    } else {
+      return true
+    }
+  }
+  return true;
+}
+
+//校验成年挂儿科
+const validateAgeForChildClass = (classCode,age) => {
+  if (classCode == "03") {
+    if (age > 17) {
+      showToast({
+        message: '已满18周岁成人无法在儿科就诊,请重新挂号',
+        position: 'top'
+      })
+      return false
+    } else {
+      return true
+    }
+  }
+  return true;
+}
+
 const confirmAppointment = () => {
-  const message = appointment.ampm === '夜间门诊'
+  if (confirmAppointmentValidate) {
+    const message = appointment.ampm === '夜间门诊'
       ? '夜间门诊就诊时间为17:30-21:00,如您疼痛难忍或病情紧急,请至一楼急诊科就诊。'
       : '实际看诊序号以至分诊台到诊登记为准。当天未就诊,不予退号、换号、转科,敬请谅解。'
   checkAppointmentRequirements(appointment.patientId, appointment.deptCode).then(() => {
@@ -103,6 +144,8 @@ const confirmAppointment = () => {
     }).catch(() => {
     })
   })
+  }
+  
 }
 
 function fetchPatientName() {

+ 2 - 2
src/views/hospital-service/appointment/AppointmentEntry.vue

@@ -1,8 +1,8 @@
 <template>
   <window-size>
     <van-cell title="预约挂号" is-link @click="routeTo('/appointment')" />
-    <van-cell title="夜间门诊" is-link @click="routeTo('/nightClinic')" />
-    <van-cell title="挂号管理" is-link @click="routeTo('/selectRegManagePatient')" />
+    <!-- <van-cell title="夜间门诊" is-link @click="routeTo('/nightClinic')" />
+    <van-cell title="挂号管理" is-link @click="routeTo('/selectRegManagePatient')" /> -->
   </window-size>
 </template>
 <script setup>

+ 8 - 3
src/views/hospital-service/appointment/SelectDoctorAndDate.vue

@@ -50,11 +50,16 @@
             />&nbsp;
           </template>
           <template #title>
-            <span>{{item.doctorName}} | {{item.chargeType}}</span>
+            <div>{{item.doctorName}} | {{item.chargeType}}</div>
+            <div  v-if="item.left_num == 0">当天线上号已挂完,请前往医院现场挂号</div>
           </template>
-          <template #label>
+          
+          <!-- <template #label>
             <div :style="labelStyle" v-show="item.introduction">{{ item.introduction }}</div>
-          </template>
+          </template> -->
+          <!-- <template>
+            <span  >当天线上号已挂完,请前往医院现场挂号</span>
+          </template> -->
         </van-cell>
       </div>
     </div>

+ 1 - 0
src/views/mine/appointment-record/AppointmentRecords.vue

@@ -7,6 +7,7 @@
         <van-cell center>
           <template #title>
             <div style="font-size: 12px; color: rgb(128, 128, 128)">
+              <div>就诊人:{{ item.patientName }}</div>
               <div>挂号科室:{{ item.unitName }}</div>
               <div>挂号医生:{{ item.doctorName }}</div>
               <div>挂号号别:{{ item.chargeType }}</div>

+ 10 - 6
src/views/mine/patient-id-cards/BindPatientCard.vue

@@ -23,7 +23,7 @@
     </van-cell>
     <van-field v-model="card.cardNo" :placeholder="cardNoHint"/>
     <div style="height: 5px"></div>
-    <van-field v-model="card.phone" type="tel" placeholder="请输入手机号"/>
+    <!-- <van-field v-model="card.phone" type="tel" placeholder="请输入手机号"/>
     <div style="height: 5px"></div>
     <div style="margin-bottom: 5px" v-if="correctIdCard">
       <span style="color: red; font-size: 13px; padding: 8px 0 0 8px">* {{ correctIdCardHint }}</span>
@@ -39,10 +39,10 @@
         @click="showArea = true"
     />
     <van-popup v-model:show="showArea" position="bottom">
-      <van-area :area-list="allArea" value="430105" @confirm="onConfirmArea($event.selectedOptions)" @cancel="showArea = false"/>
+      <van-area :area-list="allArea" v-model="card.areaValue" @confirm="onConfirmArea($event.selectedOptions)" @cancel="showArea = false"/>
     </van-popup>
     <van-field v-model="card.street" label="街道、小区" type="text" placeholder="请输入住址所在街道、小区"/>
-    <div style="height: 10px"></div>
+    <div style="height: 10px"></div> -->
     <van-button type="primary" block icon="checked" @click="beforeBindCard">立即绑定</van-button>
   </window-size>
   <van-dialog v-model:show="multipleCards.show" title="请选择一张就诊卡" @confirm="bindSelectCard">
@@ -111,11 +111,13 @@ const card = reactive({
   cardType: 0,
   cardNo: '',
   phone: '',
-  province: '',
-  city: '',
-  district: '',
+  province: '320000',
+  city: '321300',
+  address:'江苏省/宿迁市/沭阳县',
+  district: '321322',
   street: '',
   socialNo: '',
+  areaValue:"321322"
 })
 const cardNoHint = computed(() => {
   const type = card.cardType
@@ -129,6 +131,7 @@ const cardNoHint = computed(() => {
 })
 const showArea = ref(false)
 const onConfirmArea = (values) => {
+  
   card.province = values[0].value
   card.city = values[1].value
   card.district = values[2].value
@@ -136,6 +139,7 @@ const onConfirmArea = (values) => {
       .filter((item) => !!item)
       .map((item) => item.text)
       .join('/')
+      console.log("area",card)
   showArea.value = false
 }
 const multipleCards = reactive({

+ 6 - 6
src/views/mine/patient-id-cards/CreatePatientCard.vue

@@ -57,7 +57,7 @@
             @click="showArea = true"
         />
         <van-popup v-model:show="showArea" position="bottom">
-          <van-area :area-list="allArea" :value="defaultDistrict" @confirm="onConfirmArea" @cancel="showArea = false"/>
+          <van-area :area-list="allArea" v-model="defaultDistrict" @confirm="onConfirmArea" @cancel="showArea = false"/>
         </van-popup>
         <van-field v-model="inputInfo.street" label="街道、小区" type="text" placeholder="请输入住址所在街道、小区"/>
         &nbsp;&nbsp;&nbsp;&nbsp;<van-tag type="danger">* 13岁以下儿童建卡请填写监护人信息 *</van-tag>
@@ -92,7 +92,7 @@ const fileList = ref([])
 const disableUpload = computed(() => {
   return fileList.value.length !== 1
 })
-const defaultDistrict = ref('430105')
+const defaultDistrict = ref('321322')
 
 const uploadIdCard = (base64) => {
   readImage({content: base64}).then((res) => {
@@ -127,12 +127,12 @@ const inputInfo = reactive({
   name: null,
   socialNo: null,
   phone: null,
-  address: null,
-  province: null,
-  city: null,
-  district: null,
   street: null,
   sex: null,
+  province: '320000',
+  city: '321300',
+  address:'江苏省/宿迁市/沭阳县',
+  district: '321322',
 })
 const showInputDialog = ref(false)
 const showArea = ref(false)

+ 3 - 0
src/views/public-pages/Cashier.vue

@@ -2,6 +2,9 @@
   <window-size>
     <payment-countdown @onFinish="countdownFinished = true"></payment-countdown>
     <div class="to-be-paid-wrapper">
+      <div class="label">
+        就诊人:<span>{{createOrderRequest.patientName}}</span>
+      </div>
       <div class="label">
         收款单位:<span>沭阳铭和医院</span>
       </div>