protected boolean checkIfEpisodeOfCareCanBeCancelled(EpisodeofCareVo episodeOfCare) { boolean episode = false; if (episodeOfCare == null) return episode; if (episodeOfCare.getCurrentStatus() == null || EpisodeOfCareStatus.OPEN.equals(episodeOfCare.getCurrentStatus().getStatus()))// WDEV-14910 { episode = true; for (int j = 0; episodeOfCare.getCareContextsIsNotNull() && j < episodeOfCare.getCareContexts().size(); j++) { if (chekIfCareContextsAreNotOpened(episodeOfCare.getCareContexts().get(j)) == false) episode = false; } } return episode; }
protected boolean checkIfEpisodeOfCaresAreNotOpened(EpisodeofCareVo episode) { if (episode == null) return false; if (episode.getCurrentStatus() == null || EpisodeOfCareStatus.OPEN.equals(episode.getCurrentStatus().getStatus()))// WDEV-14910 return false; else { for (int i = 0; episode.getCareContextsIsNotNull() && i < episode.getCareContexts().size(); i++) { if (chekIfCareContextsAreNotOpened(episode.getCareContexts().get(i)) == false) return false; } } return true; }
protected boolean checkIfEpisodeOfCareCanBeCancelled(EpisodeofCareVo episodeOfCare) { boolean episode = false; if( episodeOfCare == null) return episode; if(episodeOfCare.getCurrentStatus() == null || EpisodeOfCareStatus.OPEN.equals(episodeOfCare.getCurrentStatus().getStatus()))// WDEV-14910 { episode = true; for(int j = 0;episodeOfCare.getCareContextsIsNotNull() && j < episodeOfCare.getCareContexts().size();j++) { if( chekIfCareContextsAreNotOpened(episodeOfCare.getCareContexts().get(j)) == false) episode = false; } } return episode; }
protected boolean checkIfEpisodeOfCaresAreNotOpened(EpisodeofCareVo episode) { if(episode == null) return false; if(episode.getCurrentStatus() == null || EpisodeOfCareStatus.OPEN.equals(episode.getCurrentStatus().getStatus()))// WDEV-14910 return false; else { for(int i = 0;episode.getCareContextsIsNotNull() && i < episode.getCareContexts().size();i++) { if( chekIfCareContextsAreNotOpened(episode.getCareContexts().get(i)) == false) return false; } } return true; }
public Boolean hasActiveEpisodeOfCare(CareSpellRefVo careSpell) { if (careSpell == null || careSpell.getID_CareSpell() == null) return false; StringBuilder query = new StringBuilder(); query.append("SELECT COUNT(episode.id) "); query.append(" FROM EpisodeOfCare AS episode LEFT JOIN episode.careSpell AS careSpell LEFT JOIN episode.currentStatus AS curStatus LEFT JOIN curStatus.status AS status "); query.append(" WHERE careSpell.id = :CARE_SPELL_ID AND status.id = :OPEN_STATUS"); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("CARE_SPELL_ID"); paramValues.add(careSpell.getID_CareSpell()); paramNames.add("OPEN_STATUS"); paramValues.add(EpisodeOfCareStatus.OPEN.getID()); long count = getDomainFactory().countWithHQL(query.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray(new Object[paramValues.size()])); if (count > 0) return true; return false; }
private EpisodeOfCareAdmitVo createEpisodeOfCare(CareSpellAdmitVo careSpell, DateTime startDateTime, HcpRefVo responsibleHCP, Specialty specialty) { EpisodeOfCareAdmitVo episodeOfCare = new EpisodeOfCareAdmitVo(); episodeOfCare.setStartDate(startDateTime.getDate()); episodeOfCare.setEndDate(null); episodeOfCare.setCareSpell(careSpell); episodeOfCare.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY); episodeOfCare.setSpecialty(specialty); episodeOfCare.setResponsibleHCP(responsibleHCP); EpisodeOfCareStatusHistoryVo firstStatus = new EpisodeOfCareStatusHistoryVo(); firstStatus.setStatus(EpisodeOfCareStatus.OPEN); firstStatus.setStatusDateTime(startDateTime); episodeOfCare.setCurrentStatus(firstStatus); episodeOfCare.setStatusHistory(new EpisodeOfCareStatusHistoryVoCollection()); episodeOfCare.getStatusHistory().add(firstStatus); if (careSpell.getEpisodes() == null) careSpell.setEpisodes(new EpisodeOfCareAdmitVoCollection()); careSpell.getEpisodes().add(episodeOfCare); return episodeOfCare; }
private EpisodeOfCareRepatriationVo createEpisodeOfCare(PatientRefVo patient, CareSpellRefVo careSpell, PasEventRepatriationVo pasEvent, DateTime startDateTime, HcpLiteVo hcp, LocationRefVo location, ServiceLiteVo service, SourceOfReferral sourceOfReferral) { EpisodeOfCareRepatriationVo episodeOfCare = new EpisodeOfCareRepatriationVo(); episodeOfCare.setCareSpell(careSpell); episodeOfCare.setResponsibleHCP(hcp); episodeOfCare.setSpecialty(service != null ? service.getSpecialty() : null); episodeOfCare.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY); episodeOfCare.setStartDate(startDateTime.getDate()); episodeOfCare.setEndDate(null); EpisodeOfCareStatusHistoryVo firstStatus = new EpisodeOfCareStatusHistoryVo(); firstStatus.setStatus(EpisodeOfCareStatus.OPEN); firstStatus.setStatusDateTime(startDateTime); episodeOfCare.setCurrentStatus(firstStatus); episodeOfCare.setStatusHistory(new EpisodeOfCareStatusHistoryVoCollection()); episodeOfCare.getStatusHistory().add(firstStatus); episodeOfCare.setCareContexts(new CareContextRepatriationVoCollection()); episodeOfCare.getCareContexts().add(createCareContext(patient, episodeOfCare, pasEvent, startDateTime, hcp, location, service, sourceOfReferral)); return episodeOfCare; }
private EpisodeOfCareForRequestServiceShortVo createEpisodeOfCare(CareSpellForRequestServiceShortVo careSpell, DateTime startDateTime, HcpRefVo responsibleHCP, Specialty specialty) { EpisodeOfCareForRequestServiceShortVo episodeOfCare = new EpisodeOfCareForRequestServiceShortVo(); episodeOfCare.setStartDate(startDateTime.getDate()); episodeOfCare.setCareSpell(careSpell); episodeOfCare.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY); episodeOfCare.setSpecialty(specialty); episodeOfCare.setResponsibleHCP(responsibleHCP); EpisodeOfCareStatusHistoryVo firstStatus = new EpisodeOfCareStatusHistoryVo(); firstStatus.setStatus(EpisodeOfCareStatus.OPEN); firstStatus.setStatusDateTime(startDateTime); episodeOfCare.setCurrentStatus(firstStatus); episodeOfCare.setStatusHistory(new EpisodeOfCareStatusHistoryRefVoCollection()); episodeOfCare.getStatusHistory().add(firstStatus); if (careSpell.getEpisodes() == null) careSpell.setEpisodes(new EpisodeOfCareForRequestServiceShortVoCollection()); careSpell.getEpisodes().add(episodeOfCare); return episodeOfCare; }
private boolean parentCancelled() { Object selectedValue = form.dyngrdList().getValue(); if (selectedValue instanceof EpisodeofCareVo) { CareSpellVo careSpell = (CareSpellVo) form.dyngrdList().getSelectedRow().getParent().getValue(); if (careSpell.getCurrentStatus() != null && ProblemGroupStatus.CANCELLED.equals(careSpell.getCurrentStatus().getStatus())) return true; } if (selectedValue instanceof CareContextVo) { EpisodeofCareVo episodeOfCare = (EpisodeofCareVo) form.dyngrdList().getSelectedRow().getParent().getValue(); if (episodeOfCare.getCurrentStatus() != null && EpisodeOfCareStatus.CANCELLED.equals(episodeOfCare.getCurrentStatus().getStatus())) return true; } if (selectedValue instanceof ClinicalContactShortVo) { CareContextVo careContext = (CareContextVo) form.dyngrdList().getSelectedRow().getParent().getValue(); if (careContext.getCurrentStatus() != null && CareContextStatus.CANCELLED.equals(careContext.getCurrentStatus().getStatus())) return true; } return false; }
private void updateContextMenuState() { form.getContextMenus().getClinicalContactsListViewCancelledContextsItem().setVisible(!ConfigFlag.UI.PATIENT_SUMMARY_SHOW_CANCELLED_CONTEXTS_BY_DEFAULT.getValue()); //wdev-13977 -> modified in WDEV-14909 form.getContextMenus().getClinicalContactsListHideCancelledContextsItem().setVisible(ConfigFlag.UI.PATIENT_SUMMARY_SHOW_CANCELLED_CONTEXTS_BY_DEFAULT.getValue()); // WDEV-14909 boolean isProblemGroupSelected = form.grdList().getSelectedRow() != null && form.grdList().getSelectedRow().getValue() instanceof CareSpellVo; boolean isProblemGroupCancelled = isProblemGroupSelected && ((CareSpellVo) form.grdList().getSelectedRow().getValue()).getCurrentStatus() != null && ProblemGroupStatus.CANCELLED.equals(((CareSpellVo) form.grdList().getSelectedRow().getValue()).getCurrentStatus().getStatus()); form.getContextMenus().getClinicalContactsListUndoCancelProblemGroupItem().setVisible(isProblemGroupSelected && isProblemGroupCancelled); boolean isEpisodeOfCareSelected = form.grdList().getSelectedRow() != null && form.grdList().getSelectedRow().getValue() instanceof EpisodeofCareVo; boolean isEpisodeOfCareCancelled = isEpisodeOfCareSelected && ((EpisodeofCareVo) form.grdList().getSelectedRow().getValue()).getCurrentStatus() != null && EpisodeOfCareStatus.CANCELLED.equals(((EpisodeofCareVo) form.grdList().getSelectedRow().getValue()).getCurrentStatus().getStatus()); form.getContextMenus().getClinicalContactsListUndoCancelEpisodeOfCareItem().setVisible(isEpisodeOfCareSelected && isEpisodeOfCareCancelled && !parentCancelled()); boolean isCareContextSelected = form.grdList().getSelectedRow() != null && form.grdList().getSelectedRow().getValue() instanceof CareContextVo; boolean isCareContextCancelled = isCareContextSelected && ((CareContextVo) form.grdList().getSelectedRow().getValue()).getCurrentStatus() != null && CareContextStatus.CANCELLED.equals(((CareContextVo) form.grdList().getSelectedRow().getValue()).getCurrentStatus().getStatus()); form.getContextMenus().getClinicalContactsListUndoCancelCareContextItem().setVisible(isCareContextSelected && isCareContextCancelled && !parentCancelled()); boolean isClinicalContactSelected = form.grdList().getSelectedRow() != null && form.grdList().getSelectedRow().getValue() instanceof ClinicalContactShortVo; boolean isClinicalContactCancelled = isClinicalContactSelected && ((ClinicalContactShortVo) form.grdList().getSelectedRow().getValue()).getCurrentStatus() != null && ClinicalContactStatus.CANCELLED.equals(((ClinicalContactShortVo) form.grdList().getSelectedRow().getValue()).getCurrentStatus().getStatus()); form.getContextMenus().getClinicalContactsListUndoCancelClinicalContactItem().setVisible(isClinicalContactSelected && isClinicalContactCancelled && !parentCancelled()); }
private boolean parentCancelled() { ValueObject selectedValue = form.grdList().getValue(); if (selectedValue instanceof EpisodeofCareVo) { CareSpellVo careSpell = (CareSpellVo) form.grdList().getSelectedRow().getParentRow().getValue(); if (careSpell.getCurrentStatus() != null && ProblemGroupStatus.CANCELLED.equals(careSpell.getCurrentStatus().getStatus())) return true; } if (selectedValue instanceof CareContextVo) { EpisodeofCareVo episodeOfCare = (EpisodeofCareVo) form.grdList().getSelectedRow().getParentRow().getValue(); if (episodeOfCare.getCurrentStatus() != null && EpisodeOfCareStatus.CANCELLED.equals(episodeOfCare.getCurrentStatus().getStatus())) return true; } if (selectedValue instanceof ClinicalContactShortVo) { CareContextVo careContext = (CareContextVo) form.grdList().getSelectedRow().getParentRow().getValue(); if (careContext.getCurrentStatus() != null && CareContextStatus.CANCELLED.equals(careContext.getCurrentStatus().getStatus())) return true; } return false; }