Browse Source

患者预约页面接口联调交互

master
kuaileWu 1 year ago
parent
commit
16e7979d97
  1. 15
      components/bookBox.vue
  2. 8
      pages/index/index.vue
  3. 98
      pages/prebook/prebook.vue
  4. 9
      pages/visitors/visitors.vue

15
components/bookBox.vue

@ -3,11 +3,11 @@
<view class="date-wraper"> <view class="date-wraper">
<view :class="'date'+((selectDay==key)?' active':'')" v-for="(item,key) in RegistrationTimeList" @click="chooseDay(key, item)"> <view :class="'date'+((selectDay==key)?' active':'')" v-for="(item,key) in RegistrationTimeList" @click="chooseDay(key, item)">
<view class="top"> <view class="top">
<view>{{item.date.substring(8,10)}}</view> <view>{{item.date.date.substring(8,10)}}</view>
<view class="PfScMedium">{{item.weekday}}</view> <view class="PfScMedium">{{item.date.weekday}}</view>
</view> </view>
<view :class="'bot'+((item.type!=1 && item.type!=5)?' active':'')+(key==0?' PfScMedium':'')"> <view :class="'bot'+((item.date.type!=1 && item.date.type!=5)?' active':'')+(key==0?' PfScMedium':'')">
{{item.type_text}} {{item.date.type_text}}
</view> </view>
</view> </view>
</view> </view>
@ -16,7 +16,7 @@
<view :class="'item'+(timeList.am.length<=0?' itemempty':' ')" v-if="bookTimeList"> <view :class="'item'+(timeList.am.length<=0?' itemempty':' ')" v-if="bookTimeList">
<view class="title PfScMedium">上午预约</view> <view class="title PfScMedium">上午预约</view>
<view class="inner-wrapper" v-if="timeList.am.length>0"> <view class="inner-wrapper" v-if="timeList.am.length>0">
<view v-for="(item,key) in timeList.am" :class="'son PfScMedium'+(item.bed_count<=0?' disable':'')" @click="confirmSubmit(item)" :hover-class="item.bed_count>0?'hover2':''"> <view v-for="(item,key) in timeList.am" :class="'son PfScMedium'+(item.bed_count<=0?' disable':'')" @click="confirmSubmit(item, 1)" :hover-class="item.bed_count>0?'hover2':''">
{{item.start}}-{{item.end}} {{item.start}}-{{item.end}}
<text v-if="visitorList.length > item.bed_count || item.bed_count<=0">{{item.bed_count>0?item.bed_count:'满'}}</text> <text v-if="visitorList.length > item.bed_count || item.bed_count<=0">{{item.bed_count>0?item.bed_count:'满'}}</text>
</view> </view>
@ -31,7 +31,7 @@
<view :class="'item'+(timeList.pm.length<=0?' itemempty':' ')" v-if="bookTimeList"> <view :class="'item'+(timeList.pm.length<=0?' itemempty':' ')" v-if="bookTimeList">
<view class="title PfScMedium">下午预约</view> <view class="title PfScMedium">下午预约</view>
<view class="inner-wrapper" v-if="timeList.pm.length>0"> <view class="inner-wrapper" v-if="timeList.pm.length>0">
<view :class="'son PfScMedium'+(item.bed_count<=0?' disable':'')" @click="confirmSubmit(item)" :hover-class="item.bed_count>0?'hover2':''" v-for="(item,key) in timeList.pm"> <view :class="'son PfScMedium'+(item.bed_count<=0?' disable':'')" @click="confirmSubmit(item, 2)" :hover-class="item.bed_count>0?'hover2':''" v-for="(item,key) in timeList.pm">
{{item.start}}-{{item.end}} {{item.start}}-{{item.end}}
<text v-if="visitorList.length > item.bed_count || item.bed_count<=0">{{item.bed_count?item.bed_count:''}}</text> <text v-if="visitorList.length > item.bed_count || item.bed_count<=0">{{item.bed_count?item.bed_count:''}}</text>
</view> </view>
@ -90,10 +90,11 @@ export default {
if(book.am.length > 0 || book.pm.length > 0) this.bookTimeList = true if(book.am.length > 0 || book.pm.length > 0) this.bookTimeList = true
this.timeList = book this.timeList = book
}, },
confirmSubmit(times){ confirmSubmit(times, type){
if(times.bed_count <= 0) return if(times.bed_count <= 0) return
times.date = this.RegistrationTimeList[this.selectDay].date times.date = this.RegistrationTimeList[this.selectDay].date
times.key = this.selectDay times.key = this.selectDay
times.type = type
this.$emit('confirmSubmitEvent', times) this.$emit('confirmSubmitEvent', times)
} }
} }

8
pages/index/index.vue

@ -33,7 +33,7 @@
<view class="top flex"> <view class="top flex">
<view class="left"> <view class="left">
<view class="title flex"> <view class="title flex">
<text class="over2">{{item.h_name}}</text> <text class="over2">{{item.h_name}} {{item.depart_name}}</text>
<img :src="cssUrl+'index_comback.svg'" v-if="item.h_pos" @click="toLocation(item)"> <img :src="cssUrl+'index_comback.svg'" v-if="item.h_pos" @click="toLocation(item)">
</view> </view>
<view class="date over2" v-if="item.visit_times"> <view class="date over2" v-if="item.visit_times">
@ -141,8 +141,6 @@
'http://api.map.baidu.com/marker?location='+baiduLngLat.lat+','+baiduLngLat.lng+'&title='+hospital.h_name+'&content=即将前往目的地&output=html&src=webapp.baidu.openAPIdemo', 'http://api.map.baidu.com/marker?location='+baiduLngLat.lat+','+baiduLngLat.lng+'&title='+hospital.h_name+'&content=即将前往目的地&output=html&src=webapp.baidu.openAPIdemo',
'https://m.amap.com/share/index/lnglat='+hospital.h_pos+'&name='+hospital.h_name+'&src=uriapi&innersrc=uriapi', 'https://m.amap.com/share/index/lnglat='+hospital.h_pos+'&name='+hospital.h_name+'&src=uriapi&innersrc=uriapi',
] ]
console.log(mapList[res.tapIndex])
// return;
// return; // return;
location.href = mapList[res.tapIndex] location.href = mapList[res.tapIndex]
}, },
@ -191,8 +189,8 @@
}); });
}, },
toVisitors(hospital){ toVisitors(hospital){
uni.setStorageSync('hospital_id', hospital.depart_id) uni.setStorageSync('depart_id', hospital.depart_id)
uni.setStorageSync('hospital', JSON.stringify(hospital)) uni.setStorageSync('depart', JSON.stringify(hospital))
uni.setStorageSync('doctor_info', JSON.stringify(this.doctorInfo)) uni.setStorageSync('doctor_info', JSON.stringify(this.doctorInfo))
uni.navigateTo({ uni.navigateTo({
url:"/pages/visitors/visitors?type=1" url:"/pages/visitors/visitors?type=1"

98
pages/prebook/prebook.vue

@ -2,18 +2,18 @@
<view class="page-prebook"> <view class="page-prebook">
<view class="title flex"> <view class="title flex">
<img :src="cssUrl+'ten.svg'"> <img :src="cssUrl+'ten.svg'">
{{hospital.hospital_name}} {{hospital.hospital_dept_name}} {{depart.h_name}} {{depart.depart_name}}
</view> </view>
<book ref="book" @confirmSubmitEvent="showConfirm" :RegistrationTimeList="RegistrationTimeList" :visitorList="activeVisitors"/> <book ref="book" @confirmSubmitEvent="showConfirm" :RegistrationTimeList="RegistrationTimeList" :visitorList="activeVisitors"/>
<slider-box ref="sliderbox"> <slider-box ref="sliderbox">
<view class="slider-title PfScMedium">预约信息确认</view> <view class="slider-title PfScMedium">预约信息确认</view>
<view class="members-box" v-if="needSelectMembers"> <view class="members-box" v-if="needSelectMembers">
<view class="desc">当前时段余号不足只能预约{{times.left_count}}</view> <view class="desc">当前时段余号不足只能预约{{times.remain_num}}</view>
<view class="members"> <view class="members">
<view :class="'memmbers-item'+(item.choose?' active':'')" v-for="(item,key) in activeVisitors" @click="chooseVisitor(key)"> <view :class="'memmbers-item'+(item.choose?' active':'')" v-for="(item,key) in activeVisitors" @click="chooseVisitor(key)">
<img :src="cssUrl+'checkbox_false.svg'"> <img :src="cssUrl+'checkbox_false.svg'">
<img :src="cssUrl+'checkbox_true.svg'"> <img :src="cssUrl+'checkbox_true.svg'">
{{item.real_name}} {{item.visitor_name}}
</view> </view>
</view> </view>
</view> </view>
@ -21,21 +21,21 @@
<view class="left">就诊人</view> <view class="left">就诊人</view>
<view class="right over2 over5"> <view class="right over2 over5">
<text v-for="(item,key) in activeVisitors"> <text v-for="(item,key) in activeVisitors">
<text v-if="key<=9">{{nums[key]}}</text><text v-else>n.</text>{{item.real_name}} <text v-if="key<=9">{{nums[key]}}</text><text v-else>n.</text>{{item.visitor_name}}
</text> </text>
</view> </view>
</view> </view>
<view class="item" > <view class="item" >
<view class="left">医生姓名</view> <view class="left">医生姓名</view>
<view class="right">{{doctorInfo.name}}</view> <view class="right">{{doctorInfo.doctor_info.name}}</view>
</view> </view>
<view class="item"> <view class="item">
<view class="left">就诊医院</view> <view class="left">就诊医院</view>
<view class="right over2 over5">{{hospital.hospital_name}} {{hospital.hospital_dept_name}}</view> <view class="right over2 over5">{{depart.h_name}} {{depart.depart_name}}</view>
</view> </view>
<view class="item"> <view class="item">
<view class="left">看诊时间</view> <view class="left">看诊时间</view>
<view class="right orange">{{times.date}} 上午 {{times.start_time}}-{{times.end_time}}</view> <view class="right orange">{{times.date}} {{times.time_desc}} {{times.start_time}}-{{times.end_time}}</view>
</view> </view>
<view class="btns-box flex"> <view class="btns-box flex">
@ -66,7 +66,10 @@
activeVisitors:[], activeVisitors:[],
nums:['①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩'], nums:['①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩'],
times:false, times:false,
chooseVisitorCount:0 chooseVisitorCount:0,
departId:false,
depart:false,
visit_nums_id:false
} }
}, },
components:{ components:{
@ -76,26 +79,24 @@
onShow() { onShow() {
var activeVisitors = uni.getStorageSync('active_visitors') var activeVisitors = uni.getStorageSync('active_visitors')
if(!activeVisitors){ if(!activeVisitors){
this.$pop.modelShow('请先选择要预约的就诊人', '/pages/visitors/visitors?type=1') this.$func.toPage('/pages/index/index')
return return
} }
this.activeVisitors = JSON.parse(activeVisitors)
this.hospitalId = uni.getStorageSync('hospital_id')
this.hospital = uni.getStorageSync('hospital')
this.activeVisitors = JSON.parse(activeVisitors)
this.departId = uni.getStorageSync('depart_id')
this.depart = uni.getStorageSync('depart')
var doctorInfo = uni.getStorageSync('doctor_info') var doctorInfo = uni.getStorageSync('doctor_info')
if(!doctorInfo){ if(!doctorInfo){
this.$pop.modelShow('请先选择要预约的医生', '/pages/index/index') this.$pop.modelShow('请先选择要预约的医生', '/pages/index/index')
return return
} }
this.doctorInfo = JSON.parse(doctorInfo) this.doctorInfo = JSON.parse(doctorInfo)
if(!this.departId && this.depart) {
if(!this.hospitalId && this.hospital) { this.$pop.modelShow('请先选择要预约的医院科室', '/pages/index/index')
this.$pop.modelShow('请先选择要预约的医院', '/pages/index/index')
return return
} }
this.hospital = JSON.parse(this.hospital) this.depart = JSON.parse(this.depart)
this.doctorId = getApp().globalData.doctorId
this.getAvailabletRegistrationTime() this.getAvailabletRegistrationTime()
}, },
methods: { methods: {
@ -116,20 +117,23 @@
this.$set(this.activeVisitors, key, visitor) this.$set(this.activeVisitors, key, visitor)
}, },
tips(){ tips(){
uni.removeStorageSync('active_visitors')
uni.showToast({ uni.showToast({
title:"成功预约"+this.chooseVisitorCount+"人", title:"成功预约"+this.chooseVisitorCount+"人",
mask:true, mask:true,
image:this.cssUrl+'gou.svg', image:this.cssUrl+'gou.svg',
times:false, times:false,
success() { success() {
uni.navigateTo({ setTimeout(function(){
url:"/pages/prebook_list/prebook_list" uni.navigateTo({
}) url:"/pages/prebook_list/prebook_list"
})
}, 1500)
} }
}) })
}, },
getAvailabletRegistrationTime(refresh = true, chooseDay = '') { getAvailabletRegistrationTime(refresh = true, chooseDay = '') {
this.$http.req('client/doctor/visit_hospital/days/'+this.hospitalId).then(data=>{ this.$http.req('get_appoint_times',{depart_id:this.departId}, 'GET').then(data=>{
if(data == -1) return if(data == -1) return
// data.days = [ // data.days = [
// { // {
@ -221,7 +225,7 @@
// ] // ]
// } // }
this.RegistrationTimeList = data.days this.RegistrationTimeList = data
if(this.RegistrationTimeList.length>0) { if(this.RegistrationTimeList.length>0) {
if(refresh || chooseDay>=this.RegistrationTimeList.length) { if(refresh || chooseDay>=this.RegistrationTimeList.length) {
this.$refs.book.dataInit(this.RegistrationTimeList[0]) this.$refs.book.dataInit(this.RegistrationTimeList[0])
@ -236,11 +240,8 @@
}, },
appoint() { appoint() {
var param = new Object() var param = new Object()
param.visit_hospital_id = this.hospitalId param.depart_id = this.departId
param.start_time = this.times.start_time param.visit_nums_id = this.visit_nums_id
param.end_time = this.times.end_time
param.date = this.times.date
var uids = new Array() var uids = new Array()
for (var i = 0; i < this.activeVisitors.length; i++) { for (var i = 0; i < this.activeVisitors.length; i++) {
var visitor = this.activeVisitors[i] var visitor = this.activeVisitors[i]
@ -256,39 +257,54 @@
this.$pop.modelShow('请选择预约就诊人') this.$pop.modelShow('请选择预约就诊人')
return return
} }
this.chooseVisitorCount = uids.length
param.user_ids = JSON.stringify(uids)
param.handler_type = 1
this.$http.req('client/user/appoint/', param).then(data=>{ if(uids.length > this.times.remain_num){
this.$pop.modelShow('当前时段余号不足,只能预约'+this.times.remain_num+'人')
return
}
param.visitor_ids = uids.join(',')
this.chooseVisitorCount = uids.length
this.$http.req('appoint', param).then(data=>{
if(data == -1) return if(data == -1) return
this.tips() this.tips()
}); });
}, },
appointCheck(times, chooseDay=''){ appointCheck(times, chooseDay='', visit_nums_id){
var param = new Object() var param = new Object()
param.start_time = times.start param.depart_id = this.departId
param.end_time = times.end this.visit_nums_id = param.visit_nums_id = visit_nums_id
param.date = times.date
param.visit_hospital_id = this.hospitalId var visitor_ids = new Array();
param.visit_user_count = 1 for (var i = 0; i < this.activeVisitors.length; i++) {
visitor_ids.push(this.activeVisitors[i].id)
}
param.visitor_ids = visitor_ids.join(',')
this.times = param this.times = param
this.$http.req('client/user/appoint/check', param).then(data=>{ this.times.date = times.date.date
this.times.start_time = times.start
this.times.end_time = times.end
this.times.time_desc = '下午'
if(times.type == 1) this.times.time_desc = '上午'
this.$http.req('check_appoint_nums', param).then(data=>{
if(data == -1) { if(data == -1) {
this.getAvailabletRegistrationTime(false, chooseDay) this.getAvailabletRegistrationTime(false, chooseDay)
return return
} }
if(data.left_count < this.activeVisitors.length){
if(data.remain_num < this.activeVisitors.length){
this.needSelectMembers = true this.needSelectMembers = true
this.$set(this.times, 'remain_num', data.remain_num)
this.$refs.sliderbox.showConfirm() this.$refs.sliderbox.showConfirm()
this.times.left_count = data.left_count
}else{ }else{
this.$refs.sliderbox.showConfirm() this.$refs.sliderbox.showConfirm()
} }
}); });
}, },
showConfirm(times) { showConfirm(times) {
this.appointCheck(times, times.key) this.appointCheck(times, times.key, times.id)
}, },
submitConfim(){ submitConfim(){
this.appoint() this.appoint()

9
pages/visitors/visitors.vue

@ -73,7 +73,8 @@
hospitalId:false, hospitalId:false,
activeVisitors:[], activeVisitors:[],
popMsgs:[], popMsgs:[],
popIndex:0 popIndex:0,
depart_id:0
} }
}, },
components:{ components:{
@ -90,9 +91,9 @@
uni.setStorageSync('visitor_type', this.type) uni.setStorageSync('visitor_type', this.type)
this.getVisitors() this.getVisitors()
this.hospitalId = uni.getStorageSync('hospital_id') this.depart_id = uni.getStorageSync('depart_id')
if(!this.hospitalId && this.type == 1) { if(!this.depart_id && this.type == 1) {
this.$pop.modelShow('请先选择要预约的医院', '/pages/index/index') this.$pop.modelShow('请先选择要预约的医院科室', '/pages/index/index')
return return
} }
}, },

Loading…
Cancel
Save