From eb57300644217f5b618642346df85f842f474023 Mon Sep 17 00:00:00 2001 From: liquanyu Date: Mon, 27 Apr 2020 11:41:49 +0800 Subject: [PATCH] update --- .../lyms/platform/biz/dal/ITrackDownRecordDao.java | 2 + .../biz/dal/impl/TrackDownRecordDaoImpl.java | 12 + .../biz/service/TrackDownRecordService.java | 7 +- .../com/lyms/platform/pojo/TrackDownRecord.java | 11 + .../com/lyms/platform/query/AntExRecordQuery.java | 10 +- .../lyms/platform/query/TrackDownRecordQuery.java | 879 +++++++++++---------- .../operate/web/controller/TestController.java | 42 + .../web/facade/AntenatalExaminationFacade.java | 9 + .../operate/web/facade/TrackDownFacade.java | 68 +- .../operate/web/request/TrackDownQueryRequest.java | 41 + 10 files changed, 665 insertions(+), 416 deletions(-) diff --git a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ITrackDownRecordDao.java b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ITrackDownRecordDao.java index c6b9e94..dfb9579 100644 --- a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ITrackDownRecordDao.java +++ b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ITrackDownRecordDao.java @@ -39,4 +39,6 @@ public interface ITrackDownRecordDao { Page findPage(MongoQuery query); void findAndModify(MongoQuery query, TrackDownRecord obj); + + public void updateTrackDownOneCol(String id, Object colValue); } diff --git a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/TrackDownRecordDaoImpl.java b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/TrackDownRecordDaoImpl.java index d79508e..58ac2a9 100644 --- a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/TrackDownRecordDaoImpl.java +++ b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/TrackDownRecordDaoImpl.java @@ -11,6 +11,9 @@ import com.lyms.platform.pojo.TrackDownRecord; import org.bson.types.ObjectId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; import org.springframework.stereotype.Repository; import java.util.List; @@ -74,6 +77,15 @@ public class TrackDownRecordDaoImpl extends BaseMongoDAOImpl im return find(query.convertToMongoQuery()); } + + + @Override + public void updateTrackDownOneCol(String id, Object colValue) { + this.mongoTemplate.updateFirst(new Query(Criteria.where("id").is(id)), Update.update("nextCheckTime", colValue), TrackDownRecord.class); + //为了使修改为空的时候能够同步到线上 + updateTrackDown(findById(id), id); + } + @Override public Page findPage(MongoQuery query) { return findPage(query.convertToMongoQuery()); diff --git a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/TrackDownRecordService.java b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/TrackDownRecordService.java index feba9c8..2ee3eb2 100644 --- a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/TrackDownRecordService.java +++ b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/TrackDownRecordService.java @@ -74,7 +74,7 @@ public class TrackDownRecordService { } public void findAndMoidify(TrackDownRecordQuery query,TrackDownRecord downRecord){ - iTrackDownRecordDao.findAndModify(query.convertToQuery(),downRecord); + iTrackDownRecordDao.findAndModify(query.convertToQuery(), downRecord); } public void updateTrackDown(TrackDownRecord obj, String id) { @@ -106,4 +106,9 @@ public class TrackDownRecordService { } return iTrackDownRecordDao.queryTrackDown(query1.addOrder(Sort.Direction.DESC, "modified")); } + + public void updateTrackDownOneCol(String id, Object colValue) + { + iTrackDownRecordDao.updateTrackDownOneCol(id,colValue); + } } \ No newline at end of file diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/TrackDownRecord.java b/platform-dal/src/main/java/com/lyms/platform/pojo/TrackDownRecord.java index 1e665ce..7c78403 100644 --- a/platform-dal/src/main/java/com/lyms/platform/pojo/TrackDownRecord.java +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/TrackDownRecord.java @@ -60,6 +60,9 @@ public class TrackDownRecord extends BaseModel { //预约追访日期 private Date appointmentDate; + //产检预约时间 + private Date nextCheckTime; + //追访日期 private Date trackDownDate; //是否终止流程 @@ -83,6 +86,14 @@ public class TrackDownRecord extends BaseModel { private String trackHospitalId; + public Date getNextCheckTime() { + return nextCheckTime; + } + + public void setNextCheckTime(Date nextCheckTime) { + this.nextCheckTime = nextCheckTime; + } + public String getTrackHospitalId() { return trackHospitalId; } diff --git a/platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java b/platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java index b10c966..8a6c039 100644 --- a/platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java +++ b/platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java @@ -703,7 +703,15 @@ public class AntExRecordQuery extends BaseQuery implements IConvertToNativeQuery if (null != nextCheckTimeEnd) { if (null != c) { - c = c.lte(nextCheckTimeEnd); + if (c.getCriteriaObject().containsField("nextCheckTimeEnd")) + { + c = c.lte(nextCheckTimeEnd); + } + else + { + c = c.and("nextCheckTime").lte(nextCheckTimeEnd); + } + } else { c = Criteria.where("nextCheckTime").lte(nextCheckTimeEnd); } diff --git a/platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java b/platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java index adc956d..15376ab 100644 --- a/platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java +++ b/platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java @@ -72,6 +72,10 @@ public class TrackDownRecordQuery extends BaseQuery implements IConvertToNativeQ //预约结束追访日期 private Date appointmentDateEnd; + //产检预约逾期天数 + private Date checkOverDaysStart; + private Date checkOverDaysEnd; + //追访状态 0 正常 1. 待追访 2.已终止 private Integer followupStatus; @@ -97,101 +101,494 @@ public class TrackDownRecordQuery extends BaseQuery implements IConvertToNativeQ private String trackHospitalId; - public String getTrackHospitalId() { - return trackHospitalId; - } - public void setTrackHospitalId(String trackHospitalId) { - this.trackHospitalId = trackHospitalId; - } + @Override + public MongoQuery convertToQuery() { + MongoCondition condition = MongoCondition.newInstance(); - public List getHospitalIdList() { - return hospitalIdList; - } + if (status != null) { + if (status != 3) {//查询全部 + condition = condition.and("status", status, MongoOper.IS); + } + } else { + //默认只查询显示的数据 + condition = condition.and("status", 1, MongoOper.IS); + } - public void setHospitalIdList(List hospitalIdList) { - this.hospitalIdList = hospitalIdList; - } + if (StringUtils.isNotEmpty(id)) { + condition = condition.and("id", id, MongoOper.IS); + } - public boolean isHistory() { - return isHistory; - } + if (CollectionUtils.isNotEmpty(hospitalIdList)) { + condition = condition.and("hospitalId", hospitalIdList, MongoOper.IN); + } - public void setHistory(boolean history) { - isHistory = history; - } + if (StringUtils.isNotEmpty(phone)) { + condition = condition.and("phone", phone, MongoOper.IS); + } - public Date getStartCreated() { - return startCreated; - } + if (StringUtils.isNotEmpty(cardNo)) { + condition = condition.and("cardNo", cardNo, MongoOper.IS); + } - public void setStartCreated(Date startCreated) { - this.startCreated = startCreated; - } + if (isHistory) { + condition = condition.and("isHistory", false, MongoOper.EXISTS); + } - public Date getEndCreated() { - return endCreated; - } + if (StringUtils.isNotEmpty(provinceId)) { + condition = condition.and("provinceRegisterId", provinceId, MongoOper.IS); + } + if (StringUtils.isNotEmpty(residentsArchiveId)) { + condition = condition.and("residentsArchiveId", residentsArchiveId, MongoOper.IS); + } + if (StringUtils.isNotEmpty(cityId)) { + condition = condition.and("cityRegisterId", cityId, MongoOper.IS); + } + if (StringUtils.isNotEmpty(areaId)) { + condition = condition.and("areaRegisterId", areaId, MongoOper.IS); + } + if (StringUtils.isNotEmpty(hospitalId)) { + condition = condition.and("hospitalId", hospitalId, MongoOper.IS); + } + if (StringUtils.isNotEmpty(streetId)) { + condition = condition.and("streetRegisterId", streetId, MongoOper.IS); + } + if (null != trackType) { + condition = condition.and("trackType", trackType, MongoOper.IS); + } + if (null != trackTypes) { + condition = condition.and("trackType", trackTypes, MongoOper.IN); + } - public void setEndCreated(Date endCreated) { - this.endCreated = endCreated; - } + if (StringUtils.isNotEmpty(source)) { + condition = condition.and("source", source, MongoOper.IS); + } + if (StringUtils.isNotEmpty(parentId)) { + condition = condition.and("parentId", parentId, MongoOper.IS); + } + if (null != parentIds) { + condition = condition.and("parentId", parentIds, MongoOper.IN); + } - public Integer getQueryTrackType() { - return queryTrackType; - } + if (null != pids) { + condition = condition.and("pid", pids, MongoOper.IN); + } - public void setQueryTrackType(Integer queryTrackType) { - this.queryTrackType = queryTrackType; - } + //排除 产筛跟分娩住院 + if (queryTrackType != null && queryTrackType != 4 && queryTrackType != 5) { + if (null != followupStatus) { + if (followupStatus == 0) { + Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); + condition = condition.and("appointmentDate", newDate, MongoOper.GTE); + } else if (followupStatus == 1) { + Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); + condition = condition.and("appointmentDate", newDate, MongoOper.LT); + } else if (followupStatus == 2) { + condition = condition.and("stop", "1", MongoOper.IS); + } + } + } + /*******产筛特殊处理**********/ + if (queryTrackType != null && queryTrackType == 4) { + if (null != followupStatus) { + if (followupStatus == 0) { + Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); + condition = condition.and("sieveAppointmentDate", newDate, MongoOper.GTE); + } else if (followupStatus == 1) { + Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); + condition = condition.and("sieveAppointmentDate", newDate, MongoOper.LT); + } else if (followupStatus == 2) { + condition = condition.and("stop", "1", MongoOper.IS); + } + } - public Date getStartBeOverdueDays() { - return startBeOverdueDays; - } + } - public void setStartBeOverdueDays(Date startBeOverdueDays) { - this.startBeOverdueDays = startBeOverdueDays; - } + /*****分娩住院特殊处理*********/ + if (queryTrackType != null && queryTrackType == 5) { + if (null != followupStatus) { + if (followupStatus == 0) { + Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); + condition = condition.and("fmzyAppointmentDate", newDate, MongoOper.GTE); + } else if (followupStatus == 1) { + Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); + condition = condition.and("fmzyAppointmentDate", newDate, MongoOper.LT); + } else if (followupStatus == 2) { + condition = condition.and("stop", "1", MongoOper.IS); + } + } - public Date getEndBeOverdueDays() { - return endBeOverdueDays; - } + } + Criteria c1 = null; - public void setEndBeOverdueDays(Date endBeOverdueDays) { - this.endBeOverdueDays = endBeOverdueDays; - } + if (StringUtils.isNotEmpty(key)) { + MongoCondition c = MongoCondition.newInstance(); + MongoCondition con1 = MongoCondition.newInstance("phone", key, MongoOper.IS); + MongoCondition con2 = MongoCondition.newInstance("username", "^" + key, MongoOper.LIKE); + MongoCondition con3 = MongoCondition.newInstance("cardNo", key, MongoOper.IS); + if (c1 != null) { + c1 = c1.andOperator(c.orCondition(new MongoCondition[]{con1, con2, con3}).getCriteria()); + } else { + c1 = c.orCondition(new MongoCondition[]{con1, con2, con3}).getCriteria(); + } + } - public Date getTrackDownDateStart() { - return trackDownDateStart; - } - public void setTrackDownDateStart(Date trackDownDateStart) { - this.trackDownDateStart = trackDownDateStart; - } - public Date getTrackDownDateEnd() { - return trackDownDateEnd; - } + if (org.apache.commons.lang.StringUtils.isNotBlank(trackHospitalId)) { + MongoCondition c = MongoCondition.newInstance(); + MongoCondition con1 = MongoCondition.newInstance("trackHospitalId", trackHospitalId, MongoOper.IS); + MongoCondition con2 = MongoCondition.newInstance("hospitalId", trackHospitalId, MongoOper.IS); + if (c1 != null) { + c1 = c1.andOperator(c.orCondition(new MongoCondition[]{con1, con2}).getCriteria()); + } else { + c1 = c.orCondition(new MongoCondition[]{con1, con2}).getCriteria(); + } + } - public void setTrackDownDateEnd(Date trackDownDateEnd) { - this.trackDownDateEnd = trackDownDateEnd; - } + if (null != lastMensesStart) { + if (null != c1) { + c1 = c1.and("lastMenses").gte(lastMensesStart); + } else { + c1 = Criteria.where("lastMenses").gte(lastMensesStart); + } + } + if (null != lastMensesEnd) { + if (c1 != null) { + c1 = c1.lte(lastMensesEnd); + } else { + c1 = Criteria.where("lastMenses").lte(lastMensesEnd); + } + } - public Integer getFollowupStatus() { - return followupStatus; - } + if (null != foundStart) { + if (null != c1) { + c1 = c1.and("womanBuildTime").gte(foundStart); + } else { + c1 = Criteria.where("womanBuildTime").gte(foundStart); + } + } + if (null != foundEnd) { + if (c1 != null) { + c1 = c1.lte(foundEnd); + } else { + c1 = Criteria.where("womanBuildTime").lte(foundEnd); + } + } - public void setFollowupStatus(Integer followupStatus) { - this.followupStatus = followupStatus; - } + //排除 产筛 跟分娩住院 + if (queryTrackType != null && queryTrackType != 4 && queryTrackType != 5) { + if (null != appointmentDateStart) { + if (null != c1) { + c1 = c1.and("appointmentDate").gte(appointmentDateStart); + } else { + c1 = Criteria.where("appointmentDate").gte(appointmentDateStart); + } + } + if (null != appointmentDateEnd) { + if (c1 != null) { + c1 = c1.lte(appointmentDateEnd); + } else { + c1 = Criteria.where("appointmentDate").lte(appointmentDateEnd); + } + } - public Date getAppointmentDateStart() { - return appointmentDateStart; - } + if (null != trackDownDateStart) { + if (null != c1) { + c1 = c1.and("trackDownDate").gte(trackDownDateStart); + } else { + c1 = Criteria.where("trackDownDate").gte(trackDownDateStart); + } + } + if (null != trackDownDateEnd) { + if (c1 != null) { + c1 = c1.lte(trackDownDateEnd); + } else { + c1 = Criteria.where("trackDownDate").lte(trackDownDateEnd); + } + } - public void setAppointmentDateStart(Date appointmentDateStart) { - this.appointmentDateStart = appointmentDateStart; + + if (null != startBeOverdueDays) { + if (null != c1) { + c1 = c1.and("appointmentDate").gte(startBeOverdueDays); + } else { + c1 = Criteria.where("appointmentDate").gte(startBeOverdueDays); + } + } + if (null != endBeOverdueDays) { + if (c1 != null) { + if (c1.getCriteriaObject().containsField("appointmentDate")) + { + c1 = c1.lte(endBeOverdueDays); + } + else + { + c1 = c1.and("appointmentDate").lte(endBeOverdueDays); + } + + } else { + c1 = Criteria.where("appointmentDate").lte(endBeOverdueDays); + } + } + + + if (null != checkOverDaysStart) { + if (null != c1) { + c1 = c1.and("nextCheckTime").gte(checkOverDaysStart); + } else { + c1 = Criteria.where("nextCheckTime").gte(checkOverDaysStart); + } + } + if (null != checkOverDaysEnd) { + if (c1 != null) { + if (c1.getCriteriaObject().containsField("nextCheckTime")) + { + c1 = c1.lte(checkOverDaysEnd); + } + else + { + c1 = c1.and("nextCheckTime").lte(checkOverDaysEnd); + } + + } else { + c1 = Criteria.where("nextCheckTime").lte(checkOverDaysEnd); + } + } + + + } + /******产筛特殊处理*******/ + if (null != queryTrackType && queryTrackType == 4) { + if (null != trackDownDateStart) { + if (null != c1) { + c1 = c1.and("sieveTrackDownDate").gte(trackDownDateStart); + } else { + c1 = Criteria.where("sieveTrackDownDate").gte(trackDownDateStart); + } + } + if (null != trackDownDateEnd) { + if (c1 != null) { + c1 = c1.lte(trackDownDateEnd); + } else { + c1 = Criteria.where("sieveTrackDownDate").lte(trackDownDateEnd); + } + } + + if (null != startBeOverdueDays) { + if (null != c1) { + c1 = c1.and("sieveAppointmentDate").gte(startBeOverdueDays); + } else { + c1 = Criteria.where("sieveAppointmentDate").gte(startBeOverdueDays); + } + } + if (null != endBeOverdueDays) { + if (c1 != null) { + c1 = c1.lte(endBeOverdueDays); + } else { + c1 = Criteria.where("sieveAppointmentDate").lte(endBeOverdueDays); + } + } + if (null != appointmentDateStart) { + if (null != c1) { + c1 = c1.and("sieveAppointmentDate").gte(appointmentDateStart); + } else { + c1 = Criteria.where("sieveAppointmentDate").gte(appointmentDateStart); + } + } + if (null != appointmentDateEnd) { + if (c1 != null) { + c1 = c1.lte(appointmentDateEnd); + } else { + c1 = Criteria.where("sieveAppointmentDate").lte(appointmentDateEnd); + } + } + } + + /**********分娩住院特殊处理**************/ + if (null != queryTrackType && queryTrackType == 5) { + if (null != trackDownDateStart) { + if (null != c1) { + c1 = c1.and("fmzyTrackDownDate").gte(trackDownDateStart); + } else { + c1 = Criteria.where("fmzyTrackDownDate").gte(trackDownDateStart); + } + } + if (null != trackDownDateEnd) { + if (c1 != null) { + c1 = c1.lte(trackDownDateEnd); + } else { + c1 = Criteria.where("fmzyTrackDownDate").lte(trackDownDateEnd); + } + } + + if (null != startBeOverdueDays) { + if (null != c1) { + c1 = c1.and("fmzyAppointmentDate").gte(startBeOverdueDays); + } else { + c1 = Criteria.where("fmzyAppointmentDate").gte(startBeOverdueDays); + } + } + if (null != endBeOverdueDays) { + if (c1 != null) { + c1 = c1.lte(endBeOverdueDays); + } else { + c1 = Criteria.where("fmzyAppointmentDate").lte(endBeOverdueDays); + } + } + if (null != appointmentDateStart) { + if (null != c1) { + c1 = c1.and("fmzyAppointmentDate").gte(appointmentDateStart); + } else { + c1 = Criteria.where("fmzyAppointmentDate").gte(appointmentDateStart); + } + } + if (null != appointmentDateEnd) { + if (c1 != null) { + c1 = c1.lte(appointmentDateEnd); + } else { + c1 = Criteria.where("fmzyAppointmentDate").lte(appointmentDateEnd); + } + } + } + + + if (null != startCreated) { + if (null != c1) { + c1 = c1.and("created").gte(startCreated); + } else { + c1 = Criteria.where("created").gte(startCreated); + } + } + if (null != endCreated) { + if (c1 != null) { + c1 = c1.lte(endCreated); + } else { + c1 = Criteria.where("created").lte(endCreated); + } + } + + + if (null != c1) { + condition = condition.andCondition(new MongoCondition(c1)); + } + return condition.toMongoQuery(); + } + + + + public Date getCheckOverDaysStart() { + return checkOverDaysStart; + } + + public void setCheckOverDaysStart(Date checkOverDaysStart) { + this.checkOverDaysStart = checkOverDaysStart; + } + + public Date getCheckOverDaysEnd() { + return checkOverDaysEnd; + } + + public void setCheckOverDaysEnd(Date checkOverDaysEnd) { + this.checkOverDaysEnd = checkOverDaysEnd; + } + + public String getTrackHospitalId() { + return trackHospitalId; + } + + public void setTrackHospitalId(String trackHospitalId) { + this.trackHospitalId = trackHospitalId; + } + + public List getHospitalIdList() { + return hospitalIdList; + } + + public void setHospitalIdList(List hospitalIdList) { + this.hospitalIdList = hospitalIdList; + } + + public boolean isHistory() { + return isHistory; + } + + public void setHistory(boolean history) { + isHistory = history; + } + + public Date getStartCreated() { + return startCreated; + } + + public void setStartCreated(Date startCreated) { + this.startCreated = startCreated; + } + + public Date getEndCreated() { + return endCreated; + } + + public void setEndCreated(Date endCreated) { + this.endCreated = endCreated; + } + + public Integer getQueryTrackType() { + return queryTrackType; + } + + public void setQueryTrackType(Integer queryTrackType) { + this.queryTrackType = queryTrackType; + } + + + public Date getStartBeOverdueDays() { + return startBeOverdueDays; + } + + public void setStartBeOverdueDays(Date startBeOverdueDays) { + this.startBeOverdueDays = startBeOverdueDays; + } + + public Date getEndBeOverdueDays() { + return endBeOverdueDays; + } + + public void setEndBeOverdueDays(Date endBeOverdueDays) { + this.endBeOverdueDays = endBeOverdueDays; + } + + public Date getTrackDownDateStart() { + return trackDownDateStart; + } + + public void setTrackDownDateStart(Date trackDownDateStart) { + this.trackDownDateStart = trackDownDateStart; + } + + public Date getTrackDownDateEnd() { + return trackDownDateEnd; + } + + public void setTrackDownDateEnd(Date trackDownDateEnd) { + this.trackDownDateEnd = trackDownDateEnd; + } + + public Integer getFollowupStatus() { + return followupStatus; + } + + public void setFollowupStatus(Integer followupStatus) { + this.followupStatus = followupStatus; + } + + public Date getAppointmentDateStart() { + return appointmentDateStart; + } + + public void setAppointmentDateStart(Date appointmentDateStart) { + this.appointmentDateStart = appointmentDateStart; } public Date getAppointmentDateEnd() { @@ -369,344 +766,4 @@ public class TrackDownRecordQuery extends BaseQuery implements IConvertToNativeQ public void setTrackType(Integer trackType) { this.trackType = trackType; } - - @Override - public MongoQuery convertToQuery() { - MongoCondition condition = MongoCondition.newInstance(); - - if (status != null) { - if (status != 3) {//查询全部 - condition = condition.and("status", status, MongoOper.IS); - } - } else { - //默认只查询显示的数据 - condition = condition.and("status", 1, MongoOper.IS); - } - - if (StringUtils.isNotEmpty(id)) { - condition = condition.and("id", id, MongoOper.IS); - } - - if (CollectionUtils.isNotEmpty(hospitalIdList)) { - condition = condition.and("hospitalId", hospitalIdList, MongoOper.IN); - } - - if (StringUtils.isNotEmpty(phone)) { - condition = condition.and("phone", phone, MongoOper.IS); - } - - if (StringUtils.isNotEmpty(cardNo)) { - condition = condition.and("cardNo", cardNo, MongoOper.IS); - } - - if (isHistory) { - condition = condition.and("isHistory", false, MongoOper.EXISTS); - } - - if (StringUtils.isNotEmpty(provinceId)) { - condition = condition.and("provinceRegisterId", provinceId, MongoOper.IS); - } - if (StringUtils.isNotEmpty(residentsArchiveId)) { - condition = condition.and("residentsArchiveId", residentsArchiveId, MongoOper.IS); - } - if (StringUtils.isNotEmpty(cityId)) { - condition = condition.and("cityRegisterId", cityId, MongoOper.IS); - } - if (StringUtils.isNotEmpty(areaId)) { - condition = condition.and("areaRegisterId", areaId, MongoOper.IS); - } - if (StringUtils.isNotEmpty(hospitalId)) { - condition = condition.and("hospitalId", hospitalId, MongoOper.IS); - } - if (StringUtils.isNotEmpty(streetId)) { - condition = condition.and("streetRegisterId", streetId, MongoOper.IS); - } - if (null != trackType) { - condition = condition.and("trackType", trackType, MongoOper.IS); - } - if (null != trackTypes) { - condition = condition.and("trackType", trackTypes, MongoOper.IN); - } - - if (StringUtils.isNotEmpty(source)) { - condition = condition.and("source", source, MongoOper.IS); - } - if (StringUtils.isNotEmpty(parentId)) { - condition = condition.and("parentId", parentId, MongoOper.IS); - } - if (null != parentIds) { - condition = condition.and("parentId", parentIds, MongoOper.IN); - } - - if (null != pids) { - condition = condition.and("pid", pids, MongoOper.IN); - } - - //排除 产筛跟分娩住院 - if (queryTrackType != null && queryTrackType != 4 && queryTrackType != 5) { - if (null != followupStatus) { - if (followupStatus == 0) { - Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); - condition = condition.and("appointmentDate", newDate, MongoOper.GTE); - } else if (followupStatus == 1) { - Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); - condition = condition.and("appointmentDate", newDate, MongoOper.LT); - } else if (followupStatus == 2) { - condition = condition.and("stop", "1", MongoOper.IS); - } - } - } - - /*******产筛特殊处理**********/ - if (queryTrackType != null && queryTrackType == 4) { - if (null != followupStatus) { - if (followupStatus == 0) { - Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); - condition = condition.and("sieveAppointmentDate", newDate, MongoOper.GTE); - } else if (followupStatus == 1) { - Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); - condition = condition.and("sieveAppointmentDate", newDate, MongoOper.LT); - } else if (followupStatus == 2) { - condition = condition.and("stop", "1", MongoOper.IS); - } - } - - } - - /*****分娩住院特殊处理*********/ - if (queryTrackType != null && queryTrackType == 5) { - if (null != followupStatus) { - if (followupStatus == 0) { - Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); - condition = condition.and("fmzyAppointmentDate", newDate, MongoOper.GTE); - } else if (followupStatus == 1) { - Date newDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd(new Date()) + " 00:00:00"); - condition = condition.and("fmzyAppointmentDate", newDate, MongoOper.LT); - } else if (followupStatus == 2) { - condition = condition.and("stop", "1", MongoOper.IS); - } - } - - } - Criteria c1 = null; - - if (StringUtils.isNotEmpty(key)) { - MongoCondition c = MongoCondition.newInstance(); - MongoCondition con1 = MongoCondition.newInstance("phone", key, MongoOper.IS); - MongoCondition con2 = MongoCondition.newInstance("username", "^" + key, MongoOper.LIKE); - MongoCondition con3 = MongoCondition.newInstance("cardNo", key, MongoOper.IS); - if (c1 != null) { - c1 = c1.andOperator(c.orCondition(new MongoCondition[]{con1, con2, con3}).getCriteria()); - } else { - c1 = c.orCondition(new MongoCondition[]{con1, con2, con3}).getCriteria(); - } - } - - - - if (org.apache.commons.lang.StringUtils.isNotBlank(trackHospitalId)) { - MongoCondition c = MongoCondition.newInstance(); - MongoCondition con1 = MongoCondition.newInstance("trackHospitalId", trackHospitalId, MongoOper.IS); - MongoCondition con2 = MongoCondition.newInstance("hospitalId", trackHospitalId, MongoOper.IS); - if (c1 != null) { - c1 = c1.andOperator(c.orCondition(new MongoCondition[]{con1, con2}).getCriteria()); - } else { - c1 = c.orCondition(new MongoCondition[]{con1, con2}).getCriteria(); - } - } - - if (null != lastMensesStart) { - if (null != c1) { - c1 = c1.and("lastMenses").gte(lastMensesStart); - } else { - c1 = Criteria.where("lastMenses").gte(lastMensesStart); - } - } - if (null != lastMensesEnd) { - if (c1 != null) { - c1 = c1.lte(lastMensesEnd); - } else { - c1 = Criteria.where("lastMenses").lte(lastMensesEnd); - } - } - - if (null != foundStart) { - if (null != c1) { - c1 = c1.and("womanBuildTime").gte(foundStart); - } else { - c1 = Criteria.where("womanBuildTime").gte(foundStart); - } - } - if (null != foundEnd) { - if (c1 != null) { - c1 = c1.lte(foundEnd); - } else { - c1 = Criteria.where("womanBuildTime").lte(foundEnd); - } - } - - //排除 产筛 跟分娩住院 - if (queryTrackType != null && queryTrackType != 4 && queryTrackType != 5) { - if (null != appointmentDateStart) { - if (null != c1) { - c1 = c1.and("appointmentDate").gte(appointmentDateStart); - } else { - c1 = Criteria.where("appointmentDate").gte(appointmentDateStart); - } - } - if (null != appointmentDateEnd) { - if (c1 != null) { - c1 = c1.lte(appointmentDateEnd); - } else { - c1 = Criteria.where("appointmentDate").lte(appointmentDateEnd); - } - } - - if (null != trackDownDateStart) { - if (null != c1) { - c1 = c1.and("trackDownDate").gte(trackDownDateStart); - } else { - c1 = Criteria.where("trackDownDate").gte(trackDownDateStart); - } - } - if (null != trackDownDateEnd) { - if (c1 != null) { - c1 = c1.lte(trackDownDateEnd); - } else { - c1 = Criteria.where("trackDownDate").lte(trackDownDateEnd); - } - } - - - if (null != startBeOverdueDays) { - if (null != c1) { - c1 = c1.and("appointmentDate").gte(startBeOverdueDays); - } else { - c1 = Criteria.where("appointmentDate").gte(startBeOverdueDays); - } - } - if (null != endBeOverdueDays) { - if (c1 != null) { - c1 = c1.lte(endBeOverdueDays); - } else { - c1 = Criteria.where("appointmentDate").lte(endBeOverdueDays); - } - } - } - /******产筛特殊处理*******/ - if (null != queryTrackType && queryTrackType == 4) { - if (null != trackDownDateStart) { - if (null != c1) { - c1 = c1.and("sieveTrackDownDate").gte(trackDownDateStart); - } else { - c1 = Criteria.where("sieveTrackDownDate").gte(trackDownDateStart); - } - } - if (null != trackDownDateEnd) { - if (c1 != null) { - c1 = c1.lte(trackDownDateEnd); - } else { - c1 = Criteria.where("sieveTrackDownDate").lte(trackDownDateEnd); - } - } - - if (null != startBeOverdueDays) { - if (null != c1) { - c1 = c1.and("sieveAppointmentDate").gte(startBeOverdueDays); - } else { - c1 = Criteria.where("sieveAppointmentDate").gte(startBeOverdueDays); - } - } - if (null != endBeOverdueDays) { - if (c1 != null) { - c1 = c1.lte(endBeOverdueDays); - } else { - c1 = Criteria.where("sieveAppointmentDate").lte(endBeOverdueDays); - } - } - if (null != appointmentDateStart) { - if (null != c1) { - c1 = c1.and("sieveAppointmentDate").gte(appointmentDateStart); - } else { - c1 = Criteria.where("sieveAppointmentDate").gte(appointmentDateStart); - } - } - if (null != appointmentDateEnd) { - if (c1 != null) { - c1 = c1.lte(appointmentDateEnd); - } else { - c1 = Criteria.where("sieveAppointmentDate").lte(appointmentDateEnd); - } - } - } - - /**********分娩住院特殊处理**************/ - if (null != queryTrackType && queryTrackType == 5) { - if (null != trackDownDateStart) { - if (null != c1) { - c1 = c1.and("fmzyTrackDownDate").gte(trackDownDateStart); - } else { - c1 = Criteria.where("fmzyTrackDownDate").gte(trackDownDateStart); - } - } - if (null != trackDownDateEnd) { - if (c1 != null) { - c1 = c1.lte(trackDownDateEnd); - } else { - c1 = Criteria.where("fmzyTrackDownDate").lte(trackDownDateEnd); - } - } - - if (null != startBeOverdueDays) { - if (null != c1) { - c1 = c1.and("fmzyAppointmentDate").gte(startBeOverdueDays); - } else { - c1 = Criteria.where("fmzyAppointmentDate").gte(startBeOverdueDays); - } - } - if (null != endBeOverdueDays) { - if (c1 != null) { - c1 = c1.lte(endBeOverdueDays); - } else { - c1 = Criteria.where("fmzyAppointmentDate").lte(endBeOverdueDays); - } - } - if (null != appointmentDateStart) { - if (null != c1) { - c1 = c1.and("fmzyAppointmentDate").gte(appointmentDateStart); - } else { - c1 = Criteria.where("fmzyAppointmentDate").gte(appointmentDateStart); - } - } - if (null != appointmentDateEnd) { - if (c1 != null) { - c1 = c1.lte(appointmentDateEnd); - } else { - c1 = Criteria.where("fmzyAppointmentDate").lte(appointmentDateEnd); - } - } - } - - - if (null != startCreated) { - if (null != c1) { - c1 = c1.and("created").gte(startCreated); - } else { - c1 = Criteria.where("created").gte(startCreated); - } - } - if (null != endCreated) { - if (c1 != null) { - c1 = c1.lte(endCreated); - } else { - c1 = Criteria.where("created").lte(endCreated); - } - } - - - if (null != c1) { - condition = condition.andCondition(new MongoCondition(c1)); - } - return condition.toMongoQuery(); - } } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java index 858e7a7..bc2b068 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java @@ -3431,4 +3431,46 @@ public class TestController extends BaseController { return "setNumberCode finish"; } + @Autowired + private TrackDownRecordService trackDownRecordService; + + /** + * 修改最后一次产检预约日期同步到追访记录中 + * @return + */ + @RequestMapping(value = "/syncTrckDownNextTime", method = RequestMethod.GET) + @ResponseBody + public String syncTrckDownNextTime() { + TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); + downRecordQuery.setStatus(3); + List records = trackDownRecordService.queryTrackDown(downRecordQuery); + int batchSize = 1000; + int end = 0; + for (int i = 0; i < records.size(); i += batchSize) { + end = (end + batchSize); + if (end > records.size()) { + end = records.size(); + } + System.out.println("start:" + i + ",end:" + end); + final List tempList = records.subList(i, end); + new Thread(new Runnable() { + @Override + public void run() { + if (CollectionUtils.isNotEmpty(tempList)) { + for (TrackDownRecord down : tempList) { + + Patients pat = patientsService.findOnePatientById(down.getParentId()); + if (pat != null) + { + trackDownRecordService.updateTrackDownOneCol(down.getId(), pat.getNextCheckTime()); + } + } + } + } + }).start(); + } + + return "syncTrckDownNextTime finish"; + } + } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java index b76f733..1975c5a 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java @@ -1461,10 +1461,19 @@ public class AntenatalExaminationFacade { } if (StringUtils.isNotEmpty(nextCheckTime)) { trackDownRecord.setAppointmentDate(DateUtil.parseYMD(nextCheckTime)); + trackDownRecord.setNextCheckTime(DateUtil.parseYMD(nextCheckTime)); } else { trackDownRecord.setAppointmentDate(new Date()); + } trackDownService.addOrupdateTrackDownRecord(userId, trackDownRecord); + + //把下次预约时间更新为空 + if (StringUtils.isEmpty(nextCheckTime) && StringUtils.isNotEmpty(trackDownRecord.getId())) + { + trackDownRecordService.updateTrackDownOneCol(trackDownRecord.getId(),null); + } + } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java index f86e039..919e896 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java @@ -502,6 +502,34 @@ public class TrackDownFacade { downRecordQuery.setCityId(downQueryRequest.getCityId()); downRecordQuery.setStreetId(downQueryRequest.getStreetId()); downRecordQuery.setKey(downQueryRequest.getKey()); + + //产检逾期天数 + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); + antExRecordQuery.setCheckTimeStart(DateUtil.getMonth(-10)); //当前时间十个月以前的产检数据 + //逾期天数 + if (null != downQueryRequest.getCheckOverDaysStart()) { + Calendar instance = Calendar.getInstance(); + instance.setTime(new Date()); + instance.add(Calendar.DATE, -downQueryRequest.getCheckOverDaysStart()); + instance.set(Calendar.HOUR_OF_DAY, 23); + instance.set(Calendar.MINUTE, 59); + instance.set(Calendar.SECOND, 59); + instance.set(Calendar.MILLISECOND, 999); + Date end = instance.getTime(); + downRecordQuery.setCheckOverDaysEnd(end); + } + if (null != downQueryRequest.getCheckOverDaysEnd()) { + Calendar instance = Calendar.getInstance(); + instance.setTime(new Date()); + instance.add(Calendar.DATE, -downQueryRequest.getCheckOverDaysEnd()); + instance.set(Calendar.HOUR_OF_DAY, 00); + instance.set(Calendar.MINUTE, 00); + instance.set(Calendar.SECOND, 00); + instance.set(Calendar.MILLISECOND, 000); + Date start = instance.getTime(); + downRecordQuery.setCheckOverDaysStart(start); + } + /** *孕期检查 * */ @@ -565,6 +593,31 @@ public class TrackDownFacade { downRecordQuery.setStartBeOverdueDays(start); } + //逾期天数 + if (null != downQueryRequest.getBeOverdueDaysStart()) { + Calendar instance = Calendar.getInstance(); + instance.setTime(new Date()); + instance.add(Calendar.DATE, -downQueryRequest.getBeOverdueDaysStart()); + instance.set(Calendar.HOUR_OF_DAY, 23); + instance.set(Calendar.MINUTE, 59); + instance.set(Calendar.SECOND, 59); + instance.set(Calendar.MILLISECOND, 999); + Date end = instance.getTime(); + downRecordQuery.setEndBeOverdueDays(end); + } + if (null != downQueryRequest.getBeOverdueDaysEnd()) { + Calendar instance = Calendar.getInstance(); + instance.setTime(new Date()); + instance.add(Calendar.DATE, -downQueryRequest.getBeOverdueDaysEnd()); + instance.set(Calendar.HOUR_OF_DAY, 00); + instance.set(Calendar.MINUTE, 00); + instance.set(Calendar.SECOND, 00); + instance.set(Calendar.MILLISECOND, 000); + Date start = instance.getTime(); + downRecordQuery.setStartBeOverdueDays(start); + } + + //产检和产后数据特殊处理 if (null != downQueryRequest.getTrackType() && TrackDownDateEnums.C.getId() == downQueryRequest.getTrackType()) { @@ -597,8 +650,6 @@ public class TrackDownFacade { downRecordQuery.setHospitalId(hospitalId); - System.out.println("====>" + downRecordQuery.convertToQuery().convertToMongoQuery()); - return downRecordQuery; } @@ -753,6 +804,7 @@ public class TrackDownFacade { PageResult pageResult = new PageResult(); try { downRecordQuery = convertNaviteQuery(downQueryRequest, userId); + System.out.println(downRecordQuery.convertToQuery().convertToMongoQuery().toString()); } catch (Exception e) { pageResult.setCount(0); pageResult.setPage(downQueryRequest.getPage()); @@ -996,7 +1048,6 @@ public class TrackDownFacade { public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate, Integer encryption) { String parentId = downRecord.getParentId(); - String hospitalId = downRecord.getHospitalId(); Patients patients = patientsService.findOnePatientById(downRecord.getParentId()); Map temp = new HashMap<>(); @@ -1051,6 +1102,9 @@ public class TrackDownFacade { } else { temp.put("yyzfTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(downRecord.getAppointmentDate())); // 预约时间 temp.put("trackDownTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getTrackDownDate())); // 追访时间 + + int days = trackDown == null ? 0 : DateUtil.getDays(downRecord.getAppointmentDate(),new Date()); + temp.put("yyzfTimeDays", days); /** 追访逾期天数 */ } } else { @@ -1062,6 +1116,8 @@ public class TrackDownFacade { temp.put("yyzfTime", downRecord == null ? "--" : DateUtil.getyyyy_MM_dd(downRecord.getSieveAppointmentDate())); // 分娩住院预约时间 } else { temp.put("yyzfTime", downRecord == null ? "--" : DateUtil.getyyyy_MM_dd(downRecord.getAppointmentDate())); // 预约预约时间 + int days = downRecord == null ? 0 : DateUtil.getDays(downRecord.getAppointmentDate(),new Date()); + temp.put("yyzfTimeDays", days); /** 追访逾期天数 */ } } //如果是产前检查取预约结果 @@ -1072,6 +1128,9 @@ public class TrackDownFacade { //if (downRecord.getTrackType() == TrackDownDateEnums.C.getId() || downRecord.getTrackType() == TrackDownDateEnums.I.getId()) {//产检追访查询预约产检日期 if (examinationModel.getNextCheckTime() != null) { temp.put("yyTime", DateUtil.getyyyy_MM_dd(examinationModel.getNextCheckTime())); /** 预约产检日期 */ + + int days = DateUtil.getDays(examinationModel.getNextCheckTime(), new Date()); + temp.put("yyTimeDays", days); /** 预约逾期天数 */ } //} } else { @@ -1082,10 +1141,13 @@ public class TrackDownFacade { // if (downRecord.getTrackType() == TrackDownDateEnums.C.getId() || downRecord.getTrackType() == TrackDownDateEnums.I.getId()) {//产检追访查询预约产检日期 if (antExChuModel.getNextCheckTime() != null) { temp.put("yyTime", DateUtil.getyyyy_MM_dd(antExChuModel.getNextCheckTime())); /** 预约产检日期 */ + int days = DateUtil.getDays(antExChuModel.getNextCheckTime(), new Date()); + temp.put("yyTimeDays", days); /** 预约逾期天数 */ } //} } else { temp.put("yyTime", "--"); + temp.put("yyTimeDays", "--"); } } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/TrackDownQueryRequest.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/TrackDownQueryRequest.java index 102e189..6e1a3cc 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/TrackDownQueryRequest.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/TrackDownQueryRequest.java @@ -66,6 +66,15 @@ public class TrackDownQueryRequest extends BasePageQueryRequest { //起始逾期天数 private Integer beOverdueDays; + + //追访预约逾期天数 + private Integer beOverdueDaysStart; + private Integer beOverdueDaysEnd; + + //产检预约逾期天数 + private Integer checkOverDaysStart; + private Integer checkOverDaysEnd; + //开始追访日期 private String trackDownDateStart; @@ -92,6 +101,38 @@ public class TrackDownQueryRequest extends BasePageQueryRequest { private boolean isArea; + public Integer getCheckOverDaysStart() { + return checkOverDaysStart; + } + + public void setCheckOverDaysStart(Integer checkOverDaysStart) { + this.checkOverDaysStart = checkOverDaysStart; + } + + public Integer getCheckOverDaysEnd() { + return checkOverDaysEnd; + } + + public void setCheckOverDaysEnd(Integer checkOverDaysEnd) { + this.checkOverDaysEnd = checkOverDaysEnd; + } + + public Integer getBeOverdueDaysStart() { + return beOverdueDaysStart; + } + + public void setBeOverdueDaysStart(Integer beOverdueDaysStart) { + this.beOverdueDaysStart = beOverdueDaysStart; + } + + public Integer getBeOverdueDaysEnd() { + return beOverdueDaysEnd; + } + + public void setBeOverdueDaysEnd(Integer beOverdueDaysEnd) { + this.beOverdueDaysEnd = beOverdueDaysEnd; + } + public boolean isArea() { return isArea; } -- 1.8.3.1