checkupInput.js 4.32 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
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
var networkUtil = require('../../utils/network_util.js')
var api = require('../../utils/apiFile.js')
var networkUtil = require('../../utils/network_util.js')
var api = require('../../utils/apiFile.js')

var page
var isRefresh = false;
// 是否有更多
var app = getApp()
Page({
data: {
array: [],
hospitalId: "",
pid:"",
toDay: "",
temperature: "",
height: "",
weight: "",
headWidth: "",
bust: "",
feedArray:["母乳喂养","混合喂养","人工喂养"],
feed: "0",
canWork:true,
},
// 下拉刷新回调接口
onPullDownRefresh() {},
onLoad(e) {
var d = new Date();
var toDay = d.getFullYear() + "-" + ("00" + (d.getMonth() + 1)).substr(-2) + "-" + ("00" + d.getDate()).substr(-2);
this.setData({
toDay: toDay,
})
this.setData({
hospitalId: app.globalData.userInfo.hospitalId,
pid:app.globalData.userInfo.pid,
})
if(this.data.pid == ""||this.data.pid== undefined){
this.setData({
canWork:false
});
}
this.getList();
networkUtil._get(api.checkList,
{ patientId: getApp().globalData.currentId},
function (res) {
console.log(res)
})
},
getList() {
networkUtil._post(api.getCheckUpHistory, {
keyword: this.data.pid,
sort: this.data.hospitalId,
}, res => {
console.log(res)
if (res.statusCode == 200 && res.data.errorcode == 0) {
var data = res.data.data;
this.setData({
array: res.data.data[0].babyInfos
})
}
}, err => {

}, 'application/json')
},

inputtemperature(e) {
var temperature = this.data.temperature;
var data = e.detail.value;
if (data.indexOf('.') > -1 && data.indexOf('.')<data.length-2){
data = data.slice(0, -1)
}
if (data <= 50 && data >= 0) {
this.setData({
temperature: data
})
}else{
this.setData({
temperature:temperature
})
}
},
inputheight(e) {
var height = this.data.height;
var data = e.detail.value;
if (data.indexOf('.') > -1 && data.indexOf('.') < data.length - 2) {
data = data.slice(0,-1)
}
if (data <= 200 && data >= 0) {
this.setData({
height: data
})
}else{
this.setData({
height:height
})
}
},
inputweight(e) {
var weight = this.data.weight;
var data = e.detail.value;
if (data.indexOf('.') > -1 && data.indexOf('.') < data.length - 2) {
data = data.slice(0, -1)
}
if (data <= 50 && data >= 0) {
this.setData({
weight: data
})
}else{
this.setData({
weight:weight
})
}
},
inputheadWidth(e) {
var headWidth = this.data.headWidth;
var data = e.detail.value;
if (data.indexOf('.') > -1 && data.indexOf('.') < data.length - 2) {
data = data.slice(0, -1)
}
if (data <= 100 && data >= 0) {
this.setData({
headWidth: data
})
}else{
this.setData({
headWidth:headWidth
})
}
},
inputbust(e) {
var bust = this.data.bust;
var data = e.detail.value;
if (data.indexOf('.') > -1 && data.indexOf('.') < data.length - 2) {
data = data.slice(0, -1)
}
if (data <= 100 && data >= 0) {
this.setData({
bust: data
})
}else{
this.setData({
bust:bust
})
}
},
bindPickerChange: function (e) {
this.setData({
fhrLength: e.detail.value,
})
},
toMyApport() {
if (!this.data.canWork) {
wx.showModal({
title: '提示',
content: "游客用户不能录入产检信息!",
showCancel: false,
});
return;
};
if (isRefresh) {
return;
}
isRefresh = true;
networkUtil._post(api.setCheckUp, {
babyInfos: [
{
temperature: this.data.temperature,
height: this.data.height,
weight: this.data.weight,
headWidth: this.data.headWidth,
bust: this.data.bust,
feed: this.data.feed,
}
],
pid: this.data.pid,
hospitalId: this.data.hospitalId,
}, (res) => {
isRefresh = false
this.getList();
wx.showModal({
title: '成功提交',
content: '检查信息已提交!',
showCancel: false
});
}, (err) => {
isRefresh = false
}, 'application/json')
}
})