From dc68ec504070fdfb373be1f74a1604c871bd41a2 Mon Sep 17 00:00:00 2001 From: liquanyu Date: Wed, 30 Nov 2016 18:37:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E6=A3=80=E6=8A=A5=E8=A1=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lyms/platform/query/PatientsQuery.java | 22 ++++++++++-------- .../java/com/lyms/platform/operate/web/Test.java | 26 ++++++++++++++++------ .../operate/web/facade/AntExRecordFacade.java | 6 ++--- .../operate/web/result/CjStatisticsResult.java | 19 +++++++++++++++- 4 files changed, 52 insertions(+), 21 deletions(-) diff --git a/platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java b/platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java index 2bf217f..fbec734 100644 --- a/platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java +++ b/platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java @@ -726,15 +726,8 @@ public class PatientsQuery extends BaseQuery implements IConvertToNativeQuery { if (buildTypeEq != null) { condition = condition.and("buildType", buildTypeEq, MongoOper.IS); } - Criteria c1 = null; - if (lastCheckEmployeeId != null) { - condition = condition.and("lastCheckEmployeeId", lastCheckEmployeeId, MongoOper.IS); - } - else if(lastCheckEId){ - // condition = condition.and("lastCheckEmployeeId", "", MongoOper.NE); - // condition = condition.andCondition(MongoCondition.newInstance("lastCheckEmployeeId", null, MongoOper.NE)); - c1 = Criteria.where("lastCheckEmployeeId").ne("").ne(null); - } + + if (bookbuildingDoctor != null) { condition = condition.and("bookbuildingDoctor", bookbuildingDoctor, MongoOper.IS); } @@ -814,6 +807,8 @@ public class PatientsQuery extends BaseQuery implements IConvertToNativeQuery { if (null != pid) { condition = condition.and("pid", pid, MongoOper.IS); } + Criteria c1 = null; + if (null != queryNo) { MongoCondition c = MongoCondition.newInstance(); MongoCondition con1 = MongoCondition.newInstance("phone", queryNo, MongoOper.IS); @@ -822,6 +817,15 @@ public class PatientsQuery extends BaseQuery implements IConvertToNativeQuery { c1= c.orCondition(new MongoCondition[]{con1, con2, con3}).getCriteria(); } + if (lastCheckEmployeeId != null) { + condition = condition.and("lastCheckEmployeeId", lastCheckEmployeeId, MongoOper.IS); + } + else if(lastCheckEId){ + condition = condition.and("lastCheckEmployeeId", "", MongoOper.NE); + MongoCondition c = MongoCondition.newInstance(); + c1= c.andCondition(MongoCondition.newInstance("lastCheckEmployeeId", null, MongoOper.NE)).getCriteria(); + } + if (fmDateStart != null && fmDateEnd != null) { c1 = Criteria.where("fmDate").gte(fmDateStart).lte(fmDateEnd); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java index 583314e..1fbae59 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java @@ -26,7 +26,7 @@ import java.util.List; public class Test { public static void main(String[] args) { -// PatientsQuery patientsQuery1 = new PatientsQuery(); + PatientsQuery patientsQuery1 = new PatientsQuery(); // patientsQuery1.setHospitalId("221"); // patientsQuery1.setYn(YnEnums.YES.getId()); // patientsQuery1.setType(1); @@ -44,18 +44,30 @@ public class Test { // patientsQuery1.setBookbuildingDateEnd(DateUtil.parseYMD("2016-12-08")); +// Date yuYueDate = DateUtil.addDay(new Date(), 2); +// if (yuYueDate != null) { +// //把时间格式化成 yyyy_MM_dd 的日期 +// yuYueDate = DateUtil.formatDate(yuYueDate); +// } +// AntExChuQuery antExChuQuery = new AntExChuQuery(); +// antExChuQuery.setYn(YnEnums.YES.getId()); +// antExChuQuery.setNextCheckTimeStart(yuYueDate); +// antExChuQuery.setNextCheckTimeEnd(yuYueDate); +// antExChuQuery.setHospitalId("242"); + + patientsQuery1.setLastCheckEId(true); + patientsQuery1.setHospitalId("242"); + patientsQuery1.setType(1); + Date yuYueDate = DateUtil.addDay(new Date(), 2); if (yuYueDate != null) { //把时间格式化成 yyyy_MM_dd 的日期 yuYueDate = DateUtil.formatDate(yuYueDate); } - AntExChuQuery antExChuQuery = new AntExChuQuery(); - antExChuQuery.setYn(YnEnums.YES.getId()); - antExChuQuery.setNextCheckTimeStart(yuYueDate); - antExChuQuery.setNextCheckTimeEnd(yuYueDate); - antExChuQuery.setHospitalId("242"); + patientsQuery1.setDueDateStart(yuYueDate); + patientsQuery1.setDueDateEnd(yuYueDate); - System.out.println(antExChuQuery.convertToQuery().convertToMongoQuery()); + System.out.println(patientsQuery1.convertToQuery().convertToMongoQuery()); /* diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java index 78257a3..e98e713 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java @@ -28,10 +28,7 @@ import org.apache.commons.lang.math.NumberUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 产检管理 @@ -187,6 +184,7 @@ public class AntExRecordFacade { } data.add(cjStatisticsResult); } + Collections.sort(data,new CjStatisticsResult()); } return baseListResponse.setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(patientsQuery1.getPageInfo()); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsResult.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsResult.java index b1922d8..af789e0 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsResult.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsResult.java @@ -1,11 +1,15 @@ package com.lyms.platform.operate.web.result; +import com.lyms.platform.common.utils.StringUtils; + +import java.util.Comparator; + /** * * 产检统计 * Created by Administrator on 2016/11/28 0028. */ -public class CjStatisticsResult { +public class CjStatisticsResult implements Comparator { private String dId; private String dName; private String count; @@ -37,4 +41,17 @@ public class CjStatisticsResult { public void setCount(String count) { this.count = count; } + + @Override + public int compare(CjStatisticsResult o1, CjStatisticsResult o2) { + if (o1 != null && o2 != null) + { + if (StringUtils.isNotEmpty(o2.getCount()) && StringUtils.isNotEmpty(o1.getCount())) + { + return Integer.parseInt(o2.getCount()) - Integer.parseInt(o1.getCount()); + } + } + return 0; + } + } -- 1.8.3.1