Commit 67ec4f8f5dcd6b11441223e4e5a377063afe1fbf
1 parent
d499121b1b
Exists in
master
and in
6 other branches
纠正月龄,体格发育评价
Showing 2 changed files with 172 additions and 71 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
67ec4f8
| ... | ... | @@ -797,29 +797,31 @@ | 
| 797 | 797 | } else { | 
| 798 | 798 | base.setDueDate(DateUtil.getyyyy_MM_dd(model.getDueDate())); | 
| 799 | 799 | } | 
| 800 | +// | |
| 801 | +// String c = ""; | |
| 802 | +// if (model.getDueWeek() != null) | |
| 803 | +// { | |
| 804 | +// Integer days = model.getDueWeek()*7 + (model.getDueDay() == null ? 0 : model.getDueDay()); | |
| 805 | +// if ((DateUtil.daysBetween(model.getBirth(),new Date())+days) < 280) | |
| 806 | +// { | |
| 807 | +// base.setIsCorrectMonthAge(1); | |
| 808 | +// //纠正胎龄 | |
| 809 | +// c = "孕"+(days/7)+"周"+(days%7 == 0 ? "" : days%7+"天"); | |
| 810 | +// } | |
| 811 | +// else | |
| 812 | +// { | |
| 813 | +// //纠正月龄 | |
| 814 | +// if (StringUtils.isNotEmpty(base.getDueDate())) | |
| 815 | +// { | |
| 816 | +// base.setIsCorrectMonthAge(2); | |
| 817 | +// DateUtil.getMonthDesc(DateUtil.parseYMD(base.getDueDate()),new Date()); | |
| 818 | +// } | |
| 819 | +// } | |
| 820 | +// } | |
| 821 | +// base.setCorrectValue(c); | |
| 800 | 822 | } | 
| 801 | 823 | |
| 802 | - String c = ""; | |
| 803 | - if (model.getDueWeek() != null) | |
| 804 | - { | |
| 805 | - Integer days = model.getDueWeek()*7 + (model.getDueDay() == null ? 0 : model.getDueDay()); | |
| 806 | - if ((DateUtil.daysBetween(model.getBirth(),new Date())+days) < 280) | |
| 807 | - { | |
| 808 | - base.setIsCorrectMonthAge(1); | |
| 809 | - //纠正胎龄 | |
| 810 | - c = "孕"+(days/7)+"周"+(days%7 == 0 ? "" : days%7+"天"); | |
| 811 | - } | |
| 812 | - else | |
| 813 | - { | |
| 814 | - //纠正月龄 | |
| 815 | - if (StringUtils.isNotEmpty(base.getDueDate())) | |
| 816 | - { | |
| 817 | - base.setIsCorrectMonthAge(2); | |
| 818 | - DateUtil.getMonthDesc(DateUtil.parseYMD(base.getDueDate()),new Date()); | |
| 819 | - } | |
| 820 | - } | |
| 821 | - } | |
| 822 | - base.setCorrectValue(c); | |
| 824 | + | |
| 823 | 825 | |
| 824 | 826 | |
| 825 | 827 | base.setBirthday(DateUtil.getyyyy_MM_dd(model.getBirth())); | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
67ec4f8
| ... | ... | @@ -459,7 +459,7 @@ | 
| 459 | 459 | hrisks.add("5aab6d3e422b03d4ad2bf83f"); | 
| 460 | 460 | hrisks.add("de7468e6-1bb5-4fab-ae84-78857868409a"); | 
| 461 | 461 | antExRecordQuery.setrFactorList(hrisks); | 
| 462 | - List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.ASC,"created"); | |
| 462 | + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.ASC, "created"); | |
| 463 | 463 | if (org.apache.commons.collections.CollectionUtils.isNotEmpty(antExRecordModelList)) | 
| 464 | 464 | { | 
| 465 | 465 | for (AntExRecordModel model : antExRecordModelList) | 
| 466 | 466 | |
| 467 | 467 | |
| 468 | 468 | |
| 469 | 469 | |
| ... | ... | @@ -503,24 +503,26 @@ | 
| 503 | 503 | Integer type = Integer.valueOf(String.valueOf(map.get("type"))); // 1 无需药物治疗 2 需药物治疗 | 
| 504 | 504 | Date checkDate = (Date)map.get("checkDate"); //第一次出现糖尿病的检查时间 | 
| 505 | 505 | |
| 506 | - Date currentDate = DateUtil.addDay(DateUtil.formatDate(new Date()),-7); | |
| 506 | + //Date currentDate = DateUtil.addDay(DateUtil.formatDate(new Date()),-7); | |
| 507 | 507 | |
| 508 | 508 | BloodSugarQuery bloodSugarQuery = new BloodSugarQuery(); | 
| 509 | 509 | bloodSugarQuery.setIsExistReportDate(true); | 
| 510 | 510 | bloodSugarQuery.setPid(pid); | 
| 511 | 511 | List<BloodSugar> bloodSugars = bloodSugarService.queryBloodSugarList(bloodSugarQuery, Sort.Direction.DESC, "reportDate"); | 
| 512 | + | |
| 512 | 513 | if (CollectionUtils.isNotEmpty(bloodSugars)) | 
| 513 | 514 | { | 
| 514 | 515 | BloodSugar blood = bloodSugars.get(0); | 
| 515 | 516 | if (blood != null && blood.getReportDate() != null) | 
| 516 | 517 | { | 
| 517 | - queryDate = currentDate.getTime() > blood.getReportDate().getTime() ? currentDate : blood.getReportDate(); | |
| 518 | + queryDate = blood.getReportDate(); | |
| 518 | 519 | } | 
| 519 | 520 | } | 
| 520 | 521 | else | 
| 521 | 522 | { | 
| 522 | - queryDate = checkDate.getTime() < currentDate.getTime() ? currentDate : checkDate; | |
| 523 | + queryDate = checkDate; | |
| 523 | 524 | } | 
| 525 | + | |
| 524 | 526 | //达标次数 | 
| 525 | 527 | int successCount = 0; | 
| 526 | 528 | |
| 527 | 529 | |
| 528 | 530 | |
| 529 | 531 | |
| 530 | 532 | |
| 531 | 533 | |
| 532 | 534 | |
| 533 | 535 | |
| 534 | 536 | |
| 535 | 537 | |
| 536 | 538 | |
| 537 | 539 | |
| 538 | 540 | |
| 539 | 541 | |
| 540 | 542 | |
| ... | ... | @@ -530,65 +532,162 @@ | 
| 530 | 532 | //7 药物治疗,监测次数达标,血糖平稳但不理想 | 
| 531 | 533 | Integer monitorStatus = null; | 
| 532 | 534 | |
| 533 | - if (DateUtil.daysBetween(queryDate,new Date()) == 7) | |
| 535 | + if (DateUtil.daysBetween(queryDate,new Date()) >= 7) | |
| 534 | 536 | { | 
| 535 | - BloodSugarQuery buery = new BloodSugarQuery(); | |
| 536 | - buery.setPid(pid); | |
| 537 | - buery.setCreatedStart(queryDate); | |
| 538 | - buery.setCreatedEnd(DateUtil.formatDate(DateUtil.addDay(DateUtil.formatDate(new Date()),7))); | |
| 539 | - List<BloodSugar> list = bloodSugarService.queryBloodSugarList(buery, Sort.Direction.DESC, "created"); | |
| 540 | 537 | |
| 541 | - int size = list == null ? 0 : list.size(); | |
| 542 | - if (type == 1 && size < 8) | |
| 538 | + while (true) | |
| 543 | 539 | { | 
| 544 | - monitorStatus = 1; | |
| 545 | - } | |
| 546 | - else if (type == 1 && size >= 8) | |
| 547 | - { | |
| 548 | - for (BloodSugar blood : list) | |
| 540 | + | |
| 541 | + Date endDate = DateUtil.addDay(queryDate,7); | |
| 542 | + if (endDate.getTime() > new Date().getTime()) | |
| 549 | 543 | { | 
| 550 | - Integer bsType = blood.getBloodSugarType(); | |
| 551 | - if (StringUtils.isEmpty(blood.getBloodSugar()) || bsType == null) | |
| 544 | + break; | |
| 545 | + } | |
| 546 | + | |
| 547 | + BloodSugarQuery buery = new BloodSugarQuery(); | |
| 548 | + buery.setPid(pid); | |
| 549 | + buery.setCreatedStart(queryDate); | |
| 550 | + buery.setCreatedEnd(endDate); | |
| 551 | + List<BloodSugar> list = bloodSugarService.queryBloodSugarList(buery, Sort.Direction.DESC, "created"); | |
| 552 | + | |
| 553 | + | |
| 554 | + int size = list == null ? 0 : list.size(); | |
| 555 | + if (type == 1 && size < 8) | |
| 556 | + { | |
| 557 | + monitorStatus = 1; | |
| 558 | + } | |
| 559 | + else if (type == 1 && size >= 8) | |
| 560 | + { | |
| 561 | + for (BloodSugar blood : list) | |
| 552 | 562 | { | 
| 553 | - continue; | |
| 554 | - } | |
| 555 | - successCount += getBloodSugarSuccess(bsType, blood); | |
| 563 | + Integer bsType = blood.getBloodSugarType(); | |
| 564 | + if (StringUtils.isEmpty(blood.getBloodSugar()) || bsType == null) | |
| 565 | + { | |
| 566 | + continue; | |
| 567 | + } | |
| 568 | + successCount += getBloodSugarSuccess(bsType, blood); | |
| 556 | 569 | |
| 570 | + } | |
| 571 | + double result = new BigDecimal((float)successCount / size).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
| 572 | + monitorStatus = result < 0.8 ? 2 : 3; | |
| 557 | 573 | } | 
| 558 | - double result = new BigDecimal((float)successCount / size).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
| 559 | - monitorStatus = result < 0.8 ? 2 : 3; | |
| 560 | - } | |
| 561 | - else if (type == 2 && size < 21) | |
| 562 | - { | |
| 563 | - monitorStatus = 4; | |
| 564 | - } | |
| 565 | - else if (type == 2 && size >= 21) | |
| 566 | - { | |
| 567 | - for (BloodSugar blood : list) | |
| 574 | + else if (type == 2 && size < 21) | |
| 568 | 575 | { | 
| 569 | - Integer bsType = blood.getBloodSugarType(); | |
| 570 | - if (StringUtils.isEmpty(blood.getBloodSugar()) || bsType == null) | |
| 576 | + monitorStatus = 4; | |
| 577 | + } | |
| 578 | + else if (type == 2 && size >= 21) | |
| 579 | + { | |
| 580 | + for (BloodSugar blood : list) | |
| 571 | 581 | { | 
| 572 | - continue; | |
| 582 | + Integer bsType = blood.getBloodSugarType(); | |
| 583 | + if (StringUtils.isEmpty(blood.getBloodSugar()) || bsType == null) | |
| 584 | + { | |
| 585 | + continue; | |
| 586 | + } | |
| 587 | + successCount += getBloodSugarSuccess(bsType, blood); | |
| 573 | 588 | } | 
| 574 | - successCount += getBloodSugarSuccess(bsType, blood); | |
| 589 | + double result = new BigDecimal((float)successCount / size).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
| 590 | + monitorStatus = result < 0.6 ? 5 : (result < 0.8 ? 6 : 7); | |
| 575 | 591 | } | 
| 576 | - double result = new BigDecimal((float)successCount / size).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
| 577 | - monitorStatus = result < 0.6 ? 5 : (result < 0.8 ? 6 : 7); | |
| 578 | - } | |
| 579 | 592 | |
| 580 | - Patients patients = mongoTemplate.findById(one.getParentId(), Patients.class); | |
| 581 | - int week = DateUtil.getWeek2(patients.getLastMenses(), DateUtil.formatDate(one.getCreated())); | |
| 582 | - if (week < 6) | |
| 583 | - { | |
| 584 | - return false; | |
| 593 | + Patients patients = mongoTemplate.findById(one.getParentId(), Patients.class); | |
| 594 | + int week = DateUtil.getWeek2(patients.getLastMenses(), DateUtil.formatDate(one.getCreated())); | |
| 595 | + if (week < 6) | |
| 596 | + { | |
| 597 | + return false; | |
| 598 | + } | |
| 599 | + one.setCurrentWeek(week); | |
| 600 | + one.setMonitorStatus(monitorStatus); | |
| 601 | + one.setReportDate(DateUtil.formatDate(DateUtil.addDay(new Date(), -1))); | |
| 602 | + one.setStatus(1); //报告状态 1未查看 2查看 | |
| 603 | + | |
| 604 | + queryDate = endDate; | |
| 605 | + | |
| 606 | + return true; | |
| 585 | 607 | } | 
| 586 | - one.setCurrentWeek(week); | |
| 587 | - one.setMonitorStatus(monitorStatus); | |
| 588 | - one.setReportDate(DateUtil.formatDate(DateUtil.addDay(new Date(), -1))); | |
| 589 | - one.setStatus(1); //报告状态 1未查看 2查看 | |
| 590 | - return true; | |
| 591 | 608 | } | 
| 609 | + | |
| 610 | + | |
| 611 | +// if (CollectionUtils.isNotEmpty(bloodSugars)) | |
| 612 | +// { | |
| 613 | +// BloodSugar blood = bloodSugars.get(0); | |
| 614 | +// if (blood != null && blood.getReportDate() != null) | |
| 615 | +// { | |
| 616 | +// queryDate = currentDate.getTime() > blood.getReportDate().getTime() ? currentDate : blood.getReportDate(); | |
| 617 | +// } | |
| 618 | +// } | |
| 619 | +// else | |
| 620 | +// { | |
| 621 | +// queryDate = checkDate.getTime() < currentDate.getTime() ? currentDate : checkDate; | |
| 622 | +// } | |
| 623 | +// //达标次数 | |
| 624 | +// int successCount = 0; | |
| 625 | +// | |
| 626 | +// //监测状态 1 非药物治疗,监测不足 2 非药物治疗,监测次数达标,血糖控制不理想 | |
| 627 | +// //3 非药物治疗,监测次数达标,血糖控制良好 4 药物治疗,监测不足 | |
| 628 | +// //5 药物治疗,监测次数达标,血糖波动较大 6 药物治疗,监测次数达标,血糖控制良好 | |
| 629 | +// //7 药物治疗,监测次数达标,血糖平稳但不理想 | |
| 630 | +// Integer monitorStatus = null; | |
| 631 | +// | |
| 632 | +// if (DateUtil.daysBetween(queryDate,new Date()) == 7) | |
| 633 | +// { | |
| 634 | +// BloodSugarQuery buery = new BloodSugarQuery(); | |
| 635 | +// buery.setPid(pid); | |
| 636 | +// buery.setCreatedStart(queryDate); | |
| 637 | +// buery.setCreatedEnd(DateUtil.formatDate(DateUtil.addDay(DateUtil.formatDate(new Date()),7))); | |
| 638 | +// List<BloodSugar> list = bloodSugarService.queryBloodSugarList(buery, Sort.Direction.DESC, "created"); | |
| 639 | +// | |
| 640 | +// int size = list == null ? 0 : list.size(); | |
| 641 | +// if (type == 1 && size < 8) | |
| 642 | +// { | |
| 643 | +// monitorStatus = 1; | |
| 644 | +// } | |
| 645 | +// else if (type == 1 && size >= 8) | |
| 646 | +// { | |
| 647 | +// for (BloodSugar blood : list) | |
| 648 | +// { | |
| 649 | +// Integer bsType = blood.getBloodSugarType(); | |
| 650 | +// if (StringUtils.isEmpty(blood.getBloodSugar()) || bsType == null) | |
| 651 | +// { | |
| 652 | +// continue; | |
| 653 | +// } | |
| 654 | +// successCount += getBloodSugarSuccess(bsType, blood); | |
| 655 | +// | |
| 656 | +// } | |
| 657 | +// double result = new BigDecimal((float)successCount / size).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
| 658 | +// monitorStatus = result < 0.8 ? 2 : 3; | |
| 659 | +// } | |
| 660 | +// else if (type == 2 && size < 21) | |
| 661 | +// { | |
| 662 | +// monitorStatus = 4; | |
| 663 | +// } | |
| 664 | +// else if (type == 2 && size >= 21) | |
| 665 | +// { | |
| 666 | +// for (BloodSugar blood : list) | |
| 667 | +// { | |
| 668 | +// Integer bsType = blood.getBloodSugarType(); | |
| 669 | +// if (StringUtils.isEmpty(blood.getBloodSugar()) || bsType == null) | |
| 670 | +// { | |
| 671 | +// continue; | |
| 672 | +// } | |
| 673 | +// successCount += getBloodSugarSuccess(bsType, blood); | |
| 674 | +// } | |
| 675 | +// double result = new BigDecimal((float)successCount / size).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
| 676 | +// monitorStatus = result < 0.6 ? 5 : (result < 0.8 ? 6 : 7); | |
| 677 | +// } | |
| 678 | +// | |
| 679 | +// Patients patients = mongoTemplate.findById(one.getParentId(), Patients.class); | |
| 680 | +// int week = DateUtil.getWeek2(patients.getLastMenses(), DateUtil.formatDate(one.getCreated())); | |
| 681 | +// if (week < 6) | |
| 682 | +// { | |
| 683 | +// return false; | |
| 684 | +// } | |
| 685 | +// one.setCurrentWeek(week); | |
| 686 | +// one.setMonitorStatus(monitorStatus); | |
| 687 | +// one.setReportDate(DateUtil.formatDate(DateUtil.addDay(new Date(), -1))); | |
| 688 | +// one.setStatus(1); //报告状态 1未查看 2查看 | |
| 689 | +// return true; | |
| 690 | +// } | |
| 592 | 691 | } | 
| 593 | 692 | return false; | 
| 594 | 693 | } |