Commit a33e4d0e6d2508d4cd764824bd685f4660c767f3

Authored by liquanyu
1 parent 80de4f57b7

新曾高危优化

Showing 4 changed files with 337 additions and 119 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java View file @ a33e4d0
... ... @@ -344,13 +344,22 @@
344 344 // }
345 345 // return antExRecordDao.queryRecord(query.addOrder(Sort.Direction.DESC, "checkTime"));
346 346  
347   - return queryAntExRecords(antExRecordQuery,Sort.Direction.DESC,"checkTime");
  347 + return queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "checkTime");
348 348 }
349 349  
350 350 public List<AntExRecordModel> queryAntExRecords(AntExRecordQuery antExRecordQuery,Sort.Direction direction,String sortField) {
351 351 MongoQuery query = antExRecordQuery.convertToQuery();
352 352 if (StringUtils.isNotEmpty(antExRecordQuery.getNeed())) {
353 353 antExRecordQuery.mysqlBuild(antExRecordDao.count(query));
  354 + query.start(antExRecordQuery.getOffset()).end(antExRecordQuery.getLimit());
  355 + }
  356 + return antExRecordDao.queryRecord(query.addOrder(direction, sortField));
  357 + }
  358 +
  359 + public List<AntExRecordModel> queryAntExRecords(AntExRecordQuery antExRecordQuery,Sort.Direction direction,String sortField,int count) {
  360 + MongoQuery query = antExRecordQuery.convertToQuery();
  361 + if (StringUtils.isNotEmpty(antExRecordQuery.getNeed())) {
  362 + antExRecordQuery.mysqlBuild(count);
354 363 query.start(antExRecordQuery.getOffset()).end(antExRecordQuery.getLimit());
355 364 }
356 365 return antExRecordDao.queryRecord(query.addOrder(direction, sortField));
platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java View file @ a33e4d0
... ... @@ -74,6 +74,7 @@
74 74 CourseTypeModel("CourseTypeModel", 97831039590L),
75 75 PatientCourseModel("PatientCourseModel", 92531039591L),
76 76 ModularFunctionConfigModel("ModularFunctionConfigModel", 97531039991L),
  77 + BabySieveModel("BabySieveModel", 97531049991L),
77 78 BabyEyeCheck("BabyEyeCheck", 97521039591L);
78 79  
79 80 private String cname;
platform-dal/src/main/java/com/lyms/platform/pojo/BabySieveModel.java View file @ a33e4d0
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.beans.SerialIdEnum;
  4 +import com.lyms.platform.common.result.BaseModel;
  5 +import org.springframework.data.mongodb.core.mapping.Document;
  6 +
  7 +import java.util.Date;
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +/**
  12 + * 儿童新筛查
  13 + *
  14 + */
  15 +@Document(collection = "lyms_baby_sieve")
  16 +public class BabySieveModel extends BaseModel {
  17 +
  18 + private static final long serialVersionUID = SerialIdEnum.AntExChuModel.getCid();
  19 +
  20 +
  21 + private String id;
  22 + //实验号
  23 + private String testNumber;
  24 +
  25 + //采血单位
  26 + private String collectHospitalId;
  27 +
  28 + //当前登陆操作医院
  29 + private String currentHospitalId;
  30 +
  31 + //采血医生
  32 + private String collectDocterId;
  33 +
  34 + //采血日期
  35 + private Date collectDate;
  36 +
  37 + /****母亲信息*********/
  38 +
  39 + //母亲姓名
  40 + private String montherName;
  41 + //住院号
  42 + private String zyNo;
  43 + //母亲身份证号
  44 + private String montherCardNo;
  45 + //母亲疾病
  46 + private String montherDisease;
  47 +
  48 + //联系方式
  49 + private String phone;
  50 + //地址
  51 + private String address;
  52 +
  53 + /****母亲信息*********/
  54 + //儿童出生日期
  55 + private Date babyBirth;
  56 +
  57 + //孕周
  58 + private String dueWeek;
  59 +
  60 + //分娩方式
  61 + private String dueType;
  62 +
  63 + //性别
  64 + private Integer sex;
  65 +
  66 + //35种疾病筛查
  67 + private String diseaseSieve;
  68 +
  69 + //送检医院
  70 + private String sendCheckHospitalId;
  71 +
  72 + //儿童建档主键
  73 + private String babyId;
  74 +
  75 + //分娩id
  76 + private String matdeliverId;
  77 +
  78 + //孕妇档案id
  79 + private String patientId;
  80 +
  81 + //创建时间
  82 + private Date created;
  83 + //修改时间
  84 + private Date modified;
  85 +
  86 + public String getId() {
  87 + return id;
  88 + }
  89 +
  90 + public void setId(String id) {
  91 + this.id = id;
  92 + }
  93 +
  94 + public String getTestNumber() {
  95 + return testNumber;
  96 + }
  97 +
  98 + public void setTestNumber(String testNumber) {
  99 + this.testNumber = testNumber;
  100 + }
  101 +
  102 + public String getCollectHospitalId() {
  103 + return collectHospitalId;
  104 + }
  105 +
  106 + public void setCollectHospitalId(String collectHospitalId) {
  107 + this.collectHospitalId = collectHospitalId;
  108 + }
  109 +
  110 + public String getCurrentHospitalId() {
  111 + return currentHospitalId;
  112 + }
  113 +
  114 + public void setCurrentHospitalId(String currentHospitalId) {
  115 + this.currentHospitalId = currentHospitalId;
  116 + }
  117 +
  118 + public String getCollectDocterId() {
  119 + return collectDocterId;
  120 + }
  121 +
  122 + public void setCollectDocterId(String collectDocterId) {
  123 + this.collectDocterId = collectDocterId;
  124 + }
  125 +
  126 + public Date getCollectDate() {
  127 + return collectDate;
  128 + }
  129 +
  130 + public void setCollectDate(Date collectDate) {
  131 + this.collectDate = collectDate;
  132 + }
  133 +
  134 + public String getMontherName() {
  135 + return montherName;
  136 + }
  137 +
  138 + public void setMontherName(String montherName) {
  139 + this.montherName = montherName;
  140 + }
  141 +
  142 + public String getZyNo() {
  143 + return zyNo;
  144 + }
  145 +
  146 + public void setZyNo(String zyNo) {
  147 + this.zyNo = zyNo;
  148 + }
  149 +
  150 + public String getMontherCardNo() {
  151 + return montherCardNo;
  152 + }
  153 +
  154 + public void setMontherCardNo(String montherCardNo) {
  155 + this.montherCardNo = montherCardNo;
  156 + }
  157 +
  158 + public String getMontherDisease() {
  159 + return montherDisease;
  160 + }
  161 +
  162 + public void setMontherDisease(String montherDisease) {
  163 + this.montherDisease = montherDisease;
  164 + }
  165 +
  166 + public String getPhone() {
  167 + return phone;
  168 + }
  169 +
  170 + public void setPhone(String phone) {
  171 + this.phone = phone;
  172 + }
  173 +
  174 + public String getAddress() {
  175 + return address;
  176 + }
  177 +
  178 + public void setAddress(String address) {
  179 + this.address = address;
  180 + }
  181 +
  182 + public Date getBabyBirth() {
  183 + return babyBirth;
  184 + }
  185 +
  186 + public void setBabyBirth(Date babyBirth) {
  187 + this.babyBirth = babyBirth;
  188 + }
  189 +
  190 + public String getDueWeek() {
  191 + return dueWeek;
  192 + }
  193 +
  194 + public void setDueWeek(String dueWeek) {
  195 + this.dueWeek = dueWeek;
  196 + }
  197 +
  198 + public String getDueType() {
  199 + return dueType;
  200 + }
  201 +
  202 + public void setDueType(String dueType) {
  203 + this.dueType = dueType;
  204 + }
  205 +
  206 + public Integer getSex() {
  207 + return sex;
  208 + }
  209 +
  210 + public void setSex(Integer sex) {
  211 + this.sex = sex;
  212 + }
  213 +
  214 + public String getDiseaseSieve() {
  215 + return diseaseSieve;
  216 + }
  217 +
  218 + public void setDiseaseSieve(String diseaseSieve) {
  219 + this.diseaseSieve = diseaseSieve;
  220 + }
  221 +
  222 + public String getSendCheckHospitalId() {
  223 + return sendCheckHospitalId;
  224 + }
  225 +
  226 + public void setSendCheckHospitalId(String sendCheckHospitalId) {
  227 + this.sendCheckHospitalId = sendCheckHospitalId;
  228 + }
  229 +
  230 + public String getBabyId() {
  231 + return babyId;
  232 + }
  233 +
  234 + public void setBabyId(String babyId) {
  235 + this.babyId = babyId;
  236 + }
  237 +
  238 + public String getMatdeliverId() {
  239 + return matdeliverId;
  240 + }
  241 +
  242 + public void setMatdeliverId(String matdeliverId) {
  243 + this.matdeliverId = matdeliverId;
  244 + }
  245 +
  246 + public String getPatientId() {
  247 + return patientId;
  248 + }
  249 +
  250 + public void setPatientId(String patientId) {
  251 + this.patientId = patientId;
  252 + }
  253 +
  254 + public Date getCreated() {
  255 + return created;
  256 + }
  257 +
  258 + public void setCreated(Date created) {
  259 + this.created = created;
  260 + }
  261 +
  262 + public Date getModified() {
  263 + return modified;
  264 + }
  265 +
  266 + public void setModified(Date modified) {
  267 + this.modified = modified;
  268 + }
  269 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ a33e4d0
... ... @@ -625,8 +625,8 @@
625 625 }
626 626  
627 627 //antExRecordQuery.setLevelId(antExManagerQueryRequest.getLevel());
628   - List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC,"created");
629   - System.out.println("antExRecordModelList===================="+antExRecordModelList.size());
  628 + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "created");
  629 + System.out.println("antExRecordModelList====================" + antExRecordModelList.size());
630 630 Map<String,List<AntExRecordModel>> map = handleAntexRecord(antExRecordModelList);
631 631 AntExRecordQuery pageAntExRecordsQuery = new AntExRecordQuery();
632 632  
... ... @@ -644,7 +644,7 @@
644 644 {
645 645  
646 646 initBasicData();
647   - List<String> ids = new ArrayList<>();
  647 + List<Map<String,Object>> ids = new ArrayList<>();
648 648 Map<String,List<String>> incriskMap = new HashMap<>();
649 649  
650 650 if (map.size() > 0)
... ... @@ -673,7 +673,7 @@
673 673 public Map<String, Object> call() {
674 674 Map<String, Object> result = new HashMap<String, Object>();
675 675 if (CollectionUtils.isNotEmpty(tempList)) {
676   - List<String> ids = new ArrayList<>();
  676 + List<Map<String,Object>> ids = new ArrayList<>();
677 677 Map<String, List<String>> incriskMap = new HashMap<>();
678 678 AntExRecordQuery beforeRecordQuery = new AntExRecordQuery();
679 679 for (String patientId : tempList) {
... ... @@ -695,7 +695,10 @@
695 695  
696 696 if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6")
697 697 && getConditionRisk(request.getRiskFactorId(), currentRiskList, request.getLevel())) {
698   - ids.add(oneRecord.getId());
  698 + Map<String,Object> objMap = new HashMap<String, Object>();
  699 + objMap.put("id",oneRecord.getId());
  700 + objMap.put("time",oneRecord.getCheckTime());
  701 + ids.add(objMap);
699 702 incriskMap.put(oneRecord.getId(), currentRiskList);
700 703 } else if (CollectionUtils.isNotEmpty(beforeRiskList)) {
701 704 List incrHrisk = new ArrayList();
702 705  
... ... @@ -705,14 +708,20 @@
705 708 }
706 709 }
707 710 if (CollectionUtils.isNotEmpty(incrHrisk) && getConditionRisk(request.getRiskFactorId(), incrHrisk, request.getLevel())) {
708   - ids.add(oneRecord.getId());
  711 + Map<String,Object> objMap = new HashMap<String, Object>();
  712 + objMap.put("id",oneRecord.getId());
  713 + objMap.put("time",oneRecord.getCheckTime());
  714 + ids.add(objMap);
709 715 incriskMap.put(oneRecord.getId(), incrHrisk);
710 716 }
711 717 }
712 718 } else {
713 719 if (CollectionUtils.isNotEmpty(oneRecord.gethRisk()) && getConditionRisk(request.getRiskFactorId(),
714 720 oneRecord.gethRisk(), request.getLevel())) {
715   - ids.add(oneRecord.getId());
  721 + Map<String,Object> objMap = new HashMap<String, Object>();
  722 + objMap.put("id",oneRecord.getId());
  723 + objMap.put("time",oneRecord.getCheckTime());
  724 + ids.add(objMap);
716 725 incriskMap.put(oneRecord.getId(), oneRecord.gethRisk());
717 726 }
718 727 }
... ... @@ -740,7 +749,10 @@
740 749  
741 750 if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6")
742 751 && getConditionRisk(request.getRiskFactorId(), currentRiskList, request.getLevel())) {
743   - ids.add(oneRecord.getId());
  752 + Map<String,Object> objMap = new HashMap<String, Object>();
  753 + objMap.put("id",oneRecord.getId());
  754 + objMap.put("time",oneRecord.getCheckTime());
  755 + ids.add(objMap);
744 756 incriskMap.put(oneRecord.getId(), currentRiskList);
745 757 } else if (CollectionUtils.isNotEmpty(beforeRiskList)) {
746 758 List<String> incrHrisk = new ArrayList();
... ... @@ -751,7 +763,10 @@
751 763 }
752 764 if (CollectionUtils.isNotEmpty(incrHrisk) && getConditionRisk(request.getRiskFactorId(), incrHrisk, request.getLevel())) {
753 765  
754   - ids.add(oneRecord.getId());
  766 + Map<String,Object> objMap = new HashMap<String, Object>();
  767 + objMap.put("id",oneRecord.getId());
  768 + objMap.put("time",oneRecord.getCheckTime());
  769 + ids.add(objMap);
755 770 incriskMap.put(oneRecord.getId(), incrHrisk);
756 771 }
757 772 }
758 773  
759 774  
760 775  
761 776  
762 777  
... ... @@ -784,128 +799,52 @@
784 799 }
785 800 riskBasicMap.clear();
786 801  
  802 + }
787 803  
788   -// for (String patientId : map.keySet())
789   -// {
790   -// List<AntExRecordModel> list = map.get(patientId);
791   -// if (CollectionUtils.isNotEmpty(list))
792   -// {
793   -// if (list.size() == 1)
794   -// {
795   -// AntExRecordModel oneRecord = list.get(0);
796   -// if (!(CollectionUtils.isNotEmpty(oneRecord.gethRisk()) && oneRecord.gethRisk().contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6")))
797   -// {
798   -// if (CollectionUtils.isNotEmpty(oneRecord.gethRisk()))
799   -// {
800   -// beforeRecordQuery.setParentId(patientId);
801   -// beforeRecordQuery.setCheckTimeEnd(oneRecord.getCheckTime());
802   -// beforeRecordQuery.setNeqId(oneRecord.getId());
803   -// List<AntExRecordModel> beforeAntRecords = recordService.queryAntExRecords(beforeRecordQuery);
804   -// if (CollectionUtils.isNotEmpty(beforeAntRecords))
805   -// {
806   -// AntExRecordModel twoRecord = beforeAntRecords.get(0);
807   -// List currentRiskList = oneRecord.gethRisk();
808   -// List beforeRiskList = twoRecord.gethRisk();
809   -//
810   -// if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6")
811   -// && getConditionRisk(request.getRiskFactorId(),currentRiskList,request.getLevel()))
812   -// {
813   -// ids.add(oneRecord.getId());
814   -// incriskMap.put(oneRecord.getId(), currentRiskList);
815   -// }
816   -// else if (CollectionUtils.isNotEmpty(beforeRiskList) )
817   -// {
818   -// List incrHrisk = new ArrayList();
819   -// for (Object riskId : currentRiskList)
820   -// {
821   -// if (!beforeRiskList.contains(riskId))
822   -// {
823   -// incrHrisk.add(riskId);
824   -// }
825   -// }
826   -// if (CollectionUtils.isNotEmpty(incrHrisk) && getConditionRisk(request.getRiskFactorId(),incrHrisk,request.getLevel()))
827   -// {
828   -// ids.add(oneRecord.getId());
829   -// incriskMap.put(oneRecord.getId(), incrHrisk);
830   -// }
831   -// }
832   -// }
833   -// else
834   -// {
835   -// if (CollectionUtils.isNotEmpty(oneRecord.gethRisk()) && getConditionRisk(request.getRiskFactorId(),
836   -// oneRecord.gethRisk(),request.getLevel()))
837   -// {
838   -// ids.add(oneRecord.getId());
839   -// incriskMap.put(oneRecord.getId(), oneRecord.gethRisk());
840   -// }
841   -// }
842   -// }
843   -// }
844   -// }
845   -// else if (list.size() > 1)
846   -// {
847   -// AntExRecordModel oneRecord = list.get(0);
848   -//
849   -// if (CollectionUtils.isNotEmpty(oneRecord.gethRisk()) && oneRecord.gethRisk().contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6"))
850   -// {
851   -// continue;
852   -// }
853   -//
854   -// AntExRecordModel twoRecord = list.get(1);
855   -//
856   -// List currentRiskList = oneRecord.gethRisk();
857   -// List beforeRiskList = twoRecord.gethRisk();
858   -//
859   -// if (CollectionUtils.isEmpty(currentRiskList) && CollectionUtils.isEmpty(beforeRiskList))
860   -// {
861   -// continue;
862   -// }
863   -// if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6")
864   -// && CollectionUtils.isEmpty(currentRiskList))
865   -// {
866   -// continue;
867   -// }
868   -//
869   -// if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6")
870   -// && getConditionRisk(request.getRiskFactorId(),currentRiskList,request.getLevel()))
871   -// {
872   -// ids.add(oneRecord.getId());
873   -// incriskMap.put(oneRecord.getId(), currentRiskList);
874   -// }
875   -// else if (CollectionUtils.isNotEmpty(beforeRiskList) )
876   -// {
877   -// List<String> incrHrisk = new ArrayList();
878   -// for (Object riskId : currentRiskList)
879   -// {
880   -// if (!beforeRiskList.contains(riskId))
881   -// {
882   -// incrHrisk.add(String.valueOf(riskId));
883   -// }
884   -// }
885   -// if (CollectionUtils.isNotEmpty(incrHrisk) && getConditionRisk(request.getRiskFactorId(),incrHrisk,request.getLevel()))
886   -// {
887   -//
888   -// ids.add(oneRecord.getId());
889   -// incriskMap.put(oneRecord.getId(), incrHrisk);
890   -// }
891   -// }
892   -// }
893   -// }
894   -// }
  804 + if (CollectionUtils.isEmpty(ids))
  805 + {
  806 + return null;
895 807 }
896 808  
897 809 if (CollectionUtils.isEmpty(ids))
898 810 {
  811 + Collections.sort(ids, new Comparator<Map<String, Object>>() {
  812 + @Override
  813 + public int compare(Map<String, Object> o1, Map<String, Object> o2) {
  814 + Object d1 = o1.get("time");
  815 + Object d2 = o2.get("time");
  816 + if (d1 != null && d1 != null)
  817 + {
  818 + return ((Date)d1).compareTo((Date)d2);
  819 + }
  820 + return 0;
  821 + }
  822 + });
  823 + }
  824 +
  825 + int index = request.getPage() * request.getLimit() - request.getLimit();
  826 + int from = request.getPage() * request.getLimit();
  827 + System.out.println("index = " + index + " from = " + from);
  828 + List<Map<String,Object>> pages = ids.subList(index,from);
  829 + if (CollectionUtils.isEmpty(pages))
  830 + {
899 831 return null;
900 832 }
  833 +
  834 + List<String> recordIds = new ArrayList<>();
  835 + for (Map<String,Object> item : pages)
  836 + {
  837 + recordIds.add(String.valueOf(item.get("id")));
  838 + }
  839 +
901 840 pageAntExRecordsQuery.setNeed("true");
902 841 pageAntExRecordsQuery.setPage(request.getPage());
903 842 pageAntExRecordsQuery.setLimit(request.getLimit());
904   - pageAntExRecordsQuery.setIds(ids);
  843 + pageAntExRecordsQuery.setIds(recordIds);
905 844 pageAntExRecordsQuery.setLevelId(request.getLevel());
906 845  
907 846  
908   - List<AntExRecordModel> pageAntExRecords = recordService.queryAntExRecords(pageAntExRecordsQuery);
  847 + List<AntExRecordModel> pageAntExRecords = recordService.queryAntExRecords(pageAntExRecordsQuery, Sort.Direction.DESC, "checkTime",ids.size());
909 848 if (CollectionUtils.isNotEmpty(pageAntExRecords))
910 849 {
911 850 for (AntExRecordModel model : pageAntExRecords)