Exemple #1
0
 @Override
 public List<Study> findByCreatedDateRange(Date startDate, Date endDate)
     throws MaPSeqDAOException {
   logger.debug("ENTERING findByCreatedDateRange(Date, Date)");
   String formattedStartDate = DateFormatUtils.ISO_DATE_FORMAT.format(startDate);
   String formattedEndDate = DateFormatUtils.ISO_DATE_FORMAT.format(endDate);
   List<Study> ret = studyService.findByCreatedDateRange(formattedStartDate, formattedEndDate);
   return ret;
 }
  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 void fillFormValues(EctConsultationFormRequestForm thisForm, String segmentId)
      throws HL7Exception, UnsupportedEncodingException, Base64DecodingException {
    Hl7TextMessageDao hl7TextMessageDao =
        (Hl7TextMessageDao) SpringUtils.getBean("hl7TextMessageDao");
    Hl7TextMessage hl7TextMessage = hl7TextMessageDao.find(Integer.parseInt(segmentId));

    String encodedMessage = hl7TextMessage.getBase64EncodedeMessage();
    byte[] decodedMessage = Base64.decode(encodedMessage);
    String decodedMessageString = new String(decodedMessage, MiscUtils.DEFAULT_UTF8_ENCODING);

    REF_I12 refI12 = (REF_I12) OscarToOscarUtils.pipeParserParse(decodedMessageString);

    thisForm.setHl7TextMessageId(hl7TextMessage.getId());

    thisForm.setAllergies(RefI12.getNteValue(refI12, RefI12.REF_NTE_TYPE.ALLERGIES));
    thisForm.setReasonForConsultation(
        RefI12.getNteValue(refI12, RefI12.REF_NTE_TYPE.REASON_FOR_CONSULTATION));
    thisForm.setClinicalInformation(
        RefI12.getNteValue(refI12, RefI12.REF_NTE_TYPE.CLINICAL_INFORMATION));
    thisForm.setCurrentMedications(
        RefI12.getNteValue(refI12, RefI12.REF_NTE_TYPE.CURRENT_MEDICATIONS));

    GregorianCalendar referralDate =
        DataTypeUtils.getCalendarFromDTM(refI12.getRF1().getEffectiveDate());
    thisForm.setReferalDate(DateFormatUtils.ISO_DATE_FORMAT.format(referralDate));

    thisForm.setConcurrentProblems(
        RefI12.getNteValue(refI12, RefI12.REF_NTE_TYPE.CONCURRENT_PROBLEMS));

    // spoecifically told that this field should not be sent electronically (so it shouldn't be
    // received either).
    // thisForm.setAppointmentNotes(RefI12.getNteValue(refI12,
    // RefI12.REF_NTE_TYPE.APPOINTMENT_NOTES));

    // ---

    PID pid = refI12.getPID();
    Demographic demographic = DataTypeUtils.parsePid(pid);

    StringBuilder address = new StringBuilder();
    if (demographic.getAddress() != null) address.append(demographic.getAddress()).append("<br />");
    if (demographic.getCity() != null) address.append(demographic.getCity()).append(", ");
    if (demographic.getProvince() != null) address.append(demographic.getProvince());
    thisForm.setPatientAddress(address.toString());

    if (demographic.getBirthDay() != null) {
      thisForm.setPatientDOB(DateFormatUtils.ISO_DATE_FORMAT.format(demographic.getBirthDay()));
      String ageString =
          UtilDateUtilities.calcAgeAtDate(demographic.getBirthDay().getTime(), new Date());
      thisForm.setPatientAge(ageString);
    }

    thisForm.setPatientHealthNum(demographic.getHin());
    thisForm.setPatientHealthCardType(demographic.getHcType());
    thisForm.setPatientHealthCardVersionCode(demographic.getVer());

    thisForm.setPatientFirstName(demographic.getFirstName());
    thisForm.setPatientLastName(demographic.getLastName());
    thisForm.setPatientPhone(demographic.getPhone());
    thisForm.setPatientSex(demographic.getSex());
    //        thisForm.setPatientWPhone(patientAddress);
    thisForm.setPatientEmail(demographic.getEmail());

    // referring provider
    PRD referringPrd = RefI12.getPrdByRoleId(refI12, "RP");
    Provider provider = DataTypeUtils.parsePrdAsProvider(referringPrd);
    thisForm.setProviderName(provider.getLastName() + ", " + provider.getFirstName());

    thisForm.seteReferral(true);

    // referredTo specialist
    PRD referredToPrd = RefI12.getPrdByRoleId(refI12, "RT");
    ProfessionalSpecialist professionalSpecialist =
        DataTypeUtils.parsePrdAsProfessionalSpecialist(referredToPrd);
    thisForm.setProfessionalSpecialistName(
        professionalSpecialist.getLastName() + ", " + professionalSpecialist.getFirstName());
    thisForm.setProfessionalSpecialistAddress(professionalSpecialist.getStreetAddress());
    thisForm.setProfessionalSpecialistPhone(professionalSpecialist.getPhoneNumber());
  }