|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
const app = getApp<IAppOption>()
|
|
|
|
|
|
|
|
|
|
Page({
|
|
|
|
|
data: {
|
|
|
|
|
relationType: '1',
|
|
|
|
|
name: '',
|
|
|
|
|
gender: '',
|
|
|
|
|
birth: '',
|
|
|
|
|
ageRange: '',
|
|
|
|
|
diagnosisTime: '',
|
|
|
|
|
diagnoseType: '',
|
|
|
|
|
|
|
|
|
|
diagnoseTypeShow: false,
|
|
|
|
|
DiagnoseType: app.globalData.DiagnoseType,
|
|
|
|
|
diagnoseTypeIndex: '',
|
|
|
|
|
diagnoseTypeName: '',
|
|
|
|
|
selectDiagnoseTypeIndex: '0',
|
|
|
|
|
|
|
|
|
|
currentDate: dayjs().format('YYYY-MM'),
|
|
|
|
|
submiting: false,
|
|
|
|
|
|
|
|
|
|
proces: '0',
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
this.setData({
|
|
|
|
|
pagePath: options.page,
|
|
|
|
|
proces: options.proces,
|
|
|
|
|
})
|
|
|
|
|
app.zdWaitLogin({ isReg: false, loginPage: true }).then(() => {
|
|
|
|
|
app.getZdUserInfo(this, true, (zdUserInfo) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
relationType: zdUserInfo.RelationType || '1',
|
|
|
|
|
name: zdUserInfo.PatientName,
|
|
|
|
|
gender: zdUserInfo.Gender,
|
|
|
|
|
ageRange: zdUserInfo.AgeRange,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
app.zdMpBehavior({ PageName: 'PG_PATIENTINFOENTRY' })
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleRelationType(e: WechatMiniprogram.CustomEvent) {
|
|
|
|
|
const { id } = e.currentTarget.dataset
|
|
|
|
|
this.setData({
|
|
|
|
|
relationType: id,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleGender(e: WechatMiniprogram.CustomEvent) {
|
|
|
|
|
const { id } = e.currentTarget.dataset
|
|
|
|
|
this.setData({
|
|
|
|
|
gender: id,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleSelectAge(e: WechatMiniprogram.CustomEvent) {
|
|
|
|
|
const { id } = e.currentTarget.dataset
|
|
|
|
|
this.setData({
|
|
|
|
|
ageRange: id,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleSubmit() {
|
|
|
|
|
if (this.data.submiting) return
|
|
|
|
|
app.zdMpBehavior({ PageName: 'BTN_PATIENTINFONEXT' })
|
|
|
|
|
const { name, gender, ageRange, relationType } = this.data
|
|
|
|
|
const { registrationSource, registChannel, regBusinessId, WorkerId, IsAliQiWei } = app.globalData
|
|
|
|
|
const { doctorId, inviteChan } = app.globalData.scene
|
|
|
|
|
let toast = ''
|
|
|
|
|
// if (!diagnosisTime) toast = "确诊时间不能为空";
|
|
|
|
|
// if (!birth) toast = "出生日期不能为空";
|
|
|
|
|
if (!gender) toast = '请选择性别'
|
|
|
|
|
if (!ageRange) toast = '请选择年龄范围'
|
|
|
|
|
if (!name) toast = '姓名不能为空'
|
|
|
|
|
if (toast) {
|
|
|
|
|
wx.showToast({ title: toast, icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const backPage = app.globalData.backPage
|
|
|
|
|
const navUrl =
|
|
|
|
|
typeof backPage === 'string' && backPage.includes('liveResult') ? backPage : '/patient/pages/certReslove/index'
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
submiting: true,
|
|
|
|
|
})
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=zd/account/reg',
|
|
|
|
|
data: {
|
|
|
|
|
name,
|
|
|
|
|
gender,
|
|
|
|
|
ageRange,
|
|
|
|
|
// birth,
|
|
|
|
|
// diagnoseType,
|
|
|
|
|
// diagnosisTime,
|
|
|
|
|
relationType,
|
|
|
|
|
registrationSource,
|
|
|
|
|
registChannel,
|
|
|
|
|
regBusinessId,
|
|
|
|
|
WorkerId,
|
|
|
|
|
inviteDoctorId: doctorId,
|
|
|
|
|
inviteChannel: inviteChan,
|
|
|
|
|
IsAliQiWei,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
.then((_res) => {
|
|
|
|
|
app.updateLoginInfo(() => {
|
|
|
|
|
wx.reLaunch({
|
|
|
|
|
url: navUrl,
|
|
|
|
|
})
|
|
|
|
|
this.setData({
|
|
|
|
|
submiting: false,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.setData({
|
|
|
|
|
submiting: false,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleBack() {
|
|
|
|
|
wx.navigateBack({
|
|
|
|
|
fail() {
|
|
|
|
|
wx.reLaunch({
|
|
|
|
|
url: '/patient/pages/login/index',
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export {}
|