...
|
...
|
@@ -4,18 +4,18 @@ |
|
|
const Page = require('../../utils/ald-stat.js').Page;
|
|
|
const app = getApp();
|
|
|
Page({
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
showdoctor:false,//是否显示首页医生信息
|
|
|
show_notest:false,//显示有记录和无记录之间的切换
|
|
|
showfilesLog:false,//是否显示最新记录(没有记录不显示)
|
|
|
filesLogdata:'',//档案数量
|
|
|
doctorinfo:[],//医生信息
|
|
|
fileslog:{},//最新记录
|
|
|
},
|
|
|
goaddrecord(files_id, patient){
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
showdoctor: false, //是否显示首页医生信息
|
|
|
show_notest: false, //显示有记录和无记录之间的切换
|
|
|
showfilesLog: false, //是否显示最新记录(没有记录不显示)
|
|
|
filesLogdata: '', //档案数量
|
|
|
doctorinfo: [], //医生信息
|
|
|
fileslog: {}, //最新记录
|
|
|
},
|
|
|
goaddrecord(files_id, patient) {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/addrecord/addrecord?fields_id=' + files_id + '&patient=' + patient,
|
|
|
success: function(res) {},
|
...
|
...
|
@@ -23,24 +23,24 @@ Page({ |
|
|
complete: function(res) {},
|
|
|
})
|
|
|
},
|
|
|
gointroduce(e){
|
|
|
gointroduce(e) {
|
|
|
console.log(e.currentTarget.dataset.id);
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/introduce/introduce?doctor_id=' + e.currentTarget.dataset.id,
|
|
|
success: function (res) { },
|
|
|
fail: function (res) { },
|
|
|
complete: function (res) { },
|
|
|
success: function(res) {},
|
|
|
fail: function(res) {},
|
|
|
complete: function(res) {},
|
|
|
})
|
|
|
},
|
|
|
gonormal(){
|
|
|
gonormal() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/normal/normal',
|
|
|
success: function (res) { },
|
|
|
fail: function (res) { },
|
|
|
complete: function (res) { },
|
|
|
success: function(res) {},
|
|
|
fail: function(res) {},
|
|
|
complete: function(res) {},
|
|
|
})
|
|
|
},
|
|
|
goarticle(){
|
|
|
goarticle() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/article/article',
|
|
|
success: function(res) {},
|
...
|
...
|
@@ -48,14 +48,14 @@ Page({ |
|
|
complete: function(res) {},
|
|
|
})
|
|
|
},
|
|
|
gorecord(e){
|
|
|
let that=this;
|
|
|
if (that.data.showfilesLog){
|
|
|
gorecord(e) {
|
|
|
let that = this;
|
|
|
if (that.data.showfilesLog) {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/record/record?showrecord=' + e.currentTarget.dataset.showrecord + '&files_id=' +
|
|
|
e.currentTarget.dataset.files_id,
|
|
|
})
|
|
|
}else{
|
|
|
} else {
|
|
|
wx.showToast({
|
|
|
title: '暂无记录',
|
|
|
icon: 'none',
|
...
|
...
|
@@ -63,99 +63,98 @@ Page({ |
|
|
})
|
|
|
}
|
|
|
},
|
|
|
gofile_manage(files_id){
|
|
|
gofile_manage(files_id) {
|
|
|
console.log(files_id)
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/file_manage/file_manage?files_id=' + files_id,
|
|
|
})
|
|
|
},
|
|
|
//到文章详情
|
|
|
goarticle_details(e){
|
|
|
goarticle_details(e) {
|
|
|
console.log(e)
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/article_detail/article_detail?id='+e.currentTarget.id,
|
|
|
url: '/pages/article_detail/article_detail?id=' + e.currentTarget.id,
|
|
|
success: function(res) {},
|
|
|
fail: function(res) {},
|
|
|
complete: function(res) {},
|
|
|
})
|
|
|
},
|
|
|
//判断是否有医生id和是否登陆
|
|
|
ifdoctorid(){
|
|
|
let that=this;
|
|
|
if (app.globalData.doctorid == 0) {//没有传过来的doctorid
|
|
|
let url ='public/checkOpenid';
|
|
|
let params={
|
|
|
openid: wx.getStorageSync('openid')
|
|
|
}
|
|
|
app.post(url,params).then((res)=>{
|
|
|
wx.setStorageSync('token', res.token);
|
|
|
if (res.doctor_id==0){//没有关联医生
|
|
|
that.setData({
|
|
|
showdoctor:false
|
|
|
})
|
|
|
}else{//有关联医生获取医生详情
|
|
|
app.globalData.doctor_id = res.doctor_id;
|
|
|
app.globalData.doctorid = res.doctorid;
|
|
|
that.getDoctorInfo(doctorid);
|
|
|
}
|
|
|
}).catch((errMsg)=>{
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
}else{
|
|
|
that.getDoctorInfo(app.globalData.doctorid);
|
|
|
that.bindDoctor(app.globalData.doctorid);
|
|
|
}
|
|
|
ifdoctorid(openid) {
|
|
|
let that = this;
|
|
|
let url = 'public/checkOpenid';
|
|
|
let params = {
|
|
|
openid:openid
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
wx.setStorageSync('token', res.token);
|
|
|
if (res.doctor_id == 0) { //没有关联医生
|
|
|
if (app.globalData.doctorid == 0) { //没有传过来的doctorid
|
|
|
that.setData({
|
|
|
showdoctor: false
|
|
|
})
|
|
|
} else {
|
|
|
that.getDoctorInfo(app.globalData.doctorid);
|
|
|
that.bindDoctor(openid,app.globalData.doctorid);
|
|
|
}
|
|
|
} else { //有关联医生获取医生详情
|
|
|
app.globalData.doctor_id = res.doctor_id;
|
|
|
app.globalData.doctorid = res.doctorid;
|
|
|
that.getDoctorInfo(res.doctorid);
|
|
|
}
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
},
|
|
|
//绑定医生
|
|
|
bindDoctor(doctorid){
|
|
|
let that=this;
|
|
|
let url ='public/bindDoctor';
|
|
|
let params={
|
|
|
openid: wx.getStorageSync('openid'),
|
|
|
doctorid: doctorid
|
|
|
}
|
|
|
app.post(url,params).then((res)=>{
|
|
|
}).catch((errMsg)=>{
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
bindDoctor(openid, doctorid) {
|
|
|
let that = this;
|
|
|
let url = 'public/bindDoctor';
|
|
|
let params = {
|
|
|
openid: openid,
|
|
|
doctorid: doctorid
|
|
|
}
|
|
|
app.post(url, params).then((res) => {}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
},
|
|
|
//获取医生详情,医生ID有两个用处不同
|
|
|
getDoctorInfo(doctorid){
|
|
|
let that=this;
|
|
|
let url = 'index/getDoctorInfo';
|
|
|
let params = {
|
|
|
// doctorid: doctorid//暂时
|
|
|
doctorid:'tigeryang01'
|
|
|
getDoctorInfo(doctorid) {
|
|
|
let that = this;
|
|
|
let url = 'index/getDoctorInfo';
|
|
|
let params = {
|
|
|
// doctorid: doctorid//暂时
|
|
|
doctorid: 'tigeryang01'
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
if (res.avatar == '') {
|
|
|
res.avatar = '../../img/no_puimg.png'
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
if (res.avatar == ''){
|
|
|
res.avatar ='../../img/no_puimg.png'
|
|
|
}
|
|
|
that.setData({
|
|
|
doctorinfo: res,
|
|
|
showdoctor:true
|
|
|
})
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
that.setData({
|
|
|
doctorinfo: res,
|
|
|
showdoctor: true
|
|
|
})
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
},
|
|
|
//获取文章列表
|
|
|
getArticleList(){
|
|
|
let that=this;
|
|
|
let url ='index/getArticleList';
|
|
|
let params={//参数暂时
|
|
|
doctor_id:1,
|
|
|
page:1,
|
|
|
list_rows:5
|
|
|
getArticleList() {
|
|
|
let that = this;
|
|
|
let url = 'index/getArticleList';
|
|
|
let params = { //参数暂时
|
|
|
doctor_id: 1,
|
|
|
page: 1,
|
|
|
list_rows: 5
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
let list=res.data;
|
|
|
for(let obj of list){
|
|
|
if (obj.more.thumbnail==''){
|
|
|
obj.more.thumbnail ='../../img/LoadFail.png'
|
|
|
let list = res.data;
|
|
|
for (let obj of list) {
|
|
|
if (obj.more.thumbnail == '') {
|
|
|
obj.more.thumbnail = '../../img/LoadFail.png'
|
|
|
}
|
|
|
}
|
|
|
res.data=list;
|
|
|
res.data = list;
|
|
|
that.setData({
|
|
|
articlelist: res
|
|
|
})
|
...
|
...
|
@@ -164,7 +163,7 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
//到添加患者界面
|
|
|
goaddfile(){
|
|
|
goaddfile() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/addfile/addfile',
|
|
|
success: function(res) {},
|
...
|
...
|
@@ -173,53 +172,53 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
//获取最新病情记录
|
|
|
getLastFilesLog(){
|
|
|
let that=this;
|
|
|
let url ='index/getLastFilesLog';
|
|
|
let params={
|
|
|
'openid': wx.getStorageSync('openid')
|
|
|
}
|
|
|
app.post(url,params).then((res)=>{
|
|
|
if (res.more.length != 0 ){
|
|
|
if (res.doctor_reply == null) {
|
|
|
res.doctor_reply = '等待医生回复'
|
|
|
}
|
|
|
that.setData({
|
|
|
showfilesLog:true,
|
|
|
fileslog:res
|
|
|
})
|
|
|
}else{
|
|
|
that.setData({
|
|
|
showfilesLog: false,
|
|
|
fileslog: res
|
|
|
})
|
|
|
}
|
|
|
}).catch((errMsg)=>{
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
getLastFilesLog(openid) {
|
|
|
let that = this;
|
|
|
let url = 'index/getLastFilesLog';
|
|
|
let params = {
|
|
|
'openid': openid
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
if (res.more.length != 0) {
|
|
|
if (res.doctor_reply == null) {
|
|
|
res.doctor_reply = '等待医生回复'
|
|
|
}
|
|
|
that.setData({
|
|
|
showfilesLog: true,
|
|
|
fileslog: res
|
|
|
})
|
|
|
} else {
|
|
|
that.setData({
|
|
|
showfilesLog: false,
|
|
|
fileslog: res
|
|
|
})
|
|
|
}
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
},
|
|
|
//获取档案数
|
|
|
getFilesNumber(){
|
|
|
let that=this;
|
|
|
let url='index/getFilesNumber';
|
|
|
let params={
|
|
|
openid: wx.getStorageSync('openid')
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
if(res==0){
|
|
|
that.setData({
|
|
|
filesLogdata:res,
|
|
|
show_notest:true//显示没有档案,没有记录
|
|
|
})
|
|
|
}else{
|
|
|
that.setData({
|
|
|
filesLogdata: res,
|
|
|
show_notest: false
|
|
|
getFilesNumber(openid) {
|
|
|
let that = this;
|
|
|
let url = 'index/getFilesNumber';
|
|
|
let params = {
|
|
|
openid: openid
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
if (res == 0) {
|
|
|
that.setData({
|
|
|
filesLogdata: res,
|
|
|
show_notest: true //显示没有档案,没有记录
|
|
|
})
|
|
|
} else {
|
|
|
that.setData({
|
|
|
filesLogdata: res,
|
|
|
show_notest: false
|
|
|
})
|
|
|
}
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
}
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
},
|
|
|
//授权
|
|
|
getopwer(e) {
|
...
|
...
|
@@ -236,17 +235,23 @@ Page({ |
|
|
wx.setStorageSync('openid', res.openid);
|
|
|
wx.setStorageSync('session_key', res.session_key);
|
|
|
if (e.currentTarget.dataset.tag == '1') {
|
|
|
|
|
|
that.login(res.openid, res.session_key, e.detail.encryptedData, e.detail.iv, '', '', e.currentTarget.dataset.tag);
|
|
|
|
|
|
|
|
|
} else if (e.currentTarget.dataset.tag == '2') {
|
|
|
|
|
|
that.login(res.openid, res.session_key, e.detail.encryptedData, e.detail.iv, e.currentTarget.dataset.files_id, '', e.currentTarget.dataset.tag);
|
|
|
|
|
|
|
|
|
} else if (e.currentTarget.dataset.tag == '3') {
|
|
|
|
|
|
that.login(res.openid, res.session_key, e.detail.encryptedData, e.detail.iv, e.currentTarget.dataset.files_id, e.currentTarget.dataset.patient, e.currentTarget.dataset.tag);
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
// 调用sendSession方法,将session_key以参数形式传入
|
|
|
that.aldstat.sendSession(res.session_key);
|
|
|
// 调用sendOpenid方法,将openid以参数形式传入
|
|
|
that.aldstat.sendOpenid(res.openid);
|
|
|
|
|
|
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
...
|
...
|
@@ -254,7 +259,7 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
//用户登陆
|
|
|
login(openid, session_key, encryptedData, iv, files_id='', patient='',tag) {
|
|
|
login(openid, session_key, encryptedData, iv, files_id = '', patient = '', tag) {
|
|
|
console.log('files_id', files_id);
|
|
|
console.log('patient', patient);
|
|
|
console.log('tag', tag);
|
...
|
...
|
@@ -272,80 +277,99 @@ Page({ |
|
|
that.setData({
|
|
|
userInfo: app.globalData.userInfo,
|
|
|
})
|
|
|
if(tag=='1'){
|
|
|
if (tag == '1') {
|
|
|
that.goaddfile();
|
|
|
}else if(tag=='2'){
|
|
|
} else if (tag == '2') {
|
|
|
that.gofile_manage(files_id);
|
|
|
}else if(tag == '3'){
|
|
|
} else if (tag == '3') {
|
|
|
that.goaddrecord(files_id, patient);
|
|
|
}
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
let that=this;
|
|
|
that.ifdoctorid();//判断是否有医生ID
|
|
|
that.getArticleList();//获取文章列表
|
|
|
that.getFilesNumber();//获取档案数量
|
|
|
let openid = wx.getStorageSync('openid');//获取最新记录
|
|
|
if(openid != ''){
|
|
|
that.getLastFilesLog();
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
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.getArticleList(res.openid); //获取文章列表
|
|
|
that.getFilesNumber(res.openid); //获取档案数量
|
|
|
that.getLastFilesLog(res.openid);
|
|
|
app.setStatisticsVisitorLog('/pages/index/index'); //统计打开界面数量
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
}
|
|
|
app.setStatisticsVisitorLog('/pages/index/index');//统计打开界面数量
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function () {
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function (options) {
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function() {},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function(options) {
|
|
|
let that = this;
|
|
|
that.ifdoctorid();//判断是否有医生ID
|
|
|
that.getArticleList();//获取文章列表
|
|
|
that.getFilesNumber();//获取档案数量
|
|
|
let openid = wx.getStorageSync('openid');//获取最新记录
|
|
|
if (openid != '') {
|
|
|
that.getLastFilesLog();
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function () {
|
|
|
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function () {
|
|
|
|
|
|
},
|
|
|
wx.login({
|
|
|
success: (res) => {
|
|
|
let url = 'public/getSessionKey';
|
|
|
let params = {
|
|
|
code: res.code
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
that.ifdoctorid(res.openid); //判断是否有医生ID
|
|
|
that.getArticleList(res.openid); //获取文章列表
|
|
|
that.getFilesNumber(res.openid); //获取档案数量
|
|
|
that.getLastFilesLog(res.openid);
|
|
|
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg)
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function() {
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
},
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
},
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
}
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function() {
|
|
|
|
|
|
}
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|