Commit f50f193b64acd0157a0eea3f6c15767294f69416
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 10 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/LisCrisisItemService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisCrisisItemController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RemoteFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CollectionUtils.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/LisCrisisItemService.java
View file @
f50f193
| ... | ... | @@ -30,12 +30,23 @@ |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public List<LisCrisisItem> query(LisCrisisItemQuery query) { |
| 33 | +// MongoQuery mongoQuery = query.convertToQuery(); | |
| 34 | +// if (StringUtils.isNotEmpty(query.getNeed())) { | |
| 35 | +// query.mysqlBuild(lisCrisisItemDao.queryLisCrisisItemCount(mongoQuery)); | |
| 36 | +// mongoQuery.start(query.getOffset()).end(query.getLimit()); | |
| 37 | +// } | |
| 38 | +// return lisCrisisItemDao.queryLisCrisisItem(mongoQuery.addOrder(Sort.Direction.ASC, "status")); | |
| 39 | + | |
| 40 | + return query(query, Sort.Direction.ASC, "status"); | |
| 41 | + } | |
| 42 | + | |
| 43 | + public List<LisCrisisItem> query(LisCrisisItemQuery query,Sort.Direction direction,String sortField) { | |
| 33 | 44 | MongoQuery mongoQuery = query.convertToQuery(); |
| 34 | 45 | if (StringUtils.isNotEmpty(query.getNeed())) { |
| 35 | 46 | query.mysqlBuild(lisCrisisItemDao.queryLisCrisisItemCount(mongoQuery)); |
| 36 | 47 | mongoQuery.start(query.getOffset()).end(query.getLimit()); |
| 37 | 48 | } |
| 38 | - return lisCrisisItemDao.queryLisCrisisItem(mongoQuery.addOrder(Sort.Direction.ASC, "status")); | |
| 49 | + return lisCrisisItemDao.queryLisCrisisItem(mongoQuery.addOrder(direction, sortField)); | |
| 39 | 50 | } |
| 40 | 51 | |
| 41 | 52 | public void updateLisCrisisItem(LisCrisisItem obj, String id) { |
platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java
View file @
f50f193
| ... | ... | @@ -77,6 +77,16 @@ |
| 77 | 77 | this.dayWeigthsJson = dayWeigthsJson; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | + private Date modified; | |
| 81 | + | |
| 82 | + public Date getModified() { | |
| 83 | + return modified; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void setModified(Date modified) { | |
| 87 | + this.modified = modified; | |
| 88 | + } | |
| 89 | + | |
| 80 | 90 | private String id; |
| 81 | 91 | |
| 82 | 92 | private String pid; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisCrisisItemController.java
View file @
f50f193
| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | import com.lyms.platform.query.PatientsQuery; |
| 19 | 19 | import org.apache.commons.collections.CollectionUtils; |
| 20 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | +import org.springframework.data.domain.Sort; | |
| 21 | 22 | import org.springframework.stereotype.Controller; |
| 22 | 23 | import org.springframework.web.bind.annotation.*; |
| 23 | 24 | |
| ... | ... | @@ -267,7 +268,7 @@ |
| 267 | 268 | query.setParentIds(parentIds); |
| 268 | 269 | } |
| 269 | 270 | |
| 270 | - List<LisCrisisItem> lisCrisisItemList = lisCrisisItemService.query(query); | |
| 271 | + List<LisCrisisItem> lisCrisisItemList = lisCrisisItemService.query(query, Sort.Direction.DESC, "publishTime"); | |
| 271 | 272 | List<Map> list = new ArrayList<>(); |
| 272 | 273 | |
| 273 | 274 | if (CollectionUtils.isNotEmpty(lisCrisisItemList)) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RemoteFacade.java
View file @
f50f193
| ... | ... | @@ -51,7 +51,7 @@ |
| 51 | 51 | String bpStatus = getBpStatus(entry.getValue().get("ssy").toString(), entry.getValue().get("szy").toString()); |
| 52 | 52 | if(StringUtils.isNotEmpty(bpStatus)) { |
| 53 | 53 | patients = (patients == null ? mongoTemplate.findById(bloodPressure.getParentId(), Patients.class) : patients); |
| 54 | - setTempInfo(bloodPressure.getId() + ID_SEPARATOR + entry.getKey(), temp, patients, | |
| 54 | + setTempInfo(bloodPressure.getId() + ID_SEPARATOR + entry.getKey() + ID_SEPARATOR + bloodPressure.getModified().getTime(), temp, patients, | |
| 55 | 55 | entry.getValue().get("ssy") + "/" + entry.getValue().get("szy"), bpStatus, "(收缩压:90-140 舒张压:60-90)", ErrorPatientEnums.BLOOD_PRESSURE, bloodPressure.getModified()); |
| 56 | 56 | } |
| 57 | 57 | } |
| ... | ... | @@ -84,7 +84,7 @@ |
| 84 | 84 | Map<String, Object> temp = new HashMap<>(); |
| 85 | 85 | temp.put("name", BloodSugarEnums.getName(bloodSugar.getBloodSugarType())); |
| 86 | 86 | bloodSugarCache.put(bloodSugar.getId(), temp); |
| 87 | - setTempInfo(bloodSugar.getId(), temp, mongoTemplate.findById(bloodSugar.getParentId(), Patients.class), bloodSugar.getBloodSugar(), Double.parseDouble(bloodSugar.getBloodSugar()) > max ? "高血糖" : "低血糖", | |
| 87 | + setTempInfo(bloodSugar.getId() + ID_SEPARATOR + bloodSugar.getModified().getTime(), temp, mongoTemplate.findById(bloodSugar.getParentId(), Patients.class), bloodSugar.getBloodSugar(), Double.parseDouble(bloodSugar.getBloodSugar()) > max ? "高血糖" : "低血糖", | |
| 88 | 88 | "(" + min +"-" + max + ")", ErrorPatientEnums.BLOOD_SUGAR, bloodSugar.getModified()); |
| 89 | 89 | } |
| 90 | 90 | } |
| ... | ... | @@ -109,7 +109,8 @@ |
| 109 | 109 | Double low = lowMap.get(week); |
| 110 | 110 | Double high = highMap.get(week); |
| 111 | 111 | if(addWeight < low || addWeight > high) { |
| 112 | - setTempInfo(patientWeight.getId() + ID_SEPARATOR + entry.getKey(), temp, patients, null, addWeight < low ? "增重过少" : "增重过多", | |
| 112 | + setTempInfo(patientWeight.getId() + ID_SEPARATOR + entry.getKey() + ID_SEPARATOR, temp, patients, (patientWeight.getModified() == null ? "" : patientWeight.getModified().getTime() + ""), addWeight < low ? "增重过少" : "增重过多", | |
| 113 | +// setTempInfo(patientWeight.getId() + ID_SEPARATOR + entry.getKey() + ID_SEPARATOR + patientWeight.getModified().getTime(), temp, patients, null, addWeight < low ? "增重过少" : "增重过多", | |
| 113 | 114 | "(" + lowMap.get(0) + "~" + highMap.get(0) + ")", ErrorPatientEnums.PATIENT_WEIGHT, patientWeight.getCreated()); |
| 114 | 115 | temp.put("beforeWeight", patientWeight.getBeforeWeight()); |
| 115 | 116 | temp.put("nowWeight", patientWeight.getNowWeight()); |
| ... | ... | @@ -132,7 +133,7 @@ |
| 132 | 133 | if(DateUtil.parseYMD(entry.getKey()).getTime() >= yesterday.getTime()) { |
| 133 | 134 | if(entry.getValue() < 36D || entry.getValue() > 38.5D ) { |
| 134 | 135 | patients = (patients == null ? mongoTemplate.findById(tempModel.getParentId(), Patients.class) : patients); |
| 135 | - setTempInfo(tempModel.getId() + ID_SEPARATOR + entry.getKey(), temp, patients, entry.getValue() + "", entry.getValue() < 36D ? "低热" : "高热", | |
| 136 | + setTempInfo(tempModel.getId() + ID_SEPARATOR + entry.getKey() + ID_SEPARATOR + tempModel.getModified().getTime(), temp, patients, entry.getValue() + "", entry.getValue() < 36D ? "低热" : "高热", | |
| 136 | 137 | "(36-37.4)", ErrorPatientEnums.TEMP, tempModel.getModified()); |
| 137 | 138 | } |
| 138 | 139 | } |
| ... | ... | @@ -146,7 +147,7 @@ |
| 146 | 147 | |
| 147 | 148 | private void setTempInfo(String id, Map<String, Object> temp, Patients patients, String value, String desc, String ckz, ErrorPatientEnums errorPatientEnums, Date modified) { |
| 148 | 149 | if(patients == null) return; |
| 149 | - temp.put("id", id + ID_SEPARATOR + DateUtil.getymd()); | |
| 150 | + temp.put("id", id + ID_SEPARATOR); | |
| 150 | 151 | temp.put("username", patients.getUsername()); |
| 151 | 152 | temp.put("lastMenses", patients.getLastMenses().getTime()/1000); |
| 152 | 153 | temp.put("pid", patients.getPid()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
f50f193
| ... | ... | @@ -3861,14 +3861,14 @@ |
| 3861 | 3861 | Organization organization = organizationService.getOrganization(Integer.parseInt(data.getFmHospital())); |
| 3862 | 3862 | if (organization != null && organization.getYn() == YnEnums.YES.getId()) { |
| 3863 | 3863 | fmHospital = organization.getName(); |
| 3864 | - cityId = organization.getAreaId(); | |
| 3864 | + cityId = organization.getCityId(); | |
| 3865 | 3865 | } |
| 3866 | 3866 | } else { |
| 3867 | 3867 | fmHospital = data.getFmHospital(); |
| 3868 | 3868 | } |
| 3869 | 3869 | } |
| 3870 | 3870 | |
| 3871 | - //出生地点(县) | |
| 3871 | + //出生地点(市) | |
| 3872 | 3872 | map.put("bornAddress", CommonsHelper.getName1(cityId,basicConfigService)); |
| 3873 | 3873 | |
| 3874 | 3874 | //分娩医院 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java
View file @
f50f193
| ... | ... | @@ -57,7 +57,12 @@ |
| 57 | 57 | temp.put("pulse", bloodPressure.getPulse()); |
| 58 | 58 | temp.put("timestamp", DateUtil.getyyyy_MM_dd_hms(new Date())); |
| 59 | 59 | temp.put("hospitalId", hospitalId); |
| 60 | - BloodPressure bp = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(bloodPressure.getParentId()).and("yn").ne(0)), BloodPressure.class); | |
| 60 | +// BloodPressure bp = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(bloodPressure.getParentId()).and("yn").ne(0)), BloodPressure.class); | |
| 61 | + Patients p = mongoTemplate.findById(bloodPressure.getParentId(), Patients.class); | |
| 62 | + BloodPressure bp = null; | |
| 63 | + if(p != null) { | |
| 64 | + bp = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(p.getPid())), BloodPressure.class); | |
| 65 | + } | |
| 61 | 66 | if(bp == null) { |
| 62 | 67 | String parentId = mongoUtil.doHidePatient(bloodPressure.getParentId(), hospitalId); |
| 63 | 68 | bloodPressure.setPid(mongoUtil.getPid(parentId)); |
| 64 | 69 | |
| ... | ... | @@ -106,10 +111,12 @@ |
| 106 | 111 | List<String> ids = new ArrayList<>(); |
| 107 | 112 | if(CollectionUtils.isNotEmpty(patients)) { |
| 108 | 113 | for (Patients patient : patients) { |
| 109 | - ids.add(patient.getId()); | |
| 114 | +// ids.add(patient.getId()); | |
| 115 | + ids.add(patient.getPid()); | |
| 110 | 116 | } |
| 111 | 117 | } |
| 112 | - criteria.and("parentId").in(ids); | |
| 118 | +// criteria.and("parentId").in(ids); | |
| 119 | + criteria.and("pid").in(ids); | |
| 113 | 120 | PageResult pageResult = findMongoPage(BloodPressure.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); |
| 114 | 121 | List<BloodPressure> bloodPressures = (List<BloodPressure>) pageResult.getGrid(); |
| 115 | 122 | List<Map<String, Object>> restList = new ArrayList<>(); |
| ... | ... | @@ -150,6 +157,7 @@ |
| 150 | 157 | List<String> xAxis = new ArrayList<>(); |
| 151 | 158 | if(bloodPressure != null) { |
| 152 | 159 | List<String> betweenDay = DateUtil.getBetweenDay(7); |
| 160 | + CollectionUtils.reverse(betweenDay); | |
| 153 | 161 | Map<String, Map<String, Object>> infos = bloodPressure.getInfos(); |
| 154 | 162 | for (String date : betweenDay) { |
| 155 | 163 | Map<String, Object> temp = new HashMap<>(); |
| ... | ... | @@ -211,7 +219,12 @@ |
| 211 | 219 | temp.put("pulse", bloodPressure.getPulse()); |
| 212 | 220 | temp.put("timestamp", DateUtil.getyyyy_MM_dd_hms(new Date())); |
| 213 | 221 | temp.put("hospitalId", hospitalId); |
| 214 | - BloodPressure bp = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(bloodPressure.getParentId()).and("yn").ne(0)), BloodPressure.class); | |
| 222 | + | |
| 223 | + Patients p = mongoTemplate.findById(bloodPressure.getParentId(), Patients.class); | |
| 224 | + BloodPressure bp = null; | |
| 225 | + if(p != null) { | |
| 226 | + bp = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(p.getPid())), BloodPressure.class); | |
| 227 | + } | |
| 215 | 228 | bloodPressure.setModified(new Date()); |
| 216 | 229 | if(bp == null) { |
| 217 | 230 | String parentId = mongoUtil.doHidePatient(bloodPressure.getParentId(), hospitalId); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
f50f193
| ... | ... | @@ -46,7 +46,8 @@ |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | public BaseResponse add(Integer userId, BloodSugar bloodSugar) { |
| 49 | - BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(bloodSugar.getParentId()).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugar.getBloodSugarType())), BloodSugar.class); | |
| 49 | +// BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(bloodSugar.getParentId()).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugar.getBloodSugarType())), BloodSugar.class); | |
| 50 | + BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(mongoUtil.getPid(bloodSugar.getParentId())).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugar.getBloodSugarType())), BloodSugar.class); | |
| 50 | 51 | if(one != null) { |
| 51 | 52 | one.setModified(new Date()); |
| 52 | 53 | one.setBloodSugar(bloodSugar.getBloodSugar()); |
| ... | ... | @@ -203,7 +204,8 @@ |
| 203 | 204 | |
| 204 | 205 | @Override |
| 205 | 206 | public BaseResponse wxAdd(String parentId, String bloodSugar, Integer bloodSugarType) { |
| 206 | - BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(parentId).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugarType)), BloodSugar.class); | |
| 207 | + BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(mongoUtil.getPid(parentId)).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugarType)), BloodSugar.class); | |
| 208 | +// BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(parentId).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugarType)), BloodSugar.class); | |
| 207 | 209 | if(one != null) { |
| 208 | 210 | one.setModified(new Date()); |
| 209 | 211 | one.setBloodSugar(bloodSugar); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
f50f193
| ... | ... | @@ -105,6 +105,7 @@ |
| 105 | 105 | patients.setSource(patientWeight.getPatientId()); |
| 106 | 106 | patients.setCreated(new Date()); |
| 107 | 107 | // mongoTemplate.save(patients); |
| 108 | + patients.setModified(new Date()); | |
| 108 | 109 | patientsService.addPatient(patients); |
| 109 | 110 | patientWeight.setPatientId(patients.getId()); |
| 110 | 111 | } |
| ... | ... | @@ -141,6 +142,7 @@ |
| 141 | 142 | dayWeights2.add(m); |
| 142 | 143 | } |
| 143 | 144 | pw.setDayWeights2(dayWeights2); |
| 145 | + pw.setModified(new Date()); | |
| 144 | 146 | patientWeightService2.update(Query.query(Criteria.where("id").is(pw.getId())), pw); |
| 145 | 147 | return RespBuilder.buildSuccess(pw.getId()); |
| 146 | 148 | } |
| ... | ... | @@ -169,6 +171,7 @@ |
| 169 | 171 | dayWeights2.add(m); |
| 170 | 172 | patientWeight.setDayWeights2(dayWeights2); |
| 171 | 173 | |
| 174 | + patientWeight.setModified(new Date()); | |
| 172 | 175 | patientWeightService2.add(patientWeight); |
| 173 | 176 | |
| 174 | 177 | operateLogFacade.addAddOptLog(userId, Integer.valueOf(hospitalId), patientWeight, OptActionEnums.ADD.getId(), "添加孕体重"); |
| ... | ... | @@ -186,6 +189,7 @@ |
| 186 | 189 | return RespBuilder.buildSuccess(patientWeight.getId()); |
| 187 | 190 | } else { |
| 188 | 191 | patientWeight.setOperaterId(userId.toString()); |
| 192 | + patientWeight.setModified(new Date()); | |
| 189 | 193 | patientWeightService2.update(Query.query(Criteria.where("id").is(patientWeight.getId())), patientWeight); |
| 190 | 194 | return RespBuilder.buildSuccess(patientWeight.getId()); |
| 191 | 195 | } |
| ... | ... | @@ -454,6 +458,7 @@ |
| 454 | 458 | dayWeights2.add(m); |
| 455 | 459 | } |
| 456 | 460 | pw.setDayWeights2(dayWeights2); |
| 461 | + pw.setModified(new Date()); | |
| 457 | 462 | patientWeightService2.update(Query.query(Criteria.where("id").is(pw.getId())), pw); |
| 458 | 463 | return RespBuilder.buildSuccess(pw); |
| 459 | 464 | } |
| ... | ... | @@ -478,6 +483,7 @@ |
| 478 | 483 | patientWeight.setPid(patients.getPid()); |
| 479 | 484 | patientWeight.setDayWeights(dayWeights); |
| 480 | 485 | patientWeight.setId(null); |
| 486 | + patientWeight.setModified(new Date()); | |
| 481 | 487 | patientWeightService2.add(patientWeight); |
| 482 | 488 | return RespBuilder.buildSuccess(patientWeight); |
| 483 | 489 | |
| ... | ... | @@ -493,6 +499,7 @@ |
| 493 | 499 | map.put(entry.getKey() + "", entry.getValue() + ""); |
| 494 | 500 | } |
| 495 | 501 | patientWeight.setDayWeights(map); |
| 502 | + patientWeight.setModified(new Date()); | |
| 496 | 503 | |
| 497 | 504 | JSONArray dayWeights2 = JSONArray.fromObject(patientWeight.getDayWeights2Json()); |
| 498 | 505 | /*List<Map<String, Object>> dayWeights2List = new ArrayList<>(); |
| ... | ... | @@ -584,6 +591,7 @@ |
| 584 | 591 | patientWeight.setBmi(getBmi(beforeWeight, beforeHeight)); |
| 585 | 592 | } |
| 586 | 593 | } |
| 594 | + patientWeight.setModified(new Date()); | |
| 587 | 595 | patientWeightService2.update(Query.query(Criteria.where("id").is(id)), patientWeight); |
| 588 | 596 | |
| 589 | 597 | if(sync) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CollectionUtils.java
View file @
f50f193
| ... | ... | @@ -220,5 +220,17 @@ |
| 220 | 220 | restList.addAll(tempList); |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | + | |
| 224 | + public static <T> void reverse(List<T> restList) { | |
| 225 | + if(CollectionUtils.isNotEmpty(restList)) { | |
| 226 | + List<T> tempList = new ArrayList<>(); | |
| 227 | + int size = restList.size(); | |
| 228 | + for (int i = size - 1; i >= 0 ; i--) { | |
| 229 | + tempList.add(restList.get(i)); | |
| 230 | + } | |
| 231 | + restList.clear(); | |
| 232 | + restList.addAll(tempList); | |
| 233 | + } | |
| 234 | + } | |
| 223 | 235 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
View file @
f50f193