Commit f500d4efa60291a7e90df3afe315a5187027ab0d
1 parent
b2d98b97e0
Exists in
master
and in
6 other branches
生日末次月经日期更改
Showing 2 changed files with 37 additions and 2 deletions
platform-dal/src/main/java/com/lyms/platform/pojo/TemporaryUserModel.java
View file @
f500d4e
1 | 1 | package com.lyms.platform.pojo; |
2 | 2 | |
3 | +import com.lyms.platform.common.core.annotation.form.FormParam; | |
3 | 4 | import com.lyms.platform.common.result.BaseModel; |
5 | +import org.hibernate.validator.constraints.NotEmpty; | |
4 | 6 | import org.springframework.data.mongodb.core.mapping.Document; |
5 | 7 | |
6 | 8 | import java.util.Date; |
... | ... | @@ -14,6 +16,10 @@ |
14 | 16 | |
15 | 17 | private Date birth; |
16 | 18 | |
19 | + @FormParam | |
20 | + @NotEmpty(message = "生日不能为空.") | |
21 | + private String birthday; | |
22 | + | |
17 | 23 | private String phone; |
18 | 24 | |
19 | 25 | private Date lastMenses; |
... | ... | @@ -47,6 +53,26 @@ |
47 | 53 | private String yn; |
48 | 54 | |
49 | 55 | private String hospitalId; |
56 | + | |
57 | + @FormParam | |
58 | + @NotEmpty(message = "末次月经不能为空.") | |
59 | + private String lastMenstrualPeriod; | |
60 | + | |
61 | + public String getLastMenstrualPeriod() { | |
62 | + return lastMenstrualPeriod; | |
63 | + } | |
64 | + | |
65 | + public void setLastMenstrualPeriod(String lastMenstrualPeriod) { | |
66 | + this.lastMenstrualPeriod = lastMenstrualPeriod; | |
67 | + } | |
68 | + | |
69 | + public String getBirthday() { | |
70 | + return birthday; | |
71 | + } | |
72 | + | |
73 | + public void setBirthday(String birthday) { | |
74 | + this.birthday = birthday; | |
75 | + } | |
50 | 76 | |
51 | 77 | public String getHospitalId() { |
52 | 78 | return hospitalId; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TemporaryUserServiceImpl.java
View file @
f500d4e
... | ... | @@ -52,6 +52,8 @@ |
52 | 52 | public BaseResponse addAndUpdate(TemporaryUserModel temporaryUser, Integer userId) { |
53 | 53 | if (null != temporaryUser.getId()) { |
54 | 54 | temporaryUser.setModified(new Date()); |
55 | + temporaryUser.setBirth(DateUtil.parseYMD(temporaryUser.getBirthday())); | |
56 | + temporaryUser.setLastMenses(DateUtil.parseYMD(temporaryUser.getLastMenstrualPeriod())); | |
55 | 57 | temporaryUserDao.updateTemporaryBlood(Query.query(Criteria.where("_id").is(temporaryUser.getId())), temporaryUser); |
56 | 58 | return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("修改成功"); |
57 | 59 | } |
... | ... | @@ -62,6 +64,8 @@ |
62 | 64 | if (temporaryUserModels != null) { |
63 | 65 | temporaryUser.setModified(new Date()); |
64 | 66 | temporaryUser.setYn("1"); |
67 | + temporaryUser.setBirth(DateUtil.parseYMD(temporaryUser.getBirthday())); | |
68 | + temporaryUser.setLastMenses(DateUtil.parseYMD(temporaryUser.getLastMenstrualPeriod())); | |
65 | 69 | temporaryUserDao.updateTemporaryBlood(Query.query(Criteria.where("_id").is(temporaryUserModels.getId())), temporaryUser); |
66 | 70 | return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("完成!"); |
67 | 71 | } |
... | ... | @@ -77,6 +81,8 @@ |
77 | 81 | } |
78 | 82 | } |
79 | 83 | temporaryUser.setYn("1"); |
84 | + temporaryUser.setBirth(DateUtil.parseYMD(temporaryUser.getBirthday())); | |
85 | + temporaryUser.setLastMenses(DateUtil.parseYMD(temporaryUser.getLastMenstrualPeriod())); | |
80 | 86 | temporaryUser.setRiskLevelId(JsonUtil.array2JsonString(riskLevelIdList)); |
81 | 87 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
82 | 88 | temporaryUser.setHospitalId(hospitalId); |
... | ... | @@ -100,7 +106,7 @@ |
100 | 106 | Criteria criteria = Criteria.where("yn").ne("0").and("hospitalId").in(hospital); |
101 | 107 | Criteria pCriteria = Criteria.where("yn").ne("0").and("hospitalId").in(hospital); |
102 | 108 | if (org.apache.commons.lang.StringUtils.isNotBlank(key)) { |
103 | - pCriteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("userName").regex(key)); | |
109 | + pCriteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("userName").regex(key), Criteria.where("cardID").regex(key)); | |
104 | 110 | flag = true; |
105 | 111 | } |
106 | 112 | if (stateWeek != null && endWeek != null) { |
107 | 113 | |
... | ... | @@ -110,7 +116,10 @@ |
110 | 116 | flag = true; |
111 | 117 | } |
112 | 118 | if (age != null) { |
119 | + System.out.println(age); | |
113 | 120 | Date start = DateUtil.getBeforeAge(age); |
121 | + System.out.println(start); | |
122 | + | |
114 | 123 | Date end = DateUtil.getBeforeAge(age + 1); |
115 | 124 | pCriteria.and("birth").gt(end).lte(start); |
116 | 125 | flag = true; |
... | ... | @@ -131,7 +140,7 @@ |
131 | 140 | for (TemporaryUserModel temporaryUser : bloodSugars) { |
132 | 141 | Map<String, Object> map = new HashMap<>(); |
133 | 142 | map.put("userName", temporaryUser.getUserName()); |
134 | - map.put("birth", DateUtil.getAge(temporaryUser.getBirth(), new Date())); | |
143 | + map.put("birth", DateUtil.getAge(temporaryUser.getBirth())); | |
135 | 144 | map.put("phone", temporaryUser.getPhone()); |
136 | 145 | map.put("lastMenses", DateUtil.getWeekDesc(temporaryUser.getLastMenses(), new Date())); |
137 | 146 | map.put("beforeWeight", temporaryUser.getBeforeWeight()); |