From b80bf8d8160528c330f4561a2fec15dd0b3e5e54 Mon Sep 17 00:00:00 2001 From: "litao@lymsh.com" Date: Tue, 25 Jul 2017 11:54:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=94=9F=E5=84=BF=E8=AE=BF=E8=A7=86?= =?UTF-8?q?=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lyms/platform/common/enums/BregmaticEnums.java | 16 ++++++++++++++++ .../platform/common/enums/ComplexionEnums.java | 16 ++++++++++++++++ .../lyms/platform/common/enums/FeedTypeEnums.java | 17 +++++++++++++++++ .../com/lyms/platform/common/enums/SkinEnums.java | 22 +++++++++++++++++++--- .../platform/common/enums/UmbilicalCordEnums.java | 16 ++++++++++++++++ .../com/lyms/platform/common/enums/VomitEnums.java | 17 +++++++++++++++++ .../web/service/impl/NewbornServiceImpl.java | 2 +- 7 files changed, 102 insertions(+), 4 deletions(-) diff --git a/platform-common/src/main/java/com/lyms/platform/common/enums/BregmaticEnums.java b/platform-common/src/main/java/com/lyms/platform/common/enums/BregmaticEnums.java index 327a198..25ad606 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/enums/BregmaticEnums.java +++ b/platform-common/src/main/java/com/lyms/platform/common/enums/BregmaticEnums.java @@ -1,5 +1,7 @@ package com.lyms.platform.common.enums; +import com.lyms.platform.common.utils.StringUtils; + /** * 前囟 闭合/未闭合 * Created by lt on 2017/7/18 0018 @@ -11,6 +13,20 @@ public enum BregmaticEnums { private Integer id; private String name; + public static String getName(String id) { + if(StringUtils.isEmpty(id)) { + return null; + } + int i = Integer.parseInt(id); + BregmaticEnums[] values = BregmaticEnums.values(); + for (BregmaticEnums value : values) { + if (value.getId() == i) { + return value.getName(); + } + } + return null; + } + public static BregmaticEnums get(Integer id) { BregmaticEnums[] values = BregmaticEnums.values(); for (BregmaticEnums value : values) { diff --git a/platform-common/src/main/java/com/lyms/platform/common/enums/ComplexionEnums.java b/platform-common/src/main/java/com/lyms/platform/common/enums/ComplexionEnums.java index 12635b8..bd87653 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/enums/ComplexionEnums.java +++ b/platform-common/src/main/java/com/lyms/platform/common/enums/ComplexionEnums.java @@ -1,5 +1,7 @@ package com.lyms.platform.common.enums; +import com.lyms.platform.common.utils.StringUtils; + /** * 面色 红润/黄染/其他 * Created by lt on 2017/7/18 0018 @@ -42,4 +44,18 @@ public enum ComplexionEnums { public void setName(String name) { this.name = name; } + + public static String getName(String id) { + if(StringUtils.isEmpty(id)) { + return null; + } + int i = Integer.parseInt(id); + ComplexionEnums[] values = ComplexionEnums.values(); + for (ComplexionEnums value : values) { + if (value.getId() == i) { + return value.getName(); + } + } + return null; + } } diff --git a/platform-common/src/main/java/com/lyms/platform/common/enums/FeedTypeEnums.java b/platform-common/src/main/java/com/lyms/platform/common/enums/FeedTypeEnums.java index efca074..d2a093a 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/enums/FeedTypeEnums.java +++ b/platform-common/src/main/java/com/lyms/platform/common/enums/FeedTypeEnums.java @@ -1,5 +1,7 @@ package com.lyms.platform.common.enums; +import com.lyms.platform.common.utils.StringUtils; + /** * 喂养方式 纯母乳/混合/人工 * Created by lt on 2017/7/18 0018 @@ -22,6 +24,20 @@ public enum FeedTypeEnums { return null; } + public static String getName(String id) { + if(StringUtils.isEmpty(id)) { + return null; + } + int i = Integer.parseInt(id); + FeedTypeEnums[] values = FeedTypeEnums.values(); + for (FeedTypeEnums value : values) { + if (value.id == i) { + return value.name; + } + } + return null; + } + FeedTypeEnums(Integer id, String name){ this.id = id; this.name = name; @@ -42,4 +58,5 @@ public enum FeedTypeEnums { public void setName(String name) { this.name = name; } + } diff --git a/platform-common/src/main/java/com/lyms/platform/common/enums/SkinEnums.java b/platform-common/src/main/java/com/lyms/platform/common/enums/SkinEnums.java index 915502f..9218c37 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/enums/SkinEnums.java +++ b/platform-common/src/main/java/com/lyms/platform/common/enums/SkinEnums.java @@ -1,5 +1,7 @@ package com.lyms.platform.common.enums; +import com.lyms.platform.common.utils.StringUtils; + /** * 皮肤枚举 未见异常/湿疹/糜烂/其他 * Created by lt on 2017/7/18 0018 @@ -13,9 +15,23 @@ public enum SkinEnums { private Integer id; private String name; - public static FeedTypeEnums get(Integer id) { - FeedTypeEnums[] values = FeedTypeEnums.values(); - for (FeedTypeEnums value : values) { + public static String getName(String id) { + if(StringUtils.isEmpty(id)) { + return null; + } + int i = Integer.parseInt(id); + SkinEnums[] values = SkinEnums.values(); + for (SkinEnums value : values) { + if (value.getId() == i) { + return value.getName(); + } + } + return null; + } + + public static SkinEnums get(Integer id) { + SkinEnums[] values = SkinEnums.values(); + for (SkinEnums value : values) { if (value.getId() == id) { return value; } diff --git a/platform-common/src/main/java/com/lyms/platform/common/enums/UmbilicalCordEnums.java b/platform-common/src/main/java/com/lyms/platform/common/enums/UmbilicalCordEnums.java index a76f532..7bc9d3f 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/enums/UmbilicalCordEnums.java +++ b/platform-common/src/main/java/com/lyms/platform/common/enums/UmbilicalCordEnums.java @@ -1,5 +1,7 @@ package com.lyms.platform.common.enums; +import com.lyms.platform.common.utils.StringUtils; + /** * 脐带 未脱/脱落/脐部有渗出/其他 * Created by lt on 2017/7/18 0018 @@ -13,6 +15,20 @@ public enum UmbilicalCordEnums { private Integer id; private String name; + public static String getName(String id) { + if(StringUtils.isEmpty(id)) { + return null; + } + int i = Integer.parseInt(id); + UmbilicalCordEnums[] values = UmbilicalCordEnums.values(); + for (UmbilicalCordEnums value : values) { + if (value.getId() == i) { + return value.getName(); + } + } + return null; + } + public static UmbilicalCordEnums get(Integer id) { UmbilicalCordEnums[] values = UmbilicalCordEnums.values(); for (UmbilicalCordEnums value : values) { diff --git a/platform-common/src/main/java/com/lyms/platform/common/enums/VomitEnums.java b/platform-common/src/main/java/com/lyms/platform/common/enums/VomitEnums.java index cae648d..7ec8bed 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/enums/VomitEnums.java +++ b/platform-common/src/main/java/com/lyms/platform/common/enums/VomitEnums.java @@ -1,5 +1,7 @@ package com.lyms.platform.common.enums; +import com.lyms.platform.common.utils.StringUtils; + /** * 是否呕吐 * Created by lt on 2017/7/18 0018 @@ -26,6 +28,20 @@ public enum VomitEnums { this.name = name; } + public static String getName(String id) { + if(StringUtils.isEmpty(id)) { + return null; + } + int i = Integer.parseInt(id); + VomitEnums[] values = VomitEnums.values(); + for (VomitEnums value : values) { + if (value.getId() == i) { + return value.getName(); + } + } + return null; + } + public Integer getId() { return id; } @@ -41,4 +57,5 @@ public enum VomitEnums { public void setName(String name) { this.name = name; } + } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/NewbornServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/NewbornServiceImpl.java index 7a5b361..25aa8d2 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/NewbornServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/NewbornServiceImpl.java @@ -75,7 +75,7 @@ public class NewbornServiceImpl extends BaseServiceImpl implements INewbornVisit public BaseObjectResponse addOrUpdate(Integer userId, NewbornVisit newbornVisit) { newbornVisit.setFeedType(newbornVisit.getFeedType() == null ? null : FeedTypeEnums.get(Integer.parseInt(newbornVisit.getFeedType())).getName()); newbornVisit.setSkin(newbornVisit.getSkin() == null ? null : SkinEnums.get(Integer.parseInt(newbornVisit.getSkin())).getName()); - newbornVisit.setComplexion(newbornVisit.getComplexion() == null ? null : BregmaticEnums.get(Integer.parseInt(newbornVisit.getComplexion())).getName()); + newbornVisit.setComplexion(newbornVisit.getComplexion() == null ? null : ComplexionEnums.get(Integer.parseInt(newbornVisit.getComplexion())).getName()); newbornVisit.setUmbilicalCord(newbornVisit.getUmbilicalCord() == null ? null : UmbilicalCordEnums.get(Integer.parseInt(newbornVisit.getUmbilicalCord())).getName()); newbornVisit.setHospitalId(autoMatchFacade.getHospitalId(userId)); // newbornVisit.setNextVisitTime(newbornVisit.getUmbilicalCord() == null ? null : UmbilicalCordEnums.get(Integer.parseInt(newbornVisit.getUmbilicalCord())).getName()); -- 1.8.3.1