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.
237 lines
5.0 KiB
237 lines
5.0 KiB
const app = getApp<IAppOption>() |
|
|
|
Page({ |
|
data: { |
|
popupShow: false, |
|
popupType: 'preDiagnosisReportDate', // 确认绑定曾经扫码医生 |
|
popupParams: {}, |
|
|
|
edit: false, |
|
|
|
fold1: true, |
|
fold2: true, |
|
fold3: true, |
|
|
|
hospitalName: '', |
|
|
|
examId: '', |
|
period: '1', |
|
|
|
beginDate: '', |
|
endDate: '', |
|
hospitalId: '', |
|
isBiochemical: 2, |
|
alt: '', |
|
ast: '', |
|
bilirubin: '', |
|
isCFIxActivity: 2, |
|
clottingFactor: '', |
|
isOther: 2, |
|
otherInfo: '', |
|
|
|
attachmentList2: [], |
|
attachmentList3: [], |
|
attachmentList10: [], |
|
|
|
formKeys: [ |
|
'beginDate', |
|
'endDate', |
|
'hospitalId', |
|
'isBiochemical', |
|
'alt', |
|
'ast', |
|
'bilirubin', |
|
'isCFIxActivity', |
|
'clottingFactor', |
|
'isOther', |
|
'otherInfo', |
|
], |
|
|
|
dict: { |
|
result: {}, |
|
number: {}, |
|
}, |
|
}, |
|
onLoad(options) { |
|
this.setData({ |
|
examId: options.examid || '', |
|
period: options.period || '1', |
|
edit: options.edit === '1', |
|
}) |
|
}, |
|
onShow() { |
|
app.waitLogin({ type: 1 }).then(() => { |
|
this.getDict() |
|
this.getDetail() |
|
}) |
|
}, |
|
getDict() { |
|
wx.ajax({ |
|
method: 'GET', |
|
url: '?r=wtx/treatment/get-dict', |
|
data: {}, |
|
}).then((res) => { |
|
this.setData({ |
|
dict: res, |
|
}) |
|
}) |
|
}, |
|
getDetail() { |
|
const { examId, formKeys } = this.data |
|
if (!examId) return |
|
wx.ajax({ |
|
method: 'GET', |
|
url: '?r=wtx/treatment/get-examination-info', |
|
data: { |
|
examId: examId, |
|
}, |
|
}).then((res) => { |
|
const reset = formKeys.reduce((pre, cur) => { |
|
pre[cur] = res[cur] || '' |
|
return pre |
|
}, {}) |
|
this.setData({ |
|
...reset, |
|
attachmentList2: res.attachmentList[2] || [], |
|
attachmentList3: res.attachmentList[3] || [], |
|
attachmentList10: res.attachmentList[10] || [], |
|
hospitalName: res.hospitalName || '', |
|
}) |
|
}) |
|
}, |
|
handleSelectHospital() { |
|
wx.navigateTo({ |
|
url: `/patient/pages/selectHostipal/index?select=1&id=${this.data.hospitalId}`, |
|
events: { |
|
acceptDataFromOpenedPage: (data) => { |
|
this.setData({ |
|
hospitalId: data.hospitalId, |
|
hospitalName: data.hospitalName, |
|
}) |
|
this.updateSave() |
|
}, |
|
}, |
|
}) |
|
}, |
|
handleToggleFold(e: any) { |
|
const { fold } = e.currentTarget.dataset |
|
this.setData({ |
|
[fold]: !this.data[fold], |
|
}) |
|
}, |
|
handleToggleCheck(e: any) { |
|
const { check, fold } = e.currentTarget.dataset |
|
let foldValue = this.data[fold] |
|
if (this.data[check] == 2) { |
|
foldValue = false |
|
} |
|
this.setData({ |
|
[check]: this.data[check] == 1 ? 2 : 1, |
|
[fold]: foldValue, |
|
}) |
|
this.updateSave() |
|
}, |
|
updateSave(e = null) { |
|
let isBack = false |
|
if (e) { |
|
const { back } = (e as any).currentTarget.dataset |
|
isBack = back == 1 |
|
} |
|
const { formKeys, period, examId, ...reset } = this.data |
|
const form = formKeys.reduce((pre, cur) => { |
|
pre[cur] = reset[cur] |
|
return pre |
|
}, {}) |
|
wx.ajax({ |
|
method: 'POST', |
|
url: '?r=wtx/exam/save-record', |
|
data: { |
|
examId, |
|
period, |
|
...form, |
|
}, |
|
}).then((res) => { |
|
this.setData({ |
|
examId: res, |
|
}) |
|
if (isBack) { |
|
wx.navigateBack() |
|
} |
|
}) |
|
}, |
|
setFile(e: any) { |
|
const { type, key } = e.currentTarget.dataset |
|
const { examId, period } = this.data |
|
const detail = e.detail || [] |
|
let apiArr: any[] = [] |
|
const fileList = this.data[key] || [] |
|
detail.forEach((item: any) => { |
|
const params: any = { |
|
examId, |
|
period, |
|
type, |
|
fileType: item.fileType, |
|
name: item.name, |
|
url: item.url, |
|
videoUrl: item.videoUrl, |
|
duration: item.duration, |
|
} |
|
fileList.push(params) |
|
apiArr.push(this.saveAttachment(params)) |
|
}) |
|
this.setData({ |
|
[key]: fileList, |
|
}) |
|
Promise.all(apiArr).then((res) => { |
|
console.log(res) |
|
}) |
|
}, |
|
saveAttachment(params: any) { |
|
return wx.ajax({ |
|
method: 'POST', |
|
url: '?r=wtx/treatment/save-attachment', |
|
data: params, |
|
}) |
|
}, |
|
delFile(e: any) { |
|
const { key } = e.currentTarget.dataset |
|
const { index, item } = e.detail |
|
if (item.attachmentId) { |
|
wx.ajax({ |
|
method: 'POST', |
|
url: '?r=wtx/treatment/del-attachment', |
|
data: { |
|
attachmentId: item.attachmentId, |
|
}, |
|
}) |
|
} |
|
const fileList = this.data[key] |
|
const newFileList = fileList.filter((_, i) => i !== index) |
|
this.setData({ |
|
[key]: newFileList, |
|
}) |
|
}, |
|
handleDel() { |
|
const { examId } = this.data |
|
wx.showModal({ |
|
title: '确认删除?', |
|
confirmColor: 'rgba(246, 74, 58, 1)', |
|
success: (res) => { |
|
if (res.confirm) { |
|
wx.ajax({ |
|
method: 'POST', |
|
url: '?r=wtx/exam/del', |
|
data: { examId }, |
|
}).then(() => { |
|
wx.navigateBack() |
|
}) |
|
} |
|
}, |
|
}) |
|
}, |
|
handleBack() { |
|
wx.navigateBack() |
|
}, |
|
}) |
|
|
|
export {}
|
|
|