Commit 345ff26097a5701a38e23bad28d3d7124244c276

Authored by litao@lymsh.com
1 parent ee67124b48

耳塞相关接口

Showing 10 changed files with 567 additions and 104 deletions

platform-common/src/main/java/com/lyms/platform/common/enums/AddSubtractEnums.java View file @ 345ff26
  1 +package com.lyms.platform.common.enums;
  2 +
  3 +import com.lyms.platform.common.utils.StringUtils;
  4 +
  5 +/**
  6 + * ( + ) (一) 其他
  7 + * Created by lt on 2017/7/18 0018
  8 + */
  9 +public enum AddSubtractEnums {
  10 + ADD(1, "( + )"),
  11 + SUBTRACT(2, "(一)"),
  12 + OTHER(3, "其他");
  13 +
  14 + private Integer id;
  15 + private String name;
  16 +
  17 + public static AddSubtractEnums get(Integer id) {
  18 + AddSubtractEnums[] values = AddSubtractEnums.values();
  19 + for (AddSubtractEnums value : values) {
  20 + if (value.getId() == id) {
  21 + return value;
  22 + }
  23 + }
  24 + return null;
  25 + }
  26 +
  27 + AddSubtractEnums(Integer id, String name){
  28 + this.id = id;
  29 + this.name = name;
  30 + }
  31 +
  32 + public static String getName(String id) {
  33 + if(StringUtils.isEmpty(id)) {
  34 + return null;
  35 + }
  36 + int i = Integer.parseInt(id);
  37 + AddSubtractEnums[] values = AddSubtractEnums.values();
  38 + for (AddSubtractEnums value : values) {
  39 + if (value.getId() == i) {
  40 + return value.getName();
  41 + }
  42 + }
  43 + return null;
  44 + }
  45 +
  46 + public Integer getId() {
  47 + return id;
  48 + }
  49 +
  50 + public void setId(Integer id) {
  51 + this.id = id;
  52 + }
  53 +
  54 + public String getName() {
  55 + return name;
  56 + }
  57 +
  58 + public void setName(String name) {
  59 + this.name = name;
  60 + }
  61 +
  62 +}
platform-common/src/main/java/com/lyms/platform/common/enums/EyeMovementsEnums.java View file @ 345ff26
  1 +package com.lyms.platform.common.enums;
  2 +
  3 +import com.lyms.platform.common.utils.StringUtils;
  4 +
  5 +/**
  6 + * 眼球运动
  7 + */
  8 +public enum EyeMovementsEnums {
  9 + COORDINATE(1, "协调"),
  10 + LIMIT(2, "限制");
  11 +
  12 + private Integer id;
  13 + private String name;
  14 +
  15 + public static EyeMovementsEnums get(Integer id) {
  16 + EyeMovementsEnums[] values = EyeMovementsEnums.values();
  17 + for (EyeMovementsEnums value : values) {
  18 + if (value.getId() == id) {
  19 + return value;
  20 + }
  21 + }
  22 + return null;
  23 + }
  24 +
  25 + EyeMovementsEnums(Integer id, String name){
  26 + this.id = id;
  27 + this.name = name;
  28 + }
  29 +
  30 + public static String getName(String id) {
  31 + if(StringUtils.isEmpty(id)) {
  32 + return null;
  33 + }
  34 + int i = Integer.parseInt(id);
  35 + EyeMovementsEnums[] values = EyeMovementsEnums.values();
  36 + for (EyeMovementsEnums value : values) {
  37 + if (value.getId() == i) {
  38 + return value.getName();
  39 + }
  40 + }
  41 + return null;
  42 + }
  43 +
  44 + public Integer getId() {
  45 + return id;
  46 + }
  47 +
  48 + public void setId(Integer id) {
  49 + this.id = id;
  50 + }
  51 +
  52 + public String getName() {
  53 + return name;
  54 + }
  55 +
  56 + public void setName(String name) {
  57 + this.name = name;
  58 + }
  59 +
  60 +}
platform-common/src/main/java/com/lyms/platform/common/enums/EyePositionEnums.java View file @ 345ff26
  1 +package com.lyms.platform.common.enums;
  2 +
  3 +import com.lyms.platform.common.utils.StringUtils;
  4 +
  5 +/**
  6 + * 眼位
  7 + */
  8 +public enum EyePositionEnums {
  9 + NORMOTOPIA(1, "正位"),
  10 + INTERNAL_OBLIQUE(2, "内斜"),
  11 + EXTERNAL_OBLIQUE(3, "外斜"),
  12 + SUPERIOR_OBLIQUE_MUSCLE(4, "上斜肌肌麻痹"),
  13 + OTHER(5, "其他");
  14 +
  15 + private Integer id;
  16 + private String name;
  17 +
  18 + public static EyePositionEnums get(Integer id) {
  19 + EyePositionEnums[] values = EyePositionEnums.values();
  20 + for (EyePositionEnums value : values) {
  21 + if (value.getId() == id) {
  22 + return value;
  23 + }
  24 + }
  25 + return null;
  26 + }
  27 +
  28 + EyePositionEnums(Integer id, String name){
  29 + this.id = id;
  30 + this.name = name;
  31 + }
  32 +
  33 + public static String getName(String id) {
  34 + if(StringUtils.isEmpty(id)) {
  35 + return null;
  36 + }
  37 + int i = Integer.parseInt(id);
  38 + EyePositionEnums[] values = EyePositionEnums.values();
  39 + for (EyePositionEnums value : values) {
  40 + if (value.getId() == i) {
  41 + return value.getName();
  42 + }
  43 + }
  44 + return null;
  45 + }
  46 +
  47 + public Integer getId() {
  48 + return id;
  49 + }
  50 +
  51 + public void setId(Integer id) {
  52 + this.id = id;
  53 + }
  54 +
  55 + public String getName() {
  56 + return name;
  57 + }
  58 +
  59 + public void setName(String name) {
  60 + this.name = name;
  61 + }
  62 +
  63 +}
platform-dal/src/main/java/com/lyms/platform/pojo/BabyEyeCheck.java View file @ 345ff26
... ... @@ -43,11 +43,6 @@
43 43 private Date checkTime;
44 44  
45 45 /**
46   - * 眼保健时间
47   - */
48   -// private String eyeCheckDay;
49   -
50   - /**
51 46 * 眼病高危因素
52 47 */
53 48 private List<String> riskFactorId;
54 49  
55 50  
... ... @@ -102,12 +97,12 @@
102 97 private String fundusResult;
103 98  
104 99 /**
105   - * 指导意见(下拉列表)
  100 + * 处理意见
106 101 */
107   - private List<String> guidanceOpinionIds;
  102 + private String handleOpinions;
108 103  
109 104 /**
110   - * 指导意见(输入)
  105 + * 指导意见
111 106 */
112 107 private String guidanceOpinions;
113 108  
114 109  
115 110  
116 111  
117 112  
118 113  
119 114  
120 115  
121 116  
122 117  
123 118  
124 119  
125 120  
126 121  
127 122  
128 123  
129 124  
130 125  
131 126  
... ... @@ -117,54 +112,199 @@
117 112 private String doctor;
118 113  
119 114 /**
120   - * 预约下次检查
  115 + * 预约下次检查枚举
121 116 */
122   - private Date nextCheckTime;
  117 + private String CheckMonthId;
123 118  
124 119 /**
125   - * 预约下次检查描述
  120 + * 预约下次检查时间
126 121 */
127   - private Date nextCheckTimeDesc;
  122 + private Date nextCheckTime;
128 123 /** ================================== table1 end ==================================== */
129 124  
130 125  
131 126 /** ================================== table2 start ==================================== */
132   -
133 127 /**
134   - * 外眼观察其他的结果
  128 + * 外眼观察
135 129 */
  130 + private String extEyelook;
136 131 private String extEyelookOther;
137 132  
138 133 /**
139   - * 视动性眼震
  134 + * 红光反射
140 135 */
141   - private String nystagmus;
  136 + private String redReflex;
  137 + private String redReflexOther;
142 138  
143 139 /**
  140 + * 手持验光仪
  141 + */
  142 + private String r1;
  143 + private String r2;
  144 + private String l1;
  145 + private String l2;
  146 +
  147 + /**
144 148 * 结膜
145 149 */
146 150 private String conjunctiva;
  151 + private String conjunctivaOther;
147 152  
148 153 /**
149 154 * 角膜
150 155 */
151 156 private String corneal;
  157 + private String cornealOther;
152 158  
153 159 /**
154 160 * 泪器
155 161 */
156 162 private String lacrimalApparatus;
  163 + private String lacrimalApparatusOther;
157 164  
158 165 /**
  166 + * 眼球运动
  167 + */
  168 + private String eyeMovementsId;
  169 +
  170 + /**
  171 + * 眼位
  172 + */
  173 + private String eyePositionId;
  174 + private String eyePositionOther;
  175 +
  176 + /**
  177 + * 双眼视觉
  178 + */
  179 + private String binocularVision;
  180 +
  181 + /**
159 182 * 其他
160 183 */
161 184 private String other;
  185 + /** ================================== table2 end ==================================== */
162 186  
  187 + /** ================================== table3 start ==================================== */
163 188 /**
164   - * 处理意见
  189 + * 视力
165 190 */
166   - private String handleOpinions;
  191 + private String lVision;
  192 + private String rVision;
167 193  
  194 + /**
  195 + * 屈光
  196 + */
  197 + private String refractionL1;
  198 + private String refractionL2;
  199 + private String refractionR1;
  200 + private String refractionR2;
  201 +
  202 + /**
  203 + * 视动性眼震
  204 + */
  205 + private String nystagmus;
  206 +
  207 + /**
  208 + * 选择性注视卡检查
  209 + */
  210 + private String fixationCard;
  211 +
  212 + public String getRefractionL1() {
  213 + return refractionL1;
  214 + }
  215 +
  216 + public void setRefractionL1(String refractionL1) {
  217 + this.refractionL1 = refractionL1;
  218 + }
  219 +
  220 + public String getRefractionL2() {
  221 + return refractionL2;
  222 + }
  223 +
  224 + public void setRefractionL2(String refractionL2) {
  225 + this.refractionL2 = refractionL2;
  226 + }
  227 +
  228 + public String getRefractionR1() {
  229 + return refractionR1;
  230 + }
  231 +
  232 + public void setRefractionR1(String refractionR1) {
  233 + this.refractionR1 = refractionR1;
  234 + }
  235 +
  236 + public String getRefractionR2() {
  237 + return refractionR2;
  238 + }
  239 +
  240 + public void setRefractionR2(String refractionR2) {
  241 + this.refractionR2 = refractionR2;
  242 + }
  243 +
  244 + public String getNystagmus() {
  245 + return nystagmus;
  246 + }
  247 +
  248 + public void setNystagmus(String nystagmus) {
  249 + this.nystagmus = nystagmus;
  250 + }
  251 +
  252 + public String getFixationCard() {
  253 + return fixationCard;
  254 + }
  255 +
  256 + public void setFixationCard(String fixationCard) {
  257 + this.fixationCard = fixationCard;
  258 + }
  259 +
  260 + public String getExtEyelook() {
  261 + return extEyelook;
  262 + }
  263 +
  264 + public void setExtEyelook(String extEyelook) {
  265 + this.extEyelook = extEyelook;
  266 + }
  267 +
  268 + public String getExtEyelookOther() {
  269 + return extEyelookOther;
  270 + }
  271 +
  272 + public void setExtEyelookOther(String extEyelookOther) {
  273 + this.extEyelookOther = extEyelookOther;
  274 + }
  275 +
  276 + public String getRedReflexOther() {
  277 + return redReflexOther;
  278 + }
  279 +
  280 + public void setRedReflexOther(String redReflexOther) {
  281 + this.redReflexOther = redReflexOther;
  282 + }
  283 +
  284 + public String getConjunctivaOther() {
  285 + return conjunctivaOther;
  286 + }
  287 +
  288 + public void setConjunctivaOther(String conjunctivaOther) {
  289 + this.conjunctivaOther = conjunctivaOther;
  290 + }
  291 +
  292 + public String getCornealOther() {
  293 + return cornealOther;
  294 + }
  295 +
  296 + public void setCornealOther(String cornealOther) {
  297 + this.cornealOther = cornealOther;
  298 + }
  299 +
  300 + public String getLacrimalApparatusOther() {
  301 + return lacrimalApparatusOther;
  302 + }
  303 +
  304 + public void setLacrimalApparatusOther(String lacrimalApparatusOther) {
  305 + this.lacrimalApparatusOther = lacrimalApparatusOther;
  306 + }
  307 +
168 308 public String getId() {
169 309 return id;
170 310 }
... ... @@ -229,6 +369,134 @@
229 369 this.checkMonthId = checkMonthId;
230 370 }
231 371  
  372 + public Date getNextCheckTime() {
  373 + return nextCheckTime;
  374 + }
  375 +
  376 + public void setNextCheckTime(Date nextCheckTime) {
  377 + this.nextCheckTime = nextCheckTime;
  378 + }
  379 +
  380 + public String getRedReflex() {
  381 + return redReflex;
  382 + }
  383 +
  384 + public void setRedReflex(String redReflex) {
  385 + this.redReflex = redReflex;
  386 + }
  387 +
  388 + public String getR1() {
  389 + return r1;
  390 + }
  391 +
  392 + public void setR1(String r1) {
  393 + this.r1 = r1;
  394 + }
  395 +
  396 + public String getR2() {
  397 + return r2;
  398 + }
  399 +
  400 + public void setR2(String r2) {
  401 + this.r2 = r2;
  402 + }
  403 +
  404 + public String getL1() {
  405 + return l1;
  406 + }
  407 +
  408 + public void setL1(String l1) {
  409 + this.l1 = l1;
  410 + }
  411 +
  412 + public String getL2() {
  413 + return l2;
  414 + }
  415 +
  416 + public void setL2(String l2) {
  417 + this.l2 = l2;
  418 + }
  419 +
  420 + public String getConjunctiva() {
  421 + return conjunctiva;
  422 + }
  423 +
  424 + public void setConjunctiva(String conjunctiva) {
  425 + this.conjunctiva = conjunctiva;
  426 + }
  427 +
  428 + public String getCorneal() {
  429 + return corneal;
  430 + }
  431 +
  432 + public void setCorneal(String corneal) {
  433 + this.corneal = corneal;
  434 + }
  435 +
  436 + public String getLacrimalApparatus() {
  437 + return lacrimalApparatus;
  438 + }
  439 +
  440 + public void setLacrimalApparatus(String lacrimalApparatus) {
  441 + this.lacrimalApparatus = lacrimalApparatus;
  442 + }
  443 +
  444 + public String getEyeMovementsId() {
  445 + return eyeMovementsId;
  446 + }
  447 +
  448 + public void setEyeMovementsId(String eyeMovementsId) {
  449 + this.eyeMovementsId = eyeMovementsId;
  450 + }
  451 +
  452 + public String getEyePositionId() {
  453 + return eyePositionId;
  454 + }
  455 +
  456 + public void setEyePositionId(String eyePositionId) {
  457 + this.eyePositionId = eyePositionId;
  458 + }
  459 +
  460 + public String getEyePositionOther() {
  461 + return eyePositionOther;
  462 + }
  463 +
  464 + public void setEyePositionOther(String eyePositionOther) {
  465 + this.eyePositionOther = eyePositionOther;
  466 + }
  467 +
  468 + public String getBinocularVision() {
  469 + return binocularVision;
  470 + }
  471 +
  472 + public void setBinocularVision(String binocularVision) {
  473 + this.binocularVision = binocularVision;
  474 + }
  475 +
  476 + public String getOther() {
  477 + return other;
  478 + }
  479 +
  480 + public void setOther(String other) {
  481 + this.other = other;
  482 + }
  483 +
  484 + public String getlVision() {
  485 + return lVision;
  486 + }
  487 +
  488 + public void setlVision(String lVision) {
  489 + this.lVision = lVision;
  490 + }
  491 +
  492 + public String getrVision() {
  493 + return rVision;
  494 + }
  495 +
  496 + public void setrVision(String rVision) {
  497 + this.rVision = rVision;
  498 + }
  499 +
232 500 public String getCheckHospital() {
233 501 return checkHospital;
234 502 }
235 503  
... ... @@ -325,12 +593,12 @@
325 593 this.fundusResult = fundusResult;
326 594 }
327 595  
328   - public List<String> getGuidanceOpinionIds() {
329   - return guidanceOpinionIds;
  596 + public String getHandleOpinions() {
  597 + return handleOpinions;
330 598 }
331 599  
332   - public void setGuidanceOpinionIds(List<String> guidanceOpinionIds) {
333   - this.guidanceOpinionIds = guidanceOpinionIds;
  600 + public void setHandleOpinions(String handleOpinions) {
  601 + this.handleOpinions = handleOpinions;
334 602 }
335 603  
336 604 public String getGuidanceOpinions() {
... ... @@ -347,78 +615,6 @@
347 615  
348 616 public void setDoctor(String doctor) {
349 617 this.doctor = doctor;
350   - }
351   -
352   - public Date getNextCheckTime() {
353   - return nextCheckTime;
354   - }
355   -
356   - public void setNextCheckTime(Date nextCheckTime) {
357   - this.nextCheckTime = nextCheckTime;
358   - }
359   -
360   - public Date getNextCheckTimeDesc() {
361   - return nextCheckTimeDesc;
362   - }
363   -
364   - public void setNextCheckTimeDesc(Date nextCheckTimeDesc) {
365   - this.nextCheckTimeDesc = nextCheckTimeDesc;
366   - }
367   -
368   - public String getExtEyelookOther() {
369   - return extEyelookOther;
370   - }
371   -
372   - public void setExtEyelookOther(String extEyelookOther) {
373   - this.extEyelookOther = extEyelookOther;
374   - }
375   -
376   - public String getNystagmus() {
377   - return nystagmus;
378   - }
379   -
380   - public void setNystagmus(String nystagmus) {
381   - this.nystagmus = nystagmus;
382   - }
383   -
384   - public String getConjunctiva() {
385   - return conjunctiva;
386   - }
387   -
388   - public void setConjunctiva(String conjunctiva) {
389   - this.conjunctiva = conjunctiva;
390   - }
391   -
392   - public String getCorneal() {
393   - return corneal;
394   - }
395   -
396   - public void setCorneal(String corneal) {
397   - this.corneal = corneal;
398   - }
399   -
400   - public String getLacrimalApparatus() {
401   - return lacrimalApparatus;
402   - }
403   -
404   - public void setLacrimalApparatus(String lacrimalApparatus) {
405   - this.lacrimalApparatus = lacrimalApparatus;
406   - }
407   -
408   - public String getOther() {
409   - return other;
410   - }
411   -
412   - public void setOther(String other) {
413   - this.other = other;
414   - }
415   -
416   - public String getHandleOpinions() {
417   - return handleOpinions;
418   - }
419   -
420   - public void setHandleOpinions(String handleOpinions) {
421   - this.handleOpinions = handleOpinions;
422 618 }
423 619 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEyeCheckController.java View file @ 345ff26
... ... @@ -3,6 +3,7 @@
3 3 import com.lyms.platform.common.base.BaseController;
4 4 import com.lyms.platform.common.result.BaseResponse;
5 5 import com.lyms.platform.operate.web.service.BabyEyeCheckService;
  6 +import com.lyms.platform.pojo.BabyEyeCheck;
6 7 import com.lyms.platform.pojo.BabyEyePatient;
7 8 import org.springframework.beans.factory.annotation.Autowired;
8 9 import org.springframework.stereotype.Controller;
... ... @@ -28,8 +29,8 @@
28 29  
29 30 @ResponseBody
30 31 @RequestMapping(method = RequestMethod.POST)
31   - public BaseResponse addOrUpdate(@RequestBody BabyEyePatient babyEyePatient, HttpServletRequest request) {
32   - return babyEyeCheckService.addOrUpdate(getUserId(request), babyEyePatient);
  32 + public BaseResponse addOrUpdate(@RequestBody BabyEyeCheck babyEyeCheck, HttpServletRequest request) {
  33 + return babyEyeCheckService.addOrUpdate(getUserId(request), babyEyeCheck);
33 34 }
34 35  
35 36 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEyePatientController.java View file @ 345ff26
... ... @@ -33,6 +33,13 @@
33 33 return babyEyePatientService.addOrUpdate(getUserId(request), babyEyePatient);
34 34 }
35 35  
  36 + @ResponseBody
  37 + @RequestMapping(value = "/baby/{id}")
  38 + @TokenRequired
  39 + public BaseResponse list(@PathVariable String babyId, HttpServletRequest request) {
  40 + return babyEyePatientService.list(getUserId(request), babyId);
  41 + }
  42 +
36 43 /**
37 44 * 保存之后查看的数据
38 45 * @param id
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEyeCheckService.java View file @ 345ff26
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import com.lyms.platform.common.result.BaseObjectResponse;
4 4 import com.lyms.platform.common.result.BaseResponse;
  5 +import com.lyms.platform.pojo.BabyEyeCheck;
5 6 import com.lyms.platform.pojo.BabyEyePatient;
6 7  
7 8 import java.util.Date;
... ... @@ -12,7 +13,7 @@
12 13 public interface BabyEyeCheckService {
13 14 BaseObjectResponse init();
14 15  
15   - BaseResponse addOrUpdate(Integer userId, BabyEyePatient babyEyePatient);
  16 + BaseResponse addOrUpdate(Integer userId, BabyEyeCheck babyEyeCheck);
16 17  
17 18 BaseResponse info(String id);
18 19  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEyePatientService.java View file @ 345ff26
... ... @@ -17,5 +17,7 @@
17 17 BaseResponse edit(String id);
18 18  
19 19 BaseResponse delete(String id);
  20 +
  21 + BaseResponse list(Integer userId, String babyId);
20 22 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyeCheckServiceImpl.java View file @ 345ff26
1 1 package com.lyms.platform.operate.web.service.impl;
2 2  
3 3 import com.lyms.platform.biz.service.BasicConfigService;
  4 +import com.lyms.platform.common.enums.*;
4 5 import com.lyms.platform.common.result.BaseObjectResponse;
5 6 import com.lyms.platform.common.result.BaseResponse;
  7 +import com.lyms.platform.common.result.RespBuilder;
  8 +import com.lyms.platform.common.utils.*;
  9 +import com.lyms.platform.operate.web.facade.AutoMatchFacade;
  10 +import com.lyms.platform.operate.web.facade.BasicConfigFacade;
  11 +import com.lyms.platform.operate.web.result.BasicConfigResult;
6 12 import com.lyms.platform.operate.web.service.BabyEyeCheckService;
7 13 import com.lyms.platform.permission.dao.master.BabyEyeCheckMapper;
  14 +import com.lyms.platform.pojo.BabyEyeCheck;
8 15 import com.lyms.platform.pojo.BabyEyePatient;
  16 +import com.lyms.platform.pojo.BabyModel;
  17 +import com.lyms.platform.pojo.NewbornVisit;
9 18 import org.springframework.beans.factory.annotation.Autowired;
  19 +import org.springframework.data.mongodb.core.MongoTemplate;
  20 +import org.springframework.data.mongodb.core.query.Criteria;
  21 +import org.springframework.data.mongodb.core.query.Query;
  22 +import org.springframework.data.mongodb.core.query.Update;
10 23 import org.springframework.stereotype.Service;
11 24  
  25 +import java.util.ArrayList;
12 26 import java.util.Date;
  27 +import java.util.List;
  28 +import java.util.Map;
13 29  
14 30 /**
15 31 * Created by lt on 2017/8/5 0005
16 32  
17 33  
... ... @@ -22,14 +38,42 @@
22 38 @Autowired
23 39 private BasicConfigService basicConfigService;
24 40  
  41 + @Autowired
  42 + private BasicConfigFacade basicConfigFacade;
  43 +
  44 + @Autowired
  45 + private AutoMatchFacade autoMatchFacade;
  46 +
  47 + @Autowired
  48 + private MongoTemplate mongoTemplate;
  49 +
25 50 @Override
26 51 public BaseObjectResponse init() {
27   - return null;
  52 + List<Map<String, Object>> addSubtract = EnumUtil.toJson(AddSubtractEnums.class); /** (+) (一) 其他 */
  53 + List<Map<String, Object>> checkMonth = EnumUtil.toJson(CheckMonthEnums.class); /** (检查时间 */
  54 + List<BasicConfigResult> highRisk = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.HIGH_RISK_ID); /** 高危因素 */
  55 +
  56 + return RespBuilder.buildSuccess("addSubtract", addSubtract, "checkMonth", checkMonth, "highRisk", highRisk);
28 57 }
29 58  
30 59 @Override
31   - public BaseResponse addOrUpdate(Integer userId, BabyEyePatient babyEyePatient) {
32   - return null;
  60 + public BaseResponse addOrUpdate(Integer userId, BabyEyeCheck babyEyeCheck) {
  61 + if(StringUtils.isEmpty(babyEyeCheck.getId())) {
  62 + babyEyeCheck.setCreated(new Date());
  63 + babyEyeCheck.setYn("1");
  64 + babyEyeCheck.setOperaterId(userId + "");
  65 + babyEyeCheck.setHospitalId(autoMatchFacade.getHospitalId(userId));
  66 + BabyModel babyModel = mongoTemplate.findById(babyEyeCheck.getBabyId(), BabyModel.class);
  67 + if(babyModel != null) {
  68 + babyEyeCheck.setPid(babyModel.getPid());
  69 + }
  70 + mongoTemplate.save(babyEyeCheck);
  71 + } else {
  72 + babyEyeCheck.setOperaterId(userId.toString());
  73 + Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(babyEyeCheck));
  74 + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(babyEyeCheck.getId())), update, NewbornVisit.class);
  75 + }
  76 + return RespBuilder.buildSuccess(babyEyeCheck.getId());
33 77 }
34 78  
35 79 @Override
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyePatientServiceImpl.java View file @ 345ff26
... ... @@ -11,6 +11,7 @@
11 11 import com.lyms.platform.common.utils.*;
12 12 import com.lyms.platform.operate.web.facade.AutoMatchFacade;
13 13 import com.lyms.platform.operate.web.facade.BasicConfigFacade;
  14 +import com.lyms.platform.operate.web.facade.OrganizationGroupsFacade;
14 15 import com.lyms.platform.operate.web.result.BasicConfigResult;
15 16 import com.lyms.platform.operate.web.service.BabyEyePatientService;
16 17 import com.lyms.platform.operate.web.utils.CollectionUtils;
17 18  
... ... @@ -27,16 +28,14 @@
27 28 import org.apache.commons.collections.map.HashedMap;
28 29 import org.apache.struts.config.BaseConfig;
29 30 import org.springframework.beans.factory.annotation.Autowired;
  31 +import org.springframework.data.domain.Sort;
30 32 import org.springframework.data.mongodb.core.MongoTemplate;
31 33 import org.springframework.data.mongodb.core.query.Criteria;
32 34 import org.springframework.data.mongodb.core.query.Query;
33 35 import org.springframework.data.mongodb.core.query.Update;
34 36 import org.springframework.stereotype.Service;
35 37  
36   -import java.util.ArrayList;
37   -import java.util.Date;
38   -import java.util.List;
39   -import java.util.Map;
  38 +import java.util.*;
40 39  
41 40 /**
42 41 * Created by lt on 2017/8/5 0005
... ... @@ -67,6 +66,9 @@
67 66 @Autowired
68 67 private CouponMapper couponMapper;
69 68  
  69 + @Autowired
  70 + private OrganizationGroupsFacade organizationGroupsFacade;
  71 +
70 72 @Override
71 73 public BaseObjectResponse init() {
72 74 List<Map<String, Object>> sex = EnumUtil.toJson(SexEnum.class, "id", "text");
... ... @@ -176,6 +178,31 @@
176 178 @Override
177 179 public BaseResponse delete(String id) {
178 180 return null;
  181 + }
  182 +
  183 + @Override
  184 + public BaseResponse list(Integer userId, String babyId) {
  185 + List<String> hospitalIds = organizationGroupsFacade.findGroupHospital(userId, false);
  186 + if(CollectionUtils.isEmpty(hospitalIds)) {
  187 + return RespBuilder.buildSuccess();
  188 + }
  189 + List<BabyEyePatient> babyEyePatients = mongoTemplate.find(Query.query(Criteria.where("babyId").is(babyId).and("hospitalId").in(hospitalIds).and("yn").ne("0"))
  190 + .with(new Sort(Sort.Direction.DESC, "birth")), BabyEyePatient.class);
  191 + List<Map<String, Object>> rest = new ArrayList<>();
  192 + for (BabyEyePatient babyEyePatient : babyEyePatients) {
  193 + Map<String, Object> temp = new HashMap<>();
  194 + temp.put("id", babyEyePatient.getId());
  195 + temp.put("hospitalId", babyEyePatient.getHospitalId());
  196 + temp.put("pid", babyEyePatient.getPid());
  197 + temp.put("name", babyEyePatient.getName());
  198 + String sex = babyEyePatient.getSex();
  199 + if(StringUtils.isNotEmpty(sex)) {
  200 + temp.put("sex", SexEnum.getTextById(Integer.parseInt(sex)));
  201 + }
  202 + temp.put("age", DateUtil.getBabyMonthAge(babyEyePatient.getBirth(), babyEyePatient.getBookBuildingDate()));
  203 + rest.add(temp);
  204 + }
  205 + return RespBuilder.buildSuccess(rest);
179 206 }
180 207 }