@Override protected void onGrdDischargesGridHeaderClicked(int column) throws PresentationLogicException { // WDEV-13136 // Updated the index for column if (column == COL_ACTUAL_DISCHARGE_DATETIME) { if(form.getLocalContext().getSortOrder() == null) { form.getLocalContext().setSortOrder(SortOrder.ASCENDING); } DischargedEpisodeVoCollection voColl = form.grdDischarges().getValues(); voColl.sort(DischargedEpisodeVo.getDateTimeComparator(form.getLocalContext().getSortOrder())); if(form.getLocalContext().getSortOrder().equals(SortOrder.ASCENDING)) form.getLocalContext().setSortOrder(SortOrder.DESCENDING); else if(form.getLocalContext().getSortOrder().equals(SortOrder.DESCENDING)) form.getLocalContext().setSortOrder(SortOrder.ASCENDING); form.grdDischarges().getRows().clear(); populateGrid(voColl); } }
public DischargedEpisodeVo getDischargeEpisodeByAdmissionDetail(AdmissionDetailRefVo admDetRef) { if( admDetRef == null ) throw new CodingRuntimeException("AdmissionDetailRefVo is null"); DomainFactory factory = getDomainFactory(); String hql = " select d1_1 from DischargedEpisode as d1_1 left join d1_1.admissionDetail as a1_1 where (d1_1.admissionDetail.id = :idAdmissionDet ) order by d1_1.systemInformation.creationDateTime desc "; List<?> lst = factory.find(hql,new String[]{"idAdmissionDet"},new Object[]{admDetRef.getID_AdmissionDetail()}); if (lst != null && lst.size() > 0) { DischargedEpisodeVoCollection tempColl = DischargedEpisodeVoAssembler.createDischargedEpisodeVoCollectionFromDischargedEpisode(lst) ; if(tempColl != null && tempColl.size() > 0) { return tempColl.get(0); } } return null; }
public DischargedEpisodeVo getDischargedEpisodeDetails(CareContextRefVo ccRefVo, PatientRefVo voPatRefVo) { DomainFactory factory = getDomainFactory(); CareContextVo voCC = CareContextVoAssembler.create((CareContext)factory.getDomainObject(CareContext.class, ccRefVo.getID_CareContext())); if (voCC.getPasEvent() == null) { return null; } String hql = "from DischargedEpisode de " + " where de.pasEvent.patient.id = :patId " + " and de.pasEvent.id = :eventId "; ArrayList<String> labels = new ArrayList<String>(); labels.add("patId"); labels.add("eventId"); ArrayList<Object> values = new ArrayList<Object>(); values.add(voPatRefVo.getID_Patient()); values.add(voCC.getPasEvent().getID_PASEvent()); List<?> l = factory.find(hql, labels, values); if (l != null && l.size() > 0) { if (l.size() > 1) throw new DomainRuntimeException("Duplicate data found for Patient and PasEvent"); DischargedEpisodeVoCollection voColl = DischargedEpisodeVoAssembler.createDischargedEpisodeVoCollectionFromDischargedEpisode(l); return voColl.get(0); } return null; }
public void saveDischargeEpisodes(DischargedEpisodeVoCollection collDischargedEpisodeVo, MemberOfStaffShortVo mos) throws DomainInterfaceException, StaleObjectException { for(int i=0; i<collDischargedEpisodeVo.size(); i++){ if (!collDischargedEpisodeVo.get(i).isValidated()) { throw new DomainRuntimeException("Episode VO has not been validated!"); } DomainFactory factory = getDomainFactory(); DischargedEpisode diDo = DischargedEpisodeVoAssembler.extractDischargedEpisode(factory, collDischargedEpisodeVo.get(i)); factory.save(diDo); saveDocumentStatus(collDischargedEpisodeVo.get(i).getPasEvent().getCspDocumentStatus(), collDischargedEpisodeVo.get(i).getPasEvent(), mos); } }
public DischargeAndPASEventForReferralCodingVoCollection listPASEvents(CatsReferralRefVo voCatsReferralRef) { if (ConfigFlag.DOM.REFERRAL_CODING_SOURCE.getValue().equals(REFERRAL_CODING_SOURCE_DISCHARGE)) { DomainFactory factory = getDomainFactory(); String hql = "SELECT dspw from DischargeSummaryPacuAndWard dspw where dspw.catsReferral.id = :catsId"; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); markers.add("catsId"); values.add(voCatsReferralRef.getID_CatsReferral()); return DischargeAndPASEventForReferralCodingVoAssembler.createDischargeAndPASEventForReferralCodingVoCollectionFromDischargeSummaryPacuAndWard(factory.find(hql,markers,values)).sort(); } else if (ConfigFlag.DOM.REFERRAL_CODING_SOURCE.getValue().equals(REFERRAL_CODING_SOURCE_ADMISSIONS)) { String query = "SELECT de FROM CatsReferral AS ref LEFT JOIN ref.admissions AS adm, DischargedEpisode AS de RIGHT JOIN de.admissionDetail AS addet WHERE addet.id = adm.id AND ref.id = :CATS_ID AND de is not null"; DischargedEpisodeVoCollection dischargedEpisodes = DischargedEpisodeVoAssembler.createDischargedEpisodeVoCollectionFromDischargedEpisode(getDomainFactory().find(query, "CATS_ID", voCatsReferralRef.getID_CatsReferral())); DischargeAndPASEventForReferralCodingVoCollection results = new DischargeAndPASEventForReferralCodingVoCollection(); for (DischargedEpisodeVo episode : dischargedEpisodes) { DischargeAndPASEventForReferralCodingVo result = new DischargeAndPASEventForReferralCodingVo(); result.setCatsReferral(voCatsReferralRef); result.setDischargeEpisode(episode); // result.setDischargeDateTime(episode.getDischargeDateTime()); results.add(result); } return results; } return null; }
public DischargeAndPASEventForReferralCodingVoCollection listPASEvents(CatsReferralRefVo voCatsReferralRef) { if (ConfigFlag.DOM.REFERRAL_CODING_SOURCE.getValue().equals(REFERRAL_CODING_SOURCE_DISCHARGE)) { DomainFactory factory = getDomainFactory(); String hql = "SELECT dspw from DischargeSummaryPacuAndWard dspw where dspw.catsReferral.id = :catsId"; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); markers.add("catsId"); values.add(voCatsReferralRef.getID_CatsReferral()); return DischargeAndPASEventForReferralCodingVoAssembler.createDischargeAndPASEventForReferralCodingVoCollectionFromDischargeSummaryPacuAndWard(factory.find(hql, markers, values)).sort(); } else if (ConfigFlag.DOM.REFERRAL_CODING_SOURCE.getValue().equals(REFERRAL_CODING_SOURCE_ADMISSIONS)) { String query = "SELECT de FROM CatsReferral AS ref LEFT JOIN ref.admissions AS adm, DischargedEpisode AS de RIGHT JOIN de.admissionDetail AS addet WHERE addet.id = adm.id AND ref.id = :CATS_ID AND de is not null"; DischargedEpisodeVoCollection dischargedEpisodes = DischargedEpisodeVoAssembler.createDischargedEpisodeVoCollectionFromDischargedEpisode(getDomainFactory().find(query, "CATS_ID", voCatsReferralRef.getID_CatsReferral())); DischargeAndPASEventForReferralCodingVoCollection results = new DischargeAndPASEventForReferralCodingVoCollection(); for (DischargedEpisodeVo episode : dischargedEpisodes) { DischargeAndPASEventForReferralCodingVo result = new DischargeAndPASEventForReferralCodingVo(); result.setCatsReferral(voCatsReferralRef); result.setDischargeEpisode(episode); result.setDischargeDateTime(episode.getDischargeDateTime()); results.add(result); } return results; } return null; }
private void search() { String[] errors = validateSearchUIRules(); if (errors!=null && errors.length>0) { engine.showErrors(errors); return; } form.grdDischarges().getRows().clear(); form.lblTotal().setValue("Total : 0"); // WDEV-18099 RecentDischargesFilterVo voFilter = new RecentDischargesFilterVo(); if (form.txtIDNum().getValue() != null && form.cmbIDType().getValue() == null) { engine.showErrors(new String[]{"Please enter both an Identifier type as well as its value."}); return; } voFilter.setHospNum(form.txtIDNum().getValue()); voFilter.setIDType(form.cmbIDType().getValue()); //WDEV-13065 -- if (form.txtIDNum().getValue() == null) voFilter.setDischDestination(form.cmbDischargeDestination().getValue()); voFilter.setForename(form.txtForeName().getValue()); voFilter.setSurname(form.txtSurname().getValue()); voFilter.setConsultant(form.qmbHCP().getValue()); voFilter.setFromDate(form.dteFrom().getValue()); voFilter.setToDate(form.dteTo().getValue()); if (voFilter.countFieldsWithValue() == 1 && voFilter.getIDTypeIsNotNull()) { engine.showMessage("Please enter some valid search criteria.", "Invalid search criteria", MessageButtons.OK, MessageIcon.ERROR); return; } form.getGlobalContext().STHK.setRecentDischargesListFilter(voFilter); DischargedEpisodeVoCollection voColl; if ((voFilter.countFieldsWithValue() == 1 && voFilter.getIDType() == null) || voFilter.countFieldsWithValue() > 1) { voColl = domain.listRecentDischarges(voFilter); } else { engine.showMessage("Please enter some search criteria.", "Invalid search criteria", MessageButtons.OK, MessageIcon.ERROR); return; } if (voColl == null || voColl.size() == 0) { engine.showMessage("No Recent Discharge records match your search criteria.", "No data found", MessageButtons.OK, MessageIcon.WARNING); return; } if (voColl != null) form.lblTotal().setValue("Total : " + String.valueOf(voColl.size())); if (voColl!=null) populateGrid(voColl); }
private void populateGrid(DischargedEpisodeVoCollection disEpis) { for (int i=0;i<disEpis.size();i++) { DischargedEpisodeVo epis = disEpis.get(i); form.grdDischarges().setValue(epis); grdDischargesRow aRow = form.grdDischarges().getRows().newRow(); if (epis.getPasEventIsNotNull()) { aRow.setValue(epis); if (epis.getPasEvent().getConsultantIsNotNull()) if (epis.getPasEvent().getConsultant().getMosIsNotNull()) if (epis.getPasEvent().getConsultant().getMos().getNameIsNotNull()) aRow.setColConsultant(epis.getPasEvent().getConsultant().getMos().getName().toString()); if (epis.getPasEvent().getPatientIsNotNull()) { epis.getPasEvent().getPatient().calculateAge(); if (epis.getPasEvent().getPatient().getIdentifiersIsNotNull()) for (int j=0;j<epis.getPasEvent().getPatient().getIdentifiers().size();j++) if (epis.getPasEvent().getPatient().getIdentifiers().get(j).getType().equals(PatIdType.HOSPNUM)) aRow.setColHOSNUM(epis.getPasEvent().getPatient().getIdentifiers().get(j).getValue()); if (epis.getPasEvent().getPatient().getSexIsNotNull()) aRow.setColPatSex(epis.getPasEvent().getPatient().getSex().getText()); if (epis.getPasEvent().getPatient().getNameIsNotNull()) if (epis.getPasEvent().getPatient().getName().getSurnameIsNotNull()) aRow.setColSurname(epis.getPasEvent().getPatient().getName().getSurname()); if (epis.getPasEvent().getPatient().getName().getForenameIsNotNull()) aRow.setColForename(epis.getPasEvent().getPatient().getName().getForename()); if (epis.getPasEvent().getLocationIsNotNull()) aRow.setColWard(epis.getPasEvent().getLocation().getName()); if(epis.getPasEvent().getPatient().getAssociatedPatientIsNotNull()) aRow.setBackColor(ConfigFlag.UI.MERGED_COLOUR.getValue()); if (epis.getPasEvent().getPatient().getDodIsNotNull()) aRow.setBackColor(ConfigFlag.UI.RIP_COLOUR.getValue()); } if (epis.getDischargeDateTimeIsNotNull()) aRow.setColDateTime(epis.getDischargeDateTime().toString()); if (epis.getDischargeDestinationIsNotNull()) aRow.setColDestination(epis.getDischargeDestination().getText()); } } }
private void search() { String[] errors = validateSearchUIRules(); if (errors!=null && errors.length>0) { engine.showErrors(errors); return; } form.grdDischarges().getRows().clear(); form.lblTotal().setValue("Total: 0"); // WDEV-18099 RecentDischargesFilterVo voFilter = new RecentDischargesFilterVo(); if (form.txtIDNum().getValue() != null && form.cmbIDType().getValue() == null) { engine.showErrors(new String[]{"Please enter both an Identifier type as well as its value."}); return; } voFilter.setHospNum(form.txtIDNum().getValue()); voFilter.setIDType(form.cmbIDType().getValue()); //WDEV-13065 -- if (form.txtIDNum().getValue() == null) voFilter.setDischDestination(form.cmbDischargeDestination().getValue()); voFilter.setForename(form.txtForeName().getValue()); voFilter.setSurname(form.txtSurname().getValue()); voFilter.setConsultant(form.qmbHCP().getValue()); voFilter.setFromDate(form.dteFrom().getValue()); voFilter.setToDate(form.dteTo().getValue()); if (voFilter.countFieldsWithValue() == 1 && voFilter.getIDTypeIsNotNull()) { engine.showMessage("Please enter some valid search criteria.", "Invalid search criteria", MessageButtons.OK, MessageIcon.ERROR); return; } form.getGlobalContext().STHK.setRecentDischargesListFilter(voFilter); DischargedEpisodeVoCollection voColl; if ((voFilter.countFieldsWithValue() == 1 && voFilter.getIDType() == null) || voFilter.countFieldsWithValue() > 1) { voColl = domain.listRecentDischarges(voFilter); } else { engine.showMessage("Please enter some search criteria.", "Invalid search criteria", MessageButtons.OK, MessageIcon.ERROR); return; } if (voColl == null || voColl.size() == 0) { engine.showMessage("No Recent Discharge records match your search criteria.", "No data found", MessageButtons.OK, MessageIcon.WARNING); return; } if (voColl != null) form.lblTotal().setValue("Total: " + String.valueOf(voColl.size())); if (voColl!=null) populateGrid(voColl); }