예제 #1
0
  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);
  }
예제 #2
0
  @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;
  }