Commit 35184a96cbc8592c50ca2cea9061c194bb1f7eb6
1 parent
928995d28d
Exists in
master
and in
1 other branch
增加社区id
Showing 4 changed files with 148 additions and 13 deletions
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyResult.java
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
35184a9
... | ... | @@ -62,14 +62,50 @@ |
62 | 62 | * 身份证号码 |
63 | 63 | */ |
64 | 64 | private String cardNo; |
65 | - | |
66 | - | |
65 | + | |
67 | 66 | /** |
67 | + * 生日 | |
68 | + */ | |
69 | + private Date birthStart; | |
70 | + | |
71 | + /** | |
72 | + * 生日 | |
73 | + */ | |
74 | + private Date birthEnd; | |
75 | + | |
76 | + public Date getBirthEnd() { | |
77 | + return birthEnd; | |
78 | + } | |
79 | + | |
80 | + public void setBirthEnd(Date birthEnd) { | |
81 | + this.birthEnd = birthEnd; | |
82 | + } | |
83 | + | |
84 | + public Date getBirthStart() { | |
85 | + return birthStart; | |
86 | + } | |
87 | + | |
88 | + public void setBirthStart(Date birthStart) { | |
89 | + this.birthStart = birthStart; | |
90 | + } | |
91 | + | |
92 | + /** | |
68 | 93 | * 是否有效 |
69 | 94 | */ |
70 | 95 | private int yn=-1; |
71 | - | |
72 | - | |
96 | + /** | |
97 | + * 1:孕妇,2:儿童 | |
98 | + */ | |
99 | + private int type=-1; | |
100 | + | |
101 | + public int getType() { | |
102 | + return type; | |
103 | + } | |
104 | + | |
105 | + public void setType(int type) { | |
106 | + this.type = type; | |
107 | + } | |
108 | + | |
73 | 109 | public String getCardNo() { |
74 | 110 | return cardNo; |
75 | 111 | } |
... | ... | @@ -162,6 +198,9 @@ |
162 | 198 | if(-1!=yn){ |
163 | 199 | condition=condition.and("yn", yn, MongoOper.IS); |
164 | 200 | } |
201 | + if(-1!=type){ | |
202 | + condition=condition.and("yn", type, MongoOper.IS); | |
203 | + } | |
165 | 204 | /*if(null!=dueDateStart){ |
166 | 205 | // condition= condition.elemMatch("dueDate",MongoCondition.newInstance("$lte", dueDateStart, MongoOper.IS).and("$gte", dueDateEnd, MongoOper.IS)); |
167 | 206 | // condition=condition.and("dueDate", dueDateStart, MongoOper.GTE).and("dueDate", dueDateEnd, MongoOper.LTE); |
... | ... | @@ -186,7 +225,23 @@ |
186 | 225 | if (isAddStart) { |
187 | 226 | return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); |
188 | 227 | } |
189 | - | |
228 | + boolean isAddStart1 = Boolean.FALSE; | |
229 | + if (null != birthStart) { | |
230 | + c = Criteria.where("birth").gte(birthStart); | |
231 | + isAddStart = Boolean.TRUE; | |
232 | + } | |
233 | + | |
234 | + if (null != birthEnd) { | |
235 | + if (isAddStart1) { | |
236 | + c = c.lte(birthEnd); | |
237 | + } else { | |
238 | + c = Criteria.where("birth").lte(birthEnd); | |
239 | + } | |
240 | + isAddStart1 = Boolean.TRUE; | |
241 | + } | |
242 | + if (isAddStart ||isAddStart1) { | |
243 | + return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); | |
244 | + } | |
190 | 245 | return condition.toMongoQuery(); |
191 | 246 | } |
192 | 247 | public String getId() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java
View file @
35184a9
... | ... | @@ -3,8 +3,13 @@ |
3 | 3 | import java.util.ArrayList; |
4 | 4 | import java.util.HashMap; |
5 | 5 | import java.util.List; |
6 | +import java.util.Map; | |
6 | 7 | |
8 | +import com.lyms.platform.biz.service.CommunityConfigService; | |
7 | 9 | import com.lyms.platform.biz.service.PatientsService; |
10 | +import com.lyms.platform.common.utils.DateUtil; | |
11 | +import com.lyms.platform.common.utils.JsonUtil; | |
12 | +import com.lyms.platform.pojo.CommunityConfig; | |
8 | 13 | import com.lyms.platform.pojo.Patients; |
9 | 14 | import com.lyms.platform.query.PatientsQuery; |
10 | 15 | import org.apache.commons.collections.CollectionUtils; |
... | ... | @@ -33,6 +38,8 @@ |
33 | 38 | private PuerperaService puerperaService; |
34 | 39 | @Autowired |
35 | 40 | private PatientsService patientsService; |
41 | + @Autowired | |
42 | + private CommunityConfigService communityConfigService; | |
36 | 43 | |
37 | 44 | @Autowired |
38 | 45 | private BabyService babyService; |
... | ... | @@ -45,6 +52,29 @@ |
45 | 52 | */ |
46 | 53 | public BaseListResponse findBabyList(BabyManagerQueryRequest babyManagerRequest) { |
47 | 54 | |
55 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
56 | + patientsQuery.setType(2); | |
57 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
58 | + patientsQuery.setBirthEnd(babyManagerRequest.getdEnd()); | |
59 | + patientsQuery.setBirthStart(babyManagerRequest.getdStart()); | |
60 | + patientsQuery.setVisitstatus(babyManagerRequest.getVisitstatus()); | |
61 | + patientsQuery.setPage(babyManagerRequest.getPage()); | |
62 | + patientsQuery.setLimit(babyManagerRequest.getLimit()); | |
63 | + | |
64 | + if (StringUtils.isNotEmpty(babyManagerRequest.getKeyword())) { | |
65 | + patientsQuery.setKeyword(babyManagerRequest.getKeyword()); | |
66 | + } | |
67 | + List<Patients> patientsList = patientsService.queryPatient(patientsQuery); | |
68 | + | |
69 | + List<BabyResult> data =new ArrayList<BabyResult>(); | |
70 | + | |
71 | + if(CollectionUtils.isNotEmpty(patientsList)){ | |
72 | + for(Patients patients:patientsList){ | |
73 | + data.add(buildResult(patients)); | |
74 | + } | |
75 | + } | |
76 | + | |
77 | +/* | |
48 | 78 | BabyModelQuery babyQuery = new BabyModelQuery(); |
49 | 79 | babyQuery.setBirthEnd(babyManagerRequest.getdEnd()); |
50 | 80 | babyQuery.setBirthStart(babyManagerRequest.getdStart()); |
51 | 81 | |
52 | 82 | |
... | ... | @@ -55,15 +85,17 @@ |
55 | 85 | List<BabyResult> data = new ArrayList<BabyResult>(); |
56 | 86 | // 根据关键字先查询产妇信息 |
57 | 87 | if (StringUtils.isNotEmpty(babyManagerRequest.getKeyword())) { |
58 | - PuerperaModelQuery puerperaQuery = new PuerperaModelQuery(); | |
59 | - puerperaQuery.setKeyword(babyManagerRequest.getKeyword()); | |
88 | + *//* PuerperaModelQuery puerperaQuery = new PuerperaModelQuery(); | |
89 | + puerperaQuery.setKeyword(babyManagerRequest.getKeyword());*//* | |
60 | 90 | PatientsQuery patientsQuery = new PatientsQuery(); |
61 | 91 | patientsQuery.setKeyword(babyManagerRequest.getKeyword()); |
92 | + patientsQuery.setType(2); | |
93 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
62 | 94 | // 符合关键字的产妇列表 |
63 | 95 | // List<PuerperaModel> puerList = puerperaService.queryPuerpera(puerperaQuery); |
64 | 96 | List<Patients> puerList = patientsService.queryPatient(patientsQuery); |
65 | 97 | if (CollectionUtils.isNotEmpty(puerList)) { |
66 | - /* for (PuerperaModel model : puerList) { | |
98 | + *//* for (PuerperaModel model : puerList) { | |
67 | 99 | babyQuery.setParentId(model.getId()); |
68 | 100 | List<BabyModel> babies = babyService.queryBabyWithQuery(babyQuery); |
69 | 101 | if (CollectionUtils.isNotEmpty(babies)) { |
... | ... | @@ -71,7 +103,7 @@ |
71 | 103 | data.add(buildResult(baby, model)); |
72 | 104 | } |
73 | 105 | } |
74 | - }*/ | |
106 | + }*//* | |
75 | 107 | |
76 | 108 | for(Patients model : puerList) { |
77 | 109 | babyQuery.setParentId(model.getId()); |
78 | 110 | |
... | ... | @@ -88,10 +120,10 @@ |
88 | 120 | List<BabyModel> babies = babyService.queryBabyWithQuery(babyQuery); |
89 | 121 | if (CollectionUtils.isNotEmpty(babies)) { |
90 | 122 | for (BabyModel baby : babies) { |
91 | - data.add(buildResult(baby,/* puerperaService.findOnePuerperaById(baby.getParentId())*/patientsService.findOnePatientById(baby.getParentId()))); | |
123 | + data.add(buildResult(baby,*//* puerperaService.findOnePuerperaById(baby.getParentId())*//*patientsService.findOnePatientById(baby.getParentId()))); | |
92 | 124 | } |
93 | 125 | } |
94 | - } | |
126 | + }*/ | |
95 | 127 | |
96 | 128 | return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(data); |
97 | 129 | } |
98 | 130 | |
... | ... | @@ -104,10 +136,10 @@ |
104 | 136 | * @return 返回结果 |
105 | 137 | */ |
106 | 138 | public BaseResponse deleteOneBabyById(String id) { |
107 | - BabyModel obj = new BabyModel(); | |
139 | + Patients obj = new Patients(); | |
108 | 140 | obj.setYn(YnEnums.NO.getId()); |
109 | 141 | obj.setId(id); |
110 | - babyService.updateOneBaby(obj, id); | |
142 | + patientsService.updatePatient(obj); | |
111 | 143 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
112 | 144 | } |
113 | 145 | |
... | ... | @@ -155,6 +187,43 @@ |
155 | 187 | // TODO 需要根据产妇模型上的社区id获取社区信息 |
156 | 188 | babyResult.setCommunity(StringUtils.isEmpty(puerModel.getCommunityId()) ? "" : puerModel.getCommunityId()); |
157 | 189 | return babyResult; |
190 | + } | |
191 | + public BabyResult buildResult(Patients patients){ | |
192 | + BabyResult babyResult = new BabyResult(); | |
193 | + String addr = ""; | |
194 | + if (StringUtils.isNotEmpty(patients.getAddress())) { | |
195 | + try { | |
196 | + Map map = JsonUtil.str2Obj(patients.getAddress(), Map.class); | |
197 | + addr = map.get("d").toString(); | |
198 | + } catch (Exception e) { | |
199 | + addr = ""; | |
200 | + } | |
201 | + } | |
202 | + babyResult.setAddress(addr); | |
203 | + | |
204 | + babyResult.setCommunityId(StringUtils.isEmpty(patients.getCommunityId()) ? "" : patients.getCommunityId()); | |
205 | + String comm="未分配"; | |
206 | + if(StringUtils.isNotEmpty(patients.getCommunityId())){ | |
207 | + CommunityConfig communityConfig = communityConfigService.queryAreaById(patients.getCommunityId()); | |
208 | + if(null!=communityConfig){ | |
209 | + comm= communityConfig.getName(); | |
210 | + } | |
211 | + } | |
212 | + String gender= "未知"; | |
213 | + if(null!=patients.getGender()){ | |
214 | + if("1".equals(patients.getGender()+"")){ | |
215 | + gender="男"; | |
216 | + }else { | |
217 | + gender="女"; | |
218 | + } | |
219 | + } | |
220 | + babyResult.setBirth(DateUtil.getyyyy_MM_dd(patients.getBirth())); | |
221 | + babyResult.setSex(gender); | |
222 | + babyResult.setCommunity(comm); | |
223 | + babyResult.setMotherName("母亲名字"); | |
224 | + babyResult.setMotherPhone(patients.getPhone()); | |
225 | + babyResult.setId(patients.getId()); | |
226 | + return babyResult; | |
158 | 227 | } |
159 | 228 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
35184a9
... | ... | @@ -82,6 +82,7 @@ |
82 | 82 | puerperaQuery.setVisitstatus(managerRequest.getVisitstatus()); |
83 | 83 | puerperaQuery.setNeed("1"); |
84 | 84 | puerperaQuery.setYn(YnEnums.YES.getId()); |
85 | + puerperaQuery.setType(1); | |
85 | 86 | // 调用service查询 |
86 | 87 | |
87 | 88 | List<Patients> puerperaList = patientsService.queryPatient(puerperaQuery); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyResult.java
View file @
35184a9
... | ... | @@ -36,6 +36,16 @@ |
36 | 36 | private String address; |
37 | 37 | |
38 | 38 | private String community; |
39 | + private String | |
40 | + communityId; | |
41 | + | |
42 | + public String getCommunityId() { | |
43 | + return communityId; | |
44 | + } | |
45 | + | |
46 | + public void setCommunityId(String communityId) { | |
47 | + this.communityId = communityId; | |
48 | + } | |
39 | 49 | |
40 | 50 | private String visit; |
41 | 51 |