private CSDiagnosisAndProcedureTextAndTooltip getPrimaryDiagnosisAndProblems(CareSpellRefVo careSpellRefVo) { if (careSpellRefVo != null) { CSPrimaryDiagnosisAndPoceduresVo voDiagAndProc = domain.listPrimaryDiagnosisAndProblems(careSpellRefVo); StringBuffer text = new StringBuffer(); StringBuffer tooltip = new StringBuffer(); String comaSeparator = ", "; String initialSeparator = " - "; if (voDiagAndProc != null && voDiagAndProc.getPrimaryDiagnosisIsNotNull() && voDiagAndProc.getPrimaryDiagnosis().size() > 0) { String primaryDiagnosisTitle = "Primary Diagnosis: "; tooltip.append("*" + primaryDiagnosisTitle + "*"); for (int i = 0; i < voDiagAndProc.getPrimaryDiagnosis().size(); i++) { if (voDiagAndProc.getPrimaryDiagnosis().get(i).getDiagnosisNameIsNotNull()) { String diagnosisName = voDiagAndProc.getPrimaryDiagnosis().get(i).getDiagnosisName(); if (i == 0) { text.append(initialSeparator); } else if (i > 0) { text.append(comaSeparator); tooltip.append(comaSeparator); } text.append(diagnosisName); tooltip.append(diagnosisName); } } } if (voDiagAndProc != null && voDiagAndProc.getPrimaryProceduresIsNotNull() && voDiagAndProc.getPrimaryProcedures().size() > 0) { boolean isPrimaryDiagnosisAdded = tooltip.length() > 0; boolean isTextAdded = text.length() > 0; if (isPrimaryDiagnosisAdded) tooltip.append("\n"); String primaryProblemTitle = "Primary Problem: "; tooltip.append("*" + primaryProblemTitle + "*"); for (int i = 0; i < voDiagAndProc.getPrimaryProcedures().size(); i++) { if (voDiagAndProc.getPrimaryProcedures().get(i).getProcedureNameIsNotNull()) { String procedureName = voDiagAndProc.getPrimaryProcedures().get(i).getProcedureName(); if (i == 0) { text.append(isTextAdded ? comaSeparator : initialSeparator); } else if (i > 0) { text.append(comaSeparator); tooltip.append(comaSeparator); } text.append(procedureName); tooltip.append(procedureName); } } } return new CSDiagnosisAndProcedureTextAndTooltip(text.toString(), new ims.utils.textile.Textile().process(tooltip.toString())); } return null; }
public CSPrimaryDiagnosisAndPoceduresVo listPrimaryDiagnosisAndProblems(CareSpellRefVo careSpellRefVo) { if (careSpellRefVo == null) throw new CodingRuntimeException("Cannot list Primary Diagnosis/Problems for null CareSpellRefVo"); DomainFactory factory = getDomainFactory(); StringBuffer diagnosisQuery = new StringBuffer(); diagnosisQuery.append("select c1_1.diagnosis.id, c1_1.diagnosis.diagnosisDescription"); diagnosisQuery.append(" from CsPrimaryDiagnosis as c1_1"); diagnosisQuery.append(" where "); diagnosisQuery.append(" (c1_1.isActive = :ACTIVE and c1_1.episodeOfCare.careSpell.id = :CARESPELL_ID)"); diagnosisQuery.append(" and c1_1.isRIE is null and c1_1.diagnosis.isRIE is null"); StringBuffer problemsQuery = new StringBuffer(); problemsQuery.append("select c1_1.patientProblem.id, c1_1.patientProblem.patientProblem"); problemsQuery.append(" from CsPrimaryProblem as c1_1"); problemsQuery.append(" where"); problemsQuery.append(" (c1_1.isActive = :ACTIVE and c1_1.careContext.episodeOfCare.careSpell.id = :CARESPELL_ID)"); problemsQuery.append(" and c1_1.isRIE is null and c1_1.patientProblem.isRIE is null"); ArrayList params = new ArrayList(); params.add("ACTIVE"); params.add("CARESPELL_ID"); ArrayList values = new ArrayList(); values.add(Boolean.TRUE); values.add(careSpellRefVo.getID_CareSpell()); List diagnosisList = factory.find(diagnosisQuery.toString(), params, values); List problemsList = factory.find(problemsQuery.toString(), params, values); CSPrimaryDiagnosisAndPoceduresVo voPrimary = new CSPrimaryDiagnosisAndPoceduresVo(); voPrimary.setPrimaryDiagnosis(new CSPatientSummaryDiagnosisVoCollection()); voPrimary.setPrimaryProcedures(new CSPatientSummaryProcedureVoCollection()); for (int i = 0; diagnosisList != null && i < diagnosisList.size(); i++) { Object[] diagObjects = (Object[]) diagnosisList.get(i); if (diagObjects != null) { CSPatientSummaryDiagnosisVo voCSPatientSummaryDiagnosis = new CSPatientSummaryDiagnosisVo(); if (diagObjects[0] instanceof Integer) { voCSPatientSummaryDiagnosis.setID_CSPatientSummaryDiagnosis((Integer) diagObjects[0]); } if (diagObjects[1] instanceof String) { voCSPatientSummaryDiagnosis.setDiagnosisName((String) diagObjects[1]); } voPrimary.getPrimaryDiagnosis().add(voCSPatientSummaryDiagnosis); } } for (int i = 0; i < problemsList.size(); i++) { Object[] procObjects = (Object[]) problemsList.get(i); if (procObjects != null) { CSPatientSummaryProcedureVo voCSPatientSummaryProcedure = new CSPatientSummaryProcedureVo(); if (procObjects[0] instanceof Integer) { voCSPatientSummaryProcedure.setID_CSPatientSummaryProcedure((Integer) procObjects[0]); } if (procObjects[1] instanceof String) { voCSPatientSummaryProcedure.setProcedureName((String) procObjects[1]); } voPrimary.getPrimaryProcedures().add(voCSPatientSummaryProcedure); } } return voPrimary; }
public CSPrimaryDiagnosisAndPoceduresVo listPrimaryDiagnosisAndProblems(CareSpellRefVo careSpellRefVo) { if(careSpellRefVo == null) throw new CodingRuntimeException("Cannot list Primary Diagnosis/Problems for null CareSpellRefVo"); DomainFactory factory = getDomainFactory(); StringBuffer diagnosisQuery = new StringBuffer(); diagnosisQuery.append("select c1_1.diagnosis.id, c1_1.diagnosis.diagnosisDescription"); diagnosisQuery.append(" from CsPrimaryDiagnosis as c1_1"); diagnosisQuery.append(" where "); diagnosisQuery.append(" (c1_1.isActive = :ACTIVE and c1_1.episodeOfCare.careSpell.id = :CARESPELL_ID)"); diagnosisQuery.append(" and c1_1.isRIE is null and c1_1.diagnosis.isRIE is null"); StringBuffer problemsQuery = new StringBuffer(); problemsQuery.append("select c1_1.patientProblem.id, c1_1.patientProblem.patientProblem"); problemsQuery.append(" from CsPrimaryProblem as c1_1"); problemsQuery.append(" where"); problemsQuery.append(" (c1_1.isActive = :ACTIVE and c1_1.careContext.episodeOfCare.careSpell.id = :CARESPELL_ID)"); problemsQuery.append(" and c1_1.isRIE is null and c1_1.patientProblem.isRIE is null"); ArrayList params = new ArrayList(); params.add("ACTIVE"); params.add("CARESPELL_ID"); ArrayList values = new ArrayList(); values.add(Boolean.TRUE); values.add(careSpellRefVo.getID_CareSpell()); List diagnosisList = factory.find(diagnosisQuery.toString(), params, values); List problemsList = factory.find(problemsQuery.toString(), params, values); CSPrimaryDiagnosisAndPoceduresVo voPrimary = new CSPrimaryDiagnosisAndPoceduresVo(); voPrimary.setPrimaryDiagnosis(new CSPatientSummaryDiagnosisVoCollection()); voPrimary.setPrimaryProcedures(new CSPatientSummaryProcedureVoCollection()); for (int i = 0; diagnosisList != null && i < diagnosisList.size(); i++) { Object[] diagObjects = (Object[]) diagnosisList.get(i); if(diagObjects != null) { CSPatientSummaryDiagnosisVo voCSPatientSummaryDiagnosis = new CSPatientSummaryDiagnosisVo(); if(diagObjects[0] instanceof Integer) { voCSPatientSummaryDiagnosis.setID_CSPatientSummaryDiagnosis((Integer)diagObjects[0]); } if(diagObjects[1] instanceof String) { voCSPatientSummaryDiagnosis.setDiagnosisName((String)diagObjects[1]); } voPrimary.getPrimaryDiagnosis().add(voCSPatientSummaryDiagnosis); } } for (int i = 0; i < problemsList.size(); i++) { Object[] procObjects = (Object[]) problemsList.get(i); if(procObjects != null) { CSPatientSummaryProcedureVo voCSPatientSummaryProcedure = new CSPatientSummaryProcedureVo(); if(procObjects[0] instanceof Integer) { voCSPatientSummaryProcedure.setID_CSPatientSummaryProcedure((Integer)procObjects[0]); } if(procObjects[1] instanceof String) { voCSPatientSummaryProcedure.setProcedureName((String)procObjects[1]); } voPrimary.getPrimaryProcedures().add(voCSPatientSummaryProcedure); } } return voPrimary; }