Commit b6fdf33050a82688d80ec2347981cdb3aed49900

Authored by shiyang
1 parent b83590c296

update

Showing 1 changed file with 53 additions and 48 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java View file @ b6fdf33
... ... @@ -3220,10 +3220,6 @@
3220 3220 babyQuery.setYn(YnEnums.YES.getId());
3221 3221 }
3222 3222  
3223   -
3224   - if (isPage) {
3225   - babyQuery.setNeed("true");
3226   - }
3227 3223 babyQuery.setMcertNo(request.getMcardNo());
3228 3224 babyQuery.setCardNo(request.getBcardNo());
3229 3225 babyQuery.setName(request.getName());
... ... @@ -3332,10 +3328,6 @@
3332 3328 babyQuery.setBuildDoctor(request.getBuildDoctor());
3333 3329 }
3334 3330  
3335   -
3336   - babyQuery.setPage(request.getPage());
3337   - babyQuery.setLimit(request.getLimit());
3338   -
3339 3331 //0 非高危 1 高危 2 全部 3、体弱儿
3340 3332 if (request.getHighRiskType() != null) {
3341 3333 if (request.getHighRiskType() == 1) {//高危
3342 3334  
... ... @@ -3397,11 +3389,11 @@
3397 3389 final String heartMurmur=request.getHeartMurmur();
3398 3390 final Integer cyNumType=request.getCyNumType();
3399 3391 final Integer qcNumType=request.getQcNumType();
3400   - List<BabyModel> list=babyBookBuildingDao.queryBabyWithQuery(babyQuery.convertToQuery());
  3392 + List<BabyModel> list=babyBookbuildingService.queryBabyBuildByCond(babyQuery);
  3393 + Set<String> data = new HashSet<>();
3401 3394 int batchSize = 20;
3402 3395 int end = 0;
3403 3396 List <Future> listFuture = new ArrayList <>();
3404   - final Set<String> idset=new HashSet<>();
3405 3397 for (int i = 0; i < list.size(); i += batchSize) {
3406 3398 end = (end + batchSize);
3407 3399 if (end > list.size()) {
3408 3400  
3409 3401  
3410 3402  
3411 3403  
3412 3404  
3413 3405  
3414 3406  
... ... @@ -3411,55 +3403,68 @@
3411 3403 listFuture.add(commonThreadPool.submit(new Callable() {
3412 3404 @Override
3413 3405 public Object call() throws Exception {
3414   - for (BabyModel risk : risks) {
3415   - Query query = new Query();
3416   - query.addCriteria(Criteria.where("id").is(risk.getId()));
3417   - if(StringUtils.isNotEmpty(mildAnaemia)){
3418   - query.addCriteria(Criteria.where("mildAnaemia").is(mildAnaemia));
3419   - }
3420   - if(StringUtils.isNotEmpty(moderateAnaemia)){
3421   - query.addCriteria(Criteria.where("moderateAnaemia").is(moderateAnaemia));
3422   - }
3423   - if(StringUtils.isNotEmpty(heartMurmur)){
3424   - query.addCriteria(Criteria.where("heartMurmur").is(heartMurmur));
3425   - }
3426   - if(null!=cyNumType){
3427   - if(cyNumType==1){//正常
3428   - Criteria criteria = new Criteria();
3429   - Criteria criteria1= Criteria.where("cyNumType").is(cyNumType);
3430   - Criteria criteria2= Criteria.where("cyNumType").exists(false);
3431   - criteria.orOperator(criteria2,criteria1);
3432   - query.addCriteria(criteria1);//如需兼容历史数据用criteria。没有该字段的暂时默认正常
  3406 + if (CollectionUtils.isNotEmpty(risks)) {
  3407 + Set<String> ids=new HashSet<>();
  3408 + for (BabyModel risk : risks) {
  3409 + Query query = new Query();
  3410 + query.addCriteria(Criteria.where("buildId").is(risk.getId()));
  3411 + if (StringUtils.isNotEmpty(mildAnaemia)) {
  3412 + query.addCriteria(Criteria.where("mildAnaemia").is(mildAnaemia));
3433 3413 }
3434   - if(cyNumType==2){//异常
3435   - query.addCriteria(Criteria.where("cyNumType").is(cyNumType));
  3414 + if (StringUtils.isNotEmpty(moderateAnaemia)) {
  3415 + query.addCriteria(Criteria.where("moderateAnaemia").is(moderateAnaemia));
3436 3416 }
3437   - }
3438   - if(null!=qcNumType){
3439   - if(qcNumType==2){//异常
3440   - //字符串判断大小
3441   - String formatQcNum = String.format("function() {\n" +
3442   - " return this.qcNum > %s \n" +
3443   - " }","0");
3444   - query.addCriteria(Criteria.where("$where").is(formatQcNum));
  3417 + if (StringUtils.isNotEmpty(heartMurmur)) {
  3418 + query.addCriteria(Criteria.where("heartMurmur").is(heartMurmur));
3445 3419 }
3446   - }
  3420 + if (null != cyNumType) {
  3421 + if (cyNumType == 1) {//正常
  3422 + Criteria criteria = new Criteria();
  3423 + Criteria criteria1 = Criteria.where("cyNumType").is(cyNumType);
  3424 + Criteria criteria2 = Criteria.where("cyNumType").exists(false);
  3425 + criteria.orOperator(criteria2, criteria1);
  3426 + query.addCriteria(criteria1);//如需兼容历史数据用criteria。没有该字段的暂时默认正常
  3427 + }
  3428 + if (cyNumType == 2) {//异常
  3429 + query.addCriteria(Criteria.where("cyNumType").is(cyNumType));
  3430 + }
  3431 + }
  3432 + if (null != qcNumType) {
  3433 + if (qcNumType == 2) {//异常
  3434 + //字符串判断大小
  3435 + String formatQcNum = String.format("function() {\n" +
  3436 + " return this.qcNum > %s \n" +
  3437 + " }", "0");
  3438 + query.addCriteria(Criteria.where("$where").is(formatQcNum));
  3439 + }
  3440 + }
3447 3441  
3448   - final BabyCheckModel checkModel = mongoTemplate.findOne(query, BabyCheckModel.class);
3449   - if(null!=checkModel){
3450   - idset.add(checkModel.getBuildId());
  3442 + BabyCheckModel checkModel = mongoTemplate.findOne(query, BabyCheckModel.class);
  3443 + if (null != checkModel) {
  3444 + ids.add(checkModel.getBuildId());
  3445 + }
3451 3446 }
  3447 + return ids;
3452 3448 }
3453 3449 return null;
3454 3450 }
3455 3451 }));
3456 3452 }
3457   - BabyModelQuery babyQuery2=new BabyModelQuery();
3458   - babyQuery2.setPage(request.getPage());
3459   - babyQuery2.setLimit(request.getLimit());
3460   - babyQuery2.setIds(new ArrayList(idset));
3461   - babyQuery=babyQuery2;
  3453 + for (Future f : listFuture) {
  3454 + try {
  3455 + data.addAll((Set) f.get(30, TimeUnit.SECONDS));
  3456 + } catch (Exception e) {
  3457 + ExceptionUtils.catchException(e, "convertToQuanPatient get result Future error.");
  3458 + }
  3459 + }
  3460 + babyQuery.setIds(new ArrayList(data));
3462 3461 }
  3462 + //分页
  3463 + if (isPage) {
  3464 + babyQuery.setNeed("true");
  3465 + }
  3466 + babyQuery.setPage(request.getPage());
  3467 + babyQuery.setLimit(request.getLimit());
3463 3468 List <BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery, "created", Sort.Direction.DESC);
3464 3469  
3465 3470 return models;