...
|
...
|
@@ -8,7 +8,7 @@ Page({ |
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
showdoctor: true, //是否显示首页医生信息
|
|
|
showdoctor: false, //是否显示首页医生信息
|
|
|
show_notest: false, //显示有记录和无记录之间的切换
|
|
|
showfilesLog: false, //是否显示最新记录(没有记录不显示)
|
|
|
showdoc_adv:true,
|
...
|
...
|
@@ -16,6 +16,7 @@ Page({ |
|
|
filesLogdata: '', //档案数量
|
|
|
doctorinfo: [], //医生信息
|
|
|
fileslog: {}, //最新记录
|
|
|
hasToken: false
|
|
|
},
|
|
|
goaddrecord(files_id, patient) {
|
|
|
wx.navigateTo({
|
...
|
...
|
@@ -64,9 +65,12 @@ Page({ |
|
|
})
|
|
|
}
|
|
|
},
|
|
|
addrecord(e){
|
|
|
this.goaddrecord(e.currentTarget.dataset.files_id, e.currentTarget.dataset.patient);
|
|
|
},
|
|
|
gofile_manage(files_id) {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/file_manage/file_manage?files_id=' + files_id,
|
|
|
url: '/pages/file_choose/file_choose?files_id=' + files_id,
|
|
|
})
|
|
|
},
|
|
|
//到文章详情
|
...
|
...
|
@@ -90,14 +94,18 @@ Page({ |
|
|
that.getRecommendArticleList(openid, res.doctor_id);
|
|
|
if (res.doctor_id == 0) { //没有关联医生
|
|
|
if (app.globalData.doctorid == 0) { //没有传过来的doctorid
|
|
|
|
|
|
} else {
|
|
|
that.setData({
|
|
|
showdoctor: false
|
|
|
showdoctor: true
|
|
|
})
|
|
|
} else {
|
|
|
that.getDoctorInfo(app.globalData.doctorid);
|
|
|
that.bindDoctor(openid,app.globalData.doctorid);
|
|
|
}
|
|
|
} else { //有关联医生获取医生详情
|
|
|
that.setData({
|
|
|
showdoctor: true
|
|
|
})
|
|
|
app.globalData.doctor_id = res.doctor_id;
|
|
|
app.globalData.doctorid = res.doctorid;
|
|
|
that.getDoctorInfo(res.doctorid);
|
...
|
...
|
@@ -169,6 +177,9 @@ Page({ |
|
|
complete: function(res) {},
|
|
|
})
|
|
|
},
|
|
|
switchUser(e){
|
|
|
this.gofile_manage(e.currentTarget.dataset.files_id);
|
|
|
},
|
|
|
//获取最新病情记录
|
|
|
getLastFilesLog(openid) {
|
|
|
let that = this;
|
...
|
...
|
@@ -217,9 +228,9 @@ Page({ |
|
|
},
|
|
|
//授权
|
|
|
getopwer(e) {
|
|
|
console.log(e)
|
|
|
let that = this;
|
|
|
console.log('token',wx.getStorageSync('token'));
|
|
|
if (wx.getStorageSync('token') == undefined || wx.getStorageSync('token') == ''){
|
|
|
if (e.detail.encryptedData){
|
|
|
wx.login({
|
|
|
success: (res) => {
|
|
|
let url = 'public/login';
|
...
|
...
|
@@ -231,51 +242,52 @@ Page({ |
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
wx.setStorageSync('token', res.token);
|
|
|
if (e.currentTarget.dataset.tag == '1') {
|
|
|
that.setData({
|
|
|
hasToken: true
|
|
|
})
|
|
|
// if (e.currentTarget.dataset.tag == '1') {
|
|
|
that.goaddfile();
|
|
|
} else if (e.currentTarget.dataset.tag == '2') {
|
|
|
that.gofile_manage(e.currentTarget.dataset.files_id);
|
|
|
} else if (e.currentTarget.dataset.tag == '3') {
|
|
|
that.goaddrecord(e.currentTarget.dataset.files_id, e.currentTarget.dataset.patient);
|
|
|
}
|
|
|
// } else if (e.currentTarget.dataset.tag == '2') {
|
|
|
// that.gofile_manage(e.currentTarget.dataset.files_id);
|
|
|
// } else if (e.currentTarget.dataset.tag == '3') {
|
|
|
// that.goaddrecord(e.currentTarget.dataset.files_id, e.currentTarget.dataset.patient);
|
|
|
// }
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
}else{
|
|
|
if (e.currentTarget.dataset.tag == '1') {
|
|
|
that.goaddfile();
|
|
|
} else if (e.currentTarget.dataset.tag == '2') {
|
|
|
that.gofile_manage(e.currentTarget.dataset.files_id);
|
|
|
} else if (e.currentTarget.dataset.tag == '3') {
|
|
|
that.goaddrecord(e.currentTarget.dataset.files_id, e.currentTarget.dataset.patient);
|
|
|
}
|
|
|
wx.showToast({
|
|
|
title: '授权后才能正常使用',
|
|
|
icon:'none'
|
|
|
})
|
|
|
}
|
|
|
// if (wx.getStorageSync('token') == undefined || wx.getStorageSync('token') == ''){
|
|
|
|
|
|
// }else{
|
|
|
// if (e.currentTarget.dataset.tag == '1') {
|
|
|
// that.goaddfile();
|
|
|
// } else if (e.currentTarget.dataset.tag == '2') {
|
|
|
// that.gofile_manage(e.currentTarget.dataset.files_id);
|
|
|
// } else if (e.currentTarget.dataset.tag == '3') {
|
|
|
// that.goaddrecord(e.currentTarget.dataset.files_id, e.currentTarget.dataset.patient);
|
|
|
// }
|
|
|
// }
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
let that = this;
|
|
|
wx.login({
|
|
|
success: (res) => {
|
|
|
let url = 'public/getSessionKey';
|
|
|
let params = {
|
|
|
code: res.code
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
wx.setStorageSync('openid', res.openid)
|
|
|
that.ifdoctorid(res.openid); //判断是否有医生ID
|
|
|
that.getFilesNumber(res.openid); //获取档案数量
|
|
|
that.getLastFilesLog(res.openid);
|
|
|
app.setStatisticsVisitorLog('/pages/index/index'); //统计打开界面数量
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
// var openid = wx.getStorageSync('openid');
|
|
|
let token = wx.getStorageSync('token');
|
|
|
// 判断是否授权设置授权权限
|
|
|
if(token){
|
|
|
this.setData({
|
|
|
hasToken: true
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
...
|
...
|
@@ -286,22 +298,13 @@ Page({ |
|
|
*/
|
|
|
onShow: function(options) {
|
|
|
let that = this;
|
|
|
wx.login({
|
|
|
success: (res) => {
|
|
|
let url = 'public/getSessionKey';
|
|
|
let params = {
|
|
|
code: res.code
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
that.ifdoctorid(res.openid); //判断是否有医生ID
|
|
|
var openid = wx.getStorageSync('openid');
|
|
|
let token = wx.getStorageSync('token');
|
|
|
this.ifdoctorid(openid); //判断是否有医生ID
|
|
|
this.getFilesNumber(openid); //获取档案数量
|
|
|
this.getLastFilesLog(openid);
|
|
|
app.setStatisticsVisitorLog('/pages/index/index'); //统计打开界面数量
|
|
|
|
|
|
that.getFilesNumber(res.openid); //获取档案数量
|
|
|
that.getLastFilesLog(res.openid);
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
...
|
...
|
|