From bea35a6424896b8f2cdc96747f88c83b498ed100 Mon Sep 17 00:00:00 2001 From: "[wangbo]" Date: Tue, 9 Jul 2019 19:33:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=95=E5=A6=87=E8=BF=BD=E8=AE=BF=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=AD=97=E6=AE=B5=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lyms/platform/biz/dal/IPatientDao.java | 1 + .../lyms/platform/biz/service/PatientsService.java | 14 +- .../main/java/com/lyms/platform/pojo/Patients.java | 36 ++++- .../com/lyms/platform/pojo/TrackDownRecord.java | 36 ++++- .../com/lyms/platform/query/PatientsQuery.java | 38 +++++ .../lyms/platform/query/ResidentsArchiveQuery.java | 8 +- .../lyms/platform/query/TrackDownRecordQuery.java | 180 ++++++++++++++++++++- .../web/controller/TrackDownController.java | 5 +- .../operate/web/facade/ResidentsArchiveFacade.java | 2 - .../operate/web/facade/TrackDownFacade.java | 34 ++++ .../web/request/ResidentsArchiveAddRequest.java | 21 +-- .../operate/web/request/TrackDownQueryRequest.java | 74 +++++++-- .../operate/web/service/ITrackDownService.java | 2 +- .../web/service/impl/TrackDownServiceImpl.java | 84 +++++++--- 14 files changed, 468 insertions(+), 67 deletions(-) diff --git a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java index e7e98de..cdd5850 100644 --- a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java +++ b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java @@ -16,6 +16,7 @@ public interface IPatientDao { public void updatePatient(Patients obj, String id); + public void deletePatient(String id); public Patients getPatient(String id); diff --git a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java index 15dd0b4..f930015 100644 --- a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java +++ b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java @@ -55,6 +55,11 @@ public class PatientsService { iPatientDao.updatePatient(obj, obj.getId()); } + public void updatePatientOne(Patients obj, String id) { + iPatientDao.updatePatient(obj, id); + } + + public void findAndModify(PatientsQuery query, Patients obj) { iPatientDao.findAndModify(query.convertToQuery(), obj); } @@ -344,8 +349,8 @@ public class PatientsService { System.out.println("开始处理产检、产筛追访数据进入产后复查追访:" + records.size()); for (TrackDownRecord tr : records) { Patients patients = iPatientDao.getPatient(tr.getParentId()); - if (patients != null){ - if( patients.getType() == 3) {//产妇 + if (patients != null) { + if (patients.getType() == 3) {//产妇 System.out.println("产检追访已经分娩:" + patients.getId()); //分娩距当前时间天数 int day = DateUtil.daysBetween(patients.getFmDate(), new Date()); @@ -359,7 +364,8 @@ public class PatientsService { System.out.println("开始处理产检、产筛追访数据进入分娩追访:" + patients.getId()); tr.setStatus(0); } - }if(patients.getType() == 1){ + } + if (patients.getType() == 1) { if (patients.getLastMenses() != null) { int week = DateUtil.getWeek2(patients.getLastMenses(), new Date()); if (week > 20) {//不能做产前筛查追访,显示产前检查追访 @@ -386,7 +392,7 @@ public class PatientsService { downRecordQuery.setTrackTypes(Arrays.asList(TrackDownDateEnums.C.getId(), TrackDownDateEnums.H.getId())); List records = trackDownRecordService.queryTrackDown(downRecordQuery); - System.out.println("开始处理孕周大于20周自动进入产检追访:"+records.size()); + System.out.println("开始处理孕周大于20周自动进入产检追访:" + records.size()); for (TrackDownRecord tr : records) { Patients patients = iPatientDao.getPatient(tr.getParentId()); if (patients == null || tr == null) { diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java b/platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java index f5c12d0..92cc0fc 100644 --- a/platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java @@ -12,7 +12,7 @@ import java.util.List; import java.util.Objects; -@Document(collection="lyms_patient") +@Document(collection = "lyms_patient") public class Patients extends BaseModel { private static final long serialVersionUID = SerialIdEnum.Patients.getCid(); @@ -127,7 +127,7 @@ public class Patients extends BaseModel { private String hstreetRegisterId; /******add by lqy end *********/ /** - *孕妇户籍地址 + * 孕妇户籍地址 */ private String address; private String provinceId; @@ -151,7 +151,7 @@ public class Patients extends BaseModel { private Integer dueStatus; //建档类型 0 未分娩建档 1儿童建档时建档 2 自动分娩类型 3 转诊自动建档 - private Integer buildType; + private Integer buildType; /** * 产后休养地 @@ -295,10 +295,35 @@ public class Patients extends BaseModel { //辅助建档医生id private String assistUserId; - //乡镇卫生机构id private String townOrgId; + /** + * 孕妇追访字段冗余 + */ + //预约时间 + private Date followupTime; + + //流程是否终止 + private String stop; + + + public Date getFollowupTime() { + return followupTime; + } + + public void setFollowupTime(Date followupTime) { + this.followupTime = followupTime; + } + + public String getStop() { + return stop; + } + + public void setStop(String stop) { + this.stop = stop; + } + public String getTownOrgId() { return townOrgId; } @@ -626,6 +651,7 @@ public class Patients extends BaseModel { public void setRiskLevelId(String riskLevelId) { this.riskLevelId = riskLevelId; } + public String getAddressPostRest() { return addressPostRest; } @@ -657,6 +683,7 @@ public class Patients extends BaseModel { public void setAreaPostRestId(String areaPostRestId) { this.areaPostRestId = areaPostRestId; } + public Integer getRiskScore() { return riskScore; } @@ -752,6 +779,7 @@ public class Patients extends BaseModel { public void setAreaRegisterId(String areaRegisterId) { this.areaRegisterId = areaRegisterId; } + public Integer getLastReportId() { return lastReportId; } 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 20a9d2c..dae01a0 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 @@ -20,7 +20,7 @@ import java.util.Date; * @since BME V100R001C40B104 */ @Document(collection = "lyms_trackdown_record") -public class TrackDownRecord extends BaseModel{ +public class TrackDownRecord extends BaseModel { private String id; private String username; @@ -52,6 +52,40 @@ public class TrackDownRecord extends BaseModel{ //数据所在的列表 private Integer trackType; + + //预约追访日期 + private Date appointmentDate; + + //追访日期 + private Date trackDownDate; + + //是否终止流程 + private String stop; + + public String getStop() { + return stop; + } + + public void setStop(String stop) { + this.stop = stop; + } + + public Date getAppointmentDate() { + return appointmentDate; + } + + public void setAppointmentDate(Date appointmentDate) { + this.appointmentDate = appointmentDate; + } + + public Date getTrackDownDate() { + return trackDownDate; + } + + public void setTrackDownDate(Date trackDownDate) { + this.trackDownDate = trackDownDate; + } + public String getSex() { return sex; } 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 387a9a1..5c798ce 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 @@ -336,6 +336,31 @@ public class PatientsQuery extends BaseQuery implements IConvertToNativeQuery { private Date endAge; + /** + * 孕妇追访字段冗余 + * 0 代表正常 1 待追访 2.已终止 + */ + private Integer followupStatus; + + //是否分娩 + private Boolean isDeliver; + + public Boolean isDeliver() { + return isDeliver; + } + + public void setDeliver(Boolean deliver) { + isDeliver = deliver; + } + + public Integer getFollowupStatus() { + return followupStatus; + } + + public void setFollowupStatus(Integer followupStatus) { + this.followupStatus = followupStatus; + } + public Date getStartAge() { return startAge; } @@ -379,6 +404,19 @@ public class PatientsQuery extends BaseQuery implements IConvertToNativeQuery { if (null != serviceTypeIsExist) { condition = condition.and("serviceType", serviceTypeIsExist, MongoOper.EXISTS); } + if (null != isDeliver) { + condition = condition.and("fmDate", isDeliver, MongoOper.EXISTS); + } + + if (null != followupStatus) { + if (0 == followupStatus) { + condition = condition.and("followupTime", new Date(), MongoOper.GTE); + } else if (1 == followupStatus) { + condition = condition.and("followupTime", new Date(), MongoOper.LTE); + } else if (2 == followupStatus) { + condition = condition.and("stop", "1", MongoOper.IS); + } + } if (null != townOrgId) { condition = condition.and("townOrgId", townOrgId, MongoOper.IS); diff --git a/platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java b/platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java index 6d6410e..2e4df3a 100644 --- a/platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java +++ b/platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java @@ -174,16 +174,14 @@ public class ResidentsArchiveQuery extends BaseQuery implements IConvertToNative condition = condition.and("pregnantBuild", pregnantBuild, MongoOper.IS); } if (null != followupStatus) { - if (followupStatus == 1) { + if (followupStatus == 0) { + condition = condition.and("followupTime", new Date(), MongoOper.GTE); + } else if (followupStatus == 1) { condition = condition.and("followupTime", new Date(), MongoOper.LTE); } else if (followupStatus == 2) { - condition = condition.and("followupTime", new Date(), MongoOper.GTE); - } else if (followupStatus == 3) { condition = condition.and("stop", "1", MongoOper.IS); } } - - if (StringUtils.isNotBlank(username)) { condition = condition.and("username", username, MongoOper.LIKE); } 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 e7634fd..0496f8c 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 @@ -53,6 +53,108 @@ public class TrackDownRecordQuery extends BaseQuery implements IConvertToNativeQ */ private Date lastMensesEnd; + //妇女建档开始日期 + private Date foundStart; + + //妇女建档结束日期 + private Date foundEnd; + + + //预约开始追访日期 + private Date appointmentDateStart; + + //预约结束追访日期 + private Date appointmentDateEnd; + + + //追访状态 0 正常 1. 待追访 2.已终止 + private Integer followupStatus; + + //开始追访日期 + private Date trackDownDateStart; + + //结束追访日期 + private Date trackDownDateEnd; + + //起始逾期时间 + private Date startBeOverdueDays; + + //结束逾期时间 + private Date endBeOverdueDays; + + + 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() { + return appointmentDateEnd; + } + + public void setAppointmentDateEnd(Date appointmentDateEnd) { + this.appointmentDateEnd = appointmentDateEnd; + } + + public Date getFoundStart() { + return foundStart; + } + + public void setFoundStart(Date foundStart) { + this.foundStart = foundStart; + } + + public Date getFoundEnd() { + return foundEnd; + } + + public void setFoundEnd(Date foundEnd) { + this.foundEnd = foundEnd; + } + public List getParentIds() { return parentIds; } @@ -209,8 +311,8 @@ public class TrackDownRecordQuery extends BaseQuery implements IConvertToNativeQ public MongoQuery convertToQuery() { MongoCondition condition = MongoCondition.newInstance(); - if (status!=null) { - if(status!=3){//查询全部 + if (status != null) { + if (status != 3) {//查询全部 condition = condition.and("status", status, MongoOper.IS); } } else { @@ -262,14 +364,22 @@ public class TrackDownRecordQuery extends BaseQuery implements IConvertToNativeQ condition = condition.and("parentId", parentId, MongoOper.IS); } - if (null!=parentIds) { + if (null != parentIds) { condition = condition.and("parentId", parentIds, MongoOper.IN); } if (null != pids) { condition = condition.and("pid", pids, MongoOper.IN); } - + if (null != followupStatus) { + if (followupStatus == 0) { + condition = condition.and("appointmentDate", new Date(), MongoOper.GTE); + } else if (followupStatus == 1) { + condition = condition.and("appointmentDate", new Date(), MongoOper.LTE); + } else if (followupStatus == 2) { + condition = condition.and("stop", "1", MongoOper.IS); + } + } Criteria c1 = null; if (StringUtils.isNotEmpty(key)) { @@ -298,6 +408,68 @@ public class TrackDownRecordQuery extends BaseQuery implements IConvertToNativeQ c1 = Criteria.where("lastMenses").lte(lastMensesEnd); } } + + if (null != foundStart) { + if (null != c1) { + c1 = c1.and("created").gte(foundStart); + } else { + c1 = Criteria.where("created").gte(foundStart); + } + } + if (null != foundEnd) { + if (c1 != null) { + c1 = c1.lte(foundEnd); + } else { + c1 = Criteria.where("created").lte(foundEnd); + } + } + + 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 != c1) { condition = condition.andCondition(new MongoCondition(c1)); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java index 3b544b4..9181869 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java @@ -4,6 +4,7 @@ import com.lyms.platform.biz.service.PatientsService; import com.lyms.platform.common.annotation.TokenRequired; import com.lyms.platform.common.base.BaseController; import com.lyms.platform.common.result.BaseResponse; +import com.lyms.platform.common.utils.DateUtil; import com.lyms.platform.operate.web.facade.TrackDownFacade; import com.lyms.platform.operate.web.facade.TrackDownJobFacade; import com.lyms.platform.operate.web.request.TrackDownQueryRequest; @@ -86,9 +87,9 @@ public class TrackDownController extends BaseController { @RequestMapping(value = "/all", method = RequestMethod.GET) public BaseResponse all(Date buildStart, Date buildEnd, Date checkStart, Date checkEnd, Date fmStart, Date fmEnd, String key, Integer type, @RequestParam Integer page, @RequestParam Integer limit, HttpServletRequest request, - Integer check, String checkup, String pregnantBuild, Integer followupStatus) { + Integer check, String checkup, String pregnantBuild, Integer followupStatus, boolean isDeliver) { return trackDownService.all(buildStart, buildEnd, checkStart, checkEnd, fmStart, fmEnd, key, - page, limit, getUserId(request), type, check, checkup, pregnantBuild, followupStatus); + page, limit, getUserId(request), type, check, checkup, pregnantBuild, followupStatus, isDeliver); } @ResponseBody diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java index e257c5f..b30d80c 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java @@ -441,8 +441,6 @@ public class ResidentsArchiveFacade{ trackDownService.addOrupdateTrackDownRecord(userId, trackDownRecord); } - - /** * 通过ID查看居民建档详情 * @param id 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 9fed1d8..e2abf71 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 @@ -375,6 +375,40 @@ public class TrackDownFacade { downRecordQuery.setCityId(downQueryRequest.getCityId()); downRecordQuery.setStreetId(downQueryRequest.getStreetId()); downRecordQuery.setKey(downQueryRequest.getKey()); + /** + * 孕妇追访功能新增搜索条件20190709 + * */ + downRecordQuery.setFoundStart(downQueryRequest.getFoundDateStart()); + downRecordQuery.setFoundEnd(downQueryRequest.getFoundDateEnd()); + + downRecordQuery.setAppointmentDateStart(downQueryRequest.getAppointmentDateStart()); + downRecordQuery.setAppointmentDateEnd(downQueryRequest.getAppointmentDateEnd()); + + downRecordQuery.setFollowupStatus(downQueryRequest.getFollowupStatus()); + + if (null != downQueryRequest.getBeOverdueDays()) { + Calendar instance = Calendar.getInstance(); + instance.setTime(new Date()); + instance.add(Calendar.DATE, -downQueryRequest.getBeOverdueDays()); + 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); + + instance.setTime(new Date()); + instance.add(Calendar.DATE, -downQueryRequest.getBeOverdueDays()); + 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()) { downRecordQuery.setTrackTypes(Arrays.asList(3, 9)); diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ResidentsArchiveAddRequest.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ResidentsArchiveAddRequest.java index 732f646..d5f08ed 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ResidentsArchiveAddRequest.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ResidentsArchiveAddRequest.java @@ -12,9 +12,8 @@ import java.util.Date; import java.util.Map; /** - * - * 居民建档请求数据 - * + * 居民建档请求数据 + *

* Created by Administrator on 2016/11/14 0014. */ @Form @@ -128,7 +127,7 @@ public class ResidentsArchiveAddRequest implements IBasicRequestConvert> restList = new ArrayList<>(); Integer archiveModelCount = 0; @@ -90,6 +94,7 @@ public class TrackDownServiceImpl extends BaseServiceImpl implements ITrackDownS query.setFollowupStatus(followupStatus); //妇女建档主数据 List modelList = residentsArchiveService.queryResident(query); + System.out.println("---------" + query.convertToQuery().convertToMongoQuery().toString()); // StopWatch stopWatch = new StopWatch("妇女建档主数据"); //优化前 // stopWatch.start("妇女建档优化前"); @@ -110,7 +115,6 @@ public class TrackDownServiceImpl extends BaseServiceImpl implements ITrackDownS } } } - } else { restList = getResidentMainData(modelList); } @@ -137,9 +141,11 @@ public class TrackDownServiceImpl extends BaseServiceImpl implements ITrackDownS patientsQuery.setNeed("need"); patientsQuery.setLimit(limit); patientsQuery.setPage(page); - patientsQuery.setHospitalId(hospitalId); patientsQuery.setQueryNo(key); + patientsQuery.setFollowupStatus(followupStatus); + patientsQuery.setDeliver(isDeliver); + List patientsList = patientsService.queryPatient(patientsQuery); StopWatch stopWatch = new StopWatch("孕妇建档主数据"); //优化前 @@ -787,28 +793,59 @@ public class TrackDownServiceImpl extends BaseServiceImpl implements ITrackDownS && TrackDownTransferEnums.B.getId() == trackDown.getTrackDownTransfer()) {//性别男:特殊处理,流转到下一流程时结束流程 trackDown.setTrackDownTransfer(TrackDownTransferEnums.C.getId()); } + /** 孕妇追访功能冗余字段**/ + //获取孕妇建档id + if (StringUtils.isNotEmpty(trackDownRecord.getParentId())) { + Patients patients = new Patients(); + if (null != trackDown.getReservatDate()) { + patients.setFollowupTime(trackDown.getReservatDate()); + } else { + patients.setFollowupTime(new Date()); + } + if (1 == trackDown.getTrackDownTransfer() || 2 == trackDown.getTrackDownTransfer()) { + patients.setStop("0"); + } else if (3 == trackDown.getTrackDownTransfer()) { + patients.setStop("1"); + } + patientsService.updatePatientOne(patients, trackDownRecord.getParentId()); + } + //获取妇女建党id + if (StringUtils.isNotEmpty(trackDownRecord.getResidentsArchiveId())) { + ResidentsArchiveModel residentsArchiveModel1 = new ResidentsArchiveModel(); + if (null != trackDown.getReservatDate()) { + residentsArchiveModel1.setFollowupTime(trackDown.getReservatDate()); + } else { + residentsArchiveModel1.setFollowupTime(new Date()); + } + /**冗余 现在处于哪一个流程*/ + if (1 == trackDown.getTrackDownTransfer() || 2 == trackDown.getTrackDownTransfer()) { + residentsArchiveModel1.setStop("0"); + } else if (3 == trackDown.getTrackDownTransfer()) { + residentsArchiveModel1.setStop("1"); + } + residentsArchiveService.updateResident(residentsArchiveModel1, trackDown.getParentId()); + } + /**冗余到追访记录表*/ + TrackDownRecord trackDownRecord1 = new TrackDownRecord(); + if (null != trackDownRecord.getAppointmentDate() && trackDown.getReservatDate() != null) { + trackDownRecord1.setAppointmentDate(trackDown.getReservatDate()); + } else { + trackDownRecord1.setAppointmentDate(new Date()); + } + if (null != trackDown.getTrackDownDate()) { + trackDownRecord1.setTrackDownDate(trackDown.getTrackDownDate()); + } + if (null != trackDownRecord.getStop() && null != trackDown.getTrackDownTransfer()) { + if (1 == trackDown.getTrackDownTransfer() || 2 == trackDown.getTrackDownTransfer()) { + trackDownRecord1.setStop("0"); + } else if (3 == trackDown.getTrackDownTransfer()) { + trackDownRecord1.setStop("1"); + } + } + trackDownRecordService.updateTrackDown(trackDownRecord1, trackDownRecord.getId()); } } } - /**冗余预约追访日期*/ - if (StringUtils.isNotEmpty(trackDown.getParentId()) && StringUtils.isNotEmpty(trackDown.getHospitalId())) { - ResidentsArchiveModel residentsArchiveModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(trackDown.getParentId()).and("hospitalId").is(trackDown.getHospitalId())), ResidentsArchiveModel.class); - if (null != residentsArchiveModel) { - ResidentsArchiveModel residentsArchiveModel1 = new ResidentsArchiveModel(); - if (null != residentsArchiveModel.getFollowupTime()) { - residentsArchiveModel1.setFollowupTime(trackDown.getReservatDate()); - } else { - residentsArchiveModel1.setFollowupTime(new Date()); - } - /**冗余 现在处于哪一个流程*/ - if (1 == trackDown.getTrackDownTransfer() || 2 == trackDown.getTrackDownTransfer()) { - residentsArchiveModel1.setStop("0"); - } else if (3 == trackDown.getTrackDownTransfer()) { - residentsArchiveModel1.setStop("1"); - } - residentsArchiveService.updateResident(residentsArchiveModel1, trackDown.getParentId()); - } - } trackDown.setId(null); trackDown.setYn(YnEnums.YES.getId()); trackDown.setCreated(new Date()); @@ -816,7 +853,6 @@ public class TrackDownServiceImpl extends BaseServiceImpl implements ITrackDownS trackDown.setOperaterId(userId); trackDown.setModified(new Date()); - trackDownService.add(trackDown); String recordId = trackDown.getTrackDownRecId(); updateRecordStatus(trackDown, recordId); @@ -845,8 +881,6 @@ public class TrackDownServiceImpl extends BaseServiceImpl implements ITrackDownS @Autowired private TrackDownRecordService trackDownRecordService; - @Autowired - private PatientsService patientsService; /** -- 1.8.3.1