|
|
|
const app = getApp<IAppOption>()
|
|
|
|
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
popupShow: false,
|
|
|
|
popupType: 'preDiagnosisReportDate', // 确认绑定曾经扫码医生
|
|
|
|
popupParams: {},
|
|
|
|
|
|
|
|
fold1: true,
|
|
|
|
fold2: true,
|
|
|
|
fold3: true,
|
|
|
|
fold4: true,
|
|
|
|
fold5: true,
|
|
|
|
fold6: true,
|
|
|
|
fold7: true,
|
|
|
|
fold8: true,
|
|
|
|
fold9: true,
|
|
|
|
fold10: true,
|
|
|
|
|
|
|
|
// form
|
|
|
|
examId: '',
|
|
|
|
period: '1',
|
|
|
|
|
|
|
|
beginDate: '',
|
|
|
|
endDate: '',
|
|
|
|
isBloodRoutine: 2,
|
|
|
|
isBiochemical: 2,
|
|
|
|
alt: '',
|
|
|
|
ast: '',
|
|
|
|
bilirubin: '',
|
|
|
|
isCFIxActivity: 2,
|
|
|
|
clottingFactor: '',
|
|
|
|
isCFIxInhibitor: 2,
|
|
|
|
cFII: '',
|
|
|
|
isHepatitisB: 2,
|
|
|
|
hbsAg: '',
|
|
|
|
hbvDNA: '',
|
|
|
|
isHepatitisC: 2,
|
|
|
|
hcvAntibody: '',
|
|
|
|
hcvRNA: '',
|
|
|
|
isHivAntibody: 2,
|
|
|
|
hiv: '',
|
|
|
|
isAfp: 2,
|
|
|
|
afp: '',
|
|
|
|
isAav: 2,
|
|
|
|
aav: '',
|
|
|
|
isOther: 2,
|
|
|
|
otherInfo: '',
|
|
|
|
|
|
|
|
attachmentList1: [],
|
|
|
|
attachmentList2: [],
|
|
|
|
attachmentList3: [],
|
|
|
|
attachmentList4: [],
|
|
|
|
attachmentList5: [],
|
|
|
|
attachmentList6: [],
|
|
|
|
attachmentList7: [],
|
|
|
|
attachmentList8: [],
|
|
|
|
attachmentList9: [],
|
|
|
|
attachmentList10: [],
|
|
|
|
|
|
|
|
formKeys: [
|
|
|
|
'beginDate',
|
|
|
|
'endDate',
|
|
|
|
'isBloodRoutine',
|
|
|
|
'isBiochemical',
|
|
|
|
'alt',
|
|
|
|
'ast',
|
|
|
|
'bilirubin',
|
|
|
|
'isCFIxActivity',
|
|
|
|
'clottingFactor',
|
|
|
|
'isCFIxInhibitor',
|
|
|
|
'cFII',
|
|
|
|
'isHepatitisB',
|
|
|
|
'hbsAg',
|
|
|
|
'hbvDNA',
|
|
|
|
'isHepatitisC',
|
|
|
|
'hcvAntibody',
|
|
|
|
'hcvRNA',
|
|
|
|
'isHivAntibody',
|
|
|
|
'hiv',
|
|
|
|
'isAfp',
|
|
|
|
'afp',
|
|
|
|
'isAav',
|
|
|
|
'aav',
|
|
|
|
'isOther',
|
|
|
|
'otherInfo',
|
|
|
|
],
|
|
|
|
|
|
|
|
checkNum: 0,
|
|
|
|
checkList: [
|
|
|
|
'isBloodRoutine',
|
|
|
|
'isBiochemical',
|
|
|
|
'isCFIxActivity',
|
|
|
|
'isCFIxInhibitor',
|
|
|
|
'isHepatitisB',
|
|
|
|
'isHepatitisC',
|
|
|
|
'isHivAntibody',
|
|
|
|
'isAfp',
|
|
|
|
'isAav',
|
|
|
|
'isOther',
|
|
|
|
],
|
|
|
|
|
|
|
|
dict: {
|
|
|
|
result: {},
|
|
|
|
number: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onLoad(options) {
|
|
|
|
this.setData({
|
|
|
|
examId: options.examid || '',
|
|
|
|
period: options.period || '1',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
const { formKeys, period } = this.data
|
|
|
|
const examinationCache = wx.getStorageSync(`examinationCache${period}`)
|
|
|
|
app.waitLogin().then(() => {
|
|
|
|
this.getDict()
|
|
|
|
if (examinationCache) {
|
|
|
|
const reset = formKeys.reduce((pre, cur) => {
|
|
|
|
pre[cur] = examinationCache[cur] || ''
|
|
|
|
return pre
|
|
|
|
}, {})
|
|
|
|
this.setData({
|
|
|
|
...reset,
|
|
|
|
})
|
|
|
|
this.getCheckNum()
|
|
|
|
} else {
|
|
|
|
this.getDetail()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onUnload() {
|
|
|
|
this.updateSave()
|
|
|
|
},
|
|
|
|
onHide() {
|
|
|
|
this.updateSave()
|
|
|
|
},
|
|
|
|
getDict() {
|
|
|
|
wx.ajax({
|
|
|
|
method: 'GET',
|
|
|
|
url: '?r=wtx/treatment/get-dict',
|
|
|
|
data: {},
|
|
|
|
}).then((res) => {
|
|
|
|
this.setData({
|
|
|
|
dict: res,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getDetail() {
|
|
|
|
const { examId, formKeys } = this.data
|
|
|
|
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,
|
|
|
|
attachmentList1: res.attachmentList[1] || [],
|
|
|
|
attachmentList2: res.attachmentList[2] || [],
|
|
|
|
attachmentList3: res.attachmentList[3] || [],
|
|
|
|
attachmentList4: res.attachmentList[4] || [],
|
|
|
|
attachmentList5: res.attachmentList[5] || [],
|
|
|
|
attachmentList6: res.attachmentList[6] || [],
|
|
|
|
attachmentList7: res.attachmentList[7] || [],
|
|
|
|
attachmentList8: res.attachmentList[8] || [],
|
|
|
|
attachmentList9: res.attachmentList[9] || [],
|
|
|
|
attachmentList10: res.attachmentList[10] || [],
|
|
|
|
})
|
|
|
|
this.getCheckNum()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
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()
|
|
|
|
this.getCheckNum()
|
|
|
|
},
|
|
|
|
getCheckNum() {
|
|
|
|
const { checkList } = this.data
|
|
|
|
let num = 0
|
|
|
|
checkList.forEach((item) => {
|
|
|
|
if (this.data[item] == 1) {
|
|
|
|
num += 1
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.setData({
|
|
|
|
checkNum: num,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleSelect(e: any) {
|
|
|
|
const { key, value } = e.currentTarget.dataset
|
|
|
|
this.setData({
|
|
|
|
[key]: value,
|
|
|
|
})
|
|
|
|
this.updateSave()
|
|
|
|
},
|
|
|
|
updateSave() {
|
|
|
|
const { formKeys, period, examId, ...reset } = this.data
|
|
|
|
const form = formKeys.reduce((pre, cur) => {
|
|
|
|
pre[cur] = reset[cur]
|
|
|
|
return pre
|
|
|
|
}, {})
|
|
|
|
const storageKey = `examinationCache${period}`
|
|
|
|
wx.setStorageSync(storageKey, form)
|
|
|
|
|
|
|
|
wx.ajax({
|
|
|
|
method: 'POST',
|
|
|
|
url: '?r=wtx/treatment/save-examination',
|
|
|
|
data: {
|
|
|
|
examId,
|
|
|
|
period,
|
|
|
|
...form,
|
|
|
|
},
|
|
|
|
}).then(() => {
|
|
|
|
wx.removeStorageSync(storageKey)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
setFile(e: any) {
|
|
|
|
console.log('DEBUGPRINT[63]: index.ts:189: e=', e)
|
|
|
|
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,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
export {}
|