From 57225d648b6f72631f962147c03c1b80b07697b4 Mon Sep 17 00:00:00 2001 From: jiangjiazhi Date: Thu, 11 Aug 2016 11:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BE=E7=BD=AEparentid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/facade/AntenatalExaminationFacade.java | 111 +++++++++++---------- 1 file changed, 61 insertions(+), 50 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java index b4380f3..37d2c91 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java @@ -228,59 +228,22 @@ public class AntenatalExaminationFacade { */ public HighScoreResult findLastRisk(String parentId,boolean needLevel) { List list = antenatalExaminationService.findAllByParentId(parentId); - AntenatalExaminationModel model = null; - if (CollectionUtils.isNotEmpty(list)) { - model = list.get(0); - } HighScoreResult highScoreResult = new HighScoreResult(); - try { - boolean next=true; - //复诊 - if (null != model && StringUtils.isNotEmpty(model.getRiskFactor()) && !"{}".equals(model.getRiskFactor())) { - List list1 = JsonUtil.toList(model.getRiskFactor(), List.class); - highScoreResult = queryRisk(list1, needLevel); - next=false; - } - if (null != model && !"{}".equals(model.getOtherRisk())) { - Map map = JsonUtil.str2Obj(model.getOtherRisk(), Map.class); - - //风险因素 - Map map1 = new HashMap(); - map1.put("id", ""); - map1.put("name", map.get("fxysu")); - highScoreResult.getHighRisk().add(map1); - //风险评分 - Object idObj = map.get("fxpf"); - if (null != idObj) { - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj.toString()); - highScoreResult.setScore(highScoreResult.getScore() + NumberUtils.toInt(basicConfig.getName(), 0)); - } - if(needLevel){ - Object idObj1 = map.get("fyyse"); - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj1.toString()); - Map map2 = new HashMap<>(); - map2.put("id", basicConfig.getId()); - map2.put("name", basicConfig.getName()); - highScoreResult.getLevel().add(map2); - } - next=false; - } - if(next){ - //初诊 - AntExChuQuery antExChuQuery = new AntExChuQuery(); - antExChuQuery.setParentId(parentId); - antExChuQuery.setYn(YnEnums.YES.getId()); - List list1 = antenatalExaminationService.queryAntExChu(antExChuQuery); - AntExChuModel antExChuModel = null; - if (CollectionUtils.isNotEmpty(list1)) { - antExChuModel = list1.get(0); + boolean next=true; + if (CollectionUtils.isNotEmpty(list)) { + for(AntenatalExaminationModel model:list){ + if(!next){ + break; } - if (null != antExChuModel && StringUtils.isNotEmpty(antExChuModel.getHighrisk()) && !"{}".equals(antExChuModel.getHighrisk())) { - List list2 = JsonUtil.toList(antExChuModel.getHighrisk(), List.class); - highScoreResult = queryRisk(list2,true); + //复诊 + if (null != model && StringUtils.isNotEmpty(model.getRiskFactor()) && !"{}".equals(model.getRiskFactor())) { + List list1 = JsonUtil.toList(model.getRiskFactor(), List.class); + highScoreResult = queryRisk(list1, needLevel); + next=false; } - if (null != antExChuModel && !"{}".equals(antExChuModel.getOtherHighRisk())) { - Map map = JsonUtil.str2Obj(antExChuModel.getOtherHighRisk(), Map.class); + if (null != model && !"{}".equals(model.getOtherRisk())) { + Map map = JsonUtil.str2Obj(model.getOtherRisk(), Map.class); + //风险因素 Map map1 = new HashMap(); map1.put("id", ""); @@ -300,7 +263,55 @@ public class AntenatalExaminationFacade { map2.put("name", basicConfig.getName()); highScoreResult.getLevel().add(map2); } + next=false; + } + } + } + + try { + + if(next){ + //初诊 + AntExChuQuery antExChuQuery = new AntExChuQuery(); + antExChuQuery.setParentId(parentId); + antExChuQuery.setYn(YnEnums.YES.getId()); + List list1 = antenatalExaminationService.queryAntExChu(antExChuQuery); + if (CollectionUtils.isNotEmpty(list1)) { + for(AntExChuModel antExChuModel:list1){ + if(!next){ + break; + } + if (null != antExChuModel && StringUtils.isNotEmpty(antExChuModel.getHighrisk()) && !"{}".equals(antExChuModel.getHighrisk())) { + List list2 = JsonUtil.toList(antExChuModel.getHighrisk(), List.class); + highScoreResult = queryRisk(list2,true); + next=false; + } + if (null != antExChuModel && !"{}".equals(antExChuModel.getOtherHighRisk())) { + Map map = JsonUtil.str2Obj(antExChuModel.getOtherHighRisk(), Map.class); + //风险因素 + Map map1 = new HashMap(); + map1.put("id", ""); + map1.put("name", map.get("fxysu")); + highScoreResult.getHighRisk().add(map1); + //风险评分 + Object idObj = map.get("fxpf"); + if (null != idObj) { + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj.toString()); + highScoreResult.setScore(highScoreResult.getScore() + NumberUtils.toInt(basicConfig.getName(), 0)); + } + if(needLevel){ + Object idObj1 = map.get("fyyse"); + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj1.toString()); + Map map2 = new HashMap<>(); + map2.put("id", basicConfig.getId()); + map2.put("name", basicConfig.getName()); + highScoreResult.getLevel().add(map2); + } + next=false; + } + } } + } } catch (Exception e) { -- 1.8.3.1