public ActionForward save( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request); DynaActionForm dform = (DynaActionForm) form; Episode episode = (Episode) dform.get("episode"); Integer id = null; try { id = Integer.parseInt(request.getParameter("episode.id")); } catch (NumberFormatException e) { /*empty*/ } Episode e = null; if (id != null && id.intValue() > 0) { e = episodeDao.find(Integer.valueOf(id)); } else { e = new Episode(); } BeanUtils.copyProperties(episode, e, new String[] {"id", "lastUpdateTime", "lastUpdateUser"}); e.setLastUpdateUser(loggedInInfo.getLoggedInProviderNo()); if (!securityInfoManager.hasPrivilege( LoggedInInfo.getLoggedInInfoFromSession(request), "_demographic", "w", e.getDemographicNo())) { throw new SecurityException("missing required security object (_demographic)"); } if (id != null && id.intValue() > 0) { episodeDao.merge(e); } else { episodeDao.persist(e); } request.setAttribute("parentAjaxId", "episode"); return mapping.findForward("success"); }
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 int addOneClaimHeaderRecord(LoggedInInfo loggedInInfo, BillingClaimHeader1Data val) { BillingONCHeader1 b = new BillingONCHeader1(); b.setHeaderId(0); b.setTranscId(val.transc_id); b.setRecId(val.rec_id); b.setHin(val.hin); b.setVer(val.ver); b.setDob(val.dob); b.setPayProgram(val.pay_program); b.setPayee(val.payee); b.setRefNum(val.ref_num); b.setFaciltyNum(val.facilty_num); if (val.admission_date.length() > 0) try { b.setAdmissionDate(dateformatter.parse(val.admission_date)); } catch (ParseException e) { /*empty*/ } b.setRefLabNum(val.ref_lab_num); b.setManReview(val.man_review); b.setLocation(val.location); b.setDemographicNo(Integer.parseInt(val.demographic_no)); b.setProviderNo(val.provider_no); String apptNo = StringUtils.trimToNull(val.appointment_no); if (apptNo != null) { b.setAppointmentNo(Integer.parseInt(val.appointment_no)); } else { b.setAppointmentNo(null); } b.setDemographicName(StringEscapeUtils.escapeSql(val.demographic_name)); b.setSex(val.sex); b.setProvince(val.province); if (val.billing_date.length() > 0) try { b.setBillingDate(dateformatter.parse(val.billing_date)); } catch (ParseException e) { /*empty*/ } if (val.billing_time.length() > 0) try { b.setBillingTime(timeFormatter.parse(val.billing_time)); } catch (ParseException e) { MiscUtils.getLogger().error("Invalid time", e); } b.setTotal(new BigDecimal(val.total == null ? "0.00" : val.total)); if (val.paid == null || val.paid.isEmpty()) { b.setPaid(new BigDecimal("0.00")); } else { b.setPaid(new BigDecimal(val.paid)); } b.setStatus(val.status); b.setComment(StringEscapeUtils.escapeSql(val.comment)); b.setVisitType(val.visittype); b.setProviderOhipNo(val.provider_ohip_no); b.setProviderRmaNo(val.provider_rma_no); b.setApptProviderNo(val.apptProvider_no); b.setAsstProviderNo(val.asstProvider_no); b.setCreator(val.creator); b.setClinic(val.clinic); ProgramProvider pp = programManager2.getCurrentProgramInDomain( loggedInInfo, loggedInInfo.getLoggedInProviderNo()); if (pp != null) { b.setProgramNo(pp.getProgramId().intValue()); } cheaderDao.persist(b); return b.getId(); }