Commit 69c6dc5d69272c483824dc2e9cb66bcc288ae047
1 parent
f3bec32e8b
Exists in
master
and in
8 other branches
修改新电子病历
Showing 1 changed file with 45 additions and 23 deletions
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
View file @
69c6dc5
1 | 1 | package com.lyms.platform.biz.service; |
2 | 2 | |
3 | -import com.lyms.platform.biz.dal.IAntenatalExaminationDao; | |
4 | 3 | import com.lyms.platform.biz.dal.IPatientDao; |
5 | 4 | import com.lyms.platform.biz.dal.ISieveApplyOrderDao; |
6 | 5 | import com.lyms.platform.biz.dal.ISieveDao; |
7 | 6 | |
... | ... | @@ -9,8 +8,8 @@ |
9 | 8 | import com.lyms.platform.common.enums.YnEnums; |
10 | 9 | import com.lyms.platform.common.utils.DateUtil; |
11 | 10 | import com.lyms.platform.common.utils.LogUtil; |
12 | -import com.lyms.platform.pojo.AntenatalExaminationModel; | |
13 | 11 | import com.lyms.platform.pojo.Patients; |
12 | +import com.lyms.platform.pojo.SieveApplyOrderModel; | |
14 | 13 | import com.lyms.platform.pojo.SieveModel; |
15 | 14 | import com.lyms.platform.query.AntExQuery; |
16 | 15 | import com.lyms.platform.query.PatientsQuery; |
... | ... | @@ -18,7 +17,6 @@ |
18 | 17 | import com.lyms.platform.query.SieveQuery; |
19 | 18 | import org.apache.commons.collections.CollectionUtils; |
20 | 19 | import org.apache.commons.lang.StringUtils; |
21 | -import org.apache.commons.lang.math.NumberUtils; | |
22 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
23 | 21 | import org.springframework.data.domain.Sort; |
24 | 22 | import org.springframework.stereotype.Service; |
... | ... | @@ -39,6 +37,7 @@ |
39 | 37 | private ISieveDao sieveDao; |
40 | 38 | @Autowired |
41 | 39 | private ISieveApplyOrderDao sieveApplyOrderDao; |
40 | + | |
42 | 41 | public Patients addPatient(Patients obj) { |
43 | 42 | return iPatientDao.addPatient(obj); |
44 | 43 | } |
45 | 44 | |
... | ... | @@ -46,9 +45,11 @@ |
46 | 45 | public void updatePatient(Patients obj) { |
47 | 46 | iPatientDao.updatePatient(obj, obj.getId()); |
48 | 47 | } |
49 | - public void findAndModify(PatientsQuery query,Patients obj){ | |
48 | + | |
49 | + public void findAndModify(PatientsQuery query, Patients obj) { | |
50 | 50 | iPatientDao.findAndModify(query.convertToQuery(), obj); |
51 | 51 | } |
52 | + | |
52 | 53 | public List<Patients> queryPatient(PatientsQuery patientsQuery) { |
53 | 54 | MongoQuery query = patientsQuery.convertToQuery(); |
54 | 55 | if (StringUtils.isNotEmpty(patientsQuery.getNeed())) { |
... | ... | @@ -59,7 +60,7 @@ |
59 | 60 | return iPatientDao.queryPatient(query.addOrder(Sort.Direction.DESC, "id")); |
60 | 61 | } |
61 | 62 | |
62 | - public List<Patients> findLatelyCreated(MongoQuery mongoQuery){ | |
63 | + public List<Patients> findLatelyCreated(MongoQuery mongoQuery) { | |
63 | 64 | return iPatientDao.queryPatient(mongoQuery); |
64 | 65 | } |
65 | 66 | |
66 | 67 | |
67 | 68 | |
68 | 69 | |
... | ... | @@ -161,21 +162,20 @@ |
161 | 162 | |
162 | 163 | /** |
163 | 164 | * 删除过期产筛的数据,删掉自动到期的部分 |
164 | - * | |
165 | 165 | */ |
166 | - public void delSieve(){ | |
166 | + public void delSieve() { | |
167 | 167 | SieveQuery sieveQuery = new SieveQuery(); |
168 | 168 | sieveQuery.setYn(YnEnums.YES.getId()); |
169 | 169 | Date endDate = DateUtil.addDay(new Date(), -146); |
170 | 170 | sieveQuery.setLastMensesStart(endDate); |
171 | 171 | List<SieveModel> list = sieveDao.queryList(sieveQuery.convertToQuery()); |
172 | - if(CollectionUtils.isNotEmpty(list)){ | |
173 | - for(SieveModel sieveModel:list) { | |
174 | - SieveApplyOrderQuery sieveApplyOrderQuery=new SieveApplyOrderQuery(); | |
172 | + if (CollectionUtils.isNotEmpty(list)) { | |
173 | + for (SieveModel sieveModel : list) { | |
174 | + SieveApplyOrderQuery sieveApplyOrderQuery = new SieveApplyOrderQuery(); | |
175 | 175 | sieveApplyOrderQuery.setParentId(sieveModel.getParentId()); |
176 | 176 | sieveApplyOrderQuery.setYn(YnEnums.YES.getId()); |
177 | - List list1 = sieveApplyOrderDao.queryList(sieveApplyOrderQuery.convertToQuery()); | |
178 | - if(CollectionUtils.isEmpty(list1)){ | |
177 | + List list1 = sieveApplyOrderDao.queryList(sieveApplyOrderQuery.convertToQuery()); | |
178 | + if (CollectionUtils.isEmpty(list1)) { | |
179 | 179 | sieveModel.setYn(YnEnums.NO.getId()); |
180 | 180 | sieveDao.updateChanQianSieve(sieveModel); |
181 | 181 | } |
182 | 182 | |
183 | 183 | |
... | ... | @@ -186,14 +186,14 @@ |
186 | 186 | /** |
187 | 187 | * 自动分娩产妇的 |
188 | 188 | */ |
189 | - public void autoMatDeliver(){ | |
189 | + public void autoMatDeliver() { | |
190 | 190 | Date endDate = DateUtil.addDay(new Date(), -293); |
191 | - PatientsQuery patientsQuery=new PatientsQuery(); | |
191 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
192 | 192 | patientsQuery.setYn(YnEnums.YES.getId()); |
193 | 193 | patientsQuery.setType(1); |
194 | 194 | patientsQuery.setLastMensesStart(endDate); |
195 | 195 | List<Patients> patientses = queryPatient(patientsQuery); |
196 | - for(Patients patients:patientses){ | |
196 | + for (Patients patients : patientses) { | |
197 | 197 | patients.setType(3); |
198 | 198 | patients.setBuildType(2); |
199 | 199 | patients.setFmDate(new Date()); |
... | ... | @@ -201,6 +201,7 @@ |
201 | 201 | updatePatient(patients); |
202 | 202 | } |
203 | 203 | } |
204 | + | |
204 | 205 | /** |
205 | 206 | * 孕妇建档时调用的方法或者修改末次月经后调用 |
206 | 207 | * |
207 | 208 | |
... | ... | @@ -219,9 +220,9 @@ |
219 | 220 | SieveModel sieveModel = convertToModel(patients); |
220 | 221 | sieveModel.setFrom("1"); |
221 | 222 | sieveDao.addChanQianSieve(sieveModel); |
222 | - }else{ | |
223 | + } else { | |
223 | 224 | //修改孕妇基本信息 |
224 | - for(SieveModel sieveModel:list){ | |
225 | + for (SieveModel sieveModel : list) { | |
225 | 226 | sieveModel.setPhone(patients.getPhone()); |
226 | 227 | sieveModel.setName(patients.getUsername()); |
227 | 228 | sieveModel.setLastMenses(patients.getLastMenses()); |
... | ... | @@ -229,12 +230,33 @@ |
229 | 230 | sieveDao.updateChanQianSieve(sieveModel); |
230 | 231 | } |
231 | 232 | } |
232 | - }else{ | |
233 | - //修改孕妇末次月经不满足条件删除产筛数据 | |
234 | - SieveQuery sieveQuery = new SieveQuery(); | |
235 | - sieveQuery.setYn(YnEnums.YES.getId()); | |
236 | - sieveQuery.setParentId(patients.getId()); | |
237 | - sieveDao.deleteById(sieveQuery.convertToQuery()); | |
233 | + } else { | |
234 | + | |
235 | + SieveApplyOrderQuery sieveApplyOrderQuery = new SieveApplyOrderQuery(); | |
236 | + sieveApplyOrderQuery.setParentId(patients.getId()); | |
237 | + sieveApplyOrderQuery.setYn(YnEnums.YES.getId()); | |
238 | + sieveApplyOrderQuery.setHospitalId(patients.getHospitalId()); | |
239 | + List<SieveApplyOrderModel> list1 = sieveApplyOrderDao.queryList(sieveApplyOrderQuery.convertToQuery()); | |
240 | + if (CollectionUtils.isEmpty(list1)) { | |
241 | + //修改孕妇末次月经不满足条件删除产筛数据 | |
242 | + SieveQuery sieveQuery = new SieveQuery(); | |
243 | + sieveQuery.setYn(YnEnums.YES.getId()); | |
244 | + sieveQuery.setParentId(patients.getId()); | |
245 | + sieveDao.deleteById(sieveQuery.convertToQuery()); | |
246 | + } else { | |
247 | + SieveQuery sieveQuery = new SieveQuery(); | |
248 | + sieveQuery.setYn(YnEnums.YES.getId()); | |
249 | + sieveQuery.setParentId(patients.getId()); | |
250 | + List<SieveModel> list = sieveDao.queryList(sieveQuery.convertToQuery()); | |
251 | + //修改孕妇基本信息 | |
252 | + for (SieveModel sieveModel : list) { | |
253 | + sieveModel.setPhone(patients.getPhone()); | |
254 | + sieveModel.setName(patients.getUsername()); | |
255 | + sieveModel.setLastMenses(patients.getLastMenses()); | |
256 | + sieveModel.setCardNo(patients.getCardNo()); | |
257 | + sieveDao.updateChanQianSieve(sieveModel); | |
258 | + } | |
259 | + } | |
238 | 260 | } |
239 | 261 | } |
240 | 262 | } |