// pages/selectBg/selectBg.js var app = getApp() let common = require('../../config/common.js') Page({ /** * 页面的初始数据 */ data: { list:[], show:false, name:'', painId:'', relate:'', card:'', cardNum:'', menuList:[ // {name:"病理报告单",id:'0'}, {name:"检查报告单",id:'2'}, {name:"检验报告单",id:'1'}, ] }, naviToMsg(e){ let cardNum = this.data.cardNum console.log(e.currentTarget.dataset.item.id) let id = e.currentTarget.dataset.item.id wx.navigateTo({ url: '/pages/bgMsg/bgMsg?cardNum='+cardNum+'&id='+id, }) }, getPerList(){ wx.request({ url:'https://fy.btlsoln.com:8443/getPatientByOpenid?openid', method:"GET", data:{ openid:app.globalData.openId }, header: { 'content-type': 'application/json' }, success: (res)=> { console.log(res,"患者") if(res.data.length > 0){ let data = res.data data.map((item,index) => { if(item.TYPE == 0){ this.setData({ name:item.TRUE_NAME, painId:item.PATIENT_ID, relate:item.RELATE, cardNum:item.MEDICAL_CARD, cardType:item.CARD_TYPE }) } }) this.setData({ list:data }) }else{ wx.showModal({ title: '', content: '您还未绑定就诊人,请先绑定就诊人信息!', cancelText:"否", confirmText:'是', success: function(res) { if (res.confirm) { wx.navigateTo({ url: '/pages/userMsgDel/userMsgDel?state=0', }) }else{ wx.switchTab({ url: '/pages/index/index', }) } } }) } } }) }, showPop(){ this.setData({ show: true }); }, onClose() { this.setData({ show: false }); }, confirm(e){ console.log(e.currentTarget.dataset.item) let user = e.currentTarget.dataset.item this.setData({ name:user.TRUE_NAME, painId:user.PATIENT_ID, relate:user.RELATE, card:user.ID_CARD, show:false, cardNum:user.MEDICAL_CARD }); }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if(app.globalData.openId == ""||app.globalData.openId==null){ wx.showToast({title: '加载中', icon: 'loading', duration: 30000}); common.checkGlobalOpenId().then(res=>{ app.globalData.openId = res this.getPerList() wx.hideToast(); }, err=>{ //初始化失败,弹框提示 }) }else{ this.getPerList() } // this.getPerList() // this.setData({ // name:app.globalData.name, // painId:app.globalData.painId, // type:app.globalData.relate, // card:app.globalData.sfId, // cardNum:app.globalData.cardNum // }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { wx.setNavigationBarTitle({ title: "选择报告类型", }) }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })