=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java 2010-09-27 09:48:06 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java 2010-10-05 06:44:36 +0000 @@ -267,7 +267,7 @@ //System.out.println("listAll startPos "+ startPos+" endPos "+ endPos ); patients = patientService.getPatientsByOrgUnitAttr( organisationUnit , startPos,endPos, patientAttribute ); - + if( patients != null && patients.size() > 0 ) { //System.out.println("patients size = "+patients.size()); @@ -280,8 +280,10 @@ mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) ); if(sortPatientAttributeId!=null && patientAttribute!=null) { - mapPatientPatientAttr.put(patient, - patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ).getValue()); + PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ); + String value = (attributeValue == null )?"" : attributeValue.getValue(); + + mapPatientPatientAttr.put(patient, value); } } } @@ -325,11 +327,14 @@ mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) ); if(sortPatientAttributeId!=null && patientAttribute!=null) { - mapPatientPatientAttr.put(patient, patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ).getValue()); + PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ); + String value = (attributeValue == null )?"" : attributeValue.getValue(); + + mapPatientPatientAttr.put(patient, value); } } } -System.out.println("\n patientAttributeValueService.searchPatientAttributeValue : " + patients); + return SUCCESS; } @@ -360,7 +365,10 @@ { if(sortPatientAttributeId!=null && patientAttribute!=null) { - mapPatientPatientAttr.put(patient, patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ).getValue()); + PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ); + String value = (attributeValue == null )?"" : attributeValue.getValue(); + + mapPatientPatientAttr.put(patient, value); } } } @@ -398,7 +406,10 @@ mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) ); if(sortPatientAttributeId!=null && patientAttribute!=null) { - mapPatientPatientAttr.put(patient, patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ).getValue()); + PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ); + String value = (attributeValue == null )?"" : attributeValue.getValue(); + + mapPatientPatientAttr.put(patient, value); } } } @@ -439,7 +450,10 @@ { if(sortPatientAttributeId!=null && patientAttribute!=null) { - mapPatientPatientAttr.put(patient, patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ).getValue()); + PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ); + String value = (attributeValue == null )?"" : attributeValue.getValue(); + + mapPatientPatientAttr.put(patient, value); } } } @@ -467,7 +481,10 @@ mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) ); if(sortPatientAttributeId!=null && patientAttribute!=null) { - mapPatientPatientAttr.put(patient, patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ).getValue()); + PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute ); + String value = (attributeValue == null )?"" : attributeValue.getValue(); + + mapPatientPatientAttr.put(patient, value); } } }