Commit 3d5c494c19af35ada97872067c587b51555e43b9
1 parent
b31bd109b2
Exists in
master
and in
6 other branches
update
Showing 6 changed files with 99 additions and 10 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java
- 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-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.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/PostkfFaccade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java
View file @
3d5c494
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java
View file @
3d5c494
| ... | ... | @@ -53,6 +53,15 @@ |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | @Override |
| 56 | + public List<HashMap> queryPatientAnxtchuCount(MongoQuery query) { | |
| 57 | + AggregationOperation match = Aggregation.match(query.getCriteria()); | |
| 58 | + AggregationOperation group = Aggregation.group("firstCheckId").count().as("count"); | |
| 59 | + Aggregation aggregation = Aggregation.newAggregation(match, group); | |
| 60 | + AggregationResults<HashMap> result = mongoTemplate.aggregate(aggregation, "lyms_patient", HashMap.class); | |
| 61 | + return result.getMappedResults(); | |
| 62 | + } | |
| 63 | + | |
| 64 | + @Override | |
| 56 | 65 | public void updatePatientLastCheckEmployeeIdOne(String id, String lastCheckEmployeeId){ |
| 57 | 66 | this.mongoTemplate.updateFirst(new Query(Criteria.where("id").is(id)), Update.update("lastCheckEmployeeId", lastCheckEmployeeId), Patients.class); |
| 58 | 67 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
View file @
3d5c494
| ... | ... | @@ -21,10 +21,7 @@ |
| 21 | 21 | import org.springframework.data.mongodb.core.query.Query; |
| 22 | 22 | import org.springframework.stereotype.Service; |
| 23 | 23 | |
| 24 | -import java.util.Arrays; | |
| 25 | -import java.util.Date; | |
| 26 | -import java.util.List; | |
| 27 | -import java.util.Map; | |
| 24 | +import java.util.*; | |
| 28 | 25 | |
| 29 | 26 | /** |
| 30 | 27 | * Created by Administrator on 2016/4/22 0022. |
| ... | ... | @@ -129,6 +126,10 @@ |
| 129 | 126 | return iPatientDao.queryPatient(query.addOrder(Sort.Direction.fromString(sort), field)); |
| 130 | 127 | } |
| 131 | 128 | |
| 129 | + | |
| 130 | + public List<HashMap> queryPatientAnxtchuCount(PatientsQuery patientsQuery) { | |
| 131 | + return iPatientDao.queryPatientAnxtchuCount(patientsQuery.convertToQuery()); | |
| 132 | + } | |
| 132 | 133 | |
| 133 | 134 | public int queryPatientCount(PatientsQuery patientsQuery) { |
| 134 | 135 | return iPatientDao.queryPatientCount(patientsQuery.convertToQuery()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java
View file @
3d5c494
| ... | ... | @@ -159,6 +159,27 @@ |
| 159 | 159 | return patientFacade.queryHighRisk(patientsQueryRequest, null, 1, loginState.getId(), "true", Boolean.FALSE); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | + | |
| 163 | + /** | |
| 164 | + * 初诊检查医生统计 | |
| 165 | + * @param patientsQueryRequest | |
| 166 | + * @param request | |
| 167 | + * @return | |
| 168 | + */ | |
| 169 | + @RequestMapping(value = "/queryAnxtchuCount", method = RequestMethod.GET) | |
| 170 | + @ResponseBody | |
| 171 | + @TokenRequired | |
| 172 | + public BaseResponse queryAnxtchuCount(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) { | |
| 173 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 174 | + | |
| 175 | + | |
| 176 | + return patientFacade.queryAnxtchuCount(patientsQueryRequest, null, 1, loginState.getId(), "true", Boolean.FALSE); | |
| 177 | + } | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 162 | 183 | /** |
| 163 | 184 | * 孕期体重异常管理 |
| 164 | 185 | * @param patientsQueryRequest 全部孕妇管理查询 (因为请求参数一样同用一个对象) |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
3d5c494
| ... | ... | @@ -3210,5 +3210,67 @@ |
| 3210 | 3210 | |
| 3211 | 3211 | @Autowired |
| 3212 | 3212 | private CouponService couponService; |
| 3213 | + | |
| 3214 | + public BaseResponse queryAnxtchuCount(RiskPatientsQueryRequest riskPatientsQueryRequest, Boolean isHighRisk, Integer type, Integer userId, String needPage, boolean isRegion) { | |
| 3215 | + PatientsQuery patientsQuery = complayRequest(riskPatientsQueryRequest, isHighRisk, type, userId, needPage, isRegion); | |
| 3216 | + patientsQuery.setGcdfDoctorId(riskPatientsQueryRequest.getGcdfDoctorId());//分娩记录加住院管床大夫 | |
| 3217 | + | |
| 3218 | + if ("lp".equals(riskPatientsQueryRequest.getHstart())) { | |
| 3219 | + if ("1".equals(riskPatientsQueryRequest.getYyzt())) { | |
| 3220 | + //获取有检查数据 | |
| 3221 | + patientsQuery.setNextCheckTimeNe(true); | |
| 3222 | + } else if ("2".equals(riskPatientsQueryRequest.getYyzt())) { | |
| 3223 | + //获取没有有检查数据 | |
| 3224 | + patientsQuery.setNextCheckTimeIs(true); | |
| 3225 | + patientsQuery.setNextCheckTimeNe(false); | |
| 3226 | + } | |
| 3227 | + } | |
| 3228 | + System.out.println(patientsQuery.convertToQuery().convertToMongoQuery().toString()); | |
| 3229 | + List<HashMap> temp = patientsService.queryPatientAnxtchuCount(patientsQuery); | |
| 3230 | + List<Map<String,String>> datas = new ArrayList<>(); | |
| 3231 | + if (CollectionUtils.isNotEmpty(temp)) | |
| 3232 | + { | |
| 3233 | + for (HashMap map : temp) | |
| 3234 | + { | |
| 3235 | + if (map.get("_id") == null) | |
| 3236 | + { | |
| 3237 | + continue; | |
| 3238 | + } | |
| 3239 | + Map<String,String> data = new HashMap<>(); | |
| 3240 | + String firstCheckDoctorName = usersService.getUsers(Integer.valueOf(map.get("_id").toString())).getName(); | |
| 3241 | + data.put("firstCheckDoctorName",firstCheckDoctorName); | |
| 3242 | + data.put("firstCheckDoctorId",map.get("_id") == null ? null : map.get("_id").toString()); | |
| 3243 | + data.put("count",map.get("count").toString()); | |
| 3244 | + datas.add(data); | |
| 3245 | + } | |
| 3246 | + } | |
| 3247 | + // 排序,这里数据量并不大,所以可以在这里排序,排序规则为按照count倒序 | |
| 3248 | + Collections.sort(datas, new Comparator<Map<String,String>>() { | |
| 3249 | + @Override | |
| 3250 | + public int compare(Map<String,String> o1, Map<String,String> o2) { | |
| 3251 | + int i1; | |
| 3252 | + int i2; | |
| 3253 | + try { | |
| 3254 | + i1 = Integer.valueOf(o1.get("count")); | |
| 3255 | + } catch (Exception e) { | |
| 3256 | + i1 = 0; | |
| 3257 | + } | |
| 3258 | + try { | |
| 3259 | + i2 = Integer.valueOf(o2.get("count")); | |
| 3260 | + } catch (Exception e) { | |
| 3261 | + i2 = 0; | |
| 3262 | + } | |
| 3263 | + if (i1 > i2) { | |
| 3264 | + return -1; | |
| 3265 | + } else if (i1 < i2) { | |
| 3266 | + return 1; | |
| 3267 | + } else { | |
| 3268 | + return 0; | |
| 3269 | + } | |
| 3270 | + } | |
| 3271 | + }); | |
| 3272 | + | |
| 3273 | + return new BaseObjectResponse().setData(datas).setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 3274 | + } | |
| 3213 | 3275 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostkfFaccade.java
View file @
3d5c494
| ... | ... | @@ -281,12 +281,6 @@ |
| 281 | 281 | Criteria.where("zzjj.ch28tdoctor").is(postKfRequest.getDoctorName()), |
| 282 | 282 | Criteria.where("zzjj.ch24tdoctor").is(postKfRequest.getDoctorName()), |
| 283 | 283 | |
| 284 | - Criteria.where("zzjj.cyqpgdoctor").is(postKfRequest.getDoctorName()), | |
| 285 | - Criteria.where("zzjj.ch7tdoctor").is(postKfRequest.getDoctorName()), | |
| 286 | - Criteria.where("zzjj.ch14tdoctor").is(postKfRequest.getDoctorName()), | |
| 287 | - Criteria.where("zzjj.ch28tdoctor").is(postKfRequest.getDoctorName()), | |
| 288 | - Criteria.where("zzjj.ch24tdoctor").is(postKfRequest.getDoctorName()), | |
| 289 | - | |
| 290 | 284 | Criteria.where("jbzl.cyqpgdoctor").is(postKfRequest.getDoctorName()), |
| 291 | 285 | Criteria.where("jbzl.ch7tdoctor").is(postKfRequest.getDoctorName()), |
| 292 | 286 | Criteria.where("jbzl.ch14tdoctor").is(postKfRequest.getDoctorName()), |