private PatientDiagnosisVo getExistingPatientDiagnosisOrCreateNew(DiagLiteVo voDiagnosis) { PatientDiagnosisVoCollection collDiag = form.getLocalContext().getPatientDiagnosis(); if(collDiag == null) return new PatientDiagnosisVo(); for(int i = 0; i < collDiag.size(); i++) { if(collDiag.get(i).getDiagnosis().getID_Diagnosis().equals(voDiagnosis.getID_Diagnosis())) return collDiag.get(i); } return new PatientDiagnosisVo(); }
private void populatePresentDiagnosisControls(PatientDiagnosisVoCollection presentDiagnoses) { for (int i=0; i < presentDiagnoses.size(); i++) { PatientDiagnosisVo voPatientDiagnosis = presentDiagnoses.get(i); GenForm.grdChecklistRow row = form.grdChecklist().getRows().newRow(); if(voPatientDiagnosis.getDiagnosisIsNotNull()) { row.setColDiagnosis(voPatientDiagnosis.getDiagnosis().getDiagnosisName()); row.setTooltipForColDiagnosis(voPatientDiagnosis.getDiagnosis().getDiagnosisName()); } row.setColSelect(PresentAbsentUnknown.PRESENT); if(voPatientDiagnosis.getSourceofInformationIsNotNull()) row.setColSource(voPatientDiagnosis.getSourceofInformation()); if(voPatientDiagnosis.getDiagnosedDateIsNotNull()) row.setColDiagnosisDate(voPatientDiagnosis.getDiagnosedDate()); if(voPatientDiagnosis.getDiagnosisDescriptionIsNotNull()) row.setcolDescription(voPatientDiagnosis.getDiagnosisDescription()); row.setValue(voPatientDiagnosis); setGridUIForPresent(row); } }
private PatientDiagnosisVo getLastPatientDiagnosisFromCollection(DiagLiteVo diagnosis, PatientDiagnosisVoCollection coll) { PatientDiagnosisVo mostRecentItem = null; for(int i = 0; i < coll.size(); i++) { PatientDiagnosisVo item = coll.get(i); if(item.getDiagnosis().equals(diagnosis)) { if(mostRecentItem == null) mostRecentItem = item; else { if(item.getDiagnosedDateIsNotNull()) { if(mostRecentItem.getDiagnosedDateIsNotNull()) { if(item.getDiagnosedDate().isDate() && item.getDiagnosedDate().toDate().compareTo(mostRecentItem.getDiagnosedDate().toDate()) > 0) mostRecentItem = item; } else { mostRecentItem = item; } } else { if(!mostRecentItem.getDiagnosedDateIsNotNull()) { //if both dates are null we compare by id if(item.getID_PatientDiagnosis().intValue() > mostRecentItem.getID_PatientDiagnosis().intValue()) mostRecentItem = item; } } } } } return mostRecentItem; }