Commit 431ab2d31315a78c0ffa4725f12c19159e10d51d
1 parent
afe610be41
Exists in
master
and in
6 other branches
重点孕妇登记随访本
Showing 2 changed files with 270 additions and 43 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java
View file @
431ab2d
| 1 | 1 | package com.lyms.platform.operate.web.controller; |
| 2 | 2 | |
| 3 | +import com.aspose.words.*; | |
| 3 | 4 | import com.lyms.platform.common.annotation.TokenRequired; |
| 4 | 5 | import com.lyms.platform.common.base.BaseController; |
| 5 | 6 | import com.lyms.platform.common.base.LoginContext; |
| 6 | 7 | |
| ... | ... | @@ -32,7 +33,11 @@ |
| 32 | 33 | import javax.servlet.http.HttpServletRequest; |
| 33 | 34 | import javax.servlet.http.HttpServletResponse; |
| 34 | 35 | import javax.validation.Valid; |
| 36 | +import java.awt.*; | |
| 37 | +import java.io.IOException; | |
| 38 | +import java.io.InputStream; | |
| 35 | 39 | import java.util.*; |
| 40 | +import java.util.List; | |
| 36 | 41 | |
| 37 | 42 | /** |
| 38 | 43 | * 孕产妇管理接口 |
| ... | ... | @@ -53,6 +58,7 @@ |
| 53 | 58 | |
| 54 | 59 | /** |
| 55 | 60 | * 产妇管理查询接口 |
| 61 | + * | |
| 56 | 62 | * @param managerRequest |
| 57 | 63 | * @return |
| 58 | 64 | */ |
| ... | ... | @@ -94,6 +100,7 @@ |
| 94 | 100 | |
| 95 | 101 | /** |
| 96 | 102 | * 查询所有包括孕妇和产妇 |
| 103 | + * | |
| 97 | 104 | * @param patientsQueryRequest |
| 98 | 105 | * @param request |
| 99 | 106 | * @return |
| ... | ... | @@ -101,7 +108,7 @@ |
| 101 | 108 | @RequestMapping(value = "/allPats", method = RequestMethod.GET) |
| 102 | 109 | @ResponseBody |
| 103 | 110 | @TokenRequired |
| 104 | - public BaseResponse queryAllPatPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request) { | |
| 111 | + public BaseResponse queryAllPatPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
| 105 | 112 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 106 | 113 | return patientFacade.queryHighRisk1(patientsQueryRequest, null, null, loginState.getId(), "true", Boolean.FALSE); |
| 107 | 114 | } |
| 108 | 115 | |
| 109 | 116 | |
| ... | ... | @@ -115,13 +122,14 @@ |
| 115 | 122 | @RequestMapping(value = "/hPuer", method = RequestMethod.GET) |
| 116 | 123 | @ResponseBody |
| 117 | 124 | @TokenRequired |
| 118 | - public BaseResponse queryHighRiskPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request) { | |
| 125 | + public BaseResponse queryHighRiskPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
| 119 | 126 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 120 | 127 | BaseResponse baseResponse = patientFacade.queryHighRisk(patientsQueryRequest, Boolean.TRUE, 1, loginState.getId(), "true", Boolean.FALSE); |
| 121 | 128 | return baseResponse; |
| 122 | 129 | } |
| 130 | + | |
| 123 | 131 | /** |
| 124 | - *全部孕妇管理 | |
| 132 | + * 全部孕妇管理 | |
| 125 | 133 | * |
| 126 | 134 | * @param patientsQueryRequest 全部孕妇管理查询 (因为请求参数一样同用一个对象) |
| 127 | 135 | * @return 返回结果 |
| 128 | 136 | |
| 129 | 137 | |
| 130 | 138 | |
| 131 | 139 | |
| 132 | 140 | |
| 133 | 141 | |
| 134 | 142 | |
| 135 | 143 | |
| 136 | 144 | |
| 137 | 145 | |
| 138 | 146 | |
| ... | ... | @@ -129,53 +137,55 @@ |
| 129 | 137 | @RequestMapping(value = "/aPuer", method = RequestMethod.GET) |
| 130 | 138 | @ResponseBody |
| 131 | 139 | @TokenRequired |
| 132 | - public BaseResponse queryAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request) { | |
| 140 | + public BaseResponse queryAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
| 133 | 141 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 134 | - return patientFacade.queryHighRisk(patientsQueryRequest,null,1,loginState.getId(),"true",Boolean.FALSE); | |
| 142 | + return patientFacade.queryHighRisk(patientsQueryRequest, null, 1, loginState.getId(), "true", Boolean.FALSE); | |
| 135 | 143 | } |
| 136 | 144 | |
| 137 | 145 | |
| 138 | 146 | /** |
| 139 | 147 | * 导出孕产妇数据 |
| 148 | + * | |
| 140 | 149 | * @param patientsQueryRequest |
| 141 | 150 | * @param request |
| 142 | 151 | * @return |
| 143 | 152 | */ |
| 144 | 153 | @RequestMapping(value = "/exportData", method = RequestMethod.GET) |
| 145 | 154 | @TokenRequired |
| 146 | - public void exportAllPuer(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request,HttpServletResponse response) { | |
| 155 | + public void exportAllPuer(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request, HttpServletResponse response) { | |
| 147 | 156 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 148 | - patientFacade.exportAllPuer(patientsQueryRequest,loginState.getId(),response); | |
| 157 | + patientFacade.exportAllPuer(patientsQueryRequest, loginState.getId(), response); | |
| 149 | 158 | } |
| 150 | 159 | |
| 151 | 160 | |
| 152 | 161 | /** |
| 153 | 162 | * 导出孕产妇健康管理登记表(唐山滦县) |
| 163 | + * | |
| 154 | 164 | * @param patientsQueryRequest |
| 155 | 165 | * @param request |
| 156 | 166 | * @return |
| 157 | 167 | */ |
| 158 | 168 | @RequestMapping(value = "/exportTsLxData", method = RequestMethod.GET) |
| 159 | 169 | @TokenRequired |
| 160 | - public void exportTsLxData(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request,HttpServletResponse response) { | |
| 170 | + public void exportTsLxData(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request, HttpServletResponse response) { | |
| 161 | 171 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 162 | - patientFacade.tsLxExport(patientsQueryRequest,loginState.getId(),response); | |
| 172 | + patientFacade.tsLxExport(patientsQueryRequest, loginState.getId(), response); | |
| 163 | 173 | } |
| 164 | 174 | |
| 165 | 175 | |
| 166 | - | |
| 167 | 176 | /** |
| 168 | 177 | * 区县产妇统计 |
| 178 | + * | |
| 169 | 179 | * @param patientsQueryRequest |
| 170 | 180 | * @param request |
| 171 | 181 | * @return |
| 172 | 182 | */ |
| 173 | 183 | @RequestMapping(value = "/exportAllPuerpera", method = RequestMethod.GET) |
| 174 | 184 | @TokenRequired |
| 175 | - public void exportAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request,HttpServletResponse response) { | |
| 185 | + public void exportAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request, HttpServletResponse response) { | |
| 176 | 186 | patientsQueryRequest.setFmHospital(patientsQueryRequest.gethId()); |
| 177 | 187 | patientsQueryRequest.setNotEnable("2"); |
| 178 | - patientFacade.exportAllPuer(patientsQueryRequest,0,response); | |
| 188 | + patientFacade.exportAllPuer(patientsQueryRequest, 0, response); | |
| 179 | 189 | } |
| 180 | 190 | |
| 181 | 191 | |
| 182 | 192 | |
| 183 | 193 | |
| 184 | 194 | |
| ... | ... | @@ -187,18 +197,18 @@ |
| 187 | 197 | @RequestMapping(value = "/apatients", method = RequestMethod.GET) |
| 188 | 198 | @ResponseBody |
| 189 | 199 | @TokenRequired |
| 190 | - public BaseResponse queryAllPatients(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request){ | |
| 200 | + public BaseResponse queryAllPatients(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
| 191 | 201 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 192 | - return patientFacade.queryHighRisk(patientsQueryRequest, null, 3,loginState.getId(),"true",Boolean.FALSE); | |
| 202 | + return patientFacade.queryHighRisk(patientsQueryRequest, null, 3, loginState.getId(), "true", Boolean.FALSE); | |
| 193 | 203 | } |
| 194 | 204 | |
| 195 | 205 | @RequestMapping(value = "/apatients/enums", method = RequestMethod.GET) |
| 196 | 206 | @ResponseBody |
| 197 | - public BaseResponse getEnums(){ | |
| 207 | + public BaseResponse getEnums() { | |
| 198 | 208 | Map<String, Object> map = new HashMap<>(); |
| 199 | 209 | map.put("gwfz", basicConfigFacade.getBaseicConfigByParentId(SystemConfig.HIGH_RISK_ID)); |
| 200 | 210 | List list = new ArrayList(); |
| 201 | - for(int i=5;i<=100;i=i+5){ | |
| 211 | + for (int i = 5; i <= 100; i = i + 5) { | |
| 202 | 212 | list.add(i); |
| 203 | 213 | } |
| 204 | 214 | |
| 205 | 215 | |
| 206 | 216 | |
| ... | ... | @@ -226,19 +236,16 @@ |
| 226 | 236 | |
| 227 | 237 | @RequestMapping(value = "/apatients/rLevel", method = RequestMethod.GET) |
| 228 | 238 | @ResponseBody |
| 229 | - public BaseResponse rLevle(){ | |
| 239 | + public BaseResponse rLevle() { | |
| 230 | 240 | Map<String, Object> map = new HashMap<>(); |
| 231 | 241 | |
| 232 | 242 | List<BasicConfigResult> results = new ArrayList<>(); |
| 233 | 243 | |
| 234 | 244 | List<BasicConfigResult> riskLevelConfig = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.HIGH_RISK_ID); |
| 235 | - if (CollectionUtils.isNotEmpty(riskLevelConfig)) | |
| 236 | - { | |
| 237 | - for(BasicConfigResult levelConfig : riskLevelConfig) | |
| 238 | - { | |
| 245 | + if (CollectionUtils.isNotEmpty(riskLevelConfig)) { | |
| 246 | + for (BasicConfigResult levelConfig : riskLevelConfig) { | |
| 239 | 247 | //健康 |
| 240 | - if ("e637b361-99cf-41eb-84f2-f0dab596e928".equals(levelConfig.getId())) | |
| 241 | - { | |
| 248 | + if ("e637b361-99cf-41eb-84f2-f0dab596e928".equals(levelConfig.getId())) { | |
| 242 | 249 | continue; |
| 243 | 250 | } |
| 244 | 251 | results.add(levelConfig); |
| ... | ... | @@ -257,7 +264,7 @@ |
| 257 | 264 | @RequestMapping(value = "/findp", method = RequestMethod.GET) |
| 258 | 265 | @ResponseBody |
| 259 | 266 | @TokenRequired |
| 260 | - public BaseResponse getPatent(@Valid PatientQueryRequest request,HttpServletRequest request1){ | |
| 267 | + public BaseResponse getPatent(@Valid PatientQueryRequest request, HttpServletRequest request1) { | |
| 261 | 268 | LoginContext loginState = (LoginContext) request1.getAttribute("loginContext"); |
| 262 | 269 | return patientFacade.findPatient(request, loginState.getId()); |
| 263 | 270 | } |
| ... | ... | @@ -270,7 +277,7 @@ |
| 270 | 277 | @RequestMapping(value = "/findp2", method = RequestMethod.GET) |
| 271 | 278 | @ResponseBody |
| 272 | 279 | @TokenRequired |
| 273 | - public BaseResponse getPatent2(@Valid PatientQueryRequest request,HttpServletRequest request1){ | |
| 280 | + public BaseResponse getPatent2(@Valid PatientQueryRequest request, HttpServletRequest request1) { | |
| 274 | 281 | LoginContext loginState = (LoginContext) request1.getAttribute("loginContext"); |
| 275 | 282 | return patientFacade.findPatient2(request, loginState.getId()); |
| 276 | 283 | } |
| ... | ... | @@ -283,7 +290,7 @@ |
| 283 | 290 | @RequestMapping(value = "/sendPGuildSms", method = RequestMethod.POST) |
| 284 | 291 | @ResponseBody |
| 285 | 292 | @TokenRequired |
| 286 | - public BaseResponse patientGuildSms(@RequestBody @Valid PatientGuideSmsRequest patientGuideSmsRequest,HttpServletRequest request1){ | |
| 293 | + public BaseResponse patientGuildSms(@RequestBody @Valid PatientGuideSmsRequest patientGuideSmsRequest, HttpServletRequest request1) { | |
| 287 | 294 | LoginContext loginState = (LoginContext) request1.getAttribute("loginContext"); |
| 288 | 295 | return patientFacade.patientGuildSms(patientGuideSmsRequest, loginState.getId()); |
| 289 | 296 | } |
| 290 | 297 | |
| ... | ... | @@ -297,9 +304,9 @@ |
| 297 | 304 | @RequestMapping(value = "/rhPuer", method = RequestMethod.GET) |
| 298 | 305 | @ResponseBody |
| 299 | 306 | @TokenRequired |
| 300 | - public BaseResponse queryRegionPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request) { | |
| 307 | + public BaseResponse queryRegionPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
| 301 | 308 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 302 | - return patientFacade.queryHighRisk(patientsQueryRequest, Boolean.TRUE, 1, loginState.getId(), "true",Boolean.TRUE); | |
| 309 | + return patientFacade.queryHighRisk(patientsQueryRequest, Boolean.TRUE, 1, loginState.getId(), "true", Boolean.TRUE); | |
| 303 | 310 | } |
| 304 | 311 | |
| 305 | 312 | /** |
| ... | ... | @@ -310,7 +317,7 @@ |
| 310 | 317 | @RequestMapping(value = "/rapatients", method = RequestMethod.GET) |
| 311 | 318 | @ResponseBody |
| 312 | 319 | @TokenRequired |
| 313 | - public BaseResponse queryRegionAllPatients(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request){ | |
| 320 | + public BaseResponse queryRegionAllPatients(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
| 314 | 321 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 315 | 322 | patientsQueryRequest.setFmHospital(patientsQueryRequest.gethId()); |
| 316 | 323 | patientsQueryRequest.sethId(null); |
| ... | ... | @@ -328,7 +335,7 @@ |
| 328 | 335 | patientsQueryRequest.setStartAge(null); |
| 329 | 336 | patientsQueryRequest.setEndAge(null); |
| 330 | 337 | |
| 331 | - return patientFacade.queryHighRisk(patientsQueryRequest, null, 3,loginState.getId(),"true",Boolean.TRUE); | |
| 338 | + return patientFacade.queryHighRisk(patientsQueryRequest, null, 3, loginState.getId(), "true", Boolean.TRUE); | |
| 332 | 339 | } |
| 333 | 340 | |
| 334 | 341 | /** |
| 335 | 342 | |
| 336 | 343 | |
| ... | ... | @@ -339,15 +346,15 @@ |
| 339 | 346 | @RequestMapping(value = "/allPuerpera", method = RequestMethod.GET) |
| 340 | 347 | @ResponseBody |
| 341 | 348 | @TokenRequired |
| 342 | - public BaseResponse queryPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request){ | |
| 349 | + public BaseResponse queryPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
| 343 | 350 | patientsQueryRequest.setFmHospital(patientsQueryRequest.gethId()); |
| 344 | 351 | patientsQueryRequest.setNotEnable("2"); |
| 345 | - return patientFacade.queryHighRisk(patientsQueryRequest, null, 3,0,"true",Boolean.FALSE); | |
| 352 | + return patientFacade.queryHighRisk(patientsQueryRequest, null, 3, 0, "true", Boolean.FALSE); | |
| 346 | 353 | } |
| 347 | 354 | |
| 348 | 355 | |
| 349 | 356 | /** |
| 350 | - *区域全部孕妇管理 | |
| 357 | + * 区域全部孕妇管理 | |
| 351 | 358 | * |
| 352 | 359 | * @param patientsQueryRequest 全部孕妇管理查询 (因为请求参数一样同用一个对象) |
| 353 | 360 | * @return 返回结果 |
| 354 | 361 | |
| ... | ... | @@ -355,9 +362,9 @@ |
| 355 | 362 | @RequestMapping(value = "/raPuer", method = RequestMethod.GET) |
| 356 | 363 | @ResponseBody |
| 357 | 364 | @TokenRequired |
| 358 | - public BaseResponse queryRegionAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request) { | |
| 365 | + public BaseResponse queryRegionAllPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
| 359 | 366 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 360 | - return patientFacade.queryHighRisk(patientsQueryRequest,null,1,loginState.getId(),"true",Boolean.TRUE); | |
| 367 | + return patientFacade.queryHighRisk(patientsQueryRequest, null, 1, loginState.getId(), "true", Boolean.TRUE); | |
| 361 | 368 | } |
| 362 | 369 | |
| 363 | 370 | /** |
| 364 | 371 | |
| ... | ... | @@ -419,10 +426,10 @@ |
| 419 | 426 | header.put("bookbuildingDoctor", "建档医生"); |
| 420 | 427 | |
| 421 | 428 | String hospitalId = autoMatchFacade.getHospitalId(patientManagerRequest.getOperatorId()); |
| 422 | - if("1000000114".equals(hospitalId)){ | |
| 429 | + if ("1000000114".equals(hospitalId)) { | |
| 423 | 430 | header.put("sendCareMan", "母子保健手册"); |
| 424 | 431 | header.put("bookbuildingDate", "发放时间"); |
| 425 | - }else{ | |
| 432 | + } else { | |
| 426 | 433 | header.put("bookbuildingDate", "建档时间"); |
| 427 | 434 | } |
| 428 | 435 | httpServletResponse.setContentType("application/force-download"); |
| 429 | 436 | |
| ... | ... | @@ -434,10 +441,9 @@ |
| 434 | 441 | } |
| 435 | 442 | |
| 436 | 443 | /** |
| 437 | - * 母子保健手册导出 | |
| 444 | + * 母子保健手册导出 | |
| 438 | 445 | * |
| 439 | - * @param httpServletRequest | |
| 440 | - // * @param patientManagerRequest | |
| 446 | + * @param httpServletRequest // * @param patientManagerRequest | |
| 441 | 447 | * @param httpServletResponse |
| 442 | 448 | */ |
| 443 | 449 | @TokenRequired |
| ... | ... | @@ -481,6 +487,141 @@ |
| 481 | 487 | ExcelUtil.toExcel(httpServletResponse.getOutputStream(), list, header); |
| 482 | 488 | } catch (Exception e) { |
| 483 | 489 | ExceptionUtils.catchException(e, "childbirthManagerExcel异常"); |
| 490 | + } | |
| 491 | + } | |
| 492 | + | |
| 493 | + //孕妇随访本 | |
| 494 | + @TokenRequired | |
| 495 | + @RequestMapping(value = "/gravidaFollowWord", method = RequestMethod.GET) | |
| 496 | + public void gravidaFollowWord(@RequestParam("pid") String pid, HttpServletResponse response) { | |
| 497 | + | |
| 498 | + Map<String, Object> map = patientFacade.gravidaFollowWord(pid, response); | |
| 499 | + try { | |
| 500 | + // 验证License | |
| 501 | + if (!getLicense()) { | |
| 502 | + return; | |
| 503 | + } | |
| 504 | + Document doc = null;// 原始word路径 | |
| 505 | + try { | |
| 506 | + doc = new Document(ViewController.class.getClassLoader().getResourceAsStream("sfdjb.docx")); | |
| 507 | + | |
| 508 | + DocumentBuilder builder = new DocumentBuilder(doc); | |
| 509 | + if (map.containsKey("red")) { | |
| 510 | + builder.moveToBookmark("red"); | |
| 511 | + markFrameText(builder, (String) map.get("red")); | |
| 512 | + map.remove("red"); | |
| 513 | + } | |
| 514 | + if (map.containsKey("orange")) { | |
| 515 | + builder.moveToBookmark("orange"); | |
| 516 | + markFrameText(builder, (String) map.get("orange")); | |
| 517 | + map.remove("orange"); | |
| 518 | + } | |
| 519 | + | |
| 520 | + markData(doc, map);//普通数据 | |
| 521 | + sendToBrowser(doc, "导出", "doc", true, response); | |
| 522 | + } catch (Exception e) { | |
| 523 | + e.printStackTrace(); | |
| 524 | + } | |
| 525 | + response.flushBuffer(); | |
| 526 | + } catch (IOException e) { | |
| 527 | + e.printStackTrace(); | |
| 528 | + } | |
| 529 | + } | |
| 530 | + | |
| 531 | + /** | |
| 532 | + * 获取license | |
| 533 | + * | |
| 534 | + * @return | |
| 535 | + */ | |
| 536 | + public static boolean getLicense() { | |
| 537 | + boolean result = false; | |
| 538 | + try { | |
| 539 | + InputStream is = ViewController.class.getClassLoader().getResourceAsStream("license.xml"); | |
| 540 | + License aposeLic = new License(); | |
| 541 | + aposeLic.setLicense(is); | |
| 542 | + result = true; | |
| 543 | + } catch (Exception e) { | |
| 544 | + e.printStackTrace(); | |
| 545 | + } | |
| 546 | + return result; | |
| 547 | + } | |
| 548 | + | |
| 549 | + /** | |
| 550 | + * 向客户端发送数据 | |
| 551 | + * | |
| 552 | + * @param doc com.aspose.words.Document | |
| 553 | + * @param docName 返回客户端的word文件名 | |
| 554 | + * @param formatType DOC 或者 DOCX | |
| 555 | + * @param openNewWindow 在线打开或者下载 | |
| 556 | + * @param response | |
| 557 | + * @throws Exception | |
| 558 | + */ | |
| 559 | + private void sendToBrowser(Document doc, String docName, String formatType, | |
| 560 | + boolean openNewWindow, HttpServletResponse response) | |
| 561 | + throws Exception { | |
| 562 | + String extension = formatType; | |
| 563 | + | |
| 564 | + if (formatType.equals("WML") || formatType.equals("FOPC")) | |
| 565 | + extension = "XML"; | |
| 566 | + | |
| 567 | + String fileName = docName + "." + extension; | |
| 568 | + | |
| 569 | + if (openNewWindow) | |
| 570 | + response.setHeader("content-disposition", "attachment; filename=" | |
| 571 | + + fileName); | |
| 572 | + else | |
| 573 | + response.addHeader("content-disposition", "inline; filename=" | |
| 574 | + + fileName); | |
| 575 | + | |
| 576 | + if ("doc".equals(formatType)) { | |
| 577 | + response.setContentType("application/msword"); | |
| 578 | + doc.save(response.getOutputStream(), SaveFormat.DOC); | |
| 579 | + } else if ("docx".equals(formatType)) { | |
| 580 | + response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); | |
| 581 | + doc.save(response.getOutputStream(), SaveFormat.DOCX); | |
| 582 | + } else if ("pdf".equals(formatType)) { | |
| 583 | + response.setContentType("application/pdf"); | |
| 584 | + doc.save(response.getOutputStream(), SaveFormat.PDF); | |
| 585 | + } | |
| 586 | + } | |
| 587 | + | |
| 588 | + /** | |
| 589 | + * 添加特殊字 | |
| 590 | + * | |
| 591 | + * @param builder | |
| 592 | + * @param text | |
| 593 | + */ | |
| 594 | + public void markFrameText(DocumentBuilder builder, String text) { | |
| 595 | + try { | |
| 596 | + if (com.lyms.platform.common.utils.StringUtils.isEmpty(text) || "null".equals(text)) { | |
| 597 | + return; | |
| 598 | + } | |
| 599 | + builder.getFont().getBorder().clearFormatting(); | |
| 600 | + builder.getFont().getBorder().setColor(Color.black); | |
| 601 | + builder.getFont().getBorder().setLineWidth(1); | |
| 602 | + builder.getFont().getBorder().setLineStyle(LineStyle.SINGLE); | |
| 603 | + builder.getFont().getBorder().setDistanceFromText(2); | |
| 604 | + // builder.getFont().getBorder().setShadow(true); | |
| 605 | + builder.write(text); | |
| 606 | + } catch (Exception e) { | |
| 607 | + e.printStackTrace(); | |
| 608 | + } | |
| 609 | + } | |
| 610 | + | |
| 611 | + public void markData(Document doc, Map<String, Object> data) { | |
| 612 | + try { | |
| 613 | + for (Map.Entry<String, Object> m : data.entrySet()) { | |
| 614 | + if (m.getValue() == null || "null".equals(m.getValue())) { | |
| 615 | + continue; | |
| 616 | + } | |
| 617 | + BookmarkCollection books = doc.getRange().getBookmarks(); | |
| 618 | + Bookmark bookmark = books.get(m.getKey()); | |
| 619 | + if (bookmark != null) { | |
| 620 | + bookmark.setText(String.valueOf(m.getValue())); | |
| 621 | + } | |
| 622 | + } | |
| 623 | + } catch (Exception e) { | |
| 624 | + e.printStackTrace(); | |
| 484 | 625 | } |
| 485 | 626 | } |
| 486 | 627 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
431ab2d
| ... | ... | @@ -110,6 +110,7 @@ |
| 110 | 110 | private MatDeliverFollowService matDeliverFollowService; |
| 111 | 111 | @Autowired |
| 112 | 112 | private CouponMapper couponMapper; |
| 113 | + | |
| 113 | 114 | /** |
| 114 | 115 | * 修改产妇的社区 |
| 115 | 116 | * |
| ... | ... | @@ -1256,6 +1257,7 @@ |
| 1256 | 1257 | patientManagerResult.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); |
| 1257 | 1258 | return patientManagerResult; |
| 1258 | 1259 | } |
| 1260 | + | |
| 1259 | 1261 | public PatientManagerResult healthHandbookExcelManager(PatientManagerRequest patientManagerRequest) { |
| 1260 | 1262 | PatientManagerResult patientManagerResult = new PatientManagerResult(); |
| 1261 | 1263 | |
| 1262 | 1264 | |
| ... | ... | @@ -1330,13 +1332,13 @@ |
| 1330 | 1332 | //身份证号码:孕妇身份证号码 ==cardNo |
| 1331 | 1333 | healthHandbookExcelModel.setCardNo(patients.getCardNo()); |
| 1332 | 1334 | //发放机构:当前机构名称== 当前机构名称 |
| 1333 | - String hospitalName= couponMapper.getHospitalName(patients.getHospitalId()); | |
| 1334 | - healthHandbookExcelModel.setOrganization(hospitalName==null?"诸城市人民医院":hospitalName); | |
| 1335 | + String hospitalName = couponMapper.getHospitalName(patients.getHospitalId()); | |
| 1336 | + healthHandbookExcelModel.setOrganization(hospitalName == null ? "诸城市人民医院" : hospitalName); | |
| 1335 | 1337 | //镇街、村居或单位:现住地址 |
| 1336 | 1338 | healthHandbookExcelModel.setAddress(patients.getAddress()); |
| 1337 | 1339 | //孩次:分娩儿童数 |
| 1338 | 1340 | AntExChuModel data = antExService.findOne(patients.getId()); |
| 1339 | - healthHandbookExcelModel.setChildTime(data==null?1:(data.getProdTime()==null ? 1:data.getProdTime()+1)); | |
| 1341 | + healthHandbookExcelModel.setChildTime(data == null ? 1 : (data.getProdTime() == null ? 1 : data.getProdTime() + 1)); | |
| 1340 | 1342 | //孕期:当前使用有孕== 有孕 |
| 1341 | 1343 | healthHandbookExcelModel.setGestation(healthHandbookExcelModel.getGestation()); |
| 1342 | 1344 | //发放日期:当前日期 |
| ... | ... | @@ -1522,6 +1524,90 @@ |
| 1522 | 1524 | patientBaseResult.setFlag(true); |
| 1523 | 1525 | } |
| 1524 | 1526 | return new BaseObjectResponse().setData(patientBaseResult).setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS); |
| 1527 | + } | |
| 1528 | + | |
| 1529 | + /*** | |
| 1530 | + *重点孕妇登记随访本 | |
| 1531 | + * | |
| 1532 | + */ | |
| 1533 | + public Map gravidaFollowWord(String pid, HttpServletResponse response) { | |
| 1534 | + Map<String, Object> dataMap = new HashMap<>(); | |
| 1535 | + if (StringUtils.isNotEmpty(pid)) { | |
| 1536 | + Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid)), Patients.class); | |
| 1537 | + dataMap.put("name", patients.getUsername()); | |
| 1538 | + dataMap.put("age", DateUtil.getAge(patients.getBirth())); | |
| 1539 | + //孕次 | |
| 1540 | + AntExChuModel antExChuModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid)), AntExChuModel.class); | |
| 1541 | + if (null != antExChuModel) { | |
| 1542 | + dataMap.put("pregnancySecond", antExChuModel.getPregnancyTimes()); | |
| 1543 | + //产次 | |
| 1544 | + dataMap.put("parity", antExChuModel.getProdTime()); | |
| 1545 | + } | |
| 1546 | + //预产期 | |
| 1547 | + dataMap.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate())); | |
| 1548 | + //身份证号 | |
| 1549 | + if (StringUtils.isNotEmpty(patients.getPcerteTypeId()) && "70ae1d93-2964-46bc-83fa-bec9ff605b1c".equals(patients.getPcerteTypeId())) { | |
| 1550 | + dataMap.put("cardNo", patients.getCardNo()); | |
| 1551 | + } | |
| 1552 | + //孕妇电话 | |
| 1553 | + dataMap.put("gravidaPhone", patients.getPhone()); | |
| 1554 | + //丈夫电话 | |
| 1555 | + dataMap.put("husbandPhone", patients.getHusbandPhone() != null ? patients.getHusbandPhone() : null); | |
| 1556 | + //住址 | |
| 1557 | + dataMap.put("address", CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(), | |
| 1558 | + patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService)); | |
| 1559 | + dataMap.put("weeks", DateUtil.getWeek(patients.getLastMenses())); | |
| 1560 | + //确诊单位 | |
| 1561 | + dataMap.put("diagnosis", "诸城人民医院"); | |
| 1562 | + dataMap.put("created", DateUtil.getyyyy_MM_dd(patients.getCreated())); | |
| 1563 | + //户籍 | |
| 1564 | + if (StringUtils.isNotEmpty(patients.getPliveTypeId())) { | |
| 1565 | + if ("57624c440cf23d4631523ea1".equals(patients.getPliveTypeId())) { | |
| 1566 | + dataMap.put("cz", "√"); | |
| 1567 | + } else if ("5a371bce0cf2ab082ac30433".equals(patients.getPliveTypeId())) { | |
| 1568 | + dataMap.put("zz", "√"); | |
| 1569 | + } else if ("57624c5e0cf23d4631523ea2".equals(patients.getPliveTypeId())) { | |
| 1570 | + dataMap.put("ld", "√"); | |
| 1571 | + } | |
| 1572 | + } | |
| 1573 | + if (CollectionUtils.isNotEmpty(patients.getRiskFactorId())) { | |
| 1574 | + List<String> riskFactor = patients.getRiskFactorId(); | |
| 1575 | + StringBuffer riskStr = new StringBuffer(); | |
| 1576 | + for (String risk : riskFactor) { | |
| 1577 | + riskStr.append(getBasicConfig(risk) + " "); | |
| 1578 | + } | |
| 1579 | + dataMap.put("highRisk", riskStr); | |
| 1580 | + } | |
| 1581 | + //判断风险等级 | |
| 1582 | + if (StringUtils.isNotEmpty(patients.getRiskLevelId())) { | |
| 1583 | + String str = patients.getRiskLevelId(); | |
| 1584 | + String substr = str.substring(1, str.length() - 1); | |
| 1585 | + String[] strings = substr.split(","); | |
| 1586 | + for (String strs : strings) { | |
| 1587 | + if ("\"49a36aea-c5b6-4162-87d2-9eb3c6ec00c2\"".equals(strs)) { | |
| 1588 | + dataMap.put("orange", "√"); | |
| 1589 | + } else if ("\"eb146c03-b19f-4e28-b85f-fda574b2283b\"".equals(strs)) { | |
| 1590 | + dataMap.put("red", "√"); | |
| 1591 | + } else if ("\"224b2329-cb82-4da3-a071-8527f8283aab\"".equals(strs)) { | |
| 1592 | + dataMap.put("purple", "√"); | |
| 1593 | + } else if ("\"315107bd-91fe-42a1-9237-752f3c046a40\"".equals(strs)) { | |
| 1594 | + dataMap.put("yellow", "√"); | |
| 1595 | + } | |
| 1596 | + } | |
| 1597 | + } | |
| 1598 | + } | |
| 1599 | + return dataMap; | |
| 1600 | + } | |
| 1601 | + | |
| 1602 | + private String getBasicConfig(String id) { | |
| 1603 | + if (com.lyms.platform.common.utils.StringUtils.isEmpty(id)) { | |
| 1604 | + return ""; | |
| 1605 | + } | |
| 1606 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(id); | |
| 1607 | + if (null != basicConfig) { | |
| 1608 | + return basicConfig.getName(); | |
| 1609 | + } | |
| 1610 | + return ""; | |
| 1525 | 1611 | } |
| 1526 | 1612 | |
| 1527 | 1613 | } |