信达小程序
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.

413 lines
9.2 KiB

const app = getApp<IAppOption>();
1 month ago
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;
1 month ago
list: {
id: string;
title: string;
active?: boolean;
}[];
1 month ago
}[],
params: {},
m_d: '',
nrdl: '',
focus: false,
},
onLoad(options) {
const SystemInfo = app.globalSystemInfo;
1 month ago
if (SystemInfo) {
const { bottom } = SystemInfo.capsulePosition;
1 month ago
this.setData({
bottom,
});
1 month ago
}
this.setData({
m_d: options.m_d,
nrdl: options.nrdl,
});
1 month ago
app.waitLogin({ type: [0, 1] }).then(() => {
this.handleMp(this.data.nav);
});
1 month ago
},
handleSelect(e) {
const { index } = e.currentTarget.dataset;
const { nav, question } = this.data;
const questionItem = question[nav];
1 month ago
questionItem.list = questionItem.list.map((item, i) => {
if (index == i) {
item.active = true;
1 month ago
} else {
item.active = false;
1 month ago
}
return item;
});
1 month ago
this.setData({
[`question[${nav}]`]: questionItem,
});
1 month ago
setTimeout(() => {
this.setData({
nav: nav == 8 ? 8 : nav + 1,
showSubmit: nav == 8,
});
this.handleMp(this.data.nav);
}, 500);
1 month ago
},
stopTouchMove() {
return false;
1 month ago
},
bindtransition() {
this.setData({
nav: this.data.nav,
});
1 month ago
},
handlePrev() {
const { nav } = this.data;
1 month ago
this.setData({
nav: nav - 1,
});
1 month ago
},
handleSubmit() {
app.zdMpBehavior({ PageName: 'BTN_PATIENTASSESSMENTQ9COMPLETE' });
1 month ago
wx.showLoading({
title: '提交中',
});
const { question } = this.data;
const params = {};
1 month ago
question.forEach((item) => {
if (item.type === 'intenseDose') {
params[item.key] = this.data[item.key];
1 month ago
} else {
params[item.key] = item.list.findIndex((subItem) => subItem.active);
1 month ago
}
});
1 month ago
this.setData({
params,
});
1 month ago
},
handleFinish(e) {
const that = this;
const url = `${app.globalData.upFileUrl}?r=file-service/upload-img`;
1 month ago
wx.uploadFile({
filePath: e.detail,
name: 'file',
url,
success(res) {
const data = JSON.parse(res.data);
that.submitCreate(data.data.Url);
1 month ago
},
});
1 month ago
},
handleHorSelect(e) {
const { id } = e.currentTarget.dataset;
const { SteroidDailyDose } = this.data;
1 month ago
if (!id) {
this.setData({
popupHormone: SteroidDailyDose > 0 ? SteroidDailyDose : '',
popupShow: true,
});
1 month ago
setTimeout(() => {
this.setData({
popupFocus: true,
});
}, 300);
return;
1 month ago
}
this.setData({
SteroidDailyDose: id * 1,
showSubmit: Boolean(id),
});
1 month ago
},
handlePopupCancel() {
this.setData({
popupShow: false,
popupFocus: false,
});
1 month ago
},
handlePopupSure() {
// if (!Number(this.data.popupHormone)) {
// wx.showToast({
// icon: "none",
// title: "请输入激素用量",
// });
// return;
// }
this.setData({
SteroidDailyDose: Number(this.data.popupHormone),
showSubmit: true,
});
this.handlePopupCancel();
1 month ago
},
submitCreate(Url) {
const params = this.data.params;
1 month ago
wx.ajax({
method: 'POST',
4 weeks ago
url: '?r=zd/adl/create',
1 month ago
data: params,
}).then((res) => {
this.updateAdlImg(res.Id, Url, res);
});
1 month ago
},
updateAdlImg(id, Url, params) {
const { m_d, nrdl } = this.data;
1 month ago
wx.ajax({
method: 'POST',
4 weeks ago
url: '?r=zd/adl/update-img',
1 month ago
data: {
Id: id,
ImgUrl: Url,
},
}).then(() => {
wx.hideLoading();
wx.setStorageSync('adlResultInfo', params.ScoreInfo);
1 month ago
wx.redirectTo({
4 weeks ago
url: `/patient/pages/adlResult/index?id=${id}&reset=1&m_d=${m_d}&nrdl=${nrdl}&wy=${Number(params.sendWeiYi)}&idafa=${Number(params.inviteDoctorAndFirstAdl)}`,
});
});
1 month ago
},
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'),
});
1 month ago
}
},
handleBack() {
wx.navigateBack();
1 month ago
},
onShareAppMessage() {
return {
title: 'MG-ADL测评表:评估重症肌无力患者症状对生活质量的影响',
4 weeks ago
path: '/patient/pages/adl/index',
};
1 month ago
},
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];
app.zdMpBehavior({ PageName });
1 month ago
},
});