← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2534: Change Death property of Patient object from option to compulsory property

 

------------------------------------------------------------
revno: 2534
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-01-12 09:35:14 +0700
message:
  Change Death property of Patient object from option to compulsory property
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java


--
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-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java	2011-01-11 01:56:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java	2011-01-12 02:35:14 +0000
@@ -191,6 +191,7 @@
         // ---------------------------------------------------------------------
 
         patient.setGender( gender );
+        patient.setIsDead( false );
         patient.setBloodGroup( bloodGroup );
         patient.setUnderAge( underAge );
         patient.setOrganisationUnit( organisationUnit );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java	2011-01-11 01:56:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java	2011-01-12 02:35:14 +0000
@@ -143,6 +143,7 @@
         // ---------------------------------------------------------------------
 
         patient.setGender( gender );
+        patient.setIsDead( false );
         patient.setBloodGroup( bloodGroup );
         patient.setOrganisationUnit( organisationUnit );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java	2011-01-11 10:06:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java	2011-01-12 02:35:14 +0000
@@ -28,6 +28,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Date;
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
@@ -88,15 +89,29 @@
     // -------------------------------------------------------------------------
     // Input - name
     // -------------------------------------------------------------------------
-   
+
     private String fullName;
 
     // -------------------------------------------------------------------------
     // Input - demographics
     // -------------------------------------------------------------------------
-    
+
     private String birthDate;
 
+    private boolean isDead;
+
+    private String deathDate;
+
+    public void setDead( boolean isDead )
+    {
+        this.isDead = isDead;
+    }
+
+    public void setDeathDate( String deathDate )
+    {
+        this.deathDate = deathDate;
+    }
+
     private Integer age;
 
     private char ageType;
@@ -133,21 +148,21 @@
         // ---------------------------------------------------------------------
 
         patient = patientService.getPatient( id );
-     
+
         // ---------------------------------------------------------------------
         // Set FirstName, MiddleName, LastName by FullName
         // ---------------------------------------------------------------------
 
         int startIndex = fullName.indexOf( ' ' );
         int endIndex = fullName.lastIndexOf( ' ' );
-        
+
         String name = fullName.substring( 0, startIndex );
-        patient.setFirstName( name);
-        
+        patient.setFirstName( name );
+
         if ( startIndex == endIndex )
         {
             patient.setMiddleName( "" );
-            
+
             name = fullName.substring( startIndex, fullName.length() );
             patient.setLastName( name );
         }
@@ -155,21 +170,28 @@
         {
             name = fullName.substring( startIndex + 1, endIndex );
             patient.setMiddleName( name );
-            
+
             name = fullName.substring( endIndex, fullName.length() );
             patient.setLastName( name );
         }
-        
+
         patient.setLastName( fullName.substring( endIndex, fullName.length() ) );
-    
+
         // ---------------------------------------------------------------------
         // Set Other information for patient
         // ---------------------------------------------------------------------
 
         patient.setGender( gender );
+       
+        patient.setIsDead( isDead );
+        if ( deathDate != null )
+        {
+            deathDate = deathDate.trim();
+            patient.setDeathDate( format.parseDate( deathDate ) );
+        }
         patient.setUnderAge( underAge );
         patient.setOrganisationUnit( organisationUnit );
-        
+
         if ( birthDate != null && !birthDate.isEmpty() )
         {
             birthDate = birthDate.trim();
@@ -179,7 +201,7 @@
         {
             patient.setBirthDateFromAge( age.intValue(), ageType );
         }
-        
+
         patient.setDobType( dobType );
 
         // -------------------------------------------------------------------------------------
@@ -197,7 +219,7 @@
         {
             for ( PatientIdentifierType identifierType : identifierTypes )
             {
-                if (  identifierType.getFormat()!= null && identifierType.getFormat().equals( "State Format" ) )
+                if ( identifierType.getFormat() != null && identifierType.getFormat().equals( "State Format" ) )
                 {
                     value = request.getParameter( "progcode" ) + request.getParameter( "yearcode" )
                         + request.getParameter( "benicode" );
@@ -208,11 +230,11 @@
                 }
 
                 identifier = patientIdentifierService.getPatientIdentifier( identifierType, patient );
-               
+
                 if ( StringUtils.isNotBlank( value ) )
                 {
                     value = value.trim();
-                    
+
                     if ( identifier == null )
                     {
                         identifier = new PatientIdentifier();
@@ -228,9 +250,9 @@
                     }
                 }
                 else if ( identifier != null )
-                { 
-                   patient.getIdentifiers().remove( identifier );
-                   patientIdentifierService.deletePatientIdentifier( identifier );
+                {
+                    patient.getIdentifiers().remove( identifier );
+                    patientIdentifierService.deletePatientIdentifier( identifier );
                 }
             }
         }
@@ -413,12 +435,12 @@
     {
         this.relationshipTypeId = relationshipTypeId;
     }
-    
+
     public void setDobType( Character dobType )
     {
         this.dobType = dobType;
     }
-    
+
     public void setAgeType( char ageType )
     {
         this.ageType = ageType;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java	2011-01-11 01:56:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java	2011-01-12 02:35:14 +0000
@@ -155,6 +155,7 @@
         // ---------------------------------------------------------------------
 
         patient.setGender( gender );
+        patient.setIsDead( false );
         patient.setBloodGroup( bloodGroup );
         patient.setUnderAge( underAge );
         patient.setOrganisationUnit( organisationUnit );