Commit bd27ee66e552c9aa51e5b2ac116324663dab154d

Authored by litao@lymsh.com
1 parent cb6ba67162

异常孕妇

Showing 2 changed files with 15 additions and 19 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java View file @ bd27ee6
... ... @@ -56,8 +56,8 @@
56 56  
57 57 @ResponseBody
58 58 @RequestMapping(value = "/error/fy/list", method = RequestMethod.GET)
59   - public BaseResponse errorYfList(@RequestParam String operaterId, String parentIds) {
60   - return RespBuilder.buildSuccess(remoteFacade.errorYfList(operaterId, parentIds));
  59 + public BaseResponse errorYfList() {
  60 + return RespBuilder.buildSuccess(remoteFacade.errorYfList());
61 61 }
62 62  
63 63 @RequestMapping(value = "/bookArchive",method = RequestMethod.GET)
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RemoteFacade.java View file @ bd27ee6
... ... @@ -28,19 +28,13 @@
28 28 @Autowired
29 29 private MongoTemplate mongoTemplate;
30 30  
31   - public List<Map<String, Object>> errorYfList(String operaterId, String parentIds) {
  31 + public List<Map<String, Object>> errorYfList() {
32 32 Date yesterday = DateUtil.getYesterday();
33 33 List<Map<String, Object>> restList = new ArrayList<>();
34   - Query pwQuery = Query.query(Criteria.where("operaterId").is(operaterId)).with(new Sort(Sort.Direction.ASC, "created"));
35   - Query bpQuery = Query.query(Criteria.where("operaterId").is(operaterId).and("modified").gt(yesterday)).with(new Sort(Sort.Direction.ASC, "created"));
36   - Query bsQuery = Query.query(Criteria.where("operaterId").is(operaterId).and("modified").gt(yesterday)).with(new Sort(Sort.Direction.ASC, "created"));
37   - Query tempQuery = Query.query(Criteria.where("operaterId").is(operaterId).and("modified").gt(yesterday)).with(new Sort(Sort.Direction.ASC, "created"));
38   - if(StringUtils.isNotEmpty(parentIds)) {
39   - List<String> list = CollectionUtils.asList(parentIds, String.class);
40   - pwQuery.addCriteria(Criteria.where("patientId").in(list));
41   - bpQuery.addCriteria(Criteria.where("parentId").in(list));
42   - tempQuery.addCriteria(Criteria.where("parentId").in(list));
43   - }
  34 + Query pwQuery = Query.query(new Criteria());
  35 + Query bpQuery = Query.query(Criteria.where("modified").gt(yesterday)).with(new Sort(Sort.Direction.ASC, "created"));
  36 + Query bsQuery = Query.query(Criteria.where("modified").gt(yesterday)).with(new Sort(Sort.Direction.ASC, "created"));
  37 + Query tempQuery = Query.query(Criteria.where("modified").gt(yesterday)).with(new Sort(Sort.Direction.ASC, "created"));
44 38  
45 39 /** 体重未记录修改日期 所以全表扫描 */
46 40 List<PatientWeight> patientWeights = mongoTemplate.find(pwQuery, PatientWeight.class);
... ... @@ -58,7 +52,7 @@
58 52 if(StringUtils.isNotEmpty(bpStatus)) {
59 53 patients = (patients == null ? mongoTemplate.findById(bloodPressure.getParentId(), Patients.class) : patients);
60 54 setTempInfo(bloodPressure.getId() + ID_SEPARATOR + entry.getKey(), temp, patients,
61   - entry.getValue().get("ssy") + "/" + entry.getValue().get("szy") + "mmHg", bpStatus, "(收缩压:90-140 舒张压:60-90)", ErrorPatientEnums.BLOOD_PRESSURE);
  55 + entry.getValue().get("ssy") + "/" + entry.getValue().get("szy") + "mmHg", bpStatus, "(收缩压:90-140 舒张压:60-90)", ErrorPatientEnums.BLOOD_PRESSURE, bloodPressure.getModified());
62 56 }
63 57 }
64 58 }
... ... @@ -91,7 +85,7 @@
91 85 temp.put("name", BloodSugarEnums.getName(bloodSugar.getBloodSugarType()));
92 86 bloodSugarCache.put(bloodSugar.getId(), temp);
93 87 setTempInfo(bloodSugar.getId(), temp, mongoTemplate.findById(bloodSugar.getParentId(), Patients.class), bloodSugar.getBloodSugar(), Double.parseDouble(bloodSugar.getBloodSugar()) > max ? "高血糖" : "低血糖",
94   - "(" + min +"-" + max + ")", ErrorPatientEnums.BLOOD_SUGAR);
  88 + "(" + min +"-" + max + ")", ErrorPatientEnums.BLOOD_SUGAR, bloodSugar.getModified());
95 89 }
96 90 }
97 91 restList.addAll(bloodSugarCache.values());
98 92  
... ... @@ -105,8 +99,9 @@
105 99 setMapInfo(highMap, lowMap, bmi);
106 100 Map<String, String> dayWeights = patientWeight.getDayWeights();
107 101 Map<String, Object> temp = new HashMap<>();
108   - if(MapUtils.isNotEmpty(dayWeights)) {
  102 + if(MapUtils.isNotEmpty(dayWeights) && CollectionUtils.isNotEmpty(dayWeights.entrySet())) {
109 103 for (Map.Entry<String, String> entry : dayWeights.entrySet()) {
  104 + System.out.println(patientWeight.getId() + ">>> " + entry);
110 105 if(DateUtil.parseYMD(entry.getKey()).getTime() >= yesterday.getTime()) {
111 106 patients = (patients == null ? mongoTemplate.findById(patientWeight.getPatientId(), Patients.class) : patients);
112 107 Integer week = DateUtil.getWeek2(patients.getLastMenses(), DateUtil.parseYMD(entry.getKey()));
... ... @@ -115,7 +110,7 @@
115 110 Double high = highMap.get(week);
116 111 if(addWeight < low || addWeight > high) {
117 112 setTempInfo(patientWeight.getId() + ID_SEPARATOR + entry.getKey(), temp, patients, null, addWeight < low ? "增重过少" : "增重过多",
118   - "(" + lowMap.get(0) + "~" + highMap.get(0) + ")", ErrorPatientEnums.PATIENT_WEIGHT);
  113 + "(" + lowMap.get(0) + "~" + highMap.get(0) + ")", ErrorPatientEnums.PATIENT_WEIGHT, patientWeight.getCreated());
119 114 temp.put("beforeWeight", patientWeight.getBeforeWeight());
120 115 temp.put("nowWeight", patientWeight.getNowWeight());
121 116 temp.put("addWeight", addWeight);
... ... @@ -138,7 +133,7 @@
138 133 if(entry.getValue() < 36D || entry.getValue() > 38.5D ) {
139 134 patients = (patients == null ? mongoTemplate.findById(tempModel.getParentId(), Patients.class) : patients);
140 135 setTempInfo(tempModel.getId() + ID_SEPARATOR + entry.getKey(), temp, patients, entry.getValue() + " °C", entry.getValue() < 36D ? "低热" : "高热",
141   - "(36-37.4)", ErrorPatientEnums.TEMP);
  136 + "(36-37.4)", ErrorPatientEnums.TEMP, tempModel.getModified());
142 137 }
143 138 }
144 139 }
... ... @@ -149,7 +144,7 @@
149 144 return restList;
150 145 }
151 146  
152   - private void setTempInfo(String id, Map<String, Object> temp, Patients patients, String value, String desc, String ckz, ErrorPatientEnums errorPatientEnums) {
  147 + private void setTempInfo(String id, Map<String, Object> temp, Patients patients, String value, String desc, String ckz, ErrorPatientEnums errorPatientEnums, Date modified) {
153 148 if(patients == null) return;
154 149 temp.put("id", id);
155 150 temp.put("username", patients.getUsername());
... ... @@ -159,6 +154,7 @@
159 154 temp.put("desc", desc);
160 155 temp.put("ckz", ckz);
161 156 temp.put("type", errorPatientEnums.getId());
  157 + temp.put("modified", modified);
162 158 }
163 159  
164 160 private String getBpStatus(String ssy, String szy) {