private void loadEpisodes() { //WDEV-13001 if(ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue()) { PatientRefVo voPat = getSelectedPatient(); if(voPat != null) { EpisodeOfCareWithPrimaryDiagnosisVoCollection voCollEpisodes = domain.listOpenEpisodesForPatient(getSelectedPatient()); if(voCollEpisodes != null) { for(EpisodeOfCareWithPrimaryDiagnosisVo voEpis : voCollEpisodes) form.cmbEpisode().newRow(voEpis, voEpis.toString()); // WDEV-16054 If only one episode, set this as the value in the combo if (voCollEpisodes.size() == 1) form.cmbEpisode().setValue(voCollEpisodes.get(0)); } } } }
public EpisodeOfCareWithPrimaryDiagnosisVoCollection listOpenEpisodesForPatient(PatientRefVo patient) { if (patient == null || patient.getID_Patient() == null) throw new CodingRuntimeException("patient is null or id not provided in method listOpenEpisodesForPatient"); EpisodeOfCareWithPrimaryDiagnosisVoCollection voCollEpisodes = null; String hql = "from EpisodeOfCare as epis left join fetch epis.responsibleHCP as hcp left join fetch hcp.mos as mos left join fetch epis.careSpell as cs where epis.endDate is null and cs.patient.id = " + patient.getID_Patient(); List episodes = getDomainFactory().find(hql); if(episodes != null) { voCollEpisodes = EpisodeOfCareWithPrimaryDiagnosisVoAssembler.createEpisodeOfCareWithPrimaryDiagnosisVoCollectionFromEpisodeOfCare(episodes); for(EpisodeOfCareWithPrimaryDiagnosisVo voEpis : voCollEpisodes) { //get the primary diagnosis if it exists String primaryHql = "select distinct primary.diagnosisDescription from CsPrimaryDiagnosis as csp left join csp.diagnosis as primary where (csp.episodeOfCare.id = :episId and csp.isActive = :status)"; List diagnosisNames = getDomainFactory().find(primaryHql, new String[]{"episId", "status"}, new Object[]{ voEpis.getID_EpisodeOfCare(), Boolean.TRUE}); if(diagnosisNames != null && diagnosisNames.size() > 0) { String strDisplay = ""; int i=0; Iterator it = diagnosisNames.iterator(); while(it.hasNext()) { if(i > 0) strDisplay += ","; strDisplay += (String)it.next(); i++; } if(strDisplay.equals("")) strDisplay = "unknown"; voEpis.setPrimaryDiagnosisName(" - " + strDisplay + " - "); } else voEpis.setPrimaryDiagnosisName(" - unknown - "); } } return voCollEpisodes; }
public EpisodeOfCareWithPrimaryDiagnosisVoCollection listOpenEpisodesForPatient(PatientRefVo patient) { if (patient == null || patient.getID_Patient() == null) throw new CodingRuntimeException("patient is null or id not provided in method listOpenEpisodesForPatient"); EpisodeOfCareWithPrimaryDiagnosisVoCollection voCollEpisodes = null; String hql = "from EpisodeOfCare as epis left join fetch epis.responsibleHCP as hcp left join fetch hcp.mos as mos left join fetch epis.careSpell as cs where epis.endDate is null and cs.patient.id = " + patient.getID_Patient(); List episodes = getDomainFactory().find(hql); if(episodes != null) { voCollEpisodes = EpisodeOfCareWithPrimaryDiagnosisVoAssembler.createEpisodeOfCareWithPrimaryDiagnosisVoCollectionFromEpisodeOfCare(episodes); for(EpisodeOfCareWithPrimaryDiagnosisVo voEpis : voCollEpisodes) { //get the primary diagnosis if it exists String primaryHql = "select distinct primary.diagnosisDescription from CsPrimaryDiagnosis as csp left join csp.diagnosis as primary where (csp.episodeOfCare.id = :episId and csp.isActive = :status)"; List diagnosisNames = getDomainFactory().find(primaryHql, new String[]{"episId", "status"}, new Object[]{ voEpis.getID_EpisodeOfCare(), Boolean.TRUE}); if(diagnosisNames != null && diagnosisNames.size() > 0) { StringBuilder strDisplay = new StringBuilder(""); int i=0; Iterator it = diagnosisNames.iterator(); while(it.hasNext()) { if(i > 0) strDisplay.append(","); strDisplay.append((String)it.next()); i++; } if (strDisplay.toString().equals("")) strDisplay.append("unknown"); voEpis.setPrimaryDiagnosisName(" - " + strDisplay + " - "); } else voEpis.setPrimaryDiagnosisName(" - unknown - "); } } return voCollEpisodes; }