Example usage for org.apache.commons.lang.time DateFormatUtils ISO_DATE_FORMAT

List of usage examples for org.apache.commons.lang.time DateFormatUtils ISO_DATE_FORMAT

Introduction

In this page you can find the example usage for org.apache.commons.lang.time DateFormatUtils ISO_DATE_FORMAT.

Prototype

FastDateFormat ISO_DATE_FORMAT

To view the source code for org.apache.commons.lang.time DateFormatUtils ISO_DATE_FORMAT.

Click Source Link

Document

ISO8601 formatter for date without time zone.

Usage

From source file:oscar.oscarEncounter.oscarConsultationRequest.pageUtil.EctViewConsultationRequestsUtil.java

public boolean estConsultationVecByDemographic(String demoNo) {
    ids = new Vector<String>();
    status = new Vector<String>();
    patient = new Vector<String>();
    provider = new Vector<String>();
    service = new Vector<String>();
    date = new Vector<String>();
    this.patientWillBook = new Vector<String>();
    urgency = new Vector<String>();
    apptDate = new Vector<String>();
    reason = new Vector<String>();
    consultant = new Vector<String>();
    documentNo = new Vector<String>();
    boolean verdict = true;
    try {/*from   w  w  w  .  j ava  2 s .com*/

        ConsultationRequestDao consultReqDao = (ConsultationRequestDao) SpringUtils
                .getBean("consultationRequestDao");

        ProviderDao providerDao = (ProviderDao) SpringUtils.getBean("providerDao");
        DemographicDao demoDao = (DemographicDao) SpringUtils.getBean("demographicDao");
        ProfessionalSpecialistDao specialistDao = (ProfessionalSpecialistDao) SpringUtils
                .getBean("professionalSpecialistDao");
        ConsultationServiceDao serviceDao = (ConsultationServiceDao) SpringUtils
                .getBean("consultationServiceDao");
        ConsultDocsDao cdocumentDao = (ConsultDocsDao) SpringUtils.getBean("consultDocsDao");
        DocumentDAO documentDAO = (DocumentDAO) SpringUtils.getBean("documentDAO");

        ConsultationRequest consult;
        Provider prov;
        Demographic demo;
        ConsultationServices services;
        String providerId, providerName;

        List consultList = consultReqDao.getConsults(demoNo);
        for (int idx = 0; idx < consultList.size(); ++idx) {
            consult = (ConsultationRequest) consultList.get(idx);
            demo = demoDao.getDemographicById(consult.getDemographicId());
            providerId = demo.getProviderNo();
            if (providerId != null && !providerId.equals("")) {
                prov = providerDao.getProvider(demo.getProviderNo());
                providerName = prov.getFormattedName();
            } else {
                providerName = "N/A";
            }

            ids.add(consult.getId().toString());
            status.add(consult.getStatus());
            patient.add(demo.getFormattedName());
            provider.add(providerName);
            if (consult.getServiceId() != null) {
                services = serviceDao.find(consult.getServiceId());
                if (services != null)
                    service.add(services.getServiceDesc());
                else
                    service.add("");
            } else {
                service.add("");
            }

            urgency.add(consult.getUrgency());
            patientWillBook.add("" + consult.isPatientWillBook());
            date.add(DateFormatUtils.ISO_DATE_FORMAT.format(consult.getReferralDate()));
            reason.add(consult.getReasonForReferral());
            if (consult.getSpecialistId() != null) {
                ProfessionalSpecialist ps = specialistDao.getById(consult.getSpecialistId());
                if (ps != null)
                    consultant.add(ps.getFormattedName());
                else
                    consultant.add("");
            } else
                consultant.add("");

            List<ConsultDocs> docList = cdocumentDao.findDocumentsByRequestId(consult.getId());
            if (docList.size() > 0) {
                //modified by rohit to display doc descr in consultation list.. and opening the doc on click of it
                String docStr = "";
                for (ConsultDocs consultDoc : docList) {
                    if (consultDoc != null) {
                        int docNo = consultDoc.getDocumentNo();
                        Document document = documentDAO.getDocument(docNo + "");
                        if (docStr.length() == 0)
                            docStr = consultDoc.getDocumentNo() + "#" + document.getDocdesc();
                        else
                            docStr = docStr + "~" + consultDoc.getDocumentNo() + "#" + document.getDocdesc();

                    }
                }
                documentNo.add(docStr);
                //documentNo.add(String.valueOf(((cdocumentDao.findByRequestId(consult.getId())).get(0)).getDocumentNo()));
            } else
                documentNo.add("");
        }
    } catch (Exception e) {
        MiscUtils.getLogger().error("Error", e);
        verdict = false;
    }
    return verdict;
}

From source file:oscar.oscarEncounter.oscarConsultationRequest.pageUtil.EctViewRequestAction.java

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();//from www. j ava 2  s  . co  m
    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.setPatientAge(demo.getAge());

    ProviderDao provDao = (ProviderDao) SpringUtils.getBean("providerDao");
    Provider prov = provDao.getProvider(consult.getProviderNo());
    thisForm.setProviderName(prov.getFormattedName());

    thisForm.seteReferral(false);
}

From source file:oscar.oscarEncounter.oscarConsultationRequest.pageUtil.EctViewRequestAction.java

public static void fillFormValues(EctConsultationFormRequestForm thisForm, String segmentId)
        throws HL7Exception, UnsupportedEncodingException {
    Hl7TextMessageDao hl7TextMessageDao = (Hl7TextMessageDao) SpringUtils.getBean("hl7TextMessageDao");
    Hl7TextMessage hl7TextMessage = hl7TextMessageDao.find(Integer.parseInt(segmentId));

    String encodedMessage = hl7TextMessage.getBase64EncodedeMessage();
    byte[] decodedMessage = MiscUtils.decodeBase64(encodedMessage);
    String decodedMessageString = new String(decodedMessage, MiscUtils.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));

    //---/* w ww.j a  va2s.co m*/

    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);

    // 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());

}

From source file:oscar.oscarLab.ca.all.pageUtil.SendOruR01UIBean.java

private void checkForDataFromNotes(HttpServletRequest request) {
    String temp = request.getParameter("noteId");
    if (temp != null) {
        Long noteId = Long.parseLong(temp);
        CaseManagementNote caseManagementNote = caseManagementNoteDAO.getNote(noteId);

        // fill demographic info
        String demographicId = caseManagementNote.getDemographic_no();
        Demographic demographic = demographicDao.getDemographic(demographicId);
        clientFirstName = StringEscapeUtils.escapeHtml(StringUtils.trimToEmpty(demographic.getFirstName()));
        clientLastName = StringEscapeUtils.escapeHtml(StringUtils.trimToEmpty(demographic.getLastName()));
        clientHin = StringEscapeUtils.escapeHtml(StringUtils.trimToEmpty(demographic.getHin()));
        GregorianCalendar cal = demographic.getBirthDay();
        if (cal != null)
            clientBirthDate = StringEscapeUtils.escapeHtml(DateFormatUtils.ISO_DATE_FORMAT.format(cal));
        clientGender = StringEscapeUtils.escapeHtml(StringUtils.trimToEmpty(demographic.getSex()));

        // fill note info
        subject = StringEscapeUtils.escapeHtml("Encounter Note");
        StringBuilder sb = new StringBuilder();
        sb.append(caseManagementNote.getNote());

        List<CaseManagementIssue> caseManagementIssues = caseManagementIssueNotesDao
                .getNoteIssues(caseManagementNote.getId().intValue());
        if (caseManagementIssues.size() > 0) {
            sb.append("\n---------- Attached Issues ---------");
            for (CaseManagementIssue caseManagementIssue : caseManagementIssues) {
                sb.append('\n');
                Issue issue = caseManagementIssue.getIssue();
                sb.append(issue.getCode());
                sb.append(" (");
                sb.append(issue.getDescription());
                sb.append(") : acute=");
                sb.append(caseManagementIssue.isAcute());
                sb.append(", certain=");
                sb.append(caseManagementIssue.isCertain());
                sb.append(", major=");
                sb.append(caseManagementIssue.isMajor());
                sb.append(", resolved=");
                sb.append(caseManagementIssue.isResolved());
            }/*  w  ww  .ja va 2  s  .c  o  m*/
        } else {
            sb.append("\n---------- No Attached Issues ---------");
        }

        textMessage = StringEscapeUtils.escapeHtml(sb.toString());
    }
}

From source file:oscar.oscarLab.ca.all.pageUtil.ViewOruR01UIBean.java

License:asdf

public String getBirthDayForDisplay() {
    if (demographic.getBirthDay() == null)
        return ("");
    return (DateFormatUtils.ISO_DATE_FORMAT.format(demographic.getBirthDay()));
}

From source file:oscar.oscarPrevention.PreventionData.java

public static ArrayList<Map<String, Object>> addRemotePreventions(ArrayList<Map<String, Object>> preventions,
        Integer demographicId, String preventionType, Date demographicDateOfBirth) {
    List<CachedDemographicPrevention> remotePreventions = getRemotePreventions(demographicId);

    if (remotePreventions != null) {
        for (CachedDemographicPrevention cachedDemographicPrevention : remotePreventions) {
            if (preventionType.equals(cachedDemographicPrevention.getPreventionType())) {

                Map<String, Object> h = new HashMap<String, Object>();
                h.put("integratorFacilityId",
                        cachedDemographicPrevention.getFacilityPreventionPk().getIntegratorFacilityId());
                h.put("integratorPreventionId",
                        cachedDemographicPrevention.getFacilityPreventionPk().getCaisiItemId());
                String remoteFacilityName = "N/A";
                CachedFacility remoteFacility = null;
                try {
                    remoteFacility = CaisiIntegratorManager.getRemoteFacility(
                            cachedDemographicPrevention.getFacilityPreventionPk().getIntegratorFacilityId());
                } catch (Exception e) {
                    log.error("Error", e);
                }//from w ww. j a va  2s  . co m
                if (remoteFacility != null)
                    remoteFacilityName = remoteFacility.getName();
                h.put("remoteFacilityName", remoteFacilityName);
                h.put("integratorDemographicId", cachedDemographicPrevention.getCaisiDemographicId());
                h.put("type", cachedDemographicPrevention.getPreventionType());
                h.put("provider_no", "remote:" + cachedDemographicPrevention.getCaisiProviderId());
                h.put("provider_name", "remote:" + cachedDemographicPrevention.getCaisiProviderId());
                h.put("prevention_date", DateFormatUtils.ISO_DATE_FORMAT
                        .format(cachedDemographicPrevention.getPreventionDate()));
                h.put("prevention_date_asDate", cachedDemographicPrevention.getPreventionDate());

                if (demographicDateOfBirth != null) {
                    String age = UtilDateUtilities.calcAgeAtDate(demographicDateOfBirth,
                            MiscUtils.toDate(cachedDemographicPrevention.getPreventionDate()));
                    h.put("age", age);
                } else {
                    h.put("age", "N/A");
                }

                preventions.add(h);
            }
        }

        Collections.sort(preventions, new PreventionsComparator());
    }

    return (preventions);
}