|
|
|
const app = getApp<IAppOption>()
|
|
|
|
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
popupShow: false,
|
|
|
|
// popupType: 'selectIdentity', // 选择您的身份
|
|
|
|
// popupType: 'bindDoctorReject', // 绑定失败
|
|
|
|
// popupType: 'bindDoctor', // 绑定成功
|
|
|
|
// popupType: 'bindDoctorQuestion', // 为什么绑定医生
|
|
|
|
// popupType: 'conformBindDoctorQuestion', // 确认绑定曾经扫码医生
|
|
|
|
popupType: 'conformBindDoctorConform', // 注册后绑定医生码
|
|
|
|
popupParams: {},
|
|
|
|
|
|
|
|
doctorList: [],
|
|
|
|
|
|
|
|
progress: 1,
|
|
|
|
treatment: {
|
|
|
|
followUpWeekInfo: {},
|
|
|
|
examDiffDays: '',
|
|
|
|
},
|
|
|
|
|
|
|
|
Days: '',
|
|
|
|
userInfo: {} as any,
|
|
|
|
|
|
|
|
isLoad: false,
|
|
|
|
},
|
|
|
|
onLoad() {
|
|
|
|
app.waitLogin({ type: 1 }).then(() => {
|
|
|
|
app.getUserInfo(1).then((userInfo) => {
|
|
|
|
this.setData({
|
|
|
|
userInfo,
|
|
|
|
isLoad: true,
|
|
|
|
Days: userInfo.Days.replace(
|
|
|
|
/(\d+)/g,
|
|
|
|
'<span style="font-size: 20px;font-weight:bold;color: rgba(255, 255, 255, 1);">$1</span>',
|
|
|
|
),
|
|
|
|
})
|
|
|
|
this.getBindDoctorList()
|
|
|
|
this.getTeratmentInfo()
|
|
|
|
const waitBindDoctorId = app.globalData.waitBindDoctorId
|
|
|
|
if (waitBindDoctorId) {
|
|
|
|
this.handleWaitBindDoctor(waitBindDoctorId)
|
|
|
|
} else if (userInfo.WaitBindDoctorId) {
|
|
|
|
this.handleCondormBindDoctor(userInfo.WaitBindDoctorId)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
if (this.data.isLoad) {
|
|
|
|
this.getBindDoctorList()
|
|
|
|
this.getTeratmentInfo()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getBindDoctorList() {
|
|
|
|
wx.ajax({
|
|
|
|
method: 'GET',
|
|
|
|
url: '?r=wtx/account/get-bind-doctor-list',
|
|
|
|
data: {},
|
|
|
|
}).then((res) => {
|
|
|
|
this.setData({
|
|
|
|
doctorList: res,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getTeratmentInfo() {
|
|
|
|
wx.ajax({
|
|
|
|
method: 'GET',
|
|
|
|
url: '?r=wtx/treatment/get-index-info',
|
|
|
|
data: {},
|
|
|
|
}).then((res) => {
|
|
|
|
this.setData({
|
|
|
|
treatment: res,
|
|
|
|
progress: res.period - 1,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleSwiperChange(e) {
|
|
|
|
this.setData({
|
|
|
|
progress: e.detail.current,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleCondormBindDoctor(id) {
|
|
|
|
app.getDoctorInfo(id).then((res) => {
|
|
|
|
this.setData({
|
|
|
|
popupShow: true,
|
|
|
|
popupType: 'conformBindDoctorQuestion',
|
|
|
|
popupParams: {
|
|
|
|
name: res.doctorName,
|
|
|
|
avatar: res.doctorAvatar,
|
|
|
|
hostipal: res.hospitalName,
|
|
|
|
className: res.hospitalClassificationName,
|
|
|
|
levelName: res.hospitalLevelName,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleWaitBindDoctor(id: string) {
|
|
|
|
app.globalData.waitBindDoctorId = ''
|
|
|
|
wx.ajax({
|
|
|
|
method: 'POST',
|
|
|
|
url: '?r=wtx/account/bind-doctor',
|
|
|
|
data: {
|
|
|
|
doctorId: id,
|
|
|
|
},
|
|
|
|
showMsg: false,
|
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
app.getDoctorInfo(id).then((res) => {
|
|
|
|
this.setData({
|
|
|
|
popupShow: true,
|
|
|
|
popupType: 'bindDoctor',
|
|
|
|
popupParams: {
|
|
|
|
name: res.doctorName,
|
|
|
|
avatar: res.doctorAvatar,
|
|
|
|
hostipal: res.hospitalName,
|
|
|
|
className: res.hospitalClassificationName,
|
|
|
|
levelName: res.hospitalLevelName,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
if ([101, 102].includes(err.data.code)) {
|
|
|
|
this.setData({
|
|
|
|
popupShow: true,
|
|
|
|
popupType: 'bindDoctorReject',
|
|
|
|
popupParams: {
|
|
|
|
msg: err.data.msg || '请检查网络后重试',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
wx.showToast({
|
|
|
|
icon: 'none',
|
|
|
|
title: err.data.msg || '请检查网络后重试',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleBindDoctor() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/patient/pages/bindDoctor/index',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleProgress(e: any) {
|
|
|
|
const { index } = e.currentTarget.dataset
|
|
|
|
this.setData({
|
|
|
|
progress: index,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleAskPatient() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/patient/pages/askPatient/index',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleCourse() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/patient/pages/course/index',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleColtStat() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/patient/pages/coltStat/index',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handlePopupOk() {
|
|
|
|
const { popupType, userInfo } = this.data
|
|
|
|
if (popupType === 'bindDoctorReject') {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/patient/pages/bindDoctor/index',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (popupType === 'bindDoctor') {
|
|
|
|
this.getBindDoctorList()
|
|
|
|
}
|
|
|
|
if (popupType === 'conformBindDoctorQuestion') {
|
|
|
|
this.handleWaitBindDoctor(userInfo.WaitBindDoctorId)
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
popupShow: false,
|
|
|
|
popupType: '',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handlePopupCancel() {
|
|
|
|
const { popupType } = this.data
|
|
|
|
if (popupType === 'bindDoctor') {
|
|
|
|
this.getBindDoctorList()
|
|
|
|
}
|
|
|
|
if (popupType === 'conformBindDoctorQuestion') {
|
|
|
|
wx.ajax({
|
|
|
|
method: 'POST',
|
|
|
|
url: '?r=wtx/account/del-wait-bind-doctor',
|
|
|
|
data: {},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
popupShow: false,
|
|
|
|
popupType: '',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
export {}
|