Commit 66bc9cf1e93482841718da1bc435a0361c3c130c
1 parent
7b0466492a
Exists in
master
and in
1 other branch
update
Showing 5 changed files with 71 additions and 13 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/BloodSugar.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
platform-dal/src/main/java/com/lyms/platform/pojo/BloodSugar.java
View file @
66bc9cf
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | import org.springframework.data.mongodb.core.mapping.Document; |
| 6 | 6 | |
| 7 | 7 | import java.util.Date; |
| 8 | +import java.util.List; | |
| 8 | 9 | |
| 9 | 10 | /** |
| 10 | 11 | * 血糖 |
| ... | ... | @@ -70,6 +71,18 @@ |
| 70 | 71 | |
| 71 | 72 | //0 未推送 1已经推送 |
| 72 | 73 | private Integer sevenSend; |
| 74 | + | |
| 75 | + | |
| 76 | + //高危风险id | |
| 77 | + private List<String> riskFactorId; | |
| 78 | + | |
| 79 | + public List<String> getRiskFactorId() { | |
| 80 | + return riskFactorId; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public void setRiskFactorId(List<String> riskFactorId) { | |
| 84 | + this.riskFactorId = riskFactorId; | |
| 85 | + } | |
| 73 | 86 | |
| 74 | 87 | public Integer getExceptionSend() { |
| 75 | 88 | return exceptionSend; |
platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java
View file @
66bc9cf
| ... | ... | @@ -137,16 +137,6 @@ |
| 137 | 137 | // |
| 138 | 138 | private boolean printing; |
| 139 | 139 | |
| 140 | - //高危风险id | |
| 141 | - private List<String> riskFactorId; | |
| 142 | - | |
| 143 | - public List<String> getRiskFactorId() { | |
| 144 | - return riskFactorId; | |
| 145 | - } | |
| 146 | - | |
| 147 | - public void setRiskFactorId(List<String> riskFactorId) { | |
| 148 | - this.riskFactorId = riskFactorId; | |
| 149 | - } | |
| 150 | 140 | |
| 151 | 141 | public boolean isPrinting() { |
| 152 | 142 | return printing; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
66bc9cf
| ... | ... | @@ -50,6 +50,7 @@ |
| 50 | 50 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 51 | 51 | import org.springframework.data.mongodb.core.query.Criteria; |
| 52 | 52 | import org.springframework.data.mongodb.core.query.Query; |
| 53 | +import org.springframework.data.mongodb.core.query.Update; | |
| 53 | 54 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 54 | 55 | import org.springframework.stereotype.Controller; |
| 55 | 56 | import org.springframework.web.bind.annotation.*; |
| ... | ... | @@ -3444,7 +3445,7 @@ |
| 3444 | 3445 | @ResponseBody |
| 3445 | 3446 | public String syncTrckDownNextTime() { |
| 3446 | 3447 | TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); |
| 3447 | - downRecordQuery.setLastMensesStart(DateUtil.addMonth(new Date(),-10)); | |
| 3448 | + downRecordQuery.setLastMensesStart(DateUtil.addMonth(new Date(), -10)); | |
| 3448 | 3449 | downRecordQuery.setStatus(3); |
| 3449 | 3450 | List<TrackDownRecord> records = trackDownRecordService.queryTrackDown(downRecordQuery); |
| 3450 | 3451 | int batchSize = 1000; |
| ... | ... | @@ -3474,6 +3475,46 @@ |
| 3474 | 3475 | } |
| 3475 | 3476 | |
| 3476 | 3477 | return "syncTrckDownNextTime finish"; |
| 3478 | + } | |
| 3479 | + | |
| 3480 | + | |
| 3481 | + @RequestMapping(value = "/syncBloodSugar", method = RequestMethod.GET) | |
| 3482 | + @ResponseBody | |
| 3483 | + public String syncBloodSugar() { | |
| 3484 | + List<BloodSugar> bloodSugars = mongoTemplate.find(Query.query(Criteria.where("yn").is(1)), BloodSugar.class); | |
| 3485 | + int batchSize = 2000; | |
| 3486 | + int end = 0; | |
| 3487 | + for (int i = 0; i < bloodSugars.size(); i += batchSize) { | |
| 3488 | + end = (end + batchSize); | |
| 3489 | + if (end > bloodSugars.size()) { | |
| 3490 | + end = bloodSugars.size(); | |
| 3491 | + } | |
| 3492 | + System.out.println("start:" + i + ",end:" + end); | |
| 3493 | + final List<BloodSugar> tempList = bloodSugars.subList(i, end); | |
| 3494 | + commonThreadPool.execute(new Runnable() { | |
| 3495 | + @Override | |
| 3496 | + public void run() { | |
| 3497 | + if (CollectionUtils.isNotEmpty(tempList)) { | |
| 3498 | + for (BloodSugar bloodSugar : tempList) { | |
| 3499 | + if (bloodSugar != null) { | |
| 3500 | + Patients pat = patientsService.findOnePatientById(bloodSugar.getParentId()); | |
| 3501 | + if (pat != null) | |
| 3502 | + { | |
| 3503 | + bloodSugar.setRiskFactorId(pat.getRiskFactorId()); | |
| 3504 | + | |
| 3505 | + Query query = Query.query(Criteria.where("id").is(bloodSugar.getId())); | |
| 3506 | + Update update = MongoConvertHelper | |
| 3507 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(bloodSugar)); | |
| 3508 | + mongoTemplate.updateFirst(query, update, BloodSugar.class); | |
| 3509 | + } | |
| 3510 | + } | |
| 3511 | + } | |
| 3512 | + } | |
| 3513 | + } | |
| 3514 | + }); | |
| 3515 | + } | |
| 3516 | + | |
| 3517 | + return "syncBloodSugar finish"; | |
| 3477 | 3518 | } |
| 3478 | 3519 | |
| 3479 | 3520 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
66bc9cf
| ... | ... | @@ -3153,6 +3153,20 @@ |
| 3153 | 3153 | patients1.setNextCheckTime((Date) map.get("nextCheckTime")); |
| 3154 | 3154 | } |
| 3155 | 3155 | patientsService.findAndModify(patientsQuery1, patients1); |
| 3156 | + | |
| 3157 | + | |
| 3158 | + //新增加的高危因素冗余到血糖 | |
| 3159 | + if (patients != null) | |
| 3160 | + { | |
| 3161 | + BloodSugar bloodSugar = new BloodSugar(); | |
| 3162 | + bloodSugar.setRiskFactorId(patients.getRiskFactorId()); | |
| 3163 | + bloodSugar.setParentId(patients.getId()); | |
| 3164 | + | |
| 3165 | + Query query = Query.query(Criteria.where("parentId").is(patients.getId())); | |
| 3166 | + Update update = MongoConvertHelper | |
| 3167 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(bloodSugar)); | |
| 3168 | + mongoTemplate.updateFirst(query, update, BloodSugar.class); | |
| 3169 | + } | |
| 3156 | 3170 | } |
| 3157 | 3171 | |
| 3158 | 3172 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
66bc9cf
| ... | ... | @@ -148,8 +148,8 @@ |
| 148 | 148 | rids.add("5aab6d3e422b03d4ad2bf83f"); |
| 149 | 149 | rids.add("de7468e6-1bb5-4fab-ae84-78857868409a"); |
| 150 | 150 | criteria.and("riskFactorId").in(rids); |
| 151 | - | |
| 152 | - PageResult pageResult = findMongoPage(BloodSugar.class, Query.query(criteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); | |
| 151 | + Query query = Query.query(criteria).with(new Sort(Sort.Direction.DESC, "created")); | |
| 152 | + PageResult pageResult = findMongoPage(BloodSugar.class, query, page, limit); | |
| 153 | 153 | List<BloodSugar> bloodSugars = (List<BloodSugar>) pageResult.getGrid(); |
| 154 | 154 | List<Map<String, Object>> restList = new ArrayList<>(); |
| 155 | 155 | for (BloodSugar bloodSugar : bloodSugars) { |