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.
412 lines
9.1 KiB
412 lines
9.1 KiB
const app = getApp<IAppOption>(); |
|
|
|
Page({ |
|
data: { |
|
nav: 0, |
|
showSubmit: false, |
|
popupShow: false, |
|
popupFocus: false, |
|
SteroidDailyDose: 0, |
|
popupHormone: '', |
|
question: [ |
|
{ |
|
title: '第一题:说话', |
|
key: 'TalkingScore', |
|
type: 'question', |
|
icon: '1', |
|
list: [ |
|
{ |
|
id: '1', |
|
title: '正常', |
|
}, |
|
{ |
|
id: '2', |
|
title: '间或有点含糊或有鼻音', |
|
}, |
|
{ |
|
id: '3', |
|
title: '经常含糊不清或者有鼻音,但是别人还能听懂', |
|
}, |
|
{ |
|
id: '4', |
|
title: '别人听不太懂', |
|
}, |
|
], |
|
}, |
|
{ |
|
title: '第二题:咀嚼', |
|
key: 'ChewScore', |
|
type: 'question', |
|
icon: '2', |
|
list: [ |
|
{ |
|
id: '1', |
|
title: '正常', |
|
}, |
|
{ |
|
id: '2', |
|
title: '咀嚼固体食物会感到疲劳', |
|
}, |
|
{ |
|
id: '3', |
|
title: '咀嚼松软食物会感到疲劳', |
|
}, |
|
{ |
|
id: '4', |
|
title: '使用喂食管进食,如鼻胃管胃肠管等', |
|
}, |
|
], |
|
}, |
|
{ |
|
title: '第三题:吞咽', |
|
key: 'SwallowScore', |
|
type: 'question', |
|
icon: '4', |
|
list: [ |
|
{ |
|
id: '1', |
|
title: '正常', |
|
}, |
|
{ |
|
id: '2', |
|
title: '偶尔会噎到', |
|
}, |
|
{ |
|
id: '3', |
|
title: '经常会噎到,因而需要改变饮食习惯', |
|
}, |
|
{ |
|
id: '4', |
|
title: '使用喂食管进食,如鼻胃管胃肠管等', |
|
}, |
|
], |
|
}, |
|
{ |
|
title: '第四题:呼吸', |
|
key: 'BreathScore', |
|
type: 'question', |
|
icon: '5', |
|
list: [ |
|
{ |
|
id: '1', |
|
title: '正常', |
|
}, |
|
{ |
|
id: '2', |
|
title: '劳累后感到气促或呼吸不畅', |
|
}, |
|
{ |
|
id: '3', |
|
title: '静止时感到气促或呼吸不畅', |
|
}, |
|
{ |
|
id: '4', |
|
title: '依赖呼吸机', |
|
}, |
|
], |
|
}, |
|
{ |
|
title: '第五题 刷牙或梳头的能力受损', |
|
key: 'BrushTeethAndCombHairScore', |
|
type: 'question', |
|
icon: '6', |
|
list: [ |
|
{ |
|
id: '1', |
|
title: '正常', |
|
}, |
|
{ |
|
id: '2', |
|
title: '需要多费些力气但是不需要停下来', |
|
}, |
|
{ |
|
id: '3', |
|
title: '需要停下来休息才能完成', |
|
}, |
|
{ |
|
id: '4', |
|
title: '无法自己完成', |
|
}, |
|
], |
|
}, |
|
{ |
|
title: '第六题 从椅子上起身能力受损', |
|
key: 'GetUpFromChairScore', |
|
type: 'question', |
|
icon: '3', |
|
list: [ |
|
{ |
|
id: '1', |
|
title: '正常', |
|
}, |
|
{ |
|
id: '2', |
|
title: '轻度受损,有时需要用手帮忙', |
|
}, |
|
{ |
|
id: '3', |
|
title: '中度受损,总是需要用手帮忙', |
|
}, |
|
{ |
|
id: '4', |
|
title: '严重受损,需要他人帮助', |
|
}, |
|
], |
|
}, |
|
{ |
|
title: '第七题:复视/重影', |
|
key: 'DoubleVisionScore', |
|
type: 'question', |
|
icon: '7', |
|
list: [ |
|
{ |
|
id: '1', |
|
title: '正常', |
|
}, |
|
{ |
|
id: '2', |
|
title: '有,但不是每天', |
|
}, |
|
{ |
|
id: '3', |
|
title: '每天,但不是持续一整天', |
|
}, |
|
{ |
|
id: '4', |
|
title: '持续有', |
|
}, |
|
], |
|
}, |
|
{ |
|
title: '第八题:眼睑下垂', |
|
key: 'DroopyEyelidsScore', |
|
type: 'question', |
|
icon: '8', |
|
list: [ |
|
{ |
|
id: '1', |
|
title: '正常', |
|
}, |
|
{ |
|
id: '2', |
|
title: '有,但不是每天', |
|
}, |
|
{ |
|
id: '3', |
|
title: '每天,但不是持续一整天', |
|
}, |
|
{ |
|
id: '4', |
|
title: '持续有', |
|
}, |
|
], |
|
}, |
|
{ |
|
title: '第九题:激素用量', |
|
key: 'SteroidDailyDose', |
|
type: 'intenseDose', |
|
icon: '9', |
|
}, |
|
] as { |
|
title: string; |
|
key: string; |
|
icon: string; |
|
type: string; |
|
list: { |
|
id: string; |
|
title: string; |
|
active?: boolean; |
|
}[]; |
|
}[], |
|
params: {}, |
|
|
|
m_d: '', |
|
nrdl: '', |
|
|
|
focus: false, |
|
}, |
|
onLoad(options) { |
|
const SystemInfo = app.globalSystemInfo; |
|
if (SystemInfo) { |
|
const { bottom } = SystemInfo.capsulePosition; |
|
this.setData({ |
|
bottom, |
|
}); |
|
} |
|
this.setData({ |
|
m_d: options.m_d, |
|
nrdl: options.nrdl, |
|
}); |
|
|
|
app.waitLogin({ type: [0, 1] }).then(() => { |
|
this.handleMp(this.data.nav); |
|
}); |
|
}, |
|
handleSelect(e) { |
|
const { index } = e.currentTarget.dataset; |
|
const { nav, question } = this.data; |
|
const questionItem = question[nav]; |
|
questionItem.list = questionItem.list.map((item, i) => { |
|
if (index == i) { |
|
item.active = true; |
|
} else { |
|
item.active = false; |
|
} |
|
return item; |
|
}); |
|
this.setData({ |
|
[`question[${nav}]`]: questionItem, |
|
}); |
|
setTimeout(() => { |
|
this.setData({ |
|
nav: nav == 8 ? 8 : nav + 1, |
|
showSubmit: nav == 8, |
|
}); |
|
this.handleMp(this.data.nav); |
|
}, 500); |
|
}, |
|
stopTouchMove() { |
|
return false; |
|
}, |
|
bindtransition() { |
|
this.setData({ |
|
nav: this.data.nav, |
|
}); |
|
}, |
|
handlePrev() { |
|
const { nav } = this.data; |
|
this.setData({ |
|
nav: nav - 1, |
|
}); |
|
}, |
|
handleSubmit() { |
|
|
|
wx.showLoading({ |
|
title: '提交中', |
|
}); |
|
const { question } = this.data; |
|
const params = {}; |
|
question.forEach((item) => { |
|
if (item.type === 'intenseDose') { |
|
params[item.key] = this.data[item.key]; |
|
} else { |
|
params[item.key] = item.list.findIndex((subItem) => subItem.active); |
|
} |
|
}); |
|
this.setData({ |
|
params, |
|
}); |
|
}, |
|
handleFinish(e) { |
|
const that = this; |
|
const url = `${app.globalData.upFileUrl}?r=file-service/upload-img`; |
|
wx.uploadFile({ |
|
filePath: e.detail, |
|
name: 'file', |
|
url, |
|
success(res) { |
|
const data = JSON.parse(res.data); |
|
that.submitCreate(data.data.Url); |
|
}, |
|
}); |
|
}, |
|
handleHorSelect(e) { |
|
const { id } = e.currentTarget.dataset; |
|
const { SteroidDailyDose } = this.data; |
|
if (!id) { |
|
this.setData({ |
|
popupHormone: SteroidDailyDose > 0 ? SteroidDailyDose : '', |
|
popupShow: true, |
|
}); |
|
setTimeout(() => { |
|
this.setData({ |
|
popupFocus: true, |
|
}); |
|
}, 300); |
|
return; |
|
} |
|
this.setData({ |
|
SteroidDailyDose: id * 1, |
|
showSubmit: Boolean(id), |
|
}); |
|
}, |
|
handlePopupCancel() { |
|
this.setData({ |
|
popupShow: false, |
|
popupFocus: false, |
|
}); |
|
}, |
|
handlePopupSure() { |
|
// if (!Number(this.data.popupHormone)) { |
|
// wx.showToast({ |
|
// icon: "none", |
|
// title: "请输入激素用量", |
|
// }); |
|
// return; |
|
// } |
|
this.setData({ |
|
SteroidDailyDose: Number(this.data.popupHormone), |
|
showSubmit: true, |
|
}); |
|
this.handlePopupCancel(); |
|
}, |
|
submitCreate(Url) { |
|
const params = this.data.params; |
|
wx.ajax({ |
|
method: 'POST', |
|
url: '?r=zd/adl/create', |
|
data: params, |
|
}).then((res) => { |
|
this.updateAdlImg(res.Id, Url, res); |
|
}); |
|
}, |
|
updateAdlImg(id, Url, params) { |
|
const { m_d, nrdl } = this.data; |
|
wx.ajax({ |
|
method: 'POST', |
|
url: '?r=zd/adl/update-img', |
|
data: { |
|
Id: id, |
|
ImgUrl: Url, |
|
}, |
|
}).then(() => { |
|
wx.hideLoading(); |
|
wx.setStorageSync('adlResultInfo', params.ScoreInfo); |
|
wx.redirectTo({ |
|
url: `/patient/pages/adlResult/index?id=${id}&reset=1&m_d=${m_d}&nrdl=${nrdl}&wy=${Number(params.sendWeiYi)}&idafa=${Number(params.inviteDoctorAndFirstAdl)}`, |
|
}); |
|
}); |
|
}, |
|
handleInput(e) { |
|
if (e.detail.value) { |
|
this.setData({ |
|
// eslint-disable-next-line regexp/optimal-quantifier-concatenation |
|
popupHormone: e.detail.value.replace(/^(-)?(\d{0,3})(\.\d?)?.*$/, '$1$2$3'), |
|
}); |
|
} |
|
}, |
|
handleBack() { |
|
wx.navigateBack(); |
|
}, |
|
onShareAppMessage() { |
|
return { |
|
title: 'MG-ADL测评表:评估重症肌无力患者症状对生活质量的影响', |
|
path: '/patient/pages/adl/index', |
|
}; |
|
}, |
|
|
|
handleMp(index) { |
|
const PageName = { |
|
0: 'PG_PATIENTASSESSMENTQ1', |
|
1: 'PG_PATIENTASSESSMENTQ2', |
|
2: 'PG_PATIENTASSESSMENTQ3', |
|
3: 'PG_PATIENTASSESSMENTQ4', |
|
4: 'PG_PATIENTASSESSMENTQ5', |
|
5: 'PG_PATIENTASSESSMENTQ6', |
|
6: 'PG_PATIENTASSESSMENTQ7', |
|
7: 'PG_PATIENTASSESSMENTQ8', |
|
8: 'PG_PATIENTASSESSMENTQ9', |
|
}[index]; |
|
|
|
}, |
|
});
|
|
|