← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9821: Apply multilingual in forms ( patient module ).

 

------------------------------------------------------------
revno: 9821
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-02-18 15:23:36 +0700
message:
  Apply multilingual in forms ( patient module ).
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java
  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/ShowAddPatientFormAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  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/patientForm.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupService.java	2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupService.java	2013-02-18 08:23:36 +0000
@@ -27,6 +27,7 @@
 package org.hisp.dhis.patient;
 
 import java.util.Collection;
+import java.util.List;
 
 /**
  * @author Chau Thu Tran
@@ -47,4 +48,6 @@
     PatientAttributeGroup getPatientAttributeGroupByName( String name );
 
     Collection<PatientAttributeGroup> getAllPatientAttributeGroups();
+    
+    List<PatientAttribute> getPatientAttributes( PatientAttributeGroup patientAttributeGroup );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java	2013-02-04 16:14:38 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java	2013-02-18 08:23:36 +0000
@@ -28,7 +28,9 @@
 
 import static org.hisp.dhis.i18n.I18nUtils.i18n;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.hisp.dhis.i18n.I18nService;
 import org.springframework.transaction.annotation.Transactional;
@@ -93,4 +95,9 @@
         return i18n( i18nService, patientAttributeGroupStore.getAll() );
     }
 
+    public List<PatientAttribute> getPatientAttributes( PatientAttributeGroup patientAttributeGroup )
+    {
+        return new ArrayList<PatientAttribute>( i18n( i18nService, patientAttributeGroup.getAttributes() ) );
+    }
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2013-01-21 08:13:02 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2013-02-18 08:23:36 +0000
@@ -351,10 +351,7 @@
     @Override
     public Collection<Patient> sortPatientsByAttribute( Collection<Patient> patients, PatientAttribute patientAttribute )
     {
-        // List<PatientAttributeValue> patientsSortedByAttribute = new
-        // ArrayList<PatientAttributeValue>();
-
-        Collection<Patient> sortedPatients = new ArrayList<Patient>();
+         Collection<Patient> sortedPatients = new ArrayList<Patient>();
 
         // ---------------------------------------------------------------------
         // Better to fetch all attribute values at once than fetching the

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java	2013-02-05 19:05:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java	2013-02-18 08:23:36 +0000
@@ -26,7 +26,9 @@
  */
 package org.hisp.dhis.caseentry.action.patient;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -37,6 +39,7 @@
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientAttributeGroup;
+import org.hisp.dhis.patient.PatientAttributeGroupService;
 import org.hisp.dhis.patient.PatientAttributeService;
 import org.hisp.dhis.patient.PatientIdentifier;
 import org.hisp.dhis.patient.PatientIdentifierType;
@@ -44,6 +47,7 @@
 import org.hisp.dhis.patient.PatientRegistrationForm;
 import org.hisp.dhis.patient.PatientRegistrationFormService;
 import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
 import org.hisp.dhis.program.Program;
@@ -84,9 +88,11 @@
     private RelationshipTypeService relationshipTypeService;
 
     private PatientRegistrationFormService patientRegistrationFormService;
-    
+
     private ProgramInstanceService programInstanceService;
 
+    private PatientAttributeGroupService attributeGroupService;
+
     private I18n i18n;
 
     private I18nFormat format;
@@ -121,7 +127,7 @@
 
     private Relationship relationship;
 
-    private Map<PatientAttributeGroup, Collection<PatientAttribute>> attributeGroupsMap = new HashMap<PatientAttributeGroup, Collection<PatientAttribute>>();
+    private Map<Integer, Collection<PatientAttribute>> attributeGroupsMap = new HashMap<Integer, Collection<PatientAttribute>>();
 
     private Collection<User> healthWorkers;
 
@@ -138,7 +144,7 @@
     {
         return customRegistrationForm;
     }
-
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -160,28 +166,31 @@
             if ( patientRegistrationForm != null )
             {
                 customRegistrationForm = patientRegistrationFormService.prepareDataEntryFormForAdd(
-                    patientRegistrationForm.getDataEntryForm().getHtmlCode(), healthWorkers, patient, null, i18n, format );
+                    patientRegistrationForm.getDataEntryForm().getHtmlCode(), healthWorkers, patient, null, i18n,
+                    format );
             }
         }
         else
         {
             Program program = programService.getProgram( programId );
-            Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, program, false );
+            Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient,
+                program, false );
 
             ProgramInstance programInstance = null;
-            
+
             if ( programInstances.iterator().hasNext() )
             {
                 programInstance = programInstances.iterator().next();
             }
-            
+
             PatientRegistrationForm patientRegistrationForm = patientRegistrationFormService
                 .getPatientRegistrationForm( program );
-            
+
             if ( patientRegistrationForm != null )
             {
-                customRegistrationForm = patientRegistrationFormService.prepareDataEntryFormForAdd( patientRegistrationForm
-                    .getDataEntryForm().getHtmlCode(), healthWorkers, patient, programInstance, i18n, format );
+                customRegistrationForm = patientRegistrationFormService.prepareDataEntryFormForAdd(
+                    patientRegistrationForm.getDataEntryForm().getHtmlCode(), healthWorkers, patient, programInstance,
+                    i18n, format );
             }
         }
 
@@ -199,39 +208,32 @@
             // -------------------------------------------------------------------------
 
             identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes();
-            Collection<PatientAttribute> patientAttributes = patientAttributeService.getAllPatientAttributes();
-
+            Collection<PatientAttribute> patientAttributesInProgram = new HashSet<PatientAttribute>();
+            
             Collection<Program> programs = programService.getAllPrograms();
             for ( Program program : programs )
             {
                 identifierTypes.removeAll( program.getPatientIdentifierTypes() );
-                patientAttributes.removeAll( program.getPatientAttributes() );
+                patientAttributesInProgram.removeAll( program.getPatientAttributes() );
             }
 
-            for ( PatientAttribute patientAttribute : patientAttributes )
+            attributeGroups = new ArrayList<PatientAttributeGroup>(
+                attributeGroupService.getAllPatientAttributeGroups() );
+            Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() );
+            for ( PatientAttributeGroup attributeGroup : attributeGroups )
             {
-                PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup();
-                
-                if ( attributeGroup != null )
-                {
-                    if ( attributeGroupsMap.containsKey( attributeGroup ) )
-                    {
-                        Collection<PatientAttribute> attributes = attributeGroupsMap.get( attributeGroup );
-                        attributes.add( patientAttribute );
-                    }
-                    else
-                    {
-                        Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
-                        attributes.add( patientAttribute );
-                        attributeGroupsMap.put( attributeGroup, attributes );
-                    }
-                }
-                else
-                {
-                    noGroupAttributes.add( patientAttribute );
+                List<PatientAttribute> attributes = attributeGroupService.getPatientAttributes( attributeGroup );
+                attributes.removeAll( patientAttributesInProgram );
+
+                if ( attributes.size() > 0 )
+                {
+                    attributeGroupsMap.put( attributeGroup.getId(), attributes );
                 }
             }
-
+            
+            noGroupAttributes = patientAttributeService.getPatientAttributesWithoutGroup();
+            noGroupAttributes.removeAll( patientAttributesInProgram );
+            
             // -------------------------------------------------------------------------
             // Get data
             // -------------------------------------------------------------------------
@@ -272,30 +274,7 @@
             // -------------------------------------------------------------------------
             // Get patient-attribute values
             // -------------------------------------------------------------------------
-
-            for ( PatientAttribute patientAttribute : patientAttributes )
-            {
-                PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup();
-                if ( attributeGroup != null )
-                {
-                    if ( attributeGroupsMap.containsKey( attributeGroup ) )
-                    {
-                        Collection<PatientAttribute> attributes = attributeGroupsMap.get( attributeGroup );
-                        attributes.add( patientAttribute );
-                    }
-                    else
-                    {
-                        Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
-                        attributes.add( patientAttribute );
-                        attributeGroupsMap.put( attributeGroup, attributes );
-                    }
-                }
-                else
-                {
-                    noGroupAttributes.add( patientAttribute );
-                }
-            }
-
+            
             Collection<PatientAttributeValue> patientAttributeValues = patientAttributeValueService
                 .getPatientAttributeValues( patient );
 
@@ -328,6 +307,11 @@
         this.patientRegistrationFormService = patientRegistrationFormService;
     }
 
+    public void setAttributeGroupService( PatientAttributeGroupService attributeGroupService )
+    {
+        this.attributeGroupService = attributeGroupService;
+    }
+
     public void setI18n( I18n i18n )
     {
         this.i18n = i18n;
@@ -353,7 +337,7 @@
         return healthWorkers;
     }
 
-    public Map<PatientAttributeGroup, Collection<PatientAttribute>> getAttributeGroupsMap()
+    public Map<Integer, Collection<PatientAttribute>> getAttributeGroupsMap()
     {
         return attributeGroupsMap;
     }

=== 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	2012-12-21 13:15:04 +0000
+++ 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
@@ -41,13 +41,16 @@
 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;
 import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramInstanceService;
+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;
@@ -78,6 +81,12 @@
 
     private PatientAttributeService patientAttributeService;
 
+    private PatientIdentifierTypeService identifierTypeService;
+
+    private ProgramService programService;
+
+    private RelationshipTypeService relationshipTypeService;
+
     private I18nFormat format;
 
     // -------------------------------------------------------------------------
@@ -100,7 +109,13 @@
 
     private Collection<PatientAudit> patientAudits;
 
-    private Map<String, Double> calAttributeValueMap = new HashMap<String, Double>();
+    private Map<String, String> attributeMap = new HashMap<String, String>();
+
+    private Map<String, String> identifierMap = new HashMap<String, String>();
+
+    private Map<Integer, String> programMap = new HashMap<Integer, String>();
+
+    private Map<String, Relationship> relationshipMap = new HashMap<String, Relationship>();
 
     // -------------------------------------------------------------------------
     // Action implementation
@@ -111,6 +126,41 @@
         this.patientAuditService = patientAuditService;
     }
 
+    public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService )
+    {
+        this.identifierTypeService = identifierTypeService;
+    }
+
+    public Map<String, String> getAttributeMap()
+    {
+        return attributeMap;
+    }
+
+    public Map<String, String> getIdentifierMap()
+    {
+        return identifierMap;
+    }
+
+    public Map<Integer, String> getProgramMap()
+    {
+        return programMap;
+    }
+
+    public Map<String, Relationship> 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;
@@ -141,11 +191,6 @@
         this.currentUserService = currentUserService;
     }
 
-    public Map<String, Double> getCalAttributeValueMap()
-    {
-        return calAttributeValueMap;
-    }
-
     public Collection<ProgramInstance> getActiveProgramInstances()
     {
         return activeProgramInstances;
@@ -211,10 +256,19 @@
     {
         patient = patientService.getPatient( patientId );
 
-        identifiers = patient.getIdentifiers();
+        // ---------------------------------------------------------------------
+        // Get patient-attribute-values
+        // ---------------------------------------------------------------------
 
         attributeValues = patientAttributeValueService.getPatientAttributeValues( patient );
 
+        for ( PatientAttributeValue attributeValue : attributeValues )
+        {
+            Integer id = attributeValue.getPatientAttribute().getId();
+            attributeMap.put( patientAttributeService.getPatientAttribute( id ).getDisplayName(),
+                attributeValue.getValue() );
+        }
+
         Collection<PatientAttribute> calAttributes = patientAttributeService
             .getPatientAttributesByValueType( PatientAttribute.TYPE_CALCULATED );
 
@@ -224,11 +278,41 @@
                 format );
             if ( value != null )
             {
-                calAttributeValueMap.put( calAttribute.getName(), value );
-            }
-        }
-
-        relationship = relationshipService.getRelationshipsForPatient( patient );
+                attributeMap.put( calAttribute.getDisplayName(), value + "" );
+            }
+        }
+
+        // ---------------------------------------------------------------------
+        // Get patient-identifiers
+        // ---------------------------------------------------------------------
+
+        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<Relationship> relationships = relationshipService.getRelationshipsForPatient( patient );
+
+        for ( Relationship relationship : relationships )
+        {
+            relationshipMap.put( relationshipTypeService.getRelationshipType( relationship.getId() ).getDisplayName(),
+                relationship );
+        }
 
         Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient );
 
@@ -246,6 +330,12 @@
             {
                 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/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java	2013-02-08 12:46:09 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java	2013-02-18 08:23:36 +0000
@@ -27,9 +27,12 @@
 
 package org.hisp.dhis.caseentry.action.patient;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 
 import org.hisp.dhis.i18n.I18n;
@@ -38,11 +41,13 @@
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientAttributeGroup;
+import org.hisp.dhis.patient.PatientAttributeGroupService;
 import org.hisp.dhis.patient.PatientAttributeService;
 import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientIdentifierTypeService;
 import org.hisp.dhis.patient.PatientRegistrationForm;
 import org.hisp.dhis.patient.PatientRegistrationFormService;
+import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.user.User;
@@ -67,13 +72,6 @@
         this.selectionManager = selectionManager;
     }
 
-    private PatientAttributeService patientAttributeService;
-
-    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
-    {
-        this.patientAttributeService = patientAttributeService;
-    }
-
     private PatientIdentifierTypeService patientIdentifierTypeService;
 
     public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
@@ -95,6 +93,20 @@
         this.patientRegistrationFormService = patientRegistrationFormService;
     }
 
+    private PatientAttributeService attributeService;
+
+    public void setAttributeService( PatientAttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    private PatientAttributeGroupService attributeGroupService;
+
+    public void setAttributeGroupService( PatientAttributeGroupService attributeGroupService )
+    {
+        this.attributeGroupService = attributeGroupService;
+    }
+
     private I18n i18n;
 
     public void setI18n( I18n i18n )
@@ -148,9 +160,9 @@
         return organisationUnit;
     }
 
-    private Map<PatientAttributeGroup, Collection<PatientAttribute>> attributeGroupsMap = new HashMap<PatientAttributeGroup, Collection<PatientAttribute>>();
+    private Map<Integer, Collection<PatientAttribute>> attributeGroupsMap = new HashMap<Integer, Collection<PatientAttribute>>();
 
-    public Map<PatientAttributeGroup, Collection<PatientAttribute>> getAttributeGroupsMap()
+    public Map<Integer, Collection<PatientAttribute>> getAttributeGroupsMap()
     {
         return attributeGroupsMap;
     }
@@ -169,6 +181,13 @@
         return program;
     }
 
+    private List<PatientAttributeGroup> attributeGroups;
+
+    public List<PatientAttributeGroup> getAttributeGroups()
+    {
+        return attributeGroups;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -205,40 +224,31 @@
         if ( customRegistrationForm == null )
         {
             identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes();
-            Collection<PatientAttribute> patientAttributes = patientAttributeService.getAllPatientAttributes();
+
+            Collection<PatientAttribute> patientAttributesInProgram = new HashSet<PatientAttribute>();
             Collection<Program> programs = programService.getAllPrograms();
             for ( Program program : programs )
             {
                 identifierTypes.removeAll( program.getPatientIdentifierTypes() );
-                patientAttributes.removeAll( program.getPatientAttributes() );
+                patientAttributesInProgram.addAll( program.getPatientAttributes() );
             }
 
-            attributeGroupsMap = new HashMap<PatientAttributeGroup, Collection<PatientAttribute>>();
-            for ( PatientAttribute patientAttribute : patientAttributes )
+            attributeGroups = new ArrayList<PatientAttributeGroup>(
+                attributeGroupService.getAllPatientAttributeGroups() );
+            Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() );
+            for ( PatientAttributeGroup attributeGroup : attributeGroups )
             {
-                if ( !patientAttribute.getValueType().equals( PatientAttribute.TYPE_CALCULATED ) )
+                List<PatientAttribute> attributes = attributeGroupService.getPatientAttributes( attributeGroup );
+                attributes.removeAll( patientAttributesInProgram );
+
+                if ( attributes.size() > 0 )
                 {
-                    PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup();
-                    if ( attributeGroup != null )
-                    {
-                        if ( attributeGroupsMap.containsKey( attributeGroup ) )
-                        {
-                            Collection<PatientAttribute> attributes = attributeGroupsMap.get( attributeGroup );
-                            attributes.add( patientAttribute );
-                        }
-                        else
-                        {
-                            Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
-                            attributes.add( patientAttribute );
-                            attributeGroupsMap.put( attributeGroup, attributes );
-                        }
-                    }
-                    else
-                    {
-                        noGroupAttributes.add( patientAttribute );
-                    }
+                    attributeGroupsMap.put( attributeGroup.getId(), attributes );
                 }
             }
+
+            noGroupAttributes = attributeService.getPatientAttributesWithoutGroup();
+            noGroupAttributes.removeAll( patientAttributesInProgram );
         }
 
         return SUCCESS;

=== 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-04 03:09:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-02-18 08:23:36 +0000
@@ -435,6 +435,9 @@
 			ref="org.hisp.dhis.patient.PatientRegistrationFormService" />
 		<property name="programInstanceService"
 			ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="attributeGroupService">
+			<ref bean="org.hisp.dhis.patient.PatientAttributeGroupService" />
+		</property>
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.patient.AddPatientAction"
@@ -487,7 +490,7 @@
 		scope="prototype">
 		<property name="selectionManager"
 			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="patientAttributeService">
+		<property name="attributeService">
 			<ref bean="org.hisp.dhis.patient.PatientAttributeService" />
 		</property>
 		<property name="patientIdentifierTypeService">
@@ -499,6 +502,9 @@
 		<property name="patientRegistrationFormService">
 			<ref bean="org.hisp.dhis.patient.PatientRegistrationFormService" />
 		</property>
+		<property name="attributeGroupService">
+			<ref bean="org.hisp.dhis.patient.PatientAttributeGroupService" />
+		</property>
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.patient.ValidatePatientAction"
@@ -1046,6 +1052,12 @@
 		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
 		<property name="patientAttributeService"
 			ref="org.hisp.dhis.patient.PatientAttributeService" />
+		<property name="identifierTypeService"
+			ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+		<property name="relationshipTypeService"
+			ref="org.hisp.dhis.relationship.RelationshipTypeService" />
+		<property name="programService"
+			ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
 
 	<!-- Comment -->

=== 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-13 15:58:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2013-02-18 08:23:36 +0000
@@ -1,3 +1,6 @@
+$identifierMap
+
+
 <h3>
  <a name="mainPagelink" href="javascript:onClickBackBtn();">$i18n.getString( 'patient_management' )</a>
  &#8226; $i18n.getString( 'patient_dashboard' )
@@ -52,34 +55,27 @@
 						#end
 					</td>
 				</tr>
-				#foreach( $identifier in $identifiers )
+				#foreach( $identifierTypeName in $identifierMap.ketSet() )
 				<tr>
-					#if($!identifier.identifierType)
-						<td>$identifier.identifierType.displayName</td>
+					#if($!identifier)
+						<td>$identifierTypeName</td>
 					#else
 						<td>$i18n.getString("system_identifier")</td>
 					#end
-					<td>$identifier.identifier</td>
+					<td>$identifierMap.get($identifierTypeName)</td>
 				</tr>
 				#end
-				#foreach( $attributeName in $calAttributeValueMap.keySet() )
-				<tr class="bold">
+				#foreach( $attributeName in $attributeMap.keySet() )
+				<tr>
+					#set( $attributeValue=$$attributeMap.get($attributeName) )
 					<td>$attributeName</td>
-					<td>$calAttributeValueMap.get($attributeName)</td>
-				</tr>
-				#end
-				#foreach( $attributeValue in $attributeValues )
-				<tr>
-					<td>$attributeValue.patientAttribute.displayName</td>
 					<td>
-						#if($attributeValue.patientAttribute.valueType=='YES/NO')
-							#if($attributeValue.value=='true')
-								$i18n.getString("yes")
-							#else
-								$i18n.getString("no")
-							#end
+						#if($attributeValue=='true')
+							$i18n.getString("yes")
+						#elseif( $attributeValue=='false')
+							$i18n.getString("no")
 						#else
-							$encoder.htmlEncode($attributeValue.value)
+							$encoder.htmlEncode($attributeValue)
 						#end	
 					</td>
 				</tr>
@@ -118,7 +114,7 @@
 							#if($programInstance.program.type==1)
 							<tr>
 								<td id='tr2_$programInstance.id' onclick='javascript:loadActiveProgramStageRecords("$programInstance.id", "$programStageInstance.id")' style='cursor:pointer;'>
-									<a>&#8226; $programStageInstance.programStage.displayName ($format.formatDate($programStageInstance.dueDate))</a>
+									<a>&#8226; $programMap.get($programInstance.program.id) ($format.formatDate($programStageInstance.dueDate))</a>
 								</td>
 							</tr>
 							#end

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2013-02-13 15:58:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2013-02-18 08:23:36 +0000
@@ -139,10 +139,10 @@
 
 	<!-- ATTRIBUTES IN GROUPS -->
 	
-	#foreach ($attributeGroup in $attributeGroupsMap.keySet() )
+	#foreach ($attributeGroup in $attributeGroups )
 		<tr><td>&nbsp;</td></tr>
 		<tr><th colspan="2" class="heading-column">$attributeGroup.displayName</th></tr>
-		#set($attributes = $attributeGroupsMap.get($attributeGroup))
+		#set($attributes = $attributeGroupsMap.get($attributeGroup.id))
 		#foreach($attribute in $attributes )
 			#set($value = "")
 			#set($value = $patientAttributeValueMap.get($attribute.id))