Browse Source

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

master
kuaileWu 1 year ago
parent
commit
16e7979d97
  1. 15
      components/bookBox.vue
  2. 8
      pages/index/index.vue
  3. 100
      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'+((selectDay==key)?' active':'')" v-for="(item,key) in RegistrationTimeList" @click="chooseDay(key, item)">
<view class="top">
<view>{{item.date.substring(8,10)}}</view>
<view class="PfScMedium">{{item.weekday}}</view>
<view>{{item.date.date.substring(8,10)}}</view>
<view class="PfScMedium">{{item.date.weekday}}</view>
</view>
<view :class="'bot'+((item.type!=1 && item.type!=5)?' active':'')+(key==0?' PfScMedium':'')">
{{item.type_text}}
<view :class="'bot'+((item.date.type!=1 && item.date.type!=5)?' active':'')+(key==0?' PfScMedium':'')">
{{item.date.type_text}}
</view>
</view>
</view>
@ -16,7 +16,7 @@
<view :class="'item'+(timeList.am.length<=0?' itemempty':' ')" v-if="bookTimeList">
<view class="title PfScMedium">上午预约</view>
<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}}
<text v-if="visitorList.length > item.bed_count || item.bed_count<=0">{{item.bed_count>0?item.bed_count:'满'}}</text>
</view>
@ -31,7 +31,7 @@
<view :class="'item'+(timeList.pm.length<=0?' itemempty':' ')" v-if="bookTimeList">
<view class="title PfScMedium">下午预约</view>
<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}}
<text v-if="visitorList.length > item.bed_count || item.bed_count<=0">{{item.bed_count?item.bed_count:''}}</text>
</view>
@ -90,10 +90,11 @@ export default {
if(book.am.length > 0 || book.pm.length > 0) this.bookTimeList = true
this.timeList = book
},
confirmSubmit(times){
confirmSubmit(times, type){
if(times.bed_count <= 0) return
times.date = this.RegistrationTimeList[this.selectDay].date
times.key = this.selectDay
times.type = type
this.$emit('confirmSubmitEvent', times)
}
}

8
pages/index/index.vue

@ -33,7 +33,7 @@
<view class="top flex">
<view class="left">
<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)">
</view>
<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',
'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;
location.href = mapList[res.tapIndex]
},
@ -191,8 +189,8 @@
});
},
toVisitors(hospital){
uni.setStorageSync('hospital_id', hospital.depart_id)
uni.setStorageSync('hospital', JSON.stringify(hospital))
uni.setStorageSync('depart_id', hospital.depart_id)
uni.setStorageSync('depart', JSON.stringify(hospital))
uni.setStorageSync('doctor_info', JSON.stringify(this.doctorInfo))
uni.navigateTo({
url:"/pages/visitors/visitors?type=1"

100
pages/prebook/prebook.vue

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

9
pages/visitors/visitors.vue

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

Loading…
Cancel
Save