248 lines
7.2 KiB
JavaScript
248 lines
7.2 KiB
JavaScript
/*
|
|
* 手太欠
|
|
* 愿这世界都如故事里一样 美好而动人~
|
|
*/
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
numberWrite : '', //第几次填写报告
|
|
disabled : false, //按钮样式
|
|
sexName : 'man',
|
|
caseId : '', //档案ID
|
|
symptoms: [],
|
|
// 血脂
|
|
hyperlipidemia:{
|
|
Max : '',
|
|
Min : '',
|
|
Number:'',
|
|
Id :'',
|
|
showpath: '',
|
|
path : ''
|
|
},
|
|
|
|
// 血压
|
|
hypertension: {
|
|
Max : '',
|
|
Min : '',
|
|
High : '',
|
|
Number:'',
|
|
Id :'',
|
|
showpath: '',
|
|
path : ''
|
|
},
|
|
|
|
// 血糖
|
|
hyperglycemia: {
|
|
Max : '',
|
|
Min : '',
|
|
Number:'',
|
|
Id :'',
|
|
showpath: '',
|
|
path : ''
|
|
},
|
|
|
|
// 尿酸
|
|
ua: {
|
|
Max : '',
|
|
Min : '',
|
|
Number:'',
|
|
Id :'',
|
|
showpath: '',
|
|
path : ''
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
console.log(options)
|
|
this.setData({
|
|
numberWrite : options.number,
|
|
caseId : options.caseid
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
// 健康前置信息
|
|
wx.$api.member.goutCreate().then(res => {
|
|
this.setData({
|
|
// 血脂
|
|
['hyperlipidemia.Max']: Number(res.data.count.man.hyperlipidemia.max),
|
|
['hyperlipidemia.Min']: Number(res.data.count.man.hyperlipidemia.min),
|
|
|
|
// 血压
|
|
['hypertension.Max']: Number(res.data.count.man.hypertension.max),
|
|
['hypertension.Min']: Number(res.data.count.man.hypertension.min),
|
|
|
|
// 血糖
|
|
['hyperglycemia.Max']: Number(res.data.count.man.hyperglycemia.max),
|
|
['hyperglycemia.Min']: Number(res.data.count.man.hyperglycemia.min),
|
|
|
|
// 尿酸
|
|
['ua.Max']: Number(res.data.count.man.ua.max),
|
|
['ua.Min']: Number(res.data.count.man.ua.min),
|
|
})
|
|
}).catch(err => {})
|
|
|
|
// 反馈前置信息
|
|
wx.$api.member.goutSee().then(res => {
|
|
this.setData({
|
|
symptoms: res.data.case.symptoms,
|
|
sexName : res.data.case.sex
|
|
})
|
|
}).catch(err => {})
|
|
},
|
|
|
|
/**
|
|
* 记录值
|
|
*/
|
|
recordInput(e) {
|
|
let value = Number(e.detail.value),
|
|
name = e.target.dataset.name,
|
|
id = e.target.dataset.id
|
|
if(name == 'hyperlipidemia') {
|
|
// 血脂
|
|
this.setData({
|
|
['hyperlipidemia.Number']: value,
|
|
['hyperlipidemia.Id']: id
|
|
})
|
|
} else if(name == 'hypertension') {
|
|
// 血压
|
|
this.setData({
|
|
['hypertension.Number']: value,
|
|
['hypertension.Id']: id
|
|
})
|
|
} else if(name == 'hyperglycemia') {
|
|
// 血糖
|
|
this.setData({
|
|
['hyperglycemia.Number']: value,
|
|
['hyperglycemia.Id']: id
|
|
})
|
|
} else {
|
|
// 尿酸
|
|
this.setData({
|
|
['ua.Number']: value,
|
|
['ua.Id']: id
|
|
})
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 记录高血压值
|
|
*/
|
|
highInput(e) {
|
|
this.setData({
|
|
['hypertension.High']: Number(e.detail.value)
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 上传图片
|
|
*/
|
|
updImg(type){
|
|
let newName = type.currentTarget.dataset.name
|
|
wx.chooseMedia({
|
|
count : 1,
|
|
success : path => {
|
|
// 上传图片
|
|
wx.$api.file.uploadImg(path.tempFiles[0].tempFilePath, {}).then(res=>{
|
|
if(newName == 'hyperlipidemia') {
|
|
// 血脂
|
|
this.setData({
|
|
['hyperlipidemia.showpath']: res.url,
|
|
['hyperlipidemia.path']: res.path
|
|
})
|
|
} else if(newName == 'hypertension') {
|
|
// 血压
|
|
this.setData({
|
|
['hypertension.showpath']: res.url,
|
|
['hypertension.path']: res.path
|
|
})
|
|
} else if(newName == 'hyperglycemia') {
|
|
// 血糖
|
|
this.setData({
|
|
['hyperglycemia.showpath']: res.url,
|
|
['hyperglycemia.path']: res.path
|
|
})
|
|
} else {
|
|
// 尿酸
|
|
this.setData({
|
|
['ua.showpath']: res.url,
|
|
['ua.path']: res.path
|
|
})
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 提交表单
|
|
*/
|
|
uploadSubmit(val) {
|
|
let dataArr = []
|
|
let symptoms = this.data.symptoms
|
|
for(let val of symptoms){
|
|
switch (val.symptom_id){
|
|
// 血脂
|
|
case this.data.hyperlipidemia.Id:
|
|
dataArr.push({
|
|
symptom_id : val.symptom_id,
|
|
high : 0,
|
|
low : this.data.hyperlipidemia.Number,
|
|
cover : this.data.hyperlipidemia.path
|
|
})
|
|
break;
|
|
// 血压
|
|
case this.data.hypertension.Id:
|
|
dataArr.push({
|
|
symptom_id : val.symptom_id,
|
|
high : this.data.hypertension.High,
|
|
low : this.data.hypertension.Number,
|
|
cover : this.data.hypertension.path
|
|
})
|
|
break;
|
|
// 血糖
|
|
case this.data.hyperglycemia.Id:
|
|
dataArr.push({
|
|
symptom_id : val.symptom_id,
|
|
high : 0,
|
|
low : this.data.hyperglycemia.Number,
|
|
cover : this.data.hyperglycemia.path
|
|
})
|
|
break;
|
|
// 尿酸
|
|
case this.data.ua.Id:
|
|
dataArr.push({
|
|
symptom_id : val.symptom_id,
|
|
high : 0,
|
|
low : this.data.ua.Number,
|
|
cover : this.data.ua.path
|
|
})
|
|
break;
|
|
default:
|
|
// wx.showToast({
|
|
// title: '请填写完整信息',
|
|
// icon : 'none'
|
|
// })
|
|
// break;
|
|
}
|
|
}
|
|
|
|
let data = {
|
|
remark : val.detail.value.remark,
|
|
symptoms: dataArr
|
|
}
|
|
wx.$api.member.AddlastLog(this.data.caseId,data).then(res => {
|
|
wx.navigateBack()
|
|
}).catch(err => {})
|
|
}
|
|
}) |