|
|
|
|
const MEDICATIONS_MAP: Record<number, string> = {
|
|
|
|
|
1: '没有使用激素',
|
|
|
|
|
2: '激素',
|
|
|
|
|
3: '免疫抑制剂',
|
|
|
|
|
4: '靶向CD19生物制剂',
|
|
|
|
|
5: '靶向CD20生物制剂',
|
|
|
|
|
99: '其他',
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const IMMUNOSUPPRESSANT_MAP: Record<number, string> = {
|
|
|
|
|
1: '吗替麦考酚酯',
|
|
|
|
|
2: '替唑嘌呤',
|
|
|
|
|
3: '环磷酰胺',
|
|
|
|
|
4: '来氟米特',
|
|
|
|
|
5: '甲氨蝶呤',
|
|
|
|
|
6: '环孢素A',
|
|
|
|
|
7: '他克莫司',
|
|
|
|
|
8: '艾拉莫德',
|
|
|
|
|
99: '其他',
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const IMAGE_TYPE_LABELS: Record<string, string> = {
|
|
|
|
|
outpatientRecord: '门诊病历及处方',
|
|
|
|
|
labReport: '检验报告',
|
|
|
|
|
imagingExam: '影像学检查',
|
|
|
|
|
pathology: '病理诊断及活检',
|
|
|
|
|
immuneFunction: '外周血免疫功能评估',
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Page({
|
|
|
|
|
data: {
|
|
|
|
|
id: 0,
|
|
|
|
|
visitDate: '',
|
|
|
|
|
nextVisitDate: '',
|
|
|
|
|
displayIgG4Value: '' as string | number | null,
|
|
|
|
|
medicationsLabel: '',
|
|
|
|
|
oralHormoneDosage: '' as string | number | null,
|
|
|
|
|
immunosuppressantLabel: '',
|
|
|
|
|
reminderEnabled: 2,
|
|
|
|
|
imageGroups: [] as { type: string; label: string; list: string[] }[],
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onLoad(options: any) {
|
|
|
|
|
if (options.id) {
|
|
|
|
|
this.setData({ id: Number(options.id) })
|
|
|
|
|
this.getDetail()
|
|
|
|
|
this.getReminderConfig()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ========== API ==========
|
|
|
|
|
|
|
|
|
|
getDetail() {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=igg4/medical-visit/detail',
|
|
|
|
|
data: { id: this.data.id },
|
|
|
|
|
}).then((res: any) => {
|
|
|
|
|
if (!res) return
|
|
|
|
|
const medicationsLabel = (res.medicationsUsed || [])
|
|
|
|
|
.map((id: number) => {
|
|
|
|
|
if (id === 99 && res.medicationsUsedOtherText) return `其他:${res.medicationsUsedOtherText}`
|
|
|
|
|
return MEDICATIONS_MAP[id]
|
|
|
|
|
})
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
.join('、')
|
|
|
|
|
const immunosuppressantLabel = (res.immunosuppressantName || [])
|
|
|
|
|
.map((id: number) => {
|
|
|
|
|
if (id === 99 && res.immunosuppressantNameOtherText) return `其他:${res.immunosuppressantNameOtherText}`
|
|
|
|
|
return IMMUNOSUPPRESSANT_MAP[id]
|
|
|
|
|
})
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
.join('、')
|
|
|
|
|
|
|
|
|
|
const imageGroups: { type: string; label: string; list: string[] }[] = []
|
|
|
|
|
const images = res.images || {}
|
|
|
|
|
for (const type of Object.keys(IMAGE_TYPE_LABELS)) {
|
|
|
|
|
const list = (images[type] || []).map((img: any) => img.maskedImageUrl || img.imageUrl)
|
|
|
|
|
if (list.length) {
|
|
|
|
|
imageGroups.push({ type, label: IMAGE_TYPE_LABELS[type], list })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
visitDate: res.visitDate || '',
|
|
|
|
|
nextVisitDate: res.nextVisitDate || '',
|
|
|
|
|
displayIgG4Value: res.displayIgG4Value,
|
|
|
|
|
medicationsLabel,
|
|
|
|
|
oralHormoneDosage: res.oralHormoneDosage,
|
|
|
|
|
immunosuppressantLabel,
|
|
|
|
|
imageGroups,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getReminderConfig() {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '?r=igg4/medical-visit/get-reminder-config',
|
|
|
|
|
}).then((res: any) => {
|
|
|
|
|
if (!res) return
|
|
|
|
|
this.setData({ reminderEnabled: res.reminderEnabled || 2 })
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
saveReminderConfig(e: any) {
|
|
|
|
|
const val = e.detail.value ? 1 : 2
|
|
|
|
|
this.setData({ reminderEnabled: val })
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=igg4/medical-visit/save-reminder-config',
|
|
|
|
|
data: { reminderEnabled: val },
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ========== 操作 ==========
|
|
|
|
|
|
|
|
|
|
handleDelete() {
|
|
|
|
|
wx.showModal({
|
|
|
|
|
title: '确认删除记录?',
|
|
|
|
|
content: `删除${this.data.visitDate || ''}记录,此操作不可逆,相关照片将永久删除`,
|
|
|
|
|
confirmText: '确认删除',
|
|
|
|
|
confirmColor: '#ee0a24',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if (!res.confirm) return
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: '?r=igg4/medical-visit/delete',
|
|
|
|
|
data: { id: this.data.id },
|
|
|
|
|
}).then((res: any) => {
|
|
|
|
|
if (!res) return
|
|
|
|
|
wx.navigateBack()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleEdit() {
|
|
|
|
|
wx.navigateTo({ url: `/gift/pages/record/index?id=${this.data.id}` })
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handlePreviewImage(e: any) {
|
|
|
|
|
const { url, type } = e.currentTarget.dataset
|
|
|
|
|
const group = this.data.imageGroups.find((g) => g.type === type)
|
|
|
|
|
if (!group) return
|
|
|
|
|
wx.previewImage({
|
|
|
|
|
current: url,
|
|
|
|
|
urls: group.list,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export {}
|