Commit 7db3bcb642942cc89b18e22de038f99e756e9877
Exists in
master
and in
8 other branches
Merge remote-tracking branch 'origin/master'
Showing 9 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
- 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/facade/VisitFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/VisitResult.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java
View file @
7db3bcb
1 | 1 | package com.lyms.platform.biz.dal.impl; |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.dal.IPatientDao; |
4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
4 | 5 | import com.lyms.platform.common.dao.operator.MongoCondition; |
5 | 6 | import com.lyms.platform.common.dao.operator.MongoOper; |
6 | 7 | import com.lyms.platform.common.dao.operator.MongoQuery; |
7 | 8 | import com.lyms.platform.common.dao.operator.Page; |
8 | 9 | import com.lyms.platform.pojo.Patients; |
9 | -import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
10 | +import org.bson.types.ObjectId; | |
10 | 11 | import org.springframework.stereotype.Repository; |
11 | 12 | |
12 | 13 | import java.util.List; |
13 | 14 | |
14 | 15 | /** |
15 | - * | |
16 | 16 | * 患者模型 |
17 | - * | |
18 | - * | |
17 | + * <p> | |
18 | + * <p> | |
19 | 19 | * Created by Administrator on 2016/4/22 0022. |
20 | 20 | */ |
21 | 21 | @Repository("patientDaoImpl") |
22 | -public class PatientDaoImpl extends BaseMongoDAOImpl<Patients> implements IPatientDao { | |
22 | +public class PatientDaoImpl extends BaseMongoDAOImpl<Patients> implements IPatientDao { | |
23 | 23 | @Override |
24 | 24 | public Patients addPatient(Patients obj) { |
25 | - return save(obj); | |
25 | + return save(obj); | |
26 | 26 | } |
27 | 27 | |
28 | 28 | @Override |
29 | 29 | public void updatePatient(Patients obj, String id) { |
30 | - update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj); | |
30 | + boolean check = ObjectId.isValid(id); | |
31 | + if (check) { | |
32 | + update(new MongoQuery(new MongoCondition("id", new ObjectId(id), MongoOper.IS)).convertToMongoQuery(), obj); | |
33 | + } | |
31 | 34 | } |
32 | 35 | |
33 | 36 | @Override |
34 | 37 | public void deletePatient(String id) { |
35 | - delete(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery()); | |
38 | + boolean check = ObjectId.isValid(id); | |
39 | + if (check) { | |
40 | + delete(new MongoQuery(new MongoCondition("id", new ObjectId(id), MongoOper.IS)).convertToMongoQuery()); | |
41 | + } | |
36 | 42 | } |
37 | 43 | |
38 | 44 | @Override |
39 | 45 | public Patients getPatient(String id) { |
40 | - return findById(id); | |
46 | + return findById(id); | |
41 | 47 | } |
42 | 48 | |
43 | 49 | @Override |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
View file @
7db3bcb
... | ... | @@ -51,7 +51,7 @@ |
51 | 51 | */ |
52 | 52 | public Patients findOnePatientByCardNo(PatientsQuery puerperaQuery) { |
53 | 53 | List<Patients> result = iPatientDao.queryPatient(puerperaQuery.convertToQuery()); |
54 | - if(CollectionUtils.isEmpty(result)){ | |
54 | + if(CollectionUtils.isNotEmpty(result)){ | |
55 | 55 | return result.get(0); |
56 | 56 | } |
57 | 57 | return null; |
platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
View file @
7db3bcb
... | ... | @@ -84,6 +84,71 @@ |
84 | 84 | |
85 | 85 | private Integer patientLevel; |
86 | 86 | |
87 | + private String lastCheckEmployeeId; | |
88 | + private Integer lastReportId; | |
89 | + | |
90 | + private String riskFactorId; | |
91 | + private String riskGroupId; | |
92 | + private Integer serviceType; | |
93 | + private Integer vip; | |
94 | + private String lastReportDoctorName; | |
95 | + | |
96 | + public String getLastCheckEmployeeId() { | |
97 | + return lastCheckEmployeeId; | |
98 | + } | |
99 | + | |
100 | + public void setLastCheckEmployeeId(String lastCheckEmployeeId) { | |
101 | + this.lastCheckEmployeeId = lastCheckEmployeeId; | |
102 | + } | |
103 | + | |
104 | + public String getLastReportDoctorName() { | |
105 | + return lastReportDoctorName; | |
106 | + } | |
107 | + | |
108 | + public void setLastReportDoctorName(String lastReportDoctorName) { | |
109 | + this.lastReportDoctorName = lastReportDoctorName; | |
110 | + } | |
111 | + | |
112 | + public Integer getLastReportId() { | |
113 | + return lastReportId; | |
114 | + } | |
115 | + | |
116 | + public void setLastReportId(Integer lastReportId) { | |
117 | + this.lastReportId = lastReportId; | |
118 | + } | |
119 | + | |
120 | + public String getRiskFactorId() { | |
121 | + return riskFactorId; | |
122 | + } | |
123 | + | |
124 | + public void setRiskFactorId(String riskFactorId) { | |
125 | + this.riskFactorId = riskFactorId; | |
126 | + } | |
127 | + | |
128 | + public String getRiskGroupId() { | |
129 | + return riskGroupId; | |
130 | + } | |
131 | + | |
132 | + public void setRiskGroupId(String riskGroupId) { | |
133 | + this.riskGroupId = riskGroupId; | |
134 | + } | |
135 | + | |
136 | + public Integer getServiceType() { | |
137 | + return serviceType; | |
138 | + } | |
139 | + | |
140 | + public void setServiceType(Integer serviceType) { | |
141 | + this.serviceType = serviceType; | |
142 | + } | |
143 | + | |
144 | + public Integer getVip() { | |
145 | + return vip; | |
146 | + } | |
147 | + | |
148 | + public void setVip(Integer vip) { | |
149 | + this.vip = vip; | |
150 | + } | |
151 | + | |
87 | 152 | public Integer getPatientLevel() { |
88 | 153 | return patientLevel; |
89 | 154 | } |
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
7db3bcb
... | ... | @@ -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 | - private int yn; | |
71 | - | |
72 | - | |
95 | + private int yn=-1; | |
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 | } |
76 | 112 | |
... | ... | @@ -157,8 +193,18 @@ |
157 | 193 | condition= condition.and("id", new ObjectId(id), MongoOper.IS); |
158 | 194 | } |
159 | 195 | if(null!=cardNo){ |
160 | - condition=condition.and("cardno", cardNo, MongoOper.IS); | |
196 | + condition=condition.and("cardno", cardNo, MongoOper.IS); | |
197 | + | |
161 | 198 | } |
199 | + if(null!=phone){ | |
200 | + condition=condition.and("phone", phone, MongoOper.IS); | |
201 | + } | |
202 | + if(-1!=yn){ | |
203 | + condition=condition.and("yn", yn, MongoOper.IS); | |
204 | + } | |
205 | + if(-1!=type){ | |
206 | + condition=condition.and("type", type, MongoOper.IS); | |
207 | + } | |
162 | 208 | /*if(null!=dueDateStart){ |
163 | 209 | // condition= condition.elemMatch("dueDate",MongoCondition.newInstance("$lte", dueDateStart, MongoOper.IS).and("$gte", dueDateEnd, MongoOper.IS)); |
164 | 210 | // condition=condition.and("dueDate", dueDateStart, MongoOper.GTE).and("dueDate", dueDateEnd, MongoOper.LTE); |
... | ... | @@ -183,7 +229,23 @@ |
183 | 229 | if (isAddStart) { |
184 | 230 | return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); |
185 | 231 | } |
186 | - | |
232 | + boolean isAddStart1 = Boolean.FALSE; | |
233 | + if (null != birthStart) { | |
234 | + c = Criteria.where("birth").gte(birthStart); | |
235 | + isAddStart = Boolean.TRUE; | |
236 | + } | |
237 | + | |
238 | + if (null != birthEnd) { | |
239 | + if (isAddStart1) { | |
240 | + c = c.lte(birthEnd); | |
241 | + } else { | |
242 | + c = Criteria.where("birth").lte(birthEnd); | |
243 | + } | |
244 | + isAddStart1 = Boolean.TRUE; | |
245 | + } | |
246 | + if (isAddStart ||isAddStart1) { | |
247 | + return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); | |
248 | + } | |
187 | 249 | return condition.toMongoQuery(); |
188 | 250 | } |
189 | 251 | public String getId() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java
View file @
7db3bcb
... | ... | @@ -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 | + patientsQuery.setNeed("1"); | |
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,46 @@ |
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.setName(patients.getUsername()); | |
221 | + babyResult.setBirth(DateUtil.getyyyy_MM_dd(patients.getBirth())); | |
222 | + babyResult.setSex(gender); | |
223 | + babyResult.setCommunity(comm); | |
224 | + babyResult.setMotherName("母亲名字"); | |
225 | + babyResult.setMotherPhone(patients.getPhone()); | |
226 | + babyResult.setId(patients.getId()); | |
227 | + babyResult.setVisit(patients.getIsVisit() == 0 ? "未访视" : "已访视"); | |
228 | + babyResult.setVisitStatus(patients.getIsVisit()); | |
229 | + return babyResult; | |
158 | 230 | } |
159 | 231 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
7db3bcb
... | ... | @@ -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/facade/VisitFacade.java
View file @
7db3bcb
... | ... | @@ -108,7 +108,9 @@ |
108 | 108 | */ |
109 | 109 | private Patients findOnePuerperaByCardNo(String cardNo) { |
110 | 110 | PatientsQuery query = new PatientsQuery(); |
111 | - query.setCardNo(cardNo); | |
111 | + //先根据传入的手机号 | |
112 | +// query.setCardNo(cardNo); | |
113 | + query.setPhone(cardNo); | |
112 | 114 | query.setYn(YnEnums.YES.getId()); |
113 | 115 | // 根据身份证号找到产妇信息 |
114 | 116 | return patientsService.findOnePatientByCardNo(query); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyResult.java
View file @
7db3bcb
... | ... | @@ -36,6 +36,25 @@ |
36 | 36 | private String address; |
37 | 37 | |
38 | 38 | private String community; |
39 | + private String | |
40 | + communityId; | |
41 | + private int visitStatus; | |
42 | + | |
43 | + public int getVisitStatus() { | |
44 | + return visitStatus; | |
45 | + } | |
46 | + | |
47 | + public void setVisitStatus(int visitStatus) { | |
48 | + this.visitStatus = visitStatus; | |
49 | + } | |
50 | + | |
51 | + public String getCommunityId() { | |
52 | + return communityId; | |
53 | + } | |
54 | + | |
55 | + public void setCommunityId(String communityId) { | |
56 | + this.communityId = communityId; | |
57 | + } | |
39 | 58 | |
40 | 59 | private String visit; |
41 | 60 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/VisitResult.java
View file @
7db3bcb
... | ... | @@ -108,10 +108,10 @@ |
108 | 108 | } catch (Exception e) { |
109 | 109 | } |
110 | 110 | setAge(model.getAge()); |
111 | - setCardNo(model.getCardNo()); | |
112 | - setDeliverOrg(model.getDeliverOrg()); | |
111 | + setCardNo(null==model.getCardNo()?"":model.getCardNo()); | |
112 | + setDeliverOrg(model.getDeliverOrg()==null?"":model.getDeliverOrg()); | |
113 | 113 | setDueDate(DateUtil.getyyyy_MM_dd(model.getDueDate())); |
114 | - setDueType(model.getDueType()); | |
114 | + setDueType(model.getDueType()==null?"":model.getDueType()); | |
115 | 115 | setName(model.getUsername()); |
116 | 116 | } |
117 | 117 | } |