From a33e4d0e6d2508d4cd764824bd685f4660c767f3 Mon Sep 17 00:00:00 2001 From: liquanyu Date: Fri, 24 Aug 2018 16:34:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E6=9B=BE=E9=AB=98=E5=8D=B1=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/biz/service/AntExRecordService.java | 11 +- .../java/com/lyms/platform/beans/SerialIdEnum.java | 1 + .../com/lyms/platform/pojo/BabySieveModel.java | 269 +++++++++++++++++++++ .../operate/web/facade/AntExRecordFacade.java | 175 +++++--------- 4 files changed, 337 insertions(+), 119 deletions(-) create mode 100644 platform-dal/src/main/java/com/lyms/platform/pojo/BabySieveModel.java diff --git a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java index 56a1edd..ad281ca 100644 --- a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java +++ b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java @@ -344,7 +344,7 @@ public class AntExRecordService { // } // return antExRecordDao.queryRecord(query.addOrder(Sort.Direction.DESC, "checkTime")); - return queryAntExRecords(antExRecordQuery,Sort.Direction.DESC,"checkTime"); + return queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "checkTime"); } public List queryAntExRecords(AntExRecordQuery antExRecordQuery,Sort.Direction direction,String sortField) { @@ -356,6 +356,15 @@ public class AntExRecordService { return antExRecordDao.queryRecord(query.addOrder(direction, sortField)); } + public List queryAntExRecords(AntExRecordQuery antExRecordQuery,Sort.Direction direction,String sortField,int count) { + MongoQuery query = antExRecordQuery.convertToQuery(); + if (StringUtils.isNotEmpty(antExRecordQuery.getNeed())) { + antExRecordQuery.mysqlBuild(count); + query.start(antExRecordQuery.getOffset()).end(antExRecordQuery.getLimit()); + } + return antExRecordDao.queryRecord(query.addOrder(direction, sortField)); + } + public Integer count(AntExRecordQuery antExRecordQuery) { return antExRecordDao.count(antExRecordQuery.convertToQuery()); diff --git a/platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java b/platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java index 8d62b47..2dc74e2 100644 --- a/platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java +++ b/platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java @@ -74,6 +74,7 @@ public enum SerialIdEnum { CourseTypeModel("CourseTypeModel", 97831039590L), PatientCourseModel("PatientCourseModel", 92531039591L), ModularFunctionConfigModel("ModularFunctionConfigModel", 97531039991L), + BabySieveModel("BabySieveModel", 97531049991L), BabyEyeCheck("BabyEyeCheck", 97521039591L); private String cname; diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/BabySieveModel.java b/platform-dal/src/main/java/com/lyms/platform/pojo/BabySieveModel.java new file mode 100644 index 0000000..e90961f --- /dev/null +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/BabySieveModel.java @@ -0,0 +1,269 @@ +package com.lyms.platform.pojo; + +import com.lyms.platform.beans.SerialIdEnum; +import com.lyms.platform.common.result.BaseModel; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 儿童新筛查 + * + */ +@Document(collection = "lyms_baby_sieve") +public class BabySieveModel extends BaseModel { + + private static final long serialVersionUID = SerialIdEnum.AntExChuModel.getCid(); + + + private String id; + //实验号 + private String testNumber; + + //采血单位 + private String collectHospitalId; + + //当前登陆操作医院 + private String currentHospitalId; + + //采血医生 + private String collectDocterId; + + //采血日期 + private Date collectDate; + + /****母亲信息*********/ + + //母亲姓名 + private String montherName; + //住院号 + private String zyNo; + //母亲身份证号 + private String montherCardNo; + //母亲疾病 + private String montherDisease; + + //联系方式 + private String phone; + //地址 + private String address; + + /****母亲信息*********/ + //儿童出生日期 + private Date babyBirth; + + //孕周 + private String dueWeek; + + //分娩方式 + private String dueType; + + //性别 + private Integer sex; + + //35种疾病筛查 + private String diseaseSieve; + + //送检医院 + private String sendCheckHospitalId; + + //儿童建档主键 + private String babyId; + + //分娩id + private String matdeliverId; + + //孕妇档案id + private String patientId; + + //创建时间 + private Date created; + //修改时间 + private Date modified; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTestNumber() { + return testNumber; + } + + public void setTestNumber(String testNumber) { + this.testNumber = testNumber; + } + + public String getCollectHospitalId() { + return collectHospitalId; + } + + public void setCollectHospitalId(String collectHospitalId) { + this.collectHospitalId = collectHospitalId; + } + + public String getCurrentHospitalId() { + return currentHospitalId; + } + + public void setCurrentHospitalId(String currentHospitalId) { + this.currentHospitalId = currentHospitalId; + } + + public String getCollectDocterId() { + return collectDocterId; + } + + public void setCollectDocterId(String collectDocterId) { + this.collectDocterId = collectDocterId; + } + + public Date getCollectDate() { + return collectDate; + } + + public void setCollectDate(Date collectDate) { + this.collectDate = collectDate; + } + + public String getMontherName() { + return montherName; + } + + public void setMontherName(String montherName) { + this.montherName = montherName; + } + + public String getZyNo() { + return zyNo; + } + + public void setZyNo(String zyNo) { + this.zyNo = zyNo; + } + + public String getMontherCardNo() { + return montherCardNo; + } + + public void setMontherCardNo(String montherCardNo) { + this.montherCardNo = montherCardNo; + } + + public String getMontherDisease() { + return montherDisease; + } + + public void setMontherDisease(String montherDisease) { + this.montherDisease = montherDisease; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Date getBabyBirth() { + return babyBirth; + } + + public void setBabyBirth(Date babyBirth) { + this.babyBirth = babyBirth; + } + + public String getDueWeek() { + return dueWeek; + } + + public void setDueWeek(String dueWeek) { + this.dueWeek = dueWeek; + } + + public String getDueType() { + return dueType; + } + + public void setDueType(String dueType) { + this.dueType = dueType; + } + + public Integer getSex() { + return sex; + } + + public void setSex(Integer sex) { + this.sex = sex; + } + + public String getDiseaseSieve() { + return diseaseSieve; + } + + public void setDiseaseSieve(String diseaseSieve) { + this.diseaseSieve = diseaseSieve; + } + + public String getSendCheckHospitalId() { + return sendCheckHospitalId; + } + + public void setSendCheckHospitalId(String sendCheckHospitalId) { + this.sendCheckHospitalId = sendCheckHospitalId; + } + + public String getBabyId() { + return babyId; + } + + public void setBabyId(String babyId) { + this.babyId = babyId; + } + + public String getMatdeliverId() { + return matdeliverId; + } + + public void setMatdeliverId(String matdeliverId) { + this.matdeliverId = matdeliverId; + } + + public String getPatientId() { + return patientId; + } + + public void setPatientId(String patientId) { + this.patientId = patientId; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getModified() { + return modified; + } + + public void setModified(Date modified) { + this.modified = modified; + } +} 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 a507ffc..637d3d7 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 @@ -625,8 +625,8 @@ public class AntExRecordFacade { } //antExRecordQuery.setLevelId(antExManagerQueryRequest.getLevel()); - List antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC,"created"); - System.out.println("antExRecordModelList===================="+antExRecordModelList.size()); + List antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "created"); + System.out.println("antExRecordModelList====================" + antExRecordModelList.size()); Map> map = handleAntexRecord(antExRecordModelList); AntExRecordQuery pageAntExRecordsQuery = new AntExRecordQuery(); @@ -644,7 +644,7 @@ public class AntExRecordFacade { { initBasicData(); - List ids = new ArrayList<>(); + List> ids = new ArrayList<>(); Map> incriskMap = new HashMap<>(); if (map.size() > 0) @@ -673,7 +673,7 @@ public class AntExRecordFacade { public Map call() { Map result = new HashMap(); if (CollectionUtils.isNotEmpty(tempList)) { - List ids = new ArrayList<>(); + List> ids = new ArrayList<>(); Map> incriskMap = new HashMap<>(); AntExRecordQuery beforeRecordQuery = new AntExRecordQuery(); for (String patientId : tempList) { @@ -695,7 +695,10 @@ public class AntExRecordFacade { if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") && getConditionRisk(request.getRiskFactorId(), currentRiskList, request.getLevel())) { - ids.add(oneRecord.getId()); + Map objMap = new HashMap(); + objMap.put("id",oneRecord.getId()); + objMap.put("time",oneRecord.getCheckTime()); + ids.add(objMap); incriskMap.put(oneRecord.getId(), currentRiskList); } else if (CollectionUtils.isNotEmpty(beforeRiskList)) { List incrHrisk = new ArrayList(); @@ -705,14 +708,20 @@ public class AntExRecordFacade { } } if (CollectionUtils.isNotEmpty(incrHrisk) && getConditionRisk(request.getRiskFactorId(), incrHrisk, request.getLevel())) { - ids.add(oneRecord.getId()); + Map objMap = new HashMap(); + objMap.put("id",oneRecord.getId()); + objMap.put("time",oneRecord.getCheckTime()); + ids.add(objMap); incriskMap.put(oneRecord.getId(), incrHrisk); } } } else { if (CollectionUtils.isNotEmpty(oneRecord.gethRisk()) && getConditionRisk(request.getRiskFactorId(), oneRecord.gethRisk(), request.getLevel())) { - ids.add(oneRecord.getId()); + Map objMap = new HashMap(); + objMap.put("id",oneRecord.getId()); + objMap.put("time",oneRecord.getCheckTime()); + ids.add(objMap); incriskMap.put(oneRecord.getId(), oneRecord.gethRisk()); } } @@ -740,7 +749,10 @@ public class AntExRecordFacade { if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") && getConditionRisk(request.getRiskFactorId(), currentRiskList, request.getLevel())) { - ids.add(oneRecord.getId()); + Map objMap = new HashMap(); + objMap.put("id",oneRecord.getId()); + objMap.put("time",oneRecord.getCheckTime()); + ids.add(objMap); incriskMap.put(oneRecord.getId(), currentRiskList); } else if (CollectionUtils.isNotEmpty(beforeRiskList)) { List incrHrisk = new ArrayList(); @@ -751,7 +763,10 @@ public class AntExRecordFacade { } if (CollectionUtils.isNotEmpty(incrHrisk) && getConditionRisk(request.getRiskFactorId(), incrHrisk, request.getLevel())) { - ids.add(oneRecord.getId()); + Map objMap = new HashMap(); + objMap.put("id",oneRecord.getId()); + objMap.put("time",oneRecord.getCheckTime()); + ids.add(objMap); incriskMap.put(oneRecord.getId(), incrHrisk); } } @@ -784,128 +799,52 @@ public class AntExRecordFacade { } riskBasicMap.clear(); + } -// for (String patientId : map.keySet()) -// { -// List list = map.get(patientId); -// if (CollectionUtils.isNotEmpty(list)) -// { -// if (list.size() == 1) -// { -// AntExRecordModel oneRecord = list.get(0); -// if (!(CollectionUtils.isNotEmpty(oneRecord.gethRisk()) && oneRecord.gethRisk().contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6"))) -// { -// if (CollectionUtils.isNotEmpty(oneRecord.gethRisk())) -// { -// beforeRecordQuery.setParentId(patientId); -// beforeRecordQuery.setCheckTimeEnd(oneRecord.getCheckTime()); -// beforeRecordQuery.setNeqId(oneRecord.getId()); -// List beforeAntRecords = recordService.queryAntExRecords(beforeRecordQuery); -// if (CollectionUtils.isNotEmpty(beforeAntRecords)) -// { -// AntExRecordModel twoRecord = beforeAntRecords.get(0); -// List currentRiskList = oneRecord.gethRisk(); -// List beforeRiskList = twoRecord.gethRisk(); -// -// if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") -// && getConditionRisk(request.getRiskFactorId(),currentRiskList,request.getLevel())) -// { -// ids.add(oneRecord.getId()); -// incriskMap.put(oneRecord.getId(), currentRiskList); -// } -// else if (CollectionUtils.isNotEmpty(beforeRiskList) ) -// { -// List incrHrisk = new ArrayList(); -// for (Object riskId : currentRiskList) -// { -// if (!beforeRiskList.contains(riskId)) -// { -// incrHrisk.add(riskId); -// } -// } -// if (CollectionUtils.isNotEmpty(incrHrisk) && getConditionRisk(request.getRiskFactorId(),incrHrisk,request.getLevel())) -// { -// ids.add(oneRecord.getId()); -// incriskMap.put(oneRecord.getId(), incrHrisk); -// } -// } -// } -// else -// { -// if (CollectionUtils.isNotEmpty(oneRecord.gethRisk()) && getConditionRisk(request.getRiskFactorId(), -// oneRecord.gethRisk(),request.getLevel())) -// { -// ids.add(oneRecord.getId()); -// incriskMap.put(oneRecord.getId(), oneRecord.gethRisk()); -// } -// } -// } -// } -// } -// else if (list.size() > 1) -// { -// AntExRecordModel oneRecord = list.get(0); -// -// if (CollectionUtils.isNotEmpty(oneRecord.gethRisk()) && oneRecord.gethRisk().contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6")) -// { -// continue; -// } -// -// AntExRecordModel twoRecord = list.get(1); -// -// List currentRiskList = oneRecord.gethRisk(); -// List beforeRiskList = twoRecord.gethRisk(); -// -// if (CollectionUtils.isEmpty(currentRiskList) && CollectionUtils.isEmpty(beforeRiskList)) -// { -// continue; -// } -// if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") -// && CollectionUtils.isEmpty(currentRiskList)) -// { -// continue; -// } -// -// if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") -// && getConditionRisk(request.getRiskFactorId(),currentRiskList,request.getLevel())) -// { -// ids.add(oneRecord.getId()); -// incriskMap.put(oneRecord.getId(), currentRiskList); -// } -// else if (CollectionUtils.isNotEmpty(beforeRiskList) ) -// { -// List incrHrisk = new ArrayList(); -// for (Object riskId : currentRiskList) -// { -// if (!beforeRiskList.contains(riskId)) -// { -// incrHrisk.add(String.valueOf(riskId)); -// } -// } -// if (CollectionUtils.isNotEmpty(incrHrisk) && getConditionRisk(request.getRiskFactorId(),incrHrisk,request.getLevel())) -// { -// -// ids.add(oneRecord.getId()); -// incriskMap.put(oneRecord.getId(), incrHrisk); -// } -// } -// } -// } -// } + if (CollectionUtils.isEmpty(ids)) + { + return null; } if (CollectionUtils.isEmpty(ids)) { + Collections.sort(ids, new Comparator>() { + @Override + public int compare(Map o1, Map o2) { + Object d1 = o1.get("time"); + Object d2 = o2.get("time"); + if (d1 != null && d1 != null) + { + return ((Date)d1).compareTo((Date)d2); + } + return 0; + } + }); + } + + int index = request.getPage() * request.getLimit() - request.getLimit(); + int from = request.getPage() * request.getLimit(); + System.out.println("index = " + index + " from = " + from); + List> pages = ids.subList(index,from); + if (CollectionUtils.isEmpty(pages)) + { return null; } + + List recordIds = new ArrayList<>(); + for (Map item : pages) + { + recordIds.add(String.valueOf(item.get("id"))); + } + pageAntExRecordsQuery.setNeed("true"); pageAntExRecordsQuery.setPage(request.getPage()); pageAntExRecordsQuery.setLimit(request.getLimit()); - pageAntExRecordsQuery.setIds(ids); + pageAntExRecordsQuery.setIds(recordIds); pageAntExRecordsQuery.setLevelId(request.getLevel()); - List pageAntExRecords = recordService.queryAntExRecords(pageAntExRecordsQuery); + List pageAntExRecords = recordService.queryAntExRecords(pageAntExRecordsQuery, Sort.Direction.DESC, "checkTime",ids.size()); if (CollectionUtils.isNotEmpty(pageAntExRecords)) { for (AntExRecordModel model : pageAntExRecords) -- 1.8.3.1