Prechádzať zdrojové kódy

添加快速下单核酸检测功能,添加新建就诊卡功能。

lighter 4 rokov pred
rodič
commit
3688574df4

+ 0 - 8
src/api/appointment.js

@@ -86,11 +86,3 @@ export function getDoctorQrCode(doctorCode) {
     params: { doctorCode },
   })
 }
-
-export function createPayOrder(data) {
-  return request({
-    url: '/appointment/createPayOrder',
-    method: 'post',
-    data,
-  })
-}

+ 8 - 0
src/api/check-exam.js

@@ -15,3 +15,11 @@ export function checkExamDetail(orderId) {
     params: { orderId },
   })
 }
+
+export function checkIndexBySocialNo(socialNo) {
+  return request({
+    url: '/inspections/checkIndexBySocialNo',
+    method: 'get',
+    params: { socialNo },
+  })
+}

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

@@ -0,0 +1,9 @@
+import request from '../utils/request'
+
+export function savePrescription(patientId) {
+  return request({
+    url: '/orderCovid/savePrescription',
+    method: 'get',
+    params: { patientId },
+  })
+}

+ 16 - 0
src/api/patient-id-cards.js

@@ -47,3 +47,19 @@ export function relieveBindCardButCanceled(data) {
     data,
   })
 }
+
+export function readImage(data) {
+  return request({
+    url: '/analyzeIdCard/readImage',
+    method: 'post',
+    data,
+  })
+}
+
+export function readInput(data) {
+  return request({
+    url: '/analyzeIdCard/readInput',
+    method: 'post',
+    data,
+  })
+}

+ 17 - 1
src/api/wx-jsapi.js

@@ -2,8 +2,24 @@ import request from '../utils/request'
 
 export function getJsApiSHA1(url) {
   return request({
-    url: '/wechat/getJsApiSHA1',
+    url: '/wxApi/getJsApiSHA1',
     method: 'get',
     params: { url },
   })
 }
+
+export function createPayOrder(data) {
+  return request({
+    url: '/wxApi/createPayOrder',
+    method: 'post',
+    data,
+  })
+}
+
+export function updatePayStatus(tradeNo, status) {
+  return request({
+    url: '/wxApi/updatePayStatus',
+    method: 'get',
+    params: { tradeNo, status },
+  })
+}

BIN
src/assets/capture-img.png


+ 17 - 2
src/components/select-card/index.vue

@@ -16,14 +16,27 @@
     title="添加就诊人"
     :label="addCardText"
     is-link
-    to="/bindPatientCard"
+    @click="showCreatedCardMethod = true"
   ></van-cell>
   <div style="height: 10px"></div>
+
+  <van-dialog
+    v-model:show="showCreatedCardMethod"
+    title="请选择绑定方式"
+    :show-confirm-button="false"
+    show-cancel-button
+  >
+    <div style="padding: 20px">
+      <van-button type="primary" block to="/bindPatientCard">绑定就诊卡</van-button>
+      <div style="height: 10px"></div>
+      <van-button type="primary" plain block to="/createPatientCard">新建就诊卡</van-button>
+    </div>
+  </van-dialog>
 </template>
 
 <script>
 import store from '../../store'
-import { computed } from 'vue'
+import { computed, ref } from 'vue'
 export default {
   name: 'SelectCard',
   props: {
@@ -42,10 +55,12 @@ export default {
     const addCardText = computed(() => {
       return '还可添加' + (5 - cards.value.length) + '人'
     })
+    const showCreatedCardMethod = ref(false)
     return {
       cards,
       showAddCard,
       addCardText,
+      showCreatedCardMethod,
     }
   },
 }

+ 18 - 4
src/router/index.js

@@ -45,7 +45,11 @@ export const constantRoutes = [
     component: () => import('../views/mine/patient-id-cards/BindPatientCard.vue'),
     meta: { title: '添加就诊人' },
   },
-
+  {
+    path: '/createPatientCard',
+    component: () => import('../views/mine/patient-id-cards/CreatePatientCard.vue'),
+    meta: { title: '新建就诊人' },
+  },
   {
     path: '/appointment',
     component: () => import('../views/hospital-service/appointment/Appointment.vue'),
@@ -126,7 +130,7 @@ export const constantRoutes = [
     meta: { title: '住院费用明细' },
   },
   {
-    path: '/displayPrepaid/:name/:inpatientNo/:admissTimes/:deptName/:lastBalance',
+    path: '/displayPrepaid/:patientId/:name/:inpatientNo/:admissTimes/:deptName/:lastBalance',
     name: 'displayPrepaid',
     component: () => import('../views/hospital-service/inpatient-service/DisplayPrepaid.vue'),
     meta: { title: '预交金' },
@@ -152,10 +156,20 @@ export const constantRoutes = [
     meta: { title: '疫苗' },
   },
   {
-    path: '/covidExam/:patientId',
-    component: () => import('../views/hospital-service/health-cart/CovidExam.vue'),
+    path: '/selectCovidBranch/:patientId',
+    component: () => import('../views/hospital-service/covid-exam/SelectCovidBranch.vue'),
     meta: { title: '新冠肺炎核酸检测' },
   },
+  {
+    path: '/checkCovidExamResult/:patientId',
+    component: () => import('../views/hospital-service/covid-exam/CheckExamResult.vue'),
+    meta: { title: '查询新冠核酸检测结果' },
+  },
+  {
+    path: '/selectOrderCovidPatient',
+    component: () => import('../views/hospital-service/covid-exam/SelectPatientCard.vue'),
+    meta: { title: '选择就诊卡' },
+  },
   {
     path: '/selectAppointmentRecordPatient',
     component: () => import('../views/mine/appointment-record/SelectPatientCard.vue'),

+ 9 - 7
src/utils/wx-pay.js

@@ -1,23 +1,25 @@
-import { createPayOrder } from '../api/appointment'
+import { createPayOrder } from '../api/wx-jsapi'
 
-export function wxPay(param, callback) {
+export function wxPay(param, wxPayCallback) {
   createPayOrder(param).then((res) => {
     WeixinJSBridge.invoke(
       'getBrandWCPayRequest',
       {
         appId: res.appId,
         timeStamp: res.timeStamp,
-        nonceStr: res.nonceStr,
-        package: res.package,
+        nonceStr: res.serialNo,
+        package: 'prepay_id=' + res.prepayId,
         signType: res.signType,
         paySign: res.paySign,
         totalFee: res.totalFee,
       },
       function (res2) {
         if (res2.err_msg === 'get_brand_wcpay_request:ok') {
-          // 使用以上方式判断前端返回,微信团队郑重提示:
-          //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
-          callback(res)
+          wxPayCallback(res, 1)
+        } else if (res2.err_msg === 'get_brand_wcpay_request:cancel') {
+          wxPayCallback(res, 2)
+        } else {
+          wxPayCallback(res, 3)
         }
       }
     )

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

@@ -15,6 +15,7 @@
     <div style="height: 10px"></div>
     <van-grid :gutter="10" clickable :column-num="3">
       <van-grid-item icon="shopping-cart" text="健康商城" to="/selectHealthCartPatient" />
+      <van-grid-item icon="hot" text="新冠检测" to="/selectOrderCovidPatient" />
     </van-grid>
     <div style="height: 10px"></div>
   </window-size>

+ 16 - 2
src/views/hospital-service/appointment/AppointmentConfirm.vue

@@ -45,16 +45,28 @@
       title="添加就诊人"
       :value="addCardText"
       is-link
-      to="/bindPatientCard"
+      @click="showCreatedCardMethod = true"
     ></van-cell>
     <div style="height: 10px"></div>
     <van-button type="primary" block @click="confirmAppointment">确认挂号</van-button>
+    <van-dialog
+      v-model:show="showCreatedCardMethod"
+      title="请选择绑定方式"
+      :show-confirm-button="false"
+      show-cancel-button
+    >
+      <div style="padding: 20px">
+        <van-button type="primary" block to="/bindPatientCard">绑定就诊卡</van-button>
+        <div style="height: 10px"></div>
+        <van-button type="primary" plain block to="/createPatientCard">新建就诊卡</van-button>
+      </div>
+    </van-dialog>
   </window-size>
 </template>
 
 <script>
 import store from '../../../store'
-import { computed, onMounted, reactive, watchEffect } from 'vue'
+import { computed, onMounted, reactive, ref, watchEffect } from 'vue'
 import Cookies from 'js-cookie'
 import { getGhFee, hasDoneCovidAssessment } from '../../../api/appointment'
 import router from '../../../router'
@@ -62,6 +74,7 @@ import { Dialog } from 'vant'
 export default {
   name: 'AppointConfirm',
   setup() {
+    const showCreatedCardMethod = ref(false)
     const week = Cookies.get('week')
     const data = reactive({
       week: week ? week : localStorage.week,
@@ -111,6 +124,7 @@ export default {
       })
     })
     return {
+      showCreatedCardMethod,
       data,
       patientCards,
       showAddCard,

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

@@ -164,10 +164,10 @@ export default {
       return index === data.currentIndex ? 'primary' : 'default'
     }
     const hasSource = (index) => {
-      return data.nextSevenDaySources[index] === 0 ? '有' : '无'
+      return data.nextSevenDaySources[index] === 200 ? '有' : '无'
     }
     const badgeColor = (index) => {
-      return data.nextSevenDaySources[index] === 0 ? 'green' : 'red'
+      return data.nextSevenDaySources[index] === 200 ? 'green' : 'red'
     }
     const handleClickDate = (index) => {
       data.currentIndex = index

+ 22 - 19
src/views/hospital-service/appointment/PayAppointmentFee.vue

@@ -46,9 +46,10 @@
 import store from '../../../store'
 import { reactive } from 'vue'
 import { getLocalOpenId } from '../../../utils/check-patient-id'
-import { createPayOrder, saveAppointment } from '../../../api/appointment'
+import { saveAppointment } from '../../../api/appointment'
 import { wxPay } from '../../../utils/wx-pay'
 import { Toast } from 'vant'
+import { updatePayStatus } from '../../../api/wx-jsapi'
 export default {
   name: 'PayAppointmentFee',
   setup() {
@@ -60,20 +61,25 @@ export default {
       data.disablePayButton = true
     }
 
-    const callback = (lres) => {
-      const param = {
-        mzyReqrec: {
-          patientId: data.appointment.patientId,
-          paymode: 'WX',
-          psordnum: lres.tradeNo,
-          agtordnum: lres.timeStamp,
-        },
-        mzyRequestId: data.appointment.mzyRequestId,
-        totalFee: data.appointment.fee,
+    const wxPayCallback = (res, flag) => {
+      updatePayStatus(res.tradeNo, flag)
+      if (flag === 1) {
+        const param = {
+          mzyReqrec: {
+            patientId: data.appointment.patientId,
+            paymode: 'WX',
+            psordnum: res.tradeNo,
+            agtordnum: res.nonceStr,
+          },
+          mzyRequestId: data.appointment.mzyRequestId,
+          totalFee: data.appointment.fee,
+        }
+        saveAppointment(param).then((res) => {
+          Toast.success(res)
+        })
+      } else {
+        Toast.fail('支付失败')
       }
-      saveAppointment(param).then((res) => {
-        Toast.success(res)
-      })
     }
 
     const pay = () => {
@@ -81,12 +87,9 @@ export default {
         body: '挂号费',
         totalFee: data.appointment.fee,
         openId: getLocalOpenId(),
+        patientId: data.appointment.patientId,
       }
-      // wxPay(param, callback)
-
-      createPayOrder(param).then((res) => {
-        callback(res)
-      })
+      wxPay(param, wxPayCallback)
     }
     return {
       data,

+ 66 - 0
src/views/hospital-service/covid-exam/CheckExamResult.vue

@@ -0,0 +1,66 @@
+<template>
+  <window-size>
+    <div style="height: 5px"></div>
+    <van-field v-model="socialNo" label="身份证号" placeholder="请输入要查询的身份证号">
+      <template #button>
+        <van-button size="small" type="primary" @click="startQuery">查询</van-button>
+      </template>
+    </van-field>
+    <div style="height: 5px"></div>
+    <div v-for="(item, index) in list" :key="index">
+      <van-cell
+        :title="item.aply_CTNT"
+        :label="item.ordr_CREATE_DATE"
+        :value="filterType(item.patient_TYPE, item.ptnt_ID)"
+        is-link
+        center
+        :to="'/checkExamDetail/' + item.ordr_ID"
+      ></van-cell>
+    </div>
+  </window-size>
+</template>
+
+<script>
+import { ref } from 'vue'
+import { isValidIdcard } from '../../../utils/validate'
+import { checkIndexBySocialNo } from '../../../api/check-exam'
+import { Toast } from 'vant'
+
+export default {
+  setup() {
+    const socialNo = ref(null)
+    const list = ref([])
+
+    // todo 加载时查询默认卡的身份证号
+    const startQuery = () => {
+      if (!isValidIdcard(socialNo.value)) {
+        Toast({
+          message: '请输入正确的身份证号码',
+          position: 'top',
+        })
+      } else {
+        checkIndexBySocialNo(socialNo.value).then((res) => {
+          list.value = res
+        })
+      }
+    }
+    return {
+      socialNo,
+      list,
+      startQuery,
+      filterType,
+    }
+  },
+}
+
+function filterType(val, no) {
+  if (val === '0') {
+    return '门诊号:' + no
+  } else if (val === '1') {
+    return '住院号:' + no
+  } else if (val === '3') {
+    return '体检号:' + no
+  }
+  return ''
+}
+</script>

+ 37 - 0
src/views/hospital-service/covid-exam/SelectCovidBranch.vue

@@ -0,0 +1,37 @@
+<template>
+  <window-size>
+    <div style="height: 10px"></div>
+    <van-cell title="预定核酸检测" is-link @click="showDiaglog"></van-cell>
+    <van-cell title="查询检测结果" is-link :to="'/checkCovidExamResult/' + patientId"></van-cell>
+  </window-size>
+</template>
+
+<script>
+import { Dialog } from 'vant'
+import { useRouter } from 'vue-router'
+import { savePrescription } from '../../../api/order-covid-exam'
+export default {
+  setup() {
+    const router = useRouter()
+    const patientId = router.currentRoute.value.params.patientId
+    const showDiaglog = () => {
+      Dialog.confirm({
+        message: '是否确认预定新冠核酸检测?',
+        title: '提示',
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+      })
+        .then(() => {
+          savePrescription(patientId).then(() => {
+            router.push('/unPaidList/' + patientId)
+          })
+        })
+        .catch(() => {})
+    }
+    return {
+      patientId,
+      showDiaglog,
+    }
+  },
+}
+</script>

+ 5 - 0
src/views/hospital-service/covid-exam/SelectPatientCard.vue

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

+ 0 - 33
src/views/hospital-service/health-cart/CovidExam.vue

@@ -1,33 +0,0 @@
-<template>
-  <window-size>
-    <div style="height: 10px"></div>
-    <van-cell title="名称" value="新冠肺炎核酸检测"></van-cell>
-    <van-cell title="价格" value="¥1"></van-cell>
-    <div style="height: 10px"></div>
-    <van-button type="primary" block @click="pay">微信支付</van-button>
-  </window-size>
-</template>
-<script>
-import { wxPay } from '../../../utils/wx-pay'
-import { getLocalOpenId } from '../../../utils/check-patient-id'
-import { Toast } from 'vant'
-export default {
-  setup() {
-    const callback = () => {
-      Toast.success('您已成功支付!')
-    }
-
-    const pay = () => {
-      const param = {
-        body: '新冠肺炎核酸检测',
-        totalFee: 1,
-        openId: getLocalOpenId(),
-      }
-      wxPay(param, callback)
-    }
-    return {
-      pay,
-    }
-  },
-}
-</script>

+ 0 - 1
src/views/hospital-service/health-cart/HealthCartCategory.vue

@@ -3,7 +3,6 @@
     <div style="height: 10px"></div>
     <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="'/covidExam/' + patientId"></van-cell>
   </window-size>
 </template>
 

+ 19 - 26
src/views/hospital-service/inpatient-service/DisplayPrepaid.vue

@@ -53,15 +53,17 @@
       </van-col>
     </van-row>
     <div style="height: 20px"></div>
-    <van-button type="primary" block @click="createOrder">微信支付</van-button>
+    <van-button type="primary" block @click="pay">微信支付</van-button>
   </window-size>
 </template>
 
 <script>
 import { ref } from 'vue'
 import { useRouter } from 'vue-router'
-import { createPayOrder } from '../../../api/appointment'
 import { getLocalOpenId } from '../../../utils/check-patient-id'
+import { wxPay } from '../../../utils/wx-pay'
+import { updatePayStatus } from '../../../api/wx-jsapi'
+import { Toast } from 'vant'
 export default {
   setup() {
     const router = useRouter()
@@ -73,40 +75,31 @@ export default {
     const setPrepaidAmount = (val) => {
       prepaidAmount.value = val
     }
-    const createOrder = () => {
+    const wxPayCallback = (res, flag) => {
+      updatePayStatus(res.tradeNo, flag)
+      if (flag === 1) {
+        Toast.success('您已成功支付')
+      } else {
+        // todo支付失败
+        Toast.fail('支付失败')
+      }
+    }
+    const pay = () => {
       const param = {
         body: '住院预交金',
         totalFee: prepaidAmount.value,
         openId: getLocalOpenId(),
+        patientId: param.patientId,
+        inpatientNo: param.inpatientNo,
+        admissTimes: param.admissTimes,
       }
-      createPayOrder(param).then((res) => {
-        // eslint-disable-next-line no-undef
-        WeixinJSBridge.invoke(
-          'getBrandWCPayRequest',
-          {
-            appId: res.appId,
-            timeStamp: res.timeStamp,
-            nonceStr: res.nonceStr,
-            package: res.package,
-            signType: res.signType,
-            paySign: res.paySign,
-            totalFee: res.totalFee,
-          },
-          function (res) {
-            alert(JSON.stringify(res))
-            if (res.err_msg == 'get_brand_wcpay_request:ok') {
-              // 使用以上方式判断前端返回,微信团队郑重提示:
-              //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
-            }
-          }
-        )
-      })
+      wxPay(param, wxPayCallback)
     }
     return {
       param,
       isPlainButton,
       setPrepaidAmount,
-      createOrder,
+      pay,
     }
   },
 }

+ 1 - 0
src/views/hospital-service/inpatient-service/InPatientService.vue

@@ -51,6 +51,7 @@ export default {
       router.push({
         name: 'displayPrepaid',
         params: {
+          patientId: patientId,
           name: data.value.name,
           inpatientNo: data.value.inpatientNo,
           admissTimes: data.value.admissTimes,

+ 19 - 25
src/views/hospital-service/pay-mz-fee/UnPaidDetail.vue

@@ -46,41 +46,35 @@ import { useRouter } from 'vue-router'
 import { getUnPaidDetail } from '../../../api/pay-mz-fee'
 import { onMounted, ref } from 'vue'
 import { getLocalOpenId } from '../../../utils/check-patient-id'
-import { createPayOrder } from '../../../api/appointment'
+import { wxPay } from '../../../utils/wx-pay'
+import { updatePayStatus } from '../../../api/wx-jsapi'
+import { Toast } from 'vant'
 export default {
   name: 'UnPaidDetail',
   setup() {
     const router = useRouter()
     const params = router.currentRoute.value.params
     const fees = ref([])
+    const wxPayCallback = (res, flag) => {
+      updatePayStatus(res.tradeNo, flag)
+      if (flag === 1) {
+        Toast.success('您已成功支付')
+      } else {
+        Toast.fail('支付失败')
+      }
+    }
     const wechatPay = () => {
+      let bodyText = '门诊缴费'
+      if (fees.value.length === 1) {
+        bodyText = fees.value[0].itemName
+      }
       const param = {
-        body: '挂号费',
-        totalFee: params.totalAmt,
+        body: bodyText,
+        totalFee: params.totalAmt / 100,
         openId: getLocalOpenId(),
+        patientId: params.patientId,
       }
-      createPayOrder(param).then((res) => {
-        // eslint-disable-next-line no-undef
-        WeixinJSBridge.invoke(
-          'getBrandWCPayRequest',
-          {
-            appId: res.appId,
-            timeStamp: res.timeStamp,
-            nonceStr: res.nonceStr,
-            package: res.package,
-            signType: res.signType,
-            paySign: res.paySign,
-            totalFee: res.totalFee,
-          },
-          function (res) {
-            alert(JSON.stringify(res))
-            if (res.err_msg == 'get_brand_wcpay_request:ok') {
-              // 使用以上方式判断前端返回,微信团队郑重提示:
-              //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
-            }
-          }
-        )
-      })
+      wxPay(param, wxPayCallback)
     }
     onMounted(() => {
       getUnPaidDetail(params.patientId, params.hisOrdNum).then((res) => {

+ 35 - 1
src/views/mine/MineHome.vue

@@ -9,5 +9,39 @@
       <van-cell icon="gold-coin" title="门诊缴费记录" is-link to="/selectMzFeePaymentRecordPatient"></van-cell>
       <van-cell icon="balance-list" title="住院预交金记录" is-link to="/selectZyYjjPatient"></van-cell
     ></van-cell-group>
+    <div style="height: 20px"></div>
+    <van-button type="primary" block @click="payOneCent">支付1分钱</van-button>
   </window-size>
-</template>
+</template>
+
+<script>
+import { updatePayStatus } from '../../api/wx-jsapi'
+import { getLocalOpenId } from '../../utils/check-patient-id'
+import { wxPay } from '../../utils/wx-pay'
+export default {
+  setup() {
+    const wxPayCallback = (res, flag) => {
+      updatePayStatus(res.tradeNo, flag)
+      if (flag === 1) {
+        Toast.success('您已成功支付')
+      } else {
+        // todo支付失败
+        Toast.fail('支付失败')
+      }
+    }
+    const payOneCent = () => {
+      const param = {
+        body: '测试费用',
+        totalFee: '0.01',
+        openId: getLocalOpenId(),
+        patientId: '317452-0',
+      }
+      wxPay(param, wxPayCallback)
+    }
+
+    return {
+      payOneCent,
+    }
+  },
+}
+</script>

+ 49 - 44
src/views/mine/patient-id-cards/BindPatientCard.vue

@@ -1,49 +1,47 @@
 <template>
   <window-size>
-    <back-nav></back-nav>
-    <div style="margin: 0 15px">
-      <div style="height: 10px"></div>
-      <div id="paddingRightZero">
-        <van-cell title="关系">
-          <template #right-icon>
-            <van-radio-group v-model="card.relation" direction="horizontal">
-              <van-radio name="1">本人</van-radio>
-              <van-radio name="2">他人</van-radio>
-            </van-radio-group>
-          </template>
-        </van-cell>
-      </div>
-      <div style="height: 10px"></div>
-      <van-field v-model="card.name" label="姓名" type="text" placeholder="请输入姓名" />
-      <div style="height: 10px"></div>
-      <van-cell>
-        <span style="font-size: 13px; color: gray">就诊卡或身份证</span>
-        <div style="height: 5px"></div>
-        <van-radio-group v-model="card.cardType" direction="horizontal">
-          <van-radio name="1">就诊卡</van-radio>
-          <van-radio name="2">身份证</van-radio>
-        </van-radio-group>
+    <div style="height: 10px"></div>
+    <div id="paddingRightZero">
+      <van-cell title="关系">
+        <template #right-icon>
+          <van-radio-group v-model="card.relation" direction="horizontal">
+            <van-radio name="1">本人</van-radio>
+            <van-radio name="2">他人</van-radio>
+          </van-radio-group>
+        </template>
       </van-cell>
-      <van-field v-model="card.cardNo" type="tel" :placeholder="cardNoHint" />
-      <div style="height: 10px"></div>
-      <van-field v-model="card.phone" type="tel" placeholder="请输入手机号" />
-      <div style="height: 10px"></div>
-      <van-field
-        readonly
-        clickable
-        name="area"
-        v-model="card.address"
-        label="住址地区"
-        placeholder="点击选择省市区"
-        @click="showArea = true"
-      />
-      <van-popup v-model:show="showArea" position="bottom">
-        <van-area :area-list="allArea" value="430105" @confirm="onConfirmArea" @cancel="showArea = false" />
-      </van-popup>
-      <van-field v-model="card.street" label="街道、小区" type="text" placeholder="请输入住址所在街道、小区" />
-      <div style="height: 10px"></div>
-      <van-button type="primary" block icon="checked" @click="bindCard">立即绑定</van-button>
     </div>
+    <div style="height: 10px"></div>
+    <van-field v-model="card.name" label="姓名" type="text" placeholder="请输入姓名" />
+    <div style="height: 10px"></div>
+    <van-cell>
+      <span style="font-size: 13px; color: gray">门诊号/就诊卡/身份证</span>
+      <div style="height: 5px"></div>
+      <van-radio-group v-model="card.cardType" direction="horizontal">
+        <van-radio name="0">门诊号</van-radio>
+        <van-radio name="1">就诊卡</van-radio>
+        <van-radio name="2">身份证</van-radio>
+      </van-radio-group>
+    </van-cell>
+    <van-field v-model="card.cardNo" type="tel" :placeholder="cardNoHint" />
+    <div style="height: 10px"></div>
+    <van-field v-model="card.phone" type="tel" placeholder="请输入手机号" />
+    <div style="height: 10px"></div>
+    <van-field
+      readonly
+      clickable
+      name="area"
+      v-model="card.address"
+      label="住址地区"
+      placeholder="点击选择省市区"
+      @click="showArea = true"
+    />
+    <van-popup v-model:show="showArea" position="bottom">
+      <van-area :area-list="allArea" value="430105" @confirm="onConfirmArea" @cancel="showArea = false" />
+    </van-popup>
+    <van-field v-model="card.street" label="街道、小区" type="text" placeholder="请输入住址所在街道、小区" />
+    <div style="height: 10px"></div>
+    <van-button type="primary" block icon="checked" @click="bindCard">立即绑定</van-button>
   </window-size>
   <van-dialog v-model:show="multipleCards.show" title="请选择一张就诊卡" @confirm="bindSelectCard">
     <van-radio-group v-model="multipleCards.cardNo">
@@ -100,7 +98,7 @@ export default {
       openId: getLocalOpenId(),
       relation: '1',
       name: '',
-      cardType: '1',
+      cardType: '0',
       cardNo: '',
       phone: '',
       province: '',
@@ -109,7 +107,14 @@ export default {
       street: '',
     })
     const cardNoHint = computed(() => {
-      return card.cardType === '1' ? '请输入院内就诊卡号码' : '请输入身份证号码'
+      const type = card.cardType
+      if (type === '0') {
+        return '请输入门诊ID号'
+      } else if (type === '1') {
+        return '请输入就诊卡号码'
+      } else {
+        return '请输入身份证号码'
+      }
     })
     const showArea = ref(false)
     const onConfirmArea = (values) => {

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

@@ -0,0 +1,213 @@
+<template>
+  <window-size>
+    <div style="height: 5px"></div>
+    <van-tag>请拍摄身份证的人像面照片</van-tag>
+    <div :style="uploadHeight" id="capBox">
+      <div :style="uploadWidth">
+        <van-uploader style="width: 100%; height: 100%" v-model="fileList" :max-count="1">
+          <img style="width: 100%; height: 100%" :src="capImg" />
+        </van-uploader>
+      </div>
+
+      <div style="height: 10px"></div>
+      <div class="cap-tip">
+        <van-tag type="danger">拍摄要求</van-tag>
+        <p>*&nbsp;&nbsp;身份证置于纯色背景上</p>
+        <p>*&nbsp;&nbsp;拍摄身份证时请靠近证件并垂直拍摄</p>
+        <div style="margin: 20px">
+          <van-button type="primary" block :disabled="disableUpload" @click="uploadIdCard">确定上传</van-button>
+          <div style="height: 10px"></div>
+          <van-button block @click="showInputDialog = true">没带身份证,填写信息</van-button>
+        </div>
+      </div>
+    </div>
+    <van-dialog
+      v-model:show="showInputDialog"
+      width="90%"
+      title="请补充以下信息"
+      show-cancel-button
+      confirm-button-text="新建卡"
+      :before-close="beforeClose"
+    >
+      <div style="padding: 20px">
+        <van-field v-model="inputInfo.name" label="姓名" placeholder="请输入姓名"></van-field>
+        <van-field v-model="inputInfo.socialNo" label="身份证号" placeholder="请输入身份证号"></van-field>
+        <van-field v-model="inputInfo.phone" type="tel" label="手机号" placeholder="请输入手机号"></van-field>
+        <van-field
+          readonly
+          clickable
+          name="area"
+          v-model="inputInfo.address"
+          label="住址地区"
+          placeholder="点击选择省市区"
+          @click="showArea = true"
+        />
+        <van-popup v-model:show="showArea" position="bottom">
+          <van-area :area-list="allArea" :value="defaultDistrict" @confirm="onConfirmArea" @cancel="showArea = false" />
+        </van-popup>
+        <van-field v-model="inputInfo.street" label="街道、小区" type="text" placeholder="请输入住址所在街道、小区" />
+      </div>
+    </van-dialog>
+  </window-size>
+</template>
+
+<script>
+import { computed, reactive, ref } from 'vue'
+import store from '../../../store'
+import capImg from '../../../assets/capture-img.png'
+import allArea from '../../../utils/area'
+import { getPatientIdByOpenId, readImage, readInput } from '../../../api/patient-id-cards'
+import { isValidIdcard, isValidPhone } from '../../../utils/validate'
+import { Toast } from 'vant'
+import router from '../../../router'
+import { getLocalOpenId } from '../../../utils/check-patient-id'
+export default {
+  setup() {
+    const windowSize = store.state.windowSize
+    const uploadWidth = {
+      margin: '10px 60px',
+      width: windowSize.w - 120 + 'px',
+    }
+    const uploadHeight = {
+      height: ((windowSize.w - 120) / 3) * 2 + 'px',
+    }
+    const fileList = ref([])
+    const disableUpload = computed(() => {
+      return fileList.value.length !== 1
+    })
+    const defaultDistrict = ref('430105')
+    const uploadIdCard = () => {
+      readImage(fileList.value[0]).then((res) => {
+        inputInfo.name = res.name
+        inputInfo.socialNo = res.socialNo
+        inputInfo.district = res.district
+        inputInfo.city = res.city
+        inputInfo.province = res.province
+        inputInfo.address = res.address
+        inputInfo.street = res.street
+        if (res.district) {
+          defaultDistrict.value = res.district
+        } else {
+          defaultDistrict.value = '430105'
+        }
+        showInputDialog.value = true
+      })
+    }
+    const inputInfo = reactive({
+      openId: getLocalOpenId(),
+      name: null,
+      socialNo: null,
+      phone: null,
+      address: null,
+      province: null,
+      city: null,
+      district: null,
+      street: null,
+    })
+    const showInputDialog = ref(false)
+    const showArea = ref(false)
+    const onConfirmArea = (values) => {
+      inputInfo.province = values[0].code
+      inputInfo.city = values[1].code
+      inputInfo.district = values[2].code
+      inputInfo.address = values
+        .filter((item) => !!item)
+        .map((item) => item.name)
+        .join('/')
+      showArea.value = false
+    }
+    const beforeClose = (action) =>
+      new Promise((resolve) => {
+        if (action === 'cancel') {
+          showInputDialog.value = false
+          resolve(false)
+        } else {
+          if (!inputInfo.name) {
+            Toast({
+              message: '请输入姓名',
+              position: 'top',
+            })
+            resolve(false)
+            return
+          }
+          if (!isValidIdcard(inputInfo.socialNo)) {
+            Toast({
+              message: '请输入正确的身份证号码',
+              position: 'top',
+            })
+            resolve(false)
+            return
+          }
+          if (!isValidPhone(inputInfo.phone)) {
+            Toast({
+              message: '请输入正确的手机号码',
+              position: 'top',
+            })
+            resolve(false)
+            return
+          }
+          if (!inputInfo.province || !inputInfo.city) {
+            Toast({
+              message: '请选择住址地区',
+              position: 'top',
+            })
+            resolve(false)
+            return
+          }
+          if (!inputInfo.street) {
+            Toast({
+              message: '请输入街道、小区',
+              position: 'top',
+            })
+            resolve(false)
+            return
+          }
+          setTimeout(() => {
+            readInput(inputInfo)
+              .then(() => {
+                Toast.success('建卡成功!')
+                resolve(true)
+                getPatientIdByOpenId(getLocalOpenId()).then((res) => {
+                  store.commit('SET_PATIENTCARDS', res)
+                  router.go(-1)
+                })
+              })
+              .catch(() => {
+                resolve(false)
+              })
+          }, 500)
+        }
+      })
+    return {
+      uploadWidth,
+      uploadHeight,
+      capImg,
+      defaultDistrict,
+      fileList,
+      disableUpload,
+      uploadIdCard,
+      inputInfo,
+      showInputDialog,
+      showArea,
+      allArea,
+      onConfirmArea,
+      beforeClose,
+    }
+  },
+}
+</script>
+
+<style>
+#capBox .van-uploader__upload,
+#capBox .van-uploader__preview,
+#capBox .van-uploader__preview-image {
+  width: 100% !important;
+  height: 100% !important;
+}
+
+.cap-tip p {
+  font-size: 13px;
+  margin-left: 10px;
+  color: orangered;
+}
+</style>

+ 1 - 1
src/views/mine/patient-id-cards/MyPatientIdCards.vue

@@ -1,6 +1,6 @@
 <template>
   <window-size>
-    <select-card to="patientCardInfo"></select-card>
+    <select-card to="patientCardInfo" v-if="!showEmpty"></select-card>
     <van-empty description="您还没有添加就诊人" v-if="showEmpty">
       <van-button type="primary" block @click="showCreatedCardMethod = true"> 添加就诊人 </van-button>
     </van-empty>

+ 1 - 2
src/views/mine/zy-prepaid-record/PrepaidRecord.vue

@@ -1,7 +1,7 @@
 <template>
   <window-size>
     <van-empty v-if="showEmpty" description="没有此就诊卡的预交金记录"></van-empty>
-    <van-notice-bar left-icon="volume-o" :scrollable="false">
+    <van-notice-bar v-if="!showEmpty" left-icon="volume-o" :scrollable="false">
       <van-swipe vertical class="notice-swipe" :autoplay="3000" :show-indicators="false">
         <van-swipe-item>
           住院号:{{ data.baseInfo.inpatientNo }}, 住院次数:{{ data.baseInfo.admissTimes }}
@@ -42,7 +42,6 @@ export default {
     })
     onMounted(() => {
       getPrepaidHistory(patientId).then((res) => {
-        console.log(res)
         data.baseInfo = res.baseInfo
         data.prepaid = res.prepaid
       })