CheckReport.js 3.78 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
// 网络请求工具类
var networkUtil = require('../../utils/network_util.js')
var api = require('../../utils/apiFile.js')
var util = require('../../utils/util.js')
var event = require('../../utils/event.js')

Page({
data: {
dateList: {},
isShowOne: false,
isShowTwo: false,
isShowThree: false,
// 用户信息
userData:{},
// 时间下标
dateIndex:0,
monthText:'1月11日',
yearText:'2017',
todayInfo:'',
// 是否建档
subscribe:false,
// 问诊信息
wzInfo:''
},
onLoad: function (option) {

this.setData({
userData: getApp().globalData.userInfo
})
networkUtil.showLoading()
this.getCheckList()
},
isShowMore: function (e) {
var self = this
console.log(e)
var index = e.currentTarget.dataset.index
console.log(index)
if (index == 1) {
self.setData({
isShowOne: !self.data.isShowOne,
isShowTwo: false,
isShowThree: false,
})
} if (index == 2) {
if (!self.data.wzInfo.handl_suggest){
return
}
self.setData({
isShowOne: false,
isShowTwo: !self.data.isShowTwo,
isShowThree: false,
})
} if (index == 3) {
if (!self.data.wzInfo.guide_suggest) {
return
}
self.setData({
isShowOne: false,
isShowTwo: false,
isShowThree: !self.data.isShowThree,
})
}
},
toBefore(){
var index = this.data.dateIndex
index --
if (index < 0) {
index = this.data.dateList.length - 1
}
this.changeDateWithIndex(index)
},
toAfter() {
var index = this.data.dateIndex
index++
if (index >= this.data.dateList.length){
index = 0
}
this.changeDateWithIndex(index)
},
clickDate(e){
this.changeDateWithIndex(e.detail.value)
},
// 通过日期列表下标改变日期文字
changeDateWithIndex(index){
var text = this.data.dateList[index]
this.setData({
dateIndex: index,
yearText: this.setDateYearText(text),
monthText: this.setDateMonthText(text)
})
networkUtil.showLoading()
this.getCheckDetails()
this.getWzXinxi()
},
getCheckList() {
var self = this
// 列表
networkUtil._get(api.checkList,{}, function (res) {
// console.log('获取时间信息', res.data.data)
if (res.data.data[0].checkTime.length > 0){
self.setData({
dateList: res.data.data[0].checkTime
})
self.changeDateWithIndex(0)
}
}, function (res) {
wx.stopPullDownRefresh()
})
},
getCheckDetails() {
var self = this
var params = {}
params.patientId = getApp().globalData.userId[0]
// params.patientId = 88635
params.checkTime = this.data.dateList[this.data.dateIndex]
// 获取当天信息
networkUtil._get(api.checkDetails, params, function (res) {
console.log('获取当天信息', res)
var subscribe = false
if (res.data.data.nextcheck && res.data.data.nextcheck.length > 0){
subscribe = true
}
self.setData({
todayInfo: res.data.data,
subscribe: subscribe
})
}, function (res) {
wx.stopPullDownRefresh()
})
},
getWzXinxi() {
var self = this
var params = {}
params.patientId = getApp().globalData.userId[0]
// params.patientId = 88635
params.checkTime = this.data.dateList[this.data.dateIndex]
params.page = 0
params.limit = 30
// 具体检查信息
networkUtil._get(api.wzXinxi, params, function (res) {
console.log('获取详细信息', res)
self.setData({
list: res.data.list,
wzInfo: res.data
})
}, function (res) {

})
},
setDateYearText(text){
return text.substr(0, 5)
},
setDateMonthText(text) {
return text.substring(5, text.length)
}

})