Commit 07ea90dfdbb6538f249e55dbcb78a0e36bd1c266
1 parent
3afedf05b4
Exists in
master
and in
1 other branch
code update
Showing 6 changed files with 149 additions and 5 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java
- platform-common/src/main/java/com/lyms/platform/common/enums/BaybHealthTabEnums.java
- platform-dal/src/main/java/com/lyms/platform/pojo/AwModel.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyCheckController.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 @
07ea90d
... | ... | @@ -82,7 +82,7 @@ |
82 | 82 | // addaw(applicationContext, "0-83月龄体重标准差数值表(男、女).csv", 0); |
83 | 83 | // addZhenduan(applicationContext); |
84 | 84 | |
85 | - addMingzu(applicationContext); | |
85 | + addHealthConfig(applicationContext); | |
86 | 86 | } |
87 | 87 | |
88 | 88 | public static void addZhenduan(ApplicationContext applicationContext) { |
... | ... | @@ -381,6 +381,42 @@ |
381 | 381 | e.printStackTrace(); |
382 | 382 | } |
383 | 383 | } |
384 | + | |
385 | + | |
386 | + public static void addHealthConfig(ApplicationContext applicationContext) { | |
387 | + MongoTemplate mongoTemplate | |
388 | + =(MongoTemplate)applicationContext.getBean("mongoTemplate"); | |
389 | + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); | |
390 | + | |
391 | + try { | |
392 | + List<String> list = FileUtils.readLines(new File("F:\\temp\\touwei.txt"),"gbk"); | |
393 | + for (String line:list) { | |
394 | + if (line != null) { | |
395 | + | |
396 | + String[] array = line.split(","); | |
397 | + | |
398 | + AwModel awModel2 = new AwModel(); | |
399 | + awModel2.setType(2); | |
400 | + awModel2.setSex(0); | |
401 | + awModel2.setAge(Integer.valueOf(array[0])); | |
402 | + awModel2.setRthreeDs(Double.valueOf(array[1])); | |
403 | + awModel2.setRtwoDs(Double.valueOf(array[2])); | |
404 | + awModel2.setRoneDs(Double.valueOf(array[3])); | |
405 | + awModel2.setMiddleDs(Double.valueOf(array[4])); | |
406 | + awModel2.setPoneDs(Double.valueOf(array[5])); | |
407 | + awModel2.setPtwoDs(Double.valueOf(array[6])); | |
408 | + awModel2.setPthreeDs(Double.valueOf(array[7])); | |
409 | + | |
410 | + System.out.println(" == " + JsonUtil.obj2JsonString(awModel2)); | |
411 | + mongoTemplate.save(awModel2); | |
412 | + } | |
413 | + } | |
414 | + | |
415 | + } catch (Exception e) { | |
416 | + e.printStackTrace(); | |
417 | + } | |
418 | + } | |
419 | + | |
384 | 420 | |
385 | 421 | public static void addVisit(ApplicationContext applicationContext){ |
386 | 422 | VisitModel visitModel = new VisitModel(); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java
View file @
07ea90d
... | ... | @@ -61,10 +61,11 @@ |
61 | 61 | return babyHwDao.queryHWByHeight(condition.toMongoQuery()); |
62 | 62 | } |
63 | 63 | |
64 | - public List<AwModel> queryAwByHeight(Integer age, Integer sex) { | |
64 | + public List<AwModel> queryBabyHealthConfig(Integer age, Integer sex,Integer type) { | |
65 | 65 | MongoCondition condition = MongoCondition.newInstance(); |
66 | 66 | condition = condition.and("age", age, MongoOper.IS); |
67 | 67 | condition = condition.and("sex", sex, MongoOper.IS); |
68 | + condition = condition.and("type", type, MongoOper.IS); | |
68 | 69 | return babyAwDao.queryAwByHeight(condition.toMongoQuery()); |
69 | 70 | } |
70 | 71 |
platform-common/src/main/java/com/lyms/platform/common/enums/BaybHealthTabEnums.java
View file @
07ea90d
1 | +package com.lyms.platform.common.enums; | |
2 | + | |
3 | + | |
4 | + | |
5 | +/** | |
6 | + * Created by lqy on 2016/3/29 0029. | |
7 | + */ | |
8 | +public enum BaybHealthTabEnums { | |
9 | + | |
10 | + | |
11 | + TZ(0,"体重"), | |
12 | + | |
13 | + SC(1,"身长"), | |
14 | + | |
15 | + TW(2,"头围"); | |
16 | + | |
17 | + private BaybHealthTabEnums(int id, String name){ | |
18 | + this.name=name; | |
19 | + this.id =id; | |
20 | + } | |
21 | + private String name; | |
22 | + private int id; | |
23 | + | |
24 | + public int getId() { | |
25 | + return id; | |
26 | + } | |
27 | + | |
28 | + public String getName() { | |
29 | + return name; | |
30 | + } | |
31 | + public static String getNameById(int id){ | |
32 | + for(BaybHealthTabEnums enums:values()){ | |
33 | + if(id==enums.getId()){ | |
34 | + return enums.getName(); | |
35 | + } | |
36 | + } | |
37 | + return null; | |
38 | + } | |
39 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/AwModel.java
View file @
07ea90d
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyCheckController.java
View file @
07ea90d
... | ... | @@ -120,10 +120,30 @@ |
120 | 120 | */ |
121 | 121 | @RequestMapping(value = "/queryHWByHeight", method = RequestMethod.GET) |
122 | 122 | @ResponseBody |
123 | - public BaseObjectResponse queryHWByHeight(@RequestParam(required = true) Double height,@RequestParam(required = true) Integer sex){ | |
123 | + public BaseObjectResponse queryHWByHeight( | |
124 | + @RequestParam(required = true) Double height, | |
125 | + @RequestParam(required = true) Integer sex){ | |
124 | 126 | return babyCheckFacade.queryHWByHeight(height, sex); |
125 | 127 | |
126 | 128 | } |
129 | + | |
130 | + | |
131 | + /** | |
132 | + * 查询儿童的健康状态 | |
133 | + * @param value | |
134 | + * @param sex | |
135 | + * @return | |
136 | + */ | |
137 | + @RequestMapping(value = "/queryBabyHealthStatus", method = RequestMethod.GET) | |
138 | + @ResponseBody | |
139 | + public BaseObjectResponse queryBabyHealthStatus(@RequestParam(required = true) Double value, | |
140 | + @RequestParam(required = true) Integer sex, | |
141 | + @RequestParam(required = true) Integer type, | |
142 | + @RequestParam(required = true) String birth){ | |
143 | + return babyCheckFacade.queryBabyHealthStatus(birth,value, sex, type); | |
144 | + | |
145 | + } | |
146 | + | |
127 | 147 | |
128 | 148 | /** |
129 | 149 | * 计算体格发育评价 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
07ea90d
... | ... | @@ -939,7 +939,7 @@ |
939 | 939 | |
940 | 940 | |
941 | 941 | //查询该月龄的年龄别体重值 |
942 | - List<AwModel> aws = babyCheckService.queryAwByHeight(monthAge, sex); | |
942 | + List<AwModel> aws = babyCheckService.queryBabyHealthConfig(monthAge, sex,0); | |
943 | 943 | if (CollectionUtils.isNotEmpty(aws) && aws.size() > 1) |
944 | 944 | { |
945 | 945 | AwModel model = aws.get(0); |
... | ... | @@ -1032,6 +1032,54 @@ |
1032 | 1032 | objectResponse.setErrormsg("成功"); |
1033 | 1033 | |
1034 | 1034 | return objectResponse; |
1035 | + } | |
1036 | + | |
1037 | + public BaseObjectResponse queryBabyHealthStatus(String birth,Double value, Integer sex, Integer type) { | |
1038 | + | |
1039 | + //计算儿童的月龄 | |
1040 | + int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), new Date()); | |
1041 | + | |
1042 | + | |
1043 | + //查询该月龄的年龄别体重值 | |
1044 | + List<AwModel> list = babyCheckService.queryBabyHealthConfig(monthAge, sex,type); | |
1045 | + String res = ""; | |
1046 | + if (CollectionUtils.isNotEmpty(list)) { | |
1047 | + AwModel model = list.get(0); | |
1048 | + | |
1049 | + if (model.getPthreeDs() < value) | |
1050 | + { | |
1051 | + res = "上"; | |
1052 | + } | |
1053 | + else if (model.getPthreeDs() >=value && value > model.getPtwoDs()) | |
1054 | + { | |
1055 | + res = "中上"; | |
1056 | + } | |
1057 | + else if (model.getPtwoDs() >=value && value > model.getPoneDs()) | |
1058 | + { | |
1059 | + res = "中+"; | |
1060 | + } | |
1061 | + else if (model.getPoneDs() >=value && value >= model.getRoneDs()) | |
1062 | + { | |
1063 | + res = "中"; | |
1064 | + } | |
1065 | + else if (model.getRoneDs() >value && value >= model.getRtwoDs()) | |
1066 | + { | |
1067 | + res = "中-"; | |
1068 | + } | |
1069 | + else if (model.getRtwoDs() >value && value >= model.getRthreeDs()) | |
1070 | + { | |
1071 | + res = "中下"; | |
1072 | + } | |
1073 | + else if (model.getRtwoDs() >value) | |
1074 | + { | |
1075 | + res = "下"; | |
1076 | + } | |
1077 | + } | |
1078 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
1079 | + objectResponse.setData(res); | |
1080 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
1081 | + objectResponse.setErrormsg("成功"); | |
1082 | + return objectResponse; | |
1035 | 1083 | } |
1036 | 1084 | } |