信达小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

176 lines
4.0 KiB

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