CheckReport.js 4.31 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
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
// 网络请求工具类
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,
flag: false,
// 问诊信息
wzInfo:'',
// 预约详细信息
subscribeDetails:''
},
onLoad: function (option) {
var date1 = new Date('2017-1-8')
console.log('date1', date1)
this.setData({
userData: getApp().globalData.userInfo
})
networkUtil.showLoading()
this.getCheckList()
},
isShowMore: function (e) {
var self = this
var index = e.currentTarget.dataset.index
if (index == 1) {
self.setData({
isShowOne: !self.data.isShowOne,
isShowTwo: false,
isShowThree: false,
})
} if (index == 2) {
if (!self.data.wzInfo.handlSuggest){
return
}
self.setData({
isShowOne: false,
isShowTwo: !self.data.isShowTwo,
isShowThree: false,
})
} if (index == 3) {
if (!self.data.wzInfo.guideSuggest) {
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)
},
// 查看预约建档
lookSubscribe(){
this.setData({ flag: true })
},
// 关闭预约建档
closeMask(){
this.setData({ flag: false })
},
// 通过日期列表下标改变日期文字
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) {
})
},
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
var subscribeDetail = {}
// 下次产检信息
if (res.data.data && res.data.data.nextcheck && res.data.data.nextcheck.length > 0){
subscribe = true
subscribeDetail.checkhospital = res.data.data.checkhospital
subscribeDetail.nextcheck = res.data.data.nextcheck
}
self.setData({
todayInfo: res.data.data,
subscribe: subscribe,
subscribeDetails: subscribeDetail
})
}, function (res) {
})
},
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)
if (res.data.diagnose && res.data.diagnose.length > 0) {
res.data.diagnose = res.data.diagnose.split(",")
}
self.setData({
wzInfo: res.data
})
}, function (res) {

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

})