← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7080: (patient) Add missing files.

 

------------------------------------------------------------
revno: 7080
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-05-29 20:03:38 +0700
message:
  (patient) Add missing files.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadPatientPropertiesAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonPatientProperties.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
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadPatientPropertiesAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadPatientPropertiesAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadPatientPropertiesAction.java	2012-05-29 13:03:38 +0000
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.caseentry.action.report;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $LoadPatientPropertiesAction.java Apr 5, 2012 7:27:52 PM$
+ */
+public class LoadPatientPropertiesAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientIdentifierTypeService identifierTypeService;
+
+    private ProgramService programService;
+
+    private PatientAttributeService attributeService;
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private Integer programId;
+
+    private Collection<PatientIdentifierType> identifierTypes = new HashSet<PatientIdentifierType>();
+
+    private Collection<PatientAttribute> patientAttributes = new HashSet<PatientAttribute>();
+
+    // -------------------------------------------------------------------------
+    // Getter && Setters
+    // -------------------------------------------------------------------------
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService )
+    {
+        this.identifierTypeService = identifierTypeService;
+    }
+
+    public void setAttributeService( PatientAttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    public void setProgramId( Integer programId )
+    {
+        this.programId = programId;
+    }
+
+    public Collection<PatientIdentifierType> getIdentifierTypes()
+    {
+        return identifierTypes;
+    }
+
+    public Collection<PatientAttribute> getPatientAttributes()
+    {
+        return patientAttributes;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        Program program = programService.getProgram( programId );
+
+        identifierTypes = identifierTypeService.getPatientIdentifierTypesWithoutProgram();
+        identifierTypes.addAll( identifierTypeService.getPatientIdentifierTypes( program ) );
+
+        patientAttributes.addAll( attributeService.getPatientAttributes( null, null ) );
+        patientAttributes.addAll( attributeService.getPatientAttributes( program ) );
+
+        return SUCCESS;
+    }
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonPatientProperties.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonPatientProperties.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonPatientProperties.vm	2012-05-29 13:03:38 +0000
@@ -0,0 +1,48 @@
+{ "patientProperties": [
+  {
+	"id": "fixedAttr_firstName",
+	"name": "$i18n.getString('first_name')"
+  },
+  {
+	"id": "fixedAttr_middleName",
+	"name": "$i18n.getString('middle_name')"
+  },
+  {
+	"id": "fixedAttr_lastName",
+	"name": "$i18n.getString('last_name')"
+  },
+  {
+	"id": "fixedAttr_gender",
+	"name": "$i18n.getString('gender')"
+  },
+  {
+	"id": "fixedAttr_birthDate",
+	"name": "$i18n.getString('date_of_birth')"
+  },
+  {
+	"id": "fixedAttr_dobType",
+	"name": "$i18n.getString('dob_type')"
+  },
+  {
+	"id": "fixedAttr_phoneNumber",
+	"name": "$i18n.getString('phone_number')"
+  },
+  {
+	"id": "fixedAttr_deathdate",
+	"name": "$i18n.getString('death_date')"
+  },
+  #foreach( ${identifierType} in $!{identifierTypes} )
+  {
+	"id": "iden_${identifierType.id}",
+	"name": "$!encoder.jsonEncode( ${identifierType.name} )"
+  },
+  #end
+  #set( $size = $!{patientAttributes.size()} )
+  #foreach( $patientAttribute in $!{patientAttributes} )
+  {
+    "id": "attr_${patientAttribute.id}",
+	"name": "$!encoder.jsonEncode( ${patientAttribute.name} )"
+  }#if( $velocityCount < $size ),#end
+  #end
+  ]
+}
\ No newline at end of file