/** * WDEV-7506 * disconnectFromPasEvent * Check if there is a CareConext linked to this PasEvent * if there is, remove the link and close the carecontext * @param factory * @param peDo * @throws StaleObjectException */ private void disconnectFromPasEvent(DomainFactory factory, PASEvent peDo) throws StaleObjectException { if (!(ConfigFlag.HL7.INSTANTIATE_EPISODE_FROM_ADT.getValue()||ConfigFlag.HL7.INPATIENT_EPISODE_MANAGEMENT_FROM_PAS.getValue()||ConfigFlag.UI.MAXIMS_ADT_NO_INTERFACE.getValue())) return; List lst= CareContext.listCareContextByPasEvent(factory, peDo); if (lst != null && lst.size() > 0) { // Only one CareContext per pas event CareContext domCareContext = (CareContext) lst.get(0); domCareContext.setPasEvent(null); domCareContext.setEndDateTime(new java.util.Date()); //WDEV-10231 domCareContext.setCurrentStatus(new CareContextStatusHistory()); domCareContext.getCurrentStatus().setStatusDateTime(new Date()); domCareContext.getCurrentStatus().setStatus(getDomLookup(CareContextStatus.CANCELLED)); domCareContext.getStatusHistory().add(domCareContext.getCurrentStatus()); factory.save(domCareContext); } }
protected boolean checkIfCareContextCanBeCancelled(CareContextVo careContext) { if (careContext == null) return false; if (careContext.getCurrentStatus() != null && CareContextStatus.CANCELLED.equals(careContext.getCurrentStatus().getStatus())) return false; if (careContext.getClinicalContacts() != null) { for (ClinicalContactShortVo clinicalContact : careContext.getClinicalContacts()) { if (clinicalContact.getCurrentStatus() == null || ClinicalContactStatus.OPEN.equals(clinicalContact.getCurrentStatus().getStatus())) return false; } } return true; }
protected boolean chekIfCareContextsAreNotOpened(CareContextVo carecontext) { if (carecontext == null) return false; if (carecontext.getCurrentStatus() == null || CareContextStatus.OPEN.equals(carecontext.getCurrentStatus().getStatus()))// WDEV-14910 return false; else { for (int j = 0; carecontext.getClinicalContactsIsNotNull() && j < carecontext.getClinicalContacts().size(); j++) { if (checkIfClinicalContactsAreNotOpened(carecontext.getClinicalContacts().get(j)) == false) return false; } } return true; }
protected boolean chekIfCareContextsAreNotOpened(CareContextVo carecontext) { if( carecontext == null) return false; if( carecontext.getCurrentStatus() == null || CareContextStatus.OPEN.equals(carecontext.getCurrentStatus().getStatus()))// WDEV-14910 return false; else { for(int j = 0;carecontext.getClinicalContactsIsNotNull() && j < carecontext.getClinicalContacts().size();j++) { if( checkIfClinicalContactsAreNotOpened(carecontext.getClinicalContacts().get(j)) == false) return false; } } return true; }
public Boolean hasActiveCareContexts(EpisodeOfCareRefVo episodeOfCare) { if (episodeOfCare == null || episodeOfCare.getID_EpisodeOfCare() == null) return false; StringBuilder query = new StringBuilder(); query.append("SELECT COUNT(context.id) "); query.append(" FROM CareContext AS context LEFT JOIN context.episodeOfCare AS episode LEFT JOIN context.currentStatus AS curStatus LEFT JOIN curStatus.status AS status "); query.append(" WHERE episode.id = :EPISODE_CARE_ID AND status.id = :OPEN_STATUS"); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("EPISODE_CARE_ID"); paramValues.add(episodeOfCare.getID_EpisodeOfCare()); paramNames.add("OPEN_STATUS"); paramValues.add(CareContextStatus.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 CareContextRepatriationVo createCareContext(PatientRefVo patient, EpisodeOfCareRefVo episodeOfCare, PasEventRepatriationVo pasEvent, DateTime startDateTime, HcpLiteVo hcp, LocationRefVo location, ServiceLiteVo service, SourceOfReferral sourceOfReferral) { CareContextRepatriationVo careContext = new CareContextRepatriationVo(); careContext.setPasEvent(pasEvent); careContext.setContext(ContextType.REFERRAL); careContext.setEpisodeOfCare(episodeOfCare); careContext.setStartDateTime(startDateTime); careContext.setEndDateTime(null); careContext.setResponsibleHCP(hcp); CareContextStatusHistoryVo firstStatus = new CareContextStatusHistoryVo(); firstStatus.setStatus(CareContextStatus.OPEN); firstStatus.setStatusDateTime(startDateTime); careContext.setCurrentStatus(firstStatus); careContext.setStatusHistory(new CareContextStatusHistoryVoCollection()); careContext.getStatusHistory().add(firstStatus); return careContext; }
private CareContextForRequestServiceShortVo createCareContext(EpisodeOfCareForRequestServiceShortVo episodeOfCare, ContextType contextType, DateTime startDateTime, HcpRefVo responsibleHCP) { CareContextForRequestServiceShortVo careContext = new CareContextForRequestServiceShortVo(); careContext.setContext(contextType); careContext.setStartDateTime(startDateTime); careContext.setEndDateTime(null); careContext.setEpisodeOfCare(episodeOfCare); CareContextStatusHistoryVo firstStatus = new CareContextStatusHistoryVo(); firstStatus.setStatus(CareContextStatus.OPEN); firstStatus.setStatusDateTime(startDateTime); // careContext.setCurrentStatus(firstStatus); // careContext.setStatusHistory(new CareContextStatusHistoryVoCollection()); // careContext.getStatusHistory().add(firstStatus); if (episodeOfCare.getCareContexts() == null) episodeOfCare.setCareContexts(new CareContextForRequestServiceShortVoCollection()); episodeOfCare.getCareContexts().add(careContext); return careContext; }
private boolean careContextIsCancelled(CareContextVo voCareContext) { if (voCareContext == null) throw new CodingRuntimeException("voCareContext cannot be null in method careContextIsCancelled"); if(voCareContext.getCurrentStatusIsNotNull() && voCareContext.getCurrentStatus().getStatusIsNotNull()) { if(voCareContext.getCurrentStatus().getStatus().equals(CareContextStatus.CANCELLED)) return true; } return false; }
private void open() { PatientShort patient = domain.getPatient(form.getGlobalContext().Core.getPatientShort()); form.getGlobalContext().Core.setPatientShort(patient); AdmissionDetailVo currentAdmissionDet =null; CareContextVo tempCareContext = (form.getGlobalContext().Core.getCurrentCareContextIsNotNull() ? domain.getCareContextByCareContextRef(form.getGlobalContext().Core.getCurrentCareContext()) :null ); if (tempCareContext!=null && tempCareContext.getPasEventIsNotNull() && tempCareContext.getCurrentStatusIsNotNull() && CareContextStatus.OPEN.equals(tempCareContext.getCurrentStatus().getStatus()) ) { currentAdmissionDet=domain.getAdmissionDetailByPasEvent(form.getGlobalContext().Core.getCurrentCareContext().getPasEvent()); } else if (patient.getWardIsNotNull()) { currentAdmissionDet = domain.getAdmissionDetail(patient); if (currentAdmissionDet!=null && currentAdmissionDet.getPasEventIsNotNull()) { form.getGlobalContext().Core.setCurrentCareContext(domain.getCareContext(currentAdmissionDet.getPasEvent())); } } EpisodeofCareShortVo episodeOfCare = form.getGlobalContext().Core.getEpisodeofCareShort(); CareContextShortVo careContext = form.getGlobalContext().Core.getCurrentCareContext(); form.lyrADT().tabAdmissionDetails().ccAdmissionDetails().initialize(patient, episodeOfCare, careContext, currentAdmissionDet); form.lyrADT().tabDischargeDetails().ccDischargeDetails().initialize(patient, episodeOfCare, careContext, currentAdmissionDet,form.getLocalContext().getIsOpenedFromInpatientListForm()); //wdev-16427 if( form.getLocalContext().getIsOpenedFromInpatientListFormIsNotNull() && Boolean.TRUE.equals(form.getLocalContext().getIsOpenedFromInpatientListForm())) //wdev-16427 { form.lyrADT().tabDischargeDetails().ccDischargeDetails().setMode(FormMode.EDIT); form.lyrADT().showtabDischargeDetails(); form.setMode(FormMode.EDIT); } else form.setMode(FormMode.VIEW); }
public EDischargeSTHKSummaryVoCollection getSTHKPatientDocuments() { DomainFactory factory = getDomainFactory(); String sql = "select summ from Summary as summ left join summ.careContext as cCtxt left join cCtxt.currentStatus as cStat where summ.dischargeLetterStatus.id = -1719 and ( summ.tTAStatus = -2084 or summ.tTAStatus = -2075) and cStat.status not in (:id1) "; List lst = factory.find(sql,new String[]{"id1"}, new Object[]{getDomLookup(CareContextStatus.CANCELLED)}); if(lst != null && !lst.isEmpty()) { System.out.println(new DateTime().toString() + ": No of results : " + lst.size()); return EDischargeSTHKSummaryVoAssembler.createEDischargeSTHKSummaryVoCollectionFromSummary(lst); } return null; }
public EDischargeSTHKSummaryVoCollection getSTHKSuppPatientDocuments() { DomainFactory factory = getDomainFactory(); String sql = "select summ from Summary as summ left join summ.careContext as cCtxt left join cCtxt.currentStatus as cStat where summ.dischargeLetterStatus.id = -1727 and summ.dischargeSupplementaryLetterStatus.id = -1821 and ( summ.tTAStatus = -2084 or summ.tTAStatus = -2075) and cStat.status not in (:id1)"; List lst = factory.find(sql,new String[]{"id1"}, new Object[]{getDomLookup(CareContextStatus.CANCELLED)}); if(lst != null && !lst.isEmpty()) { System.out.println(new DateTime().toString() + ": No of results : " + lst.size()); return EDischargeSTHKSummaryVoAssembler.createEDischargeSTHKSummaryVoCollectionFromSummary(lst); } return null; }
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; }
private CareContextAdmitVo createCareContext(EpisodeOfCareAdmitVo episodeOfCare, ContextType contextType, PasEventAdmitVo pasEvent, DateTime startDateTime, Date estimatedDischargeDate, HcpRefVo responsibleHCP, ContactLocation locationType, String bedNumber) { CareContextAdmitVo careContext = new CareContextAdmitVo(); careContext.setContext(contextType); careContext.setStartDateTime(startDateTime); careContext.setEndDateTime(null); careContext.setResponsibleHCP(responsibleHCP); careContext.setEpisodeOfCare(episodeOfCare); careContext.setPasEvent(pasEvent); careContext.setBedNumber(bedNumber); careContext.setEstimatedDischargeDate(estimatedDischargeDate); CareContextStatusHistoryVo firstStatus = new CareContextStatusHistoryVo(); firstStatus.setStatus(CareContextStatus.OPEN); firstStatus.setStatusDateTime(startDateTime); careContext.setCurrentStatus(firstStatus); careContext.setStatusHistory(new CareContextStatusHistoryVoCollection()); careContext.getStatusHistory().add(firstStatus); if (episodeOfCare.getCareContexts() == null) episodeOfCare.setCareContexts(new CareContextAdmitVoCollection()); episodeOfCare.getCareContexts().add(careContext); return careContext; }