Commit c3ff90810617a60dd1ae80cceadea8fd93314500
1 parent
4c003d80e5
Exists in
master
and in
6 other branches
分娩登记字段添加,和导出的字段添加
Showing 3 changed files with 354 additions and 263 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatDeliverController.java
View file @
c3ff908
| ... | ... | @@ -283,272 +283,19 @@ |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | |
| 286 | + /** | |
| 287 | + * 分娩导出 | |
| 288 | + * | |
| 289 | + * @param httpServletRequest | |
| 290 | + * @param childbirthManagerRequest | |
| 291 | + * @param httpServletResponse | |
| 292 | + */ | |
| 286 | 293 | @TokenRequired |
| 287 | 294 | @RequestMapping(value = "fmRecordExportExcl", method = RequestMethod.POST) |
| 288 | 295 | public void fmRecordExportExcl(HttpServletRequest httpServletRequest, @RequestBody ChildbirthManagerRequest childbirthManagerRequest, HttpServletResponse httpServletResponse) { |
| 289 | 296 | try { |
| 290 | 297 | childbirthManagerRequest.setOperatorId(((LoginContext) httpServletRequest.getAttribute("loginContext")).getId()); |
| 291 | - | |
| 292 | - Map<String, String> query = childbirthManagerRequest.getInitQueryMap(); | |
| 293 | - | |
| 294 | - String queryStr = ""; | |
| 295 | - for (String key : query.keySet()) { | |
| 296 | - queryStr += key + ","; | |
| 297 | - } | |
| 298 | - childbirthManagerRequest.setInitQuery(queryStr + "fmTime"); | |
| 299 | - | |
| 300 | - childbirthManagerRequest.setExcel(true); | |
| 301 | - // 这里返回的结果必然是这个泛型,之所以query返回的结果集没有用泛型是为了更好的传递数据 | |
| 302 | - @SuppressWarnings("unchecked") | |
| 303 | - List<ChildbirthManagerQueryModel> childbirthManagerQueryModelList = matDeliverFacade.childbirthManager(childbirthManagerRequest).getData(); | |
| 304 | - List<Map<String, Object>> list = new LinkedList<>(); | |
| 305 | - int num = 0; | |
| 306 | - for (ChildbirthManagerQueryModel queryModel : childbirthManagerQueryModelList) { | |
| 307 | - | |
| 308 | - Patients patients = patientsService.findOnePatientById(queryModel.getPatientId()); | |
| 309 | - Map<String, Object> map = new LinkedHashMap<>(); | |
| 310 | - map.put("num", String.valueOf(num)); | |
| 311 | - map.put("dueDate", queryModel.getDueDate()); | |
| 312 | - map.put("fmTime", queryModel.getFmTime()); | |
| 313 | - if (StringUtils.isNotEmpty(queryModel.getBhnum())) { | |
| 314 | - map.put("zyNo", " " + queryModel.getBhnum()); | |
| 315 | - } else { | |
| 316 | - map.put("zyNo", "-"); | |
| 317 | - } | |
| 318 | - map.put("name", queryModel.getName()); | |
| 319 | - map.put("age", String.valueOf(queryModel.getAge())); | |
| 320 | - //居住地 | |
| 321 | - String liveAddress = CommonsHelper.getResidence(patients.getProvinceId(), patients.getCityId(), | |
| 322 | - patients.getAreaId(), patients.getStreetId(), patients.getAddress(), basicConfigService); | |
| 323 | - map.put("liveAddress", liveAddress); | |
| 324 | - String regAddress = CommonsHelper.getResidence(patients.getProvinceRegisterId(), | |
| 325 | - patients.getCityRegisterId(), patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService); | |
| 326 | - | |
| 327 | - map.put("regAddress", regAddress); | |
| 328 | - map.put("phone", queryModel.getPhone()); | |
| 329 | - | |
| 330 | - /* AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 331 | - antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 332 | - antExChuQuery.setParentId(patients.getId()); | |
| 333 | - List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
| 334 | - if (CollectionUtils.isNotEmpty(antExChuModels)) | |
| 335 | - { | |
| 336 | - AntExChuModel antExChuModel = antExChuModels.get(0); | |
| 337 | - map.put("yc",antExChuModel.getPregnancyTimes() == null ? "" : antExChuModel.getPregnancyTimes()); | |
| 338 | - map.put("cc",antExChuModel.getProdTime() == null ? "" : antExChuModel.getProdTime()); | |
| 339 | - | |
| 340 | - } | |
| 341 | - else | |
| 342 | - { | |
| 343 | - map.put("yc",""); | |
| 344 | - map.put("cc",""); | |
| 345 | - }*/ | |
| 346 | - if (null == queryModel.getGravidity()) { | |
| 347 | - map.put("yc", ""); | |
| 348 | - } else { | |
| 349 | - map.put("yc", String.valueOf(queryModel.getGravidity())); | |
| 350 | - } | |
| 351 | - if (null == queryModel.getDueCount()) { | |
| 352 | - map.put("cc", ""); | |
| 353 | - } else { | |
| 354 | - map.put("cc", String.valueOf(queryModel.getDueCount())); | |
| 355 | - } | |
| 356 | - map.put("week", queryModel.getDueWeek()); | |
| 357 | - HighScoreResult highScoreResult = antenatalExaminationFacade.findLastRisk(patients.getPid(), false); | |
| 358 | - //妊娠期高危因素 | |
| 359 | - map.put("risk", highScoreResult.gethighRiskStr()); | |
| 360 | - String a = ""; | |
| 361 | - String m = ""; | |
| 362 | - String y = ""; | |
| 363 | - Map<String, Object> amy = queryModel.getMyzd(); | |
| 364 | - if (null != amy && amy.size() > 0) { | |
| 365 | - if (null != amy.get("0")) { | |
| 366 | - if (true == (boolean) amy.get("0")) { | |
| 367 | - a = "√"; | |
| 368 | - } | |
| 369 | - } | |
| 370 | - if (null != amy.get("1")) { | |
| 371 | - if (true == (boolean) amy.get("1")) { | |
| 372 | - m = "√"; | |
| 373 | - } | |
| 374 | - } | |
| 375 | - if (null != amy.get("2")) { | |
| 376 | - if (true == (boolean) amy.get("2")) { | |
| 377 | - y = "√"; | |
| 378 | - } | |
| 379 | - } | |
| 380 | - } | |
| 381 | - map.put("A", a); | |
| 382 | - map.put("M", m); | |
| 383 | - map.put("Y", y); | |
| 384 | - String aModel1 = ""; | |
| 385 | - String aModel2 = ""; | |
| 386 | - String aModel3 = ""; | |
| 387 | - String aModel4 = ""; | |
| 388 | - //镇痛方式 | |
| 389 | - if ("1".equals(queryModel.getZgnmz())) { | |
| 390 | - aModel1 = "√"; | |
| 391 | - } | |
| 392 | - if ("1".equals(queryModel.getDlfm())) { | |
| 393 | - aModel2 = "√"; | |
| 394 | - } | |
| 395 | - if ("1".equals(queryModel.getFmzty())) { | |
| 396 | - aModel3 = "√"; | |
| 397 | - } | |
| 398 | - if ("1".equals(queryModel.getZypbfm())) { | |
| 399 | - aModel4 = "√"; | |
| 400 | - } | |
| 401 | - map.put("aModel1", aModel1); | |
| 402 | - map.put("aModel2", aModel2); | |
| 403 | - map.put("aModel3", aModel3); | |
| 404 | - map.put("aModel4", aModel4); | |
| 405 | - | |
| 406 | - String yidu = ""; | |
| 407 | - String erdu = ""; | |
| 408 | - String sandu = ""; | |
| 409 | - String ceqie = ""; | |
| 410 | - if (null != queryModel.getSiLielevel()) { | |
| 411 | - if (1 == queryModel.getSiLielevel()) { | |
| 412 | - yidu = "√"; | |
| 413 | - } else if (2 == queryModel.getSiLielevel()) { | |
| 414 | - erdu = "√"; | |
| 415 | - } else if (3 == queryModel.getSiLielevel()) { | |
| 416 | - sandu = "√"; | |
| 417 | - } | |
| 418 | - } | |
| 419 | - | |
| 420 | - map.put("yidu", yidu); | |
| 421 | - map.put("erdu", erdu); | |
| 422 | - map.put("sandu", sandu); | |
| 423 | - if ("2".equals(queryModel.getIncision())) { | |
| 424 | - ceqie = "√"; | |
| 425 | - } | |
| 426 | - map.put("ceqie", ceqie); | |
| 427 | - //map.put("perinealCondition",queryModel.getPerinealCondition() == null ? "" : queryModel.getPerinealCondition()); | |
| 428 | - map.put("fetalPosition", queryModel.getFetalPosition() == null ? "" : queryModel.getFetalPosition()); | |
| 429 | - | |
| 430 | - String reslult1 = ""; | |
| 431 | - String reslult2 = ""; | |
| 432 | - String reslult3 = ""; | |
| 433 | - String reslult4 = ""; | |
| 434 | - String reslult5 = ""; | |
| 435 | - String deliveryMode = queryModel.getDeliveryMode(); | |
| 436 | - String deliveryMode1 = queryModel.getDeliveryMode1(); | |
| 437 | - if (deliveryMode != null && deliveryMode.contains("顺产")) { | |
| 438 | - reslult1 = "√"; | |
| 439 | - } | |
| 440 | - if (deliveryMode1 != null && deliveryMode1.contains("胎吸")) { | |
| 441 | - reslult2 = "√"; | |
| 442 | - } else if (deliveryMode1 != null && deliveryMode1.contains("自由体位")) { | |
| 443 | - reslult3 = "√"; | |
| 444 | - } else if (deliveryMode1 != null && deliveryMode1.contains("臀牵引")) { | |
| 445 | - reslult4 = "√"; | |
| 446 | - } | |
| 447 | - if (deliveryMode != null && deliveryMode.contains("剖宫产")) { | |
| 448 | - reslult5 = "√"; | |
| 449 | - } | |
| 450 | - map.put("deliveryMode1", reslult1); | |
| 451 | - map.put("deliveryMode2", reslult2); | |
| 452 | - map.put("deliveryMode3", reslult3); | |
| 453 | - map.put("deliveryMode4", reslult4); | |
| 454 | - map.put("deliveryMode5", reslult5); | |
| 455 | - map.put("thloseBloodL", queryModel.getThloseBloodL() == null ? "" : String.valueOf(queryModel.getThloseBloodL())); | |
| 456 | - map.put("sex", queryModel.getSex()); | |
| 457 | - map.put("height", queryModel.getBabyHeight()); | |
| 458 | - int nu = 0; | |
| 459 | - String weight = ""; | |
| 460 | - if (StringUtils.isNotEmpty(queryModel.getBabyWeight()) && queryModel.getBabyWeight().contains(",")) { | |
| 461 | - nu = 1; | |
| 462 | - String arrs[] = queryModel.getBabyWeight().split(","); | |
| 463 | - for (int i = 0; i < arrs.length; i++) { | |
| 464 | - try { | |
| 465 | - String w = String.valueOf(Double.parseDouble(arrs[i]) * 1000); | |
| 466 | - int dex = w.indexOf("."); | |
| 467 | - if (-1 == dex) { | |
| 468 | - weight += w + ""; | |
| 469 | - } else { | |
| 470 | - weight += w.substring(0, dex) + ""; | |
| 471 | - } | |
| 472 | - //weight+=(Double.parseDouble(arrs[i]) * 1000)+""; | |
| 473 | - } catch (Exception E) { | |
| 474 | - weight += arrs[i]; | |
| 475 | - } | |
| 476 | - if (i != arrs.length - 1) { | |
| 477 | - weight += ","; | |
| 478 | - } | |
| 479 | - | |
| 480 | - } | |
| 481 | - } | |
| 482 | - if (0 == nu && !"-".equals(queryModel.getBabyWeight())) { | |
| 483 | - if (StringUtils.isNotEmpty(queryModel.getBabyWeight())) { | |
| 484 | - String w = String.valueOf(Double.parseDouble(queryModel.getBabyWeight()) * 1000); | |
| 485 | - int dex = w.indexOf("."); | |
| 486 | - if (-1 == dex) { | |
| 487 | - weight = w + ""; | |
| 488 | - } else { | |
| 489 | - weight = w.substring(0, dex) + ""; | |
| 490 | - } | |
| 491 | - } | |
| 492 | - //weight = (Double.parseDouble(queryModel.getBabyWeight()) * 1000)+""; | |
| 493 | - } else if (0 == nu && "-".equals(queryModel.getBabyWeight()) && StringUtils.isNotEmpty(queryModel.getBabyWeight())) { | |
| 494 | - weight = queryModel.getBabyWeight(); | |
| 495 | - } | |
| 496 | - map.put("weight", weight); | |
| 497 | - //评分 | |
| 498 | - map.put("apgarScorePf1", queryModel.getApgarScorePf1()); | |
| 499 | - map.put("apgarScorePf5", queryModel.getApgarScorePf5()); | |
| 500 | - map.put("apgarScorePf10", queryModel.getApgarScorePf10()); | |
| 501 | - | |
| 502 | - map.put("malformation", queryModel.getMalformation() == null ? "" : queryModel.getMalformation()); | |
| 503 | - //queryModel.getTireNumber()-queryModel.getLivingNumber() | |
| 504 | - map.put("sc", queryModel.getPregnancyOut());//死产 | |
| 505 | - | |
| 506 | - int bn = 0; | |
| 507 | - String jcsc = ""; | |
| 508 | - if (queryModel.getContactM() != null && queryModel.getContactM().contains(",")) { | |
| 509 | - bn = 1; | |
| 510 | - String[] arrs = queryModel.getContactM().split(","); | |
| 511 | - for (int i = 0; i < arrs.length; i++) { | |
| 512 | - if ("1".equals(arrs[i])) { | |
| 513 | - jcsc += "√"; | |
| 514 | - | |
| 515 | - } else { | |
| 516 | - jcsc += "-"; | |
| 517 | - } | |
| 518 | - if (i != arrs.length - 1) { | |
| 519 | - jcsc += ","; | |
| 520 | - } | |
| 521 | - } | |
| 522 | - } | |
| 523 | - if (bn == 0 && !"-".equals(queryModel.getContactM())) { | |
| 524 | - jcsc += "√"; | |
| 525 | - } else if (bn == 0 && "-".equals(queryModel.getContactM())) { | |
| 526 | - jcsc += queryModel.getContactM(); | |
| 527 | - } | |
| 528 | - map.put("jzsx", jcsc);//皮肤接触及早吸吮≥30分钟 | |
| 529 | - map.put("xj", "-");//宣教 | |
| 530 | - map.put("jsz", queryModel.getDeliverDoctor());//接生者 | |
| 531 | - //科室 | |
| 532 | - String department1 = ""; | |
| 533 | - String department2 = ""; | |
| 534 | - if ("1".equals(queryModel.getDepartment())) { | |
| 535 | - department1 = "√"; | |
| 536 | - } else if ("2".equals(queryModel.getDepartment())) { | |
| 537 | - department2 = "√"; | |
| 538 | - } | |
| 539 | - map.put("department1", department1); | |
| 540 | - map.put("department2", department2); | |
| 541 | - | |
| 542 | - map.put("remark", patients.getMremark() == null ? "" : patients.getMremark());//备注42列 | |
| 543 | - num++; | |
| 544 | - list.add(map); | |
| 545 | - } | |
| 546 | - | |
| 547 | - httpServletResponse.setContentType("application/force-download"); | |
| 548 | - httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("分娩登记表.xls").getBytes("UTF-8"), "ISO-8859-1")); | |
| 549 | - String path = this.getClass().getResource("/").getPath() + "fm_record.xls"; | |
| 550 | - ExcelUtil.writeWhExclFile(path, httpServletResponse.getOutputStream(), list); | |
| 551 | - | |
| 298 | + matDeliverFacade.fmRecordExportExcl(childbirthManagerRequest, httpServletResponse); | |
| 552 | 299 | } catch (Exception e) { |
| 553 | 300 | ExceptionUtils.catchException(e, "fmRecordExportExcl异常"); |
| 554 | 301 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
c3ff908
| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | import com.lyms.platform.operate.web.utils.UnitConstants; |
| 21 | 21 | import com.lyms.platform.operate.web.worker.ChildbearAgeWorker; |
| 22 | 22 | import com.lyms.platform.operate.web.worker.DueOrgCountWorker; |
| 23 | +import com.lyms.platform.operate.web.worker.MatDeliverWorker; | |
| 23 | 24 | import com.lyms.platform.operate.web.worker.MaterDeliverWorker; |
| 24 | 25 | import com.lyms.platform.permission.model.Organization; |
| 25 | 26 | import com.lyms.platform.permission.model.OrganizationQuery; |
| ... | ... | @@ -47,8 +48,8 @@ |
| 47 | 48 | import java.text.ParseException; |
| 48 | 49 | import java.text.SimpleDateFormat; |
| 49 | 50 | import java.util.*; |
| 50 | -import java.util.concurrent.Callable; | |
| 51 | -import java.util.concurrent.Future; | |
| 51 | +import java.util.concurrent.*; | |
| 52 | +import java.util.concurrent.atomic.AtomicInteger; | |
| 52 | 53 | |
| 53 | 54 | /** |
| 54 | 55 | * 分娩记录信息 |
| ... | ... | @@ -139,6 +140,8 @@ |
| 139 | 140 | |
| 140 | 141 | private static Map<String, List> babyMap = new HashMap<>(); |
| 141 | 142 | |
| 143 | + private static ExpiryMap cacheExcelData = new ExpiryMap(); | |
| 144 | + | |
| 142 | 145 | @Autowired |
| 143 | 146 | private AreaCountFacade areaCountFacade; |
| 144 | 147 | |
| ... | ... | @@ -2738,5 +2741,69 @@ |
| 2738 | 2741 | totalMap.put("sieveFreeCount", ""); |
| 2739 | 2742 | list.add(totalMap); |
| 2740 | 2743 | } |
| 2744 | + | |
| 2745 | + /** | |
| 2746 | + * 分娩导出 | |
| 2747 | + * | |
| 2748 | + * @param childbirthManagerRequest | |
| 2749 | + * @param httpServletResponse | |
| 2750 | + * @throws Exception | |
| 2751 | + */ | |
| 2752 | + public void fmRecordExportExcl(ChildbirthManagerRequest childbirthManagerRequest, HttpServletResponse httpServletResponse) throws Exception { | |
| 2753 | + Map<String, String> query = childbirthManagerRequest.getInitQueryMap(); | |
| 2754 | + List<Map<String, Object>> list = new CopyOnWriteArrayList<>(); | |
| 2755 | + String cacheKey = query.toString(); | |
| 2756 | + Object o = cacheExcelData.get(cacheKey); | |
| 2757 | + if (o != null){ | |
| 2758 | + list = (List<Map<String, Object>>) o; | |
| 2759 | + } else { | |
| 2760 | + list = getMapList(childbirthManagerRequest, query); | |
| 2761 | + cacheExcelData.put(cacheKey, list); | |
| 2762 | + } | |
| 2763 | + httpServletResponse.setContentType("application/force-download"); | |
| 2764 | + httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("分娩登记表.xls").getBytes("UTF-8"), "ISO-8859-1")); | |
| 2765 | + String path = this.getClass().getResource("/").getPath() + "fm_record.xls"; | |
| 2766 | + ExcelUtil.writeWhExclFile(path, httpServletResponse.getOutputStream(), list); | |
| 2767 | + } | |
| 2768 | + | |
| 2769 | + /** | |
| 2770 | + * 获取maplist 数据 | |
| 2771 | + * @param childbirthManagerRequest | |
| 2772 | + * @param query | |
| 2773 | + * @return | |
| 2774 | + * @throws Exception | |
| 2775 | + */ | |
| 2776 | + private List<Map<String, Object>> getMapList(ChildbirthManagerRequest childbirthManagerRequest, Map<String, String> query) | |
| 2777 | + throws Exception { | |
| 2778 | + String queryStr = ""; | |
| 2779 | + for (String key : query.keySet()) { | |
| 2780 | + queryStr += key + ","; | |
| 2781 | + } | |
| 2782 | + childbirthManagerRequest.setInitQuery(queryStr + "fmTime"); | |
| 2783 | + | |
| 2784 | + childbirthManagerRequest.setExcel(true); | |
| 2785 | + // 这里返回的结果必然是这个泛型,之所以query返回的结果集没有用泛型是为了更好的传递数据 | |
| 2786 | + @SuppressWarnings("unchecked") | |
| 2787 | + List<ChildbirthManagerQueryModel> childbirthManagerQueryModelList = childbirthManager(childbirthManagerRequest).getData(); | |
| 2788 | + | |
| 2789 | + ExecutorService service = new ThreadPoolExecutor(5, 10, 900000, TimeUnit.MILLISECONDS, | |
| 2790 | + new LinkedBlockingQueue<Runnable>(), | |
| 2791 | + new RejectedExecutionHandler() { | |
| 2792 | + @Override | |
| 2793 | + public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { | |
| 2794 | + throw new RuntimeException(); | |
| 2795 | + } | |
| 2796 | + }); | |
| 2797 | + List<Map<String, Object>> list = new CopyOnWriteArrayList<>(); | |
| 2798 | + AtomicInteger atomicInteger = new AtomicInteger(); | |
| 2799 | + for (ChildbirthManagerQueryModel queryModel : childbirthManagerQueryModelList) { | |
| 2800 | + service.execute(new MatDeliverWorker(patientsService, queryModel, basicConfigService, antenatalExaminationFacade, list, atomicInteger)); | |
| 2801 | + } | |
| 2802 | + service.shutdown(); | |
| 2803 | + service.awaitTermination(1, TimeUnit.HOURS); | |
| 2804 | + | |
| 2805 | + return list; | |
| 2806 | + } | |
| 2807 | + | |
| 2741 | 2808 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/MatDeliverWorker.java
View file @
c3ff908
| 1 | +package com.lyms.platform.operate.web.worker; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.BasicConfigService; | |
| 4 | +import com.lyms.platform.biz.service.PatientsService; | |
| 5 | +import com.lyms.platform.common.utils.StringUtils; | |
| 6 | +import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade; | |
| 7 | +import com.lyms.platform.operate.web.result.ChildbirthManagerQueryModel; | |
| 8 | +import com.lyms.platform.operate.web.result.HighScoreResult; | |
| 9 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
| 10 | +import com.lyms.platform.pojo.Patients; | |
| 11 | + | |
| 12 | +import java.util.LinkedHashMap; | |
| 13 | +import java.util.List; | |
| 14 | +import java.util.Map; | |
| 15 | +import java.util.concurrent.atomic.AtomicInteger; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * | |
| 19 | + * @Author dongqin | |
| 20 | + * @Description 分娩导出 | |
| 21 | + * @Date 8:42 2019/5/24 | |
| 22 | + */ | |
| 23 | + | |
| 24 | +public class MatDeliverWorker implements Runnable{ | |
| 25 | + private PatientsService patientsService; | |
| 26 | + private ChildbirthManagerQueryModel queryModel; | |
| 27 | + private BasicConfigService basicConfigService; | |
| 28 | + private AntenatalExaminationFacade antenatalExaminationFacade; | |
| 29 | + private List<Map<String, Object>> list; | |
| 30 | + private AtomicInteger atomicInteger; | |
| 31 | + public MatDeliverWorker(PatientsService patientsService, ChildbirthManagerQueryModel queryModel, | |
| 32 | + BasicConfigService basicConfigService, AntenatalExaminationFacade antenatalExaminationFacade, | |
| 33 | + List<Map<String, Object>> list, AtomicInteger atomicInteger){ | |
| 34 | + this.patientsService = patientsService; | |
| 35 | + this.queryModel = queryModel; | |
| 36 | + this.basicConfigService = basicConfigService; | |
| 37 | + this.antenatalExaminationFacade = antenatalExaminationFacade; | |
| 38 | + this.list = list; | |
| 39 | + this.atomicInteger = atomicInteger; | |
| 40 | + } | |
| 41 | + | |
| 42 | + | |
| 43 | + @Override | |
| 44 | + public void run() { | |
| 45 | + try { | |
| 46 | + setExcelDate(); | |
| 47 | + }catch (Exception t){ | |
| 48 | + t.fillInStackTrace(); | |
| 49 | + } | |
| 50 | + | |
| 51 | + } | |
| 52 | + | |
| 53 | + | |
| 54 | + private void setExcelDate() { | |
| 55 | + Map<String, Object> map = new LinkedHashMap<>(); | |
| 56 | + list.add(map); | |
| 57 | + map.put("num", String.valueOf(atomicInteger.getAndIncrement())); | |
| 58 | + Patients patients = patientsService.findOnePatientById(queryModel.getPatientId()); | |
| 59 | + map.put("dueDate", queryModel.getDueDate()); | |
| 60 | + map.put("fmTime", queryModel.getFmTime()); | |
| 61 | + if (StringUtils.isNotEmpty(queryModel.getBhnum())) { | |
| 62 | + map.put("zyNo", " " + queryModel.getBhnum()); | |
| 63 | + } else { | |
| 64 | + map.put("zyNo", "-"); | |
| 65 | + } | |
| 66 | + map.put("name", queryModel.getName()); | |
| 67 | + map.put("age", String.valueOf(queryModel.getAge())); | |
| 68 | + //居住地 | |
| 69 | + String liveAddress = CommonsHelper.getResidence(patients.getProvinceId(), patients.getCityId(), | |
| 70 | + patients.getAreaId(), patients.getStreetId(), patients.getAddress(), basicConfigService); | |
| 71 | + map.put("liveAddress", liveAddress); | |
| 72 | + String regAddress = CommonsHelper.getResidence(patients.getProvinceRegisterId(), | |
| 73 | + patients.getCityRegisterId(), | |
| 74 | + patients.getAreaRegisterId(), | |
| 75 | + patients.getStreetRegisterId(), | |
| 76 | + patients.getAddressRegister(), | |
| 77 | + basicConfigService); | |
| 78 | + | |
| 79 | + map.put("regAddress", regAddress); | |
| 80 | + map.put("phone", queryModel.getPhone()); | |
| 81 | + | |
| 82 | + if (null == queryModel.getGravidity()) { | |
| 83 | + map.put("yc", ""); | |
| 84 | + } else { | |
| 85 | + map.put("yc", String.valueOf(queryModel.getGravidity())); | |
| 86 | + } | |
| 87 | + if (null == queryModel.getDueCount()) { | |
| 88 | + map.put("cc", ""); | |
| 89 | + } else { | |
| 90 | + map.put("cc", String.valueOf(queryModel.getDueCount())); | |
| 91 | + } | |
| 92 | + map.put("week", queryModel.getDueWeek()); | |
| 93 | + HighScoreResult highScoreResult = antenatalExaminationFacade.findLastRisk(patients.getPid(), false); | |
| 94 | + //妊娠期高危因素 | |
| 95 | + map.put("risk", highScoreResult.gethighRiskStr()); | |
| 96 | + | |
| 97 | + | |
| 98 | + Map<String, Object> amy = queryModel.getMyzd(); | |
| 99 | + map.put("A", getMyzdVal(amy, "A")); | |
| 100 | + map.put("M", getMyzdVal(amy, "M")); | |
| 101 | + map.put("Y", getMyzdVal(amy, "Y")); | |
| 102 | + | |
| 103 | + String aModel1 = ""; | |
| 104 | + String aModel2 = ""; | |
| 105 | + String aModel3 = ""; | |
| 106 | + String aModel4 = ""; | |
| 107 | + //镇痛方式 | |
| 108 | + if ("1".equals(queryModel.getZgnmz())) { | |
| 109 | + aModel1 = "√"; | |
| 110 | + } | |
| 111 | + if ("1".equals(queryModel.getDlfm())) { | |
| 112 | + aModel2 = "√"; | |
| 113 | + } | |
| 114 | + if ("1".equals(queryModel.getFmzty())) { | |
| 115 | + aModel3 = "√"; | |
| 116 | + } | |
| 117 | + if ("1".equals(queryModel.getZypbfm())) { | |
| 118 | + aModel4 = "√"; | |
| 119 | + } | |
| 120 | + map.put("aModel1", aModel1); | |
| 121 | + map.put("aModel2", aModel2); | |
| 122 | + map.put("aModel3", aModel3); | |
| 123 | + map.put("aModel4", aModel4); | |
| 124 | + | |
| 125 | + String yidu = ""; | |
| 126 | + String erdu = ""; | |
| 127 | + String sandu = ""; | |
| 128 | + String ceqie = ""; | |
| 129 | + if (null != queryModel.getSiLielevel()) { | |
| 130 | + if (1 == queryModel.getSiLielevel()) { | |
| 131 | + yidu = "√"; | |
| 132 | + } else if (2 == queryModel.getSiLielevel()) { | |
| 133 | + erdu = "√"; | |
| 134 | + } else if (3 == queryModel.getSiLielevel()) { | |
| 135 | + sandu = "√"; | |
| 136 | + } | |
| 137 | + } | |
| 138 | + | |
| 139 | + map.put("yidu", yidu); | |
| 140 | + map.put("erdu", erdu); | |
| 141 | + map.put("sandu", sandu); | |
| 142 | + if ("2".equals(queryModel.getIncision())) { | |
| 143 | + ceqie = "√"; | |
| 144 | + } | |
| 145 | + map.put("ceqie", ceqie); | |
| 146 | + map.put("fetalPosition", queryModel.getFetalPosition() == null ? "" : queryModel.getFetalPosition()); | |
| 147 | + | |
| 148 | + String reslult1 = ""; | |
| 149 | + String reslult2 = ""; | |
| 150 | + String reslult3 = ""; | |
| 151 | + String reslult4 = ""; | |
| 152 | + String reslult5 = ""; | |
| 153 | + String deliveryMode = queryModel.getDeliveryMode(); | |
| 154 | + String deliveryMode1 = queryModel.getDeliveryMode1(); | |
| 155 | + if (deliveryMode != null && deliveryMode.contains("顺产")) { | |
| 156 | + reslult1 = "√"; | |
| 157 | + } | |
| 158 | + if (deliveryMode1 != null && deliveryMode1.contains("胎吸")) { | |
| 159 | + reslult2 = "√"; | |
| 160 | + } else if (deliveryMode1 != null && deliveryMode1.contains("自由体位")) { | |
| 161 | + reslult3 = "√"; | |
| 162 | + } else if (deliveryMode1 != null && deliveryMode1.contains("臀牵引")) { | |
| 163 | + reslult4 = "√"; | |
| 164 | + } | |
| 165 | + if (deliveryMode != null && deliveryMode.contains("剖宫产")) { | |
| 166 | + reslult5 = "√"; | |
| 167 | + } | |
| 168 | + map.put("deliveryMode1", reslult1); | |
| 169 | + map.put("deliveryMode2", reslult2); | |
| 170 | + map.put("deliveryMode3", reslult3); | |
| 171 | + map.put("deliveryMode4", reslult4); | |
| 172 | + map.put("deliveryMode5", reslult5); | |
| 173 | + map.put("thloseBloodL", queryModel.getThloseBloodL() == null ? "" : String.valueOf(queryModel.getThloseBloodL())); | |
| 174 | + map.put("sex", queryModel.getSex()); | |
| 175 | + map.put("height", queryModel.getBabyHeight()); | |
| 176 | + int nu = 0; | |
| 177 | + String weight = ""; | |
| 178 | + if (StringUtils.isNotEmpty(queryModel.getBabyWeight()) && queryModel.getBabyWeight().contains(",")) { | |
| 179 | + nu = 1; | |
| 180 | + String arrs[] = queryModel.getBabyWeight().split(","); | |
| 181 | + for (int i = 0; i < arrs.length; i++) { | |
| 182 | + try { | |
| 183 | + String w = String.valueOf(Double.parseDouble(arrs[i]) * 1000); | |
| 184 | + int dex = w.indexOf("."); | |
| 185 | + if (-1 == dex) { | |
| 186 | + weight += w + ""; | |
| 187 | + } else { | |
| 188 | + weight += w.substring(0, dex) + ""; | |
| 189 | + } | |
| 190 | + } catch (Exception E) { | |
| 191 | + weight += arrs[i]; | |
| 192 | + } | |
| 193 | + if (i != arrs.length - 1) { | |
| 194 | + weight += ","; | |
| 195 | + } | |
| 196 | + | |
| 197 | + } | |
| 198 | + } | |
| 199 | + if (0 == nu && !"-".equals(queryModel.getBabyWeight())) { | |
| 200 | + if (StringUtils.isNotEmpty(queryModel.getBabyWeight())) { | |
| 201 | + String w = String.valueOf(Double.parseDouble(queryModel.getBabyWeight()) * 1000); | |
| 202 | + int dex = w.indexOf("."); | |
| 203 | + if (-1 == dex) { | |
| 204 | + weight = w + ""; | |
| 205 | + } else { | |
| 206 | + weight = w.substring(0, dex) + ""; | |
| 207 | + } | |
| 208 | + } | |
| 209 | + } else if (0 == nu && "-".equals(queryModel.getBabyWeight()) && StringUtils.isNotEmpty(queryModel.getBabyWeight())) { | |
| 210 | + weight = queryModel.getBabyWeight(); | |
| 211 | + } | |
| 212 | + map.put("weight", weight); | |
| 213 | + //评分 | |
| 214 | + map.put("apgarScorePf1", queryModel.getApgarScorePf1()); | |
| 215 | + map.put("apgarScorePf5", queryModel.getApgarScorePf5()); | |
| 216 | + map.put("apgarScorePf10", queryModel.getApgarScorePf10()); | |
| 217 | + | |
| 218 | + map.put("malformation", queryModel.getMalformation() == null ? "" : queryModel.getMalformation()); | |
| 219 | + map.put("sc", queryModel.getPregnancyOut());//死产 | |
| 220 | + | |
| 221 | + int bn = 0; | |
| 222 | + String jcsc = ""; | |
| 223 | + if (queryModel.getContactM() != null && queryModel.getContactM().contains(",")) { | |
| 224 | + bn = 1; | |
| 225 | + String[] arrs = queryModel.getContactM().split(","); | |
| 226 | + for (int i = 0; i < arrs.length; i++) { | |
| 227 | + if ("1".equals(arrs[i])) { | |
| 228 | + jcsc += "√"; | |
| 229 | + | |
| 230 | + } else { | |
| 231 | + jcsc += "-"; | |
| 232 | + } | |
| 233 | + if (i != arrs.length - 1) { | |
| 234 | + jcsc += ","; | |
| 235 | + } | |
| 236 | + } | |
| 237 | + } | |
| 238 | + if (bn == 0 && !"-".equals(queryModel.getContactM())) { | |
| 239 | + jcsc += "√"; | |
| 240 | + } else if (bn == 0 && "-".equals(queryModel.getContactM())) { | |
| 241 | + jcsc += queryModel.getContactM(); | |
| 242 | + } | |
| 243 | + map.put("jzsx", jcsc);//皮肤接触及早吸吮≥30分钟 | |
| 244 | + map.put("xj", "-");//宣教 | |
| 245 | + map.put("jsz", queryModel.getDeliverDoctor());//接生者 | |
| 246 | + //科室 | |
| 247 | + String department1 = ""; | |
| 248 | + String department2 = ""; | |
| 249 | + if ("1".equals(queryModel.getDepartment())) { | |
| 250 | + department1 = "√"; | |
| 251 | + } else if ("2".equals(queryModel.getDepartment())) { | |
| 252 | + department2 = "√"; | |
| 253 | + } | |
| 254 | + map.put("department1", department1); | |
| 255 | + map.put("department2", department2); | |
| 256 | + map.put("remark", patients.getMremark() == null ? "" : patients.getMremark());//备注42列 | |
| 257 | + } | |
| 258 | + | |
| 259 | + /** | |
| 260 | + * 获取 + 阳性/ - 阴性 | |
| 261 | + * @param amy | |
| 262 | + * @param key | |
| 263 | + * @return | |
| 264 | + */ | |
| 265 | + private String getMyzdVal(Map<String, Object> amy, String key) { | |
| 266 | + String str = ""; | |
| 267 | + if (amy != null && amy.size() > 0){ | |
| 268 | + Object object = amy.get(key); | |
| 269 | + if (object != null){ | |
| 270 | + if (object instanceof String){ | |
| 271 | + str = object.toString(); | |
| 272 | + } | |
| 273 | + } | |
| 274 | + } | |
| 275 | + return str; | |
| 276 | + } | |
| 277 | +} |