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.
238 lines
5.7 KiB
238 lines
5.7 KiB
import dayjs from 'dayjs' |
|
const licia = require('miniprogram-licia') |
|
|
|
const app = getApp<IAppOption>() |
|
|
|
Page({ |
|
data: { |
|
nav: 0, |
|
|
|
userInfo: {}, |
|
|
|
fold1: false, |
|
fold2: false, |
|
fold3: false, |
|
fold4: false, |
|
|
|
periodOne: [], |
|
periodTwo: [], |
|
periodThree: {}, |
|
periodFour: [], |
|
empty0: false, |
|
|
|
medical: { |
|
lastBleedingInfo: { |
|
bleedingPartList: [], |
|
}, |
|
}, |
|
|
|
followExam: { |
|
recommendDate: [], |
|
} as any, |
|
|
|
calendarConfig: { |
|
multi: false, |
|
hideSelectYear: true, |
|
markToday: '今', // 当天日期展示不使用默认数字,用特殊文字标记 |
|
autoChoosedWhenJump: true, |
|
firstDayOfWeek: 'Mon', |
|
theme: 'geneb', |
|
takeoverTap: false, |
|
highlightToday: true, |
|
onlyShowCurrentMonth: true, |
|
disableMode: { |
|
type: 'after', // [‘before’, 'after'] |
|
}, |
|
}, |
|
}, |
|
onLoad(options) { |
|
if (options.nav) { |
|
this.setData({ |
|
nav: Number(options.nav), |
|
}) |
|
} |
|
}, |
|
onShow() { |
|
app.waitLogin({ type: 1 }).then(() => { |
|
this.getInfo() |
|
app.getUserInfo(1).then((userInfo) => { |
|
this.setData({ |
|
userInfo: { |
|
...userInfo, |
|
CreateTime: dayjs(userInfo.CreateTime).format('YYYY年MM月DD日'), |
|
}, |
|
}) |
|
}) |
|
}) |
|
}, |
|
handleNav(e) { |
|
const { nav } = e.currentTarget.dataset |
|
this.setData({ |
|
nav, |
|
}) |
|
this.getInfo() |
|
}, |
|
getInfo() { |
|
const { nav } = this.data |
|
if (nav == 0) { |
|
wx.ajax({ |
|
method: 'GET', |
|
url: '?r=wtx/treatment/get-archives', |
|
data: {}, |
|
}).then((res) => { |
|
this.setData({ |
|
...res, |
|
empty0: |
|
!res.periodOne.length && |
|
!res.periodTwo.length && |
|
!res.periodFour.length && |
|
!res.periodThree.injectionDate && |
|
!res.periodThree.injectionWeight && |
|
!res.periodThree.injectionDrugs && |
|
!res.periodThree.injectionNum, |
|
}) |
|
}) |
|
} |
|
if (nav == 1) { |
|
wx.ajax({ |
|
method: 'GET', |
|
url: '?r=wtx/treatment/get-medical-history-info', |
|
data: {}, |
|
}).then((res) => { |
|
this.setData({ |
|
medical: res, |
|
}) |
|
}) |
|
} |
|
if (nav == 2) { |
|
wx.ajax({ |
|
method: 'GET', |
|
url: '?r=wtx/treatment/get-follow-up-exam', |
|
data: {}, |
|
}).then((res) => { |
|
this.setData({ |
|
followExam: { |
|
injectionDateName: dayjs(res.injectionDate).format('YYYY年MM月DD日 ddd'), |
|
...res, |
|
}, |
|
}) |
|
this.getFollowList() |
|
}) |
|
} |
|
}, |
|
getFollowList(dateMonth = '') { |
|
wx.ajax({ |
|
method: 'GET', |
|
url: '?r=wtx/treatment/get-follow-up-exam-list', |
|
data: { |
|
month: dateMonth, |
|
}, |
|
}).then((res) => { |
|
console.log('res: ', res) |
|
const { followExam } = this.data |
|
this.setCalendarTodos({ |
|
bleedDate: [followExam.injectionDate], |
|
injectionDate: res, |
|
reportInjectionDate: followExam.recommendDate, |
|
}) |
|
}) |
|
}, |
|
handleWhenChangeMonth(e) { |
|
console.log('DEBUGPRINT[101]: index.ts:129: e=', e) |
|
const next = e.detail.next |
|
const dateMonth = dayjs(`${next.year}-${next.month}`).format('YYYY-MM') |
|
this.getFollowList(dateMonth) |
|
}, |
|
setCalendarTodos({ |
|
bleedDate = [], |
|
injectionDate = [], |
|
reportInjectionDate = [], |
|
}: { |
|
bleedDate: any[] |
|
injectionDate: string[] |
|
reportInjectionDate: string[] |
|
}) { |
|
const calendar = this.selectComponent('#calendar').calendar |
|
const dates: any[] = [] |
|
|
|
const unionArr = licia.union(bleedDate, injectionDate, reportInjectionDate) |
|
|
|
unionArr.forEach((date: string) => { |
|
let color: string[] = [] |
|
if (bleedDate.includes(date)) { |
|
color.push('rgba(246, 74, 58, 1)') |
|
} |
|
if (injectionDate.includes(date)) { |
|
color.push('rgba(255, 163, 112, 1)') |
|
} |
|
if (reportInjectionDate.includes(date)) { |
|
color.push('rgba(255, 207, 135, 1)') |
|
} |
|
|
|
dates.push({ |
|
year: date.split('-')[0], |
|
month: date.split('-')[1], |
|
date: date.split('-')[2], |
|
color, |
|
}) |
|
}) |
|
|
|
calendar.setTodos({ |
|
// 待办点标记设置 |
|
pos: 'bottom', // 待办点标记位置 ['top', 'bottom'] |
|
dotColor: 'purple', // 待办点标记颜色 |
|
circle: false, // 待办圆圈标记设置(如圆圈标记已签到日期),该设置与点标记设置互斥 |
|
showLunar: true, |
|
showLabelAlways: true, // 点击时是否显示待办事项(圆点/文字),在 circle 为 true 及当日历配置 showLunar 为 true 时,此配置失效 |
|
dates, |
|
}) |
|
}, |
|
|
|
handleFold(e) { |
|
const { fold } = e.currentTarget.dataset |
|
this.setData({ |
|
[fold]: !this.data[fold], |
|
}) |
|
console.log(this.data[fold]) |
|
}, |
|
handleRevisitRecord() { |
|
wx.navigateTo({ |
|
url: '/patient/pages/lastDiagnosisReport/index', |
|
}) |
|
}, |
|
handleRevisitDetail(e) { |
|
const { id, period } = e.currentTarget.dataset |
|
wx.navigateTo({ |
|
url: `/patient/pages/lastDiagnosisReport/index?examid=${id}&period=${period}`, |
|
}) |
|
}, |
|
handleRevisitAll() { |
|
wx.navigateTo({ |
|
url: '/patient/pages/revisitRecord/index', |
|
}) |
|
}, |
|
handleCourse(e: any) { |
|
const { progress } = e.currentTarget.dataset |
|
wx.navigateTo({ |
|
url: `/patient/pages/course/index?current=${progress}`, |
|
}) |
|
}, |
|
handleBbmDetail() { |
|
wx.navigateTo({ |
|
url: '/patient/pages/bbmReport/index', |
|
}) |
|
}, |
|
handlePreDiagnosisReport(e) { |
|
const { id, period } = e.currentTarget.dataset |
|
wx.navigateTo({ |
|
url: `/patient/pages/preDiagnosisReport/index?examid=${id}&period=${period}`, |
|
}) |
|
}, |
|
handleInjectionDate() { |
|
wx.navigateTo({ |
|
url: '/patient/pages/injectDate/index', |
|
}) |
|
}, |
|
}) |
|
|
|
export {}
|
|
|