Commit e85c22b2e74dbd837ce6db7dd374a1d3cd2e6b47
1 parent
977749549e
Exists in
master
and in
6 other branches
分娩查询
Showing 2 changed files with 52 additions and 23 deletions
platform-dal/src/main/java/com/lyms/platform/query/MatDeliverQuery.java
View file @
e85c22b
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | import com.lyms.platform.common.dao.operator.MongoOper; |
| 7 | 7 | import com.lyms.platform.common.dao.operator.MongoQuery; |
| 8 | 8 | import org.apache.commons.collections.CollectionUtils; |
| 9 | +import org.bson.types.ObjectId; | |
| 9 | 10 | import org.springframework.data.mongodb.core.query.Criteria; |
| 10 | 11 | |
| 11 | 12 | import java.util.Date; |
| ... | ... | @@ -126,6 +127,9 @@ |
| 126 | 127 | // 1 <2500g、2 ≥4000g、3 ≥2500g与<4000g之间 |
| 127 | 128 | private Integer weight; |
| 128 | 129 | |
| 130 | + private List<ObjectId> babyIds; | |
| 131 | + | |
| 132 | + | |
| 129 | 133 | @Override |
| 130 | 134 | public MongoQuery convertToQuery() { |
| 131 | 135 | MongoCondition condition = MongoCondition.newInstance(); |
| ... | ... | @@ -269,21 +273,8 @@ |
| 269 | 273 | } |
| 270 | 274 | } |
| 271 | 275 | |
| 272 | - if (weight != null) { | |
| 273 | - | |
| 274 | - //1 <2500g、2 ≥4000g、3 ≥2500g与<4000g之间 | |
| 275 | - switch (weight) { | |
| 276 | - case 1: | |
| 277 | - condition = condition.and("baby.babyWeight", "2500", MongoOper.LT); | |
| 278 | - break; | |
| 279 | - case 2: | |
| 280 | - condition = condition.and("baby.babyWeight", "4000", MongoOper.GTE); | |
| 281 | - break; | |
| 282 | - case 3: | |
| 283 | - isAddStart = Boolean.TRUE; | |
| 284 | - c = Criteria.where("baby.babyWeight").gte("2500").lt("4000"); | |
| 285 | - break; | |
| 286 | - } | |
| 276 | + if (babyIds != null && babyIds.size() > 0) { | |
| 277 | + condition = condition.and("baby._id", babyIds, MongoOper.IN); | |
| 287 | 278 | } |
| 288 | 279 | |
| 289 | 280 | if (null != createdStart) { |
| ... | ... | @@ -332,6 +323,13 @@ |
| 332 | 323 | return condition.toMongoQuery(); |
| 333 | 324 | } |
| 334 | 325 | |
| 326 | + public List<ObjectId> getBabyIds() { | |
| 327 | + return babyIds; | |
| 328 | + } | |
| 329 | + | |
| 330 | + public void setBabyIds(List<ObjectId> babyIds) { | |
| 331 | + this.babyIds = babyIds; | |
| 332 | + } | |
| 335 | 333 | |
| 336 | 334 | public Integer getWeight() { |
| 337 | 335 | return weight; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
e85c22b
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | import com.lyms.hospitalapi.lcdcf.LcdcfHisService; |
| 6 | 6 | import com.lyms.platform.biz.service.*; |
| 7 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 8 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 8 | 9 | import com.lyms.platform.common.enums.*; |
| 9 | 10 | import com.lyms.platform.common.result.BaseListResponse; |
| 10 | 11 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 11 | 12 | |
| ... | ... | @@ -31,11 +32,13 @@ |
| 31 | 32 | import org.apache.commons.collections.map.HashedMap; |
| 32 | 33 | import org.apache.commons.lang.StringUtils; |
| 33 | 34 | import org.apache.commons.lang.math.NumberUtils; |
| 35 | +import org.bson.types.ObjectId; | |
| 34 | 36 | import org.slf4j.Logger; |
| 35 | 37 | import org.slf4j.LoggerFactory; |
| 36 | 38 | import org.springframework.beans.factory.annotation.Autowired; |
| 37 | 39 | import org.springframework.beans.factory.annotation.Qualifier; |
| 38 | 40 | import org.springframework.data.domain.Sort; |
| 41 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 39 | 42 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 40 | 43 | import org.springframework.stereotype.Component; |
| 41 | 44 | |
| 42 | 45 | |
| 43 | 46 | |
| 44 | 47 | |
| ... | ... | @@ -1681,21 +1684,19 @@ |
| 1681 | 1684 | if (matdeliverFollowRequest.getStartDay() != null && matdeliverFollowRequest.getEndDay() != null ) |
| 1682 | 1685 | { |
| 1683 | 1686 | matDeliverQuery.setCreatedStart(DateUtil.formatDate(DateUtil.addDay(new Date(), -matdeliverFollowRequest.getEndDay()))); |
| 1684 | - matDeliverQuery.setEndStart(DateUtil.formatDate(DateUtil.addDay(new Date(), -matdeliverFollowRequest.getStartDay()+1))); | |
| 1687 | + matDeliverQuery.setEndStart(DateUtil.formatDate(DateUtil.addDay(new Date(), -matdeliverFollowRequest.getStartDay()))); | |
| 1685 | 1688 | } |
| 1686 | 1689 | else if (matdeliverFollowRequest.getStartDay() != null) |
| 1687 | 1690 | { |
| 1688 | 1691 | matDeliverQuery.setCreatedStart(DateUtil.formatDate(DateUtil.addDay(new Date(), -matdeliverFollowRequest.getStartDay()))); |
| 1689 | - matDeliverQuery.setEndStart(DateUtil.formatDate(DateUtil.addDay(new Date(), -matdeliverFollowRequest.getStartDay()+1))); | |
| 1692 | + matDeliverQuery.setEndStart(DateUtil.formatDate(DateUtil.addDay(new Date(), -matdeliverFollowRequest.getStartDay()))); | |
| 1690 | 1693 | } |
| 1691 | 1694 | else if(matdeliverFollowRequest.getEndDay() != null) |
| 1692 | 1695 | { |
| 1693 | 1696 | matDeliverQuery.setCreatedStart(DateUtil.formatDate(DateUtil.addDay(new Date(), -matdeliverFollowRequest.getEndDay()))); |
| 1694 | - matDeliverQuery.setEndStart(DateUtil.formatDate(DateUtil.addDay(new Date(), -matdeliverFollowRequest.getEndDay()+1))); | |
| 1697 | + matDeliverQuery.setEndStart(DateUtil.formatDate(DateUtil.addDay(new Date(), -matdeliverFollowRequest.getEndDay()))); | |
| 1695 | 1698 | } |
| 1696 | 1699 | |
| 1697 | - System.out.println(DateUtil.getyyyy_MM_dd(matDeliverQuery.getCreatedStart())); | |
| 1698 | - System.out.println(DateUtil.getyyyy_MM_dd(matDeliverQuery.getEndStart())); | |
| 1699 | 1700 | |
| 1700 | 1701 | // if (matdeliverFollowRequest.getFollowStage() != null) {//按访视阶段查询 |
| 1701 | 1702 | // if (matdeliverFollowRequest.getFollowStage() == 1) {//1、访视期内 分娩时间为:21天到当前时间 |
| ... | ... | @@ -1858,7 +1859,7 @@ |
| 1858 | 1859 | } |
| 1859 | 1860 | } |
| 1860 | 1861 | |
| 1861 | - | |
| 1862 | + String hid = autoMatchFacade.getHospitalId(childbirthManagerRequest.getOperatorId()); | |
| 1862 | 1863 | patientsQuery.setYn(YnEnums.YES.getId()); |
| 1863 | 1864 | patientsQuery.setIsAutoFm(YnEnums.NO.getId()); |
| 1864 | 1865 | patientsQuery.setType(3); |
| ... | ... | @@ -1866,7 +1867,7 @@ |
| 1866 | 1867 | List<String> hospitalList = new ArrayList<>(); |
| 1867 | 1868 | if (StringUtils.isEmpty(childbirthManagerRequest.getIsArea())) { |
| 1868 | 1869 | // 非区域 |
| 1869 | - hospitalList.add(autoMatchFacade.getHospitalId(childbirthManagerRequest.getOperatorId())); | |
| 1870 | + hospitalList.add(hid); | |
| 1870 | 1871 | } else { |
| 1871 | 1872 | // 区域 |
| 1872 | 1873 | if (StringUtils.isNotEmpty(childbirthManagerRequest.getHospitalId())) { |
| 1873 | 1874 | |
| 1874 | 1875 | |
| ... | ... | @@ -1954,14 +1955,44 @@ |
| 1954 | 1955 | matDeliverQuery.setHloseBloodType(childbirthManagerRequest.getHloseBloodType()); |
| 1955 | 1956 | String deliveryModeQueryJson = "fmfs\\\":\\\"" + childbirthManagerRequest.getDeliveryMode(); |
| 1956 | 1957 | matDeliverQuery.setDeliveryModeQueryJson(StringUtils.isEmpty(childbirthManagerRequest.getDeliveryMode()) ? null : deliveryModeQueryJson); |
| 1957 | - matDeliverQuery.setWeight(childbirthManagerRequest.getWeight()); | |
| 1958 | +// matDeliverQuery.setWeight(childbirthManagerRequest.getWeight()); | |
| 1958 | 1959 | |
| 1960 | + if (childbirthManagerRequest.getWeight() != null) | |
| 1961 | + { | |
| 1962 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 1963 | + babyModelQuery.setDataStatus(false); | |
| 1964 | + babyModelQuery.setHospitalId(hid); | |
| 1965 | + babyModelQuery.setBuildType(2); | |
| 1966 | + | |
| 1967 | + switch (childbirthManagerRequest.getWeight()) { | |
| 1968 | + case 1: | |
| 1969 | + babyModelQuery.setBabyWeightEnd(String.valueOf(2500 - 0.01)); | |
| 1970 | + break; | |
| 1971 | + case 2: | |
| 1972 | + babyModelQuery.setBabyWeightStart(String.valueOf(4000)); | |
| 1973 | + break; | |
| 1974 | + case 3: | |
| 1975 | + babyModelQuery.setBabyWeightStart(String.valueOf(2500)); | |
| 1976 | + babyModelQuery.setBabyWeightEnd(String.valueOf(4000 - 0.01)); | |
| 1977 | + break; | |
| 1978 | + } | |
| 1979 | + List<BabyModel> babyModelList = babyService.queryBabyWithQuery(babyModelQuery); | |
| 1980 | + List<String> babyParentIdList = new ArrayList<>(); | |
| 1981 | + for (BabyModel babyModel : babyModelList) { | |
| 1982 | + babyParentIdList.add(babyModel.getParentId()); | |
| 1983 | + } | |
| 1984 | + parentIdList.retainAll(babyParentIdList); | |
| 1985 | + matDeliverQuery.setParentIdList(parentIdList); | |
| 1986 | + } | |
| 1987 | + | |
| 1988 | + | |
| 1959 | 1989 | List<MaternalDeliverModel> maternalDeliverModelList; |
| 1960 | 1990 | if (!childbirthManagerRequest.isExcel() && (childbirthManagerRequest.getHloseBloodType() != null |
| 1961 | 1991 | || StringUtils.isNotEmpty(childbirthManagerRequest.getDeliveryMode()) || childbirthManagerRequest.getWeight() != null)) {//根据出血量查询继续分页 |
| 1962 | 1992 | matDeliverQuery.setLimit(childbirthManagerRequest.getLimit()); |
| 1963 | 1993 | matDeliverQuery.setPage(childbirthManagerRequest.getPage()); |
| 1964 | 1994 | matDeliverQuery.setNeed("need"); |
| 1995 | + System.out.println(matDeliverQuery.convertToQuery().convertToMongoQuery().toString()); | |
| 1965 | 1996 | maternalDeliverModelList = matDeliverService.pageQuery(matDeliverQuery); |
| 1966 | 1997 | // 这里就设置分页内容 |
| 1967 | 1998 | childbirthManagerResult.setPageInfo(matDeliverQuery.getPageInfo()); |