/** * retrieve the physical examination result derail * * @see phys_report phys_recommendation phys_doctor_id phys_doctor_name phys_date phys_client_name * @param model * @return */ @RequestMapping(value = "/phys_result_detail") public String retrievePhysResultDetail( Model modelmap, HttpSession httpSession, @RequestParam String project_uid) { // generate phys report f 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<TestResult> testResultList = testResultDao.queryByAccountAndProjectUid( account, project_uid); // For testing ................................ if (testResultList != null) { List<Map<String, String>> reportList = new ArrayList<Map<String, String>>(); for (int i = 0; i < testResultList.size(); i++) { Map<String, String> result = new HashMap<String, String>(); result.put("phsy_report_id", project_uid); result.put( "phsy_report_project", getPhysicalItemName(testResultList.get(i).getIdPhysicalItem())); result.put("phsy_report_result", testResultList.get(i).getResult()); result.put("phsy_report_backup", "无"); reportList.add(result); } // generate phys doctor's recommendation String recommendation = "多喝水,早睡眠"; // generate phys doctor's name String doctorName = "钟丽萍"; // generate phys doctor's id String doctorId = "YG040001"; // generate date // String date = "2014年11月17日"; // generate phys client name String clientName = accountClient.getAccountClient(); modelmap.addAttribute("phys_client_name", clientName); modelmap.addAttribute("phys_doctor_id", doctorId); modelmap.addAttribute("phys_doctor_name", doctorName); modelmap.addAttribute("phys_date", doctorName); modelmap.addAttribute("phys_report", reportList); modelmap.addAttribute("phys_recommendation", recommendation); } } else { modelmap.addAttribute("phys_report", null); } return "/vip/vi_resultDetail"; }
/** * apply for appointments * * @param model * @return */ @RequestMapping(value = "/vi_submitAppointment", method = RequestMethod.POST) public String submitAppointment( Model modelmap, HttpSession httpSession, String year, String month, String day, Integer total, String chooseNum, String chooseId) { String account = (String) httpSession.getAttribute("accountName"); Integer flag = (Integer) httpSession.getAttribute("flag"); AccountClient accountClient = accountClientDao.findClientByAccount( account); // For testing ................................... if (accountClient != null && flag != null && flag == Constant.account_client) { boolean insertResult = false; String[] chooseIdArray = chooseId.split(","); // split List<PhysicalItem> physicalList = (List<PhysicalItem>) physicalDao.retrieveAll(); // List<String> chooseIdItems = new ArrayList<String>(); // resolve chooseId from chooseIdArray to chooseIdItems for (int i = 0; i < chooseIdArray.length; i++) { if (chooseIdArray[i].equalsIgnoreCase("true")) { chooseIdItems.add(String.valueOf(i)); } } if (chooseIdItems.size() > 0) { // generate indent List indentList = (List) indentDao.queryAll(); int indentSum = indentList == null ? 0 : indentList.size(); Indent indent = new Indent(); indent.setUidIndent(indentSum + 1); // inital the uid of the indent indent.setMoneyIndent(total); indentDao.save(indent); // Are you sure it is ok? // generate project List projectList = (List) projectDao.queryAll(); int projectSum = projectList == null ? 0 : projectList.size(); Project project = new Project(); project.setUidProject(projectSum + 1); project.setAccount( account); // For testing ............................................................... project.setClientName( accountClient .getAccountClient()); // For testing // ............................................................... project.setPeopleNumber(1); project.setTimeBegin(year + month + day); project.setTimeEnd("UnRecord"); project.setAddressGroup("个人"); projectDao.save(project); IndentVip indentVip = new IndentVip(); List indentVipList = (List) indentVipDao.queryAll(); int indentVipSum = indentVipList.size(); indentVip.setUidIndentVip(indentVipSum + 1); // int indentVip.setUidIndent(indent.getUidIndent()); // int indentVip.setUidProject(project.getUidProject()); // int indentVip.setAccountClientIndent(account); indentVip.setIndentVipName(accountClient.getAccountClient()); indentVip.setIndentVipSex(accountClient.getSexClient()); indentVip.setIndentVipEmail(accountClient.getEmailClient()); indentVip.setIndentVipAddress(accountClient.getAddressClient()); indentVip.setIndentVipPhone(accountClient.getPhoneClient()); indentVipDao.save(indentVip); for (int j = 0; j < chooseIdItems.size(); j++) { // generate projectdetail List ProjectDetailList = (List) projectDetailDao.queryAll(); int projectDetailSum = ProjectDetailList == null ? 0 : ProjectDetailList.size(); ProjectDetail projectDetail = new ProjectDetail(); projectDetail.setUidProjectDetail(projectDetailSum + 1); projectDetail.setProject(project); projectDetail.setTestType(physicalList.get(j).getTypeItem()); projectDetailDao.save(projectDetail); // Are you sure it is ok? // generate orderdetail List orderDetailList = (List) orderDetailDao.queryAll(); int orderdetailSum = orderDetailList == null ? 0 : orderDetailList.size(); OrderDetail orderDetail = new OrderDetail(); orderDetail.setUidOrderDetail(orderdetailSum + 1); orderDetail.setIndent(indent); orderDetail.setProjectDetail(projectDetail); orderDetail.setMoneyOrder(total); orderDetail.setOrderClientName( accountClient .getAccountClient()); // For testing // ......................................................... orderDetail.setOrderTime(TimeUtils.getNowDate()); orderDetailDao.save(orderDetail); // Are you sure it is ok? List testResultSumList = ((List) testResultDao.queryAll()); int testResultSum = testResultSumList == null ? 0 : testResultSumList.size(); TestResult testResult = new TestResult(); testResult.setUidTestDetail(testResultSum + 1); testResult.setOrderDetail(orderDetail); testResult.setIdPhysicalItem(chooseIdItems.get(j)); testResult.setResult("haven't yet"); testResult.setIndentGroupMember(""); testResult.setUidProject(String.valueOf(project.getUidProject())); testResult.setAccount( account); // For testing ......................................................... testResultDao.save(testResult); } insertResult = true; } else { insertResult = false; } if (insertResult) { Map<String, Object> map = new HashMap<String, Object>(); map.put("id", accountClient.getAccountClient()); map.put("gender", accountClient.getSexClient()); map.put("identity", accountClient.getIdentityCardNumber()); map.put("mobilephone", accountClient.getPhoneClient()); map.put("officephone", "无"); map.put("email", accountClient.getEmailClient()); map.put("address", accountClient.getAddressClient()); map.put("sicknesshistory", accountClient.getSicknessHistory()); map.put("salesman", "Unknown"); map.put("name", accountClient.getAccountClient()); modelmap.addAttribute("user", map); modelmap.addAttribute("submitAppointmentsuccess", "true"); } } else { Map<String, Object> map = new HashMap<String, Object>(); map.put("id", accountClient.getAccountClient()); map.put("gender", accountClient.getSexClient()); map.put("identity", accountClient.getIdentityCardNumber()); map.put("mobilephone", accountClient.getPhoneClient()); map.put("officephone", "无"); map.put("email", accountClient.getEmailClient()); map.put("address", accountClient.getAddressClient()); map.put("sicknesshistory", accountClient.getSicknessHistory()); map.put("salesman", "Unknown"); map.put("name", accountClient.getAccountClient()); modelmap.addAttribute("user", map); modelmap.addAttribute("submitAppointmentsuccess", null); } return "vip/vi_index"; }