Commit 3663e4c70137db7966ddfff5327ab8f06f5728d9
1 parent
450bf49366
Exists in
master
and in
1 other branch
update login add first change pwd
Showing 2 changed files with 234 additions and 23 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java
View file @
3663e4c
... | ... | @@ -7,10 +7,13 @@ |
7 | 7 | |
8 | 8 | import com.lyms.platform.common.annotation.TokenRequired; |
9 | 9 | import com.lyms.platform.common.base.LoginContext; |
10 | +import com.lyms.platform.common.utils.MessageUtil; | |
11 | +import com.lyms.platform.common.utils.PropertiesUtils; | |
10 | 12 | import com.lyms.platform.common.utils.StringUtils; |
11 | 13 | import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade; |
12 | 14 | import com.lyms.platform.operate.web.request.AntenatalExaminationQueryRequest; |
13 | 15 | import com.lyms.platform.operate.web.request.BabyManageRequest; |
16 | +import org.apache.commons.httpclient.HttpClient; | |
14 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
15 | 18 | import org.springframework.stereotype.Controller; |
16 | 19 | import org.springframework.web.bind.annotation.*; |
17 | 20 | |
... | ... | @@ -25,7 +28,9 @@ |
25 | 28 | import com.lyms.platform.operate.web.request.BookbuildingQueryRequest; |
26 | 29 | import com.lyms.platform.operate.web.request.YunBookbuildingAddRequest; |
27 | 30 | |
31 | +import java.io.IOException; | |
28 | 32 | |
33 | + | |
29 | 34 | /* |
30 | 35 | *孕妇建档 |
31 | 36 | * lqy |
... | ... | @@ -91,7 +96,7 @@ |
91 | 96 | bookbuildingQueryRequest.setVcCardNo(vcCardNo); |
92 | 97 | bookbuildingQueryRequest.setCardNo(cardNo); |
93 | 98 | LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext"); |
94 | - BaseListResponse listResponse = bookbuildingFacade.queryPregnantBuildRecord(bookbuildingQueryRequest,loginState.getId()); | |
99 | + BaseListResponse listResponse = bookbuildingFacade.queryPregnantBuildRecord(bookbuildingQueryRequest, loginState.getId()); | |
95 | 100 | return listResponse; |
96 | 101 | } |
97 | 102 | |
... | ... | @@ -159,6 +164,8 @@ |
159 | 164 | return objectResponse; |
160 | 165 | } |
161 | 166 | |
167 | + | |
168 | + public static final String center_statistics_url= PropertiesUtils.getPropertyValue("center_statistics_url"); | |
162 | 169 | /** |
163 | 170 | * 产检报告 |
164 | 171 | * @param request |
165 | 172 | |
... | ... | @@ -166,9 +173,8 @@ |
166 | 173 | */ |
167 | 174 | |
168 | 175 | @RequestMapping(value = "/queryChanJianReport", method = RequestMethod.GET) |
169 | - @ResponseBody | |
170 | 176 | @TokenRequired |
171 | - public BaseListResponse queryChanJianReport(HttpServletRequest request, | |
177 | + public void queryChanJianReport(HttpServletRequest request,HttpServletResponse response, | |
172 | 178 | @RequestParam(required = false) String exDateStart, |
173 | 179 | @RequestParam(required = false) String exDateEnd, |
174 | 180 | @RequestParam(required = false) String name, |
... | ... | @@ -186,25 +192,81 @@ |
186 | 192 | @RequestParam(required = false) Integer limit |
187 | 193 | ){ |
188 | 194 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
189 | - BaseListResponse objectResponse = bookbuildingFacade.queryChanJianReport(loginState.getId(), | |
190 | - exDateStart, | |
191 | - exDateEnd, | |
192 | - name, | |
193 | - weekStarts, | |
194 | - weekEnds, | |
195 | - hbsab, | |
196 | - hbeag, | |
197 | - hbeab, | |
198 | - hbcab, | |
199 | - syphilis, | |
200 | - hiv, | |
201 | - hcv, | |
202 | - doctorNo, | |
203 | - page, | |
204 | - limit | |
205 | - | |
206 | - ); | |
207 | - return objectResponse; | |
195 | + StringBuffer params = new StringBuffer(); | |
196 | + params.append("userId="); | |
197 | + params.append(loginState.getId()); | |
198 | + if (org.apache.commons.lang.StringUtils.isNotBlank(exDateStart)) { | |
199 | + params.append("&exDateStart="); | |
200 | + params.append(exDateStart); | |
201 | + } | |
202 | + if (org.apache.commons.lang.StringUtils.isNotBlank(exDateEnd)) { | |
203 | + params.append("&exDateEnd="); | |
204 | + params.append(exDateEnd); | |
205 | + } | |
206 | + if (org.apache.commons.lang.StringUtils.isNotBlank(name)) { | |
207 | + params.append("&name="); | |
208 | + params.append(name); | |
209 | + } | |
210 | + if (weekStarts != null) { | |
211 | + params.append("&weekStarts="); | |
212 | + params.append(weekStarts); | |
213 | + } | |
214 | + if (weekEnds != null) { | |
215 | + params.append("&weekEnds="); | |
216 | + params.append(weekEnds); | |
217 | + } | |
218 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hbsab)) { | |
219 | + params.append("&hbsab="); | |
220 | + params.append(hbsab); | |
221 | + } | |
222 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hbeag)) { | |
223 | + params.append("&hbeag="); | |
224 | + params.append(hbeag); | |
225 | + } | |
226 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hbeab)) { | |
227 | + params.append("&hbeab="); | |
228 | + params.append(hbeab); | |
229 | + } | |
230 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hbcab)) { | |
231 | + params.append("&hbcab="); | |
232 | + params.append(hbcab); | |
233 | + } | |
234 | + if (org.apache.commons.lang.StringUtils.isNotBlank(syphilis)) { | |
235 | + params.append("&syphilis="); | |
236 | + params.append(syphilis); | |
237 | + } | |
238 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hiv)) { | |
239 | + params.append("&hiv="); | |
240 | + params.append(hiv); | |
241 | + } | |
242 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hcv)) { | |
243 | + params.append("&hcv="); | |
244 | + params.append(hcv); | |
245 | + } | |
246 | + if (org.apache.commons.lang.StringUtils.isNotBlank(doctorNo)) { | |
247 | + params.append("&doctorNo="); | |
248 | + params.append(doctorNo); | |
249 | + } | |
250 | + if (page != null) { | |
251 | + params.append("&page="); | |
252 | + params.append(page); | |
253 | + } | |
254 | + if (limit != null) { | |
255 | + params.append("&limit="); | |
256 | + params.append(limit); | |
257 | + } | |
258 | + MessageUtil.UTF8GetMethod utf8GetMethod = new MessageUtil.UTF8GetMethod(center_statistics_url+"center/queryChanJianReport?" + params.toString()); | |
259 | + HttpClient client = new HttpClient(); | |
260 | + try { | |
261 | + client.executeMethod(utf8GetMethod); | |
262 | + int statusCode = utf8GetMethod.getStatusCode(); | |
263 | + if (200 == statusCode) { | |
264 | + String json = new String(utf8GetMethod.getResponseBodyAsString()); | |
265 | + writeJson(response, json); | |
266 | + } | |
267 | + } catch (IOException e) { | |
268 | + e.printStackTrace(); | |
269 | + } | |
208 | 270 | } |
209 | 271 | |
210 | 272 | |
... | ... | @@ -227,7 +289,111 @@ |
227 | 289 | @RequestParam(required = false) Integer page, |
228 | 290 | @RequestParam(required = false) Integer limit){ |
229 | 291 | LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext"); |
230 | - bookbuildingFacade.exportChanReport(loginState.getId(), httpServletResponse, | |
292 | + StringBuffer params = new StringBuffer(); | |
293 | + params.append("userId="); | |
294 | + params.append(loginState.getId()); | |
295 | + if (org.apache.commons.lang.StringUtils.isNotBlank(exDateStart)) { | |
296 | + params.append("&exDateStart="); | |
297 | + params.append(exDateStart); | |
298 | + } | |
299 | + if (org.apache.commons.lang.StringUtils.isNotBlank(exDateEnd)) { | |
300 | + params.append("&exDateEnd="); | |
301 | + params.append(exDateEnd); | |
302 | + } | |
303 | + if (org.apache.commons.lang.StringUtils.isNotBlank(name)) { | |
304 | + params.append("&name="); | |
305 | + params.append(name); | |
306 | + } | |
307 | + if (weekStarts != null) { | |
308 | + params.append("&weekStarts="); | |
309 | + params.append(weekStarts); | |
310 | + } | |
311 | + if (weekEnds != null) { | |
312 | + params.append("&weekEnds="); | |
313 | + params.append(weekEnds); | |
314 | + } | |
315 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hbsab)) { | |
316 | + params.append("&hbsab="); | |
317 | + params.append(hbsab); | |
318 | + } | |
319 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hbeag)) { | |
320 | + params.append("&hbeag="); | |
321 | + params.append(hbeag); | |
322 | + } | |
323 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hbeab)) { | |
324 | + params.append("&hbeab="); | |
325 | + params.append(hbeab); | |
326 | + } | |
327 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hbcab)) { | |
328 | + params.append("&hbcab="); | |
329 | + params.append(hbcab); | |
330 | + } | |
331 | + if (org.apache.commons.lang.StringUtils.isNotBlank(syphilis)) { | |
332 | + params.append("&syphilis="); | |
333 | + params.append(syphilis); | |
334 | + } | |
335 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hiv)) { | |
336 | + params.append("&hiv="); | |
337 | + params.append(hiv); | |
338 | + } | |
339 | + if (org.apache.commons.lang.StringUtils.isNotBlank(hcv)) { | |
340 | + params.append("&hcv="); | |
341 | + params.append(hcv); | |
342 | + } | |
343 | + if (org.apache.commons.lang.StringUtils.isNotBlank(doctorNo)) { | |
344 | + params.append("&doctorNo="); | |
345 | + params.append(doctorNo); | |
346 | + } | |
347 | + if (page != null) { | |
348 | + params.append("&page="); | |
349 | + params.append(page); | |
350 | + } | |
351 | + if (limit != null) { | |
352 | + params.append("&limit="); | |
353 | + params.append(limit); | |
354 | + } | |
355 | + MessageUtil.UTF8GetMethod utf8GetMethod = new MessageUtil.UTF8GetMethod(center_statistics_url+"center/exportChanReport?" + params.toString()); | |
356 | + HttpClient client = new HttpClient(); | |
357 | + try { | |
358 | + client.executeMethod(utf8GetMethod); | |
359 | + int statusCode = utf8GetMethod.getStatusCode(); | |
360 | + if (200 == statusCode) { | |
361 | + httpServletResponse.setContentType("application/octet-stream"); | |
362 | + httpServletResponse.setCharacterEncoding("UTF-8"); | |
363 | + httpServletResponse.setHeader("Content-Disposition", "attachment;fileName=datas.xls"); | |
364 | + httpServletResponse.getOutputStream().write(utf8GetMethod.getResponseBody()); | |
365 | + } | |
366 | + } catch (IOException e) { | |
367 | + e.printStackTrace(); | |
368 | + } | |
369 | + } | |
370 | + | |
371 | + /** | |
372 | + * 产检报告 | |
373 | + * @param request | |
374 | + * @return | |
375 | + */ | |
376 | + | |
377 | + @RequestMapping(value = "/center/queryChanJianReport", method = RequestMethod.GET) | |
378 | + @ResponseBody | |
379 | + public BaseListResponse queryCenterChanJianReport(HttpServletRequest request, | |
380 | + @RequestParam(required = false) Integer userId, | |
381 | + @RequestParam(required = false) String exDateStart, | |
382 | + @RequestParam(required = false) String exDateEnd, | |
383 | + @RequestParam(required = false) String name, | |
384 | + @RequestParam(required = false) Integer weekStarts, | |
385 | + @RequestParam(required = false) Integer weekEnds, | |
386 | + @RequestParam(required = false) String hbsab, | |
387 | + @RequestParam(required = false) String hbeag, | |
388 | + @RequestParam(required = false) String hbeab, | |
389 | + @RequestParam(required = false) String hbcab, | |
390 | + @RequestParam(required = false) String syphilis, | |
391 | + @RequestParam(required = false) String hiv, | |
392 | + @RequestParam(required = false) String hcv, | |
393 | + @RequestParam(required = false) String doctorNo, | |
394 | + @RequestParam(required = false) Integer page, | |
395 | + @RequestParam(required = false) Integer limit){ | |
396 | + BaseListResponse objectResponse = bookbuildingFacade.queryChanJianReport(userId, | |
231 | 397 | exDateStart, |
232 | 398 | exDateEnd, |
233 | 399 | name, |
234 | 400 | |
... | ... | @@ -240,7 +406,48 @@ |
240 | 406 | syphilis, |
241 | 407 | hiv, |
242 | 408 | hcv, |
409 | + doctorNo, | |
410 | + page, | |
411 | + limit | |
412 | + | |
413 | + ); | |
414 | + return objectResponse; | |
415 | + } | |
416 | + | |
417 | + | |
418 | + @RequestMapping(value = "/center/exportChanReport", method = RequestMethod.GET) | |
419 | + public void exportCenterChanReport(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse, | |
420 | + @RequestParam(required = false) Integer userId, | |
421 | + @RequestParam(required = false) String exDateStart, | |
422 | + @RequestParam(required = false) String exDateEnd, | |
423 | + @RequestParam(required = false) String name, | |
424 | + @RequestParam(required = false) Integer weekStarts, | |
425 | + @RequestParam(required = false) Integer weekEnds, | |
426 | + @RequestParam(required = false) String hbsab, | |
427 | + @RequestParam(required = false) String hbeag, | |
428 | + @RequestParam(required = false) String hbeab, | |
429 | + @RequestParam(required = false) String hbcab, | |
430 | + @RequestParam(required = false) String syphilis, | |
431 | + @RequestParam(required = false) String hiv, | |
432 | + @RequestParam(required = false) String hcv, | |
433 | + @RequestParam(required = false) String doctorNo, | |
434 | + @RequestParam(required = false) Integer page, | |
435 | + @RequestParam(required = false) Integer limit){ | |
436 | + bookbuildingFacade.exportChanReport(userId, httpServletResponse, | |
437 | + exDateStart, | |
438 | + exDateEnd, | |
439 | + name, | |
440 | + weekStarts, | |
441 | + weekEnds, | |
442 | + hbsab, | |
443 | + hbeag, | |
444 | + hbeab, | |
445 | + hbcab, | |
446 | + syphilis, | |
447 | + hiv, | |
448 | + hcv, | |
243 | 449 | doctorNo); |
244 | 450 | } |
451 | + | |
245 | 452 | } |