/** * retrieve the physical examination result * * @see phys_result * @param model * @return */ @RequestMapping(value = "/vi_checkResult") public String retrievePhysResult(Model modelmap, HttpSession httpSession) { String account = (String) httpSession.getAttribute("accountName"); Integer flag = (Integer) httpSession.getAttribute("flag"); AccountClient accountClient = accountClientDao.findClientByAccount(account); if (accountClient != null && flag != null && flag == Constant.account_client) { List<IndentVip> indentVipList = (List) indentVipDao.findByAccount(account); // For testing .......................... if (indentVipList != null) { List<Indent> indentList = new LinkedList(); List<Project> projectList = new LinkedList(); for (int i = 0; i < indentVipList.size(); i++) { Integer uidProject = indentVipList.get(i).getUidProject(); Project project = projectDao.getSingleProjectById(uidProject); Indent indent = (Indent) indentDao.findById(indentVipList.get(i).getUidIndent()); if (project != null) projectList.add(project); if (indent != null) indentList.add(indent); } // = (List)projectDao.queryAllByAccount("201231000821");//For testing // ................................ // List<TestResult> testResultList = testResultDao.queryByAccount("201231000821");//For // testing ................................ List<Map<String, String>> resultList = new LinkedList<Map<String, String>>(); for (int k = 0; k < indentVipList.size(); k++) { Map<String, String> result = new HashMap<String, String>(); result.put("phsy_sum", String.valueOf(indentVipList.size())); String YMD = projectList.get(k).getTimeBegin(); String year = "2015年"; String month = "09月"; String date = "06日"; if (YMD != null) { if (YMD.length() >= 4) year = YMD.substring(0, 4) + "年"; if (YMD.length() >= 6) month = YMD.substring(4, 6) + "月"; if (YMD.length() >= 8) date = YMD.substring(6, 8) + "日"; } result.put("phsy_time", year + month + date); String status; String updateDate; Indent indent = indentList.get(k); if (indent != null) { Boolean isPaid = indent.getIsPaid(); Boolean finishIndent = indent.getFinishIndent(); Boolean hasResult = indent.getHasResult(); String isPaidDate = indent.getIsPaidDate(); String finish_date = indent.getFinishDate(); String hasResultDate = indent.getHasResultDate(); updateDate = hasResultDate != null ? hasResultDate : finish_date != null ? finish_date : isPaidDate != null ? isPaidDate : "Unknown"; if (hasResult != null && finishIndent != null && isPaid != null) status = hasResult ? "已有结果" : finishIndent ? "已预约" : isPaid ? "已付款" : "没付款"; else status = "Unknown"; } else { updateDate = "没有更新日期"; status = "没有状态"; } result.put("phsy_status", status); result.put("phsy_update_date", updateDate); String YMD2 = updateDate; String year2 = "2015年"; String month2 = "09月"; String date2 = "06日"; if (YMD2 != null && !YMD2.equalsIgnoreCase("Unknown")) { if (YMD2.length() >= 4) year2 = YMD2.substring(0, 4) + "年"; if (YMD2.length() >= 6) month2 = YMD2.substring(4, 6) + "月"; if (YMD2.length() >= 8) date2 = YMD2.substring(6, 8) + "日"; } result.put("phsy_update_date", year2 + month2 + date2); result.put("phsy_clerk", "宫鸣"); result.put("phys_project_uid", String.valueOf(projectList.get(k).getUidProject())); result.put("phys_status_boolean", String.valueOf(status == "已有结果" ? true : false)); resultList.add(result); } modelmap.addAttribute("phys_result", resultList); } else { List<Map<String, String>> resultList = new LinkedList<Map<String, String>>(); modelmap.addAttribute("phys_result", resultList); } } else { modelmap.addAttribute("phys_result", null); } return "/vip/vi_checkResult"; }