Commit e11a4447242eb262c5b1098306c87417e11e1b77
1 parent
50d97ee193
Exists in
master
and in
6 other branches
体重管理相关代码
Showing 2 changed files with 65 additions and 15 deletions
platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java
View file @
e11a444
| ... | ... | @@ -25,6 +25,18 @@ |
| 25 | 25 | // 证件号 |
| 26 | 26 | private String cardNo; |
| 27 | 27 | |
| 28 | + // 就诊卡号 | |
| 29 | + private String vcCardNo; | |
| 30 | + | |
| 31 | + // 姓名 | |
| 32 | + private String username; | |
| 33 | + | |
| 34 | + // 电话 | |
| 35 | + private String phone; | |
| 36 | + | |
| 37 | + // 生日 | |
| 38 | + private Date birth; | |
| 39 | + | |
| 28 | 40 | // 证件类型 |
| 29 | 41 | private String pcerteTypeId; |
| 30 | 42 | |
| ... | ... | @@ -32,7 +44,7 @@ |
| 32 | 44 | private String beforeWeight; |
| 33 | 45 | |
| 34 | 46 | // 孕前身高 |
| 35 | - private Integer beforeHeight; | |
| 47 | + private String beforeHeight; | |
| 36 | 48 | |
| 37 | 49 | // 当前体重 |
| 38 | 50 | private String nowWeight; |
| ... | ... | @@ -47,6 +59,38 @@ |
| 47 | 59 | |
| 48 | 60 | private Date lastMenses; |
| 49 | 61 | |
| 62 | + public String getVcCardNo() { | |
| 63 | + return vcCardNo; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setVcCardNo(String vcCardNo) { | |
| 67 | + this.vcCardNo = vcCardNo; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public String getUsername() { | |
| 71 | + return username; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setUsername(String username) { | |
| 75 | + this.username = username; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public String getPhone() { | |
| 79 | + return phone; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setPhone(String phone) { | |
| 83 | + this.phone = phone; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public Date getBirth() { | |
| 87 | + return birth; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setBirth(Date birth) { | |
| 91 | + this.birth = birth; | |
| 92 | + } | |
| 93 | + | |
| 50 | 94 | public String getBmi() { |
| 51 | 95 | return bmi; |
| 52 | 96 | } |
| 53 | 97 | |
| ... | ... | @@ -111,11 +155,11 @@ |
| 111 | 155 | this.beforeWeight = beforeWeight; |
| 112 | 156 | } |
| 113 | 157 | |
| 114 | - public Integer getBeforeHeight() { | |
| 158 | + public String getBeforeHeight() { | |
| 115 | 159 | return beforeHeight; |
| 116 | 160 | } |
| 117 | 161 | |
| 118 | - public void setBeforeHeight(Integer beforeHeight) { | |
| 162 | + public void setBeforeHeight(String beforeHeight) { | |
| 119 | 163 | this.beforeHeight = beforeHeight; |
| 120 | 164 | } |
| 121 | 165 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
e11a444
| ... | ... | @@ -55,6 +55,11 @@ |
| 55 | 55 | if(StringUtils.isNotBlank(patientWeight.getPatientId())) { |
| 56 | 56 | Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); |
| 57 | 57 | patientWeight.setLastMenses(patients.getLastMenses()); |
| 58 | + patientWeight.setVcCardNo(patients.getVcCardNo()); | |
| 59 | + patientWeight.setCardNo(patients.getCardNo()); | |
| 60 | + patientWeight.setBirth(patients.getBirth()); | |
| 61 | + patientWeight.setUsername(patients.getUsername()); | |
| 62 | + patientWeight.setPhone(patients.getPhone()); | |
| 58 | 63 | } |
| 59 | 64 | if(StringUtils.isNotBlank(patientWeight.getNowWeight()) && patientWeight.getBeforeHeight() != null) { |
| 60 | 65 | patientWeight.setBmi(getBmi(patientWeight.getNowWeight(), patientWeight.getBeforeHeight())); |
| ... | ... | @@ -74,9 +79,12 @@ |
| 74 | 79 | public BaseResponse list(String key, String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer userId) { |
| 75 | 80 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
| 76 | 81 | Criteria criteria = Criteria.where("yn").ne("0").and("hospitalId").is(hospitalId); |
| 77 | - /* if(StringUtils.isNotBlank(serchType) && StringUtils.isNotBlank(serchValue)) { | |
| 78 | - criteria.and("cardNo").is(serchValue).and("pcerteTypeId").is(serchType); | |
| 79 | - }*/ | |
| 82 | + if(StringUtils.isNotBlank(key)) { | |
| 83 | + criteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("username").regex(key), Criteria.where("cardNo").is(key)); | |
| 84 | + } | |
| 85 | + if(StringUtils.isNotBlank(vcCardNo)) { | |
| 86 | + criteria.and("vcCardNo").is(vcCardNo); | |
| 87 | + } | |
| 80 | 88 | if(currentWeekStart != null && currentWeekEnd != null) { |
| 81 | 89 | Date start = DateUtil.getWeekStart(currentWeekEnd); |
| 82 | 90 | Date end = DateUtil.getWeekEnd(currentWeekStart); |
| ... | ... | @@ -85,13 +93,7 @@ |
| 85 | 93 | if(age != null) { |
| 86 | 94 | Date start = DateUtil.getBeforeAge(1); |
| 87 | 95 | Date end = DateUtil.getBeforeAge(2); |
| 88 | - Criteria c = Criteria.where("yn").ne("0").and("hospitalId").is(hospitalId).and("birth").lte(start).gt(end); | |
| 89 | - List<Patients> patients = mongoUtil.findField(Patients.class, c, "id"); | |
| 90 | - List<String> pids = new ArrayList<>(); | |
| 91 | - for (Patients patient : patients) { | |
| 92 | - pids.add(patient.getId()); | |
| 93 | - } | |
| 94 | - criteria.and("id").in(pids); | |
| 96 | + criteria.and("birth").lte(start).gt(end); | |
| 95 | 97 | } |
| 96 | 98 | PageResult pageResult = findMongoPage(PatientWeight.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "checkTime")), page, limit); |
| 97 | 99 | List<PatientWeight> patientWeights = (List<PatientWeight>) pageResult.getGrid(); |
| ... | ... | @@ -109,6 +111,10 @@ |
| 109 | 111 | temp.put("beforeHeight", patientWeight.getBeforeHeight()); |
| 110 | 112 | temp.put("bim", patientWeight.getBmi()); // 体质指数(BMI)=体重(kg)÷身高^2(m) |
| 111 | 113 | temp.put("nowWeight", patientWeight.getNowWeight()); |
| 114 | + | |
| 115 | + temp.put("vcCardNo", patients.getVcCardNo()); | |
| 116 | + temp.put("pcerteTypeId", patients.getPcerteTypeId()); | |
| 117 | + temp.put("cardNo", patients.getCardNo()); | |
| 112 | 118 | restMap.add(temp); |
| 113 | 119 | } |
| 114 | 120 | } |
| 115 | 121 | |
| ... | ... | @@ -118,10 +124,10 @@ |
| 118 | 124 | } |
| 119 | 125 | |
| 120 | 126 | // 体质指数(BMI)=体重(kg)÷身高^2(m) |
| 121 | - public static String getBmi(String weight, Integer height) { | |
| 127 | + public static String getBmi(String weight, String height) { | |
| 122 | 128 | if(StringUtils.isNotBlank(weight) && height != null) { |
| 123 | 129 | Double w = Double.parseDouble(weight); |
| 124 | - Double h = ((double) height) / 100l; | |
| 130 | + Double h = Double.parseDouble(height) / 100l; | |
| 125 | 131 | Double bmi = w / (h * h); |
| 126 | 132 | BigDecimal bg = new BigDecimal(bmi); |
| 127 | 133 | bmi = bg.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); |