Commit 5b36ab0828e5f916befc4bc775c68ab13545b537
1 parent
eea6365e52
Exists in
master
and in
2 other branches
根据身份证号查询患者孕周和高危因素字符串信息
给医心照护系统使用的接口
Showing 2 changed files with 78 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java
View file @
5b36ab0
... | ... | @@ -681,6 +681,21 @@ |
681 | 681 | return baseListResponse; |
682 | 682 | } |
683 | 683 | |
684 | + /** | |
685 | + * 根据身份证号查询患者孕周和高危因素字符串信息 | |
686 | + * 给医心照护系统使用的接口 | |
687 | + * @param cardNo | |
688 | + * @return | |
689 | + */ | |
690 | + @ResponseBody | |
691 | + @RequestMapping(value = "patientDueWeekAndRisk") | |
692 | + public BaseResponse queryPatientDueWeekAndRisk(@RequestParam("cardNo") String cardNo){ | |
693 | + BaseResponse baseResponse = new BaseResponse(); | |
694 | + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
695 | + baseResponse.setObject(patientFacade.queryPersonDueWeekAndRisk(cardNo)); | |
696 | + return baseResponse; | |
697 | + } | |
698 | + | |
684 | 699 | |
685 | 700 | @TokenRequired |
686 | 701 | @RequestMapping(value = "patientManagerExcel", method = RequestMethod.POST) |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
5b36ab0
... | ... | @@ -2638,6 +2638,69 @@ |
2638 | 2638 | return str; |
2639 | 2639 | } |
2640 | 2640 | |
2641 | + /** | |
2642 | + * 根据身份证号查询孕妇的最新档案信息,并返回孕妇的孕周和高危字符串信息 | |
2643 | + * @param cardNo | |
2644 | + * @return | |
2645 | + */ | |
2646 | + public String queryPersonDueWeekAndRisk(String cardNo){ | |
2647 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
2648 | + patientsQuery.setCardNo(cardNo); | |
2649 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
2650 | + List <Patients> patientsList = patientsService.queryPatient1(patientsQuery,"created"); | |
2651 | + if(CollectionUtils.isEmpty(patientsList)){ | |
2652 | + return null; | |
2653 | + } | |
2654 | + StringBuilder sb = new StringBuilder(56); | |
2655 | + Patients patients = patientsList.get(0); | |
2656 | + List<String> factor = patientsList.get(0).getRiskFactorId(); | |
2657 | + String dueWeek = ""; | |
2658 | + try { | |
2659 | + | |
2660 | + if(patients.getType() == 3){ | |
2661 | + dueWeek = "已分娩,"; | |
2662 | + }else if (patients.getBookbuildingDate().getTime() - patients.getDueDate().getTime() > 0 && patients.getBuildType() == 2) { | |
2663 | +// if (patients.getBookbuildingDate().getTime() - patients.getFmDate().getTime() > 0 && patients.getBuildType() == 2) { | |
2664 | + dueWeek = "已分娩,"; | |
2665 | + } else { | |
2666 | + int days = DateUtil.daysBetween(patients.getLastMenses(), patients.getBookbuildingDate()); | |
2667 | + if (days > 7 * 42 - 1) { | |
2668 | + dueWeek = "已分娩,"; | |
2669 | + } else { | |
2670 | + String week = (days / 7) + ""; | |
2671 | + int day = (days % 7); | |
2672 | + dueWeek = "孕" + week + "周" + (day > 0 ? "+" + day + "天," : ","); | |
2673 | + } | |
2674 | + } | |
2675 | + } catch (Exception e) { | |
2676 | + // 什么都不干 | |
2677 | + } | |
2678 | + sb.append(dueWeek); | |
2679 | + | |
2680 | + if (CollectionUtils.isNotEmpty(factor)) { | |
2681 | + for (String srt : factor) { | |
2682 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(srt)) { | |
2683 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(srt); | |
2684 | + if (null != basicConfig && sb.indexOf(basicConfig.getName()) == -1) { | |
2685 | + sb.append(basicConfig.getName()).append(','); | |
2686 | + } | |
2687 | + } | |
2688 | + } | |
2689 | + | |
2690 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(patients.getoRiskFactor())) { | |
2691 | + sb.append(patients.getoRiskFactor()); | |
2692 | + } | |
2693 | + } | |
2694 | + else if (org.apache.commons.lang.StringUtils.isNotEmpty(patients.getoRiskFactor())) | |
2695 | + { | |
2696 | + sb.append(patients.getoRiskFactor()); | |
2697 | + } | |
2698 | + if(sb.toString().endsWith(",")){ | |
2699 | + return sb.toString().substring(0,sb.toString().length()-1); | |
2700 | + } | |
2701 | + return sb.toString(); | |
2702 | + } | |
2703 | + | |
2641 | 2704 | public PatientManagerResult patientManager(PatientManagerRequest patientManagerRequest) { |
2642 | 2705 | PatientManagerResult patientManagerResult = new PatientManagerResult(); |
2643 | 2706 | String hospitalId = autoMatchFacade.getHospitalId(patientManagerRequest.getOperatorId()); |