19 changed files with 1034 additions and 904 deletions
@ -1,5 +1,7 @@ |
|||||||
{ |
{ |
||||||
"navigationStyle": "default", |
"navigationStyle": "default", |
||||||
"navigationBarTitleText": "复诊记录", |
"navigationBarTitleText": "复诊记录", |
||||||
"usingComponents": {} |
"usingComponents": { |
||||||
|
"popup": "/components/popup/index" |
||||||
|
} |
||||||
} |
} |
||||||
|
|||||||
@ -1,8 +1,120 @@ |
|||||||
const _app = getApp<IAppOption>(); |
const app = getApp<IAppOption>() |
||||||
|
|
||||||
Page({ |
Page({ |
||||||
data: {}, |
data: { |
||||||
onLoad() {}, |
list: [] as any[], |
||||||
}); |
planMap: {} as Record<string, string>, |
||||||
|
pagination: { |
||||||
|
page: 1, |
||||||
|
pages: 1, |
||||||
|
count: 0, |
||||||
|
}, |
||||||
|
popupShow: false, |
||||||
|
popupType: 'popup15', |
||||||
|
popupParams: {} as any, |
||||||
|
deleteId: '', |
||||||
|
}, |
||||||
|
|
||||||
|
onShow() { |
||||||
|
app.waitLogin({ type: [1] }).then(() => { |
||||||
|
this.getEnum().then(() => { |
||||||
|
this.getList() |
||||||
|
}) |
||||||
|
}) |
||||||
|
}, |
||||||
|
|
||||||
|
getEnum() { |
||||||
|
return wx.ajax({ |
||||||
|
method: 'GET', |
||||||
|
url: '?r=xd/follow-up-reminder/enum', |
||||||
|
}).then((res: any) => { |
||||||
|
const tp = res.treatmentPlan || {} |
||||||
|
const planMap: Record<string, string> = {} |
||||||
|
Object.keys(tp).forEach((key) => { |
||||||
|
planMap[key] = tp[key] |
||||||
|
}) |
||||||
|
this.setData({ planMap }) |
||||||
|
}) |
||||||
|
}, |
||||||
|
|
||||||
|
getList(newPage = 1) { |
||||||
|
wx.ajax({ |
||||||
|
method: 'GET', |
||||||
|
url: '?r=xd/follow-up-reminder/list', |
||||||
|
data: { page: newPage }, |
||||||
|
loading: true, |
||||||
|
}).then((res: any) => { |
||||||
|
const rawList = res.list || res || [] |
||||||
|
const planMap = this.data.planMap |
||||||
|
const list = (newPage === 1 ? [] : [...this.data.list]).concat( |
||||||
|
rawList.map((item: any) => { |
||||||
|
const planKeys = item.treatmentPlan ? item.treatmentPlan.split(',') : [] |
||||||
|
const planList = planKeys.map((key: string) => { |
||||||
|
const label = planMap[key] || key |
||||||
|
if (key === '5' && item.usageCount) { |
||||||
|
return `${label} 第${item.usageCount}次使用` |
||||||
|
} |
||||||
|
return label |
||||||
|
}) |
||||||
|
return { ...item, planList } |
||||||
|
}), |
||||||
|
) |
||||||
|
this.setData({ |
||||||
|
list, |
||||||
|
pagination: { |
||||||
|
page: res.page || newPage, |
||||||
|
pages: res.pages || 1, |
||||||
|
count: res.count || list.length, |
||||||
|
}, |
||||||
|
}) |
||||||
|
}) |
||||||
|
}, |
||||||
|
|
||||||
|
onReachBottom() { |
||||||
|
const { page, pages } = this.data.pagination |
||||||
|
if (pages > page) { |
||||||
|
this.getList(page + 1) |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
handleAdd() { |
||||||
|
wx.navigateTo({ |
||||||
|
url: '/patient/pages/followForm/index', |
||||||
|
}) |
||||||
|
}, |
||||||
|
|
||||||
|
handleEdit(e: any) { |
||||||
|
const id = e.currentTarget.dataset.id |
||||||
|
wx.navigateTo({ |
||||||
|
url: `/patient/pages/followForm/index?id=${id}`, |
||||||
|
}) |
||||||
|
}, |
||||||
|
|
||||||
|
handleDelete(e: any) { |
||||||
|
const id = e.currentTarget.dataset.id |
||||||
|
this.setData({ |
||||||
|
deleteId: id, |
||||||
|
popupShow: true, |
||||||
|
popupType: 'popup15', |
||||||
|
}) |
||||||
|
}, |
||||||
|
|
||||||
|
handlePopupOk() { |
||||||
|
this.setData({ popupShow: false }) |
||||||
|
wx.ajax({ |
||||||
|
method: 'POST', |
||||||
|
url: '?r=xd/follow-up-reminder/delete', |
||||||
|
data: { id: this.data.deleteId }, |
||||||
|
loading: true, |
||||||
|
}).then(() => { |
||||||
|
wx.showToast({ title: '删除成功', icon: 'none' }) |
||||||
|
this.getList() |
||||||
|
}) |
||||||
|
}, |
||||||
|
|
||||||
|
handlePopupCancel() { |
||||||
|
this.setData({ popupShow: false }) |
||||||
|
}, |
||||||
|
}) |
||||||
|
|
||||||
export {} |
export {} |
||||||
|
|||||||
@ -1,22 +1,37 @@ |
|||||||
<view class="page"> |
<view class="page"> |
||||||
<view class="card"> |
<view class="card" wx:for="{{list}}" wx:key="id" bind:tap="handleEdit" data-id="{{item.id}}"> |
||||||
<view class="aside"> |
<view class="aside"> |
||||||
<view class="line-top"></view> |
<view class="line-top"></view> |
||||||
<view class="circle"></view> |
<view class="circle"></view> |
||||||
<view class="line-bottom"></view> |
<view class="line-bottom"></view> |
||||||
</view> |
</view> |
||||||
<view class="container"> |
<view class="container"> |
||||||
<view class="date">复诊时间:2025-06-11</view> |
<view class="date">复诊时间:{{item.visitTime}}</view> |
||||||
<view class="wrap"> |
<view class="wrap"> |
||||||
<view class="title">复诊方案</view> |
<view class="title">复诊方案</view> |
||||||
<view class="list"> |
<view class="list"> |
||||||
<view class="list-item">生物制剂IGF-1R抗体(替妥尤单抗) 第2次使用</view> |
<view class="list-item" wx:for="{{item.planList}}" wx:for-item="plan" wx:key="index">{{plan}}</view> |
||||||
<view class="list-item">传统免疫抑制剂(如:吗替麦考酚酯、环孢素等、甲氨蝶呤)</view> |
|
||||||
</view> |
</view> |
||||||
<view class="next-date"> |
<view class="next-date"> |
||||||
<image class="icon" src="/images/icon172.png"></image> |
<image class="icon" src="{{imageUrl}}icon172.png?t={{Timestamp}}"></image> |
||||||
下次复诊时间:2025-06-11</view> |
下次复诊时间:{{item.nextVisitTime}} |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
|
|
||||||
|
<pagination pagination="{{pagination}}"></pagination> |
||||||
|
|
||||||
|
<view class="add-btn" bind:tap="handleAdd"> |
||||||
|
<image class="icon" src="{{imageUrl}}icon177.png?t={{Timestamp}}"></image> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
|
||||||
|
<popup |
||||||
|
id="popup" |
||||||
|
show="{{popupShow}}" |
||||||
|
type="{{popupType}}" |
||||||
|
params="{{popupParams}}" |
||||||
|
bind:ok="handlePopupOk" |
||||||
|
bind:cancel="handlePopupCancel" |
||||||
|
/> |
||||||
|
|||||||
@ -1,23 +1,221 @@ |
|||||||
const _app = getApp<IAppOption>(); |
const app = getApp<IAppOption>() |
||||||
|
|
||||||
Page({ |
Page({ |
||||||
data: { |
data: { |
||||||
|
id: '', |
||||||
|
isEdit: false, |
||||||
|
visitTime: '', |
||||||
|
treatmentPlan: [] as string[], |
||||||
|
planOptions: [] as any[], |
||||||
|
teprotumumabCount: 1, |
||||||
|
showUsageCount: false, |
||||||
|
nextVisitTime: '', |
||||||
|
nextVisitPreset: '', |
||||||
|
intervalOptions: [] as any[], |
||||||
popupShow: false, |
popupShow: false, |
||||||
popupType: 'popup19', |
popupType: 'popup16', |
||||||
popupParams: {}, |
popupParams: {} as any, |
||||||
|
hasChange: false, |
||||||
|
}, |
||||||
|
|
||||||
|
onLoad(options: any) { |
||||||
|
app.waitLogin({ type: [1] }).then(() => { |
||||||
|
this.getEnum().then(() => { |
||||||
|
if (options.id) { |
||||||
|
this.setData({ |
||||||
|
id: options.id, |
||||||
|
isEdit: true, |
||||||
|
}) |
||||||
|
this.getDetail() |
||||||
|
} |
||||||
|
}) |
||||||
|
}) |
||||||
|
}, |
||||||
|
|
||||||
|
getEnum() { |
||||||
|
return wx.ajax({ |
||||||
|
method: 'GET', |
||||||
|
url: '?r=xd/follow-up-reminder/enum', |
||||||
|
}).then((res: any) => { |
||||||
|
const tp = res.treatmentPlan || {} |
||||||
|
const planOptions = Object.keys(tp).map(key => ({ |
||||||
|
value: key, |
||||||
|
label: tp[key], |
||||||
|
isSelected: false, |
||||||
|
})) |
||||||
|
const nvi = res.nextVisitInterval || {} |
||||||
|
const intervalOptions = Object.keys(nvi).map(key => ({ |
||||||
|
value: key, |
||||||
|
label: nvi[key], |
||||||
|
})) |
||||||
|
this.setData({ planOptions, intervalOptions }) |
||||||
|
}) |
||||||
|
}, |
||||||
|
|
||||||
|
updatePlanOptions(treatmentPlan: string[]) { |
||||||
|
const planOptions = this.data.planOptions.map((opt: any) => ({ |
||||||
|
...opt, |
||||||
|
isSelected: treatmentPlan.includes(opt.value), |
||||||
|
})) |
||||||
|
const showUsageCount = treatmentPlan.includes('5') |
||||||
|
this.setData({ planOptions, showUsageCount }) |
||||||
|
}, |
||||||
|
|
||||||
|
getDetail() { |
||||||
|
wx.ajax({ |
||||||
|
method: 'GET', |
||||||
|
url: '?r=xd/follow-up-reminder/detail', |
||||||
|
data: { id: this.data.id }, |
||||||
|
loading: true, |
||||||
|
}).then((res: any) => { |
||||||
|
const treatmentPlan = res.treatmentPlan ? res.treatmentPlan.split(',') : [] |
||||||
|
this.setData({ |
||||||
|
visitTime: res.visitTime || '', |
||||||
|
treatmentPlan, |
||||||
|
teprotumumabCount: res.teprotumumabCount || 1, |
||||||
|
nextVisitTime: res.nextVisitTime || '', |
||||||
|
hasChange: false, |
||||||
|
}) |
||||||
|
this.updatePlanOptions(treatmentPlan) |
||||||
|
}) |
||||||
|
}, |
||||||
|
|
||||||
|
onVisitDateChange(e: any) { |
||||||
|
this.setData({ visitTime: e.detail.value, hasChange: true }) |
||||||
|
}, |
||||||
|
|
||||||
|
onNextDateChange(e: any) { |
||||||
|
this.setData({ nextVisitTime: e.detail.value, nextVisitPreset: '', hasChange: true }) |
||||||
|
}, |
||||||
|
|
||||||
|
togglePlan(e: any) { |
||||||
|
const value = e.currentTarget.dataset.value |
||||||
|
const treatmentPlan = [...this.data.treatmentPlan] |
||||||
|
const index = treatmentPlan.indexOf(value) |
||||||
|
if (index > -1) { |
||||||
|
treatmentPlan.splice(index, 1) |
||||||
|
} |
||||||
|
else { |
||||||
|
treatmentPlan.push(value) |
||||||
|
} |
||||||
|
this.setData({ treatmentPlan, hasChange: true }) |
||||||
|
this.updatePlanOptions(treatmentPlan) |
||||||
|
}, |
||||||
|
|
||||||
|
onStepperChange(e: any) { |
||||||
|
this.setData({ teprotumumabCount: e.detail, hasChange: true }) |
||||||
|
}, |
||||||
|
|
||||||
|
onNextPresetChange(e: any) { |
||||||
|
const preset = e.currentTarget.dataset.value |
||||||
|
const { visitTime } = this.data |
||||||
|
if (!visitTime) { |
||||||
|
wx.showToast({ title: '请先选择复诊时间', icon: 'none' }) |
||||||
|
return |
||||||
|
} |
||||||
|
const date = new Date(visitTime) |
||||||
|
if (preset === '21') { |
||||||
|
date.setDate(date.getDate() + 21) |
||||||
|
} |
||||||
|
else if (preset === '30') { |
||||||
|
date.setMonth(date.getMonth() + 1) |
||||||
|
} |
||||||
|
else if (preset === '60') { |
||||||
|
date.setMonth(date.getMonth() + 2) |
||||||
|
} |
||||||
|
const nextVisitTime = this.formatDate(date) |
||||||
|
this.setData({ nextVisitPreset: preset, nextVisitTime, hasChange: true }) |
||||||
|
}, |
||||||
|
|
||||||
|
formatDate(date: Date) { |
||||||
|
const y = date.getFullYear() |
||||||
|
const m = String(date.getMonth() + 1).padStart(2, '0') |
||||||
|
const d = String(date.getDate()).padStart(2, '0') |
||||||
|
return `${y}-${m}-${d}` |
||||||
|
}, |
||||||
|
|
||||||
|
handleSubmit() { |
||||||
|
const { visitTime, treatmentPlan, teprotumumabCount, nextVisitTime, id, isEdit } = this.data |
||||||
|
if (!visitTime) { |
||||||
|
wx.showToast({ title: '请选择复诊时间', icon: 'none' }) |
||||||
|
return |
||||||
|
} |
||||||
|
if (!treatmentPlan.length) { |
||||||
|
wx.showToast({ title: '请选择复诊方案', icon: 'none' }) |
||||||
|
return |
||||||
|
} |
||||||
|
if (!nextVisitTime) { |
||||||
|
wx.showToast({ title: '请选择下次复诊时间', icon: 'none' }) |
||||||
|
return |
||||||
|
} |
||||||
|
const data = { |
||||||
|
visitTime, |
||||||
|
treatmentPlan: treatmentPlan.join(','), |
||||||
|
teprotumumabCount, |
||||||
|
nextVisitTime, |
||||||
|
} |
||||||
|
if (isEdit) { |
||||||
|
wx.ajax({ |
||||||
|
method: 'POST', |
||||||
|
url: '?r=xd/follow-up-reminder/update', |
||||||
|
data: { id, ...data }, |
||||||
|
loading: true, |
||||||
|
}).then(() => { |
||||||
|
wx.showToast({ title: '更新成功', icon: 'none' }) |
||||||
|
setTimeout(() => wx.navigateBack(), 1500) |
||||||
|
}) |
||||||
|
} |
||||||
|
else { |
||||||
|
wx.ajax({ |
||||||
|
method: 'POST', |
||||||
|
url: '?r=xd/follow-up-reminder/create', |
||||||
|
data, |
||||||
|
loading: true, |
||||||
|
}).then(() => { |
||||||
|
wx.showToast({ title: '创建成功', icon: 'none' }) |
||||||
|
setTimeout(() => wx.navigateBack(), 1500) |
||||||
|
}) |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
handleCancel() { |
||||||
|
if (this.data.hasChange) { |
||||||
|
this.setData({ popupShow: true, popupType: 'popup16' }) |
||||||
|
} |
||||||
|
else { |
||||||
|
wx.navigateBack() |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
handleDelete() { |
||||||
|
this.setData({ popupShow: true, popupType: 'popup15' }) |
||||||
}, |
}, |
||||||
onLoad() {}, |
|
||||||
|
|
||||||
// popup 确认(继续退出)
|
|
||||||
handlePopupOk() { |
handlePopupOk() { |
||||||
|
const { popupType } = this.data |
||||||
this.setData({ popupShow: false }) |
this.setData({ popupShow: false }) |
||||||
wx.navigateBack() |
if (popupType === 'popup15') { |
||||||
|
// 删除确认
|
||||||
|
wx.ajax({ |
||||||
|
method: 'POST', |
||||||
|
url: '?r=xd/follow-up-reminder/delete', |
||||||
|
data: { id: this.data.id }, |
||||||
|
loading: true, |
||||||
|
}).then(() => { |
||||||
|
wx.showToast({ title: '删除成功', icon: 'none' }) |
||||||
|
setTimeout(() => wx.navigateBack(), 1500) |
||||||
|
}) |
||||||
|
} |
||||||
|
else { |
||||||
|
// 保存记录
|
||||||
|
this.handleSubmit() |
||||||
|
} |
||||||
}, |
}, |
||||||
|
|
||||||
// popup 取消
|
|
||||||
handlePopupCancel() { |
handlePopupCancel() { |
||||||
this.setData({ popupShow: false }) |
this.setData({ popupShow: false }) |
||||||
|
wx.navigateBack() |
||||||
}, |
}, |
||||||
}); |
}) |
||||||
|
|
||||||
export {} |
export {} |
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue