dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27423
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13659: Add more property for PatientIdentifier to specify the ID type will be displayed in person list.
------------------------------------------------------------
revno: 13659
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-01-08 23:13:32 +0700
message:
Add more property for PatientIdentifier to specify the ID type will be displayed in person list.
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/comparator/PatientIdentifierTypeSortOrderInListNoProgramComparator.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeInListNoProgram.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifierType.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetAttributesByProgramAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientIdentifierType.vm
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/SavePatientAttributeInListNoProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowPatientAttributeInListNoProgramAction.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/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/index.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.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/PatientIdentifierType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java 2014-01-07 15:02:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java 2014-01-08 16:13:32 +0000
@@ -28,14 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.period.PeriodType;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
@XmlRootElement( name = "patientIdentifierType", namespace = DxfNamespaces.DXF_2_0 )
@XmlAccessorType( value = XmlAccessType.NONE )
public class PatientIdentifierType
@@ -74,6 +74,10 @@
private PeriodType periodType;
+ private Boolean displayInListNoProgram = false;
+
+ private Integer sortOrderInListNoProgram;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -192,4 +196,24 @@
this.periodType = periodType;
}
+ public Boolean getDisplayInListNoProgram()
+ {
+ return displayInListNoProgram;
+ }
+
+ public void setDisplayInListNoProgram( Boolean displayInListNoProgram )
+ {
+ this.displayInListNoProgram = displayInListNoProgram;
+ }
+
+ public Integer getSortOrderInListNoProgram()
+ {
+ return sortOrderInListNoProgram;
+ }
+
+ public void setSortOrderInListNoProgram( Integer sortOrderInListNoProgram )
+ {
+ this.sortOrderInListNoProgram = sortOrderInListNoProgram;
+ }
+
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java 2014-01-07 19:37:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java 2014-01-08 16:13:32 +0000
@@ -105,4 +105,13 @@
* @return PatientIdentifierType list
*/
Collection<PatientIdentifierType> getPatientIdentifierTypes( boolean mandatory );
+
+ /**
+ * Get patient identifier type which are displayed in list
+ *
+ * @param displayInListNoProgram True/False value
+ *
+ * @return List of patient attributes
+ */
+ Collection<PatientIdentifierType> getPatientIdentifierTypeDisplayed( boolean displayInListNoProgram );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java 2014-01-07 19:37:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java 2014-01-08 16:13:32 +0000
@@ -43,5 +43,13 @@
* @return PatientIdentifierType list
*/
Collection<PatientIdentifierType> get( boolean mandatory );
-
+
+ /**
+ * Get patient identifier type which are displayed in list
+ *
+ * @param displayInListNoProgram True/False value
+ *
+ * @return List of patient attributes
+ */
+ Collection<PatientIdentifierType> getPatientIdentifierTypeDisplayed( boolean displayInListNoProgram );
}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/comparator/PatientIdentifierTypeSortOrderInListNoProgramComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/comparator/PatientIdentifierTypeSortOrderInListNoProgramComparator.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/comparator/PatientIdentifierTypeSortOrderInListNoProgramComparator.java 2014-01-08 16:13:32 +0000
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2004-2013, 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.patient.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.patient.PatientIdentifierType;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ PatientIdentifierTypeSortOrderInListNoProgramComparator.java Jan
+ * 8, 2014 10:26:50 PM $
+ */
+public class PatientIdentifierTypeSortOrderInListNoProgramComparator
+ implements Comparator<PatientIdentifierType>
+{
+ public int compare( PatientIdentifierType patientIdentifierType0, PatientIdentifierType patientIdentifierType1 )
+ {
+ if ( patientIdentifierType0.getSortOrderInListNoProgram() == null
+ || patientIdentifierType0.getSortOrderInListNoProgram() == 0 )
+ {
+ return patientIdentifierType0.getName().compareTo( patientIdentifierType1.getName() );
+ }
+
+ if ( patientIdentifierType1.getSortOrderInListNoProgram() == null
+ || patientIdentifierType1.getSortOrderInListNoProgram() == 0 )
+ {
+ return patientIdentifierType0.getName().compareTo( patientIdentifierType1.getName() );
+ }
+
+ return patientIdentifierType0.getSortOrderInListNoProgram()
+ - patientIdentifierType1.getSortOrderInListNoProgram();
+ }
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java 2014-01-07 15:02:45 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java 2014-01-08 16:13:32 +0000
@@ -97,7 +97,7 @@
patientIdentifierType.setPeriodType( periodType );
}
-
+
return patientIdentifierTypeStore.save( patientIdentifierType );
}
@@ -128,4 +128,8 @@
return i18n( i18nService, patientIdentifierTypeStore.get( mandatory ) );
}
+ public Collection<PatientIdentifierType> getPatientIdentifierTypeDisplayed( boolean displayInListNoProgram )
+ {
+ return i18n( i18nService, patientIdentifierTypeStore.getPatientIdentifierTypeDisplayed( displayInListNoProgram ) );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java 2014-01-07 15:02:45 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java 2014-01-08 16:13:32 +0000
@@ -45,4 +45,9 @@
return getCriteria( Restrictions.eq( "mandatory", mandatory ) ).list();
}
+ @SuppressWarnings( "unchecked" )
+ public Collection<PatientIdentifierType> getPatientIdentifierTypeDisplayed( boolean displayInListNoProgram )
+ {
+ return getCriteria( Restrictions.eq( "displayInListNoProgram", displayInListNoProgram ) ).list();
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2014-01-08 16:13:32 +0000
@@ -303,6 +303,7 @@
executeSql( "ALTER TABLE patientidentifiertype DROP COLUMN personDisplayName" );
executeSql( "UPDATE patientattribute SET displayInListNoProgram=false WHERE displayInListNoProgram is null" );
+ executeSql( "UPDATE PatientIdentifierType SET displayInListNoProgram=false WHERE displayInListNoProgram is null" );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifierType.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifierType.hbm.xml 2014-01-07 15:02:45 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifierType.hbm.xml 2014-01-08 16:13:32 +0000
@@ -32,5 +32,7 @@
<many-to-one name="periodType" class="org.hisp.dhis.period.PeriodType" column="periodtypeid"
foreign-key="fk_patientidentifiertype_periodtypeid" />
+ <property name="displayInListNoProgram" />
+
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetAttributesByProgramAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetAttributesByProgramAction.java 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetAttributesByProgramAction.java 2014-01-08 16:13:32 +0000
@@ -31,6 +31,7 @@
import java.util.List;
import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramPatientAttributeService;
import org.hisp.dhis.program.ProgramService;
@@ -56,6 +57,9 @@
@Autowired
private ProgramPatientAttributeService programPatientAttributeService;
+ @Autowired
+ private PatientAttributeService patientAttributeService;
+
// -------------------------------------------------------------------------
// Getter && Setter
// -------------------------------------------------------------------------
@@ -90,9 +94,9 @@
}
else
{
-
+ attributes = new ArrayList<PatientAttribute>( patientAttributeService.getPatientAttributesDisplayed( true ) );
}
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java 2014-01-08 16:13:32 +0000
@@ -47,6 +47,7 @@
import org.hisp.dhis.patient.PatientIdentifierTypeService;
import org.hisp.dhis.patient.PatientService;
import org.hisp.dhis.patient.comparator.PatientAttributeSortOrderInListNoProgramComparator;
+import org.hisp.dhis.patient.comparator.PatientIdentifierTypeSortOrderInListNoProgramComparator;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramPatientAttributeService;
import org.hisp.dhis.program.ProgramPatientIdentifierTypeService;
@@ -223,9 +224,9 @@
return attributes;
}
- private Collection<PatientIdentifierType> identifierTypes;
+ private List<PatientIdentifierType> identifierTypes;
- public Collection<PatientIdentifierType> getIdentifierTypes()
+ public List<PatientIdentifierType> getIdentifierTypes()
{
return identifierTypes;
}
@@ -310,10 +311,13 @@
else
{
attributes = new ArrayList<PatientAttribute>( patientAttributeService.getPatientAttributesDisplayed( true ) );
-
Collections.sort( attributes, new PatientAttributeSortOrderInListNoProgramComparator() );
+
+ identifierTypes = new ArrayList<PatientIdentifierType>(
+ patientIdentifierTypeService.getPatientIdentifierTypeDisplayed( true ) );
+ Collections.sort( identifierTypes, new PatientIdentifierTypeSortOrderInListNoProgramComparator() );
}
-
+
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js 2014-01-08 16:13:32 +0000
@@ -115,8 +115,8 @@
else
{
jQuery("input[name=aggregateValues]:checked").each(function( ){
- params += "aggregateValues=" + $(this).val() + "&";
- });
+ params += "aggregateValues=" + $(this).val() + "&";
+ });
}
$.ajax({
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm 2014-01-08 16:13:32 +0000
@@ -39,6 +39,9 @@
#end
#end
#else
+ #foreach( $identifierType in $identifierTypes)
+ <col/>
+ #end
#foreach( $attribute in $attributes)
<col/>
#end
@@ -65,6 +68,9 @@
#end
#end
#else
+ #foreach( $identifierType in $identifierTypes)
+ <th>$encoder.htmlEncode($identifierType.displayName)</th>
+ #end
#foreach( $attribute in $attributes)
<th id="patientAttributeName">$encoder.htmlEncode($attribute.displayName)</th>
#end
@@ -117,13 +123,25 @@
#end
#end
#else
+ #foreach( $identifierType in $identifierTypes)
+ #set($value="")
+ <td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
+ #foreach( $identifier in $patient.identifiers)
+ #if($!identifier.identifierType.id==$identifierType.id)
+ #set($value=$identifier.identifier)
+ #end
+ #end
+ <a>$encoder.htmlEncode($value)</a>
+ </td>
+ #end
+
#foreach( $attribute in $attributes)
#set($value="")
<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
#foreach( $attributeValue in $patient.attributeValues)
- #if($!attributeValue.patientAttribute.id==$programAttribute.patientAttribute.id)
+ #if($!attributeValue.patientAttribute.id==$attribute.id)
#set($value=$attributeValue.value)
- #if( $programAttribute.patientAttribute.valueType == 'bool')
+ #if( $attribute.valueType == 'bool')
#set($value=$i18n.getString($attributeValue.value))
#end
#end
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2014-01-08 16:13:32 +0000
@@ -47,6 +47,9 @@
#end
#end
#else
+ #foreach( $identifierType in $identifierTypes)
+ <col/>
+ #end
#foreach( $attribute in $attributes)
<col/>
#end
@@ -72,6 +75,9 @@
#end
#end
#else
+ #foreach( $identifierType in $identifierTypes)
+ <th>$encoder.htmlEncode($identifierType.displayName)</th>
+ #end
#foreach( $attribute in $attributes)
<th id="patientAttributeName">$encoder.htmlEncode($attribute.displayName)</th>
#end
@@ -127,6 +133,18 @@
#end
#end
#else
+ #foreach( $identifierType in $identifierTypes)
+ #set($value="")
+ <td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
+ #foreach( $identifier in $patient.identifiers)
+ #if($!identifier.identifierType.id==$identifierType.id)
+ #set($value=$identifier.identifier)
+ #end
+ #end
+ <a>$encoder.htmlEncode($value)</a>
+ </td>
+ #end
+
#foreach( $patientAttribute in $attributes)
#set($value="")
<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.uid' )">
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientIdentifierType.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientIdentifierType.vm 2012-09-17 06:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientIdentifierType.vm 2014-01-08 16:13:32 +0000
@@ -6,6 +6,7 @@
"mandatory": "$!{patientIdentifierType.mandatory}",
"related": "$!{patientIdentifierType.related}",
"noChars": "$!{patientIdentifierType.noChars}",
+ "displayInListNoProgram": "$!patientIdentifierType.displayInListNoProgram",
"type": "$!{patientIdentifierType.type}"
}
}
\ No newline at end of file
=== 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 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java 2014-01-08 16:13:32 +0000
@@ -115,13 +115,6 @@
this.expression = expression;
}
- private Boolean displayInListNoProgram;
-
- public void setDisplayInListNoProgram( Boolean displayInListNoProgram )
- {
- this.displayInListNoProgram = displayInListNoProgram;
- }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -137,9 +130,6 @@
patientAttribute.setExpression( expression );
patientAttribute.setDisplayOnVisitSchedule( false );
- displayInListNoProgram = (displayInListNoProgram == null) ? false : true;
- patientAttribute.setDisplayInListNoProgram( displayInListNoProgram );
-
mandatory = (mandatory == null) ? false : true;
patientAttribute.setMandatory( mandatory );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/SavePatientAttributeInListNoProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/SavePatientAttributeInListNoProgramAction.java 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/SavePatientAttributeInListNoProgramAction.java 2014-01-08 16:13:32 +0000
@@ -31,6 +31,9 @@
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.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -43,6 +46,9 @@
public class SavePatientAttributeInListNoProgramAction
implements Action
{
+ private final String PREFIX_IDENTYFITER_TYPE = "iden";
+
+ private final String PREFIX_ATTRIBUTE = "attr";
// -------------------------------------------------------------------------
// Dependencies
@@ -55,13 +61,16 @@
this.patientAttributeService = patientAttributeService;
}
+ @Autowired
+ private PatientIdentifierTypeService patientIdentifierTypeService;
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
- private Integer[] selectedAttributeIds;
+ private String[] selectedAttributeIds;
- public void setSelectedAttributeIds( Integer[] selectedAttributeIds )
+ public void setSelectedAttributeIds( String[] selectedAttributeIds )
{
this.selectedAttributeIds = selectedAttributeIds;
}
@@ -73,20 +82,51 @@
public String execute()
throws Exception
{
+ Collection<PatientIdentifierType> patientIdentifierTypes = patientIdentifierTypeService
+ .getAllPatientIdentifierTypes();
Collection<PatientAttribute> patientAttributes = patientAttributeService.getAllPatientAttributes();
- int index = 1;
- for ( Integer attributeId : selectedAttributeIds )
- {
- PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( attributeId );
- patientAttribute.setDisplayInListNoProgram( true );
- patientAttribute.setSortOrderInListNoProgram( index );
- patientAttributeService.updatePatientAttribute( patientAttribute );
- index++;
- patientAttributes.remove( patientAttribute );
- }
-
- // Set visitSchedule=false for other patientAttributes
+ int indexIden = 1;
+ int indexAttr = 1;
+ for ( String objectId : selectedAttributeIds )
+ {
+ // Identifier type
+
+ String[] id = objectId.split( "_" );
+ if ( id[0].equals( PREFIX_IDENTYFITER_TYPE ) )
+ {
+
+ PatientIdentifierType identifierType = patientIdentifierTypeService.getPatientIdentifierType( Integer
+ .parseInt( id[1] ) );
+ identifierType.setDisplayInListNoProgram( true );
+ identifierType.setSortOrderInListNoProgram( indexIden );
+ patientIdentifierTypeService.updatePatientIdentifierType( identifierType );
+ indexIden++;
+ patientIdentifierTypes.remove( identifierType );
+ }
+
+ // Attribute
+ else
+ {
+ PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( Integer
+ .parseInt( id[1] ) );
+ patientAttribute.setDisplayInListNoProgram( true );
+ patientAttribute.setSortOrderInListNoProgram( indexAttr );
+ patientAttributeService.updatePatientAttribute( patientAttribute );
+ indexAttr++;
+ patientAttributes.remove( patientAttribute );
+ }
+ }
+
+ // Set DisplayInListNoProgram=false for other ID type
+ for ( PatientIdentifierType patientIdentifierType : patientIdentifierTypes )
+ {
+ patientIdentifierType.setDisplayInListNoProgram( false );
+ patientIdentifierType.setSortOrderInListNoProgram( 0 );
+ patientIdentifierTypeService.updatePatientIdentifierType( patientIdentifierType );
+ }
+
+ // Set DisplayInListNoProgram=false for other attribute type
for ( PatientAttribute patientAttribute : patientAttributes )
{
patientAttribute.setDisplayInListNoProgram( false );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowPatientAttributeInListNoProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowPatientAttributeInListNoProgramAction.java 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowPatientAttributeInListNoProgramAction.java 2014-01-08 16:13:32 +0000
@@ -34,6 +34,9 @@
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
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.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -57,6 +60,9 @@
this.patientAttributeService = patientAttributeService;
}
+ @Autowired
+ private PatientIdentifierTypeService patientIdentifierTypeService;
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -75,6 +81,20 @@
return selectedPatientAttributes;
}
+ private List<PatientIdentifierType> availablePatientIdentifierTypes = new ArrayList<PatientIdentifierType>();
+
+ public List<PatientIdentifierType> getAvailablePatientIdentifierTypes()
+ {
+ return availablePatientIdentifierTypes;
+ }
+
+ private List<PatientIdentifierType> selectedPatientIdentifierTypes = new ArrayList<PatientIdentifierType>();
+
+ public List<PatientIdentifierType> getSelectedPatientIdentifierTypes()
+ {
+ return selectedPatientIdentifierTypes;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -90,6 +110,14 @@
patientAttributeService.getPatientAttributesDisplayed( true ) );
Collections.sort( availablePatientAttributes, IdentifiableObjectNameComparator.INSTANCE );
+
+ availablePatientIdentifierTypes = new ArrayList<PatientIdentifierType>(
+ patientIdentifierTypeService.getPatientIdentifierTypeDisplayed( false ) );
+ Collections.sort( availablePatientAttributes, IdentifiableObjectNameComparator.INSTANCE );
+
+ selectedPatientIdentifierTypes = new ArrayList<PatientIdentifierType>(
+ patientIdentifierTypeService.getPatientIdentifierTypeDisplayed( true ) );
+ Collections.sort( availablePatientAttributes, IdentifiableObjectNameComparator.INSTANCE );
return SUCCESS;
}
}
\ No newline at end of file
=== 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 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java 2014-01-08 16:13:32 +0000
@@ -137,13 +137,6 @@
this.expression = expression;
}
- private Boolean displayInListNoProgram;
-
- public void setDisplayInListNoProgram( Boolean displayInListNoProgram )
- {
- this.displayInListNoProgram = displayInListNoProgram;
- }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -159,9 +152,6 @@
patientAttribute.setExpression( expression );
patientAttribute.setDisplayOnVisitSchedule( false );
- displayInListNoProgram = (displayInListNoProgram == null) ? false : true;
- patientAttribute.setDisplayInListNoProgram( displayInListNoProgram );
-
mandatory = (mandatory == null) ? false : true;
patientAttribute.setMandatory( mandatory );
=== 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 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2014-01-08 16:13:32 +0000
@@ -37,14 +37,6 @@
<td></td>
</tr>
- <tr>
- <td><label for="inherit">$i18n.getString( "display_in_list_no_program" )</label></td>
- <td>
- <input type='checkbox' id="displayInListNoProgram" name="displayInListNoProgram" value='true'>
- </td>
- <td></td>
- </tr>
-
<tr>
<td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm 2013-12-21 23:14:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm 2014-01-08 16:13:32 +0000
@@ -2,6 +2,7 @@
<ul class="introList">
#introListImgItem( "patientAttribute.action" "patient_attribute" "patient" )
+ #introListImgItem( "patientAttributeInListNoProgram.action" "patient_attribute_displayed_with_no_program" "patient" )
#introListImgItem( "patientAttributeVisitSchedule.action" "patient_attribute_visit_schedule" "patient" )
#introListImgItem( "patientAttributeGroup.action" "patient_attribute_group" "patient" )
#introListImgItem( "patientIdentifierType.action" "patient_identifier_type" "patient" )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm 2013-12-21 23:14:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm 2014-01-08 16:13:32 +0000
@@ -1,6 +1,7 @@
<h2>$i18n.getString( "patients" )</h2>
<ul>
<li><a href="patientAttribute.action">$i18n.getString( "patient_attribute" )</a></li>
+ <li><a href="patientAttributeInListNoProgram.action">$i18n.getString( "patient_attribute_displayed_with_no_program" )</a></li>
<li><a href="patientAttributeVisitSchedule.action">$i18n.getString( "patient_attribute_visit_schedule" )</a></li>
<li><a href="patientAttributeGroup.action">$i18n.getString( "patient_attribute_group" )</a></li>
<li><a href="patientIdentifierType.action">$i18n.getString( "patient_identifier_type" )</a></li>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeInListNoProgram.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeInListNoProgram.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeInListNoProgram.vm 2014-01-08 16:13:32 +0000
@@ -0,0 +1,61 @@
+<h3>$i18n.getString( "patient_attribute_visit_schedule_form" ) #openHelp('patient_attribute_visit_schedule')</h3>
+
+<form id="savePatientAttributeInListNoProgramForm" name="savePatientAttributeInListNoProgramForm" action="savePatientAttributeInListNoProgram.action" method="post" action='savePatientAttributeVisitSchedule.action' onsubmit="selectAllById('selectedAttributeIds');">
+
+<table>
+ <colgroup>
+ <col style='width:300px'/>
+ <col/>
+ <col style='width:300px'/>
+ </colgroup>
+ <tr>
+ <th>$i18n.getString( "availableAttribute" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selectedAttribute" )</th>
+ </tr>
+
+ <tr>
+ <td>
+ <select style='width:322px' multiple="multiple" id="availableAttributes" name="availableAttributes" size="15" ondblclick="moveSelectedById( 'availableAttributes', 'selectedAttributeIds' )" >
+ #foreach($identifierType in $availablePatientIdentifierTypes)
+ <option value='iden_$identifierType.id'>$identifierType.displayName</option>
+ #end
+ #foreach($attribute in $availablePatientAttributes)
+ <option value='attr_$attribute.id'>$attribute.displayName</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <input type="button" value=">" onclick="moveSelectedById( 'availableAttributes', 'selectedAttributeIds' )" class='filterButton' /><br/>
+ <input type="button" value="<" onclick="moveSelectedById( 'selectedAttributeIds', 'availableAttributes' )" class='filterButton' /><br/>
+ <input type="button" value=">>" onclick="moveAllById( 'availableAttributes', 'selectedAttributeIds' )" class='filterButton' /><br/>
+ <input type="button" value="<<" onclick="moveAllById( 'selectedAttributeIds', 'availableAttributes' )" class='filterButton' />
+ </td>
+ <td>
+ <select style='width:322px' multiple="multiple" id="selectedAttributeIds" name="selectedAttributeIds" size="15" ondblclick="moveSelectedById( 'selectedAttributeIds', 'availableAttributes' )" >
+ #foreach($identifierType in $selectedPatientIdentifierTypes)
+ <option value='iden_$identifierType.id'>$identifierType.displayName</option>
+ #end
+ #foreach($attribute in $selectedPatientAttributes)
+ <option value='attr_$attribute.id'>$attribute.displayName</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <a href="javascript:moveUpSelectedOption( 'selectedAttributeIds')" title="$i18n.getString( 'move_up' )"><img src="../images/move_up.png" alt="$i18n.getString( 'move_up' )"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'selectedAttributeIds' )" title="$i18n.getString( 'move_down' )"><img src="../images/move_down.png" alt="$i18n.getString( 'move_up' )"/></a>
+ </td>
+ </tr>
+ <tr>
+ <td colspan='2'>
+ <input type="submit" value="$i18n.getString( 'save' )" />
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='patientAttributeGroup.action'"/>
+ </td>
+ </tr>
+</table>
+
+</form>
+
+<script>
+ var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+</script>
=== 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 2014-01-08 15:08:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2014-01-08 16:13:32 +0000
@@ -40,14 +40,6 @@
<td></td>
</tr>
- <tr>
- <td><label for="inherit">$i18n.getString( "display_in_list_no_program" )</label></td>
- <td>
- <input type='checkbox' id="displayInListNoProgram" name="displayInListNoProgram" value='true' #if( $patientAttribute.displayInListNoProgram ) checked #end>
- </td>
- <td></td>
- </tr>
-
<tr>
<td>$i18n.getString( "value_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
<td>