From 965edb702ed0f308596e64e51b9b74c5e934b72c Mon Sep 17 00:00:00 2001 From: liquanyu Date: Wed, 9 Nov 2022 21:36:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=85=B1=E5=8D=AB=E7=94=9F=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lyms/platform/query/BabyCheckModelQuery.java | 68 +++++++++++---- .../operate/web/facade/PatientSyncMysqlFacade.java | 97 ++++++++++++---------- 2 files changed, 107 insertions(+), 58 deletions(-) diff --git a/platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java b/platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java index 2b35936..da184cb 100644 --- a/platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java +++ b/platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java @@ -10,6 +10,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import java.util.Arrays; import java.util.Date; +import java.util.List; /** * 儿保检查查询模型 @@ -29,6 +30,7 @@ public class BabyCheckModelQuery extends BaseQuery implements IConvertToNativeQu private String[] buildIds; private String hospitalId; + private List hospitalIds; //体重评价 private String weightEvaluate; @@ -60,21 +62,6 @@ public class BabyCheckModelQuery extends BaseQuery implements IConvertToNativeQu //大于创建时间 private Date gteCreated; - public Date getGteModified() { - return gteModified; - } - - public void setGteModified(Date gteModified) { - this.gteModified = gteModified; - } - - public Date getGteCreated() { - return gteCreated; - } - - public void setGteCreated(Date gteCreated) { - this.gteCreated = gteCreated; - } private Integer checkMonthStart; private Integer checkMonthEnd; @@ -95,6 +82,40 @@ public class BabyCheckModelQuery extends BaseQuery implements IConvertToNativeQu private String hemoglobinEnd; // 检查套餐 private Integer tcType; + private Boolean lhdsl; + private List articleTypes; + + public Date getGteModified() { + return gteModified; + } + + public void setGteModified(Date gteModified) { + this.gteModified = gteModified; + } + + public Date getGteCreated() { + return gteCreated; + } + + public void setGteCreated(Date gteCreated) { + this.gteCreated = gteCreated; + } + + public List getHospitalIds() { + return hospitalIds; + } + + public void setHospitalIds(List hospitalIds) { + this.hospitalIds = hospitalIds; + } + + public Boolean getLhdsl() { + return lhdsl; + } + + public void setLhdsl(Boolean lhdsl) { + this.lhdsl = lhdsl; + } public String getHemoglobinStart() { return hemoglobinStart; @@ -191,6 +212,15 @@ public class BabyCheckModelQuery extends BaseQuery implements IConvertToNativeQu if(null!=hospitalId){ condition=condition.and("hospitalId", hospitalId, MongoOper.IS); } + if(null!=articleTypes){ + condition=condition.and("articleTypes", articleTypes, MongoOper.IN); + } + if(lhdsl != null){ + condition=condition.and("lhdsl", lhdsl, MongoOper.EXISTS); + } + if(null!=hospitalIds){ + condition=condition.and("hospitalId", hospitalIds, MongoOper.IS); + } if(null!=tcType){ condition=condition.and("tcType", tcType, MongoOper.IS); } @@ -296,6 +326,14 @@ public class BabyCheckModelQuery extends BaseQuery implements IConvertToNativeQu return new MongoCondition(c2.andOperator(condition.getCriteria(),c3)).toMongoQuery(); } + public List getArticleTypes() { + return articleTypes; + } + + public void setArticleTypes(List articleTypes) { + this.articleTypes = articleTypes; + } + public Integer getCheckMonthStart() { return checkMonthStart; } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java index 675da85..d695b4a 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientSyncMysqlFacade.java @@ -3339,19 +3339,15 @@ public class PatientSyncMysqlFacade extends BaseServiceImpl { } hospitalDate.put("data7",data6_data5+"%"); //0-6岁儿童总数 - int data8=0; - BabyModelQuery babyQuery2=new BabyModelQuery(); - babyQuery2.setYn(YnEnums.YES.getId()); - babyQuery2.setHospitalId(hospitalId); - babyQuery2.setBirthStart(DateUtil.addYear(startDateFirst,-6)); - babyQuery2.setBirthEnd(endDate); - data8 = babyBookbuildingService.queryBabyCount(babyQuery2); + end1 = DateUtil.addDay(DateUtil.addMonth(currentDate1, -72 - 1), 1); + babyQuery.setBirthStart(end1); + int data8 = babyBookbuildingService.queryBabyCount(babyQuery); int lastDate8= null==hospitalDate.get("data8")?0:Integer.parseInt(hospitalDate.get("data8").toString()); hospitalDate.put("data8",data8+lastDate8); + //0-6岁儿童系统管理人数 - int data9=0; - babyQuery2.setLastCheckDoctor2(true); - data9 = babyBookbuildingService.queryBabyCount(babyQuery2); + babyQuery.setLastCheckDoctor2(true); + int data9 = babyBookbuildingService.queryBabyCount(babyQuery); int lastDate9= null==hospitalDate.get("data9")?0:Integer.parseInt(hospitalDate.get("data9").toString()); hospitalDate.put("data9",data9+lastDate9); //0-6岁儿童系统管理率% @@ -3369,15 +3365,18 @@ public class PatientSyncMysqlFacade extends BaseServiceImpl { hospitalDate.put("data11",data9+lastDate9); //0-6岁儿童健康管理率% hospitalDate.put("data12",data9_data8+"%"); + + //0-6岁儿童眼保健及视力检查人数 - int data13=0; - BabyModelQuery babyQuery3=new BabyModelQuery(); - babyQuery3.setYn(YnEnums.YES.getId()); - babyQuery3.setHospitalId(hospitalId); - babyQuery3.setBirthStart(DateUtil.addYear(startDateFirst,-6)); - babyQuery3.setBirthEnd(endDate); - babyQuery3.setCheckId(true); - data13 = babyBookbuildingService.queryBabyCount(babyQuery3); + BabyCheckModelQuery checkModelQuery = new BabyCheckModelQuery(); + checkModelQuery.setHospitalId(hospitalId); + checkModelQuery.setYn(YnEnums.YES.getId()); + checkModelQuery.setBirthStart(start1); + checkModelQuery.setBirthEnd(end1); + checkModelQuery.setLhdsl(true); + checkModelQuery.setCheckDateStart(DateUtil.addYear(new Date(),-20)); + checkModelQuery.setCheckDateEnd(endDate); + int data13 =babyCheckService.queryBabyCheckCount(checkModelQuery); int lastDate13= null==hospitalDate.get("data13")?0:Integer.parseInt(hospitalDate.get("data13").toString()); hospitalDate.put("data13",data13+lastDate13); //0-6岁儿童眼保健及视力检查覆盖率% @@ -3469,18 +3468,16 @@ public class PatientSyncMysqlFacade extends BaseServiceImpl { //孕产妇系统管理率% hospitalDate.put("data22",data19_data2+"%"); - Date currentDate = new Date(); - Date start = DateUtil.addMonth(currentDate, 0); - Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -37), 1); - //年度内儿童接收儿童中医指导的人数 - int data23=0; - AggregationOperation match23 = Aggregation.match(Criteria.where("hospitalId").is(hospitalId) - .and("articleTypes").in(Arrays.asList(1,2,3,4,5)).and("yn") - .is(YnEnums.YES.getId()).and("birth").gte(end).lte(start)); - AggregationOperation group23 = Aggregation.group("buildId"); - Aggregation aggregation23= Aggregation.newAggregation(match23, group23); - AggregationResults result23 = mongoTemplate.aggregate(aggregation23,"lyms_babycheck", HashMap.class); - data23=result23.getMappedResults().size(); + //中医指导的人次 + BabyCheckModelQuery checkModelQuery1 = new BabyCheckModelQuery(); + checkModelQuery1.setHospitalId(hospitalId); + checkModelQuery1.setYn(YnEnums.YES.getId()); + checkModelQuery1.setBirthStart(start1); + checkModelQuery1.setBirthEnd(end1); + checkModelQuery1.setArticleTypes(Arrays.asList(1,2,3,4,5)); + checkModelQuery1.setCheckDateStart(DateUtil.addYear(new Date(),-20)); + checkModelQuery1.setCheckDateEnd(endDate); + int data23 =babyCheckService.queryBabyCheckCount(checkModelQuery1); int lastDate23= null==hospitalDate.get("data23")?0:Integer.parseInt(hospitalDate.get("data23").toString()); hospitalDate.put("data23",data23+lastDate23); @@ -3557,14 +3554,28 @@ public class PatientSyncMysqlFacade extends BaseServiceImpl { hospitalIds.add(hospitalId); } } - + BabyCheckModelQuery checkModelQuery1 = new BabyCheckModelQuery(); if (CollectionUtils.isNotEmpty(hospitalIds)) { - Criteria criteria = Criteria.where("yn").ne(0).and("hospitalId").in(hospitalIds); - criteria.and("articleTypes").in(Arrays.asList(1,2,3,4,5)); - Query query = new Query(criteria); - PageResult pageResult = findMongoPage(BabyCheckModel.class, query.with(new Sort(Sort.Direction.DESC, "created")), page, limit); - List babyCheckModelList = (List ) pageResult.getGrid(); + Date endDate = DateUtil.getDayLastSecond(DateUtil.getDateMonthLast(dateTime)); + + Date currentDate1 = DateUtil.formatDate(new Date()); + Date start1 = DateUtil.addMonth(currentDate1, 0); + checkModelQuery1.setBirthEnd(start1); + Date end1 = DateUtil.addDay(DateUtil.addMonth(currentDate1, -36 - 1), 1); + + checkModelQuery1.setHospitalIds(hospitalIds); + checkModelQuery1.setYn(YnEnums.YES.getId()); + checkModelQuery1.setBirthStart(start1); + checkModelQuery1.setBirthEnd(end1); + checkModelQuery1.setArticleTypes(Arrays.asList(1,2,3,4,5)); + checkModelQuery1.setCheckDateStart(DateUtil.addYear(new Date(),-20)); + checkModelQuery1.setCheckDateEnd(endDate); + checkModelQuery1.setPage(page); + checkModelQuery1.setLimit(limit); + checkModelQuery1.setNeed("true"); + + List babyCheckModelList = babyCheckService.queryBabyCheckRecord(checkModelQuery1); List > list = new ArrayList(); for (BabyCheckModel babyCheckModel : babyCheckModelList) { Map map = new HashMap <>(); @@ -3577,12 +3588,12 @@ public class PatientSyncMysqlFacade extends BaseServiceImpl { } map.put("id", babyModel.getId()); map.put("babyName", babyModel.getName()); - map.put("sex", babyModel.getSex() != 0 ? "男" : "女"); - map.put("mName", babyModel.getMname()); - map.put("mCardNo", babyModel.getMcertNo()); - map.put("monthAge", DateUtil.getMonth(babyModel.getBirth(), babyCheckModel.getCheckDate())); + map.put("babySex", babyModel.getSex() != 0 ? "男" : "女"); + map.put("mommyName", babyModel.getMname()); + map.put("mommyCardNo", babyModel.getMcertNo()); + map.put("checkAge", DateUtil.getMonth(babyModel.getBirth(), babyCheckModel.getCheckDate())); map.put("birth",DateUtil.getyyyy_MM_dd(babyModel.getBirth())); - map.put("mphone",babyModel.getMphone()); + map.put("mommyPhone",babyModel.getMphone()); } map.put("checkTime", DateUtil.getyyyy_MM_dd(babyCheckModel.getCheckDate())); map.put("nextCheckTime", DateUtil.getyyyy_MM_dd(babyCheckModel.getNextDate())); @@ -3592,8 +3603,8 @@ public class PatientSyncMysqlFacade extends BaseServiceImpl { list.add(map); } - pageResult.setGrid(list); - return RespBuilder.buildSuccess(pageResult); + return new BaseListResponse().setErrorcode(0).setErrormsg("成功") + .setData(list).setPageInfo(checkModelQuery1.getPageInfo()); } return RespBuilder.buildSuccess(null); -- 1.8.3.1