Commit b31eed335ae7d051ab4e1beae6341e39200cea89

Authored by liquanyu
1 parent 6d2f4b12fc

公共卫生统计

Showing 2 changed files with 100 additions and 88 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ b31eed3
... ... @@ -40,6 +40,7 @@
40 40 import org.apache.commons.collections.CollectionUtils;
41 41 import org.apache.commons.io.FileUtils;
42 42 import org.apache.commons.lang.StringUtils;
  43 +import org.aspectj.weaver.ast.Or;
43 44 import org.springframework.beans.factory.annotation.Autowired;
44 45 import org.springframework.beans.factory.annotation.Qualifier;
45 46 import org.springframework.data.domain.Sort;
46 47  
47 48  
48 49  
49 50  
50 51  
51 52  
52 53  
53 54  
54 55  
55 56  
56 57  
57 58  
58 59  
59 60  
... ... @@ -5354,104 +5355,117 @@
5354 5355 e.printStackTrace();
5355 5356 }
5356 5357 }
  5358 + private static List<Integer> allMonths = new LinkedList();
  5359 + static
  5360 + {
  5361 + allMonths.add(1);
  5362 + allMonths.add(3);
  5363 + allMonths.add(6);
  5364 + allMonths.add(8);
  5365 + allMonths.add(12);
  5366 + allMonths.add(18);
  5367 + allMonths.add(24);
  5368 + allMonths.add(30);
  5369 + allMonths.add(36);
  5370 + allMonths.add(48);
  5371 + allMonths.add(60);
  5372 + allMonths.add(72);
  5373 + }
5357 5374  
5358 5375  
  5376 + /**
  5377 + * 更新儿童是否按照 月龄检查套餐完成检查
  5378 + * @param hid
  5379 + * @param cityId
  5380 + * @param areaId
  5381 + * @param streetId
  5382 + * @return
  5383 + */
5359 5384 @RequestMapping(value = "/updateBabyCompleteCheck", method = RequestMethod.GET)
5360 5385 @ResponseBody
5361   - public String updateBabyCompleteCheck(@RequestParam(required = true) String hid) {
  5386 + public String updateBabyCompleteCheck(@RequestParam(required = false) Integer hid,
  5387 + @RequestParam(required = false) String cityId,
  5388 + @RequestParam(required = false) String areaId,
  5389 + @RequestParam(required = false) String streetId
  5390 + ) {
  5391 + OrganizationQuery organizationQuery = new OrganizationQuery();
  5392 + organizationQuery.setCityId(cityId);
  5393 + organizationQuery.setAreaId(areaId);
  5394 + organizationQuery.setStreetId(streetId);
  5395 + organizationQuery.setId(hid);
  5396 + List<Organization> organizations = organizationService.queryHospitals(organizationQuery);
  5397 + if (CollectionUtils.isNotEmpty(organizations))
  5398 + {
  5399 + for (Organization org : organizations)
  5400 + {
5362 5401  
  5402 + BabyModelQuery babyModelQuery = new BabyModelQuery();
  5403 + babyModelQuery.setYn(YnEnums.YES.getId());
  5404 + babyModelQuery.setId(org.getId()+"");
  5405 + babyModelQuery.setLastCheckDoctor2(true);
5363 5406  
5364   - BabyModelQuery babyModelQuery = new BabyModelQuery();
5365   - babyModelQuery.setYn(YnEnums.YES.getId());
5366   - babyModelQuery.setId(hid);
5367   - babyModelQuery.setLastCheckDoctor2(true);
  5407 + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
  5408 + System.out.println("updateBabyCompleteCheck="+org.getName()+"; babysize = "+models.size());
  5409 + if (CollectionUtils.isNotEmpty(models)) {
  5410 + for (BabyModel babyModel : models) {
  5411 + if (babyModel != null) {
  5412 + BabyCheckModelQuery query = new BabyCheckModelQuery();
  5413 + query.setYn(YnEnums.YES.getId());
  5414 + query.setBuildId(babyModel.getId());
5368 5415  
5369   - final List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
5370   - if (CollectionUtils.isNotEmpty(models)) {
5371   - int batchSize = 200;
5372   - int end = 0;
5373   - for (int i = 0; i < models.size(); i += batchSize) {
5374   - end = (end + batchSize);
5375   - if (end > models.size()) {
5376   - end = models.size();
5377   - }
5378   - System.out.println("start:" + i + ",end:" + end);
5379   - final List<BabyModel> tempList = models.subList(i, end);
5380   - new Thread(new Runnable() {
5381   - @Override
5382   - public void run() {
5383   - if (CollectionUtils.isNotEmpty(tempList)) {
5384   - for (BabyModel babyModel : tempList) {
5385   - if (babyModel != null) {
5386   - BabyCheckModelQuery query = new BabyCheckModelQuery();
5387   - query.setYn(YnEnums.YES.getId());
5388   - query.setBuildId(babyModel.getId());
5389   - List<Integer> allMonths = new LinkedList();
5390   - allMonths.add(1);
5391   - allMonths.add(3);
5392   - allMonths.add(6);
5393   - allMonths.add(8);
5394   - allMonths.add(12);
5395   - allMonths.add(18);
5396   - allMonths.add(24);
5397   - allMonths.add(30);
5398   - allMonths.add(36);
5399   - allMonths.add(48);
5400   - allMonths.add(60);
5401   - allMonths.add(72);
  5416 + List<Integer> checkMonths = new LinkedList();
  5417 + //当前月龄
  5418 + int currentMonth = DateUtil.getBabyAgeMonth(babyModel.getBirth(),new Date());
5402 5419  
5403   - List<Integer> checkMonths = new LinkedList();
5404   -
5405   - int checkMonth = DateUtil.getBabyAgeMonth(babyModel.getBirth(),new Date());
5406   -
5407   - for (Integer month : allMonths)
  5420 + //获取比当前月龄小于等于的套餐
  5421 + for (Integer month : allMonths)
  5422 + {
  5423 + if (month <= currentMonth)
  5424 + {
  5425 + checkMonths.add(month);
  5426 + }
  5427 + }
  5428 + //获取实际完成的套餐月龄
  5429 + List<Integer> completeCheckMonths = new LinkedList();
  5430 + List<BabyCheckModel> checkModels = babyCheckService.queryBabyCheckListRecord(query);
  5431 + if (CollectionUtils.isNotEmpty(checkModels)) {
  5432 + for (BabyCheckModel checkModel : checkModels) {
  5433 + if (checkModel.getTcType() != null)
5408 5434 {
5409   - if (month <= checkMonth)
5410   - {
5411   - checkMonths.add(month);
5412   - }
  5435 + completeCheckMonths.add(checkModel.getTcType());
5413 5436 }
5414   - List<Integer> completeCheckMonths = new LinkedList();
5415   - List<BabyCheckModel> checkModels = babyCheckService.queryBabyCheckListRecord(query);
5416   - if (CollectionUtils.isNotEmpty(checkModels)) {
5417   - for (BabyCheckModel checkModel : checkModels) {
5418   - if (checkModel.getTcType() != null)
5419   - {
5420   - completeCheckMonths.add(checkModel.getTcType());
5421   - }
5422   - }
5423   - }
5424   - if (completeCheckMonths.size() == checkMonths.size())
  5437 + }
  5438 + }
  5439 +
  5440 + int complete = 2; //表示完成
  5441 + if (completeCheckMonths.size() == checkMonths.size())
  5442 + {
  5443 + //比对每一个月龄套餐,如果有一个不相等 就不算完成
  5444 + for (int i = 0;i<completeCheckMonths.size();i++)
  5445 + {
  5446 + if (completeCheckMonths.get(i) != checkMonths.get(i))
5425 5447 {
5426   - int complete = 2;
5427   - for (int i = 0;i<completeCheckMonths.size();i++)
5428   - {
5429   - if (completeCheckMonths.get(i) != checkMonths.get(i))
5430   - {
5431   - complete = 1;
5432   - break;
5433   - }
5434   - }
5435   - if (complete == 2)
5436   - {
5437   - babyModel.setCompleteCheck(complete);
5438   - System.out.println("complete"+babyModel.getId());
5439   - babyBookbuildingService.updateBabyBuild(babyModel,babyModel.getId());
5440   - }
  5448 + complete = 1;
  5449 + break;
5441 5450 }
5442 5451 }
5443 5452 }
  5453 + else
  5454 + {
  5455 + complete = 1;
  5456 + }
  5457 + babyModel.setCompleteCheck(complete);
  5458 + if (complete == 2)
  5459 + {
  5460 + System.out.println("complete"+babyModel.getId());
  5461 + }
  5462 + babyBookbuildingService.updateBabyBuild(babyModel,babyModel.getId());
5444 5463 }
5445 5464 }
5446   - }).start();
  5465 + }
5447 5466 }
5448   -
5449 5467 }
5450   -
5451   -
5452   - return "updateBabyGrowth finish";
  5468 + return "updateBabyCompleteCheck finish";
5453 5469 }
5454   -
5455   -
5456 5470 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java View file @ b31eed3
... ... @@ -3425,16 +3425,13 @@
3425 3425 patientsQuery.setBuildTypeNot(1);
3426 3426 patientsQuery.setBookbuildingDateStart(DateUtil.addYear(new Date(),-20));
3427 3427 patientsQuery.setBookbuildingDateEnd(endDate);
  3428 + patientsQuery.setType(3); //产妇
3428 3429 int data15 = patientsService.queryPatientCount(patientsQuery);
3429 3430 int lastDate15= null==hospitalDate.get("data15")?0:Integer.parseInt(hospitalDate.get("data15").toString());
3430 3431 hospitalDate.put("data15",data15+lastDate15);
3431 3432  
3432   - //早孕建册率%
3433   - patientsQuery.setBuildDaysStart(null);
3434   - patientsQuery.setBuildDaysEnd(null);
3435 3433  
3436   - patientsQuery.setBookbuildingDateEnd(endDate);
3437   - int buildCount = patientsService.queryPatientCount(patientsQuery);
  3434 + int buildCount = data2;
3438 3435 int allBuildCount = null==hospitalDate.get("allBuildCount")?0:Integer.parseInt(hospitalDate.get("allBuildCount").toString());
3439 3436 hospitalDate.put("allBuildCount",buildCount+allBuildCount);
3440 3437 String data15_data2="0.00";
... ... @@ -3906,6 +3903,7 @@
3906 3903 patientsQuery.setBuildTypeNot(1);
3907 3904 patientsQuery.setBookbuildingDateStart(DateUtil.addYear(new Date(),-20));
3908 3905 patientsQuery.setBookbuildingDateEnd(endDate);
  3906 + patientsQuery.setType(3);
3909 3907 patientsQuery.setPage(page);
3910 3908 patientsQuery.setLimit(limit);
3911 3909 patientsQuery.setNeed("Need");