Commit c76ddf5dfee4ea9be59127615f066e765737bd27

Authored by liquanyu
1 parent ac1f7f4e50

公共卫生统计

Showing 2 changed files with 73 additions and 22 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SmnController.java View file @ c76ddf5
... ... @@ -214,7 +214,7 @@
214 214 @RequestMapping(method = RequestMethod.GET, value = "/cacnelApply/{id}")
215 215 @ResponseBody
216 216 @TokenRequired
217   - public BaseResponse cacnelApply(@PathVariable String id, HttpServletRequest request) {
  217 + public BaseResponse cacnelApply(@PathVariable String id, HttpServletRequest request) {
218 218 return smnFacade.cacnelApply(id, getUserId(request));
219 219 }
220 220  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java View file @ c76ddf5
... ... @@ -4,10 +4,7 @@
4 4 import com.lyms.platform.common.constants.ErrorCodeConstants;
5 5 import com.lyms.platform.common.dao.operator.MongoCondition;
6 6 import com.lyms.platform.common.enums.*;
7   -import com.lyms.platform.common.result.BaseObjectResponse;
8   -import com.lyms.platform.common.result.BaseResponse;
9   -import com.lyms.platform.common.result.PageResult;
10   -import com.lyms.platform.common.result.RespBuilder;
  7 +import com.lyms.platform.common.result.*;
11 8 import com.lyms.platform.common.utils.*;
12 9 import com.lyms.platform.operate.web.result.BabyCheckPageResult;
13 10 import com.lyms.platform.operate.web.result.BabyPageResult;
14 11  
15 12  
... ... @@ -3255,19 +3252,25 @@
3255 3252 //传入的时间获取年的第一天
3256 3253 Date startDateFirst=DateUtil.getYearFirst(DateUtil.getYear(startDate));
3257 3254 DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0
  3255 +
  3256 +
  3257 + BabyModelQuery babyModelQuery = new BabyModelQuery();
  3258 + babyModelQuery.setExistSource(false);
  3259 + babyModelQuery.setDataStatus(false);
  3260 + babyModelQuery.setBuildType(2);
  3261 + babyModelQuery.setPregnancyOut("0");
  3262 + babyModelQuery.setHospitalId(hospitalId);
  3263 + babyModelQuery.setBirthStart(startDate);
  3264 + babyModelQuery.setBirthEnd(endDate);
  3265 +
3258 3266 //本月活产数
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);
  3267 + int data1= (int)mongoTemplate.count(babyModelQuery.convertToQuery().convertToMongoQuery(),BabyModel.class);
3263 3268  
3264 3269 int lastDate1= null==hospitalDate.get("data1")?0:Integer.parseInt(hospitalDate.get("data1").toString());
3265 3270 hospitalDate.put("data1",data1+lastDate1);
3266 3271 //累计活产数
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);
  3272 + babyModelQuery.setBirthStart(null);
  3273 + int data2 = (int)mongoTemplate.count(babyModelQuery.convertToQuery().convertToMongoQuery(),BabyModel.class);
3271 3274  
3272 3275 int lastDate2= null==hospitalDate.get("data2")?0:Integer.parseInt(hospitalDate.get("data2").toString());
3273 3276 hospitalDate.put("data2",data2+lastDate2);
... ... @@ -3603,6 +3606,7 @@
3603 3606 }
3604 3607  
3605 3608 public BaseResponse getBabyFmList(Integer page, Integer limit, String areaId, String streetId, Date dateTime, Integer type) {
  3609 + List<Map> results = new ArrayList<>();
3606 3610 //获得区县下的街道
3607 3611 List<BasicConfig> regions = getRegions(areaId,streetId);
3608 3612 List<String> hospitalIds = new ArrayList<>();
3609 3613  
3610 3614  
... ... @@ -3616,17 +3620,64 @@
3616 3620 }
3617 3621 Date startDate=DateUtil.getDateMonthFirst(dateTime);
3618 3622 Date endDate=DateUtil.getDayLastSecond(DateUtil.getDateMonthLast(dateTime));
  3623 + BabyModelQuery babyModelQuery = new BabyModelQuery();
3619 3624 if (CollectionUtils.isNotEmpty(hospitalIds))
3620 3625 {
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);
  3626 + babyModelQuery.setExistSource(false);
  3627 + babyModelQuery.setDataStatus(false);
  3628 + babyModelQuery.setBuildType(2);
  3629 + babyModelQuery.setPregnancyOut("0");
  3630 + babyModelQuery.setHospitalIdList(hospitalIds);
  3631 +
  3632 + babyModelQuery.setPage(page);
  3633 + babyModelQuery.setLimit(limit);
  3634 + babyModelQuery.setNeed("Need");
  3635 + babyModelQuery.setOrder("birth");
  3636 + if (type == 1)
  3637 + { //本月活产数
  3638 + babyModelQuery.setBirthStart(startDate);
  3639 + babyModelQuery.setBirthEnd(endDate);
  3640 + }
  3641 + else
  3642 + { //累计活产数
  3643 + babyModelQuery.setBirthEnd(endDate);
  3644 + }
  3645 + List<BabyModel> datas = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
  3646 + if (CollectionUtils.isNotEmpty(datas))
  3647 + {
  3648 + for (BabyModel model : datas)
  3649 + {
  3650 + Map result = new HashMap();
  3651 + result.put("babyName",model.getName());
  3652 + result.put("babySex",SexEnum.getTextById(model.getSex()));
  3653 + result.put("babyWeight",model.getBabyWeight());
  3654 + result.put("babyHeight",model.getBabyHeight());
  3655 + result.put("fmDate",DateUtil.getyyyy_MM_dd(model.getBirth()));
  3656 + result.put("mommyName",model.getMname());
  3657 + result.put("mommyPhone",model.getMphone());
  3658 + result.put("mommyCertNo",model.getMcertNo());
  3659 + String fmHos = "-";
  3660 + if (StringUtils.isNotEmpty(model.getDeliverOrg()))
  3661 + {
  3662 + try{
  3663 + fmHos = organizationService.getOrganization(Integer.parseInt(model.getDeliverOrg())).getName();
  3664 + }catch (Exception e){
  3665 + fmHos = model.getDeliverOrg();
  3666 + }
  3667 + }
  3668 + result.put("fmHospital",fmHos);
  3669 + if (StringUtils.isNotEmpty(model.getParentId()))
  3670 + {
  3671 + MaternalDeliverModel fmModel = mongoTemplate.findOne(Query.query(Criteria.where("parentId")
  3672 + .is(model.getParentId())), MaternalDeliverModel.class);
  3673 + result.put("fmId",fmModel == null ? "" : fmModel.getId());
  3674 + }
  3675 + results.add(result);
  3676 + }
  3677 + }
3628 3678 }
3629   - return null;
  3679 + return new BaseListResponse().setErrorcode(0).setErrormsg("成功")
  3680 + .setData(results).setPageInfo(babyModelQuery.getPageInfo());
3630 3681 }
3631 3682 }