Commit 13ff6d46009950a586cdfd7aa2c9b5e06b8035ba
Exists in
master
Merge remote-tracking branch 'origin/master'
Showing 11 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBabyBookBuildingDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyBookbuildingDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyBookbuildingService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MongoSyncService.java
- platform-common/src/main/java/com/lyms/platform/common/dao/BaseMongoDAOImpl.java
- platform-common/src/main/java/com/lyms/platform/common/pojo/SyncDataModel.java
- platform-common/src/main/java/com/lyms/platform/common/pojo/UpdateMultiData.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyHisService.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/BabyCheckFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
View file @
13ff6d4
| ... | ... | @@ -31,6 +31,7 @@ |
| 31 | 31 | import org.springframework.context.support.ClassPathXmlApplicationContext; |
| 32 | 32 | |
| 33 | 33 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 34 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 34 | 35 | import org.springframework.data.mongodb.core.query.Query; |
| 35 | 36 | import org.springframework.data.mongodb.core.query.Update; |
| 36 | 37 | |
| ... | ... | @@ -43,7 +44,31 @@ |
| 43 | 44 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 44 | 45 | ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml"); |
| 45 | 46 | // queryRisk(applicationContext); |
| 46 | - changeLong2Time(applicationContext); | |
| 47 | + removeDoubleBaby(applicationContext); | |
| 48 | + } | |
| 49 | + | |
| 50 | + public static void removeDoubleBaby(ApplicationContext applicationContext) { | |
| 51 | + MongoTemplate mongoTemplate | |
| 52 | + =(MongoTemplate)applicationContext.getBean("mongoTemplate"); | |
| 53 | + mongoTemplate.getDb().slaveOk(); | |
| 54 | + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); | |
| 55 | + List<BabyModel> list = mongoTemplate.find(new Query(new Criteria()), BabyModel.class); | |
| 56 | + Map<String, BabyModel> localMap = new HashMap<>(); | |
| 57 | + Map<String, BabyModel> remoteMap = new HashMap<>(); | |
| 58 | + for (BabyModel model:list) { | |
| 59 | + if (model.getId().length() == 24) { | |
| 60 | + localMap.put(model.getMphone(),model); | |
| 61 | + } else if (model.getId().length() == 32) { | |
| 62 | + remoteMap.put(model.getMphone(),model); | |
| 63 | + } else { | |
| 64 | + System.out.println("other:"+JsonUtil.obj2JsonString(model)); | |
| 65 | + } | |
| 66 | + } | |
| 67 | + for (String phone:remoteMap.keySet()) { | |
| 68 | + if (localMap.containsKey(phone)) { | |
| 69 | + System.out.println("double:"+JsonUtil.obj2JsonString(remoteMap.get(phone))); | |
| 70 | + } | |
| 71 | + } | |
| 47 | 72 | } |
| 48 | 73 | |
| 49 | 74 | public static void changeLong2Time(ApplicationContext applicationContext) { |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBabyBookBuildingDao.java
View file @
13ff6d4
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyBookbuildingDaoImpl.java
View file @
13ff6d4
| 1 | 1 | package com.lyms.platform.biz.dal.impl; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.utils.StringUtils; |
| 4 | +import com.lyms.platform.pojo.AntExChuModel; | |
| 4 | 5 | import com.lyms.platform.pojo.BabyCheckModel; |
| 5 | 6 | import com.mongodb.DBCollection; |
| 6 | 7 | import com.mongodb.DBObject; |
| ... | ... | @@ -10,6 +11,8 @@ |
| 10 | 11 | import org.springframework.data.mongodb.core.aggregation.AggregationOperation; |
| 11 | 12 | import org.springframework.data.mongodb.core.aggregation.AggregationResults; |
| 12 | 13 | import org.springframework.data.mongodb.core.query.Criteria; |
| 14 | +import org.springframework.data.mongodb.core.query.Query; | |
| 15 | +import org.springframework.data.mongodb.core.query.Update; | |
| 13 | 16 | import org.springframework.stereotype.Repository; |
| 14 | 17 | |
| 15 | 18 | import com.lyms.platform.biz.dal.IBabyBookBuildingDao; |
| ... | ... | @@ -103,6 +106,14 @@ |
| 103 | 106 | } |
| 104 | 107 | } |
| 105 | 108 | return ids; |
| 109 | + } | |
| 110 | + | |
| 111 | + | |
| 112 | + @Override | |
| 113 | + public void updateBabyLastGrowth(BabyCheckModel model) { | |
| 114 | + this.mongoTemplate.updateFirst(new Query(Criteria.where("id").is(model.getBuildId())), | |
| 115 | + Update.update("weightEvaluate", model.getWeightEvaluate()).set("heightEvaluate", | |
| 116 | + model.getHeadEvaluate()).set("headEvaluate",model.getHeadEvaluate()).set("heightWeight",model.getHeightWeight()), BabyModel.class); | |
| 106 | 117 | } |
| 107 | 118 | |
| 108 | 119 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyBookbuildingService.java
View file @
13ff6d4
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MongoSyncService.java
View file @
13ff6d4
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | import org.apache.commons.lang.StringUtils; |
| 12 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | 13 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 14 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 14 | 15 | import org.springframework.data.mongodb.core.query.Query; |
| 15 | 16 | import org.springframework.data.mongodb.core.query.Update; |
| 16 | 17 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -58,8 +59,14 @@ |
| 58 | 59 | } |
| 59 | 60 | if (obj instanceof UpdateMultiData) { |
| 60 | 61 | UpdateMultiData data = (UpdateMultiData) obj; |
| 61 | - if (data.getMongoQuery() != null && data.getMongoUpdate() != null) { | |
| 62 | - mongoTemplate.updateMulti(data.getMongoQuery(), data.getMongoUpdate(), updateClass); | |
| 62 | + if (data.getQuery() != null && data.getUpdate() != null) { | |
| 63 | + Update update = MongoConvertHelper | |
| 64 | + .convertToNativeUpdate(data.getUpdate()); | |
| 65 | + MongoCondition condition = new MongoCondition(); | |
| 66 | + for (String key:data.getQuery().keySet()) { | |
| 67 | + condition = condition.and(key,data.getQuery().get(key),MongoOper.IS); | |
| 68 | + } | |
| 69 | + mongoTemplate.updateMulti(condition.toMongoQuery().convertToMongoQuery(), update, updateClass); | |
| 63 | 70 | return true; |
| 64 | 71 | } else if (data.getQuery() != null && data.getUpdate() != null) { |
| 65 | 72 | MongoCondition c = null; |
platform-common/src/main/java/com/lyms/platform/common/dao/BaseMongoDAOImpl.java
View file @
13ff6d4
| 1 | 1 | package com.lyms.platform.common.dao; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 4 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 3 | 6 | import com.lyms.platform.common.dao.operator.Page; |
| 4 | 7 | import com.lyms.platform.common.pojo.SyncDataModel; |
| 5 | 8 | import com.lyms.platform.common.pojo.UpdateMultiData; |
| ... | ... | @@ -8,6 +11,7 @@ |
| 8 | 11 | import org.apache.commons.collections.CollectionUtils; |
| 9 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 13 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 14 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 11 | 15 | import org.springframework.data.mongodb.core.query.Query; |
| 12 | 16 | import org.springframework.data.mongodb.core.query.Update; |
| 13 | 17 | import org.springframework.util.Assert; |
| ... | ... | @@ -144,7 +148,6 @@ |
| 144 | 148 | // 数据上传 |
| 145 | 149 | UpdateMultiData data = new UpdateMultiData(); |
| 146 | 150 | data.setMongoQuery(query); |
| 147 | - data.setMongoUpdate(update); | |
| 148 | 151 | data.setUpdate(ReflectionUtils.getUpdateField(obj)); |
| 149 | 152 | // 批量修改的情况下,ID字段是要修改的CLASS |
| 150 | 153 | addSyncData("UPDATEMULTI", data, obj.getClass().getName()); |
platform-common/src/main/java/com/lyms/platform/common/pojo/SyncDataModel.java
View file @
13ff6d4
| 1 | 1 | package com.lyms.platform.common.pojo; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 4 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 3 | 6 | import com.lyms.platform.common.result.BaseModel; |
| 7 | +import com.lyms.platform.common.utils.MongoConvertHelper; | |
| 8 | +import com.lyms.platform.common.utils.ReflectionUtils; | |
| 9 | +import com.lyms.platform.common.utils.SerializUtils; | |
| 10 | +import org.apache.commons.codec.binary.Base64; | |
| 4 | 11 | import org.springframework.data.mongodb.core.mapping.Document; |
| 12 | +import org.springframework.data.mongodb.core.query.Query; | |
| 13 | +import org.springframework.data.mongodb.core.query.Update; | |
| 14 | +import org.springframework.util.Assert; | |
| 5 | 15 | |
| 16 | +import java.io.Serializable; | |
| 6 | 17 | import java.util.Date; |
| 7 | 18 | |
| 8 | 19 | /** |
| ... | ... | @@ -10,6 +21,21 @@ |
| 10 | 21 | */ |
| 11 | 22 | @Document(collection = "lyms_sync_data") |
| 12 | 23 | public class SyncDataModel extends BaseModel { |
| 24 | + | |
| 25 | + public static void main(String[] a) { | |
| 26 | + Query query = new MongoQuery(new MongoCondition("yn", 1, MongoOper.IS)).convertToMongoQuery(); | |
| 27 | + SyncDataModel model = new SyncDataModel(); | |
| 28 | + model.setDataId("fuck"); | |
| 29 | + Assert.notNull(model, "execute findAndModify method must not null."); | |
| 30 | + Update update = MongoConvertHelper | |
| 31 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(model)); | |
| 32 | + Assert.notNull(update, "execute findAndModify method must not null.update:" + update); | |
| 33 | + // 数据上传 | |
| 34 | + UpdateMultiData data = new UpdateMultiData(); | |
| 35 | + data.setMongoQuery(query); | |
| 36 | + data.setUpdate(ReflectionUtils.getUpdateField(model)); | |
| 37 | + System.out.println(Base64.encodeBase64String(SerializUtils.objToByte((Serializable) data))); | |
| 38 | + } | |
| 13 | 39 | |
| 14 | 40 | private static final long serialVersionUID = 97531300010L; |
| 15 | 41 |
platform-common/src/main/java/com/lyms/platform/common/pojo/UpdateMultiData.java
View file @
13ff6d4
| ... | ... | @@ -21,21 +21,6 @@ |
| 21 | 21 | private Map<String, Object> query; |
| 22 | 22 | private Map<String, Object> update; |
| 23 | 23 | |
| 24 | - private Query mongoQuery; | |
| 25 | - private Update mongoUpdate; | |
| 26 | - | |
| 27 | - public Update getMongoUpdate() { | |
| 28 | - return mongoUpdate; | |
| 29 | - } | |
| 30 | - | |
| 31 | - public void setMongoUpdate(Update mongoUpdate) { | |
| 32 | - this.mongoUpdate = mongoUpdate; | |
| 33 | - } | |
| 34 | - | |
| 35 | - public Query getMongoQuery() { | |
| 36 | - return mongoQuery; | |
| 37 | - } | |
| 38 | - | |
| 39 | 24 | public void setQuery(Map<String, Object> query) { |
| 40 | 25 | this.query = query; |
| 41 | 26 | } |
| ... | ... | @@ -45,7 +30,6 @@ |
| 45 | 30 | } |
| 46 | 31 | |
| 47 | 32 | public void setMongoQuery(Query query) { |
| 48 | - this.mongoQuery = query; | |
| 49 | 33 | DBObject dbObject = query.getQueryObject(); |
| 50 | 34 | this.query = new HashMap<>(); |
| 51 | 35 | for (String key:dbObject.keySet()) { |
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyHisService.java
View file @
13ff6d4
| ... | ... | @@ -341,13 +341,14 @@ |
| 341 | 341 | for (PregPatientinfo info:list) { |
| 342 | 342 | Map<String,Object> map = new HashMap<>(); |
| 343 | 343 | map.put("bhnum", info.getP_BHNUM()); |
| 344 | - if ("1".equals(info.getP_SEX())) { | |
| 344 | + if ("男".equals(info.getP_SEX())) { | |
| 345 | 345 | map.put("sex", "男"); |
| 346 | - } else if ("2".equals(info.getP_SEX())) { | |
| 346 | + } else if ("女".equals(info.getP_SEX())) { | |
| 347 | 347 | map.put("sex", "女"); |
| 348 | 348 | } |
| 349 | 349 | map.put("name", info.getP_NAME()); |
| 350 | - map.put("cardNo", info.getP_CARDNO()); | |
| 350 | + map.put("idCardNo", info.getP_CARDNO()); //身份证号码 | |
| 351 | + map.put("cardNo", cardNo);//就诊卡号 | |
| 351 | 352 | map.put("phone", info.getP_MOBILEPHONE()); |
| 352 | 353 | map.put("birth", DateUtil.getyyyy_MM_dd(parseYmd(info.getBIRTH()))); |
| 353 | 354 | result.add(map); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
13ff6d4
| ... | ... | @@ -7,10 +7,14 @@ |
| 7 | 7 | import com.lyms.platform.common.utils.DateUtil; |
| 8 | 8 | import com.lyms.platform.common.utils.JsonUtil; |
| 9 | 9 | import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade; |
| 10 | +import com.lyms.platform.operate.web.facade.BabyCheckFacade; | |
| 10 | 11 | import com.lyms.platform.operate.web.result.HighScoreResult; |
| 11 | 12 | import com.lyms.platform.operate.web.service.SyncDataTaskService; |
| 12 | 13 | import com.lyms.platform.permission.service.OrganizationService; |
| 13 | 14 | import com.lyms.platform.pojo.*; |
| 15 | +import com.lyms.platform.query.*; | |
| 16 | +import javafx.scene.shape.LineTo; | |
| 17 | +import com.lyms.platform.pojo.*; | |
| 14 | 18 | import com.lyms.platform.query.AntExChuQuery; |
| 15 | 19 | import com.lyms.platform.query.AntExQuery; |
| 16 | 20 | import com.lyms.platform.query.MatDeliverQuery; |
| ... | ... | @@ -65,6 +69,16 @@ |
| 65 | 69 | @Autowired |
| 66 | 70 | private MatDeliverService matDeliverService; |
| 67 | 71 | |
| 72 | + @Autowired | |
| 73 | + private BabyBookbuildingService babyBookbuildingService; | |
| 74 | + | |
| 75 | + @Autowired | |
| 76 | + private BabyCheckService babyCheckService; | |
| 77 | + | |
| 78 | + | |
| 79 | + @Autowired | |
| 80 | + private BabyCheckFacade babyCheckFacade; | |
| 81 | + | |
| 68 | 82 | /** |
| 69 | 83 | * 获取科室 |
| 70 | 84 | */ |
| ... | ... | @@ -677,7 +691,7 @@ |
| 677 | 691 | Date max = pat.getFmDate(); |
| 678 | 692 | if (min != null && max != null) |
| 679 | 693 | { |
| 680 | - HighScoreResult highScoreResult = antenatalExaminationFacade.getPatLastRiskByDate(pat.getPid(),true,min,max); | |
| 694 | + HighScoreResult highScoreResult = antenatalExaminationFacade.getPatLastRiskByDate(pat.getPid(), true, min, max); | |
| 681 | 695 | PatientsQuery patientsQuery1 = new PatientsQuery(); |
| 682 | 696 | patientsQuery1.setId(pat.getId()); |
| 683 | 697 | patientsQuery1.setYn(YnEnums.YES.getId()); |
| ... | ... | @@ -701,6 +715,99 @@ |
| 701 | 715 | return "updateChanLaskRisk finish"; |
| 702 | 716 | } |
| 703 | 717 | |
| 718 | + /** | |
| 719 | + * 更新儿童检查表中的生长发育评价 | |
| 720 | + * @param hid | |
| 721 | + * @return | |
| 722 | + */ | |
| 723 | + @RequestMapping(value = "/updateBabyGrowth", method = RequestMethod.GET) | |
| 724 | + @ResponseBody | |
| 725 | + public String updateBabyGrowth(@RequestParam(required = true) String hid) { | |
| 726 | + | |
| 727 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 728 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
| 729 | + babyModelQuery.setHospitalId(hid); | |
| 730 | + | |
| 731 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 732 | + if (CollectionUtils.isNotEmpty(models)) | |
| 733 | + { | |
| 734 | + int batchSize = 200; | |
| 735 | + int end = 0; | |
| 736 | + for (int i = 0; i < models.size(); i += batchSize) { | |
| 737 | + end = (end + batchSize); | |
| 738 | + if (end > models.size()) { | |
| 739 | + end = models.size(); | |
| 740 | + } | |
| 741 | + System.out.println("start:" + i + ",end:" + end); | |
| 742 | + final List<BabyModel> tempList = models.subList(i, end); | |
| 743 | + new Thread(new Runnable() { | |
| 744 | + @Override | |
| 745 | + public void run() { | |
| 746 | + if (CollectionUtils.isNotEmpty(tempList)) | |
| 747 | + { | |
| 748 | + for (BabyModel babyModel : tempList) { | |
| 749 | + if (babyModel != null) | |
| 750 | + { | |
| 751 | + BabyCheckModelQuery query = new BabyCheckModelQuery(); | |
| 752 | + query.setYn(YnEnums.YES.getId()); | |
| 753 | + query.setBuildId(babyModel.getId()); | |
| 754 | + | |
| 755 | + List<BabyCheckModel> checkModels = babyCheckService.queryBabyCheckRecord(query); | |
| 756 | + if (CollectionUtils.isNotEmpty(checkModels)) | |
| 757 | + { | |
| 758 | + for (BabyCheckModel checkModel : checkModels) | |
| 759 | + { | |
| 760 | + String height = checkModel.getHeight(); | |
| 761 | + String birth = DateUtil.getyyyy_MM_dd(babyModel.getBirth()); | |
| 762 | + // type 0 体重标准差数值表 1 身长/身高标准差数值表 2 头围标准差数值表 3身高别体重 | |
| 763 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(height)) | |
| 764 | + { | |
| 765 | + String value = babyCheckFacade.getGrowthValue(birth,Double.parseDouble(height),babyModel.getSex(),1); | |
| 766 | + checkModel.setHeadEvaluate(value); | |
| 767 | + | |
| 768 | + } | |
| 769 | + String head = checkModel.getHead(); | |
| 770 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(head)) { | |
| 771 | + String value = babyCheckFacade.getGrowthValue(birth,Double.parseDouble(head),babyModel.getSex(),1); | |
| 772 | + checkModel.setHeadEvaluate(value); | |
| 773 | + } | |
| 774 | + | |
| 775 | + String weight = checkModel.getWeight(); | |
| 776 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(weight)) { | |
| 777 | + String value = babyCheckFacade.getGrowthValue(birth,Double.parseDouble(weight),babyModel.getSex(),1); | |
| 778 | + checkModel.setHeadEvaluate(value); | |
| 779 | + } | |
| 780 | + | |
| 781 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(height) && | |
| 782 | + com.lyms.platform.common.utils.StringUtils.isNotEmpty(weight)) | |
| 783 | + { | |
| 784 | + //发育评价 | |
| 785 | + List<String> growthEvaluate = babyCheckFacade.getBabyGrowthEvaluate(Double.parseDouble(height), babyModel.getSex(), birth, Double.parseDouble(weight)); | |
| 786 | + if (CollectionUtils.isNotEmpty(growthEvaluate)) | |
| 787 | + { | |
| 788 | + checkModel.setGrowthEvaluate(JsonUtil.array2JsonString(growthEvaluate)); | |
| 789 | + } | |
| 790 | + | |
| 791 | + String hw = babyCheckFacade.getBabyHW(Double.parseDouble(height),Double.parseDouble(weight),babyModel.getSex(),birth); | |
| 792 | + checkModel.setHeightWeight(hw); | |
| 793 | + | |
| 794 | + } | |
| 795 | + | |
| 796 | + babyCheckService.updateBabyCheck(checkModel,checkModel.getId()); | |
| 797 | + } | |
| 798 | + } | |
| 799 | + } | |
| 800 | + } | |
| 801 | + } | |
| 802 | + } | |
| 803 | + }).start(); | |
| 804 | + } | |
| 805 | + | |
| 806 | + } | |
| 807 | + | |
| 808 | + | |
| 809 | + return "updateBabyGrowth finish"; | |
| 810 | + } | |
| 704 | 811 | |
| 705 | 812 | public static void main(String[] a) { |
| 706 | 813 | try { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
13ff6d4
| ... | ... | @@ -94,6 +94,8 @@ |
| 94 | 94 | bm.setLastDiagnose(diagnoseNames); |
| 95 | 95 | } |
| 96 | 96 | babyBookbuildingService.updateBabyBuild(bm, request.getBuildId()); |
| 97 | + updateLastGrowth(model); | |
| 98 | + | |
| 97 | 99 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
| 98 | 100 | } |
| 99 | 101 | |
| 100 | 102 | |
| 101 | 103 | |
| 102 | 104 | |
| ... | ... | @@ -294,19 +296,47 @@ |
| 294 | 296 | applyOrderService.updateByParentId(referralApplyOrderQuery2, model1); |
| 295 | 297 | } |
| 296 | 298 | } |
| 299 | + | |
| 300 | + updateLastGrowth(model); | |
| 301 | + | |
| 297 | 302 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 298 | 303 | br.setErrormsg("成功"); |
| 299 | 304 | br.setData(model.getId()); |
| 300 | 305 | return br; |
| 301 | 306 | } |
| 302 | 307 | |
| 308 | + | |
| 309 | + public void updateLastGrowth(BabyCheckModel model) | |
| 310 | + { | |
| 311 | + babyBookbuildingService.updateBabyLastGrowth(model); | |
| 312 | + } | |
| 313 | + | |
| 314 | + | |
| 303 | 315 | /** |
| 304 | 316 | * 删除儿保检查 |
| 305 | 317 | * |
| 306 | 318 | * @param id |
| 307 | 319 | */ |
| 308 | 320 | public void deleteBabyCheckById(String id) { |
| 321 | + BabyCheckModelQuery query = new BabyCheckModelQuery(); | |
| 322 | + query.setYn(YnEnums.YES.getId()); | |
| 323 | + query.setId(id); | |
| 324 | + //查询儿童的检查记录 | |
| 325 | + List<BabyCheckModel> checkModels = babyCheckService.queryBabyCheckRecord(query,"checkDate", Sort.Direction.DESC); | |
| 326 | + | |
| 309 | 327 | babyCheckService.deleteBabyCheckById(id); |
| 328 | + if (CollectionUtils.isNotEmpty(checkModels)) | |
| 329 | + { | |
| 330 | + query.setId(null); | |
| 331 | + query.setBuildId(checkModels.get(0).getBuildId()); | |
| 332 | + checkModels = babyCheckService.queryBabyCheckRecord(query,"checkDate", Sort.Direction.DESC); | |
| 333 | + if (CollectionUtils.isNotEmpty(checkModels)) | |
| 334 | + { | |
| 335 | + updateLastGrowth(checkModels.get(0)); | |
| 336 | + } | |
| 337 | + } | |
| 338 | + | |
| 339 | + | |
| 310 | 340 | } |
| 311 | 341 | |
| 312 | 342 | /** |
| 313 | 343 | |
| ... | ... | @@ -877,8 +907,20 @@ |
| 877 | 907 | * @param sex |
| 878 | 908 | * @return |
| 879 | 909 | */ |
| 880 | - public BaseObjectResponse queryHWByHeight(Double height,Double value, Integer sex,String birth) { | |
| 910 | + public BaseObjectResponse queryHWByHeight(Double height,Double weight, Integer sex,String birth) { | |
| 881 | 911 | |
| 912 | + | |
| 913 | + String res = getBabyHW(height,weight,sex,birth); | |
| 914 | + BaseObjectResponse br = new BaseObjectResponse(); | |
| 915 | + br.setData(res); | |
| 916 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 917 | + br.setErrormsg("成功"); | |
| 918 | + return br; | |
| 919 | + } | |
| 920 | + | |
| 921 | + | |
| 922 | + public String getBabyHW(Double height,Double weight, Integer sex,String birth) | |
| 923 | + { | |
| 882 | 924 | Double hw = getHw(height); |
| 883 | 925 | |
| 884 | 926 | //计算儿童的月龄 |
| 885 | 927 | |
| 886 | 928 | |
| 887 | 929 | |
| 888 | 930 | |
| 889 | 931 | |
| 890 | 932 | |
| 891 | 933 | |
| ... | ... | @@ -896,41 +938,36 @@ |
| 896 | 938 | if (CollectionUtils.isNotEmpty(list)) { |
| 897 | 939 | AwModel model = list.get(0); |
| 898 | 940 | |
| 899 | - if (model.getPthreeDs() < value) | |
| 941 | + if (model.getPthreeDs() < weight) | |
| 900 | 942 | { |
| 901 | 943 | res = "上"; |
| 902 | 944 | } |
| 903 | - else if (model.getPthreeDs() >=value && value > model.getPtwoDs()) | |
| 945 | + else if (model.getPthreeDs() >=weight && weight > model.getPtwoDs()) | |
| 904 | 946 | { |
| 905 | 947 | res = "中上"; |
| 906 | 948 | } |
| 907 | - else if (model.getPtwoDs() >=value && value > model.getPoneDs()) | |
| 949 | + else if (model.getPtwoDs() >=weight && weight > model.getPoneDs()) | |
| 908 | 950 | { |
| 909 | 951 | res = "中+"; |
| 910 | 952 | } |
| 911 | - else if (model.getPoneDs() >=value && value >= model.getRoneDs()) | |
| 953 | + else if (model.getPoneDs() >=weight && weight >= model.getRoneDs()) | |
| 912 | 954 | { |
| 913 | 955 | res = "中"; |
| 914 | 956 | } |
| 915 | - else if (model.getRoneDs() >value && value >= model.getRtwoDs()) | |
| 957 | + else if (model.getRoneDs() >weight && weight >= model.getRtwoDs()) | |
| 916 | 958 | { |
| 917 | 959 | res = "中-"; |
| 918 | 960 | } |
| 919 | - else if (model.getRtwoDs() >value && value >= model.getRthreeDs()) | |
| 961 | + else if (model.getRtwoDs() >weight && weight >= model.getRthreeDs()) | |
| 920 | 962 | { |
| 921 | 963 | res = "中下"; |
| 922 | 964 | } |
| 923 | - else if (model.getRtwoDs() >value) | |
| 965 | + else if (model.getRtwoDs() >weight) | |
| 924 | 966 | { |
| 925 | 967 | res = "下"; |
| 926 | 968 | } |
| 927 | 969 | } |
| 928 | - | |
| 929 | - BaseObjectResponse br = new BaseObjectResponse(); | |
| 930 | - br.setData(res); | |
| 931 | - br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 932 | - br.setErrormsg("成功"); | |
| 933 | - return br; | |
| 970 | + return res; | |
| 934 | 971 | } |
| 935 | 972 | |
| 936 | 973 | /** |
| ... | ... | @@ -980,6 +1017,16 @@ |
| 980 | 1017 | */ |
| 981 | 1018 | public BaseObjectResponse queryGrowthEvaluate(Double height, Integer sex, String birth,Double weight) { |
| 982 | 1019 | |
| 1020 | + List<String> list = getBabyGrowthEvaluate(height, sex, birth, weight); | |
| 1021 | + BaseObjectResponse br = new BaseObjectResponse(); | |
| 1022 | + br.setData(list); | |
| 1023 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 1024 | + br.setErrormsg("成功"); | |
| 1025 | + return br; | |
| 1026 | + } | |
| 1027 | + | |
| 1028 | + public List<String> getBabyGrowthEvaluate(Double height, Integer sex, String birth,Double weight) | |
| 1029 | + { | |
| 983 | 1030 | List<String> growthEvaluate = new ArrayList<>(); |
| 984 | 1031 | Double hw = getHw(height); |
| 985 | 1032 | |
| 986 | 1033 | |
| ... | ... | @@ -1027,32 +1074,28 @@ |
| 1027 | 1074 | |
| 1028 | 1075 | if (value != null) |
| 1029 | 1076 | { |
| 1030 | - //中位数百分比 | |
| 1031 | - Double mp = weight/value; | |
| 1032 | - if (mp < 0.8) | |
| 1033 | - { | |
| 1034 | - growthEvaluate.add("重度消瘦"); | |
| 1035 | - } | |
| 1036 | - else if (0.8 <= mp && mp < 0.9) | |
| 1037 | - { | |
| 1038 | - growthEvaluate.add("轻度消瘦"); | |
| 1039 | - } | |
| 1040 | - else if (1.1 < mp && mp <= 1.2) | |
| 1041 | - { | |
| 1042 | - growthEvaluate.add("超重"); | |
| 1043 | - } | |
| 1044 | - else if ( mp > 1.2) | |
| 1045 | - { | |
| 1046 | - growthEvaluate.add("肥胖"); | |
| 1047 | - } | |
| 1077 | + //中位数百分比 | |
| 1078 | + Double mp = weight/value; | |
| 1079 | + if (mp < 0.8) | |
| 1080 | + { | |
| 1081 | + growthEvaluate.add("重度消瘦"); | |
| 1082 | + } | |
| 1083 | + else if (0.8 <= mp && mp < 0.9) | |
| 1084 | + { | |
| 1085 | + growthEvaluate.add("轻度消瘦"); | |
| 1086 | + } | |
| 1087 | + else if (1.1 < mp && mp <= 1.2) | |
| 1088 | + { | |
| 1089 | + growthEvaluate.add("超重"); | |
| 1090 | + } | |
| 1091 | + else if ( mp > 1.2) | |
| 1092 | + { | |
| 1093 | + growthEvaluate.add("肥胖"); | |
| 1094 | + } | |
| 1048 | 1095 | } |
| 1049 | 1096 | |
| 1050 | 1097 | } |
| 1051 | - BaseObjectResponse br = new BaseObjectResponse(); | |
| 1052 | - br.setData(growthEvaluate); | |
| 1053 | - br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 1054 | - br.setErrormsg("成功"); | |
| 1055 | - return br; | |
| 1098 | + return growthEvaluate; | |
| 1056 | 1099 | } |
| 1057 | 1100 | |
| 1058 | 1101 | public BaseObjectResponse getBaseConfig() { |
| 1059 | 1102 | |
| ... | ... | @@ -1095,7 +1138,17 @@ |
| 1095 | 1138 | } |
| 1096 | 1139 | |
| 1097 | 1140 | public BaseObjectResponse queryBabyHealthStatus(String birth,Double value, Integer sex, Integer type) { |
| 1141 | + String res = getGrowthValue(birth,value,sex,type); | |
| 1142 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 1143 | + objectResponse.setData(res); | |
| 1144 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 1145 | + objectResponse.setErrormsg("成功"); | |
| 1146 | + return objectResponse; | |
| 1147 | + } | |
| 1098 | 1148 | |
| 1149 | + | |
| 1150 | + public String getGrowthValue(String birth,Double value, Integer sex, Integer type) | |
| 1151 | + { | |
| 1099 | 1152 | //计算儿童的月龄 |
| 1100 | 1153 | int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), new Date()); |
| 1101 | 1154 | |
| 1102 | 1155 | |
| ... | ... | @@ -1106,40 +1159,38 @@ |
| 1106 | 1159 | if (CollectionUtils.isNotEmpty(list)) { |
| 1107 | 1160 | AwModel model = list.get(0); |
| 1108 | 1161 | |
| 1109 | - if (model.getPthreeDs() < value) | |
| 1110 | - { | |
| 1111 | - res = "上"; | |
| 1112 | - } | |
| 1113 | - else if (model.getPthreeDs() >=value && value > model.getPtwoDs()) | |
| 1114 | - { | |
| 1115 | - res = "中上"; | |
| 1116 | - } | |
| 1117 | - else if (model.getPtwoDs() >=value && value > model.getPoneDs()) | |
| 1118 | - { | |
| 1119 | - res = "中+"; | |
| 1120 | - } | |
| 1121 | - else if (model.getPoneDs() >=value && value >= model.getRoneDs()) | |
| 1122 | - { | |
| 1123 | - res = "中"; | |
| 1124 | - } | |
| 1125 | - else if (model.getRoneDs() >value && value >= model.getRtwoDs()) | |
| 1126 | - { | |
| 1127 | - res = "中-"; | |
| 1128 | - } | |
| 1129 | - else if (model.getRtwoDs() >value && value >= model.getRthreeDs()) | |
| 1130 | - { | |
| 1131 | - res = "中下"; | |
| 1132 | - } | |
| 1133 | - else if (model.getRtwoDs() >value) | |
| 1134 | - { | |
| 1135 | - res = "下"; | |
| 1136 | - } | |
| 1162 | + if (model.getPthreeDs() < value) | |
| 1163 | + { | |
| 1164 | + res = "上"; | |
| 1165 | + } | |
| 1166 | + else if (model.getPthreeDs() >=value && value > model.getPtwoDs()) | |
| 1167 | + { | |
| 1168 | + res = "中上"; | |
| 1169 | + } | |
| 1170 | + else if (model.getPtwoDs() >=value && value > model.getPoneDs()) | |
| 1171 | + { | |
| 1172 | + res = "中+"; | |
| 1173 | + } | |
| 1174 | + else if (model.getPoneDs() >=value && value >= model.getRoneDs()) | |
| 1175 | + { | |
| 1176 | + res = "中"; | |
| 1177 | + } | |
| 1178 | + else if (model.getRoneDs() >value && value >= model.getRtwoDs()) | |
| 1179 | + { | |
| 1180 | + res = "中-"; | |
| 1181 | + } | |
| 1182 | + else if (model.getRtwoDs() >value && value >= model.getRthreeDs()) | |
| 1183 | + { | |
| 1184 | + res = "中下"; | |
| 1185 | + } | |
| 1186 | + else if (model.getRtwoDs() >value) | |
| 1187 | + { | |
| 1188 | + res = "下"; | |
| 1189 | + } | |
| 1137 | 1190 | } |
| 1138 | - BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 1139 | - objectResponse.setData(res); | |
| 1140 | - objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 1141 | - objectResponse.setErrormsg("成功"); | |
| 1142 | - return objectResponse; | |
| 1191 | + | |
| 1192 | + return res; | |
| 1193 | + | |
| 1143 | 1194 | } |
| 1144 | 1195 | } |