public int compare(InpatientEpisodeVo o1, InpatientEpisodeVo o2) { if (o1.getWardStaysIsNotNull() && o1.getWardStays().size() > 1 && o2.getWardStaysIsNotNull() && o2.getWardStays().size() > 1) { // Sort ward stays o1.getWardStays().sort(WardStayVo.getWardStayVoIdComparator()); o2.getWardStays().sort(WardStayVo.getWardStayVoIdComparator()); WardStayVo previousStay1 = o1.getWardStays().get(1); WardStayVo previousStay2 = o2.getWardStays().get(1); return previousStay1.getTransferDateTime().compareTo(previousStay2.getTransferDateTime()) * direction; } if (o1.getWardStaysIsNotNull() && o1.getWardStays().size() > 1 && (!o2.getWardStaysIsNotNull() || o2.getWardStays().size() <= 1)) { return direction; } if ((!o1.getWardStaysIsNotNull() || o1.getWardStays().size() <= 1) && o2.getWardStaysIsNotNull() && o2.getWardStays().size() > 1) { return -1 * direction; } return 0; }
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 InpatientEpisodeVo updateAdditionalAdmissionInfoOnEdit(InpatientEpisodeVo inpatientEpisode) { if (inpatientEpisode == null) return null; WardStayVo admissionWardStay = getWardStayForAdmission(inpatientEpisode); DateTime admissionDateTime = inpatientEpisode.getAdmissionDetailUpdates().getAdmissionDateTime(); if (admissionWardStay != null) { admissionWardStay.setTransferDateTime(admissionDateTime); } ConsultantStayLiteVo admissionConsultantStay = getConsultantStayForAdmission(inpatientEpisode); if (admissionConsultantStay != null) { admissionConsultantStay.setTransferDateTime(admissionDateTime); } inpatientEpisode.setAdmissionDateTime(admissionDateTime); if (inpatientEpisode.getPasEventIsNotNull()) { inpatientEpisode.getPasEvent().setEventDateTime(admissionDateTime); } if (inpatientEpisode.getBedIsNotNull() && inpatientEpisode.getBed().getCurrentBedStatusIsNotNull()) { inpatientEpisode.getBed().getCurrentBedStatus().setStatusDateTime(admissionDateTime); } return inpatientEpisode; }
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; }
/** * Function used to create the Ward Stay record * @param outsideHoursAdmitReason * @param outsideHoursAdmitComment * @param genderBreachAdmitReason * @param genderBreachAdmitComment * @param admittedInMixedGenderBay * @return */ private WardStayVo createWardStay( ReasonForAdmissionOutOfOpeningHours outsideHoursAdmitReason, String outsideHoursAdmitComment, ReasonForAdmissionToGenderSpecificBay genderBreachAdmitReason, String genderBreachAdmitComment, Boolean admittedInMixedGenderBay) { WardStayVo wardStay = new WardStayVo(); wardStay.setTransferDateTime(form.dtimAdmitDateTime().getValue()); wardStay.setTransferOutDateTime(null); wardStay.setWard(form.cmbWard().getValue()); wardStay.setWardType(form.cmbWardType().getValue()); wardStay.setBay(domain.getLocationLite(form.getGlobalContext().Core.getWardViewPatientListBay())); wardStay.setBedSpace(null); wardStay.setPatientStatus(form.cmbPatientCategory().getValue()); wardStay.setService(form.qmbService().getValue()); wardStay.setReasonAdmittingOutsideHours(outsideHoursAdmitReason); wardStay.setReasonAdmittingOutsideHoursComment(outsideHoursAdmitComment); wardStay.setReasonGenderBreach(genderBreachAdmitReason); wardStay.setReasonGenderBreachComment(genderBreachAdmitComment); wardStay.setAdmitedInMixedGenderBay(admittedInMixedGenderBay); // Return newly created Ward Stay record return wardStay; }
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 LocationLiteVo getDischargingWard(DischargedEpisodeMaintenanceVo episode, WardStayVo stay, boolean isTheMostRecentStay) { if (episode == null) return null; LocationLiteVo dischargingWard = episode.getDischargingWard(); LocationLiteVo newDischargingWard = null; if (stay.getID_WardStay() == null && stay.getTransferOutDateTimeIsNotNull() && stay.getTransferOutDateTime().isGreaterOrEqualThan(episode.getDischargeDateTime())) newDischargingWard = stay.getWard(); else if (isTheMostRecentStay && stay.getTransferOutDateTimeIsNotNull() && stay.getTransferOutDateTime().isGreaterOrEqualThan(episode.getDischargeDateTime())) newDischargingWard = stay.getWard(); return newDischargingWard != null ? newDischargingWard : dischargingWard; }
private void rieWardStay() throws PresentationLogicException{ WardStayVo stay = form.ctn1().grdWardTransfersGrid().getValue(); try { domain.rIEWardStay(stay); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); return; } open(); }
protected void onBtnEditWardTransferClick() throws PresentationLogicException { if(form.ctn1().grdWardTransfersGrid().getSelectedRow()==null) { engine.showMessage("Please select a Stay to Edit."); return; } WardStayVo stay = form.ctn1().grdWardTransfersGrid().getValue(); boolean isDischargedEpisodeSelected = form.grdHistoricalInpatientEpisodes().getValue() != null; engine.open(form.getForms().Core.WardConsultantSpecialtyTransferDlg, new Object[]{WardConsultationSpecialtyTransfer.WARD,stay,getWardStays(), isDischargedEpisodeSelected},"Edit Ward Stay"); //WDEV-23203 }
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; }
@Override public int compare(WardStayVo a, WardStayVo b) { if(a!=null&&b!=null &&a.getTransferDateTime()!=null&&b.getTransferDateTime()!=null) { return a.getTransferDateTime().isGreaterThan( b.getTransferDateTime()) ? -1 : a.getTransferDateTime().equals(b.getTransferDateTime()) ? 0 : 1; } return 0; }
@Override public int compare(WardStayVo a, WardStayVo b) { if(a.getTransferDateTimeIsNotNull()&&b.getTransferDateTimeIsNotNull()) { return a.getTransferDateTime().isGreaterThan( b.getTransferDateTime()) ? -1 : a.getTransferDateTime().equals(b.getTransferDateTime()) ? 0 : 1; } else { return 0; } }
private void populateWardRowFromStay(grdWardTransfersGridRow row,WardStayVo stay) { if(stay!=null) { if(stay.getWardIsNotNull()) { row.setColumnWard(stay.getWard().getName()); row.setCellColumnWardTooltip(stay.getWard().getName());//WDEV-22948 } if(stay.getTransferDateTimeIsNotNull()) { row.setColumnDateFrom(stay.getTransferDateTime().getDate()); } if(stay.getTransferOutDateTimeIsNotNull()) { row.setColumnDateTo(stay.getTransferOutDateTime().getDate()); } if(stay.getPatientStatusIsNotNull()) { row.setColumnPatientCategory(stay.getPatientStatus().getText()); } if(stay.getServiceIsNotNull()) { row.setColumnService(stay.getService().getServiceName()); row.setCellColumnServiceTooltip(stay.getService().getServiceName());//WDEV-22948 } row.setValue(stay); } }
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; }
@Override public void rIEWardStay(WardStayVo stay) throws StaleObjectException { DomainFactory factory = getDomainFactory(); WardStay stayDom = WardStayVoAssembler.extractWardStay(factory, stay); stayDom.setIsRIE(true); factory.save(stayDom); }
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; }
public AdmissionDetailVo saveEmergencyAdmissionInElectiveCase(AdmissionDetailVo admission, CareSpellVo careSpell, CatsReferralEmergencyAdmissionVo catsReferral, BedSpaceStateLiteVo bedSpaceState, WardStayVo wardStay, ConsultantStayVo consultant) throws DomainInterfaceException, StaleObjectException { if (admission == null) throw new CodingRuntimeException("Admission Details parameter is mandatory."); if (careSpell == null) throw new CodingRuntimeException("Care Spell parameter is mandatory."); if (catsReferral == null) throw new CodingRuntimeException("Cats Referral parameter is mandatory."); PatientPathwayJourneyRefVo journey = createPatientJourney(catsReferral, admission); catsReferral.setJourney(journey); @SuppressWarnings("rawtypes") HashMap domMap = new HashMap(); AdmissionDetail domAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admission, domMap); CareSpell domCareSpell = CareSpellVoAssembler.extractCareSpell(getDomainFactory(), careSpell, domMap); CatsReferral domCatsReferral = CatsReferralEmergencyAdmissionVoAssembler.extractCatsReferral(getDomainFactory(), catsReferral, domMap); domCatsReferral.getCareContext().setPasEvent(domAdmissionDetail.getPasEvent()); getDomainFactory().save(domAdmissionDetail); getDomainFactory().save(domCareSpell); getDomainFactory().save(domCatsReferral); InpatientEpisode inpatEpisode = new InpatientEpisode(); inpatEpisode.setPasEvent(domAdmissionDetail.getPasEvent()); inpatEpisode.getPasEvent().setConsultant(domAdmissionDetail.getConsultant()); inpatEpisode.setAdmissionDateTime(domAdmissionDetail.getAdmissionDateTime()); inpatEpisode.setEstDischargeDate(null); inpatEpisode.setWardType(domAdmissionDetail.getWardType()); if (wardStay != null) inpatEpisode.getWardStays().add(WardStayVoAssembler.extractWardStay(getDomainFactory(), wardStay, domMap)); if (consultant != null) inpatEpisode.getConsultantStays().add(ConsultantStayVoAssembler.extractConsultantStay(getDomainFactory(), consultant, domMap)); BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpaceState, domMap); if(doBedSpaceState != null) { doBedSpaceState.setInpatientEpisode(inpatEpisode); inpatEpisode.setBed(doBedSpaceState); inpatEpisode.setBedNo(doBedSpaceState.getBedSpace().getBedNumber()); } if (wardStay != null && wardStay.getWardIsNotNull() && ConfigFlag.UI.VTE_RISK_ASSESSMENT_FUNCTIONALITY.getValue() == true) { Location doloc = getLocation(wardStay.getWard().getID_Location(), getDomainFactory()); if (doloc != null && !Boolean.TRUE.equals(doloc.isVTEAsessmentNotRequired())) { inpatEpisode.setVTEAssessmentStatus(getDomLookup(VTEAsessmentStatus.REQUIRED)); } } getDomainFactory().save(inpatEpisode); return null; }
private void addEpisodeRow(IVTERiskAssessment ivteRiskAssessments) //WDEV-15414 { if(ivteRiskAssessments == null) return; grdPatientsRow row = form.grdPatients().getRows().newRow(); if(ivteRiskAssessments.getPasEvent() != null)//WDEV-15414 { row.setColHospNumber(ivteRiskAssessments.getPasEvent().getPatient().getHospNum() != null ? ivteRiskAssessments.getPasEvent().getPatient().getHospNum().getValue() : null);//WDEV-15414 row.setTooltipForColHospNumber(row.getColHospNumber()); row.setColSurname(ivteRiskAssessments.getPasEvent().getPatient().getName().getSurname());//WDEV-15414 row.setTooltipForColSurname(row.getColSurname()); row.setColForename(ivteRiskAssessments.getPasEvent().getPatient().getName().getForename());//WDEV-15414 row.setTooltipForColForename(row.getColForename()); row.setColDOB(ivteRiskAssessments.getPasEvent().getPatient().getDobIsNotNull() ? ivteRiskAssessments.getPasEvent().getPatient().getDob().toString() : null);//WDEV-15414 row.setTooltipForColDOB(row.getColDOB()); WardStayVo admWard = getMinById(ivteRiskAssessments.getWardStays()); //wdev-14992, WDEV-15414 //row.setColAdWard(inpatient.getPasEvent().getLocationIsNotNull() ? inpatient.getPasEvent().getLocation().getName() : null); row.setColAdWard(admWard != null && admWard.getWardIsNotNull() ? admWard.getWard().getName() : null); //wdev-14492 row.setTooltipForColAdWard(row.getColAdWard()); row.setColWard(ivteRiskAssessments.getPasEvent().getPatient().getWardIsNotNull() ? ivteRiskAssessments.getPasEvent().getPatient().getWard().getName() : null);//WDEV-15414 row.setTooltipForColWard(row.getColWard()); row.setColConsultant(ivteRiskAssessments.getPasEvent().getConsultantIsNotNull() ? ivteRiskAssessments.getPasEvent().getConsultant().getIHcpName() : null);//WDEV-15414 row.setTooltipForColConsultant(row.getColConsultant()); row.setColSpecialty(ivteRiskAssessments.getPasEvent().getSpecialtyIsNotNull() ? ivteRiskAssessments.getPasEvent().getSpecialty().getText() : null);//WDEV-15414 row.setTooltipForColSpecialty(row.getColSpecialty()); } row.setColAdmissionDate(ivteRiskAssessments.getAdmissionDateTime() != null ? ivteRiskAssessments.getAdmissionDateTime().toString() : null);//WDEV-15414 row.setTooltipForColAdmissionDate(row.getColAdmissionDate()); row.setColVTEStatus(VTEAsessmentStatus.REQUIRED.equals(ivteRiskAssessments.getVTEAssessmentStatus()) ? form.getImages().OCRR.Requested : (VTEAsessmentStatus.INPROGRESS.equals(ivteRiskAssessments.getVTEAssessmentStatus()) ? form.getImages().OCRR.InProgress : null));//WDEV-15414 row.setTooltipForColVTEStatus(ivteRiskAssessments.getVTEAssessmentStatus() != null ? ivteRiskAssessments.getVTEAssessmentStatus().getText() : null);//WDEV-15414 row.setValue(ivteRiskAssessments);//WDEV-15414 if(ivteRiskAssessments.getAdmissionDateTime() != null)//WDEV-15414 { DateTime admissionDate = (DateTime) ivteRiskAssessments.getAdmissionDateTime().clone();//WDEV-15414 DateTime kpi = admissionDate.addHours(ConfigFlag.UI.VTE_RISK_ASSESSMENT_KPI_EXCEEDED_PERIOD.getValue()); if(kpi.isLessThan(new DateTime()) && !VTEAsessmentStatus.COMPLETED.equals(ivteRiskAssessments.getVTEAssessmentStatus()))//WDEV-15414 { row.setBackColor(ConfigFlag.UI.VTE_RISK_ASSESSMENT_EXCEEDED_KPI_COLOR.getValue()); return; } DateTime currentDate = new DateTime(); DateTime breachWarning = ((DateTime) kpi.clone()).addHours(-ConfigFlag.UI.VTE_RISK_ASSESSMENT_BREACH_WARNING_PERIOD.getValue()); if(currentDate.isGreaterOrEqualThan(breachWarning) && currentDate.isLessOrEqualThan(kpi)) { row.setBackColor(ConfigFlag.UI.VTE_RISK_ASSESSMENT_BREACH_WARNING_COLOR.getValue()); } } }
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; }
private WardStayVo createWardStay(DateTime admissionDateTime, PatientStatus patientCategory, ServiceLiteVo serviceLiteVo, BedSpaceStateLiteVo bedSpaceState) { WardStayVo wardStay = new WardStayVo(); wardStay.setTransferDateTime(admissionDateTime); wardStay.setPatientStatus(patientCategory); wardStay.setService(serviceLiteVo); if (bedSpaceState != null) { wardStay.setBedSpace(bedSpaceState.getBedSpace()); wardStay.setWard(bedSpaceState.getWard()); wardStay.setBay(bedSpaceState.getBay()); if (bedSpaceState.getBedSpace() != null) { wardStay.setWardType(bedSpaceState.getBedSpace().getWardType()); if (form.getGlobalContext().Core.getBedRuleBreachReason() != null) { if (Boolean.TRUE.equals(form.getGlobalContext().Core.getBedRuleBreachReason().getIsPrivateBedAllocationValidated())) { wardStay.setReasonPrivateBedAllocated(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForPrivateBedAllocation()); wardStay.setReasonPrivateBedAllocatedComment(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForPrivateBedAllocationComment()); } if (Boolean.TRUE.equals(form.getGlobalContext().Core.getBedRuleBreachReason().getIsOohAllocationValidated())) { wardStay.setReasonAdmittingOutsideHours(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForAdmissionOutOfOpeningHours()); wardStay.setReasonAdmittingOutsideHoursComment(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForAdmissionOohComment()); } if (Boolean.TRUE.equals(form.getGlobalContext().Core.getBedRuleBreachReason().getIsMixingGenderBayValidated())) { wardStay.setReasonGenderBreach(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForMixingBayGender()); wardStay.setReasonGenderBreachComment(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForMixingBayGenderComment()); } } } } return wardStay; }
public Boolean saveAdmissionAndUpdateList(AdmissionDetailVo admissionDetail, WardStayVo wardStay, ConsultantStayVo consultantStay, CareSpellAdmitVo careSpell, CatsReferralEmergencyAdmissionVo referral, Object selectedAdmissionData, PatientCaseNoteTransferVoCollection caseNoteTransfers) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException { // AdmissionDetail domAdmissionDetail = AdmissionDetailShortVoAssembler.extractAdmissionDetail(getDomainFactory(), admissionDetail); // getDomainFactory().save(domAdmissionDetail); // AdmissionDetailVo admissionDetails = AdmissionDetailVoAssembler.create(domAdmissionDetail); // admissionDetails.validate(); PendingElectiveAdmissionAdmitVo pendingBookedElectiveAdmission = selectedAdmissionData instanceof PendingElectiveAdmissionAdmitVo ? (PendingElectiveAdmissionAdmitVo) selectedAdmissionData : null; PendingEmergencyAdmissionAdmitVo pendingEDEmergency = selectedAdmissionData instanceof PendingEmergencyAdmissionAdmitVo ? (PendingEmergencyAdmissionAdmitVo) selectedAdmissionData : null; PendingElectiveAdmissionAdmitVo pendingElectiveAdmission = selectedAdmissionData instanceof PendingElectiveAdmissionAdmitVo ? (PendingElectiveAdmissionAdmitVo) selectedAdmissionData : null; CatsReferralPendingEmergencyNonEDAdmissionListVo pendingEmergencyAdmission = selectedAdmissionData instanceof CatsReferralPendingEmergencyNonEDAdmissionListVo ? (CatsReferralPendingEmergencyNonEDAdmissionListVo) selectedAdmissionData : null; PatientElectiveListBedAdmissionVo patientTCI_ElectiveList = selectedAdmissionData instanceof PatientElectiveListBedAdmissionVo ? (PatientElectiveListBedAdmissionVo) selectedAdmissionData : null; AdmissionType admissionType = AdmissionType.EMERGENCY; BedAdmissionComponent impl = (BedAdmissionComponent) getDomainImpl(BedAdmissionComponentImpl.class); if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()) && selectedAdmissionData instanceof PatientElectiveListBedAdmissionVo) { PatientElectiveListBedAdmissionVo electiveAdmission = impl.saveTCIAdmissionAndUpdateList(patientTCI_ElectiveList, null, wardStay, consultantStay, null, null, null, caseNoteTransfers); impl.createCaseNoteRequests(electiveAdmission); } // else if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()) && selectedAdmissionData instanceof PatientLite_IdentifiersVo) // { // CareSpellVo careSpell = createCareSpell((PatientLite_IdentifiersVo) selectedAdmissionData, admissionDetail.getPasEvent(), admissionDetail.getAdmissionDateTime(), admissionDetail.getConsultant(), admissionDetail.getService()); // CatsReferralEmergencyAdmissionVo catsReferral = createCatsReferral((PatientLite_IdentifiersVo) selectedAdmissionData, admissionDetail, careSpell); // // impl.saveEmergencyAdmissionInElectiveCase(admissionDetail, // Admission Detail // careSpell, // Care Spell // catsReferral, // Cats Referral // null, // Bed Space State - null when Admitting to Ward // wardStay, // Ward Stay // consultantStay, // Consultant Stay // null, // Admission Reason // null, // Ward Mixed Sex Breach // null, // Ward Bay Config // caseNoteTransfers); // Patient Case Note Transfer // } else { impl.saveAdmissionAndUpdateList(admissionDetail, // Admission Detail null, // Bed Space State - null when Admitting to Ward careSpell, referral, wardStay, // Ward Stay consultantStay, // Consultant Stay pendingBookedElectiveAdmission, // Pending Elective Admission - Planned (Booked) pendingEDEmergency, // Pending Emergency Admission - ED pendingElectiveAdmission, // Pending Elective Admission - (TCI) pendingEmergencyAdmission, // Pending Emergency Admission - Non ED admissionType, // Admission Type null, // Admission Reason null, // Ward Mixed Sex Breach null, // Ward Bay Config caseNoteTransfers); // Patient Case Note Transfer } //WDEV-21973 make sure patient has a Case Note Folder impl.createCaseNoteFolderIfNone(admissionDetail.getPasEvent().getPatient()); return true; }