private WardStayVo getMinById(WardStayVoCollection coll) { WardStayVo tempVo = null; if( coll == null || coll.size() == 0 ) return null; for(int i = 0; i < coll.size();i++) { if( i == 0) tempVo = coll.get(i); else if( i > 0 ) { if( tempVo != null && coll.get(i) != null && tempVo.getID_WardStay() > coll.get(i).getID_WardStay()) tempVo = coll.get(i); } } return tempVo; }
private WardStayVo getLastClosedWardStay(InPatientEpisodeADTVo inpatientEpisode) { if (inpatientEpisode == null || inpatientEpisode.getWardStays() == null || inpatientEpisode.getWardStays().size() ==0) return null; WardStayVoCollection wardStaysColl = inpatientEpisode.getWardStays(); for (int i=wardStaysColl.size()-1;i>=0;i--) { if (wardStaysColl.get(i) != null && wardStaysColl.get(i).getTransferOutDateTime() == null) { wardStaysColl.remove(i); } } if (wardStaysColl.size() > 0) { wardStaysColl.sort(WardStayVo.getWardStayVoIdComparator(SortOrder.DESCENDING)); return wardStaysColl.get(0); } return null; }
private InPatientEpisodeADTVo populateEpisodeDataFromTransferInTab(InPatientEpisodeADTVo voEpisode) { if (voEpisode == null) throw new CodingRuntimeException("voEpisode is null in method populateEpisodeDataFromTransferInTab"); if (voEpisode.getPasEventIsNotNull()) { voEpisode.getPasEvent().setConsultant(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().ccInConsultant().getValue()); if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO")) { voEpisode.getPasEvent().setSpecialty(domain.getCCOSpecialtyMappingFromPASSpecialty(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbCCOInSpecialty().getValue())); voEpisode.getPasEvent().setPASSpecialty(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbCCOInSpecialty().getValue()); } else voEpisode.getPasEvent().setSpecialty(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbInSpecialty().getValue()); if (form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue() != null) voEpisode.getPasEvent().setLocation(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue().getDestinationWard()); } WardStayVo voWardStay = new WardStayVo(); voWardStay.setTransferDateTime(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dtimTransfer().getValue()); voWardStay.setBedSpace(form.getGlobalContext().Core.getSelectedBedSpaceState().getBedSpace()); if (form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue() != null) voWardStay.setWard(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue().getDestinationWard()); voWardStay.setWardType(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbWardType().getValue()); if (voEpisode.getWardStays() == null) voEpisode.setWardStays(new WardStayVoCollection()); voEpisode.getWardStays().add(voWardStay); voEpisode.setEstDischargeDate(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dteDischarge().getValue()); voEpisode.setWardType(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbWardType().getValue()); return voEpisode; }
private WardStayVo getCurrentWardStayRecord(WardStayVoCollection wardStays) { if (wardStays == null || wardStays.size() == 0) return null; for (WardStayVo wardStayVo : wardStays) { if (wardStayVo != null && wardStayVo.getTransferOutDateTime() == null) return wardStayVo; } return null; }
private InPatientEpisodeADTVo addNewWardStayAndUpdateCurrent(InPatientEpisodeADTVo voEpisode) { if (voEpisode == null) return null; //update of Current Ward Stay WardStayVo currentWardStayRecordVo = getCurrentWardStayRecord(voEpisode.getWardStays()); if (currentWardStayRecordVo != null) { currentWardStayRecordVo.setTransferOutDateTime(form.dtimTransferAccept().getValue()); voEpisode.getWardStays().set(voEpisode.getWardStays().indexOf(currentWardStayRecordVo), currentWardStayRecordVo); } //new Ward Stay Created on Accepting Transfer WardStayVo voWardStay = new WardStayVo(); voWardStay.setService(form.qmbService().getValue()); voWardStay.setTransferDateTime(form.dtimTransferAccept().getValue()); voWardStay.setBedSpace(null); voWardStay.setBay(null); voWardStay.setPatientStatus(form.cmbPatientStatus().getValue()); //WDEV-20223 voWardStay.setWard(form.getLocalContext().getSelectedPendingTransfer().getDestinationWard()); voWardStay.setWardType(form.cmbWardType().getValue()); voWardStay.setTransferReason(form.cmbTransfReason().getValue()); voWardStay.setTransferComment(form.txtTransfComment().getValue()); if (voEpisode.getWardStays() == null) voEpisode.setWardStays(new WardStayVoCollection()); voEpisode.getWardStays().add(voWardStay); return voEpisode; }
private WardStayVo getAdmissionWardStay(DateTime admissionDate, WardStayVoCollection stays) { if (admissionDate == null || stays == null) return null; for (WardStayVo vo : stays) { if (admissionDate.equals(vo.getTransferDateTime())) return vo; } return null; }
private String checkForOverLappingWardStay(WardConsultantSpecialtyTransferVo wardConsultantSpecialtyTransferVo,WardStayVoCollection stays) { if(stays!=null &&wardConsultantSpecialtyTransferVo!=null) { for (WardStayVo wardStayVo : stays) { if(wardStayVo!=null&&wardStayVo.getID_WardStay()!=null &&form.getLocalContext().getWardStayIsNotNull()&&form.getLocalContext().getWardStay()!=null &&wardStayVo.getID_WardStay()!=form.getLocalContext().getWardStay().getID_WardStay()) { if(wardStayVo.getTransferDateTimeIsNotNull()&&wardStayVo.getTransferOutDateTimeIsNotNull() &&wardConsultantSpecialtyTransferVo.getDateFromIsNotNull() &&wardConsultantSpecialtyTransferVo.getDateFrom().isGreaterThan(wardStayVo.getTransferDateTime()) &&wardConsultantSpecialtyTransferVo.getDateFrom().isLessThan(wardStayVo.getTransferOutDateTime())) { return "From Date overlaps with existing stay"; } if(wardStayVo.getTransferDateTimeIsNotNull()&&wardStayVo.getTransferOutDateTimeIsNotNull() &&wardConsultantSpecialtyTransferVo.getDateToIsNotNull() &&wardConsultantSpecialtyTransferVo.getDateTo().isGreaterThan(wardStayVo.getTransferDateTime()) &&wardConsultantSpecialtyTransferVo.getDateTo().isLessThan(wardStayVo.getTransferOutDateTime())) { return "To Date overlaps with existing stay"; } } } } return null; }
private WardStayVo getWardStayForAdmission(InpatientEpisodeVo inpatientEpisode) { WardStayVoCollection wardStays = inpatientEpisode.getWardStays(); if (wardStays == null) return null; for (int i=0;i<wardStays.size();i++) { if (wardStays.get(i) == null) continue; if (wardStays.get(i).getTransferDateTime() != null && wardStays.get(i).getTransferDateTime().equals(inpatientEpisode.getAdmissionDateTime())) return wardStays.get(i); } return null; }
private InPatientEpisodeADTVo addNewWardStayAndUpdateCurrent(InPatientEpisodeADTVo voEpisode) { if (voEpisode == null) return null; //update of Current Ward Stay WardStayVo currentWardStayRecordVo = getCurrentWardStayRecord(voEpisode.getWardStays()); PendingTransfersLiteVo gridValue =(PendingTransfersLiteVo)form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue(); if (currentWardStayRecordVo != null) { currentWardStayRecordVo.setTransferOutDateTime(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dtimTransfer().getValue()); voEpisode.getWardStays().set(voEpisode.getWardStays().indexOf(currentWardStayRecordVo), currentWardStayRecordVo); } //new Ward Stay Created on Accepting Transfer WardStayVo voWardStay = new WardStayVo(); voWardStay.setTransferDateTime(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dtimTransfer().getValue()); voWardStay.setBedSpace(form.getGlobalContext().Core.getSelectedBedSpaceState().getBedSpace()); voWardStay.setPatientStatus(gridValue.getPatientStatus()); //WDEV-20223 if (form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue() != null) voWardStay.setWard(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue().getDestinationWard()); voWardStay.setWardType(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbWardType().getValue()); voWardStay.setBay(form.getGlobalContext().Core.getSelectedBedSpaceState().getBay()); voWardStay.setTransferReason(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbTransferReason().getValue()); voWardStay.setTransferComment(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().txtTransferComment().getValue()); voWardStay.setService(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().qmbInService().getValue()); if (form.getGlobalContext().Core.getBedRuleBreachReasonIsNotNull()) { if (Boolean.TRUE.equals(form.getGlobalContext().Core.getBedRuleBreachReason().getIsPrivateBedAllocationValidated())) { voWardStay.setReasonPrivateBedAllocated(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForPrivateBedAllocation()); voWardStay.setReasonPrivateBedAllocatedComment(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForPrivateBedAllocationComment()); } if (Boolean.TRUE.equals(form.getGlobalContext().Core.getBedRuleBreachReason().getIsOohAllocationValidated())) { voWardStay.setReasonAdmittingOutsideHours(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForAdmissionOutOfOpeningHours()); voWardStay.setReasonAdmittingOutsideHoursComment(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForAdmissionOohComment()); } if (Boolean.TRUE.equals(form.getGlobalContext().Core.getBedRuleBreachReason().getIsMixingGenderBayValidated())) { voWardStay.setReasonGenderBreach(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForMixingBayGender()); voWardStay.setReasonGenderBreachComment(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForMixingBayGenderComment()); } } if (voEpisode.getWardStays() == null) voEpisode.setWardStays(new WardStayVoCollection()); voEpisode.getWardStays().add(voWardStay); return voEpisode; }