Commit 9d4c134c7d77b8672977466230148c873c79c316

Authored by shiyang
1 parent ef694faa92

美生县医院系统数据分析报告-2.3.2.二级漏检提醒,1

Showing 3 changed files with 140 additions and 0 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java View file @ 9d4c134
... ... @@ -619,5 +619,51 @@
619 619 @RequestParam(required = true)String endDate) {
620 620 return reportService.getFmAfterEvaluate(hospitalId,startDate,endDate);
621 621 }
  622 + /**
  623 + * 统计管理-孕产妇数据统计-2.3.2-初诊之后的逾期
  624 + *
  625 + * @param startDate
  626 + * @param endDate
  627 + * @return
  628 + */
  629 + @RequestMapping(value = "/getChuNextOverdue", method = RequestMethod.GET)
  630 + @ResponseBody
  631 + @TokenRequired
  632 + public BaseResponse getChuNextOverdue(@RequestParam(required = true)String hospitalId,
  633 + @RequestParam(required = true)Date startDate,
  634 + @RequestParam(required = true)Date endDate) {
  635 + return reportService.getChuNextOverdue(hospitalId,startDate,endDate);
  636 + }
  637 + /**
  638 + * 统计管理-孕产妇数据统计-2.3.2-最后一次检查逾期
  639 + *
  640 + * @param startDate
  641 + * @param endDate
  642 + * @return
  643 + */
  644 + @RequestMapping(value = "/getFinallyCheckOverdue", method = RequestMethod.GET)
  645 + @ResponseBody
  646 + @TokenRequired
  647 + public BaseResponse getFinallyCheckOverdue(@RequestParam(required = true)String hospitalId,
  648 + @RequestParam(required = true)Date startDate,
  649 + @RequestParam(required = true)Date endDate) {
  650 + return reportService.getFinallyCheckOverdue(hospitalId,startDate,endDate);
  651 + }
  652 + /**
  653 + * 统计管理-孕产妇数据统计-2.3.2-乡镇级别,最后一次检查逾期
  654 + *
  655 + * @param startDate
  656 + * @param endDate
  657 + * @return
  658 + */
  659 + @RequestMapping(value = "/getAreaFinallyOverdue", method = RequestMethod.GET)
  660 + @ResponseBody
  661 + @TokenRequired
  662 + public BaseResponse getAreaFinallyOverdue(@RequestParam(required = true)String hospitalId,
  663 + @RequestParam(required = true)String areaId,
  664 + @RequestParam(required = true)Date startDate,
  665 + @RequestParam(required = true)Date endDate) {
  666 + return reportService.getAreaFinallyOverdue(hospitalId,areaId,startDate,endDate);
  667 + }
622 668 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java View file @ 9d4c134
... ... @@ -122,5 +122,11 @@
122 122 BaseResponse getFmAfterEvaluate(String hospitalId,String startDate,String endDate);
123 123  
124 124 BaseResponse getAntExChuNotDetail(String hospitalId, Integer type, Date startDate, Date endDate, Integer page, Integer limit);
  125 +
  126 + BaseResponse getChuNextOverdue(String hospitalId, Date startDate, Date endDate);
  127 +
  128 + BaseResponse getFinallyCheckOverdue(String hospitalId, Date startDate, Date endDate);
  129 +
  130 + BaseResponse getAreaFinallyOverdue(String hospitalId,String areaId ,Date startDate, Date endDate);
125 131 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 9d4c134
... ... @@ -32,6 +32,7 @@
32 32 import org.apache.commons.collections.*;
33 33 import org.apache.commons.collections.map.HashedMap;
34 34 import org.apache.commons.lang.StringUtils;
  35 +import org.bson.types.ObjectId;
35 36 import org.springframework.beans.factory.annotation.Autowired;
36 37 import org.springframework.beans.factory.annotation.Qualifier;
37 38 import org.springframework.data.domain.Sort;
... ... @@ -5016,6 +5017,93 @@
5016 5017 map.put("antExChuNotList",antExChuNotList);
5017 5018 map.put("antExChuNotAlwaysList",antExChuNotAlwaysList);
5018 5019 return map;
  5020 + }
  5021 +
  5022 + @Override
  5023 + public BaseResponse getChuNextOverdue(String hospitalId, Date startDate, Date endDate) {
  5024 + BaseResponse br = new BaseResponse();
  5025 + List <Map <String, Object>> mapList=new ArrayList<>();
  5026 + //孕妇初诊
  5027 + Criteria criteria = Criteria.where("nextCheckTime")
  5028 + .gte(startDate).lte(endDate)
  5029 + .and("hospitalId").is(hospitalId)
  5030 + .and("yn").is(1);
  5031 + List<AntExChuModel> antExChuModels = mongoTemplate.find(Query.query(criteria), AntExChuModel.class);
  5032 + //逾期初诊id
  5033 + List<Object> ids=new ArrayList<>();
  5034 + for (AntExChuModel antExChuModel : antExChuModels) {
  5035 + Criteria criteria2 = Criteria.where("parentId").is(antExChuModel.getParentId())
  5036 + .and("hospitalId").is(hospitalId)
  5037 + .and("type").is(1)
  5038 + .and("yn").is(1);
  5039 + final long count = mongoTemplate.count(Query.query(criteria2), AntExRecordModel.class);
  5040 + if(count==0){
  5041 + ids.add(new ObjectId(antExChuModel.getId()));
  5042 + }
  5043 + }
  5044 + //分组查询
  5045 + Criteria criteria3 = Criteria.where("_id").in(ids);
  5046 + AggregationOperation match = Aggregation.match(criteria3);
  5047 + AggregationOperation group = Aggregation.group("prodDoctor").count().as("count");
  5048 + Aggregation aggregation= Aggregation.newAggregation(match, group);
  5049 + AggregationResults<HashMap> result = mongoTemplate.aggregate(aggregation,"lyms_antexc", HashMap.class);
  5050 + int count=0;//逾期合计
  5051 + for (HashMap mappedResult : result.getMappedResults()) {
  5052 + Map <String, Object> map=new HashMap<>();
  5053 +
  5054 + if (null!=mappedResult.get("_id")) {
  5055 + //接生医生姓名
  5056 + String doctor = "";
  5057 + Users users = usersService.getUsers(Integer.parseInt(mappedResult.get("_id").toString()));
  5058 + if (users != null && users.getYn() == YnEnums.YES.getId()) {
  5059 + doctor = users.getName();
  5060 + }
  5061 + map.put("name", doctor);
  5062 + map.put("count", mappedResult.get("count"));
  5063 + count+=Integer.parseInt(mappedResult.get("count").toString());
  5064 + mapList.add(map);
  5065 + }
  5066 + }
  5067 + Map<String, Object> totalMap=new HashedMap();
  5068 + totalMap.put("name","合计(逾期未检)");
  5069 + totalMap.put("count",count);
  5070 + mapList.add(totalMap);
  5071 + br.setErrorcode(ErrorCodeConstants.SUCCESS);
  5072 + br.setErrormsg("成功");
  5073 + br.setObject(mapList);
  5074 + return br;
  5075 + }
  5076 +
  5077 + @Override
  5078 + public BaseResponse getFinallyCheckOverdue(String hospitalId, Date startDate, Date endDate) {
  5079 + BaseResponse br = new BaseResponse();
  5080 + List <Map <String, Object>> mapList=new ArrayList<>();
  5081 + Criteria criteria = Criteria.where("nextCheckTime")
  5082 + .gte(startDate).lte(endDate)
  5083 + .and("")
  5084 + .and("hospitalId").is(hospitalId)
  5085 + .and("yn").is(1);
  5086 + AggregationOperation match = Aggregation.match(criteria);
  5087 + AggregationOperation group = Aggregation.group("prodDoctor").count().as("count");
  5088 + Aggregation aggregation= Aggregation.newAggregation(match, group);
  5089 + AggregationResults<HashMap> result = mongoTemplate.aggregate(aggregation,"lyms_patient", HashMap.class);
  5090 +
  5091 + br.setErrorcode(ErrorCodeConstants.SUCCESS);
  5092 + br.setErrormsg("成功");
  5093 + br.setObject(mapList);
  5094 + return br;
  5095 + }
  5096 +
  5097 + @Override
  5098 + public BaseResponse getAreaFinallyOverdue(String hospitalId, String areaId,Date startDate, Date endDate) {
  5099 + BaseResponse br = new BaseResponse();
  5100 + List <Map <String, Object>> mapList=new ArrayList<>();
  5101 +
  5102 +
  5103 + br.setErrorcode(ErrorCodeConstants.SUCCESS);
  5104 + br.setErrormsg("成功");
  5105 + br.setObject(mapList);
  5106 + return br;
5019 5107 }
5020 5108 }