Commit c3c5c17a38412ef41e216946370eb5339f1bdac7

Authored by shiyang
1 parent 2870552d43

update

Showing 1 changed file with 40 additions and 54 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ c3c5c17
... ... @@ -4399,20 +4399,21 @@
4399 4399 //建档
4400 4400 Criteria criteria = Criteria.where("bookbuildingDate").gte(startDate).lte(endDate)
4401 4401 .and("hospitalId").is(hospitalId)
4402   - .and("yn").is(1);
  4402 + .and("yn").is(YnEnums.YES.getId());
4403 4403 List<Patients> patientsList = mongoTemplate.find(Query.query(criteria), Patients.class);
4404 4404 //初诊
4405 4405 Criteria criteria2 = Criteria.where("checkTime").gte(startDate).lte(endDate)
4406 4406 .and("hospitalId").is(hospitalId)
4407   - .and("yn").is(1);
  4407 + .and("yn").is(YnEnums.YES.getId());
4408 4408 long antExChu = mongoTemplate.count(Query.query(criteria2), AntExChuModel.class);
4409 4409 //建档且初诊(限本院)
4410 4410 List<Object> filingPids = new ArrayList<>();
4411 4411 for (Patients patients : patientsList) {
4412 4412 filingPids.add(patients.getPid());
4413 4413 }
4414   - Criteria criteria3 = Criteria.where("pid").in(CollectionUtils.isNotEmpty(filingPids)?filingPids:null)
  4414 + Criteria criteria3 = Criteria.where("pid").in(CollectionUtils.isNotEmpty(filingPids)?filingPids:"")
4415 4415 .and("hospitalId").is(hospitalId)
  4416 + .and("yn").is(YnEnums.YES.getId())
4416 4417 .and("checkTime").gte(startDate).lte(endDate);
4417 4418 long filingRoAntExChu = mongoTemplate.count(Query.query(criteria3), AntExChuModel.class);
4418 4419 //建档未初诊(包含外院初诊)
4419 4420  
4420 4421  
4421 4422  
4422 4423  
4423 4424  
4424 4425  
4425 4426  
4426 4427  
... ... @@ -4423,36 +4424,40 @@
4423 4424 for (Patients patients : antExChuNotList) {
4424 4425 antExChuNotPids.add(patients.getPid());
4425 4426 }
4426   - Criteria criteria4 = Criteria.where("pid").in(CollectionUtils.isNotEmpty(antExChuNotPids)?antExChuNotPids:null)
  4427 + Criteria criteria4 = Criteria.where("pid").in(CollectionUtils.isNotEmpty(antExChuNotPids)?antExChuNotPids:"")
4427 4428 .and("hospitalId").is(hospitalId)
  4429 + .and("yn").is(YnEnums.YES.getId())
4428 4430 .and("checkTime").gte(DateUtil.getMonthDay(startDate,1,1)).lte(DateUtil.getMonthDay(startDate,1,0));
4429 4431 long antExChuNext = mongoTemplate.count(Query.query(criteria4), AntExChuModel.class);
4430 4432 //建档未初诊-外院初诊
4431   - Criteria criteria5= Criteria.where("pid").in(CollectionUtils.isNotEmpty(antExChuNotPids)?antExChuNotPids:null)
  4433 + Criteria criteria5= Criteria.where("pid").in(CollectionUtils.isNotEmpty(antExChuNotPids)?antExChuNotPids:"")
4432 4434 .and("hospitalId").ne(hospitalId)
  4435 + .and("yn").is(YnEnums.YES.getId())
4433 4436 .and("checkTime").gte(startDate);
4434 4437 long antExChuWai = mongoTemplate.count(Query.query(criteria5), AntExChuModel.class);
4435 4438 //一直未初诊
4436   - List<Patients> filingNotAntExChuList = new ArrayList<>();
  4439 + int filingNotAntExChu= 0;
4437 4440 for (Patients patients : antExChuNotList) {
4438 4441 Criteria criteria6= Criteria.where("pid").is(patients.getPid())
  4442 + .and("hospitalId").is(hospitalId)
  4443 + .and("yn").is(YnEnums.YES.getId())
4439 4444 .and("checkTime").gte(startDate);
4440 4445 long count = mongoTemplate.count(Query.query(criteria6), AntExChuModel.class);
4441 4446 if(count==0){
4442   - filingNotAntExChuList.add(patients);
  4447 + filingNotAntExChu++;
4443 4448 }
4444 4449 }
4445 4450 //当前时间范围初诊,之前建档
4446 4451 Criteria criteria7 = Criteria.where("checkTime").gte(startDate).lte(endDate)
4447 4452 .and("hospitalId").is(hospitalId)
4448   - .and("yn").is(1);
  4453 + .and("yn").is(YnEnums.YES.getId());
4449 4454 List<AntExChuModel> antExChuBeforeFiling = mongoTemplate.find(Query.query(criteria7), AntExChuModel.class);
4450 4455 int filingBefore=0;
4451 4456 for (AntExChuModel antExChuModel : antExChuBeforeFiling) {
4452 4457 Criteria criteria8 = Criteria.where("bookbuildingDate").gte(antExChuModel.getLastMenses()).lt(startDate)
4453 4458 .and("pid").is(antExChuModel.getPid())
4454 4459 .and("hospitalId").is(hospitalId)
4455   - .and("yn").is(1);
  4460 + .and("yn").is(YnEnums.YES.getId());
4456 4461 Patients patient = mongoTemplate.findOne(Query.query(criteria8), Patients.class);
4457 4462 if(null!=patient){
4458 4463 filingBefore++;
... ... @@ -4465,7 +4470,7 @@
4465 4470 .gte(DateUtil.getMonthDay(startDate,-1,1)).lte(DateUtil.getMonthDay(startDate,-1,0))
4466 4471 .and("pid").is(antExChuModel.getPid())
4467 4472 .and("hospitalId").is(hospitalId)
4468   - .and("yn").is(1);
  4473 + .and("yn").is(YnEnums.YES.getId());
4469 4474 Patients patient = mongoTemplate.findOne(Query.query(criteria9), Patients.class);
4470 4475 if(null!=patient){
4471 4476 filingLastMonth++;
4472 4477  
... ... @@ -4478,37 +4483,27 @@
4478 4483 .gte(antExChuModel.getLastMenses()).lt(DateUtil.getMonthDay(startDate,-1,1))
4479 4484 .and("pid").is(antExChuModel.getPid())
4480 4485 .and("hospitalId").is(hospitalId)
4481   - .and("yn").is(1);
  4486 + .and("yn").is(YnEnums.YES.getId());
4482 4487 Patients patient = mongoTemplate.findOne(Query.query(criteria10), Patients.class);
4483 4488 if(null!=patient){
4484 4489 filingEarly++;
4485 4490 }
4486 4491 }
4487 4492 //当前月分娩产妇(顺产、剖腹产)
4488   - Criteria c = new Criteria();
4489   - Criteria c1= Criteria.where("deliveryMode").regex("fmfs\\\":\\\"1");
4490   - Criteria c2= Criteria.where("deliveryMode").regex("fmfs\\\":\\\"2");
4491   - criteria.orOperator(c1,c2);
4492   - Criteria criteria11 = Criteria.where("dueDate")
4493   - .gte(DateUtil.getyyyy_MM_dd(startDate)).lte(DateUtil.getyyyy_MM_dd(endDate))
4494   - .andOperator(criteria)
4495   - .and("hospitalId").is(hospitalId)
4496   - .and("yn").is(1);
4497   - long fmCount = mongoTemplate.count(Query.query(criteria11), MaternalDeliverModel.class);
4498   - //顺产
4499   - Criteria criteria12 = Criteria.where("dueDate")
4500   - .gte(DateUtil.getyyyy_MM_dd(startDate)).lte(DateUtil.getyyyy_MM_dd(endDate))
4501   - .and("deliveryMode").regex("fmfs\\\":\\\"1")
4502   - .and("hospitalId").is(hospitalId)
4503   - .and("yn").is(1);
4504   - long fmSCount = mongoTemplate.count(Query.query(criteria12), MaternalDeliverModel.class);
4505   - //剖腹产
4506   - Criteria criteria13 = Criteria.where("dueDate")
4507   - .gte(DateUtil.getyyyy_MM_dd(startDate)).lte(DateUtil.getyyyy_MM_dd(endDate))
4508   - .and("deliveryMode").regex("fmfs\\\":\\\"2")
4509   - .and("hospitalId").is(hospitalId)
4510   - .and("yn").is(1);
4511   - long fmPCount = mongoTemplate.count(Query.query(criteria13), MaternalDeliverModel.class);
  4493 + long fmSCount=0;//顺产
  4494 + long fmPCount=0;//剖腹产
  4495 + for (int i=1;i<=2;i++) {
  4496 + Criteria criteria11 = Criteria.where("birth")
  4497 + .gte(startDate).lte(endDate)
  4498 +// .and("pregnancyOut").is("0")//是否活产
  4499 + .and("dueType").is("" + i)
  4500 + .and("hospitalId").is(hospitalId)
  4501 + .and("yn").is(YnEnums.YES.getId());
  4502 + long count = mongoTemplate.count(Query.query(criteria11), BabyModel.class);
  4503 + fmSCount+=i==1?count:0;
  4504 + fmPCount+=i==2?count:0;
  4505 + }
  4506 + long fmCount=fmSCount+fmPCount;
4512 4507 //剖宫产率
4513 4508 String fmPLv="0";
4514 4509 if(fmCount!=0) {
4515 4510  
... ... @@ -4519,25 +4514,16 @@
4519 4514 //活产数
4520 4515 long boy=0;
4521 4516 long girl=0;
4522   - //男女
4523 4517 for (int i=0;i<2;i++){
4524   - //胎数
4525   - for (int j=1;j<=7;j++){
4526   - //对应胎数的孩子
4527   - for (int x=1;x<=j;x++){
4528   - Criteria criteria14 = Criteria.where("dueDate")
4529   - .gte(DateUtil.getyyyy_MM_dd(startDate)).lte(DateUtil.getyyyy_MM_dd(endDate))
4530   - .and("baby").exists(true)
4531   - .and("tireNumber").is(j)
4532   - .and("baby."+(x-1)+".pregnancyOut").is("0")
4533   - .and("baby."+(x-1)+".babyGender").is(""+i)
4534   - .and("hospitalId").is(hospitalId)
4535   - .and("yn").is(1);
4536   - long count = mongoTemplate.count(Query.query(criteria14), MaternalDeliverModel.class);
4537   - girl+=i==0?count:0;
4538   - boy+=i==1?count:0;
4539   - }
4540   - }
  4518 + Criteria criteria14 = Criteria.where("birth")
  4519 + .gte(startDate).lte(endDate)
  4520 + .and("pregnancyOut").is("0")
  4521 + .and("sex").is(i)
  4522 + .and("hospitalId").is(hospitalId)
  4523 + .and("yn").is(YnEnums.YES.getId());
  4524 + long count = mongoTemplate.count(Query.query(criteria14), BabyModel.class);
  4525 + girl+=i==0?count:0;
  4526 + boy+=i==1?count:0;
4541 4527 }
4542 4528 map.put("filing", patientsList.size());
4543 4529 map.put("antExChu", antExChu);
... ... @@ -4545,7 +4531,7 @@
4545 4531 map.put("antExChuNot", antExChuNotList.size());
4546 4532 map.put("antExChuNext", antExChuNext);
4547 4533 map.put("antExChuWai", antExChuWai);
4548   - map.put("filingNotAntExChu", filingNotAntExChuList.size());
  4534 + map.put("filingNotAntExChu", filingNotAntExChu);
4549 4535 map.put("filingBefore", filingBefore);
4550 4536 map.put("filingLastMonth", filingLastMonth);
4551 4537 map.put("filingEarly", filingEarly);