Commit 53ace698cd96d2a94a9dc7290bedf85a37d0e3a9
1 parent
a6d16a943f
Exists in
master
and in
6 other branches
血糖报告
Showing 3 changed files with 119 additions and 88 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java
View file @
53ace69
| ... | ... | @@ -423,7 +423,10 @@ |
| 423 | 423 | |
| 424 | 424 | @RequestMapping(method = RequestMethod.GET, value = "/getPatientRiskInfo") |
| 425 | 425 | @ResponseBody |
| 426 | - public Map getPatientRiskInfo(@RequestParam(required = false)String cardNo,@RequestParam(required = false)String vcCardNo){ | |
| 426 | + public String getPatientRiskInfo(@RequestParam(required = false)String cardNo,@RequestParam(required = false)String vcCardNo, | |
| 427 | + HttpServletResponse response){ | |
| 428 | + response.setHeader("Content-type", "text/xml;charset=utf-8"); | |
| 429 | + response.setCharacterEncoding("UTF-8"); | |
| 427 | 430 | return antenatalExaminationFacade.getPatientRiskInfo(cardNo, vcCardNo); |
| 428 | 431 | } |
| 429 | 432 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
53ace69
| ... | ... | @@ -33,6 +33,9 @@ |
| 33 | 33 | import org.apache.commons.collections.map.HashedMap; |
| 34 | 34 | import org.apache.commons.lang.StringUtils; |
| 35 | 35 | import org.apache.commons.lang.math.NumberUtils; |
| 36 | +import org.dom4j.Document; | |
| 37 | +import org.dom4j.DocumentHelper; | |
| 38 | +import org.dom4j.Element; | |
| 36 | 39 | import org.slf4j.Logger; |
| 37 | 40 | import org.slf4j.LoggerFactory; |
| 38 | 41 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -45,6 +48,7 @@ |
| 45 | 48 | import org.springframework.stereotype.Component; |
| 46 | 49 | import org.springframework.util.StopWatch; |
| 47 | 50 | |
| 51 | +import java.io.UnsupportedEncodingException; | |
| 48 | 52 | import java.util.*; |
| 49 | 53 | import java.util.regex.Pattern; |
| 50 | 54 | |
| 51 | 55 | |
| 52 | 56 | |
| 53 | 57 | |
| 54 | 58 | |
| 55 | 59 | |
| 56 | 60 | |
| 57 | 61 | |
| 58 | 62 | |
| 59 | 63 | |
| 60 | 64 | |
| ... | ... | @@ -4534,92 +4538,114 @@ |
| 4534 | 4538 | } |
| 4535 | 4539 | |
| 4536 | 4540 | |
| 4537 | - public Map<String,Object> getPatientRiskInfo(String cardNo, String vcCardNo) { | |
| 4541 | + public String getPatientRiskInfo(String cardNo, String vcCardNo) { | |
| 4542 | + Document document = DocumentHelper.createDocument();// 建立document对象,用来操作xml文件 | |
| 4543 | + document.setXMLEncoding("utf-8"); | |
| 4544 | + try { | |
| 4538 | 4545 | |
| 4539 | - Map<String,Object> map = new HashMap<>(); | |
| 4540 | - if (StringUtils.isEmpty(cardNo) && StringUtils.isEmpty(vcCardNo) ) | |
| 4541 | - { | |
| 4542 | - return map; | |
| 4543 | - } | |
| 4546 | + Element riskElement = document.addElement("risk");// 建立根节点 | |
| 4544 | 4547 | |
| 4545 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
| 4546 | - if (StringUtils.isNotEmpty(cardNo)) | |
| 4547 | - { | |
| 4548 | - patientsQuery.setCardNo(cardNo); | |
| 4549 | - } | |
| 4550 | - else if (StringUtils.isNotEmpty(vcCardNo)) | |
| 4551 | - { | |
| 4552 | - patientsQuery.setVcCardNo(vcCardNo); | |
| 4553 | - } | |
| 4554 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
| 4548 | + if (StringUtils.isEmpty(cardNo) && StringUtils.isEmpty(vcCardNo) ) | |
| 4549 | + { | |
| 4550 | + String xml = document.asXML().toString(); | |
| 4551 | + return xml; | |
| 4552 | + } | |
| 4555 | 4553 | |
| 4556 | - List<Patients> list = patientsService.queryPatient(patientsQuery); | |
| 4557 | - if (CollectionUtils.isNotEmpty(list)) { | |
| 4558 | - Patients patients = list.get(0); | |
| 4554 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 4555 | + if (StringUtils.isNotEmpty(cardNo)) | |
| 4556 | + { | |
| 4557 | + patientsQuery.setCardNo(cardNo); | |
| 4558 | + } | |
| 4559 | + else if (StringUtils.isNotEmpty(vcCardNo)) | |
| 4560 | + { | |
| 4561 | + patientsQuery.setVcCardNo(vcCardNo); | |
| 4562 | + } | |
| 4563 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 4559 | 4564 | |
| 4560 | - HighScoreResult highScoreResult = findLastRisk(patients.getPid(), false); | |
| 4561 | - AntExQuery antExQuery = new AntExQuery(); | |
| 4562 | - antExQuery.setYn(YnEnums.YES.getId()); | |
| 4563 | - antExQuery.setPid(patients.getPid()); | |
| 4564 | - antExQuery.setStart(DateUtil.addMonth(new Date(), -12)); | |
| 4565 | - // 姓名: VARCHAR2 | |
| 4566 | - // 证件号: VARCHAR2 | |
| 4567 | - // 就诊卡号:VARCHAR2 | |
| 4568 | - // 高危因素:VARCHAR2 | |
| 4569 | - // 产检医生:VARCHAR2 | |
| 4570 | - // 产检孕周:VARCHAR2 | |
| 4571 | - map.put("name", patients.getUsername()); | |
| 4572 | - map.put("cardNo", patients.getCardNo()); | |
| 4573 | - map.put("vcCardNo", patients.getVcCardNo()); | |
| 4565 | + List<Patients> list = patientsService.queryPatient(patientsQuery); | |
| 4566 | + if (CollectionUtils.isNotEmpty(list)) { | |
| 4567 | + Patients patients = list.get(0); | |
| 4574 | 4568 | |
| 4575 | - List riskList = highScoreResult.getHighRisk(); | |
| 4576 | - List resultList = new ArrayList(); | |
| 4577 | - if (CollectionUtils.isNotEmpty(riskList)) | |
| 4578 | - { | |
| 4579 | - for (int i = 0 ;i < riskList.size() ; i++) | |
| 4569 | + HighScoreResult highScoreResult = findLastRisk(patients.getPid(), false); | |
| 4570 | + AntExQuery antExQuery = new AntExQuery(); | |
| 4571 | + antExQuery.setYn(YnEnums.YES.getId()); | |
| 4572 | + antExQuery.setPid(patients.getPid()); | |
| 4573 | + antExQuery.setStart(DateUtil.addMonth(new Date(), -12)); | |
| 4574 | + // 姓名: VARCHAR2 | |
| 4575 | + // 证件号: VARCHAR2 | |
| 4576 | + // 就诊卡号:VARCHAR2 | |
| 4577 | + // 高危因素:VARCHAR2 | |
| 4578 | + // 产检医生:VARCHAR2 | |
| 4579 | + // 产检孕周:VARCHAR2 | |
| 4580 | + | |
| 4581 | + Element nameElement = riskElement.addElement("name"); | |
| 4582 | + nameElement.addText(patients.getUsername()); | |
| 4583 | + | |
| 4584 | + Element cardNoElement = riskElement.addElement("cardNo"); | |
| 4585 | + cardNoElement.addText(patients.getCardNo()); | |
| 4586 | + | |
| 4587 | + Element vcCardNoElement = riskElement.addElement("cardNo"); | |
| 4588 | + vcCardNoElement.addText(patients.getVcCardNo()); | |
| 4589 | + | |
| 4590 | + String checkDoctor = ""; | |
| 4591 | + if (StringUtils.isNotEmpty(patients.getLastCheckEmployeeId()) && FunvCommonUtil.isNumeric(patients.getLastCheckEmployeeId())) { | |
| 4592 | + Users users = usersService.getUsers(Integer.parseInt(patients.getLastCheckEmployeeId())); | |
| 4593 | + if (users != null && users.getYn() == YnEnums.YES.getId()) { | |
| 4594 | + checkDoctor = users.getName(); | |
| 4595 | + } | |
| 4596 | + } | |
| 4597 | + | |
| 4598 | + Element checkDoctorElement = riskElement.addElement("checkDoctor"); | |
| 4599 | + checkDoctorElement.addText(checkDoctor); | |
| 4600 | + | |
| 4601 | + | |
| 4602 | + Element checkWeekElement = riskElement.addElement("checkWeek"); | |
| 4603 | + checkWeekElement.addText(patients.getLastCTime() == null ? "" : DateUtil.getWeekDesc(patients.getLastMenses(), patients.getLastCTime())); | |
| 4604 | + | |
| 4605 | + | |
| 4606 | + List riskList = highScoreResult.getHighRisk(); | |
| 4607 | + if (CollectionUtils.isNotEmpty(riskList)) | |
| 4580 | 4608 | { |
| 4581 | - Map<String, String> rmap = (Map<String, String>) riskList.get(i); | |
| 4582 | - Map<String, String> resultMap = new HashMap<>(); | |
| 4583 | - String color = rmap.get("color"); | |
| 4584 | - if ("risk_green".equals(color)) | |
| 4609 | + for (int i = 0 ;i < riskList.size() ; i++) | |
| 4585 | 4610 | { |
| 4586 | - color = "绿色"; | |
| 4611 | + Map<String, String> rmap = (Map<String, String>) riskList.get(i); | |
| 4612 | + String color = rmap.get("color"); | |
| 4613 | + if ("risk_green".equals(color)) | |
| 4614 | + { | |
| 4615 | + color = "绿色"; | |
| 4616 | + } | |
| 4617 | + else if ("risk_orange".equals(color)) | |
| 4618 | + { | |
| 4619 | + color = "橙色"; | |
| 4620 | + } | |
| 4621 | + else if ("risk_yellow".equals(color)) | |
| 4622 | + { | |
| 4623 | + color = "黄色"; | |
| 4624 | + } | |
| 4625 | + else if ("risk_red".equals(color)) | |
| 4626 | + { | |
| 4627 | + color = "红色"; | |
| 4628 | + } | |
| 4629 | + else if ("risk_purple".equals(color)) | |
| 4630 | + { | |
| 4631 | + color = "紫色"; | |
| 4632 | + } | |
| 4633 | + Element riskFactorElement = riskElement.addElement("riskFactor"); | |
| 4634 | + | |
| 4635 | + String name = rmap.get("name"); | |
| 4636 | + Element nElement = riskFactorElement.addElement("name"); | |
| 4637 | + nElement.addText(name); | |
| 4638 | + | |
| 4639 | + Element colorElement = riskFactorElement.addElement("color"); | |
| 4640 | + colorElement.addText(color); | |
| 4587 | 4641 | } |
| 4588 | - else if ("risk_orange".equals(color)) | |
| 4589 | - { | |
| 4590 | - color = "橙色"; | |
| 4591 | - } | |
| 4592 | - else if ("risk_yellow".equals(color)) | |
| 4593 | - { | |
| 4594 | - color = "黄色"; | |
| 4595 | - } | |
| 4596 | - else if ("risk_red".equals(color)) | |
| 4597 | - { | |
| 4598 | - color = "红色"; | |
| 4599 | - } | |
| 4600 | - else if ("risk_purple".equals(color)) | |
| 4601 | - { | |
| 4602 | - color = "紫色"; | |
| 4603 | - } | |
| 4604 | - String name = rmap.get("name"); | |
| 4605 | - resultMap.put("color",color); | |
| 4606 | - resultMap.put("name",name); | |
| 4607 | - resultList.add(resultMap); | |
| 4608 | 4642 | } |
| 4609 | 4643 | } |
| 4610 | - | |
| 4611 | - map.put("riskFactor", resultList); | |
| 4612 | - String checkDoctor = ""; | |
| 4613 | - if (StringUtils.isNotEmpty(patients.getLastCheckEmployeeId()) && FunvCommonUtil.isNumeric(patients.getLastCheckEmployeeId())) { | |
| 4614 | - Users users = usersService.getUsers(Integer.parseInt(patients.getLastCheckEmployeeId())); | |
| 4615 | - if (users != null && users.getYn() == YnEnums.YES.getId()) { | |
| 4616 | - checkDoctor = users.getName(); | |
| 4617 | - } | |
| 4618 | - } | |
| 4619 | - map.put("checkDoctor", checkDoctor); | |
| 4620 | - map.put("checkWeek",patients.getLastCTime() == null ? "" : DateUtil.getWeekDesc(patients.getLastMenses(),patients.getLastCTime())); | |
| 4644 | + return document.asXML(); | |
| 4645 | + } catch (Exception e) { | |
| 4646 | + return document.asXML(); | |
| 4621 | 4647 | } |
| 4622 | - return map; | |
| 4648 | + | |
| 4623 | 4649 | } |
| 4624 | 4650 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
53ace69
| ... | ... | @@ -554,9 +554,11 @@ |
| 554 | 554 | { |
| 555 | 555 | continue; |
| 556 | 556 | } |
| 557 | - successCount = getBloodSugarSuccess( type, bsType, blood); | |
| 558 | - monitorStatus = successCount / size < 0.8 ? 2 : 3; | |
| 557 | + successCount += getBloodSugarSuccess(bsType, blood); | |
| 558 | + | |
| 559 | 559 | } |
| 560 | + double result = new BigDecimal((float)successCount / size).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
| 561 | + monitorStatus = result < 0.8 ? 2 : 3; | |
| 560 | 562 | } |
| 561 | 563 | else if (type == 2 && size < 21) |
| 562 | 564 | { |
| 563 | 565 | |
| ... | ... | @@ -571,10 +573,10 @@ |
| 571 | 573 | { |
| 572 | 574 | continue; |
| 573 | 575 | } |
| 574 | - successCount = getBloodSugarSuccess( type, bsType, blood); | |
| 575 | - double pacent = successCount / size; | |
| 576 | - monitorStatus = pacent < 0.6 ? 5 : (pacent < 0.8 ? 6 : 7); | |
| 576 | + successCount += getBloodSugarSuccess(bsType, blood); | |
| 577 | 577 | } |
| 578 | + double result = new BigDecimal((float)successCount / size).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
| 579 | + monitorStatus = result < 0.6 ? 5 : (result < 0.8 ? 6 : 7); | |
| 578 | 580 | } |
| 579 | 581 | |
| 580 | 582 | Patients patients = mongoTemplate.findById(one.getParentId(), Patients.class); |
| 581 | 583 | |
| 582 | 584 | |
| 583 | 585 | |
| 584 | 586 | |
| 585 | 587 | |
| ... | ... | @@ -594,29 +596,29 @@ |
| 594 | 596 | } |
| 595 | 597 | |
| 596 | 598 | |
| 597 | - private int getBloodSugarSuccess(int type,int bsType,BloodSugar blood) | |
| 599 | + private int getBloodSugarSuccess(int bsType,BloodSugar blood) | |
| 598 | 600 | { |
| 599 | 601 | int successCount = 0; |
| 600 | 602 | |
| 601 | 603 | Double bloodSugarValue = Double.valueOf(blood.getBloodSugar()); |
| 602 | 604 | //空腹 |
| 603 | - if (bsType == 1 && 3.3 >= bloodSugarValue && bloodSugarValue <= 5.3) | |
| 605 | + if (bsType == 1 && 3.3 <= bloodSugarValue && bloodSugarValue <= 5.3) | |
| 604 | 606 | { |
| 605 | 607 | successCount+=1; |
| 606 | 608 | } |
| 607 | - else if ((type == 2 || type == 4 || type == 6) && 3.3 >= bloodSugarValue && bloodSugarValue <= 5.3) | |
| 609 | + else if ((bsType == 2 || bsType == 4 || bsType == 6) && 3.3 <= bloodSugarValue && bloodSugarValue <= 5.3) | |
| 608 | 610 | { |
| 609 | 611 | successCount+=1; |
| 610 | 612 | } |
| 611 | - else if ((type == 3 || type == 5 || type == 7) && 4.4 >= bloodSugarValue && bloodSugarValue <= 6.7) | |
| 613 | + else if ((bsType == 3 || bsType == 5 || bsType == 7) && 4.4 <= bloodSugarValue && bloodSugarValue <= 6.7) | |
| 612 | 614 | { |
| 613 | 615 | successCount+=1; |
| 614 | 616 | } |
| 615 | - else if (type == 8 && 4.4 >= bloodSugarValue && bloodSugarValue <= 6.7) | |
| 617 | + else if (bsType == 8 && 4.4 <= bloodSugarValue && bloodSugarValue <= 6.7) | |
| 616 | 618 | { |
| 617 | 619 | successCount+=1; |
| 618 | 620 | } |
| 619 | - else if (type == 9 && 4.4 >= bloodSugarValue && bloodSugarValue <= 6.7) | |
| 621 | + else if (bsType == 9 && 4.4 <= bloodSugarValue && bloodSugarValue <= 6.7) | |
| 620 | 622 | { |
| 621 | 623 | successCount+=1; |
| 622 | 624 | } |