Commit 9faca9dec7d6c261d939456672abf59a8d41e5a3
1 parent
012e5ececd
Exists in
master
and in
2 other branches
pid修改
Showing 4 changed files with 51 additions and 104 deletions
littleApp_child/pages/CheckReport/CheckReport.js
View file @
9faca9d
... | ... | @@ -28,7 +28,11 @@ |
28 | 28 | isShowLeft: true, |
29 | 29 | isShowRight: false, |
30 | 30 | // 没数据 |
31 | - noData: 'no' | |
31 | + noData: 'no', | |
32 | + // 获取到的所以patent数据 | |
33 | + allPatient:[], | |
34 | + // 当前的pid | |
35 | + currentPID:'' | |
32 | 36 | }, |
33 | 37 | onLoad: function (option) { |
34 | 38 | this.setData({ |
35 | 39 | |
36 | 40 | |
... | ... | @@ -130,14 +134,19 @@ |
130 | 134 | // 通过日期列表下标改变日期文字 |
131 | 135 | changeDateWithIndex(index){ |
132 | 136 | var text = this.data.dateList[index] |
137 | + var patientId = this.getPatientIdWithDateStr(text) | |
138 | + if (!patientId){ | |
139 | + return | |
140 | + } | |
133 | 141 | this.setData({ |
134 | 142 | dateIndex: index, |
135 | 143 | yearText: this.setDateYearText(text), |
136 | - monthText: this.setDateMonthText(text) | |
144 | + monthText: this.setDateMonthText(text), | |
145 | + currentPID:patientId | |
137 | 146 | }) |
138 | 147 | networkUtil.showLoading() |
139 | - this.getCheckDetails() | |
140 | - this.getWzXinxi() | |
148 | + this.getCheckDetails(patientId) | |
149 | + this.getWzXinxi(patientId) | |
141 | 150 | }, |
142 | 151 | // 获取检查日期列表 |
143 | 152 | getCheckList() { |
144 | 153 | |
145 | 154 | |
146 | 155 | |
147 | 156 | |
148 | 157 | |
... | ... | @@ -146,17 +155,26 @@ |
146 | 155 | networkUtil._get(api.checkList, { patientId: getApp().globalData.userId[0]}, function (res) { |
147 | 156 | console.log('获取时间信息', res) |
148 | 157 | var showLeft = true |
149 | - if (res.data.data.length > 0 && res.data.data[0].checkTime.length > 0){ | |
158 | + | |
159 | + // 先遍历所有时间 存放 | |
160 | + var allCheckTimeArr = [] | |
161 | + res.data.data.map(function (item) { | |
162 | + var checkTimeArr = item.checkTime | |
163 | + allCheckTimeArr = allCheckTimeArr.concat(checkTimeArr) | |
164 | + }) | |
165 | + | |
166 | + if (allCheckTimeArr.length > 0){ | |
150 | 167 | // 只有一条数据两个圈圈都不显示 |
151 | - if (res.data.data[0].checkTime.length == 1){ | |
168 | + if (allCheckTimeArr.length == 1) { | |
152 | 169 | showLeft = false |
153 | - } | |
170 | + } | |
154 | 171 | self.setData({ |
155 | - dateList: res.data.data[0].checkTime.reverse(), | |
172 | + dateList: allCheckTimeArr.reverse(), | |
156 | 173 | isShowLeft:showLeft, |
157 | - noData: false | |
174 | + noData: false, | |
175 | + allPatient: res.data.data | |
158 | 176 | }) |
159 | - self.changeDateWithIndex(res.data.data[0].checkTime.length - 1) | |
177 | + self.changeDateWithIndex(allCheckTimeArr.length - 1) | |
160 | 178 | } else { |
161 | 179 | self.setData({ |
162 | 180 | noData:true |
163 | 181 | |
... | ... | @@ -167,10 +185,10 @@ |
167 | 185 | }) |
168 | 186 | }, |
169 | 187 | // 依据时间获取当天检查信息 |
170 | - getCheckDetails() { | |
188 | + getCheckDetails(patientId) { | |
171 | 189 | var self = this |
172 | 190 | var params = {} |
173 | - params.patientId = getApp().globalData.userId[0] | |
191 | + params.patientId = patientId | |
174 | 192 | // params.patientId = 88635 |
175 | 193 | params.checkTime = this.data.dateList[this.data.dateIndex] |
176 | 194 | // 获取当天信息 |
177 | 195 | |
... | ... | @@ -194,10 +212,10 @@ |
194 | 212 | }) |
195 | 213 | }, |
196 | 214 | // 获取问诊信息 |
197 | - getWzXinxi() { | |
215 | + getWzXinxi(patientId) { | |
198 | 216 | var self = this |
199 | 217 | var params = {} |
200 | - params.patientId = getApp().globalData.userId[0] | |
218 | + params.patientId = patientId | |
201 | 219 | // params.patientId = 88635 |
202 | 220 | params.checkTime = this.data.dateList[this.data.dateIndex] |
203 | 221 | params.page = 0 |
204 | 222 | |
... | ... | @@ -222,7 +240,19 @@ |
222 | 240 | // 设置月 日文字 |
223 | 241 | setDateMonthText(text) { |
224 | 242 | return text.substring(5, text.length) |
243 | + }, | |
244 | + // 通过时间获取id | |
245 | + getPatientIdWithDateStr(dateStr){ | |
246 | + var pid = null | |
247 | + this.data.allPatient.map(function(item){ | |
248 | + console.log(item) | |
249 | + item.checkTime.map(function (str) { | |
250 | + if(dateStr == str){ | |
251 | + pid = item.patientId | |
252 | + } | |
253 | + }) | |
254 | + }) | |
255 | + return pid | |
225 | 256 | } |
226 | - | |
227 | 257 | }) |
littleApp_child/pages/CheckReport/CheckReport.wxml
View file @
9faca9d
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | <view class="report_list_bg"> |
43 | 43 | <scroll-view class="report_list_scroll" scroll-x="true"> |
44 | 44 | <view class="report_list_item_bg"> |
45 | - <navigator class="report_list_item" url="../checkTabList/checkTabList?current_index=0{{'&checkTime=' + yearText + monthText}}"> | |
45 | + <navigator class="report_list_item" url="../checkTabList/checkTabList?current_index=0{{'&checkTime=' + yearText + monthText + '&patientId=' + currentPID}}"> | |
46 | 46 | <image src="../../source/wenzhenjiancha.png"></image> |
47 | 47 | <!-- <view class="greenColor report_list_item_dot"></view> --> |
48 | 48 | <label>问诊检查</label> |
littleApp_child/pages/checkTabList/checkTabList.js
View file @
9faca9d
... | ... | @@ -88,7 +88,7 @@ |
88 | 88 | other_textFZ:"" |
89 | 89 | }, |
90 | 90 | onLoad: function (e) { |
91 | - patientId = app.globalData.userId[0] | |
91 | + patientId = e.patientId | |
92 | 92 | checkTime = e.checkTime |
93 | 93 | // 数据初始化 |
94 | 94 | var self = this |
... | ... | @@ -113,13 +113,7 @@ |
113 | 113 | showMoreContent: function (e) { |
114 | 114 | var content = e.currentTarget.dataset.content // + "问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问诊检查问" |
115 | 115 | var title = e.currentTarget.dataset.title |
116 | - // wx.showModal({ | |
117 | - // title: title, | |
118 | - // content: content, | |
119 | - // showCancel: false, | |
120 | - // confirmText: '知道了', | |
121 | - // confirmColor: '#48C17B' | |
122 | - // }) | |
116 | + | |
123 | 117 | if(content.length>=4){ |
124 | 118 | this.setData({ |
125 | 119 | flag: true, |
... | ... | @@ -160,7 +154,7 @@ |
160 | 154 | |
161 | 155 | networkUtil.showLoading() |
162 | 156 | var param = { page: 10, limit: 100, patientId: patientId, checkTime: checkTime } |
163 | - // console.log(param) | |
157 | + console.log('param', param) | |
164 | 158 | networkUtil._get(api.wzXinxi, param, function (res) { |
165 | 159 | console.log(res) |
166 | 160 | var result = res.data.list[0] |
littleApp_child/utils/network_util.js
View file @
9faca9d
1 | 1 | |
2 | 2 | // 测试用户‘花雪莲’,手机号15928512992,验证码666666 |
3 | 3 | |
4 | -// 0测试环境 1正式环境 2演示环境 3衡水 | |
5 | -var Builing_Release_AppStore = 0 | |
4 | +// 0测试环境 1正式环境 2演示环境 3衡水 | |
5 | +var Builing_Release_AppStore = 1 | |
6 | 6 | // 获取服务器地址 |
7 | 7 | function kServerBaseUrl() { |
8 | 8 | switch (Builing_Release_AppStore) { |
9 | 9 | |
... | ... | @@ -18,86 +18,11 @@ |
18 | 18 | } |
19 | 19 | |
20 | 20 | /* |
21 | - 获取既往史类型 | |
22 | 21 | * port: 接口名称 类型字符串 |
23 | 22 | * params: 参数 类型json |
24 | 23 | * success: 成功回调 类型function |
25 | 24 | * fail: 失败回调 类型function |
26 | 25 | */ |
27 | -function _get2(port, params, success, fail) { | |
28 | - | |
29 | - wx.request({ | |
30 | - url: 'https://dev-rp-api.healthbaby.com.cn/' + port, | |
31 | - data: params, | |
32 | - method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT | |
33 | - header: { | |
34 | - 'content-type': 'application/json', | |
35 | - 'Authorization': getApp().globalData.token ? getApp().globalData.token : '' | |
36 | - }, // 设置请求的 header | |
37 | - success: function (res) { | |
38 | - // success | |
39 | - successData(res, success, fail) | |
40 | - }, | |
41 | - fail: function (res) { | |
42 | - var error = {} | |
43 | - error.errorcode = 404 | |
44 | - error.errormsg = '数据获取失败,请稍后再试' | |
45 | - console.log(res) | |
46 | - // fail | |
47 | - fail(error) | |
48 | - }, | |
49 | - complete: function (res) { | |
50 | - // complete | |
51 | - wx.hideToast() | |
52 | - // 小程序提供的api,通知页面停止下拉刷新效果 | |
53 | - wx.stopPullDownRefresh(); | |
54 | - } | |
55 | - }) | |
56 | -} | |
57 | - | |
58 | -/* | |
59 | - 获取地址 | |
60 | -* port: 接口名称 类型字符串 | |
61 | -* params: 参数 类型json | |
62 | -* success: 成功回调 类型function | |
63 | -* fail: 失败回调 类型function | |
64 | -*/ | |
65 | -function _getAddress(params, success, fail) { | |
66 | - wx.request({ | |
67 | - url: 'https://rp-api.healthbaby.com.cn/queryRegions', | |
68 | - data: params, | |
69 | - method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT | |
70 | - header: { | |
71 | - 'content-type': 'application/json' | |
72 | - }, // 设置请求的 header | |
73 | - success: function (res) { | |
74 | - // success | |
75 | - successData(res, success, fail) | |
76 | - }, | |
77 | - fail: function (res) { | |
78 | - var error = {} | |
79 | - error.errorcode = 404 | |
80 | - error.errormsg = '数据获取失败,请稍后再试' | |
81 | - console.log(res) | |
82 | - // fail | |
83 | - fail(error) | |
84 | - }, | |
85 | - complete: function (res) { | |
86 | - // complete | |
87 | - wx.hideToast() | |
88 | - // 小程序提供的api,通知页面停止下拉刷新效果 | |
89 | - wx.stopPullDownRefresh(); | |
90 | - } | |
91 | - }) | |
92 | -} | |
93 | - | |
94 | - | |
95 | -/* | |
96 | -* port: 接口名称 类型字符串 | |
97 | -* params: 参数 类型json | |
98 | -* success: 成功回调 类型function | |
99 | -* fail: 失败回调 类型function | |
100 | -*/ | |
101 | 26 | function _get(port, params, success, fail) { |
102 | 27 | console.log('---------------request_get-----------url:' + kServerBaseUrl() + port) |
103 | 28 | wx.request({ |
104 | 29 | |
... | ... | @@ -233,13 +158,11 @@ |
233 | 158 | |
234 | 159 | module.exports = { |
235 | 160 | _get: _get, |
236 | - _get2: _get2, | |
237 | 161 | _post: _post, |
238 | 162 | _put: _put, |
239 | 163 | showLoading: showLoading, |
240 | 164 | showErrorToast: showErrorToast, |
241 | 165 | Builing_Release_AppStore: Builing_Release_AppStore, |
242 | - _getAddress: _getAddress | |
243 | 166 | } |
244 | 167 | |
245 | 168 | // networkUtil._get(api,param,function(res){},function(res){}) |