From e11a4447242eb262c5b1098306c87417e11e1b77 Mon Sep 17 00:00:00 2001 From: "litao@lymsh.com" Date: Tue, 12 Sep 2017 11:22:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=93=E9=87=8D=E7=AE=A1=E7=90=86=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lyms/platform/pojo/PatientWeight.java | 50 ++++++++++++++++++++-- .../web/service/impl/PatientWeightServiceImpl.java | 30 +++++++------ 2 files changed, 65 insertions(+), 15 deletions(-) diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java b/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java index 085191b..5098aa7 100644 --- a/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java @@ -25,6 +25,18 @@ public class PatientWeight { // 证件号 private String cardNo; + // 就诊卡号 + private String vcCardNo; + + // 姓名 + private String username; + + // 电话 + private String phone; + + // 生日 + private Date birth; + // 证件类型 private String pcerteTypeId; @@ -32,7 +44,7 @@ public class PatientWeight { private String beforeWeight; // 孕前身高 - private Integer beforeHeight; + private String beforeHeight; // 当前体重 private String nowWeight; @@ -47,6 +59,38 @@ public class PatientWeight { private Date lastMenses; + public String getVcCardNo() { + return vcCardNo; + } + + public void setVcCardNo(String vcCardNo) { + this.vcCardNo = vcCardNo; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Date getBirth() { + return birth; + } + + public void setBirth(Date birth) { + this.birth = birth; + } + public String getBmi() { return bmi; } @@ -111,11 +155,11 @@ public class PatientWeight { this.beforeWeight = beforeWeight; } - public Integer getBeforeHeight() { + public String getBeforeHeight() { return beforeHeight; } - public void setBeforeHeight(Integer beforeHeight) { + public void setBeforeHeight(String beforeHeight) { this.beforeHeight = beforeHeight; } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java index e9d71eb..d4300cc 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java @@ -55,6 +55,11 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient if(StringUtils.isNotBlank(patientWeight.getPatientId())) { Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); patientWeight.setLastMenses(patients.getLastMenses()); + patientWeight.setVcCardNo(patients.getVcCardNo()); + patientWeight.setCardNo(patients.getCardNo()); + patientWeight.setBirth(patients.getBirth()); + patientWeight.setUsername(patients.getUsername()); + patientWeight.setPhone(patients.getPhone()); } if(StringUtils.isNotBlank(patientWeight.getNowWeight()) && patientWeight.getBeforeHeight() != null) { patientWeight.setBmi(getBmi(patientWeight.getNowWeight(), patientWeight.getBeforeHeight())); @@ -74,9 +79,12 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient public BaseResponse list(String key, String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer userId) { String hospitalId = autoMatchFacade.getHospitalId(userId); Criteria criteria = Criteria.where("yn").ne("0").and("hospitalId").is(hospitalId); - /* if(StringUtils.isNotBlank(serchType) && StringUtils.isNotBlank(serchValue)) { - criteria.and("cardNo").is(serchValue).and("pcerteTypeId").is(serchType); - }*/ + if(StringUtils.isNotBlank(key)) { + criteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("username").regex(key), Criteria.where("cardNo").is(key)); + } + if(StringUtils.isNotBlank(vcCardNo)) { + criteria.and("vcCardNo").is(vcCardNo); + } if(currentWeekStart != null && currentWeekEnd != null) { Date start = DateUtil.getWeekStart(currentWeekEnd); Date end = DateUtil.getWeekEnd(currentWeekStart); @@ -85,13 +93,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient if(age != null) { Date start = DateUtil.getBeforeAge(1); Date end = DateUtil.getBeforeAge(2); - Criteria c = Criteria.where("yn").ne("0").and("hospitalId").is(hospitalId).and("birth").lte(start).gt(end); - List patients = mongoUtil.findField(Patients.class, c, "id"); - List pids = new ArrayList<>(); - for (Patients patient : patients) { - pids.add(patient.getId()); - } - criteria.and("id").in(pids); + criteria.and("birth").lte(start).gt(end); } PageResult pageResult = findMongoPage(PatientWeight.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "checkTime")), page, limit); List patientWeights = (List) pageResult.getGrid(); @@ -109,6 +111,10 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient temp.put("beforeHeight", patientWeight.getBeforeHeight()); temp.put("bim", patientWeight.getBmi()); // 体质指数(BMI)=体重(kg)÷身高^2(m) temp.put("nowWeight", patientWeight.getNowWeight()); + + temp.put("vcCardNo", patients.getVcCardNo()); + temp.put("pcerteTypeId", patients.getPcerteTypeId()); + temp.put("cardNo", patients.getCardNo()); restMap.add(temp); } } @@ -118,10 +124,10 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } // 体质指数(BMI)=体重(kg)÷身高^2(m) - public static String getBmi(String weight, Integer height) { + public static String getBmi(String weight, String height) { if(StringUtils.isNotBlank(weight) && height != null) { Double w = Double.parseDouble(weight); - Double h = ((double) height) / 100l; + Double h = Double.parseDouble(height) / 100l; Double bmi = w / (h * h); BigDecimal bg = new BigDecimal(bmi); bmi = bg.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); -- 1.8.3.1