public ActionForward getDemographic(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException { String demographicNo = request.getParameter("demographicNo"); if(!securityInfoManager.hasPrivilege(LoggedInInfo.getLoggedInInfoFromSession(request), "_demographic", "r", null)) { throw new SecurityException("missing required security object (_demographic)"); } Demographic demographic = demographicDao.getDemographic(demographicNo); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(demographic,config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward getTickler(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { TicklerDAO ticklerDao = (TicklerDAO) SpringUtils.getBean("ticklerDAOT"); Tickler t = ticklerDao.getTickler(Long.parseLong(request.getParameter("tickler_no"))); HashMap<String, HashMap<String, Object>> hashMap = new HashMap<String, HashMap<String, Object>>(); HashMap<String, Object> ticklerMap = new HashMap<String, Object>(); ticklerMap.put("message", t.getMessage()); ticklerMap.put("updateDate", t.getUpdate_date()); ticklerMap.put("provider", t.getProvider().getFormattedName()); ticklerMap.put("providerNo", t.getProvider().getProviderNo()); ticklerMap.put("toProvider", t.getAssignee().getFormattedName()); ticklerMap.put("toProviderNo", t.getAssignee().getProviderNo()); hashMap.put("tickler", ticklerMap); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
/** * 直接输出JSON.含有java.sql.date数据类型 * @param response * @param object * @param headers */ public static void renderJsonForSqlDate(final HttpServletResponse response,final Object object, final String... headers) { JsDateJsonBeanProcessor beanProcessor = new JsDateJsonBeanProcessor(); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, beanProcessor); JSONObject json = JSONObject.fromObject(object, config); // Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create(); render(response,JSON, json.toString(), headers); }
public ActionForward visibleProgramsAndRoles(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { LoggedInInfo loggedInInfo=LoggedInInfo.getLoggedInInfoFromSession(request); String providerNo=loggedInInfo.getLoggedInProviderNo(); String demoNo = request.getParameter("demoNo"); HashMap<Program, List<Secrole>> visibleMap = getAllProviderAccessibleRolesForDemo(providerNo, demoNo); HashMap<String, Object> hashMap = new HashMap<String, Object>(); List<HashMap<String, Object>> mapList = new ArrayList<HashMap<String, Object>>(); for (Program p : visibleMap.keySet()) { HashMap<String, Object> map = new HashMap<String, Object>(); map.put("programNo", p.getId()); map.put("programName", p.getName()); map.put("roleAccess", visibleMap.get(p)); mapList.add(map); } // for (HashMap<String, String> p : getDischargedPrograms(demoNo)) { // HashMap<String, Object> map = new HashMap<String, Object>(); // map.put("programNo", p.get("programNo")); // map.put("programName", p.get("programName") + " (discharged)"); // // map.put("roleAccess", new ArrayList<String>()); // // mapList.add(map); // } hashMap.put("programs", mapList); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward ticklerGetNote(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException { String ticklerNo = request.getParameter("ticklerNo"); CaseManagementNoteLinkDAO caseManagementNoteLinkDao = (CaseManagementNoteLinkDAO) SpringUtils.getBean("CaseManagementNoteLinkDAO"); CaseManagementNoteLink link = caseManagementNoteLinkDao.getLastLinkByTableId(CaseManagementNoteLink.TICKLER, Long.valueOf(ticklerNo)); if (link != null) { Long noteId = link.getNoteId(); CaseManagementNote note = this.caseManagementNoteDao.getNote(noteId); if (note != null) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); Map<String, Serializable> hashMap = new HashMap<String, Serializable>(); hashMap.put("noteId", note.getId().toString()); hashMap.put("note", note.getNote()); hashMap.put("revision", note.getRevision()); hashMap.put("obsDate", formatter.format(note.getObservation_date())); hashMap.put("editor", this.providerMgr.getProvider(note.getProviderNo()).getFormattedName()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); } } return null; }
@GET @Path("/info") @Produces("application/json") public String oauthInfo() { try { LoggedInInfo loggedInInfo = getLoggedInInfo(); Provider provider = loggedInInfo.getLoggedInProvider(); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); String login = getOAuthContext().getSubject().getLogin(); List<String> roles = getOAuthContext().getSubject().getRoles(); JSONObject obj = new JSONObject(); obj.put("provider", JSONObject.fromObject(provider,config)); obj.put("login", login); obj.put("roles", roles); return obj.toString(); } catch (Exception e) { return "Sorry, there was an error building your resposne: " + e.toString(); } }
@GET @Path("/providers_json") @Produces("application/json") public AbstractSearchResponse<ProviderTo1> getProvidersAsJSON() { JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); List<ProviderTo1> providers = new ProviderConverter().getAllAsTransferObjects(getLoggedInInfo(), providerDao.getActiveProviders()); AbstractSearchResponse<ProviderTo1> response = new AbstractSearchResponse<ProviderTo1>(); response.setContent(providers); return response; }
@GET @Path("/provider/me") @Produces("application/json") public String getLoggedInProvider() { Provider provider = getLoggedInInfo().getLoggedInProvider(); if(provider != null) { JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); return JSONObject.fromObject(provider,config).toString(); } return null; }
@GET @Path("/providerjson/{id}") public String getProviderAsJSON(@PathParam("id") String id) { JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); return JSONObject.fromObject(providerDao.getProvider(id),config).toString(); }
public ActionForward getProviders(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ProviderDao providerDao = (ProviderDao) SpringUtils.getBean("providerDao"); List<Provider> activeProviders = providerDao.getActiveProviders(); HashMap<String, List<Provider>> hashMap = new HashMap<String, List<Provider>>(); hashMap.put("providers", activeProviders); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward getTickler(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { LoggedInInfo loggedInInfo=LoggedInInfo.getLoggedInInfoFromSession(request); if(!securityInfoManager.hasPrivilege(LoggedInInfo.getLoggedInInfoFromSession(request), "_tickler", "r", null)) { throw new SecurityException("missing required security object (_demographic)"); } Tickler t = ticklerManager.getTickler(loggedInInfo,Integer.parseInt(request.getParameter("tickler_no"))); HashMap<String, HashMap<String, Object>> hashMap = new HashMap<String, HashMap<String, Object>>(); HashMap<String, Object> ticklerMap = new HashMap<String, Object>(); ticklerMap.put("message", t.getMessage()); ticklerMap.put("updateDate", t.getUpdateDate()); ticklerMap.put("provider", t.getProvider().getFormattedName()); ticklerMap.put("providerNo", t.getProvider().getProviderNo()); ticklerMap.put("toProvider", t.getAssignee().getFormattedName()); ticklerMap.put("toProviderNo", t.getAssignee().getProviderNo()); hashMap.put("tickler", ticklerMap); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward getMacroList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { EyeformMacroDao eyeformMacroDao = (EyeformMacroDao) SpringUtils.getBean("eyeformMacroDao"); List<EyeformMacro> macroList = eyeformMacroDao.getMacros(); HashMap<String, Object> hashMap = new HashMap<String, Object>(); hashMap.put("macros", macroList); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
/** * 直接输出JSON.含有java.sql.date数据类型 * * @param response * @param object * @param headers */ public static void renderJsonForSqlDate(final HttpServletResponse response, final Object object, final String... headers) { JsDateJsonBeanProcessor beanProcessor = new JsDateJsonBeanProcessor(); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, beanProcessor); JSONObject json = JSONObject.fromObject(object, config); render(response, JSON, json.toString(), headers); }
public ActionForward visibleProgramsAndRoles(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String providerNo = LoggedInInfo.loggedInInfo.get().loggedInProvider.getProviderNo(); String demoNo = request.getParameter("demoNo"); HashMap<Program, List<Secrole>> visibleMap = getAllProviderAccessibleRolesForDemo(providerNo, demoNo); HashMap<String, Object> hashMap = new HashMap<String, Object>(); List<HashMap<String, Object>> mapList = new ArrayList<HashMap<String, Object>>(); for (Program p : visibleMap.keySet()) { HashMap<String, Object> map = new HashMap<String, Object>(); map.put("programNo", p.getId()); map.put("programName", p.getName()); map.put("roleAccess", visibleMap.get(p)); mapList.add(map); } // for (HashMap<String, String> p : getDischargedPrograms(demoNo)) { // HashMap<String, Object> map = new HashMap<String, Object>(); // map.put("programNo", p.get("programNo")); // map.put("programName", p.get("programName") + " (discharged)"); // // map.put("roleAccess", new ArrayList<String>()); // // mapList.add(map); // } hashMap.put("programs", mapList); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward getNoteScope(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ProgramDao programDao = (ProgramDao) SpringUtils.getBean("programDao"); ProgramProviderDAO programProviderDao = (ProgramProviderDAO) SpringUtils.getBean("programProviderDAO"); CaseManagementNoteDAO noteDao = (CaseManagementNoteDAO) SpringUtils.getBean("caseManagementNoteDAO"); ProgramAccessDAO programAccessDAO = (ProgramAccessDAO) SpringUtils.getBean("programAccessDAO"); SecroleDao secroleDao = (SecroleDao) SpringUtils.getBean("secroleDao"); RoleProgramAccessDAO roleProgramAccessDao = (RoleProgramAccessDAO) SpringUtils.getBean("RoleProgramAccessDAO"); String noteId = request.getParameter("noteId"); String programNo, role = ""; // Get the note if (noteId != null && noteId.equalsIgnoreCase("0") && request.getParameter("programNo") != null) { programNo = request.getParameter("programNo"); } else { CaseManagementNote note = noteDao.getNote(Long.parseLong(noteId)); programNo = note.getProgram_no(); role = note.getReporter_caisi_role(); } Program program = programDao.getProgram(Integer.parseInt(programNo)); List<ProgramAccess> programAccessList = programAccessDAO.getAccessListByProgramId(new Long(programNo)); Map<String, ProgramAccess> programAccessMap = convertProgramAccessListToMap(programAccessList); if (noteId != null && noteId.equalsIgnoreCase("0") && request.getParameter("roleId") != null) role = request.getParameter("roleId"); String roleName = secroleDao.getRole(Integer.parseInt(role)).getName().toLowerCase(); @SuppressWarnings("unchecked") List<ProgramProvider> programProviders = programProviderDao.getProgramProviders(Long.parseLong(programNo)); List<NotePermission> permissionList = new ArrayList<NotePermission>(); for (ProgramProvider provider : programProviders) { if (programAccessMap.containsKey("read " + roleName + " notes")) { ProgramAccess programAccess = programAccessMap.get("read " + roleName + " notes"); if (programAccess.isAllRoles()) { // all roles have access to this permission permissionList.add(new NotePermission(provider, NotePermission.AccessType.ALL_ROLES)); continue; } else { boolean hasRoleAccess = false; for (Secrole programRole : programAccess.getRoles()) { if (programRole.getId().longValue() == provider.getRoleId().longValue()) { // This provider has access based on their role hasRoleAccess = true; } } if (hasRoleAccess) // This role is included in the list of roles granted this permission permissionList.add(new NotePermission(provider, NotePermission.AccessType.ROLE)); else // The provider's role is not included in the list of roles granted this permission permissionList.add(new NotePermission(provider, NotePermission.AccessType.NO_ACCESS)); } } else if (roleProgramAccessDao.hasAccess("read " + roleName + " notes", provider.getRoleId())) { // Provider's role has access based on global role permissions permissionList.add(new NotePermission(provider, NotePermission.AccessType.ROLE_GLOBAL)); } else { // Provider does not have access permissionList.add(new NotePermission(provider, NotePermission.AccessType.NO_ACCESS)); } } HashMap<String, Object> hashMap = new HashMap<String, Object>(); hashMap.put("programName", program.getName()); hashMap.put("programNo", program.getId()); hashMap.put("roleName", roleName); hashMap.put("permissionList", permissionList); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward getBillingAutocompleteList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { BillingServiceDao billingServiceDao = (BillingServiceDao) SpringUtils.getBean("billingServiceDao"); String query = request.getParameter("query"); List<BillingService> queryResults = billingServiceDao.findBillingCodesByCode("%" + query + "%", "ON", new Date(), 1); HashMap<String, Object> hashMap = new HashMap<String, Object>(); hashMap.put("billing", queryResults); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward getBillingDxAutocompleteList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DiagnosticCodeDao diagnosticCodeDao = (DiagnosticCodeDao) SpringUtils.getBean("diagnosticCodeDao"); String query = request.getParameter("query"); List<DiagnosticCode> queryResults = diagnosticCodeDao.findByDiagnosticCodeAndRegion(query, "ON"); HashMap<String, Object> hashMap = new HashMap<String, Object>(); hashMap.put("dxCode", queryResults); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward saveMacro(ActionMapping maping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { EyeformMacroDao eyeformMacroDao = (EyeformMacroDao) SpringUtils.getBean("eyeformMacroDao"); HashMap<String, Object> hashMap = new HashMap<String, Object>(); try { EyeformMacro macro = new EyeformMacro(); if (request.getParameter("macroIdField") != null && request.getParameter("macroIdField").length() > 0) { macro = eyeformMacroDao.find(Integer.parseInt(request.getParameter("macroIdField"))); macro = (macro == null ? new EyeformMacro() : macro); } macro.setMacroName(request.getParameter("macroNameBox")); macro.setImpressionText(request.getParameter("macroImpressionBox")); macro.setPlanText(request.getParameter("macroPlanBox")); macro.setCopyFromLastImpression(Boolean.parseBoolean(request.getParameter("macroCopyFromLastImpression"))); if (request.getParameter("billingData") != null && request.getParameter("billingData").length() > 0) { String[] billingItems = request.getParameterValues("billingData"); List<EyeformMacroBillingItem> billingItemList = new LinkedList<EyeformMacroBillingItem>(); for (String b : billingItems) { EyeformMacroBillingItem billingItem = new EyeformMacroBillingItem(); String billingCode = b.substring(0, b.indexOf("|")); String multiplier = b.substring(b.indexOf("|")); billingItem.setBillingServiceCode(billingCode); billingItem.setMultiplier(Double.parseDouble(multiplier)); billingItemList.add(billingItem); } macro.setBillingItems(billingItemList); } eyeformMacroDao.merge(macro); hashMap.put("saved", macro.getId()); } catch (Exception e) { hashMap.put("error", e.getMessage()); } JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward getBillingArgs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HashMap<String, Object> hashMap = new HashMap<String, Object>(); LoggedInInfo loggedInInfo=LoggedInInfo.getLoggedInInfoFromSession(request); DemographicDao demographicDao = (DemographicDao) SpringUtils.getBean("demographicDao"); OscarAppointmentDao appointmentDao = (OscarAppointmentDao) SpringUtils.getBean("oscarAppointmentDao"); Appointment appointment = null; try { appointment = appointmentDao.find(Integer.parseInt(request.getParameter("appointment_no"))); } catch (Exception e) { // appointment_no is not a number, I guess appointment = null; } Demographic demographic = demographicDao.getDemographic(request.getParameter("demographic_no")); hashMap.put("ohip_version", "V03G"); if (demographic != null) { Integer sex = null; if (demographic.getSex().equalsIgnoreCase("M")) sex = 1; else if (demographic.getSex().equalsIgnoreCase("F")) sex = 2; String dateOfBirth = StringUtils.join(new String[] { demographic.getYearOfBirth(), demographic.getMonthOfBirth(), demographic.getDateOfBirth() }, ""); hashMap.put("hin", demographic.getHin()); hashMap.put("ver", demographic.getVer()); hashMap.put("hc_type", demographic.getHcType()); hashMap.put("sex", sex); hashMap.put("demographic_dob", dateOfBirth); hashMap.put("demographic_name", demographic.getLastName() + "," + demographic.getFirstName()); } if (appointment != null) { hashMap.put("apptProvider_no", appointment.getProviderNo()); hashMap.put("start_time", appointment.getStartTime().toString()); hashMap.put("appointment_date", appointment.getAppointmentDate().getTime()); } hashMap.put("current_provider_no", loggedInInfo.getLoggedInProviderNo()); hashMap.put("demo_mrp_provider_no", demographic.getProviderNo()); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward updateAppointmentReason(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HashMap<String, Object> hashMap = new HashMap<String, Object>(); OscarAppointmentDao appointmentDao = (OscarAppointmentDao) SpringUtils.getBean("oscarAppointmentDao"); Appointment appointment = appointmentDao.find(Integer.parseInt(request.getParameter("appointmentNo"))); if (appointment != null) { appointment.setReason(request.getParameter("reason")); appointmentDao.merge(appointment); hashMap.put("success", true); hashMap.put("appointmentNo", appointment.getId()); } JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String hin = request.getParameter("hin"); String ver = request.getParameter("ver"); String issueDate = request.getParameter("issueDate"); String hinExp = request.getParameter("hinExp"); if(!securityInfoManager.hasPrivilege(LoggedInInfo.getLoggedInInfoFromSession(request), "_demographic", "r", null)) { throw new SecurityException("missing required security object (_demographic)"); } DemographicDao demographicDao = (DemographicDao) SpringUtils.getBean("demographicDao"); List<Demographic> matches = demographicDao.getDemographicsByHealthNum(hin); HashMap<String, Object> hashMap = new HashMap<String, Object>(); if (matches != null) { if (matches.size() != 1 ) { hashMap.put("match", false); } else { hashMap.put("match", true); Demographic d = matches.get(0); hashMap.put("demoNo", d.getDemographicNo()); hashMap.put("lastName", d.getLastName()); hashMap.put("firstName", d.getFirstName()); hashMap.put("hin", d.getHin()); hashMap.put("hinVer", d.getVer()); hashMap.put("phone", d.getPhone()); String address = ""; if (d.getAddress() != null && d.getAddress().trim().length() > 0) address += d.getAddress().trim() + "\n"; if (d.getCity() != null && d.getCity().trim().length() > 0) address += d.getCity().trim(); if (d.getProvince() != null && d.getProvince().trim().length() > 0) address += (d.getCity() != null && d.getCity().trim().length() > 0 ? ", " : "") + d.getProvince().trim(); hashMap.put("address", address); } } JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward getBillingArgs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HashMap<String, Object> hashMap = new HashMap<String, Object>(); DemographicDao demographicDao = (DemographicDao) SpringUtils.getBean("demographicDao"); OscarAppointmentDao appointmentDao = (OscarAppointmentDao) SpringUtils.getBean("oscarAppointmentDao"); Appointment appointment = null; try { appointment = appointmentDao.find(Integer.parseInt(request.getParameter("appointment_no"))); } catch (Exception e) { // appointment_no is not a number, I guess appointment = null; } Demographic demographic = demographicDao.getDemographic(request.getParameter("demographic_no")); hashMap.put("ohip_version", "V03G"); if (demographic != null) { Integer sex = null; if (demographic.getSex().equalsIgnoreCase("M")) sex = 1; else if (demographic.getSex().equalsIgnoreCase("F")) sex = 2; String dateOfBirth = StringUtils.join(new String[] { demographic.getYearOfBirth(), demographic.getMonthOfBirth(), demographic.getDateOfBirth() }, ""); hashMap.put("hin", demographic.getHin()); hashMap.put("ver", demographic.getVer()); hashMap.put("hc_type", demographic.getHcType()); hashMap.put("sex", sex); hashMap.put("demographic_dob", dateOfBirth); hashMap.put("demographic_name", demographic.getLastName() + "," + demographic.getFirstName()); } if (appointment != null) { hashMap.put("apptProvider_no", appointment.getProviderNo()); hashMap.put("start_time", appointment.getStartTime().toString()); hashMap.put("appointment_date", appointment.getAppointmentDate().getTime()); } hashMap.put("current_provider_no", LoggedInInfo.loggedInInfo.get().loggedInProvider.getProviderNo()); hashMap.put("demo_mrp_provider_no", demographic.getProviderNo()); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String hin = request.getParameter("hin"); String ver = request.getParameter("ver"); String issueDate = request.getParameter("issueDate"); String hinExp = request.getParameter("hinExp"); DemographicDao demographicDao = (DemographicDao) SpringUtils.getBean("demographicDao"); List<Demographic> matches = demographicDao.getDemographicsByHealthNum(hin); HashMap<String, Object> hashMap = new HashMap<String, Object>(); if (matches != null) { if (matches.size() != 1 ) { hashMap.put("match", false); } else { hashMap.put("match", true); Demographic d = matches.get(0); hashMap.put("demoNo", d.getDemographicNo()); hashMap.put("lastName", d.getLastName()); hashMap.put("firstName", d.getFirstName()); hashMap.put("hin", d.getHin()); hashMap.put("hinVer", d.getVer()); hashMap.put("phone", d.getPhone()); String address = ""; if (d.getAddress() != null && d.getAddress().trim().length() > 0) address += d.getAddress().trim() + "\n"; if (d.getCity() != null && d.getCity().trim().length() > 0) address += d.getCity().trim(); if (d.getProvince() != null && d.getProvince().trim().length() > 0) address += (d.getCity() != null && d.getCity().trim().length() > 0 ? ", " : "") + d.getProvince().trim(); hashMap.put("address", address); } } JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONObject json = JSONObject.fromObject(hashMap, config); response.getOutputStream().write(json.toString().getBytes()); return null; }
public ActionForward getProductsByCode(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException { String code = request.getParameter("code"); List<DrugProduct> dps = drugProductDao.findAvailableByCode(code); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONArray jsonArray = JSONArray.fromObject( dps , config); response.getWriter().print(jsonArray); return null; }
public ActionForward findDistinctLotsAvailableByCode(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException { String code = request.getParameter("code"); List<LotBean> dps = drugProductDao.findDistinctLotsAvailableByCode(code); JsonConfig config = new JsonConfig(); config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor()); JSONArray jsonArray = JSONArray.fromObject( dps , config); response.getWriter().print(jsonArray); return null; }