Commit b67f5b8cbd54c02498333eae79a0e189fc320ff9

Authored by shiyang
1 parent 2f2bcb35d1

美生县医院系统数据分析报告-2.1孕产妇档案管理(孕产妇数据统计)-当月建档当月未初诊-分类详情

Showing 4 changed files with 146 additions and 7 deletions

platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java View file @ b67f5b8
... ... @@ -433,7 +433,17 @@
433 433 // 0~12 孕周 16~20 孕周 21~24 孕周 28~36 孕周 37~ 分娩
434 434 // 1 表示在上面各个孕周范围内的第一次检查,2 不是
435 435 private Integer isFirst;
  436 + //外院
  437 + private String notHospitalId;
436 438  
  439 + public String getNotHospitalId() {
  440 + return notHospitalId;
  441 + }
  442 +
  443 + public void setNotHospitalId(String notHospitalId) {
  444 + this.notHospitalId = notHospitalId;
  445 + }
  446 +
437 447 public Integer getIsFirst() {
438 448 return isFirst;
439 449 }
... ... @@ -743,6 +753,9 @@
743 753  
744 754 if (null != hospitalId) {
745 755 condition = condition.and("hospitalId", hospitalId, MongoOper.IS);
  756 + }
  757 + if (null != notHospitalId) {
  758 + condition = condition.and("hospitalId", notHospitalId, MongoOper.NE);
746 759 }
747 760 if (null != hospitalList) {
748 761 condition = condition.and("hospitalId", hospitalList, MongoOper.IN);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java View file @ b67f5b8
... ... @@ -20,6 +20,7 @@
20 20 import javax.servlet.http.HttpServletRequest;
21 21 import javax.servlet.http.HttpServletResponse;
22 22 import java.util.Date;
  23 +import java.util.List;
23 24 import java.util.Map;
24 25  
25 26 /**
... ... @@ -546,7 +547,7 @@
546 547 return reportService.getAntExChuDetail(hospitalId, startDate, endDate);
547 548 }
548 549 /**
549   - * 统计管理-孕产妇数据统计-高危详情
  550 + * 统计管理-孕产妇数据统计-初诊详情-高危详情
550 551 *
551 552 * @param hospitalId
552 553 * @param startDate
... ... @@ -563,6 +564,32 @@
563 564 @RequestParam(required = true)Integer page,
564 565 @RequestParam(required = true)Integer limit) {
565 566 return reportService.getHighRiskDetail(hospitalId,riskType, startDate, endDate, page, limit);
  567 + }
  568 + /**
  569 + * 统计管理-孕产妇数据统计-建档当月未初诊-(下月初诊、外院初诊、一直未初诊)详情
  570 + *
  571 + * @param hospitalId
  572 + * @param type
  573 + * @param antExChuNotList 建档未初诊
  574 + * @param antExChuNotAlwaysList 建档一直未初诊
  575 + * @param startDate
  576 + * @param endDate
  577 + * @param page
  578 + * @param limit
  579 + * @return
  580 + */
  581 + @RequestMapping(value = "/getAntExChuNotDetail", method = RequestMethod.GET)
  582 + @ResponseBody
  583 + @TokenRequired
  584 + public BaseResponse getAntExChuNotDetail(@RequestParam(required = true)String hospitalId,
  585 + @RequestParam(required = true)Integer type,
  586 + @RequestParam(required = true)List<String> antExChuNotList,
  587 + @RequestParam(required = true)List<String> antExChuNotAlwaysList,
  588 + @RequestParam(required = true)Date startDate,
  589 + @RequestParam(required = true)Date endDate,
  590 + @RequestParam(required = true)Integer page,
  591 + @RequestParam(required = true)Integer limit) {
  592 + return reportService.getAntExChuNotDetail(hospitalId,type,antExChuNotList ,antExChuNotAlwaysList,startDate, endDate, page, limit);
566 593 }
567 594 /**
568 595 * 统计管理-孕产妇数据统计-分娩详情
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java View file @ b67f5b8
... ... @@ -5,6 +5,7 @@
5 5  
6 6 import javax.servlet.http.HttpServletResponse;
7 7 import java.util.Date;
  8 +import java.util.List;
8 9 import java.util.Map;
9 10  
10 11 /**
... ... @@ -119,5 +120,7 @@
119 120 BaseResponse getFmDetail(String hospitalId, Date startDate, Date endDate);
120 121  
121 122 BaseResponse getFmAfterEvaluate(String hospitalId,String startDate,String endDate);
  123 +
  124 + BaseResponse getAntExChuNotDetail(String hospitalId, Integer type, List<String> antExChuNotList,List<String> antExChuNotAlwaysList, Date startDate, Date endDate, Integer page, Integer limit);
122 125 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ b67f5b8
... ... @@ -106,6 +106,13 @@
106 106 @Autowired
107 107 private AntExRecordService recordService;
108 108  
  109 + @Autowired
  110 + private AntenatalExaminationService antExService;
  111 +
  112 + @Autowired
  113 + private PatientsService patientsService;
  114 +
  115 +
109 116 private static final Map<String, String> colorMap = new HashMap<>();
110 117  
111 118 /**
112 119  
113 120  
114 121  
... ... @@ -4414,18 +4421,18 @@
4414 4421 .and("yn").is(YnEnums.YES.getId());
4415 4422 long antExChu = mongoTemplate.count(Query.query(criteria2), AntExChuModel.class);
4416 4423 //建档且初诊(限本院)
4417   - List<Object> filingPids = new ArrayList<>();
  4424 + List<Object> filingParentIds = new ArrayList<>();
4418 4425 for (Patients patients : patientsList) {
4419   - filingPids.add(patients.getId());
  4426 + filingParentIds.add(patients.getId());
4420 4427 }
4421   - Criteria criteria3 = Criteria.where("parentId").in(filingPids)
  4428 + Criteria criteria3 = Criteria.where("parentId").in(filingParentIds)
4422 4429 .and("hospitalId").is(hospitalId)
4423 4430 .and("yn").is(YnEnums.YES.getId())
4424 4431 .and("checkTime").gte(startDate).lte(endDate);
4425 4432 long filingRoAntExChu = mongoTemplate.count(Query.query(criteria3), AntExChuModel.class);
4426 4433 //建档未初诊(包含外院初诊)
4427   - List<Object> antExChuNotList = new ArrayList<>();//档案pid
4428   - for (Object obj : filingPids) {
  4434 + List<Object> antExChuNotList = new ArrayList<>();//后面详情会用到
  4435 + for (Object obj : filingParentIds) {
4429 4436 Criteria criteria0 = Criteria.where("parentId").is(obj)
4430 4437 .and("yn").is(YnEnums.YES.getId())
4431 4438 .and("checkTime").gte(startDate).lte(endDate);
... ... @@ -4448,6 +4455,7 @@
4448 4455 long antExChuWai = mongoTemplate.count(Query.query(criteria5), AntExChuModel.class);
4449 4456 //一直未初诊
4450 4457 int filingNotAntExChu= 0;
  4458 + List<Object> antExChuNotAlwaysList = new ArrayList<>();//后面详情用到
4451 4459 for (Object obj : antExChuNotList) {
4452 4460 Criteria criteria6= Criteria.where("parentId").is(obj)
4453 4461 .and("hospitalId").is(hospitalId)
... ... @@ -4456,6 +4464,7 @@
4456 4464 long count = mongoTemplate.count(Query.query(criteria6), AntExChuModel.class);
4457 4465 if(count==0){
4458 4466 filingNotAntExChu++;
  4467 + antExChuNotAlwaysList.add(obj);
4459 4468 }
4460 4469 }
4461 4470 //当前时间范围初诊,之前建档
... ... @@ -4559,6 +4568,8 @@
4559 4568 map.put("livingCount", boy+girl);
4560 4569 map.put("boyCount", boy);
4561 4570 map.put("girlCount", girl);
  4571 + map.put("antExChuNotList", antExChuNotList);//后面详情用到。不用再次重复查询
  4572 + map.put("antExChuNotAlwaysList", antExChuNotAlwaysList);//后面详情用到。不用再次重复查询
4562 4573  
4563 4574 br.setErrorcode(ErrorCodeConstants.SUCCESS);
4564 4575 br.setErrormsg("成功");
... ... @@ -4684,7 +4695,7 @@
4684 4695 antExRecordQuery.setNeed("yes");
4685 4696 antExRecordQuery.setPage(page);
4686 4697 antExRecordQuery.setLimit(limit);
4687   - List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "created");
  4698 + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "checkTime");
4688 4699 for (AntExRecordModel antExRecordModel : antExRecordModelList) {
4689 4700 Map<String,Object>map =new HashMap<>();
4690 4701 map.put("name", antExRecordModel.getName());
... ... @@ -4714,6 +4725,91 @@
4714 4725 br.setErrormsg("成功");
4715 4726 br.setData(antExRecordResult);
4716 4727 br.setPageInfo(antExRecordQuery.getPageInfo());
  4728 + return br;
  4729 + }
  4730 +
  4731 + @Override
  4732 + public BaseResponse getAntExChuNotDetail(String hospitalId, Integer type,List<String> antExChuNotList,List<String> antExChuNotAlwaysList, Date startDate, Date endDate, Integer page, Integer limit) {
  4733 + BaseListResponse br = new BaseListResponse();
  4734 + List <Map <String, Object>> antExRecordResult=new ArrayList<>();
  4735 + //1:下月初诊、2:外院初诊、3:一直未初诊
  4736 + List<AntExRecordModel> antExRecordModelList=new ArrayList<>();
  4737 + List<Patients> patientsList=new ArrayList<>();
  4738 + AntExRecordQuery antExRecordQuery = new AntExRecordQuery();
  4739 + PatientsQuery patientsQuery=new PatientsQuery();
  4740 + if(CollectionUtils.isNotEmpty(antExChuNotList)||CollectionUtils.isNotEmpty(antExChuNotAlwaysList)) {
  4741 + switch (type) {
  4742 + case 1:
  4743 + antExRecordQuery.setParentIds(antExChuNotList);
  4744 + antExRecordQuery.setHospitalId(hospitalId);
  4745 + antExRecordQuery.setCheckTimeStart(DateUtil.getMonthDay(startDate, 1, 1));
  4746 + antExRecordQuery.setCheckTimeEnd(DateUtil.getMonthDay(startDate, 1, 0));
  4747 + antExRecordQuery.setType(2);//初诊
  4748 + antExRecordQuery.setNeed("yes");
  4749 + antExRecordQuery.setPage(page);
  4750 + antExRecordQuery.setLimit(limit);
  4751 + antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "checkTime");
  4752 + break;
  4753 + case 2:
  4754 + antExRecordQuery.setParentIds(antExChuNotList);
  4755 + antExRecordQuery.setNotHospitalId(hospitalId);
  4756 + antExRecordQuery.setCheckTimeStart(startDate);
  4757 + antExRecordQuery.setType(2);//初诊
  4758 + antExRecordQuery.setNeed("yes");
  4759 + antExRecordQuery.setPage(page);
  4760 + antExRecordQuery.setLimit(limit);
  4761 + antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "checkTime");
  4762 + break;
  4763 + case 3:
  4764 + patientsQuery.setIds(antExChuNotAlwaysList);
  4765 + patientsQuery.setNeed("yse");
  4766 + patientsQuery.setPage(page);
  4767 + patientsQuery.setLimit(limit);
  4768 + patientsList = patientsService.queryPatientBySort(patientsQuery, "bookbuildingDate", "DESC");
  4769 + for (Patients patient : patientsList) {
  4770 + Map<String, Object> map = new HashMap<>();
  4771 + map.put("name", patient.getUsername());
  4772 + //建档孕周
  4773 + int days = DateUtil.getDays(patient.getLastMenses(), patient.getBookbuildingDate());
  4774 + map.put("filingDueWeek", com.lyms.platform.common.utils.StringUtils.dueWeek(days));
  4775 + //当前孕周
  4776 + int days2 = DateUtil.getDays(patient.getLastMenses(), new Date());
  4777 + map.put("nowDueWeek", com.lyms.platform.common.utils.StringUtils.dueWeek(days2));
  4778 + map.put("age", DateUtil.getAge(patient.getBirth()));
  4779 + map.put("phone", patient.getPhone());
  4780 + //居住地
  4781 + String liveAddress = CommonsHelper.getResidence(patient.getProvinceId(), patient.getCityId(),
  4782 + patient.getAreaId(), patient.getStreetId(), patient.getAddress(), basicConfigService);
  4783 + map.put("liveAddress", liveAddress);
  4784 + antExRecordResult.add(map);
  4785 + }
  4786 + br.setPageInfo(patientsQuery.getPageInfo());
  4787 + break;
  4788 + }
  4789 + if (type == 1 || type == 2) {
  4790 + for (AntExRecordModel antExRecordModel : antExRecordModelList) {
  4791 + Map<String, Object> map = new HashMap<>();
  4792 + map.put("name", antExRecordModel.getName());
  4793 + //建档孕周
  4794 + int days = DateUtil.getDays(antExRecordModel.getLastMenses(), antExRecordModel.getBuildTime());
  4795 + map.put("filingDueWeek", com.lyms.platform.common.utils.StringUtils.dueWeek(days));
  4796 + //当前孕周
  4797 + int days2 = DateUtil.getDays(antExRecordModel.getLastMenses(), new Date());
  4798 + map.put("nowDueWeek", com.lyms.platform.common.utils.StringUtils.dueWeek(days2));
  4799 + map.put("age", DateUtil.getAge(antExRecordModel.getBrith()));
  4800 + map.put("phone", antExRecordModel.getPhone());
  4801 + //居住地
  4802 + String liveAddress = CommonsHelper.getResidence(antExRecordModel.getProvinceId(), antExRecordModel.getCityId(),
  4803 + antExRecordModel.getAreaId(), antExRecordModel.getStreetId(), antExRecordModel.getAddress(), basicConfigService);
  4804 + map.put("liveAddress", liveAddress);
  4805 + antExRecordResult.add(map);
  4806 + }
  4807 + br.setPageInfo(antExRecordQuery.getPageInfo());
  4808 + }
  4809 + }
  4810 + br.setErrorcode(ErrorCodeConstants.SUCCESS);
  4811 + br.setErrormsg("成功");
  4812 + br.setData(antExRecordResult);
4717 4813 return br;
4718 4814 }
4719 4815