Commit 1a79820d78e2817a0df973d6f74423a2f51736b8
1 parent
e76a299da1
Exists in
master
and in
6 other branches
bug修复
Showing 2 changed files with 28 additions and 20 deletions
platform-dal/src/main/java/com/lyms/platform/pojo/NewbornVisit.java
View file @
1a79820
... | ... | @@ -24,8 +24,6 @@ |
24 | 24 | |
25 | 25 | private String hospitalId; |
26 | 26 | |
27 | - private String parentId; | |
28 | - | |
29 | 27 | private String babyId; |
30 | 28 | |
31 | 29 | private String pid; |
... | ... | @@ -192,14 +190,6 @@ |
192 | 190 | |
193 | 191 | public void setHospitalId(String hospitalId) { |
194 | 192 | this.hospitalId = hospitalId; |
195 | - } | |
196 | - | |
197 | - public String getParentId() { | |
198 | - return parentId; | |
199 | - } | |
200 | - | |
201 | - public void setParentId(String parentId) { | |
202 | - this.parentId = parentId; | |
203 | 193 | } |
204 | 194 | |
205 | 195 | public String getBabyId() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/NewbornServiceImpl.java
View file @
1a79820
... | ... | @@ -84,6 +84,10 @@ |
84 | 84 | newbornVisit.setOperationId(userId.toString()); |
85 | 85 | newbornVisit.setCreated(new Date()); |
86 | 86 | newbornVisit.setYn("1"); |
87 | + BabyModel babyModel = mongoTemplate.findById(newbornVisit.getBabyId(), BabyModel.class); | |
88 | + if(babyModel != null) { | |
89 | + newbornVisit.setPid(babyModel.getPid()); | |
90 | + } | |
87 | 91 | mongoTemplate.save(newbornVisit); |
88 | 92 | return RespBuilder.buildSuccess(newbornVisit.getId()); |
89 | 93 | } else { |
90 | 94 | |
... | ... | @@ -149,14 +153,18 @@ |
149 | 153 | } |
150 | 154 | if(StringUtils.isNotBlank(key)) { |
151 | 155 | Criteria c = new Criteria(); |
152 | - mongoUtil.findField(PersonModel.class, c, "id"); | |
156 | + c.orOperator(Criteria.where("mphone").is(key), Criteria.where("name").regex(key), Criteria.where("mcertNo").is(key)).and("yn").ne(0); | |
157 | + List<BabyModel> babyModels = mongoUtil.findField(BabyModel.class, c, "id"); | |
158 | + if(CollectionUtils.isNotEmpty(babyModels)) { | |
159 | + List<String> babyIds = CollectionUtils.getId(babyModels, "id", String.class); | |
160 | + criteria.and("babyId").in(babyIds); | |
161 | + } | |
153 | 162 | } |
154 | 163 | PageResult pageResult = findMongoPage(NewbornVisit.class, new Query(criteria), page, limit); |
155 | 164 | List<NewbornVisit> newbornVisits = (List<NewbornVisit>) pageResult.getGrid(); |
156 | 165 | List<Map<String, Object>> restMap = new ArrayList<>(); |
157 | 166 | for (NewbornVisit visit : newbornVisits) { |
158 | 167 | Map<String, Object> temp = new HashMap<>(); |
159 | - | |
160 | 168 | temp.put("checkTime", visit.getCheckTime() == null ? null : DateUtil.getyyyy_MM_dd(visit.getCheckTime())); // 复查访视时间 |
161 | 169 | String pid = visit.getPid(); |
162 | 170 | if(StringUtils.isNotBlank(pid)) { |
163 | 171 | |
164 | 172 | |
165 | 173 | |
166 | 174 | |
... | ... | @@ -167,19 +175,29 @@ |
167 | 175 | temp.put("age", DateUtil.getAge(person.getBirth())); |
168 | 176 | temp.put("phone", person.getPhone()); |
169 | 177 | } |
170 | - Patients patients = mongoTemplate.findById(visit.getParentId(), Patients.class); | |
178 | + } | |
179 | + BabyModel babyModel = mongoTemplate.findById(visit.getBabyId(), BabyModel.class); | |
180 | + if(babyModel != null) { | |
181 | + Patients patients = mongoTemplate.findById(babyModel.getParentId(), Patients.class); | |
171 | 182 | if(patients != null) { |
172 | 183 | int days = DateUtil.daysBetween(patients.getFmDate(), new Date()); |
173 | - temp.put("days", "产后"+days+"天"); | |
184 | + temp.put("days", days); | |
174 | 185 | } |
175 | - temp.put("count", mongoTemplate.count(new Query(criteria), NewbornVisit.class)); | |
176 | - temp.put("benyuan", mongoTemplate.count(new Query(criteria.and("visitHositalId").is(hospitalId)), NewbornVisit.class)); | |
177 | - restMap.add(temp); | |
178 | - // Users users = mapper.getUsers(Integer.parseInt(visit.getDoctor())); | |
179 | -// temp.put("doctorName", users == null ? null : users.getName()); | |
180 | 186 | } |
181 | - | |
187 | + List<NewbornVisit> nvs = mongoTemplate.find(new Query(criteria), NewbornVisit.class); | |
188 | + temp.put("count", nvs.size()); | |
189 | + int benyuan = 0; | |
190 | + for (NewbornVisit nv : nvs) { | |
191 | + if(hospitalId.equals(nv.getVisitHospitalId())) { | |
192 | + benyuan++; | |
193 | + } | |
194 | + } | |
195 | + temp.put("benyuan", benyuan); | |
196 | + restMap.add(temp); | |
197 | + String doctorName = mapper.getUserName(visit.getDoctor()); | |
198 | + temp.put("doctorName", doctorName); | |
182 | 199 | } |
200 | + | |
183 | 201 | return RespBuilder.buildSuccess(restMap); |
184 | 202 | } |
185 | 203 |