import dayjs from 'dayjs' const app = getApp() Page({ data: { list: [] as any[], total: 0, pagination: { page: 1, pages: 1, count: 1, }, referralFromShow: false, referralFromParams: null as any, }, onLoad(options) { app.waitLogin().then(() => { app.mpBehavior({ PageName: 'PAGE_PATIENTREVISITLIST' }) // 强制疾病患者以上身份 app.permissionVerification(3, 0, `/pages/referral/index`).then(() => { this.getList() if (options.pushId) { this.updatePush(options.pushId) } }) }) }, updatePush(id) { wx.ajax({ method: 'POST', url: '?r=zd/push-click/update-click-status', data: { pushId: id, }, }) }, getList(newPage = 1) { wx.ajax({ method: 'GET', url: '?r=zd/re-visit/get-list', data: { page: newPage, }, }).then((res) => { res.list = res.list.map((item: any) => { item.adlDate = dayjs(item.LastAdlDate).format('YYYY-MM-DD') return item }) const list = res.page === 1 ? res.list : [...this.data.list, ...res.list] this.setData({ total: res.count, list, pagination: { page: res.page, pages: res.pages, count: res.count, }, }) }) }, onReachBottom() { const { page, pages } = this.data.pagination if (pages > page) { this.getList(page + 1) } }, handleEdit(e) { const { index } = e.currentTarget.dataset const { list } = this.data const { Id, VisitDate, Hormone, TraditionalInhibitor, GammaGlobulin, PlasmaExchange, BCellInhibitor, FcRnAntagonists, C5ComplementInhibitor, ChineseMedicine, Other, } = list[index] this.setData({ referralFromShow: true, referralFromParams: { recordId: Id, visitDate: VisitDate, hormone: Number(Hormone), traditionalInhibitor: Number(TraditionalInhibitor), gammaGlobulin: Number(GammaGlobulin), plasmaExchange: Number(PlasmaExchange), bCellInhibitor: Number(BCellInhibitor), fcRnAntagonists: Number(FcRnAntagonists), c5ComplementInhibitor: Number(C5ComplementInhibitor), chineseMedicine: Number(ChineseMedicine), other: Number(Other), }, }) }, handleRecord() { app.mpBehavior({ PageName: 'BTN_PATIENTREVISITADDBTN' }) this.setData({ referralFromShow: true, referralFromParams: null, }) }, handleRefrech() { app.mpBehavior({ PageName: 'BTN_PATIENTREVISITSUBMITBTN' }) this.getList() }, handleAdl() { wx.navigateTo({ url: '/gift/pages/myHealthRecord/index', }) }, }) export {}