Commit 9ea1a1d96bf0a09edb89bc47d6bfd9af521f2b23
1 parent
7aa0f89868
Exists in
master
and in
6 other branches
公共卫生统计
Showing 2 changed files with 92 additions and 33 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AreaCountController.java
View file @
9ea1a1d
| ... | ... | @@ -527,6 +527,30 @@ |
| 527 | 527 | patientSyncMysqlFacade.getPublicHygieneServiceCountExport(provinceId,cityId,areaId,streetId,dateTime,response); |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | + | |
| 531 | + /** | |
| 532 | + * 本月活产 和 累计活产数 | |
| 533 | + * @param request | |
| 534 | + * @param page | |
| 535 | + * @param limit | |
| 536 | + * @param areaId | |
| 537 | + * @param streetId | |
| 538 | + * @param dateTime | |
| 539 | + * @return | |
| 540 | + */ | |
| 541 | + @RequestMapping(method = RequestMethod.GET, value = "/getBabyFmList") | |
| 542 | + @ResponseBody | |
| 543 | + @TokenRequired | |
| 544 | + public BaseResponse getBabyFmList(HttpServletRequest request, | |
| 545 | + Integer page, Integer limit, | |
| 546 | + @RequestParam String areaId, | |
| 547 | + @RequestParam( required = false) String streetId, | |
| 548 | + @RequestParam Integer type, // 1本月活产 2累计活产 | |
| 549 | + @RequestParam Date dateTime) { | |
| 550 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 551 | + return patientSyncMysqlFacade.getBabyFmList(page,limit,areaId,streetId,dateTime,type); | |
| 552 | + } | |
| 553 | + | |
| 530 | 554 | /** |
| 531 | 555 | * 公共卫生项目统计 中医指导明细 |
| 532 | 556 | * @param request |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java
View file @
9ea1a1d
| ... | ... | @@ -3256,43 +3256,39 @@ |
| 3256 | 3256 | Date startDateFirst=DateUtil.getYearFirst(DateUtil.getYear(startDate)); |
| 3257 | 3257 | DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0 |
| 3258 | 3258 | //本月活产数 |
| 3259 | - int data1=0; | |
| 3260 | -// for (int i=1;i<=7;i++){//多胎情况 | |
| 3261 | - MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
| 3262 | - matDeliverQuery.setHospitalId(hospitalId); | |
| 3263 | - matDeliverQuery.setYn(YnEnums.YES.getId()); | |
| 3264 | -// matDeliverQuery.setTireNumber(i); | |
| 3265 | - matDeliverQuery.setCreatedStart(startDate); | |
| 3266 | - matDeliverQuery.setEndStart(endDate); | |
| 3267 | - data1+=matDeliverService.count(matDeliverQuery);//*i | |
| 3268 | -// } | |
| 3259 | + int data1= (int)mongoTemplate.count(new Query(Criteria. | |
| 3260 | + where("yn").is(1) | |
| 3261 | + .and("baby.pregnancyOut").is("0").and("hospitalId").is(hospitalId) | |
| 3262 | + .and("dueDate1").gte(startDate).lte(endDate)),MaternalDeliverModel.class); | |
| 3263 | + | |
| 3269 | 3264 | int lastDate1= null==hospitalDate.get("data1")?0:Integer.parseInt(hospitalDate.get("data1").toString()); |
| 3270 | 3265 | hospitalDate.put("data1",data1+lastDate1); |
| 3271 | 3266 | //累计活产数 |
| 3272 | - int data2=0; | |
| 3273 | -// for (int i=1;i<=7;i++){//多胎情况 | |
| 3274 | - MatDeliverQuery matDeliverQuery2 = new MatDeliverQuery(); | |
| 3275 | - matDeliverQuery2.setHospitalId(hospitalId); | |
| 3276 | - matDeliverQuery2.setYn(YnEnums.YES.getId()); | |
| 3277 | -// matDeliverQuery.setTireNumber(i); | |
| 3278 | - matDeliverQuery2.setCreatedStart(startDateFirst); | |
| 3279 | - matDeliverQuery2.setEndStart(endDate); | |
| 3280 | - data2+=matDeliverService.count(matDeliverQuery2);//*i; | |
| 3281 | -// } | |
| 3267 | + int data2 = (int)mongoTemplate.count(new Query(Criteria. | |
| 3268 | + where("yn").is(1) | |
| 3269 | + .and("baby.pregnancyOut").is("0").and("hospitalId").is(hospitalId) | |
| 3270 | + .and("dueDate1").lte(endDate)),MaternalDeliverModel.class); | |
| 3271 | + | |
| 3282 | 3272 | int lastDate2= null==hospitalDate.get("data2")?0:Integer.parseInt(hospitalDate.get("data2").toString()); |
| 3283 | 3273 | hospitalDate.put("data2",data2+lastDate2); |
| 3284 | - //新生儿访视人数 | |
| 3285 | - int data3=0; | |
| 3286 | - AggregationOperation match = Aggregation.match(Criteria. | |
| 3287 | - where("hospitalId").is(hospitalId) | |
| 3288 | - .and("yn").is("1") | |
| 3289 | - .and("created").gte(startDateFirst).lte(endDate)); | |
| 3290 | - AggregationOperation group = Aggregation.group("babyId"); | |
| 3291 | - Aggregation aggregation= Aggregation.newAggregation(match, group); | |
| 3292 | - AggregationResults<HashMap> result = mongoTemplate.aggregate(aggregation,"lyms_newborn_visit", HashMap.class); | |
| 3293 | - data3=result.getMappedResults().size(); | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + //本月新生儿访视人数 | |
| 3277 | + int data26 = (int)mongoTemplate.count(new Query(Criteria. | |
| 3278 | + where("yn").is("1") | |
| 3279 | + .and("hospitalId").is(hospitalId) | |
| 3280 | + .and("checkTime").gte(startDate).lte(endDate)),NewbornVisit.class); | |
| 3281 | + int lastDate26= null==hospitalDate.get("data26")?0:Integer.parseInt(hospitalDate.get("data26").toString()); | |
| 3282 | + hospitalDate.put("data26",data26+lastDate26); | |
| 3283 | + | |
| 3284 | + //累计新生儿访视人数 | |
| 3285 | + int data3 = (int)mongoTemplate.count(new Query(Criteria. | |
| 3286 | + where("yn").is("1") | |
| 3287 | + .and("hospitalId").is(hospitalId) | |
| 3288 | + .and("checkTime").lte(endDate)),NewbornVisit.class); | |
| 3294 | 3289 | int lastDate3= null==hospitalDate.get("data3")?0:Integer.parseInt(hospitalDate.get("data3").toString()); |
| 3295 | 3290 | hospitalDate.put("data3",data3+lastDate3); |
| 3291 | + | |
| 3296 | 3292 | //新生儿访视率% |
| 3297 | 3293 | String data3_data2="0.00"; |
| 3298 | 3294 | if(Integer.parseInt(hospitalDate.get("data2").toString())!=0){ |
| ... | ... | @@ -3304,6 +3300,7 @@ |
| 3304 | 3300 | } |
| 3305 | 3301 | } |
| 3306 | 3302 | hospitalDate.put("data4",data3_data2+"%"); |
| 3303 | + | |
| 3307 | 3304 | //0-3岁儿童总数 |
| 3308 | 3305 | int data5=0; |
| 3309 | 3306 | BabyModelQuery babyQuery=new BabyModelQuery(); |
| 3310 | 3307 | |
| 3311 | 3308 | |
| 3312 | 3309 | |
| 3313 | 3310 | |
| 3314 | 3311 | |
| 3315 | 3312 | |
| ... | ... | @@ -3384,21 +3381,31 @@ |
| 3384 | 3381 | } |
| 3385 | 3382 | } |
| 3386 | 3383 | hospitalDate.put("data14",data13_data8+"%"); |
| 3384 | + | |
| 3387 | 3385 | //孕13周之前建册的人数 |
| 3388 | - int data15=0; | |
| 3389 | 3386 | PatientsQuery patientsQuery=new PatientsQuery(); |
| 3390 | 3387 | patientsQuery.setYn(YnEnums.YES.getId()); |
| 3391 | 3388 | patientsQuery.setHospitalId(hospitalId); |
| 3389 | + patientsQuery.setBuildDaysStart(0); | |
| 3392 | 3390 | patientsQuery.setBuildDaysEnd(13*7); |
| 3391 | + patientsQuery.setExtEnable(false); | |
| 3392 | + patientsQuery.setBuildTypeNot(1); | |
| 3393 | 3393 | patientsQuery.setBookbuildingDateStart(startDateFirst); |
| 3394 | 3394 | patientsQuery.setBookbuildingDateEnd(endDate); |
| 3395 | - data15=patientsService.queryPatientCount(patientsQuery); | |
| 3395 | + int data15 = patientsService.queryPatientCount(patientsQuery); | |
| 3396 | 3396 | int lastDate15= null==hospitalDate.get("data15")?0:Integer.parseInt(hospitalDate.get("data15").toString()); |
| 3397 | 3397 | hospitalDate.put("data15",data15+lastDate15); |
| 3398 | 3398 | //早孕建册率% |
| 3399 | + | |
| 3400 | + patientsQuery.setBuildDaysStart(null); | |
| 3401 | + patientsQuery.setBuildDaysEnd(null); | |
| 3402 | + patientsQuery.setBookbuildingDateStart(startDateFirst); | |
| 3403 | + patientsQuery.setBookbuildingDateEnd(endDate); | |
| 3404 | + int buildCount = patientsService.queryPatientCount(patientsQuery); | |
| 3399 | 3405 | String data15_data2="0.00"; |
| 3400 | 3406 | if(Integer.parseInt(hospitalDate.get("data2").toString())!=0){ |
| 3401 | - float v = (float) Integer.parseInt(hospitalDate.get("data15").toString()) / Integer.parseInt(hospitalDate.get("data2").toString()); | |
| 3407 | + float v = (float) Integer.parseInt(hospitalDate.get("data15").toString()) / | |
| 3408 | + buildCount; | |
| 3402 | 3409 | if(v>=1){ |
| 3403 | 3410 | data15_data2="100.00"; |
| 3404 | 3411 | }else { |
| ... | ... | @@ -3507,6 +3514,7 @@ |
| 3507 | 3514 | cnames.put("streetName", "乡镇"); |
| 3508 | 3515 | cnames.put("data1", "本月活产数"); |
| 3509 | 3516 | cnames.put("data2", "累计活产数"); |
| 3517 | + cnames.put("data26", "本月新生儿访视人数"); | |
| 3510 | 3518 | cnames.put("data3", "新生儿访视人数"); |
| 3511 | 3519 | cnames.put("data4", "新生儿访视率%"); |
| 3512 | 3520 | cnames.put("data5", "0-3岁儿童总数"); |
| ... | ... | @@ -3592,6 +3600,33 @@ |
| 3592 | 3600 | } |
| 3593 | 3601 | return RespBuilder.buildSuccess(null); |
| 3594 | 3602 | |
| 3603 | + } | |
| 3604 | + | |
| 3605 | + public BaseResponse getBabyFmList(Integer page, Integer limit, String areaId, String streetId, Date dateTime, Integer type) { | |
| 3606 | + //获得区县下的街道 | |
| 3607 | + List<BasicConfig> regions = getRegions(areaId,streetId); | |
| 3608 | + List<String> hospitalIds = new ArrayList<>(); | |
| 3609 | + for (BasicConfig region : regions) { | |
| 3610 | + //获得街道下的医院 | |
| 3611 | + List<Organization> organizations = getOrganization(region.getId()); | |
| 3612 | + for (Organization organization : organizations) { | |
| 3613 | + String hospitalId= StringUtils.getIntToVal(organization.getId()); | |
| 3614 | + hospitalIds.add(hospitalId); | |
| 3615 | + } | |
| 3616 | + } | |
| 3617 | + Date startDate=DateUtil.getDateMonthFirst(dateTime); | |
| 3618 | + Date endDate=DateUtil.getDayLastSecond(DateUtil.getDateMonthLast(dateTime)); | |
| 3619 | + if (CollectionUtils.isNotEmpty(hospitalIds)) | |
| 3620 | + { | |
| 3621 | + //本月活产数 | |
| 3622 | + Query query = new Query(Criteria. | |
| 3623 | + where("yn").is(1) | |
| 3624 | + .and("baby.pregnancyOut").is("0").and("hospitalId").in(hospitalIds) | |
| 3625 | + .and("dueDate1").gte(startDate).lte(endDate)); | |
| 3626 | + List<MaternalDeliverModel> datas = mongoTemplate.find(query,MaternalDeliverModel.class); | |
| 3627 | + System.out.println(datas); | |
| 3628 | + } | |
| 3629 | + return null; | |
| 3595 | 3630 | } |
| 3596 | 3631 | } |