← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2036: Added function for showing patient's relationships in list patient.

 

------------------------------------------------------------
revno: 2036
committer: Viet <Viet@Viet-laptop>
branch nick: trunk
timestamp: Thu 2010-06-24 02:59:35 +0700
message:
  Added function for showing patient's relationships in list patient.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml
  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/patientattribute/AddPatientAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ShowAddRelationshipPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.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/PatientAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java	2010-06-23 19:59:35 +0000
@@ -57,6 +57,8 @@
     
     private boolean mandatory;
     
+    private boolean inheritable;
+    
     private PatientAttributeGroup patientAttributeGroup;
     
     private Set<PatientAttributeOption> attributeOptions;
@@ -189,4 +191,12 @@
         this.patientAttributeGroup = patientAttributeGroup;
     }
 
+	public boolean isInheritable() {
+		return inheritable;
+	}
+
+	public void setInheritable(boolean inheritable) {
+		this.inheritable = inheritable;
+	}
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java	2010-05-11 16:29:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java	2010-06-23 19:59:35 +0000
@@ -112,7 +112,7 @@
     {
         return (Patient) getCriteria( Restrictions.and( Restrictions.eq( "identifierType", idenType ),
             Restrictions.eq( "identifier", value ) ) )
-            .setProjection( Projections.property( "patient.id" ) ).uniqueResult();
+            .setProjection( Projections.property( "patient" ) ).uniqueResult();
     }
 
     public int countListPatientByOrganisationUnit( OrganisationUnit orgUnit )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml	2010-06-23 19:59:35 +0000
@@ -16,6 +16,8 @@
     <property name="valueType" column="valuetype" not-null="true"/>  
     
 	<property name="mandatory" column="mandatory" not-null="true" />
+	
+	<property name="inheritable" column="inheritable" not-null="true" />
     
     <many-to-one name="patientAttributeGroup" column="patientattributegroupid"
 			class="org.hisp.dhis.patient.PatientAttributeGroup"

=== 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-06-21 12:52:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java	2010-06-23 19:59:35 +0000
@@ -29,6 +29,8 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -41,6 +43,8 @@
 import org.hisp.dhis.patient.paging.RequestUtil;
 import org.hisp.dhis.patient.state.SelectedStateManager;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
+import org.hisp.dhis.relationship.Relationship;
+import org.hisp.dhis.relationship.RelationshipService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -90,6 +94,13 @@
         this.patientAttributeValueService = patientAttributeValueService;
     }
 
+    private RelationshipService relationshipService;
+    
+    public void setRelationshipService( RelationshipService relationshipService )
+    {
+        this.relationshipService = relationshipService;
+    }
+    
     // -------------------------------------------------------------------------
     // Input/output
     // -------------------------------------------------------------------------
@@ -181,6 +192,13 @@
         return total;
     }
     
+    private Map<Integer,Collection<Relationship>> mapRelationShip = new HashMap<Integer, Collection<Relationship>>();
+    
+    public Map<Integer,Collection<Relationship>>  getMapRelationShip( )
+    {
+        return mapRelationShip;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -214,6 +232,14 @@
             
             patients = patientService.getPatientsByOrgUnit( organisationUnit , pagingUtil.getStartPos(), pagingUtil.getPageSize() );
             
+            if( patients != null && patients.size() > 0 ) 
+            {
+                for( Patient patient : patients )
+                {
+                    mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
+                }
+            }
+            
             searchText = "list_all_patients";
 
             return SUCCESS;
@@ -241,6 +267,14 @@
             patients = patientAttributeValueService.searchPatientAttributeValue(
                 patientAttribute, searchText, pagingUtil.getStartPos(), pagingUtil.getPageSize() );
 
+            if( patients != null && patients.size() > 0 ) 
+            {
+                for( Patient patient : patients )
+                {
+                    mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
+                }
+            }
+            
             return SUCCESS;
         }
 
@@ -261,6 +295,14 @@
             
             patients = patientService.getPatients( searchText, pagingUtil.getStartPos(), pagingUtil.getPageSize() );
 
+            if( patients != null && patients.size() > 0 ) 
+            {
+                for( Patient patient : patients )
+                {
+                    mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
+                }
+            }
+            
             return SUCCESS;
         }
 
@@ -283,6 +325,14 @@
             
             patients = patientService.getPatientsByOrgUnit( organisationUnit , pagingUtil.getStartPos(), pagingUtil.getPageSize() );
             
+            if( patients != null && patients.size() > 0 ) 
+            {
+                for( Patient patient : patients )
+                {
+                    mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
+                }
+            }
+            
             searchText = "list_all_patients";
 
             return SUCCESS;
@@ -308,6 +358,14 @@
 
             patients = patientAttributeValueService.searchPatientAttributeValue(
                 patientAttribute, searchText, pagingUtil.getStartPos(), pagingUtil.getPageSize() );
+            
+            if( patients != null && patients.size() > 0 ) 
+            {
+                for( Patient patient : patients )
+                {
+                    mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
+                }
+            }
         }
         
         
@@ -321,6 +379,13 @@
         
         patients = patientService.getPatients( searchText, pagingUtil.getStartPos(), pagingUtil.getPageSize() );
         
+        if( patients != null && patients.size() > 0 ) 
+        {
+            for( Patient patient : patients )
+            {
+                mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
+            }
+        }
         
         return SUCCESS;
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java	2010-06-23 19:59:35 +0000
@@ -93,6 +93,13 @@
         this.mandatory = mandatory;
     }
     
+    private boolean inheritable;
+    
+    public void setInheritable( boolean inheritable )
+    {
+        this.inheritable = inheritable;
+    }
+    
     private List<String> attrOptions;
     
     public void setAttrOptions( List<String> attrOptions )
@@ -113,6 +120,7 @@
         patientAttribute.setDescription( description );
         patientAttribute.setValueType( valueType );
         patientAttribute.setMandatory( mandatory );
+        patientAttribute.setInheritable( inheritable );
         
         patientAttributeService.savePatientAttribute( patientAttribute );
         

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java	2010-06-23 19:59:35 +0000
@@ -106,6 +106,13 @@
         this.mandatory = mandatory;
     }
     
+    private boolean inheritable;
+    
+    public void setInheritable( boolean inheritable )
+    {
+        this.inheritable = inheritable;
+    }
+    
     private List<String> attrOptions;
     
     public void setAttrOptions( List<String> attrOptions )
@@ -126,6 +133,7 @@
          patientAttribute.setDescription( description );
          patientAttribute.setValueType( valueType );
          patientAttribute.setMandatory( mandatory );
+         patientAttribute.setInheritable( inheritable );
 
          HttpServletRequest request = ServletActionContext.getRequest();
          

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ShowAddRelationshipPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ShowAddRelationshipPatientAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ShowAddRelationshipPatientAction.java	2010-06-23 19:59:35 +0000
@@ -39,7 +39,10 @@
 import org.hisp.dhis.patient.PatientIdentifier;
 import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.patient.state.SelectedStateManager;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
 import org.hisp.dhis.relationship.RelationshipType;
 import org.hisp.dhis.relationship.RelationshipTypeService;
 
@@ -57,37 +60,21 @@
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
+    
+    private PatientService patientService;
 
     private SelectedStateManager selectedStateManager;
 
-    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
-    {
-        this.selectedStateManager = selectedStateManager;
-    }
-    
     private PatientAttributeService patientAttributeService;
     
-    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
-    {
-        this.patientAttributeService = patientAttributeService;
-    }
-    
     private PatientAttributeGroupService patientAttributeGroupService;
     
-    public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService )
-    {
-        this.patientAttributeGroupService = patientAttributeGroupService;
-    }
-    
     private PatientIdentifierTypeService patientIdentifierTypeService;
     
-    public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
-    {
-        this.patientIdentifierTypeService = patientIdentifierTypeService;
-    }
-    
     private RelationshipTypeService relationshipTypeService;
     
+    private PatientAttributeValueService patientAttributeValueService;
+    
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -104,6 +91,10 @@
     
     private Map<Integer, String> identiferMap;
     
+    private Map<Integer, String> attributeMap;
+    
+    private Integer id;
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -115,11 +106,23 @@
        
         noGroupAttributes = patientAttributeService.getPatientAttributesNotGroup();
         
-        attributeGroups  = patientAttributeGroupService.getAllPatientAttributeGroups();
+        attributeGroups = patientAttributeGroupService.getAllPatientAttributeGroups();
         
         relationshipTypes = relationshipTypeService.getAllRelationshipTypes();
         
-        patient = selectedStateManager.getSelectedPatient();
+        if( id == null )
+        {
+            patient = selectedStateManager.getSelectedPatient();
+        }
+        else 
+        {
+            patient = patientService.getPatient( id.intValue() );
+        }
+        
+        if( patient == null )
+        {
+            return ERROR;
+        }
         
         identiferMap = new HashMap<Integer, String>();
 
@@ -128,7 +131,19 @@
             if ( identifier.getIdentifierType() != null )
                 identiferMap.put( identifier.getIdentifierType().getId(), identifier.getIdentifier() );
         }
-
+        
+        attributeMap = new HashMap<Integer , String>();
+        
+        Collection<PatientAttributeValue> attributeValues = patientAttributeValueService.getPatientAttributeValues( patient );
+        
+        if( attributeValues != null && attributeValues.size() > 0 )
+        {
+            for( PatientAttributeValue attributeValue : attributeValues )
+            {
+                attributeMap.put( attributeValue.getPatientAttribute().getId(), attributeValue.getValue() );
+            }
+        }
+        
         return SUCCESS;
     }
     
@@ -136,6 +151,16 @@
     // Getter/Setter
     // -------------------------------------------------------------------------
     
+    public Integer getId()
+    {
+        return id;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+    
     public Collection<PatientIdentifierType> getIdentifierTypes()
     {
         return identifierTypes;
@@ -169,5 +194,39 @@
     {
         return identiferMap;
     }
-
+    
+    public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
+    {
+        this.patientIdentifierTypeService = patientIdentifierTypeService;
+    }
+    
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+    
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+
+    public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService )
+    {
+        this.patientAttributeGroupService = patientAttributeGroupService;
+    }
+
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+
+    public Map<Integer, String> getAttributeMap()
+    {
+        return attributeMap;
+    }
+
+    public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
+    {
+        this.patientAttributeValueService = patientAttributeValueService;
+    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2010-05-18 03:42:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2010-06-23 19:59:35 +0000
@@ -162,9 +162,15 @@
 	<bean id="org.hisp.dhis.patient.action.relationship.ShowAddRelationshipPatientAction"
 		class="org.hisp.dhis.patient.action.relationship.ShowAddRelationshipPatientAction"
 		scope="prototype">
+		<property name="patientService">
+			<ref bean="org.hisp.dhis.patient.PatientService" />
+		</property>
 		<property name="patientAttributeService">
 			<ref bean="org.hisp.dhis.patient.PatientAttributeService" />
 		</property>
+		<property name="patientAttributeValueService">
+			<ref bean="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
+		</property>
 		<property name="patientAttributeGroupService"
 			ref="org.hisp.dhis.patient.PatientAttributeGroupService" />
 		<property name="patientIdentifierTypeService">
@@ -373,6 +379,8 @@
 			ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
 		<property name="patientAttributeService"
 			ref="org.hisp.dhis.patient.PatientAttributeService" />
+		<property name="relationshipService"
+			ref="org.hisp.dhis.relationship.RelationshipService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.patient.action.patient.GetPatientAction"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2010-06-19 15:32:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2010-06-23 19:59:35 +0000
@@ -385,4 +385,9 @@
 intro_relationship_type = Create, modify and view relationship types. A relationship is typically wife and husband or mother and child.
 intro_program = Create, modify and view programs. A program has program stages and defines which actions should be taken at each stage.
 intro_case_aggregation_mapping = Set up aggregation rules for the process of aggregating patient data to statistical data.
-intro_validation_criteria = Create, modify and view validation criteria. A critera is used for validation of patient data.
\ No newline at end of file
+intro_validation_criteria = Create, modify and view validation criteria. A critera is used for validation of patient data.
+patient_info = Patient Information
+add_dependent = Add dependent
+inheritable = Inheritable
+show_patient_relationships = Show patient's relationship
+add_new_relationship_for = Add new relationship for
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2010-06-23 19:59:35 +0000
@@ -50,6 +50,17 @@
 	</tr>
     
     <tr>
+    	<td width="20em"><label for="inheritable">$i18n.getString( "inheritable" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+		<td>
+			<select id="inheritable" name="inheritable" style="min-width:20em">
+				<option value="true" >$i18n.getString( "yes" )</option>
+				<option value="false" selected="selected">$i18n.getString( "no" )</option>
+			</select>
+		</td>		
+		<td></td>				
+	</tr>
+    
+    <tr>
         <td width="20em"><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
         <td>
             <select id="valueType" name="valueType" style="min-width:20em" onchange="ATTRIBUTE_OPTION.selectValueType(this);">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm	2010-04-05 12:33:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm	2010-06-23 19:59:35 +0000
@@ -1,7 +1,6 @@
 <style>
 td.input-column { width : 30em;}
-td.input-column input, td.input-column select { width: 28.5em; float:right ;}
-
+td.input-column input, td.input-column select { width: 28em; float:right ;}
 </style>
 
 ## Macro for generating the jQuery validation rules 
@@ -140,18 +139,20 @@
 		<tr><td>&nbsp;</td></tr>
 		<tr><th colspan="2">$attributeGroup.name</th></tr>
 		#foreach($attribute in $attributeGroup.attributes )
+		#set( $attributeValue = "" ) 
+		#set( $attributeValue = $attributeMap.get( $attribute.id ) ) 
 			<tr >
 				<td><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
 				<td class="input-column">
 					#if( $attribute.valueType == "YES/NO" )
-		                <select id="attr$attribute.id"  name="attr$attribute.id" style="width:100%"  > 
+		                <select id="attr$attribute.id"  name="attr$attribute.id" style="width:100%" class="attrField" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" >  
 		                	<option value="">[$i18n.getString( "please_select" )]</option>             
 		                    <option value="true">$i18n.getString( "yes" )</option>
 		                    <option value="false" selected="selected">$i18n.getString( "no" )</option>
 		                </select>                
 		            #elseif( $attribute.valueType == "DATE" )
 	                    <img src="../images/calendar_icon.gif" width="16" height="16" id="getDateValue$attribute.id" style="cursor: pointer;" title="$i18n.getString("date_selector")" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''" alt="$i18n.getString( "date" )">
-	                	<input type="text" id="attr$attribute.id"  name="attr$attribute.id"  class=' #validate( "default"  $attribute.mandatory )'>
+	                	<input type="text" id="attr$attribute.id"  name="attr$attribute.id" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" class='attrField #validate( "default"  $attribute.mandatory )'>
 	                    <script type="text/javascript">
 	                        Calendar.setup({
 	                            inputField     :    "attr$attribute.id",      // id of the input field
@@ -160,14 +161,14 @@
 	                        });
 	                    </script>                    
 					#elseif( $attribute.valueType == "COMBO" )
-						<select  id="attr$attribute.id"  name="attr$attribute.id"  class=' #validate( "default"  $attribute.mandatory )' >
+						<select  id="attr$attribute.id"  name="attr$attribute.id"  data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" class='attrField #validate( "default"  $attribute.mandatory )' >
 							 <option value="">[$i18n.getString( "please_select" )]</option>
 							#foreach ($option in $attribute.attributeOptions )
 								<option value="$option.id" >$option.name</option>
 							#end
 						</select>
 					#else 
-						<input type="text"  id="attr$attribute.id"  name="attr$attribute.id"  class=' #validate( $attribute.valueType  $attribute.mandatory )'   >
+						<input type="text"  id="attr$attribute.id"  name="attr$attribute.id"  data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" class='attrField #validate( $attribute.valueType  $attribute.mandatory )'   >
 					#end
 				</td>		
 			</tr>
@@ -180,18 +181,20 @@
 	#if ( $noGroupAttributes.size() > 0) 	
 		<tr><th colspan="2">$i18n.getString( "other_details" )</th></tr>
 		#foreach($attribute in $noGroupAttributes )
+		#set( $attributeValue = "" ) 
+		#set( $attributeValue = $attributeMap.get( $attribute.id ) ) 
 			<tr>
 				<td><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
 				<td class="input-column">
 					#if( $attribute.valueType == "YES/NO" )
-		                <select id="attr$attribute.id"  name="attr$attribute.id"  style="width:100%" > 
+		               <select id="attr$attribute.id"  name="attr$attribute.id"  style="width:100%"  data="{inheritable:$attribute.inheritable,value:'$attributeValue'}" >  
 		                	 <option value="" >[$i18n.getString( "please_select" )]</option>             
 		                    <option value="true">$i18n.getString( "yes" )</option>
 		                    <option value="false" >$i18n.getString( "no" )</option>
 		                </select>                
 		            #elseif( $attribute.valueType == "DATE" )
 		                    <img src="../images/calendar_icon.gif" width="16" height="16" id="getDateValue$attribute.id" style="cursor: pointer;" title="$i18n.getString("date_selector")" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''" alt="$i18n.getString( "date" )">
-		                	<input type="text" id="attr$attribute.id"   name="attr$attribute.id"  class=' #validate( "default"  $attribute.mandatory )' >
+		                	<input type="text" id="attr$attribute.id"   name="attr$attribute.id" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}"  class='attrField #validate( "default"  $attribute.mandatory )' >
 		                    <script type="text/javascript">
 		                        Calendar.setup({
 		                            inputField     :    "attr$attribute.id",      // id of the input field
@@ -200,14 +203,14 @@
 		                        });
 		                    </script>                    
 					#elseif( $attribute.valueType == "COMBO" )
-						<select  id="attr$attribute.id"  name="attr$attribute.id"   class=' #validate( "default"  $attribute.mandatory )'>
+						<select  id="attr$attribute.id"  name="attr$attribute.id" data="{inheritable:$attribute.inheritable,value:'$attributeValue'}"   class='attrField #validate( "default"  $attribute.mandatory )'>
 							 <option value="">[$i18n.getString( "please_select" )]</option>
 							#foreach ($option in $attribute.attributeOptions )
 								<option value="$option.id" >$option.name</option>
 							#end
 						</select>
 					#else 
-						<input type="text"  id="attr$attribute.id" name="attr$attribute.id"   class=' #validate( $attribute.valueType  $attribute.mandatory )'    >
+						<input type="text"  id="attr$attribute.id" name="attr$attribute.id"  data="{inheritable:$attribute.inheritable,value:'$attributeValue'}"  class='attrField #validate( $attribute.valueType  $attribute.mandatory )'    >
 					#end
 				</td>		
 			</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2010-06-16 12:16:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2010-06-23 19:59:35 +0000
@@ -623,4 +623,73 @@
 	var pageSize = jQuery("#sizeOfPage").val();
 	var currentPage = jQuery("#jumpToPage").val();
 	window.location.href = baseLink +"pageSize=" + pageSize +"&currentPage=" +currentPage;
-}
\ No newline at end of file
+}
+
+function toggleRelationshipRow(this_)
+{
+	if( jQuery(this_).attr("checked") ) 
+	{
+		jQuery("tr.relationship-row").each(function(){jQuery(this).show()});
+	}else {
+		jQuery("tr.relationship-row").each(function(){jQuery(this).hide()});
+	}
+}
+
+/**
+ * Overwrite showDetails() of common.js
+ * This method will show details div on a pop up instead of show the div in the main table's column.
+ * So we will have more place for the main column of the table.
+ * @return
+ */
+
+function showDetails()
+{
+	var detailArea = $("#detailsArea");
+	var top = (f_clientHeight() / 2) - 200;	
+	if ( top < 0 ) top = 0; 
+    var left = screen.width - detailArea.width() - 100;
+    detailArea.css({"left":left+"px","top":top+"px"});
+    detailArea.show('fast');
+    
+}
+
+/**
+ *  Get document width, hieght, scroll positions
+ *  Work with all browsers
+ * @return
+ */
+
+function f_clientWidth() {
+	return f_filterResults (
+		window.innerWidth ? window.innerWidth : 0,
+		document.documentElement ? document.documentElement.clientWidth : 0,
+		document.body ? document.body.clientWidth : 0
+	);
+}
+function f_clientHeight() {
+	return f_filterResults (
+		window.innerHeight ? window.innerHeight : 0,
+		document.documentElement ? document.documentElement.clientHeight : 0,
+		document.body ? document.body.clientHeight : 0
+	);
+}
+function f_scrollLeft() {
+	return f_filterResults (
+		window.pageXOffset ? window.pageXOffset : 0,
+		document.documentElement ? document.documentElement.scrollLeft : 0,
+		document.body ? document.body.scrollLeft : 0
+	);
+}
+function f_scrollTop() {
+	return f_filterResults (
+		window.pageYOffset ? window.pageYOffset : 0,
+		document.documentElement ? document.documentElement.scrollTop : 0,
+		document.body ? document.body.scrollTop : 0
+	);
+}
+function f_filterResults(n_win, n_docel, n_body) {
+	var n_result = n_win ? n_win : 0;
+	if (n_docel && (!n_result || (n_result > n_docel)))
+		n_result = n_docel;
+	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js	2010-04-05 12:33:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js	2010-06-23 19:59:35 +0000
@@ -150,6 +150,15 @@
 			if( data.related )
 			{
 				jQuery(this).val("");
+				jQuery(this).attr({"disabled":""});
+			}
+		});
+		jQuery(".attrField").each(function(){
+			var data = jQuery(this).metadata({type:"attr",name:"data"});
+			if( data.inheritable )
+			{
+				jQuery(this).val("");
+//				jQuery(this).attr({"disabled":""});
 			}
 		});
 	}else {
@@ -161,6 +170,14 @@
 				jQuery(this).attr({"disabled":"disabled"});
 			}
 		});
+		jQuery(".attrField").each(function(){
+			var data = jQuery(this).metadata({type:"attr",name:"data"});
+			if( data.inheritable )
+			{
+				jQuery(this).val(data.value);
+//				jQuery(this).attr({"disabled":"disabled"});
+			}
+		});
 	}
 }
 function ageOnchange()

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm	2010-06-23 09:02:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm	2010-06-23 19:59:35 +0000
@@ -6,6 +6,12 @@
 	#set ($sText = "" )
  #end
 
+<style>
+tr.relationship-row{background-color: #BFFFC2; display : none}
+</style>
+
+
+
 <table>
 	<tr>
 		<td>$i18n.getString( "search_result_matching_the_search_criteria" )</td>
@@ -20,7 +26,12 @@
 		<td>$total</td>
 	</tr>
 </table>
- 
+ <table>
+ <tr>
+ 	<td><label>$i18n.getString('show_patient_relationships')</label></td>
+ 	<td><input type="checkbox" onclick="toggleRelationshipRow(this)"/></td>
+ </tr>
+ </table>
 <table class="mainPageTable">
   	
   <tr>
@@ -38,7 +49,8 @@
           <col width="20">
           <!--<col width="20">-->
           <col width="20">
-          <col width="20">    
+          <col width="20">   
+          <col width="20">     
           
 		  <tr>
 		  	<td></td>
@@ -48,7 +60,7 @@
 		  	<td></td>
 		  	<td></td>
 		  	<td></td>
-		  	<td colspan="6" style="text-align:right">			
+		  	<td colspan="7" style="text-align:right">			
 				<input type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='patient.action'" style="width:10em">
 			</td>
           <tr>
@@ -59,13 +71,14 @@
             <th>$i18n.getString( "gender" )</th>
             <th>$i18n.getString( "date_of_birth" )</th> 
             <th>$i18n.getString( "age" )</th>
-            <th colspan="6" style="text-align:center">$i18n.getString( "operations" )</th>
+            <th colspan="7" style="text-align:center">$i18n.getString( "operations" )</th>
           </tr>
           
           <tbody id="list">	
           #set( $mark = false )
         
           #foreach( $patient in $patients )
+			#set( $mark = !$mark)
           	<tr #alternate( $mark )>
           		<td>			
 					#set( $nr = ( ( $pagingUtil.currentPage - 1  ) * $pagingUtil.pageSize ) + $velocityCount )
@@ -104,7 +117,11 @@
                 -->
                 <td style="text-align:center"#alternate( $mark )>                  
                   <a href="showRelationshipList.action?id=$patient.id" title="$i18n.getString( "manage_relationship" )"><img src="../images/relationship.png" alt="$i18n.getString( "manage_relationship" )"></a>
-                </td>                                
+                </td>        
+                
+                <td style="text-align:center"#alternate( $mark )>                  
+                  <a href="showAddRelationshipPatient.action?id=$patient.id" title="$i18n.getString( "add_dependent" )"><img src="images/addRelationship.png" alt="$i18n.getString( "add_dependent" )"></a>
+                </td>                        
  
                 <td style="text-align:center"#alternate( $mark )>
                   <a href="javascript:removePatient( '$patient.id', '$encoder.jsEncode( $patient.getFullName() )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
@@ -115,27 +132,78 @@
                 </td>
 				
 			</tr>
-			#if( $mark )
-				#set( $mark = false )
-			#else
-				#set( $mark = true )
+			#set( $relationships = $mapRelationShip.get($patient.id))
+			 #foreach( $relationship in $relationships )
+               <tr class="relationship-row listrow" >
+                   #set( $partnerId = false )    
+                   #if( $relationship.patientA.id == $patient.id )
+                       #set( $partnerId = $relationship.patientB.id )
+                       #set ( $partner = $relationship.patientB ) 
+                       <td>                                
+                           $encoder.htmlEncode( $relationship.relationshipType.BIsToA )
+                       </td>
+                   #elseif($relationship.patientB.id == $patient.id )
+                       #set( $partnerId = $relationship.patientA.id )
+                       #set ( $partner = $relationship.patientA )
+                       <td>                                
+                           $encoder.htmlEncode( $relationship.relationshipType.AIsToB )
+                       </td>
+                   #end                  
+                    <td>			
+						$encoder.htmlEncode( $partner.firstName )
+					</td>
+					<td>			
+						$encoder.htmlEncode( $partner.middleName )
+					</td>
+					<td>			
+						$encoder.htmlEncode( $partner.lastName )
+					</td>
+                   <td>
+                   		$encoder.htmlEncode( $partner.gender )
+                   </td>
+                   
+                   <td>			
+						$format.formatDate( $partner.birthDate )
+				   </td>
+                   
+                  <td >            
+                    $encoder.htmlEncode( $partner.getAge() )
+	                </td>
+					
+					<td style="text-align:center">
+	                  <a href="showProgramEnrollmentForm.action?id=$partner.id" title="$i18n.getString( "manage_program_enrollment" )"><img src="../images/enroll.png" alt="$i18n.getString( "manage_program_enrollment" )"></a>                  
+	                </td>                
+	                
+	                <td style="text-align:center">                  
+	                  <a href="showUpdatePatientForm.action?id=$patient.id" title="$i18n.getString( "edit_profile" )"><img src="../images/edit.png" alt="$i18n.getString( "edit_profile" )"></a>
+	                </td>
+	                
+	                <td style="text-align:center">
+	                  <a href="showUpdatePatientAttributeValueForm.action?id=$patient.id" title="$i18n.getString( "edit_attribute_values" )"><img src="../images/attribute.png" alt="$i18n.getString( "edit_attribute_values" )"></a>
+	                </td>
+	                
+	                <td style="text-align:center">                  
+	                  <a href="showRelationshipList.action?id=$patient.id" title="$i18n.getString( "manage_relationship" )"><img src="../images/relationship.png" alt="$i18n.getString( "manage_relationship" )"></a>
+	                </td>        
+	                
+	                <td style="text-align:center">                  
+	                  <a href="showAddRelationshipPatient.action?id=$patient.id" title="$i18n.getString( "add_dependent" )"><img src="images/addRelationship.png" alt="$i18n.getString( "add_dependent" )"></a>
+	                </td>                        
+	 
+	                <td style="text-align:center">
+	                  <a href="javascript:removePatient( '$partner.id', '$encoder.jsEncode( $partner.getFullName() )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
+	                </td>            
+	                
+	                <td style="text-align:center">
+	                  <a href="javascript:showPatientDetails( $partner.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a>
+	                </td>
+               </tr>
 			#end
     	#end
     	</tbody>
     
 	 </table>
     </td>
-		<td style="width:20em; padding-left:2em; vertical-align:top">
-			<div id="detailsArea" style="display:none">
-				<div style="float:right">
-					<a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/close.png" alt="$i18n.getString( "hide_details" )"></a>
-				</div>			    
-				<p><label>$i18n.getString( "identifier" ):</label><br><span id="identifierField"></span></p>				    
-				<p><label>$i18n.getString( "attributes" ):</label><br><span id="attributeField"></span></p>
-				<p><label>$i18n.getString( "enrolled_in_program" ):</label><br><span id="programField"></span></p>
-			</div>
-
-		</td>
   </tr>
   <tr>
   	<td colspan="6">
@@ -153,3 +221,11 @@
 	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
 </script>
 
+<div id="detailsArea" style="display:none;overflow:auto;height:250px;width:250px">
+	<div style="float:right">
+		<a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/close.png" alt="$i18n.getString( "hide_details" )"></a>
+	</div>			    
+	<p><label>$i18n.getString( "identifier" ):</label><br><span id="identifierField"></span></p>				    
+	<p><label>$i18n.getString( "attributes" ):</label><br><span id="attributeField"></span></p>
+	<p><label>$i18n.getString( "enrolled_in_program" ):</label><br><span id="programField"></span></p>
+</div>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2010-03-05 06:24:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2010-06-23 19:59:35 +0000
@@ -54,8 +54,19 @@
 		<td width="20em"><label for="mandatory">$i18n.getString( "mandatory" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 		<td>
 			<select id="mandatory" name="mandatory" style="min-width:20em">
-				<option value="yes" #if( $patientAttribute.mandatory ) selected="selected" #end>$i18n.getString( "yes" )</option>
-				<option value="no" #if( !$patientAttribute.mandatory ) selected="selected" #end>$i18n.getString( "no" )</option>
+				<option value="true" #if( $patientAttribute.mandatory ) selected="selected" #end>$i18n.getString( "yes" )</option>
+				<option value="false" #if( !$patientAttribute.mandatory ) selected="selected" #end>$i18n.getString( "no" )</option>
+			</select>
+		</td>		
+		<td></td>				
+	</tr>
+	
+	<tr>
+		<td width="20em"><label for="inheritable">$i18n.getString( "inheritable" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+		<td>
+			<select id="inheritable" name="inheritable" style="min-width:20em">
+				<option value="true" #if( $patientAttribute.inheritable) selected="selected" #end>$i18n.getString( "yes" )</option>
+				<option value="false" #if( !$patientAttribute.inheritable) selected="selected" #end>$i18n.getString( "no" )</option>
 			</select>
 		</td>		
 		<td></td>				

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm	2010-06-16 12:16:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm	2010-06-23 19:59:35 +0000
@@ -107,6 +107,7 @@
 		</td>
 	</tr>
 	#if($patient.underAge)
+		#set( $representative = $patient.representative ) 
 		<tr>
 			<td>$i18n.getString("representative")</td>
 			<td>$patient.representative.getFullName() <a title="$i18n.getString('patient_info')" href="#" id="btnRepresentativeInfo" rel="#representativeInfo"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a></td>
@@ -120,14 +121,8 @@
 	#set( $identifier = "" )
 	#set( $identifier = $identiferMap.get( $identifierType.id ) )
 	<tr>
-            <td><label for="bloodGroup">$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
-            #if($identifierType.format == "State Format")
-                <td><input type="hidden" id="iden$identifierType.id" name="iden$identifierType.id" value="$identifier"/>
-                <input type="text" id="orgunitcode" name="orgunitcode" disabled="disabled" value="$orgunitcode" maxlength="9" size="10"/>-<input type="text" id="progcode" name="progcode" value="$progcode" maxlength="1" size="1"/>-<input type="text" id="yearcode" value="$yearcode" name="yearcode" maxlength="2" size="2"/>-<input type="text" id="benicode" name="benicode" value="$benicode" maxlength="4" size="4"/></td>
-            #else
-                <td><input type="text" id="iden$identifierType.id" name="iden$identifierType.id" value="$identifier" data="{related:$identifierType.related}" #if($identifierType.related && $patient.underAge) disabled="disabled" #end class='#validate( "default"  $identifierType.mandatory )' style="width:30em" /></td>	
-            #end
-
+			<td><label for="bloodGroup">$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
+			<td><input type="text" id="iden$identifierType.id" name="iden$identifierType.id" value="$identifier" data="{related:$identifierType.related}" #if($identifierType.related && $patient.underAge) disabled="disabled" #end class='#validate( "default"  $identifierType.mandatory )' style="width:30em" /></td>	
 	</tr>
 	#end
 	<tr><td>&nbsp;</td></tr>
@@ -262,25 +257,25 @@
 <table>
 	<tr>
 		<td><strong>$i18n.getString("full_name")</strong></td>
-		<td>$patient.getFullName()</td>
+		<td>$representative.getFullName()</td>
 	</tr>
 	<tr>
 		<td><strong>$i18n.getString("gender")</strong></td>
-		<td> $patient.gender</td>
+		<td> $representative.gender</td>
 	</tr>
 	<tr>
 		<td><strong>$i18n.getString("birth_date")</strong></td>
-		<td>$format.formatDate( $patient.birthDate )</td>
+		<td>$format.formatDate( $representative.birthDate )</td>
 	</tr>
 	<tr>
 		<td><strong>$i18n.getString("age")</strong></td>
-		<td> $patient.getAge() </td>
+		<td> $representative.getAge() </td>
 	</tr>
 	<tr>
 		<td><strong>$i18n.getString("blood_group")</strong></td>
-		<td>$patient.getBloodGroup()</td>
+		<td>$representative.getBloodGroup()</td>
 	</tr>
-	#foreach( $patientIdentifier in $patient.identifiers )
+	#foreach( $patientIdentifier in $representative.identifiers )
 	  <tr>  
 	  	<td><strong>#if( $patientIdentifier.identifierType )$patientIdentifier.identifierType.name #else $i18n.getString("system_identifier") #end</strong></td>      
 	      <td> $patientIdentifier.identifier </td>
@@ -289,7 +284,7 @@
 	<tr>
 		<td><strong>$i18n.getString("programs")</strong></td>
 		<td>  
-			 #foreach( $program in $patient.programs )
+			 #foreach( $program in $representative.programs )
 			 	#if( $velocityCount == 1 )
 	      			 $program.name
 	      		#else ,  $program.name