Commit e216bba0d0f5d1fe8c2a9d34a458d562447ee2cd

Authored by yangfei

Merge remote-tracking branch 'origin/master'

Showing 4 changed files

platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java View file @ e216bba
1 1 package com.lyms.platform.pojo;
2 2  
  3 +import org.springframework.data.mongodb.core.mapping.Document;
  4 +
3 5 import java.util.Date;
4 6  
5 7 /**
6 8 * 孕产妇体重管理
7 9 */
  10 +@Document(collection="lyms_patient_weight")
8 11 public class PatientWeight {
9 12  
10 13 private String id;
... ... @@ -22,6 +25,18 @@
22 25 // 证件号
23 26 private String cardNo;
24 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 +
25 40 // 证件类型
26 41 private String pcerteTypeId;
27 42  
... ... @@ -29,7 +44,7 @@
29 44 private String beforeWeight;
30 45  
31 46 // 孕前身高
32   - private Integer beforeHeight;
  47 + private String beforeHeight;
33 48  
34 49 // 当前体重
35 50 private String nowWeight;
... ... @@ -44,6 +59,38 @@
44 59  
45 60 private Date lastMenses;
46 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 +
47 94 public String getBmi() {
48 95 return bmi;
49 96 }
50 97  
... ... @@ -108,11 +155,11 @@
108 155 this.beforeWeight = beforeWeight;
109 156 }
110 157  
111   - public Integer getBeforeHeight() {
  158 + public String getBeforeHeight() {
112 159 return beforeHeight;
113 160 }
114 161  
115   - public void setBeforeHeight(Integer beforeHeight) {
  162 + public void setBeforeHeight(String beforeHeight) {
116 163 this.beforeHeight = beforeHeight;
117 164 }
118 165  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java View file @ e216bba
... ... @@ -37,11 +37,23 @@
37 37 return patientWeightService.addOrUpdate(getUserId(request), patientWeight);
38 38 }
39 39  
  40 + /**
  41 + *
  42 + * @param key 姓名/证件号/联系方式
  43 + * @param vcCardNo 就诊卡号
  44 + * @param currentWeekStart 当前孕周开始
  45 + * @param currentWeekEnd 当前孕周结束
  46 + * @param age 年龄
  47 + * @param page
  48 + * @param limit
  49 + * @param request
  50 + * @return
  51 + */
40 52 @ResponseBody
41 53 @TokenRequired
42 54 @RequestMapping(value = "/query", method = RequestMethod.GET)
43   - public BaseResponse list(String serchType, String serchValue, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, HttpServletRequest request) {
44   - return patientWeightService.list(serchType, serchValue, currentWeekStart, currentWeekEnd, age, page, limit, getUserId(request));
  55 + public BaseResponse list(String key, String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, HttpServletRequest request) {
  56 + return patientWeightService.list(key, vcCardNo, currentWeekStart, currentWeekEnd, age, page, limit, getUserId(request));
45 57 }
46 58  
47 59 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java View file @ e216bba
... ... @@ -11,7 +11,7 @@
11 11  
12 12 BaseResponse addOrUpdate(Integer userId, PatientWeight patientWeight);
13 13  
14   - BaseResponse list(String serchType, String serchValue, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer userId);
  14 + BaseResponse list(String key, String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer userId);
15 15  
16 16 BaseResponse info(String id);
17 17  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ e216bba
... ... @@ -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()));
61 66  
62 67  
... ... @@ -71,12 +76,15 @@
71 76 }
72 77  
73 78 @Override
74   - public BaseResponse list(String serchType, String serchValue, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer userId) {
  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);
  82 + if(StringUtils.isNotBlank(key)) {
  83 + criteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("username").regex(key), Criteria.where("cardNo").is(key));
79 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);
83 91  
... ... @@ -85,15 +93,9 @@
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   - PageResult pageResult = findMongoPage(NewbornVisit.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "checkTime")), page, limit);
  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();
98 100 List<Map<String, Object>> restMap = new ArrayList<>();
99 101 if(CollectionUtils.isNotEmpty(patientWeights)) {
100 102  
101 103  
102 104  
... ... @@ -109,19 +111,23 @@
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 }
116 122 pageResult.setGrid(restMap);
117   - return null;
  123 + return RespBuilder.buildSuccess(pageResult);
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();