=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2013-02-18 08:23:36 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2013-02-26 03:21:49 +0000 @@ -41,7 +41,6 @@ import org.hisp.dhis.patient.PatientAudit; import org.hisp.dhis.patient.PatientAuditService; import org.hisp.dhis.patient.PatientIdentifier; -import org.hisp.dhis.patient.PatientIdentifierTypeService; import org.hisp.dhis.patient.PatientService; import org.hisp.dhis.patientattributevalue.PatientAttributeValue; import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; @@ -50,7 +49,6 @@ import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.relationship.Relationship; import org.hisp.dhis.relationship.RelationshipService; -import org.hisp.dhis.relationship.RelationshipTypeService; import org.hisp.dhis.user.CurrentUserService; import com.opensymphony.xwork2.Action; @@ -81,12 +79,6 @@ private PatientAttributeService patientAttributeService; - private PatientIdentifierTypeService identifierTypeService; - - private ProgramService programService; - - private RelationshipTypeService relationshipTypeService; - private I18nFormat format; // ------------------------------------------------------------------------- @@ -109,13 +101,9 @@ private Collection patientAudits; - private Map attributeMap = new HashMap(); - - private Map identifierMap = new HashMap(); - - private Map programMap = new HashMap(); - - private Map relationshipMap = new HashMap(); + private Map attributeMap = new HashMap(); + + Collection relationships = new HashSet(); // ------------------------------------------------------------------------- // Action implementation @@ -125,57 +113,17 @@ { this.patientAuditService = patientAuditService; } - - public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService ) - { - this.identifierTypeService = identifierTypeService; - } - - public Map getAttributeMap() + + public Map getAttributeMap() { return attributeMap; } - - public Map getIdentifierMap() - { - return identifierMap; - } - - public Map getProgramMap() - { - return programMap; - } - - public Map getRelationshipMap() - { - return relationshipMap; - } - - public void setProgramService( ProgramService programService ) - { - this.programService = programService; - } - - public void setRelationshipTypeService( RelationshipTypeService relationshipTypeService ) - { - this.relationshipTypeService = relationshipTypeService; - } - + public void setFormat( I18nFormat format ) { this.format = format; } - - public void setAttributeValues( Collection attributeValues ) - { - this.attributeValues = attributeValues; - } - - public void setActiveProgramInstances( Collection activeProgramInstances ) - { - this.activeProgramInstances = activeProgramInstances; - } - + public void setPatientAttributeService( PatientAttributeService patientAttributeService ) { this.patientAttributeService = patientAttributeService; @@ -262,13 +210,6 @@ attributeValues = patientAttributeValueService.getPatientAttributeValues( patient ); - for ( PatientAttributeValue attributeValue : attributeValues ) - { - Integer id = attributeValue.getPatientAttribute().getId(); - attributeMap.put( patientAttributeService.getPatientAttribute( id ).getDisplayName(), - attributeValue.getValue() ); - } - Collection calAttributes = patientAttributeService .getPatientAttributesByValueType( PatientAttribute.TYPE_CALCULATED ); @@ -278,7 +219,7 @@ format ); if ( value != null ) { - attributeMap.put( calAttribute.getDisplayName(), value + "" ); + attributeMap.put( calAttribute, value + "" ); } } @@ -288,32 +229,12 @@ identifiers = patient.getIdentifiers(); - for ( PatientIdentifier identifier : identifiers ) - { - if ( identifier.getIdentifierType() != null ) - { - identifierMap.put( - identifierTypeService.getPatientIdentifierType( identifier.getIdentifierType().getId() ) - .getDisplayName(), identifier.getIdentifier() ); - } - else - { - identifierMap.put( null, identifier.getIdentifier() ); - } - } - // --------------------------------------------------------------------- // Get relationship // --------------------------------------------------------------------- - Collection relationships = relationshipService.getRelationshipsForPatient( patient ); - - for ( Relationship relationship : relationships ) - { - relationshipMap.put( relationshipTypeService.getRelationshipType( relationship.getId() ).getDisplayName(), - relationship ); - } - + relationships = relationshipService.getRelationshipsForPatient( patient ); + Collection programInstances = programInstanceService.getProgramInstances( patient ); activeProgramInstances = new HashSet(); @@ -330,12 +251,6 @@ { activeProgramInstances.add( programInstance ); } - - Integer programId = programInstance.getProgram().getId(); - if ( !programMap.containsKey( programId ) ) - { - programMap.put( programId, programService.getProgram( programId ).getDisplayName() ); - } } // --------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-02-22 04:49:30 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-02-26 03:21:49 +0000 @@ -1063,11 +1063,6 @@ - - - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2013-02-21 04:05:24 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2013-02-26 03:21:49 +0000 @@ -1,6 +1,3 @@ -$identifierMap - -

$i18n.getString( 'patient_management' ) • $i18n.getString( 'patient_dashboard' ) @@ -55,27 +52,38 @@ #end - #foreach( $identifierTypeName in $identifierMap.ketSet() ) + #foreach( $identifier in $identifiers ) - #if($!identifier) - $identifierTypeName + #if($!identifier.identifierType) + $identifier.identifierType.displayName #else $i18n.getString("system_identifier") #end - $identifierMap.get($identifierTypeName) - - #end - #foreach( $attributeName in $attributeMap.keySet() ) + $identifier.identifier + + #end + + #foreach( $attribute in $attributeMap.keySet() ) + + $attribute.displayName + + $attributeMap.get( $attribute) + + + #end + + #foreach( $attributeValue in $attributeValues ) - #set( $attributeValue=$$attributeMap.get($attributeName) ) - $attributeName + $attributeValue.patientAttribute.displayName - #if($attributeValue=='true') - $i18n.getString("yes") - #elseif( $attributeValue=='false') - $i18n.getString("no") + #if($attributeValue.patientAttribute.valueType=='YES/NO') + #if($attributeValue.value) + $i18n.getString("yes") + #else + $i18n.getString("no") + #end #else - $encoder.htmlEncode($attributeValue) + $encoder.htmlEncode($attributeValue.value) #end