Yizhan-app/pages/doctor/reservation.vue

758 lines
22 KiB
Vue

<template>
<view class="reservation_main">
<template>
<nav-bar title='就医预约'></nav-bar>
<view class="reservation_back">
<image src="/static/firstaid/yuyueback.png"></image>
<view class="reservation_type">
<view :class="acIndex == 0? 'type_item_left_ac':'type_item_left'" @click="typeClick(0)">预约申请</view>
<view :class="acIndex == 0? 'type_item_right':'type_item_right_ac'" @click="typeClick(1)">预约记录</view>
</view>
</view>
</template>
<view class="reser_content" :style="{paddingBottom: acIndex == 0?'140rpx':'0rpx'}">
<template v-if="acIndex == 0">
<view class="reser_type">
<view class="reser_tle">预约类型</view>
<view class="reser_type_nav">
<view class="reser_type_item" @click="navClick(index)" :class="typeIndex == index?'reser_type_item_ac':''" v-for="(item,index) in typeList" :key="index">
{{item.txt}}
</view>
</view>
</view>
<!-- <view class="reser_type" style="margin-top: 24rpx;">
<view class="reser_tle">预约信息</view>
<van-form label-width="150rpx" ref="Form">
<view class="input_row">
<view :class="typeIndex == 0?'input_tle':'input_tle_no'">就诊医院</view>
<van-field style="flex: 1;" maxlength="24" name="hospitalName" v-model="dataForm.hospitalName" placeholder="就诊医院" :rules="[{ required: typeIndex == 0, message: '请填写就诊医院' }]"/>
</view>
<view class="input_row" v-if="typeIndex == 1">
<view class="input_tle">预约科室</view>
<van-field style="flex: 1;" name="department" maxlength="24" v-model="dataForm.department" placeholder="预约科室" :rules="[{ required: true, message: '请填写预约科室' }]"/>
</view>
<view class="input_row" v-if="typeIndex == 2">
<view class="input_tle">手术类型</view>
<van-field style="flex: 1;" name="operation" maxlength="24" v-model="dataForm.operation" placeholder="手术类型" :rules="[{ required: true, message: '请填写手术类型' }]"/>
</view>
<view class="input_row" v-if="typeIndex == 1 || typeIndex == 2">
<view class="input_tle_no">预约医生</view>
<van-field style="flex: 1;" name="doctor" maxlength="24" v-model="dataForm.doctor" placeholder="预约医生"/>
</view>
<view class="input_row_col">
<view class="input_tle">预约日期</view>
<scroll-view class="scroll-view_H " scroll-x="true">
<view class="date_nav_item" :class="dateIndex == index? 'date_nav_item_ac':''" v-for="(item,index) in dateList" :key="index" @click="selectDate(item,index)">
<view>{{item.date}}</view>
<view>{{item.weekday}}</view>
</view>
</scroll-view>
</view>
<view class="input_row_col" style="margin-bottom: 0;">
<view class="input_tle_no">备注</view>
<view class="input_tle_textarea">
<van-field style="padding: 0;background-color: unset;" type="textarea" rows="4" autosize v-model="dataForm.remarks" maxlength="200" show-word-limit placeholder="详细说明"/>
</view>
</view>
</van-form>
</view> -->
<view class="reser_type" style="margin-top: 24rpx;">
<view class="reser_tle">预约信息</view>
<van-form label-width="150rpx" ref="Form">
<view class="input_row">
<view :class="typeIndex == 0?'input_tle':'input_tle_no'">就诊医院</view>
<van-field style="flex: 1;" maxlength="24" name="hospitalName" v-model="dataForm.hospitalName" placeholder="就诊医院"/>
</view>
<view class="input_row" v-if="typeIndex == 1">
<view class="input_tle">预约科室</view>
<van-field style="flex: 1;" name="department" maxlength="24" v-model="dataForm.department" placeholder="预约科室"/>
</view>
<view class="input_row" v-if="typeIndex == 2">
<view class="input_tle">手术类型</view>
<van-field style="flex: 1;" name="operation" maxlength="24" v-model="dataForm.operation" placeholder="手术类型"/>
</view>
<view class="input_row" v-if="typeIndex == 1 || typeIndex == 2">
<view class="input_tle_no">预约医生</view>
<van-field style="flex: 1;" name="doctor" maxlength="24" v-model="dataForm.doctor" placeholder="预约医生"/>
</view>
<view class="input_row_col">
<view class="input_tle">预约日期</view>
<scroll-view class="scroll-view_H " scroll-x="true">
<view class="date_nav_item" :class="dateIndex == index? 'date_nav_item_ac':''" v-for="(item,index) in dateList" :key="index" @click="selectDate(item,index)">
<view>{{item.date}}</view>
<view>{{item.weekday}}</view>
</view>
</scroll-view>
</view>
<view class="input_row_col" style="margin-bottom: 0;">
<view class="input_tle_no">备注</view>
<view class="input_tle_textarea">
<van-field style="padding: 0;background-color: unset;" type="textarea" rows="4" autosize v-model="dataForm.remarks" maxlength="200" show-word-limit placeholder="详细说明"/>
</view>
</view>
</van-form>
</view>
<view class="reser_type" style="margin-top: 24rpx;padding-bottom: 0;">
<view class="reser_tle">预约人信息</view>
<van-form label-width="150rpx">
<view class="input_row">
<view class="input_tle_no">预约人姓名</view>
<van-field style="flex: 1;" v-model="userInfo.realName" readonly placeholder="请填写"/>
</view>
<view class="input_row">
<view class="input_tle">联系电话</view>
<van-field
name="mobile"
maxlength="11"
style="flex: 1;"
v-model="userInfo.mobile"
placeholder="请填写"
right-icon="edit"
:rules="[{ validator: mobileValidator,required: true, message: '请正确填写手机号' }]"/>
</view>
<view class="input_row">
<view class="input_tle_no">单位名称</view>
<van-field style="flex: 1;" v-model="userInfo.departmentName" readonly placeholder="请填写"/>
</view>
</van-form>
</view>
</template>
<template v-if="acIndex == 1">
<z-paging
id="paging_id"
ref="paging"
v-model="listData"
@query="queryList"
:fixed="false"
class="z-paging_nav"
:auto="false"
:style="{height: scrollH +'px'}">
<view class="card_item" @click="jumpDetail(item)" v-for="(item,index) in listData" :key="index">
<view class="card_item_top">
<view class="top_left">
<image src="/static/firstaid/yuyue.png"></image>
<view>{{item.type == 1?'医院预约':item.type == 2?'门诊预约':'手术预约'}}</view>
</view>
<view class="top_right">{{item.status == '0'?'预约成功':item.status == '1'?'已取消':''}}</view>
</view>
<view class="card_item_tips">
<view class="tips_name">预约人姓名</view>
<view class="tips_con">{{item.name}}</view>
</view>
<view class="card_item_tips" v-if="item.type == 2">
<view class="tips_name">预约科室</view>
<view class="tips_con">{{item.officesName}}</view>
</view>
<view class="card_item_tips" v-if="item.hospitalName">
<view class="tips_name">就诊医院</view>
<view class="tips_con">{{item.hospitalName}}</view>
</view>
<view class="card_item_tips" v-if="item.type == 3">
<view class="tips_name">手术类型</view>
<view class="tips_con">{{item.surgicalType}}</view>
</view>
<view class="card_item_tips" v-if="(item.type == 3 || item.type == 2) && item.doctorName">
<view class="tips_name">预约医生</view>
<view class="tips_con">{{item.doctorName}}</view>
</view>
<view class="card_item_tips">
<view class="tips_name">预约日期</view>
<view class="tips_con">{{item.appointmentTime}}</view>
</view>
</view>
</z-paging>
</template>
</view>
<view class="sub_btn_nav" v-if="acIndex == 0">
<button @click="submitClick()">提交</button>
</view>
</view>
</template>
<script>
import {
callbackRequest
} from '@/common/util.js';
import navBar from "@/components/navBar/index.vue";
import{ML_CALLBACK_REQUEST} from "@/common/util.js"
import{doctorReservation,doctorReservationList} from "@/common/api.js"
export default {
components: {
navBar
},
data() {
return {
acIndex: 0,
typeIndex: 0,
typeList: [
{txt:'医院预约',id:1},{txt:'门诊预约',id:2},{txt:'手术预约',id:3}
],
dataForm: {
hospitalName: '', // 医院名称
remarks: '', // 备注
department: '', // 科室
doctor: '', // 医生
operation: '', // 手术类型,
date: ''
},
dayNum: 7, //获取未来几天的日期
dateList:[],
dateIndex: 0,
userInfo: {},
listData: [],
screenHeight: '',
scrollH: ''
}
},
onShow() {
if(this.acIndex == 1) {
this.$nextTick(() => {
this.$refs.paging.reload()
})
}
},
mounted() {
},
onLoad() {
this.getWeekdays(this.dayNum)
this.userInfo = uni.getStorageSync('userInfos')
this.screenHeight = uni.getSystemInfoSync().safeArea.height
},
methods: {
queryList(pageNo, pageSize) {
let params = {
method: doctorReservationList,
currentPage: pageNo,
isDeleted: "0",
limit: pageSize,
userId: uni.getStorageSync('userId')
}
callbackRequest(params).then((res) => {
if (res.returnCode == 1) {
if(pageNo * pageSize >= res.returnData.total) {
this.$refs.paging.completeByNoMore(res.returnData.records,true);
return
}else{
this.$refs.paging.completeByNoMore(res.returnData.records,false);
}
} else {
uni.showToast({title: res.returnMsg,icon: 'none'});
}
})
},
submitClick() {
if(this.typeIndex == 0) {
if(!this.dataForm.hospitalName) {
uni.showToast({title: '请填写就诊医院',icon: 'none'});
return
}
}
if(this.typeIndex == 1) {
if(!this.dataForm.department) {
uni.showToast({title: '请填写预约科室',icon: 'none'});
return
}
}
if(this.typeIndex == 2) {
if(!this.dataForm.operation) {
uni.showToast({title: '请填写手术类型',icon: 'none'});
return
}
}
if(!this.mobileValidator(this.userInfo.mobile)) {
uni.showToast({title: '请完整输入手机号',icon: 'none'});
return
}
//this.typeIndex == 0 0 医院预约 1 门诊预约 2手术预约
let data = {
companyName: this.userInfo.departmentName,
userName: this.userInfo.realName,
userPhone: this.userInfo.mobile || '' ,//18256055391
sex: '-',
serviceType: this.typeIndex == 0?'其他':this.typeIndex == 1?'预约挂号':this.typeIndex == 2?'手术安排':'其他', //预约挂号/陪诊服务/住院安排/手术安排/其他,
medicalCheck: [],
prefer: `${this.dataForm.hospitalName}-`,
decsription: `${this.dataForm.hospitalName}-${this.dataForm.remarks}`
}
ML_CALLBACK_REQUEST('/api/MedicalService/CreateOrder','POST',data).then(res => {
let orderId = res.data.data.orderId
callbackRequest({
method: doctorReservation,
mlReturnStatus: res.data.code,
orderId: orderId,
name: this.userInfo.realName,
userId: uni.getStorageSync('userId'),
phone: this.userInfo.mobile,
unit: this.userInfo.departmentName,
appointmentTime: this.dataForm.date,
hospitalName: this.dataForm.hospitalName,
officesName: this.typeIndex == 1?this.dataForm.department:'', //科室名称
doctorName: this.typeIndex !== 0?this.dataForm.doctor:'', // 预约医生
surgicalType: this.typeIndex == 2?this.dataForm.operation:'', //手术类型
type: this.typeIndex == 0?'1':this.typeIndex == 1?'2':this.typeIndex == 2?'3':'',
remarks: this.dataForm.remarks
}).then(res => {
if(res.returnCode == '1') {
uni.showToast({ title: '预约成功', icon: 'none' });
this.dataForm.hospitalName = ''
this.dataForm.remarks = ''
this.dataForm.department = ''
this.dataForm.doctor = ''
this.dataForm.operation = ''
this.$refs.Form.resetValidation()
}
}).catch(err => {
console.log(err)
})
})
// this.$refs.Form.validate().then(res => {
// console.log(res);
// if(!this.mobileValidator(this.userInfo.mobile)) {
// uni.showToast({title: '请完整输入手机号',icon: 'none'});
// return
// }
// if(res === undefined) {
// //this.typeIndex == 0 0 医院预约 1 门诊预约 2手术预约
// let data = {
// companyName: this.userInfo.departmentName,
// userName: this.userInfo.realName,
// userPhone: this.userInfo.mobile || '' ,//18256055391
// sex: '-',
// serviceType: this.typeIndex == 0?'其他':this.typeIndex == 1?'预约挂号':this.typeIndex == 2?'手术安排':'其他', //预约挂号/陪诊服务/住院安排/手术安排/其他,
// medicalCheck: [],
// prefer: `${this.dataForm.hospitalName}-`,
// decsription: `${this.dataForm.hospitalName}-${this.dataForm.remarks}`
// }
// ML_CALLBACK_REQUEST('/api/MedicalService/CreateOrder','POST',data).then(res => {
// let orderId = res.data.data.orderId
// callbackRequest({
// method: doctorReservation,
// mlReturnStatus: res.data.code,
// orderId: orderId,
// name: this.userInfo.realName,
// userId: uni.getStorageSync('userId'),
// phone: this.userInfo.mobile,
// unit: this.userInfo.departmentName,
// appointmentTime: this.dataForm.date,
// hospitalName: this.dataForm.hospitalName,
// officesName: this.typeIndex == 1?this.dataForm.department:'', //科室名称
// doctorName: this.typeIndex !== 0?this.dataForm.doctor:'', // 预约医生
// surgicalType: this.typeIndex == 2?this.dataForm.operation:'', //手术类型
// type: this.typeIndex == 0?'1':this.typeIndex == 1?'2':this.typeIndex == 2?'3':'',
// remarks: this.dataForm.remarks
// }).then(res => {
// if(res.returnCode == '1') {
// uni.showToast({ title: '预约成功', icon: 'none' });
// this.dataForm.hospitalName = ''
// this.dataForm.remarks = ''
// this.dataForm.department = ''
// this.dataForm.doctor = ''
// this.dataForm.operation = ''
// this.$refs.Form.resetValidation()
// }
// })
// })
// }
// }).catch(err => {
// console.log(err)
// uni.showToast({title: err[0].message,icon: 'none'});
// })
},
jumpDetail(row) {
uni.navigateTo({
url:'/pages/doctor/detail?id=' + row.id + '&pageType=' + '1'
})
},
mobileValidator(val) {
return /^1(3[0-9]|5[0-3,5-9]|7[1-3,5-8]|8[0-9])\d{8}$/.test(val);
},
selectDate(row,index) {
this.dateIndex = index
this.dataForm.date = row.time
},
typeClick(num) {
this.acIndex = num
if(this.acIndex == 1) {
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this);
query.select("#paging_id").boundingClientRect((data) => {
this.scrollH = this.screenHeight - data.top
}).exec();
this.$refs.paging.reload()
})
}
},
navClick(index) {
this.typeIndex = index
this.dataForm.hospitalName = ''
this.dataForm.remarks = ''
this.dataForm.department = ''
this.dataForm.doctor = ''
this.dataForm.operation = ''
this.$refs.Form.resetValidation()
},
getWeekdays(n) {
const days = [];
for (let i = 0; i < n; i++) {
const date = new Date();
date.setDate(date.getDate() + i);
let y = date.getFullYear(); //获取年份
let m = date.getMonth() + 1;
let d = date.getDate();
m = this.addDate(m);
d = this.addDate(d);
days.push({
time: `${y}-${m}-${d}`,
date: `${m} - ${d}`,
weekday: date.toLocaleDateString(undefined, { weekday: 'short' })
});
}
this.dateList = days
this.dataForm.date = days[0].time
},
addDate(time) {
if (time.toString().length == 1) {
time = "0" + time.toString();
}
return time;
}
}
}
</script>
<style scoped lang="scss">
.reservation_main {
width: 100%;
background: #F2F6FA;
padding-top: 100rpx;
}
.reservation_main ::-webkit-scrollbar {
width: 0;
height: 0;
}
.reser_content {
padding: 0rpx 24rpx 0rpx 24rpx;
box-sizing: border-box;
margin-top: 30rpx;
}
.reser_content ::-webkit-scrollbar {
width: 0;
height: 0;
}
.reser_type {
width: 100%;
min-height: 100rpx;
background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx;
padding: 24rpx;
box-sizing: border-box;
.reser_tle {
font-family: PingFang SC, PingFang SC;
font-weight: bold;
font-size: 32rpx;
color: #0E1A24;
margin-left: 30rpx;
position: relative;
margin-bottom: 28rpx;
}
.reser_tle:before {
position: absolute;
content: '';
left: -24rpx;
top: 50%;
transform: translateY(-50%);
width: 8rpx;
height: 30rpx;
background: linear-gradient( 180deg, #82E7B3 0%, #94B8EF 100%);
border-radius: 4rpx;
}
}
.reser_type_nav {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16rpx;
.reser_type_item {
background: #F2F6FA;
height: 76rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 28rpx;
color: #4B5B68;
line-height: 76rpx;
text-align: center;
}
.reser_type_item_ac {
background: #EDFCF7;
border: 2rpx solid #00ADA6;
font-weight: bold;
font-size: 28rpx;
color: #00ADA6;
border-radius: 6rpx;
}
}
.input_row {
display: flex;
align-items: center;
border-bottom: 1rpx solid #EBEFF7;
margin-bottom: 30rpx;
}
.input_row_col {
margin-bottom: 30rpx;
}
.input_tle {
position: relative;
width: 135rpx;
font-weight: 400;
font-size: 28rpx;
color: #4B5B68;
text-align: left;
line-height: 24px;
}
.input_tle_no {
line-height: 24px;
width: 140rpx;
font-weight: 400;
font-size: 28rpx;
color: #4B5B68;
text-align: left;
display: inline-flex;
}
.input_tle:before {
position: absolute;
right: 5rpx;
top: 0;
color: #FB8107;
font-size: 28rpx;
content: '*';
}
.scroll-view_H {
white-space: nowrap;
width: 100%;
margin-top: 20rpx;
.date_nav_item {
width: 132rpx;
height: 118rpx;
background: #F2F6FA;
border-radius: 16rpx;
display: inline-block;
font-weight: 400;
font-size: 24rpx;
color: #4B5B68;
display: inline-flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-right: 16rpx;
padding: 20rpx;
box-sizing: border-box;
justify-content: space-between;
}
.date_nav_item_ac {
background: #EDFCF7;
border-radius: 16rpx;
border: 2rpx solid #00ADA6;
color: #00ADA6;
}
}
.input_tle_textarea {
background: #F2F6FA;
border-radius: 20rpx;
padding: 20rpx;
box-sizing: border-box;
margin-top: 24rpx;
}
.sub_btn_nav {
width: 100%;
height: 120rpx;
background: #FFFFFF;
position: fixed;
bottom: 0;
left: 0;
padding: 0 48rpx;
box-sizing: border-box;
display: flex;
align-items: center;
button {
width: 100%;
height: 88rpx;
background: linear-gradient( 94deg, #5BCE9D 0%, #00ADA6 100%);
border-radius: 12rpx;
font-weight: 400;
font-size: 32rpx;
color: #FFFFFF;
line-height: 88rpx;
text-align: center;
}
}
.card_item {
width: 100%;
min-height: 260rpx;
background: #FFFFFF;
border-radius: 20rpx;
padding: 24rpx;
box-sizing: border-box;
margin-bottom: 24rpx;
.card_item_top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 28rpx;
.top_left {
display: flex;
align-items: center;
image {
width: 48rpx;
height: 48rpx;
display: block;
margin-right: 16rpx;
}
font-weight: bold;
font-size: 36rpx;
color: #0E1A24;
}
.top_right {
width: 152rpx;
height: 56rpx;
background: #E0F6F5;
border-radius: 30rpx;
font-weight: 400;
font-size: 28rpx;
color: #00ADA6;
text-align: center;
line-height: 56rpx;
}
}
.card_item_tips {
display: flex;
margin-bottom: 10rpx;
.tips_name {
width: 180rpx;
font-weight: 400;
font-size: 28rpx;
color: #97A5B1;
}
.tips_con {
flex: 1;
font-weight: 400;
font-size: 28rpx;
color: #4B5B68;
}
}
}
.z-paging_nav {
// height: 100vh;
}
.reservation_back {
width: 100%;
height: 386rpx;
position: relative;
image {
width: 100%;
height: 100%;
display: block;
}
.reservation_type {
width: 100%;
position: relative;
bottom: 85rpx;
display: flex;
height: 90rpx;
.type_item_left {
bottom: -16rpx;
flex: 1;
background-color: #E8ECF2;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 32rpx;
color: #4B5B68;
line-height: 72rpx;
height: 72rpx;
text-align: center;
position: relative;
}
.type_item_left:before {
content: '';
position: absolute;
bottom: 0;
right: 0;
border-top: 72rpx solid #E8ECF2;
border-right: 36rpx solid #ffffff;
width: 0;
height: 0;
}
.type_item_right {
bottom: -16rpx;
flex: 1;
background-color: #E8ECF2;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 32rpx;
color: #4B5B68;
line-height: 72rpx;
height: 72rpx;
text-align: center;
position: relative;
}
.type_item_right:before {
content: '';
position: absolute;
bottom: 0;
left: 0;
border-top: 72rpx solid #E8ECF2;
border-left: 36rpx solid #ffffff;
width: 0;
height: 0;
}
.type_item_left_ac {
flex: 1;
height: 88rpx;
background-color: #ffffff !important;
font-family: PingFang SC, PingFang SC;
font-weight: bold;
font-size: 32rpx;
line-height: 88rpx;
text-align: center;
color: #00ADA6 !important;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
}
.type_item_right_ac {
flex: 1;
height: 88rpx;
background-color: #ffffff !important;
font-family: PingFang SC, PingFang SC;
font-weight: bold;
font-size: 32rpx;
line-height: 88rpx;
text-align: center;
color: #00ADA6 !important;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
}
}
}
</style>