Commit 0aa2d398bf457fdbc5fc84643a0f18df26521a6e
1 parent
b074ae2ed5
Exists in
master
and in
6 other branches
wutaotao 20190525 excel2
Showing 2 changed files with 158 additions and 263 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java
View file @
0aa2d39
... | ... | @@ -94,7 +94,6 @@ |
94 | 94 | |
95 | 95 | /** |
96 | 96 | * 查询所有包括孕妇和产妇 |
97 | - * | |
98 | 97 | * @param patientsQueryRequest |
99 | 98 | * @param request |
100 | 99 | * @return |
... | ... | @@ -102,7 +101,7 @@ |
102 | 101 | @RequestMapping(value = "/allPats", method = RequestMethod.GET) |
103 | 102 | @ResponseBody |
104 | 103 | @TokenRequired |
105 | - public BaseResponse queryAllPatPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
104 | + public BaseResponse queryAllPatPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request) { | |
106 | 105 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
107 | 106 | return patientFacade.queryHighRisk1(patientsQueryRequest, null, null, loginState.getId(), "true", Boolean.FALSE); |
108 | 107 | } |
109 | 108 | |
... | ... | @@ -121,9 +120,8 @@ |
121 | 120 | BaseResponse baseResponse = patientFacade.queryHighRisk(patientsQueryRequest, Boolean.TRUE, 1, loginState.getId(), "true", Boolean.FALSE); |
122 | 121 | return baseResponse; |
123 | 122 | } |
124 | - | |
125 | 123 | /** |
126 | - * 全部孕妇管理 | |
124 | + *全部孕妇管理 | |
127 | 125 | * |
128 | 126 | * @param patientsQueryRequest 全部孕妇管理查询 (因为请求参数一样同用一个对象) |
129 | 127 | * @return 返回结果 |
130 | 128 | |
131 | 129 | |
132 | 130 | |
133 | 131 | |
... | ... | @@ -131,24 +129,23 @@ |
131 | 129 | @RequestMapping(value = "/aPuer", method = RequestMethod.GET) |
132 | 130 | @ResponseBody |
133 | 131 | @TokenRequired |
134 | - public BaseResponse queryAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
132 | + public BaseResponse queryAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request) { | |
135 | 133 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
136 | - return patientFacade.queryHighRisk(patientsQueryRequest, null, 1, loginState.getId(), "true", Boolean.FALSE); | |
134 | + return patientFacade.queryHighRisk(patientsQueryRequest,null,1,loginState.getId(),"true",Boolean.FALSE); | |
137 | 135 | } |
138 | 136 | |
139 | 137 | |
140 | 138 | /** |
141 | 139 | * 导出孕产妇数据 |
142 | - * | |
143 | 140 | * @param patientsQueryRequest |
144 | 141 | * @param request |
145 | 142 | * @return |
146 | 143 | */ |
147 | 144 | @RequestMapping(value = "/exportData", method = RequestMethod.GET) |
148 | 145 | @TokenRequired |
149 | - public void exportAllPuer(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request, HttpServletResponse response) { | |
146 | + public void exportAllPuer(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request,HttpServletResponse response) { | |
150 | 147 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
151 | - patientFacade.exportAllPuer(patientsQueryRequest, loginState.getId(), response); | |
148 | + patientFacade.exportAllPuer(patientsQueryRequest,loginState.getId(),response); | |
152 | 149 | } |
153 | 150 | /** |
154 | 151 | * 诸城重点孕妇登记表导出 |
155 | 152 | |
156 | 153 | |
157 | 154 | |
158 | 155 | |
159 | 156 | |
160 | 157 | |
161 | 158 | |
162 | 159 | |
... | ... | @@ -162,36 +159,33 @@ |
162 | 159 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
163 | 160 | patientFacade.zcKeyPregnantWomenExcel(ids,response,loginState.getId()); |
164 | 161 | } |
165 | - | |
166 | 162 | /** |
167 | - * 导出孕产妇健康管理登记表(唐山滦县 | |
168 | 163 | * 导出孕产妇健康管理登记表(唐山滦县) |
169 | - * | |
170 | 164 | * @param patientsQueryRequest |
171 | 165 | * @param request |
172 | 166 | * @return |
173 | 167 | */ |
174 | 168 | @RequestMapping(value = "/exportTsLxData", method = RequestMethod.GET) |
175 | 169 | @TokenRequired |
176 | - public void exportTsLxData(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request, HttpServletResponse response) { | |
170 | + public void exportTsLxData(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request,HttpServletResponse response) { | |
177 | 171 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
178 | - patientFacade.tsLxExport(patientsQueryRequest, loginState.getId(), response); | |
172 | + patientFacade.tsLxExport(patientsQueryRequest,loginState.getId(),response); | |
179 | 173 | } |
180 | 174 | |
181 | 175 | |
176 | + | |
182 | 177 | /** |
183 | 178 | * 区县产妇统计 |
184 | - * | |
185 | 179 | * @param patientsQueryRequest |
186 | 180 | * @param request |
187 | 181 | * @return |
188 | 182 | */ |
189 | 183 | @RequestMapping(value = "/exportAllPuerpera", method = RequestMethod.GET) |
190 | 184 | @TokenRequired |
191 | - public void exportAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request, HttpServletResponse response) { | |
185 | + public void exportAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request,HttpServletResponse response) { | |
192 | 186 | patientsQueryRequest.setFmHospital(patientsQueryRequest.gethId()); |
193 | 187 | patientsQueryRequest.setNotEnable("2"); |
194 | - patientFacade.exportAllPuer(patientsQueryRequest, 0, response); | |
188 | + patientFacade.exportAllPuer(patientsQueryRequest,0,response); | |
195 | 189 | } |
196 | 190 | |
197 | 191 | |
198 | 192 | |
199 | 193 | |
200 | 194 | |
... | ... | @@ -203,18 +197,18 @@ |
203 | 197 | @RequestMapping(value = "/apatients", method = RequestMethod.GET) |
204 | 198 | @ResponseBody |
205 | 199 | @TokenRequired |
206 | - public BaseResponse queryAllPatients(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
200 | + public BaseResponse queryAllPatients(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request){ | |
207 | 201 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
208 | - return patientFacade.queryHighRisk(patientsQueryRequest, null, 3, loginState.getId(), "true", Boolean.FALSE); | |
202 | + return patientFacade.queryHighRisk(patientsQueryRequest, null, 3,loginState.getId(),"true",Boolean.FALSE); | |
209 | 203 | } |
210 | 204 | |
211 | 205 | @RequestMapping(value = "/apatients/enums", method = RequestMethod.GET) |
212 | 206 | @ResponseBody |
213 | - public BaseResponse getEnums() { | |
207 | + public BaseResponse getEnums(){ | |
214 | 208 | Map<String, Object> map = new HashMap<>(); |
215 | 209 | map.put("gwfz", basicConfigFacade.getBaseicConfigByParentId(SystemConfig.HIGH_RISK_ID)); |
216 | 210 | List list = new ArrayList(); |
217 | - for (int i = 5; i <= 100; i = i + 5) { | |
211 | + for(int i=5;i<=100;i=i+5){ | |
218 | 212 | list.add(i); |
219 | 213 | } |
220 | 214 | |
221 | 215 | |
222 | 216 | |
... | ... | @@ -242,16 +236,19 @@ |
242 | 236 | |
243 | 237 | @RequestMapping(value = "/apatients/rLevel", method = RequestMethod.GET) |
244 | 238 | @ResponseBody |
245 | - public BaseResponse rLevle() { | |
239 | + public BaseResponse rLevle(){ | |
246 | 240 | Map<String, Object> map = new HashMap<>(); |
247 | 241 | |
248 | 242 | List<BasicConfigResult> results = new ArrayList<>(); |
249 | 243 | |
250 | 244 | List<BasicConfigResult> riskLevelConfig = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.HIGH_RISK_ID); |
251 | - if (CollectionUtils.isNotEmpty(riskLevelConfig)) { | |
252 | - for (BasicConfigResult levelConfig : riskLevelConfig) { | |
245 | + if (CollectionUtils.isNotEmpty(riskLevelConfig)) | |
246 | + { | |
247 | + for(BasicConfigResult levelConfig : riskLevelConfig) | |
248 | + { | |
253 | 249 | //健康 |
254 | - if ("e637b361-99cf-41eb-84f2-f0dab596e928".equals(levelConfig.getId())) { | |
250 | + if ("e637b361-99cf-41eb-84f2-f0dab596e928".equals(levelConfig.getId())) | |
251 | + { | |
255 | 252 | continue; |
256 | 253 | } |
257 | 254 | results.add(levelConfig); |
... | ... | @@ -270,7 +267,7 @@ |
270 | 267 | @RequestMapping(value = "/findp", method = RequestMethod.GET) |
271 | 268 | @ResponseBody |
272 | 269 | @TokenRequired |
273 | - public BaseResponse getPatent(@Valid PatientQueryRequest request, HttpServletRequest request1) { | |
270 | + public BaseResponse getPatent(@Valid PatientQueryRequest request,HttpServletRequest request1){ | |
274 | 271 | LoginContext loginState = (LoginContext) request1.getAttribute("loginContext"); |
275 | 272 | return patientFacade.findPatient(request, loginState.getId()); |
276 | 273 | } |
... | ... | @@ -283,7 +280,7 @@ |
283 | 280 | @RequestMapping(value = "/findp2", method = RequestMethod.GET) |
284 | 281 | @ResponseBody |
285 | 282 | @TokenRequired |
286 | - public BaseResponse getPatent2(@Valid PatientQueryRequest request, HttpServletRequest request1) { | |
283 | + public BaseResponse getPatent2(@Valid PatientQueryRequest request,HttpServletRequest request1){ | |
287 | 284 | LoginContext loginState = (LoginContext) request1.getAttribute("loginContext"); |
288 | 285 | return patientFacade.findPatient2(request, loginState.getId()); |
289 | 286 | } |
... | ... | @@ -296,7 +293,7 @@ |
296 | 293 | @RequestMapping(value = "/sendPGuildSms", method = RequestMethod.POST) |
297 | 294 | @ResponseBody |
298 | 295 | @TokenRequired |
299 | - public BaseResponse patientGuildSms(@RequestBody @Valid PatientGuideSmsRequest patientGuideSmsRequest, HttpServletRequest request1) { | |
296 | + public BaseResponse patientGuildSms(@RequestBody @Valid PatientGuideSmsRequest patientGuideSmsRequest,HttpServletRequest request1){ | |
300 | 297 | LoginContext loginState = (LoginContext) request1.getAttribute("loginContext"); |
301 | 298 | return patientFacade.patientGuildSms(patientGuideSmsRequest, loginState.getId()); |
302 | 299 | } |
303 | 300 | |
... | ... | @@ -310,9 +307,9 @@ |
310 | 307 | @RequestMapping(value = "/rhPuer", method = RequestMethod.GET) |
311 | 308 | @ResponseBody |
312 | 309 | @TokenRequired |
313 | - public BaseResponse queryRegionPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
310 | + public BaseResponse queryRegionPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request) { | |
314 | 311 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
315 | - return patientFacade.queryHighRisk(patientsQueryRequest, Boolean.TRUE, 1, loginState.getId(), "true", Boolean.TRUE); | |
312 | + return patientFacade.queryHighRisk(patientsQueryRequest, Boolean.TRUE, 1, loginState.getId(), "true",Boolean.TRUE); | |
316 | 313 | } |
317 | 314 | |
318 | 315 | /** |
... | ... | @@ -323,7 +320,7 @@ |
323 | 320 | @RequestMapping(value = "/rapatients", method = RequestMethod.GET) |
324 | 321 | @ResponseBody |
325 | 322 | @TokenRequired |
326 | - public BaseResponse queryRegionAllPatients(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
323 | + public BaseResponse queryRegionAllPatients(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request){ | |
327 | 324 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
328 | 325 | patientsQueryRequest.setFmHospital(patientsQueryRequest.gethId()); |
329 | 326 | patientsQueryRequest.sethId(null); |
330 | 327 | |
331 | 328 | |
... | ... | @@ -352,15 +349,15 @@ |
352 | 349 | @RequestMapping(value = "/allPuerpera", method = RequestMethod.GET) |
353 | 350 | @ResponseBody |
354 | 351 | @TokenRequired |
355 | - public BaseResponse queryPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
352 | + public BaseResponse queryPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request){ | |
356 | 353 | patientsQueryRequest.setFmHospital(patientsQueryRequest.gethId()); |
357 | 354 | patientsQueryRequest.setNotEnable("2"); |
358 | - return patientFacade.queryHighRisk(patientsQueryRequest, null, 3, 0, "true", Boolean.FALSE); | |
355 | + return patientFacade.queryHighRisk(patientsQueryRequest, null, 3,0,"true",Boolean.FALSE); | |
359 | 356 | } |
360 | 357 | |
361 | 358 | |
362 | 359 | /** |
363 | - * 区域全部孕妇管理 | |
360 | + *区域全部孕妇管理 | |
364 | 361 | * |
365 | 362 | * @param patientsQueryRequest 全部孕妇管理查询 (因为请求参数一样同用一个对象) |
366 | 363 | * @return 返回结果 |
367 | 364 | |
... | ... | @@ -368,9 +365,9 @@ |
368 | 365 | @RequestMapping(value = "/raPuer", method = RequestMethod.GET) |
369 | 366 | @ResponseBody |
370 | 367 | @TokenRequired |
371 | - public BaseResponse queryRegionAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
368 | + public BaseResponse queryRegionAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request) { | |
372 | 369 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
373 | - return patientFacade.queryHighRisk(patientsQueryRequest, null, 1, loginState.getId(), "true", Boolean.TRUE); | |
370 | + return patientFacade.queryHighRisk(patientsQueryRequest,null,1,loginState.getId(),"true",Boolean.TRUE); | |
374 | 371 | } |
375 | 372 | |
376 | 373 | /** |
377 | 374 | |
... | ... | @@ -432,10 +429,10 @@ |
432 | 429 | header.put("bookbuildingDoctor", "建档医生"); |
433 | 430 | |
434 | 431 | String hospitalId = autoMatchFacade.getHospitalId(patientManagerRequest.getOperatorId()); |
435 | - if ("1000000114".equals(hospitalId)) { | |
432 | + if("1000000114".equals(hospitalId)){ | |
436 | 433 | header.put("sendCareMan", "母子保健手册"); |
437 | 434 | header.put("bookbuildingDate", "发放时间"); |
438 | - } else { | |
435 | + }else{ | |
439 | 436 | header.put("bookbuildingDate", "建档时间"); |
440 | 437 | } |
441 | 438 | httpServletResponse.setContentType("application/force-download"); |
442 | 439 | |
... | ... | @@ -447,9 +444,10 @@ |
447 | 444 | } |
448 | 445 | |
449 | 446 | /** |
450 | - * 母子保健手册导出 | |
447 | + * 母子保健手册导出 | |
451 | 448 | * |
452 | - * @param httpServletRequest // * @param patientManagerRequest | |
449 | + * @param httpServletRequest | |
450 | + // * @param patientManagerRequest | |
453 | 451 | * @param httpServletResponse |
454 | 452 | */ |
455 | 453 | @TokenRequired |
... | ... | @@ -493,144 +491,6 @@ |
493 | 491 | ExcelUtil.toExcel(httpServletResponse.getOutputStream(), list, header); |
494 | 492 | } catch (Exception e) { |
495 | 493 | ExceptionUtils.catchException(e, "childbirthManagerExcel异常"); |
496 | - } | |
497 | - } | |
498 | - | |
499 | - //孕妇随访本 | |
500 | - @TokenRequired | |
501 | - @RequestMapping(value = "/gravidaFollowWord", method = RequestMethod.GET) | |
502 | - public void gravidaFollowWord(@RequestParam("pid") String pid, HttpServletResponse response) { | |
503 | - | |
504 | - Map<String, Object> map = patientFacade.gravidaFollowWord(pid, response); | |
505 | - try { | |
506 | - // 验证License | |
507 | - if (!getLicense()) { | |
508 | - return; | |
509 | - } | |
510 | - Document doc = null;// 原始word路径 | |
511 | - try { | |
512 | - doc = new Document(ViewController.class.getClassLoader().getResourceAsStream("sfdjb.docx")); | |
513 | - | |
514 | - /* DocumentBuilder builder = new DocumentBuilder(doc); | |
515 | - if (map.containsKey("red")) { | |
516 | - builder.moveToBookmark("red"); | |
517 | - markFrameText(builder, (String) map.get("red")); | |
518 | - map.remove("red"); | |
519 | - } | |
520 | - if (map.containsKey("orange")) { | |
521 | - builder.moveToBookmark("orange"); | |
522 | - markFrameText(builder, (String) map.get("orange")); | |
523 | - map.remove("orange"); | |
524 | - }*/ | |
525 | - | |
526 | - markData(doc, map);//普通数据 | |
527 | - sendToBrowser(doc, "导出", "doc", true, response); | |
528 | - } catch (Exception e) { | |
529 | - e.printStackTrace(); | |
530 | - } | |
531 | - response.flushBuffer(); | |
532 | - | |
533 | - | |
534 | - | |
535 | - } catch (IOException e) { | |
536 | - e.printStackTrace(); | |
537 | - } | |
538 | - } | |
539 | - | |
540 | - /** | |
541 | - * 获取license | |
542 | - * | |
543 | - * @return | |
544 | - */ | |
545 | - public static boolean getLicense() { | |
546 | - boolean result = false; | |
547 | - try { | |
548 | - InputStream is = ViewController.class.getClassLoader().getResourceAsStream("license.xml"); | |
549 | - License aposeLic = new License(); | |
550 | - aposeLic.setLicense(is); | |
551 | - result = true; | |
552 | - } catch (Exception e) { | |
553 | - e.printStackTrace(); | |
554 | - } | |
555 | - return result; | |
556 | - } | |
557 | - | |
558 | - /** | |
559 | - * 向客户端发送数据 | |
560 | - * | |
561 | - * @param doc com.aspose.words.Document | |
562 | - * @param docName 返回客户端的word文件名 | |
563 | - * @param formatType DOC 或者 DOCX | |
564 | - * @param openNewWindow 在线打开或者下载 | |
565 | - * @param response | |
566 | - * @throws Exception | |
567 | - */ | |
568 | - private void sendToBrowser(Document doc, String docName, String formatType, | |
569 | - boolean openNewWindow, HttpServletResponse response) | |
570 | - throws Exception { | |
571 | - String extension = formatType; | |
572 | - | |
573 | - if (formatType.equals("WML") || formatType.equals("FOPC")) | |
574 | - extension = "XML"; | |
575 | - | |
576 | - String fileName = docName + "." + extension; | |
577 | - | |
578 | - if (openNewWindow) | |
579 | - response.setHeader("content-disposition", "attachment; filename=" | |
580 | - + fileName); | |
581 | - else | |
582 | - response.addHeader("content-disposition", "inline; filename=" | |
583 | - + fileName); | |
584 | - | |
585 | - if ("doc".equals(formatType)) { | |
586 | - response.setContentType("application/msword"); | |
587 | - doc.save(response.getOutputStream(), SaveFormat.DOC); | |
588 | - } else if ("docx".equals(formatType)) { | |
589 | - response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); | |
590 | - doc.save(response.getOutputStream(), SaveFormat.DOCX); | |
591 | - } else if ("pdf".equals(formatType)) { | |
592 | - response.setContentType("application/pdf"); | |
593 | - doc.save(response.getOutputStream(), SaveFormat.PDF); | |
594 | - } | |
595 | - } | |
596 | - | |
597 | - /** | |
598 | - * 添加特殊字 | |
599 | - * | |
600 | - * @param builder | |
601 | - * @param text | |
602 | - */ | |
603 | - public void markFrameText(DocumentBuilder builder, String text) { | |
604 | - try { | |
605 | - if (com.lyms.platform.common.utils.StringUtils.isEmpty(text) || "null".equals(text)) { | |
606 | - return; | |
607 | - } | |
608 | - builder.getFont().getBorder().clearFormatting(); | |
609 | - builder.getFont().getBorder().setColor(Color.black); | |
610 | - builder.getFont().getBorder().setLineWidth(1); | |
611 | - builder.getFont().getBorder().setLineStyle(LineStyle.SINGLE); | |
612 | - builder.getFont().getBorder().setDistanceFromText(2); | |
613 | - // builder.getFont().getBorder().setShadow(true); | |
614 | - builder.write(text); | |
615 | - } catch (Exception e) { | |
616 | - e.printStackTrace(); | |
617 | - } | |
618 | - } | |
619 | - | |
620 | - public void markData(Document doc, Map<String, Object> data) { | |
621 | - try { | |
622 | - for (Map.Entry<String, Object> m : data.entrySet()) { | |
623 | - if (m.getValue() == null || "null".equals(m.getValue())) { | |
624 | - continue; | |
625 | - } | |
626 | - BookmarkCollection books = doc.getRange().getBookmarks(); | |
627 | - Bookmark bookmark = books.get(m.getKey()); | |
628 | - if (bookmark != null) { | |
629 | - bookmark.setText(String.valueOf(m.getValue())); | |
630 | - } | |
631 | - } | |
632 | - } catch (Exception e) { | |
633 | - e.printStackTrace(); | |
634 | 494 | } |
635 | 495 | } |
636 | 496 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
0aa2d39
... | ... | @@ -1042,7 +1042,127 @@ |
1042 | 1042 | } |
1043 | 1043 | } |
1044 | 1044 | |
1045 | + public void zcKeyPregnantWomenExcel(String ids, HttpServletResponse response,Integer userId) { | |
1045 | 1046 | |
1047 | + try { | |
1048 | + //1 获取list数据 | |
1049 | + List<String> authors = Arrays.asList(ids.split(",")); | |
1050 | + Query query = Query.query(Criteria.where("id").in(authors)); | |
1051 | + List<Patients> patientsList = mongoTemplate.find(query, Patients.class); | |
1052 | + | |
1053 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
1054 | + List<KeyPregnantWomenExcelModel> keyPregnantWomenExcelModelList = new ArrayList<>(); | |
1055 | + if (CollectionUtils.isNotEmpty(patientsList)) { | |
1056 | + | |
1057 | + for (Patients patients : patientsList) { | |
1058 | + KeyPregnantWomenExcelModel keyPregnantWomenExcelModel = new KeyPregnantWomenExcelModel(); | |
1059 | + BeanUtils.copy(patients, keyPregnantWomenExcelModel); | |
1060 | + //姓名:产妇姓名 ==username | |
1061 | + keyPregnantWomenExcelModel.setUsername(patients.getUsername()); | |
1062 | + //年龄:产妇年龄 ==age | |
1063 | + keyPregnantWomenExcelModel.setAge(patients.getAge()); | |
1064 | + //户籍:本市(常住)、外地常住(暂住)、流动 ==address | |
1065 | + keyPregnantWomenExcelModel.setAddress(patients.getAddress()); | |
1066 | + | |
1067 | + AntExChuModel data = antExService.findOne(patients.getId()); | |
1068 | + //孕次:怀孕次数== 查看母子实现 | |
1069 | + keyPregnantWomenExcelModel.setPregnancyTimes(data==null?0:(data.getPregnancyTimes()==null ? 0:data.getPregnancyTimes())); | |
1070 | + //产次:生产次数== 查看母子实现 | |
1071 | + keyPregnantWomenExcelModel.setProdTime(data==null?1:(data.getProdTime()==null ? 1:data.getProdTime()+1)); | |
1072 | + //预产期:产妇预产期==dueDate | |
1073 | + keyPregnantWomenExcelModel.setDueDate(DateUtil.getyyyy_MM_dd(patients.getDueDate())); | |
1074 | + //居住地址:现住地址== addressRegister(孕妇居住地)addressPostRest(产后休养地) | |
1075 | + keyPregnantWomenExcelModel.setAddressRegister(patients.getAddressRegister()); | |
1076 | + //孕妇手机:产妇手机号==phone | |
1077 | + keyPregnantWomenExcelModel.setPhone(patients.getPhone()); | |
1078 | + //丈夫手机:丈夫手机号==husbandPhone | |
1079 | + keyPregnantWomenExcelModel.setHusbandPhone(patients.getHusbandPhone()); | |
1080 | + //重点疾病:高危因素名称 == rFactor | |
1081 | + List<String> factor = patients.getRiskFactorId(); | |
1082 | + getrFactor(patients, keyPregnantWomenExcelModel, factor); | |
1083 | + //高危等级:展示红/橙/黄/紫 (不显示绿色)==rLevel | |
1084 | + getRiskLevelId(patients, keyPregnantWomenExcelModel); | |
1085 | + keyPregnantWomenExcelModelList.add(keyPregnantWomenExcelModel); | |
1086 | + } | |
1087 | + } | |
1088 | + List<Map<String, Object>> list = new ArrayList<>(); | |
1089 | + for (KeyPregnantWomenExcelModel keyPregnantWomenExcelModel : keyPregnantWomenExcelModelList) { | |
1090 | + Map<String, Object> map = BeanUtils.objectToObjectMap(keyPregnantWomenExcelModel); | |
1091 | + for (String key : map.keySet()) { | |
1092 | + if (org.apache.commons.lang.StringUtils.isEmpty(String.valueOf(map.get(key)))) { | |
1093 | + map.put(key, " "); | |
1094 | + } | |
1095 | + } | |
1096 | + list.add(map); | |
1097 | + } | |
1098 | + //2:excel导出 | |
1099 | + response.setContentType("application/force-download"); | |
1100 | + response.setHeader("Content-Disposition", "attachment;filename=" + new String(("重点孕妇登记表.xls").getBytes("UTF-8"), "ISO-8859-1")); | |
1101 | + //ExcelUtil.toExcel(response.getOutputStream(), list, header); | |
1102 | + String path = this.getClass().getResource("/").getPath() + "zddc.xls"; | |
1103 | +// ExcelUtil.keyPregnantWomenExclFile2(path, response.getOutputStream(), list); | |
1104 | + ExcelUtil.writeWhExclFile(path, response.getOutputStream(), list); | |
1105 | + | |
1106 | + } catch (Exception e) { | |
1107 | + ExceptionUtils.catchException(e, e.getMessage()); } | |
1108 | + } | |
1109 | + | |
1110 | + private void getRiskLevelId(Patients patients, KeyPregnantWomenExcelModel keyPregnantWomenExcelModel) { | |
1111 | + List level = new ArrayList(); | |
1112 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(patients.getRiskLevelId())) { | |
1113 | + try { | |
1114 | + List<String> list = JsonUtil.jkstr2Obj(patients.getRiskLevelId(), List.class); | |
1115 | + for (String str : list) { | |
1116 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(str); | |
1117 | + if (null != basicConfig) { | |
1118 | + Map map = new HashMap(); | |
1119 | + basicConfig.replenRisk(map); | |
1120 | + // String name = basicConfig.getName(); | |
1121 | + // if (name.indexOf("预警") > -1) { | |
1122 | + // name = name.replace("预警", ""); | |
1123 | + // } | |
1124 | + // map.put("name", name); | |
1125 | + // map.put("color", "risk_" + RiskDefaultTypeEnum.getColor(name)); | |
1126 | + level.add(map); | |
1127 | + } | |
1128 | + } | |
1129 | + } catch (Exception e) { | |
1130 | + ExceptionUtils.catchException(e, "patients.getRiskLevelId error."); | |
1131 | + } | |
1132 | + keyPregnantWomenExcelModel.setrLevel(getLevel(HighScoreResult.filter(level))); | |
1133 | + } | |
1134 | + } | |
1135 | + | |
1136 | + private void getrFactor(Patients patients, KeyPregnantWomenExcelModel keyPregnantWomenExcelModel, List<String> factor) { | |
1137 | + if (CollectionUtils.isNotEmpty(factor)) { | |
1138 | + StringBuilder sb = new StringBuilder(56); | |
1139 | + for (String srt : factor) { | |
1140 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(srt)) { | |
1141 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(srt); | |
1142 | + if (null != basicConfig && sb.indexOf(basicConfig.getName()) == -1) { | |
1143 | + sb.append(basicConfig.getName()).append(','); | |
1144 | + } | |
1145 | + } | |
1146 | + } | |
1147 | + if (sb.toString().endsWith(",")) { | |
1148 | + keyPregnantWomenExcelModel.setrFactor(sb.substring(0, sb.length() - 1)); | |
1149 | + } else { | |
1150 | + keyPregnantWomenExcelModel.setrFactor(sb.toString()); | |
1151 | + } | |
1152 | + | |
1153 | + if (!"-".equals(keyPregnantWomenExcelModel.getrFactor()) && org.apache.commons.lang.StringUtils.isNotEmpty(patients.getoRiskFactor())) { | |
1154 | + keyPregnantWomenExcelModel.setrFactor(keyPregnantWomenExcelModel.getrFactor()+","+patients.getoRiskFactor()); | |
1155 | + }else if (org.apache.commons.lang.StringUtils.isNotEmpty(patients.getoRiskFactor())) | |
1156 | + { | |
1157 | + keyPregnantWomenExcelModel.setrFactor(patients.getoRiskFactor()); | |
1158 | + } | |
1159 | + } | |
1160 | + else if (org.apache.commons.lang.StringUtils.isNotEmpty(patients.getoRiskFactor())) | |
1161 | + { | |
1162 | + keyPregnantWomenExcelModel.setrFactor(patients.getoRiskFactor()); | |
1163 | + } | |
1164 | + } | |
1165 | + | |
1046 | 1166 | /** |
1047 | 1167 | * 唐山(滦县)需求导出孕产妇健康管理登记表 |
1048 | 1168 | */ |
... | ... | @@ -1523,91 +1643,6 @@ |
1523 | 1643 | } |
1524 | 1644 | return new BaseObjectResponse().setData(patientBaseResult).setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS); |
1525 | 1645 | } |
1526 | - | |
1527 | - /*** | |
1528 | - *重点孕妇登记随访本 | |
1529 | - * | |
1530 | - */ | |
1531 | - public Map gravidaFollowWord(String pid, HttpServletResponse response) { | |
1532 | - Map<String, Object> dataMap = new HashMap<>(); | |
1533 | - if (StringUtils.isNotEmpty(pid)) { | |
1534 | - Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid)), Patients.class); | |
1535 | - dataMap.put("name", patients.getUsername()); | |
1536 | - dataMap.put("age", DateUtil.getAge(patients.getBirth())); | |
1537 | - //孕次 | |
1538 | - AntExChuModel antExChuModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid)), AntExChuModel.class); | |
1539 | - if (null != antExChuModel) { | |
1540 | - dataMap.put("pregnancySecond", antExChuModel.getPregnancyTimes()); | |
1541 | - //产次 | |
1542 | - dataMap.put("parity", antExChuModel.getProdTime()); | |
1543 | - } | |
1544 | - //预产期 | |
1545 | - dataMap.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate())); | |
1546 | - //身份证号 | |
1547 | - if (StringUtils.isNotEmpty(patients.getPcerteTypeId()) && "70ae1d93-2964-46bc-83fa-bec9ff605b1c".equals(patients.getPcerteTypeId())) { | |
1548 | - dataMap.put("cardNo", patients.getCardNo()); | |
1549 | - } | |
1550 | - //孕妇电话 | |
1551 | - dataMap.put("gravidaPhone", patients.getPhone()); | |
1552 | - //丈夫电话 | |
1553 | - dataMap.put("husbandPhone", patients.getHusbandPhone() != null ? patients.getHusbandPhone() : null); | |
1554 | - //住址 | |
1555 | - dataMap.put("address", CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(), | |
1556 | - patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService)); | |
1557 | - dataMap.put("weeks", DateUtil.getWeek(patients.getLastMenses())); | |
1558 | - //确诊单位 | |
1559 | - dataMap.put("diagnosis", "诸城人民医院"); | |
1560 | - dataMap.put("created", DateUtil.getyyyy_MM_dd(patients.getCreated())); | |
1561 | - //户籍 | |
1562 | - if (StringUtils.isNotEmpty(patients.getPliveTypeId())) { | |
1563 | - if ("57624c440cf23d4631523ea1".equals(patients.getPliveTypeId())) { | |
1564 | - dataMap.put("cz", "√"); | |
1565 | - } else if ("5a371bce0cf2ab082ac30433".equals(patients.getPliveTypeId())) { | |
1566 | - dataMap.put("zz", "√"); | |
1567 | - } else if ("57624c5e0cf23d4631523ea2".equals(patients.getPliveTypeId())) { | |
1568 | - dataMap.put("ld", "√"); | |
1569 | - } | |
1570 | - } | |
1571 | - if (CollectionUtils.isNotEmpty(patients.getRiskFactorId())) { | |
1572 | - List<String> riskFactor = patients.getRiskFactorId(); | |
1573 | - StringBuffer riskStr = new StringBuffer(); | |
1574 | - for (String risk : riskFactor) { | |
1575 | - riskStr.append(getBasicConfig(risk) + " "); | |
1576 | - } | |
1577 | - dataMap.put("highRisk", riskStr); | |
1578 | - } | |
1579 | - //判断风险等级 | |
1580 | - if (StringUtils.isNotEmpty(patients.getRiskLevelId())) { | |
1581 | - String str = patients.getRiskLevelId(); | |
1582 | - String substr = str.substring(1, str.length() - 1); | |
1583 | - String[] strings = substr.split(","); | |
1584 | - for (String strs : strings) { | |
1585 | - if ("\"49a36aea-c5b6-4162-87d2-9eb3c6ec00c2\"".equals(strs)) { | |
1586 | - dataMap.put("orange", "√"); | |
1587 | - } else if ("\"eb146c03-b19f-4e28-b85f-fda574b2283b\"".equals(strs)) { | |
1588 | - dataMap.put("red", "√"); | |
1589 | - } else if ("\"224b2329-cb82-4da3-a071-8527f8283aab\"".equals(strs)) { | |
1590 | - dataMap.put("purple", "√"); | |
1591 | - } else if ("\"315107bd-91fe-42a1-9237-752f3c046a40\"".equals(strs)) { | |
1592 | - dataMap.put("yellow", "√"); | |
1593 | - } | |
1594 | - } | |
1595 | - } | |
1596 | - } | |
1597 | - return dataMap; | |
1598 | - } | |
1599 | - | |
1600 | - private String getBasicConfig(String id) { | |
1601 | - if (com.lyms.platform.common.utils.StringUtils.isEmpty(id)) { | |
1602 | - return ""; | |
1603 | - } | |
1604 | - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(id); | |
1605 | - if (null != basicConfig) { | |
1606 | - return basicConfig.getName(); | |
1607 | - } | |
1608 | - return ""; | |
1609 | - } | |
1610 | - | |
1611 | 1646 | |
1612 | 1647 | } |