public static void fillFormValues(EctConsultationFormRequestForm thisForm, Integer requestId) { ConsultationRequestDao consultDao = (ConsultationRequestDao) SpringUtils.getBean("consultationRequestDao"); ConsultationRequest consult = consultDao.find(requestId); thisForm.setAllergies(consult.getAllergies()); thisForm.setReasonForConsultation(consult.getReasonForReferral()); thisForm.setClinicalInformation(consult.getClinicalInfo()); thisForm.setCurrentMedications(consult.getCurrentMeds()); Date date = consult.getReferralDate(); thisForm.setReferalDate(DateFormatUtils.ISO_DATE_FORMAT.format(date)); thisForm.setSendTo(consult.getSendTo()); thisForm.setService(consult.getServiceId().toString()); thisForm.setStatus(consult.getStatus()); setAppointmentDateTime(thisForm, consult); thisForm.setConcurrentProblems(consult.getConcurrentProblems()); thisForm.setAppointmentNotes(consult.getStatusText()); thisForm.setUrgency(consult.getUrgency()); thisForm.setPatientWillBook(String.valueOf(consult.isPatientWillBook())); date = consult.getFollowUpDate(); if (date != null) { thisForm.setFollowUpDate(DateFormatUtils.ISO_DATE_FORMAT.format(date)); } else { thisForm.setFollowUpDate(""); } DemographicDao demoDao = (DemographicDao) SpringUtils.getBean("demographicDao"); Demographic demo = demoDao.getDemographicById(consult.getDemographicId()); thisForm.setPatientAddress(demo.getAddress()); thisForm.setPatientDOB(demo.getFormattedDob()); thisForm.setPatientHealthNum(demo.getHin()); thisForm.setPatientHealthCardVersionCode(demo.getVer()); thisForm.setPatientHealthCardType(demo.getHcType()); thisForm.setPatientFirstName(demo.getFirstName()); thisForm.setPatientLastName(demo.getLastName()); thisForm.setPatientPhone(demo.getPhone()); thisForm.setPatientSex(demo.getSex()); thisForm.setPatientWPhone(demo.getPhone2()); thisForm.setPatientEmail(demo.getEmail()); thisForm.setPatientAge(demo.getAge()); ProviderDao provDao = (ProviderDao) SpringUtils.getBean("providerDao"); Provider prov = provDao.getProvider(consult.getProviderNo()); thisForm.setProviderName(prov.getFormattedName()); thisForm.seteReferral(false); }
public static List<Demographic> getOCANClients(Integer facilityId) { List<Integer> demographicIds = ocanStaffFormDao.getAllOcanClients(facilityId); List<Demographic> demographics = new ArrayList<Demographic>(); for (Integer id : demographicIds) { demographics.add(demographicDao.getClientByDemographicNo(id)); } return demographics; }
private boolean checkDate18m(Date formDate, Integer demographicNo) { Calendar babyBirthday = demographicDao.getDemographic(demographicNo.toString()).getBirthDay(); if (UtilDateUtilities.getNumMonths(babyBirthday.getTime(), formDate) < 18) { return false; } return true; }
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; }
@Override public TicklerTo1 getAsTransferObject(LoggedInInfo loggedInInfo, Tickler t) throws ConversionException { ProviderDao providerDao = SpringUtils.getBean(ProviderDao.class); DemographicDao demographicDao = SpringUtils.getBean(DemographicDao.class); TicklerLinkDao ticklerLinkDao = SpringUtils.getBean(TicklerLinkDao.class); ProgramDao programDao = SpringUtils.getBean(ProgramDao.class); TicklerTo1 d = new TicklerTo1(); d.setCreator(t.getCreator()); d.setDemographicNo(t.getDemographicNo()); d.setId(t.getId()); d.setMessage(t.getMessage()); d.setPriority(t.getPriority()); d.setProgramId(t.getProgramId()); d.setServiceDate(t.getServiceDate()); d.setStatus(t.getStatus()); d.setTaskAssignedTo(t.getTaskAssignedTo()); d.setUpdateDate(t.getUpdateDate()); // want responses to include patient name - be nice to have this configurable by a parameter // map. d.setDemographicName( demographicDao.getDemographicById(t.getDemographicNo()).getFormattedName()); d.setTaskAssignedToName(providerDao.getProviderName(t.getTaskAssignedTo())); d.setCreatorName(providerDao.getProviderName(t.getCreator())); if (d.getStatus() == STATUS.A) { d.setStatusName("Active"); } if (d.getStatus() == STATUS.C) { d.setStatusName("Completed"); } if (d.getStatus() == STATUS.D) { d.setStatusName("Deleted"); } if (includeLinks) { List<TicklerLink> links = ticklerLinkDao.getLinkByTickler(d.getId()); TicklerLinkConverter tlc = new TicklerLinkConverter(); d.setTicklerLinks(tlc.getAllAsTransferObjects(loggedInInfo, links)); } if (includeComments) { for (TicklerComment tc : t.getComments()) { TicklerCommentTo1 tct = new TicklerCommentTo1(); tct.setMessage(tc.getMessage()); tct.setProviderNo(tc.getProviderNo()); tct.setUpdateDate(tc.getUpdateDate()); tct.setProviderName(tc.getProvider() != null ? tc.getProvider().getFormattedName() : "N/A"); d.getTicklerComments().add(tct); } } if (includeUpdates) { for (TicklerUpdate tu : t.getUpdates()) { TicklerUpdateTo1 tut = new TicklerUpdateTo1(); BeanUtils.copyProperties(tu, tut, new String[] {"id", "provider"}); tut.setProviderName(tu.getProvider() != null ? tu.getProvider().getFormattedName() : "N/A"); d.getTicklerUpdates().add(tut); } } if (includeProgram && t.getProgramId() != null) { // TODO: this should go through the manager, but I have no LoggedInInfo. Going to have to // change the interface and update all the implementors Program p = programDao.getProgram(t.getProgramId()); if (p != null) { d.setProgram(new ProgramConverter().getAsTransferObject(loggedInInfo, p)); } } return d; }