Commit cd234aa09b6004356aa9ca696c9bcd2569a659df
1 parent
41864ccaaa
Exists in
master
and in
1 other branch
修改产检删除
Showing 5 changed files with 103 additions and 36 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IAntExRecordDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntExRecordDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntenatalExaminationService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IAntExRecordDao.java
View file @
cd234aa
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntExRecordDaoImpl.java
View file @
cd234aa
... | ... | @@ -33,6 +33,10 @@ |
33 | 33 | @Repository("antExRecordDao") |
34 | 34 | public class AntExRecordDaoImpl extends BaseMongoDAOImpl<AntExRecordModel> implements IAntExRecordDao { |
35 | 35 | |
36 | + | |
37 | + public void findAndMove(MongoQuery mongoQuery){ | |
38 | + super.delete(mongoQuery.convertToMongoQuery()); | |
39 | + } | |
36 | 40 | /** |
37 | 41 | * 统计单个医院的产检情况 |
38 | 42 | * |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java
View file @
cd234aa
... | ... | @@ -56,21 +56,18 @@ |
56 | 56 | |
57 | 57 | //复诊 |
58 | 58 | List<AntenatalExaminationModel> list = antExService.queryAntenatalExamination(antExQuery.convertToQuery()); |
59 | - List<AntExRecordModel> data = new ArrayList<>(); | |
60 | 59 | for (AntenatalExaminationModel antEx : list) { |
61 | 60 | AntExRecordModel record = convert(antEx); |
62 | - if(null!=record){ | |
63 | - data.add(record); | |
61 | + if (null != record) { | |
62 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
63 | + antExRecordQuery.setParentId(record.getParentId()); | |
64 | + antExRecordQuery.setcId(record.getCheckDoctor()); | |
65 | + Integer count = count(antExRecordQuery); | |
66 | + if (null == count || 0 == count) { | |
67 | + antExRecordDao.addOneRecord(record); | |
68 | + } | |
64 | 69 | } |
65 | - if (data.size() == 50) { | |
66 | - antExRecordDao.batchAddRecord(data); | |
67 | - data.clear(); | |
68 | - } | |
69 | 70 | } |
70 | - if (!data.isEmpty()) { | |
71 | - antExRecordDao.batchAddRecord(data); | |
72 | - data.clear(); | |
73 | - } | |
74 | 71 | |
75 | 72 | |
76 | 73 | //初诊 |
77 | 74 | |
78 | 75 | |
79 | 76 | |
80 | 77 | |
81 | 78 | |
82 | 79 | |
83 | 80 | |
... | ... | @@ -82,25 +79,75 @@ |
82 | 79 | if (CollectionUtils.isNotEmpty(antExChuModelList)) { |
83 | 80 | for (AntExChuModel antEx : antExChuModelList) { |
84 | 81 | AntExRecordModel record = convert(antEx); |
85 | - if(null!=record){ | |
86 | - data.add(record); | |
82 | + if (null != record) { | |
83 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
84 | + antExRecordQuery.setParentId(record.getParentId()); | |
85 | + antExRecordQuery.setcId(record.getCheckDoctor()); | |
86 | + Integer count = count(antExRecordQuery); | |
87 | + if (null == count || 0 == count) { | |
88 | + antExRecordDao.addOneRecord(record); | |
89 | + } | |
87 | 90 | } |
88 | - if (data.size() == 50) { | |
89 | - antExRecordDao.batchAddRecord(data); | |
90 | - data.clear(); | |
91 | - } | |
92 | 91 | } |
93 | - if (!data.isEmpty()) { | |
94 | - antExRecordDao.batchAddRecord(data); | |
95 | - data.clear(); | |
96 | - } | |
97 | 92 | } |
98 | 93 | } |
99 | 94 | |
95 | + /** | |
96 | + * 处理删除检查 | |
97 | + * | |
98 | + * @param parentId | |
99 | + */ | |
100 | + public void handExRecord(String parentId) { | |
101 | + if (StringUtils.isEmpty(parentId)) { | |
102 | + return; | |
103 | + } | |
100 | 104 | |
105 | + //先删除掉该人的 | |
106 | + AntExRecordQuery antExRecordQuery1 = new AntExRecordQuery(); | |
107 | + antExRecordQuery1.setParentId(parentId); | |
108 | + antExRecordDao.findAndMove(antExRecordQuery1.convertToQuery()); | |
101 | 109 | |
110 | + AntExQuery antExQuery = new AntExQuery(); | |
111 | + antExQuery.setYn(YnEnums.YES.getId()); | |
112 | + antExQuery.setParentId(parentId); | |
113 | + //复诊 | |
114 | + List<AntenatalExaminationModel> list = antExService.queryAntenatalExamination(antExQuery.convertToQuery()); | |
115 | + for (AntenatalExaminationModel antEx : list) { | |
116 | + AntExRecordModel record = convert(antEx); | |
117 | + if (null != record) { | |
118 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
119 | + antExRecordQuery.setParentId(record.getParentId()); | |
120 | + antExRecordQuery.setcId(record.getCheckDoctor()); | |
121 | + Integer count = count(antExRecordQuery); | |
122 | + if (null == count || 0 == count) { | |
123 | + antExRecordDao.addOneRecord(record); | |
124 | + } | |
125 | + } | |
126 | + } | |
102 | 127 | |
128 | + //初诊 | |
129 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
130 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
131 | + antExChuQuery.setParentId(parentId); | |
132 | + List<AntExChuModel> antExChuModelList = antExService.queryAntExChu(antExChuQuery.convertToQuery()); | |
103 | 133 | |
134 | + if (CollectionUtils.isNotEmpty(antExChuModelList)) { | |
135 | + for (AntExChuModel antEx : antExChuModelList) { | |
136 | + AntExRecordModel record = convert(antEx); | |
137 | + if (null != record) { | |
138 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
139 | + antExRecordQuery.setParentId(record.getParentId()); | |
140 | + antExRecordQuery.setcId(record.getCheckDoctor()); | |
141 | + Integer count = count(antExRecordQuery); | |
142 | + if (null == count || 0 == count) { | |
143 | + antExRecordDao.addOneRecord(record); | |
144 | + } | |
145 | + } | |
146 | + } | |
147 | + } | |
148 | + } | |
149 | + | |
150 | + | |
104 | 151 | public AntExRecordModel convert(AntenatalExaminationModel antEx) { |
105 | 152 | AntExRecordModel antExRecordModel = new AntExRecordModel(); |
106 | 153 | antExRecordModel.setParentId(antEx.getParentId()); |
... | ... | @@ -115,7 +162,7 @@ |
115 | 162 | if (null != patients) { |
116 | 163 | if (patients.getType() == 1) { |
117 | 164 | antExRecordModel.setStatus(2); |
118 | - }else{ | |
165 | + } else { | |
119 | 166 | antExRecordModel.setStatus(1); |
120 | 167 | } |
121 | 168 | antExRecordModel.setBrith(patients.getBirth()); |
... | ... | @@ -126,8 +173,8 @@ |
126 | 173 | antExRecordModel.sethScore(patients.getRiskScore()); |
127 | 174 | antExRecordModel.sethRisk(patients.getRiskFactorId()); |
128 | 175 | antExRecordModel.sethLevel(JsonUtil.toList(patients.getRiskLevelId(), List.class)); |
129 | - }else{ | |
130 | - logger.info("antex find patient by id is null. parentId:"+antEx.getParentId()); | |
176 | + } else { | |
177 | + logger.info("antex find patient by id is null. parentId:" + antEx.getParentId()); | |
131 | 178 | return null; |
132 | 179 | } |
133 | 180 | return antExRecordModel; |
... | ... | @@ -145,7 +192,7 @@ |
145 | 192 | if (null != patients) { |
146 | 193 | if (patients.getType() == 1) { |
147 | 194 | antExRecordModel.setStatus(2); |
148 | - }else{ | |
195 | + } else { | |
149 | 196 | antExRecordModel.setStatus(1); |
150 | 197 | } |
151 | 198 | antExRecordModel.setLastMenses(patients.getLastMenses()); |
... | ... | @@ -156,8 +203,8 @@ |
156 | 203 | antExRecordModel.sethScore(patients.getRiskScore()); |
157 | 204 | antExRecordModel.sethRisk(patients.getRiskFactorId()); |
158 | 205 | antExRecordModel.sethLevel(JsonUtil.toList(patients.getRiskLevelId(), List.class)); |
159 | - }else{ | |
160 | - logger.info("antexc find patient by id is null. parentId:"+antExChuModel.getParentId()); | |
206 | + } else { | |
207 | + logger.info("antexc find patient by id is null. parentId:" + antExChuModel.getParentId()); | |
161 | 208 | return null; |
162 | 209 | } |
163 | 210 | return antExRecordModel; |
... | ... | @@ -181,6 +228,11 @@ |
181 | 228 | query.start(antExRecordQuery.getOffset()).end(antExRecordQuery.getLimit()); |
182 | 229 | } |
183 | 230 | return antExRecordDao.queryRecord(antExRecordQuery.convertToQuery()); |
231 | + } | |
232 | + | |
233 | + | |
234 | + public Integer count(AntExRecordQuery antExRecordQuery) { | |
235 | + return antExRecordDao.count(antExRecordQuery.convertToQuery()); | |
184 | 236 | } |
185 | 237 | |
186 | 238 | /** |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntenatalExaminationService.java
View file @
cd234aa
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | import com.lyms.platform.pojo.AntExRecordModel; |
11 | 11 | import com.lyms.platform.pojo.AntenatalExaminationModel; |
12 | 12 | import com.lyms.platform.query.AntExChuQuery; |
13 | +import com.lyms.platform.query.AntExRecordQuery; | |
13 | 14 | import com.lyms.platform.query.VisitQuery; |
14 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
15 | 16 | import org.springframework.data.domain.Sort; |
16 | 17 | |
... | ... | @@ -103,9 +104,16 @@ |
103 | 104 | antExRecordModel = antExRecordService.convert(chu); |
104 | 105 | } |
105 | 106 | |
107 | + | |
106 | 108 | if (null != antExRecordModel) { |
107 | - antExRecordModel.setCreated(new Date()); | |
108 | - antExRecordService.addOneRecord(antExRecordModel); | |
109 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
110 | + antExRecordQuery.setParentId(antExRecordModel.getParentId()); | |
111 | + antExRecordQuery.setcId(antExRecordModel.getCheckDoctor()); | |
112 | + Integer count = antExRecordService.count(antExRecordQuery); | |
113 | + if (null == count || 0 == count) { | |
114 | + antExRecordModel.setCreated(new Date()); | |
115 | + antExRecordService.addOneRecord(antExRecordModel); | |
116 | + } | |
109 | 117 | } |
110 | 118 | } |
111 | 119 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
cd234aa
... | ... | @@ -57,7 +57,8 @@ |
57 | 57 | private UsersService usersService; |
58 | 58 | @Autowired |
59 | 59 | private DeleteProcessHandler deleteProcessHandler; |
60 | - | |
60 | +@Autowired | |
61 | + private AntExRecordService recordService; | |
61 | 62 | /** |
62 | 63 | * 修改最后一次产检时间 |
63 | 64 | * |
... | ... | @@ -147,7 +148,7 @@ |
147 | 148 | setLashCTimes(hospitalId, antExAddRequest.getParentId(), 2); |
148 | 149 | |
149 | 150 | //复诊,修改产检管理 |
150 | - antenatalExaminationService.updateAntExRecord(antExAddRequest.getParentId(), 2); | |
151 | + antenatalExaminationService.updateAntExRecord(antExAddRequest.getId(), 2); | |
151 | 152 | } else { |
152 | 153 | AntenatalExaminationModel model = antExAddRequest.convertToDataModel(); |
153 | 154 | model.setOperator(userId); |
... | ... | @@ -185,7 +186,7 @@ |
185 | 186 | //修改本院最后一次定义高危 |
186 | 187 | updateLastRhTime(patients.getId(), hospitalId); |
187 | 188 | //复诊,修改产检管理 |
188 | - antenatalExaminationService.updateAntExRecord(antExAddRequest.getParentId(),2); | |
189 | + antenatalExaminationService.updateAntExRecord(model.getId(),2); | |
189 | 190 | if (null != patients.getBuildType() && patients.getBuildType() == 3) { |
190 | 191 | ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery(); |
191 | 192 | referralApplyOrderQuery.setParentId(patients.getId()); |
... | ... | @@ -270,7 +271,7 @@ |
270 | 271 | setLashCTimes(hospitalId, antExChuModel.getParentId(), 1); |
271 | 272 | |
272 | 273 | //初诊,修改产检管理 |
273 | - antenatalExaminationService.updateAntExRecord(antExChuModel.getParentId(), 1); | |
274 | + antenatalExaminationService.updateAntExRecord(antExChuModel.getId(), 1); | |
274 | 275 | |
275 | 276 | } else { |
276 | 277 | AntExChuQuery antExChuQuery1 = new AntExChuQuery(); |
... | ... | @@ -312,7 +313,7 @@ |
312 | 313 | //修改本院最后一次定义高危 |
313 | 314 | updateLastRhTime(patients.getId(), hospitalId); |
314 | 315 | setLashCTimes(hospitalId, antExChuModel.getParentId(), 1); |
315 | - antenatalExaminationService.updateAntExRecord(antExChuModel.getParentId(), 1); | |
316 | + antenatalExaminationService.updateAntExRecord(antExChuModel.getId(), 1); | |
316 | 317 | if (null != patients.getBuildType() && patients.getBuildType() == 3) { |
317 | 318 | Patients patients1 = new Patients(); |
318 | 319 | patients1.setEnable("1"); |
... | ... | @@ -1431,7 +1432,7 @@ |
1431 | 1432 | setLashCTimes(hospital, antenatalExaminationModel.getParentId(), 2); |
1432 | 1433 | |
1433 | 1434 | updateLastRisk(antenatalExaminationModel.getParentId()); |
1434 | - | |
1435 | + recordService.handExRecord(antenatalExaminationModel.getParentId()); | |
1435 | 1436 | } else { |
1436 | 1437 | return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("当前产检记录不是本院最新的产检记录,不能删除"); |
1437 | 1438 | } |
... | ... | @@ -1479,7 +1480,7 @@ |
1479 | 1480 | AntExChuModel antExChuModel1 = antenatalExaminationService.findOne(antExQueryRequest.getId()); |
1480 | 1481 | setLashCTimes(hospital, antExChuModel1.getParentId(), 1); |
1481 | 1482 | updateLastRisk(antExChuModel1.getParentId()); |
1482 | - | |
1483 | + recordService.handExRecord(antExChuModel1.getParentId()); | |
1483 | 1484 | } else { |
1484 | 1485 | return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("当前产检记录不是本院最新的产检记录,不能删除"); |
1485 | 1486 | } |