=== 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 2013-09-27 17:04:23 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java 2014-01-07 15:02:45 +0000 @@ -36,8 +36,8 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; -@XmlRootElement(name = "patientIdentifierType", namespace = DxfNamespaces.DXF_2_0) -@XmlAccessorType(value = XmlAccessType.NONE) +@XmlRootElement( name = "patientIdentifierType", namespace = DxfNamespaces.DXF_2_0 ) +@XmlAccessorType( value = XmlAccessType.NONE ) public class PatientIdentifierType extends BaseIdentifiableObject { @@ -66,8 +66,6 @@ private String type; - private Boolean personDisplayName = false; - // For Local ID type private Boolean orgunitScope = false; @@ -164,16 +162,6 @@ this.type = type; } - public Boolean getPersonDisplayName() - { - return personDisplayName; - } - - public void setPersonDisplayName( Boolean personDisplayName ) - { - this.personDisplayName = personDisplayName; - } - public Boolean getOrgunitScope() { return orgunitScope; === 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 2013-11-04 03:13:27 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java 2014-01-07 15:02:45 +0000 @@ -73,8 +73,8 @@ /** * Returns all {@link PatientIdentifierType} * - * @return a collection of all PatientIdentifierType, or an empty collection if - * there are no PatientAttributeGroups. + * @return a collection of all PatientIdentifierType, or an empty collection + * if there are no PatientAttributeGroups. */ Collection getAllPatientIdentifierTypes(); @@ -83,7 +83,8 @@ * * @param name the name of the PatientIdentifierType to return. * - * @return the PatientIdentifierType with the given name, or null if no match. + * @return the PatientIdentifierType with the given name, or null if no + * match. */ PatientIdentifierType getPatientIdentifierType( String name ); @@ -91,7 +92,8 @@ * Returns the {@link PatientIdentifierType} with the given UID. * * @param uid the UID. - * @return the PatientIdentifierType with the given UID, or null if no match. + * @return the PatientIdentifierType with the given UID, or null if no + * match. */ PatientIdentifierType getPatientIdentifierTypeByUid( String uid ); @@ -103,14 +105,4 @@ * @return PatientIdentifierType list */ Collection getPatientIdentifierTypes( boolean mandatory ); - - /** - * Retrieve patient identifer types which are displayed in person list - * instead of full name of person or not - * - * @param personDisplayName True/False value - * - * @return PatientIdentifierType list - */ - Collection getDisplayedPatientIdentifierTypes( boolean personDisplayName ); } === 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 2013-10-29 05:04:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java 2014-01-07 15:02:45 +0000 @@ -43,14 +43,5 @@ * @return PatientIdentifierType list */ Collection get( boolean mandatory ); - - /** - * Retrieve patient identifer types which are displayed in person list - * instead of full name of person or not - * - * @param personDisplayName True/False value - * - * @return PatientIdentifierType list - */ - Collection getByDisplayed( boolean personDisplayName ); + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2014-01-07 10:07:23 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2014-01-07 15:02:45 +0000 @@ -43,7 +43,6 @@ import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitGroup; import org.hisp.dhis.patient.Patient; -import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientReminder; import org.hisp.dhis.patientattributevalue.PatientAttributeValue; import org.hisp.dhis.relationship.RelationshipType; @@ -59,7 +58,7 @@ /** * @author Abyot Asalefew */ -@JacksonXmlRootElement(localName = "program", namespace = DxfNamespaces.DXF_2_0) +@JacksonXmlRootElement( localName = "program", namespace = DxfNamespaces.DXF_2_0 ) public class Program extends BaseIdentifiableObject { @@ -107,7 +106,7 @@ private Boolean ignoreOverdueEvents = false; - private List patientIdentifierTypes = new ArrayList(); + private List programPatientIdentifierTypes = new ArrayList(); private List programPatientAttributes = new ArrayList(); @@ -239,8 +238,8 @@ // ------------------------------------------------------------------------- @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getDescription() { return description; @@ -252,8 +251,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Integer getVersion() { return version; @@ -264,11 +263,11 @@ this.version = version; } - @JsonProperty(value = "organisationUnits") - @JsonSerialize(contentAs = BaseIdentifiableObject.class) - @JsonView({ DetailedView.class, ExportView.class }) - @JacksonXmlElementWrapper(localName = "organisationUnits", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty(localName = "organisationUnit", namespace = DxfNamespaces.DXF_2_0) + @JsonProperty( value = "organisationUnits" ) + @JsonSerialize( contentAs = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlElementWrapper( localName = "organisationUnits", namespace = DxfNamespaces.DXF_2_0 ) + @JacksonXmlProperty( localName = "organisationUnit", namespace = DxfNamespaces.DXF_2_0 ) public Set getOrganisationUnits() { return organisationUnits; @@ -279,10 +278,10 @@ this.organisationUnits = organisationUnits; } - @JsonProperty(value = "programInstances") - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlElementWrapper(localName = "programInstances", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty(localName = "programInstance", namespace = DxfNamespaces.DXF_2_0) + @JsonProperty( value = "programInstances" ) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlElementWrapper( localName = "programInstances", namespace = DxfNamespaces.DXF_2_0 ) + @JacksonXmlProperty( localName = "programInstance", namespace = DxfNamespaces.DXF_2_0 ) public Set getProgramInstances() { return programInstances; @@ -293,11 +292,11 @@ this.programInstances = programInstances; } - @JsonProperty(value = "programStages") - @JsonSerialize(contentAs = BaseIdentifiableObject.class) - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlElementWrapper(localName = "programStages", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty(localName = "programStage", namespace = DxfNamespaces.DXF_2_0) + @JsonProperty( value = "programStages" ) + @JsonSerialize( contentAs = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlElementWrapper( localName = "programStages", namespace = DxfNamespaces.DXF_2_0 ) + @JacksonXmlProperty( localName = "programStage", namespace = DxfNamespaces.DXF_2_0 ) public Set getProgramStages() { return programStages; @@ -309,8 +308,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getDateOfEnrollmentDescription() { return dateOfEnrollmentDescription; @@ -322,8 +321,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getDateOfIncidentDescription() { return dateOfIncidentDescription; @@ -335,14 +334,14 @@ } @JsonProperty - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getKind() { return TYPE_LOOKUP.get( type ); } @JsonProperty - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Integer getType() { return type; @@ -353,11 +352,11 @@ this.type = type; } - @JsonProperty(value = "validationCriterias") - @JsonSerialize(contentAs = BaseIdentifiableObject.class) - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlElementWrapper(localName = "validationCriterias", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty(localName = "validationCriteria", namespace = DxfNamespaces.DXF_2_0) + @JsonProperty( value = "validationCriterias" ) + @JsonSerialize( contentAs = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlElementWrapper( localName = "validationCriterias", namespace = DxfNamespaces.DXF_2_0 ) + @JacksonXmlProperty( localName = "validationCriteria", namespace = DxfNamespaces.DXF_2_0 ) public Set getPatientValidationCriteria() { return patientValidationCriteria; @@ -368,23 +367,20 @@ this.patientValidationCriteria = patientValidationCriteria; } - @JsonProperty(value = "identifierTypes") - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlElementWrapper(localName = "identifierTypes", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty(localName = "identifierType", namespace = DxfNamespaces.DXF_2_0) - public List getPatientIdentifierTypes() + public List getProgramPatientIdentifierTypes() + { - return patientIdentifierTypes; + return programPatientIdentifierTypes; } - public void setPatientIdentifierTypes( List patientIdentifierTypes ) + public void setProgramPatientIdentifierTypes( List programPatientIdentifierTypes ) { - this.patientIdentifierTypes = patientIdentifierTypes; + this.programPatientIdentifierTypes = programPatientIdentifierTypes; } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getDisplayIncidentDate() { return displayIncidentDate; @@ -396,8 +392,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) private Object getValueFromPatient( String property, Patient patient ) throws Exception { @@ -405,8 +401,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getIgnoreOverdueEvents() { return ignoreOverdueEvents; @@ -418,26 +414,26 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public boolean isSingleEvent() { return type != null && (SINGLE_EVENT_WITH_REGISTRATION == type || SINGLE_EVENT_WITHOUT_REGISTRATION == type); } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public boolean isRegistration() { return type != null && (SINGLE_EVENT_WITH_REGISTRATION == type || MULTIPLE_EVENTS_WITH_REGISTRATION == type); } @JsonProperty - @JsonSerialize(contentAs = BaseIdentifiableObject.class) - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlElementWrapper(localName = "userRoles", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty(localName = "userRole", namespace = DxfNamespaces.DXF_2_0) + @JsonSerialize( contentAs = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlElementWrapper( localName = "userRoles", namespace = DxfNamespaces.DXF_2_0 ) + @JacksonXmlProperty( localName = "userRole", namespace = DxfNamespaces.DXF_2_0 ) public Set getUserRoles() { return userRoles; @@ -449,8 +445,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getOnlyEnrollOnce() { return onlyEnrollOnce; @@ -462,8 +458,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Set getPatientReminders() { return patientReminders; @@ -475,10 +471,10 @@ } @JsonProperty - @JsonSerialize(contentAs = BaseIdentifiableObject.class) - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlElementWrapper(localName = "organisationUnitGroups", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty(localName = "organisationUnitGroup", namespace = DxfNamespaces.DXF_2_0) + @JsonSerialize( contentAs = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlElementWrapper( localName = "organisationUnitGroups", namespace = DxfNamespaces.DXF_2_0 ) + @JacksonXmlProperty( localName = "organisationUnitGroup", namespace = DxfNamespaces.DXF_2_0 ) public Set getOrganisationUnitGroups() { return organisationUnitGroups; @@ -490,8 +486,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getDisplayOnAllOrgunit() { return displayOnAllOrgunit; @@ -503,8 +499,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getSelectEnrollmentDatesInFuture() { return selectEnrollmentDatesInFuture; @@ -516,8 +512,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getSelectIncidentDatesInFuture() { return selectIncidentDatesInFuture; @@ -529,8 +525,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getRelationshipText() { return relationshipText; @@ -542,8 +538,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public RelationshipType getRelationshipType() { return relationshipType; @@ -555,8 +551,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Program getRelatedProgram() { return relatedProgram; @@ -568,8 +564,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getRelationshipFromA() { return relationshipFromA; @@ -581,8 +577,8 @@ } @JsonProperty - @JsonView({ DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class }) - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) + @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getDataEntryMethod() { return dataEntryMethod; @@ -595,7 +591,7 @@ @JsonProperty( value = "programPersonAttributes" ) @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } ) - @JacksonXmlElementWrapper(localName = "programPersonAttributes", namespace = DxfNamespaces.DXF_2_0) + @JacksonXmlElementWrapper( localName = "programPersonAttributes", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "programPersonAttribute", namespace = DxfNamespaces.DXF_2_0 ) public List getProgramPatientAttributes() { === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2014-01-07 15:02:45 +0000 @@ -73,6 +73,7 @@ import org.hisp.dhis.patient.PatientIdentifierTypeService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.program.ProgramStage; import org.hisp.dhis.program.ProgramStageService; @@ -81,8 +82,6 @@ import org.hisp.dhis.system.util.Timer; import org.springframework.beans.factory.annotation.Autowired; -import com.sun.org.apache.bcel.internal.classfile.Attribute; - /** * @author Lars Helge Overland */ @@ -90,55 +89,67 @@ implements EventAnalyticsService { private static final String ITEM_EVENT = "psi"; + private static final String ITEM_PROGRAM_STAGE = "ps"; + private static final String ITEM_EXECUTION_DATE = "eventdate"; + private static final String ITEM_LONGITUDE = "longitude"; + private static final String ITEM_LATITUDE = "latitude"; + private static final String ITEM_ORG_UNIT = "ou"; + private static final String ITEM_ORG_UNIT_NAME = "ouname"; + private static final String ITEM_ORG_UNIT_CODE = "oucode"; - + private static final String COL_NAME_EVENTDATE = "executiondate"; - private static final List SORTABLE_ITEMS = Arrays.asList( ITEM_EXECUTION_DATE, ITEM_ORG_UNIT_NAME, ITEM_ORG_UNIT_CODE ); - + private static final List SORTABLE_ITEMS = Arrays.asList( ITEM_EXECUTION_DATE, ITEM_ORG_UNIT_NAME, + ITEM_ORG_UNIT_CODE ); + @Autowired private ProgramService programService; - + @Autowired private ProgramStageService programStageService; @Autowired private DataElementService dataElementService; - + @Autowired private PatientAttributeService attributeService; @Autowired private PatientIdentifierTypeService identifierTypeService; - + @Autowired private OrganisationUnitService organisationUnitService; - + @Autowired private EventAnalyticsManager analyticsManager; - + @Autowired private EventQueryPlanner queryPlanner; - + @Autowired private AnalyticsService analyticsService; @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // EventAnalyticsService implementation // ------------------------------------------------------------------------- - //TODO order event analytics tables on execution date to avoid default sorting in queries - //TODO parallel processing of queries - + // TODO order event analytics tables on execution date to avoid default + // sorting in queries + // TODO parallel processing of queries + public Grid getAggregatedEventData( EventQueryParams params ) { queryPlanner.validate( params ); @@ -153,45 +164,49 @@ { grid.addHeader( new GridHeader( dimension.getDimension(), dimension.getDisplayName() ) ); } - + for ( QueryItem item : params.getItems() ) { grid.addHeader( new GridHeader( item.getItem().getUid(), item.getItem().getName() ) ); } - + grid.addHeader( new GridHeader( "value", "Value" ) ); // --------------------------------------------------------------------- // Data // --------------------------------------------------------------------- - + List queries = queryPlanner.planQuery( params ); for ( EventQueryParams query : queries ) { analyticsManager.getAggregatedEventData( query, grid ); - } + } // --------------------------------------------------------------------- // Meta-data // --------------------------------------------------------------------- - Map metaData = new HashMap(); - + Map metaData = new HashMap(); + Map uidNameMap = getUidNameMap( params ); - + metaData.put( NAMES_META_KEY, uidNameMap ); - + if ( params.isHierarchyMeta() ) { - metaData.put( OU_HIERARCHY_KEY, getParentGraphMap( asTypedList( params.getDimensionOrFilter( ORGUNIT_DIM_ID ), OrganisationUnit.class ) ) ); + metaData + .put( + OU_HIERARCHY_KEY, + getParentGraphMap( asTypedList( params.getDimensionOrFilter( ORGUNIT_DIM_ID ), + OrganisationUnit.class ) ) ); } - + grid.setMetaData( metaData ); - return grid; + return grid; } - + public Grid getEvents( EventQueryParams params ) { queryPlanner.validate( params ); @@ -214,7 +229,7 @@ for ( QueryItem queryItem : params.getItems() ) { IdentifiableObject item = queryItem.getItem(); - + grid.addHeader( new GridHeader( item.getUid(), item.getName() ) ); } @@ -223,38 +238,42 @@ // --------------------------------------------------------------------- Timer t = new Timer().start(); - + List queries = queryPlanner.planQuery( params ); - + t.getSplitTime( "Planned query, got: " + queries.size() ); - + int count = 0; - + for ( EventQueryParams query : queries ) { if ( params.isPaging() ) { count += analyticsManager.getEventCount( query ); } - + analyticsManager.getEvents( query, grid ); } - + t.getTime( "Queried events, got: " + grid.getHeight() ); - + // --------------------------------------------------------------------- // Meta-data // --------------------------------------------------------------------- Map metaData = new HashMap(); - + Map uidNameMap = getUidNameMap( params ); - + metaData.put( NAMES_META_KEY, uidNameMap ); - + if ( params.isHierarchyMeta() ) - { - metaData.put( OU_HIERARCHY_KEY, getParentGraphMap( asTypedList( params.getDimensionOrFilter( ORGUNIT_DIM_ID ), OrganisationUnit.class ) ) ); + { + metaData + .put( + OU_HIERARCHY_KEY, + getParentGraphMap( asTypedList( params.getDimensionOrFilter( ORGUNIT_DIM_ID ), + OrganisationUnit.class ) ) ); } if ( params.isPaging() ) @@ -262,47 +281,50 @@ Pager pager = new Pager( params.getPageWithDefault(), count, params.getPageSizeWithDefault() ); metaData.put( AnalyticsService.PAGER_META_KEY, pager ); } - + grid.setMetaData( metaData ); - + return grid; } - public EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate, - Set dimension, Set filter, boolean hierarchyMeta, SortOrder sortOrder, Integer limit, I18nFormat format ) + public EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate, + Set dimension, Set filter, boolean hierarchyMeta, SortOrder sortOrder, Integer limit, + I18nFormat format ) { - EventQueryParams params = getFromUrl( program, stage, startDate, endDate, dimension, filter, null, null, null, hierarchyMeta, false, null, null, format ); + EventQueryParams params = getFromUrl( program, stage, startDate, endDate, dimension, filter, null, null, null, + hierarchyMeta, false, null, null, format ); params.setSortOrder( sortOrder ); params.setLimit( limit ); params.setAggregate( true ); - + return params; } - - public EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate, Set dimension, Set filter, - String ouMode, Set asc, Set desc, boolean hierarchyMeta, boolean coordinatesOnly, Integer page, Integer pageSize, I18nFormat format ) + + public EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate, + Set dimension, Set filter, String ouMode, Set asc, Set desc, + boolean hierarchyMeta, boolean coordinatesOnly, Integer page, Integer pageSize, I18nFormat format ) { EventQueryParams params = new EventQueryParams(); - + Date date = new Date(); - + Program pr = programService.getProgram( program ); - + if ( pr == null ) { throw new IllegalQueryException( "Program does not exist: " + program ); } - + ProgramStage ps = programStageService.getProgramStage( stage ); - + if ( stage != null && !stage.isEmpty() && ps == null ) { throw new IllegalQueryException( "Program stage is specified but does not exist: " + stage ); } - + Date start = null; Date end = null; - + if ( startDate != null && endDate != null ) { try @@ -315,13 +337,13 @@ throw new IllegalQueryException( "Start date or end date is invalid: " + startDate + " - " + endDate ); } } - + if ( dimension != null ) { for ( String dim : dimension ) { String dimensionId = DataQueryParams.getDimensionFromParam( dim ); - + if ( ORGUNIT_DIM_ID.equals( dimensionId ) || PERIOD_DIM_ID.equals( dimensionId ) ) { List items = DataQueryParams.getDimensionItemsFromParam( dim ); @@ -333,13 +355,13 @@ } } } - + if ( filter != null ) { for ( String dim : filter ) { String dimensionId = DataQueryParams.getDimensionFromParam( dim ); - + if ( ORGUNIT_DIM_ID.equals( dimensionId ) || PERIOD_DIM_ID.equals( dimensionId ) ) { List items = DataQueryParams.getDimensionItemsFromParam( dim ); @@ -348,16 +370,16 @@ else { params.getItemFilters().addAll( getQueryItems( dim, pr ) ); - } + } } } - + for ( NameableObject object : params.getDimensionOrFilter( ORGUNIT_DIM_ID ) ) { OrganisationUnit unit = (OrganisationUnit) object; unit.setLevel( organisationUnitService.getLevelOfOrganisationUnit( unit.getUid() ) ); } - + if ( asc != null ) { for ( String sort : asc ) @@ -373,7 +395,7 @@ params.getDesc().add( getSortItem( sort, pr ) ); } } - + params.setProgram( pr ); params.setProgramStage( ps ); params.setStartDate( start ); @@ -391,39 +413,40 @@ // ------------------------------------------------------------------------- // Supportive methods // ------------------------------------------------------------------------- - + private List getQueryItems( String dimension, Program program ) { List items = new ArrayList(); - + if ( !dimension.contains( DIMENSION_NAME_SEP ) ) { items.add( getItem( program, dimension, null, null ) ); } - else // Filter + else + // Filter { String[] split = dimension.split( DIMENSION_NAME_SEP ); - + if ( split == null || split.length != 3 ) { throw new IllegalQueryException( "Item filter has invalid format: " + dimension ); } - + items.add( getItem( program, split[0], split[1], split[2] ) ); } - + return items; } - + private Map getUidNameMap( EventQueryParams params ) { Map map = new HashMap(); - + Program program = params.getProgram(); ProgramStage stage = params.getProgramStage(); - + map.put( program.getUid(), program.getName() ); - + if ( stage != null ) { map.put( stage.getUid(), stage.getName() ); @@ -445,13 +468,13 @@ { map.put( item.getItem().getUid(), item.getItem().getDisplayName() ); } - + map.putAll( getUidNameMap( params.getDimensions(), params.isHierarchyMeta() ) ); map.putAll( getUidNameMap( params.getFilters(), params.isHierarchyMeta() ) ); - + return map; } - + private Map getUidNameMap( List dimensions, boolean hierarchyMeta ) { Map map = new HashMap(); @@ -459,59 +482,59 @@ for ( DimensionalObject dimension : dimensions ) { boolean hierarchy = hierarchyMeta && DimensionType.ORGANISATIONUNIT.equals( dimension.getType() ); - + for ( IdentifiableObject idObject : dimension.getItems() ) { map.put( idObject.getUid(), idObject.getDisplayName() ); - + if ( hierarchy ) { OrganisationUnit unit = (OrganisationUnit) idObject; - + map.putAll( IdentifiableObjectUtils.getUidNameMap( unit.getAncestors() ) ); } } } - + return map; } - + private String getSortItem( String item, Program program ) { if ( !SORTABLE_ITEMS.contains( item.toLowerCase() ) && getItem( program, item, null, null ) == null ) { throw new IllegalQueryException( "Descending sort item is invalid: " + item ); } - + item = ITEM_EXECUTION_DATE.equalsIgnoreCase( item ) ? COL_NAME_EVENTDATE : item; - + return item; } - + private QueryItem getItem( Program program, String item, String operator, String filter ) { DataElement de = dataElementService.getDataElement( item ); - + if ( de != null && program.getAllDataElements().contains( de ) ) { return new QueryItem( de, operator, filter, de.isNumericType() ); } - + PatientAttribute at = attributeService.getPatientAttribute( item ); - + Collection attributes = programPatientAttributeService.getListPatientAttribute( program ); if ( at != null && attributes.contains( at ) ) { return new QueryItem( at, operator, filter, at.isNumericType() ); } - + PatientIdentifierType it = identifierTypeService.getPatientIdentifierType( item ); - - if ( it != null && program.getPatientIdentifierTypes().contains( it ) ) + + if ( it != null && programPatientIdentifierTypeService.getListPatientIdentifierType( program ).contains( it ) ) { return new QueryItem( it, operator, filter, false ); } - - throw new IllegalQueryException( "Item identifier does not reference any item part of the program: " + item ); + + throw new IllegalQueryException( "Item identifier does not reference any item part of the program: " + item ); } } === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2014-01-07 15:02:45 +0000 @@ -45,6 +45,7 @@ import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.system.util.DateUtils; import org.hisp.dhis.system.util.MathUtils; @@ -66,6 +67,9 @@ @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // Implementation // ------------------------------------------------------------------------- @@ -243,7 +247,8 @@ columns.add( col ); } - for ( PatientIdentifierType identifierType : table.getProgram().getPatientIdentifierTypes() ) + for ( PatientIdentifierType identifierType : programPatientIdentifierTypeService + .getListPatientIdentifierType( table.getProgram() ) ) { String sql = "(select identifier from patientidentifier where patientid=pi.patientid and " + "patientidentifiertypeid=" + identifierType.getId() + ") as " + quote( identifierType.getUid() ); === modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java' --- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2014-01-07 15:02:45 +0000 @@ -84,6 +84,7 @@ import org.hisp.dhis.program.ProgramInstance; import org.hisp.dhis.program.ProgramInstanceService; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.program.ProgramStage; import org.hisp.dhis.program.ProgramStageDataElement; @@ -171,6 +172,9 @@ @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // Setters // ------------------------------------------------------------------------- @@ -1610,7 +1614,8 @@ Collection programs = programService.getAllPrograms(); for ( Program program : programs ) { - patientIdentifierTypes.removeAll( program.getPatientIdentifierTypes() ); + patientIdentifierTypes.removeAll( programPatientIdentifierTypeService + .getListPatientIdentifierType( program ) ); } return patientIdentifierTypes; } @@ -1635,7 +1640,7 @@ if ( programId != null && !programId.trim().equals( "" ) ) { Program program = programService.getProgram( Integer.parseInt( programId ) ); - patientIdentifierTypes = program.getPatientIdentifierTypes(); + patientIdentifierTypes = programPatientIdentifierTypeService.getListPatientIdentifierType( program ); } else { === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java 2014-01-07 15:02:45 +0000 @@ -128,7 +128,7 @@ public Collection getPatientAttributesWithoutProgram() { Collection programPatientAttributes = programPatientAttributeService.getPatientAttributes(); - + Collection patientAttributes = patientAttributeStore.getAll(); patientAttributes.removeAll( programPatientAttributes ); === 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 2013-11-08 03:05:02 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java 2014-01-07 15:02:45 +0000 @@ -128,9 +128,4 @@ return i18n( i18nService, patientIdentifierTypeStore.get( mandatory ) ); } - public Collection getDisplayedPatientIdentifierTypes( boolean personDisplayName ) - { - return i18n( i18nService, patientIdentifierTypeStore.getByDisplayed( personDisplayName ) ); - } - } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java 2014-01-07 15:02:45 +0000 @@ -28,6 +28,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import org.apache.commons.lang.StringUtils; import org.hisp.dhis.common.Grid; import org.hisp.dhis.common.GridHeader; @@ -37,21 +45,15 @@ import org.hisp.dhis.patientattributevalue.PatientAttributeValue; import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.relationship.Relationship; import org.hisp.dhis.relationship.RelationshipService; import org.hisp.dhis.relationship.RelationshipType; import org.hisp.dhis.relationship.RelationshipTypeService; import org.hisp.dhis.system.grid.ListGrid; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - /** * @author Abyot Asalefew Gizaw * @version $Id$ @@ -113,6 +115,9 @@ this.relationshipTypeService = relationshipTypeService; } + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // Implementation methods // ------------------------------------------------------------------------- @@ -555,7 +560,8 @@ grid.addHeader( new GridHeader( i18n.getString( "gender" ), true, true ) ); grid.addHeader( new GridHeader( i18n.getString( "phone_number" ), false, true ) ); - Collection patientIdentifierTypes = program.getPatientIdentifierTypes(); + Collection patientIdentifierTypes = programPatientIdentifierTypeService + .getListPatientIdentifierType( program ); for ( PatientIdentifierType patientIdentifierType : patientIdentifierTypes ) { grid.addHeader( new GridHeader( patientIdentifierType.getDisplayName(), false, true ) ); === 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 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java 2014-01-07 15:02:45 +0000 @@ -45,9 +45,4 @@ return getCriteria( Restrictions.eq( "mandatory", mandatory ) ).list(); } - @SuppressWarnings( "unchecked" ) - public Collection getByDisplayed( boolean personDisplayName ) - { - return getCriteria( Restrictions.eq( "personDisplayName", personDisplayName ) ).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-07 08:22:52 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2014-01-07 15:02:45 +0000 @@ -289,13 +289,18 @@ executeSql( "ALTER TABLE program DROP COLUMN useBirthDateAsIncidentDate" ); executeSql( "ALTER TABLE program DROP COLUMN useBirthDateAsEnrollmentDate" ); - - executeSql( "UPDATE patientattribute set displayedInList=false WHERE displayedInList is null" ); - executeSql( "INSERT INTO program_programpatientAttributes (programid, programpatientattributeid, displayedInList ) " - + "SELECT programid,patientattributeid, displayedInList FROM program_patientattributes pp " + + executeSql( "INSERT INTO program_attributes (programid, patientattributeid, displayedInList ) " + + "SELECT programid, pp.patientattributeid, displayedInList FROM program_patientattributes pp " + "INNER JOIN patientattribute pa ON pp.patientattributeid=pa.patientattributeid" ); -// executeSql( "DROP TABLE program_patientattributes" ); -// executeSql( "ALTER TABLE patientattribute DROP COLUMN displayedInList" ); + executeSql( "DROP TABLE program_patientattributes" ); + executeSql( "ALTER TABLE patientattribute DROP COLUMN displayedInList" ); + + executeSql( "INSERT INTO program_identifierTypes (programid, patientidentifiertypeid, displayedInList ) " + + "SELECT programid, pp.patientidentifiertypeid, personDisplayName FROM program_patientidentifiertypes pp " + + "INNER JOIN patientidentifiertype pi ON pp.patientidentifiertypeid=pi.patientidentifiertypeid" ); + executeSql( "DROP TABLE program_patientidentifiertypes" ); + executeSql( "ALTER TABLE patientidentifiertype DROP COLUMN personDisplayName" ); } // ------------------------------------------------------------------------- @@ -469,7 +474,7 @@ try { Statement statement = holder.getStatement(); - + ResultSet resultSet = statement.executeQuery( "SELECT gender FROM patientattribute" ); // Only execute once @@ -776,7 +781,8 @@ + "','Staff', 'Staff','" + PatientAttribute.TYPE_USERS + "', false, false, false)" ); executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," - + max + ",healthworkerid from patient inner join userinfo on patient.healthworkerid=userinfo.userinfoid where patient.healthworkerid is not null" ); + + max + + ",healthworkerid from patient inner join userinfo on patient.healthworkerid=userinfo.userinfoid where patient.healthworkerid is not null" ); // Update custom entry form removeFixedAttributeInCustomRegistrationForm( "associate", uid ); === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2014-01-07 15:02:45 +0000 @@ -54,6 +54,7 @@ import org.hisp.dhis.system.grid.ListGrid; import org.hisp.dhis.system.util.DateUtils; import org.hisp.dhis.user.CurrentUserService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; @@ -146,6 +147,9 @@ this.programPatientAttributeService = programPatientAttributeService; } + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // Implementation methods // ------------------------------------------------------------------------- @@ -332,7 +336,8 @@ for ( Program program : programs ) { - Collection identifierTypes = program.getPatientIdentifierTypes(); + Collection identifierTypes = programPatientIdentifierTypeService + .getListPatientIdentifierType( program ); while ( iterIdentifier.hasNext() ) { PatientIdentifier identifier = iterIdentifier.next(); @@ -413,7 +418,8 @@ Patient patient = programInstance.getPatient(); - Collection identifierTypes = programInstance.getProgram().getPatientIdentifierTypes(); + Collection identifierTypes = programPatientIdentifierTypeService + .getListPatientIdentifierType( programInstance.getProgram() ); Collection identifiers = patient.getIdentifiers(); @@ -442,8 +448,9 @@ // Get patient-attribute-values which belong to the program - Collection atttributes = programPatientAttributeService.getListPatientAttribute( programInstance.getProgram() ); - + Collection atttributes = programPatientAttributeService + .getListPatientAttribute( programInstance.getProgram() ); + for ( PatientAttribute attrtibute : atttributes ) { PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue( patient, === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java 2014-01-07 15:02:45 +0000 @@ -35,6 +35,7 @@ import org.hisp.dhis.system.deletion.DeletionHandler; import org.hisp.dhis.user.UserAuthorityGroup; import org.hisp.dhis.validation.ValidationCriteria; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Chau Thu Tran @@ -77,18 +78,6 @@ } @Override - public void deletePatientIdentifierType( PatientIdentifierType patientIdentifierType ) - { - Collection programs = programService.getAllPrograms(); - - for ( Program program : programs ) - { - program.getPatientIdentifierTypes().clear(); - programService.updateProgram( program ); - } - } - - @Override public void deleteOrganisationUnit( OrganisationUnit unit ) { // TODO improve performance === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2014-01-07 15:02:45 +0000 @@ -484,6 +484,17 @@ + + + + + + + + === 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 2013-09-17 06:08:16 +0000 +++ 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 @@ -25,8 +25,6 @@ - - === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2014-01-07 15:02:45 +0000 @@ -48,11 +48,10 @@ - + - + === modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientIdentifierTypeServiceTest.java' --- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientIdentifierTypeServiceTest.java 2013-11-11 02:42:44 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientIdentifierTypeServiceTest.java 2014-01-07 15:02:45 +0000 @@ -167,23 +167,4 @@ assertTrue( equals( identifierTypes, identifierTypeC ) ); } - @Test - public void testGetDisplayedPatientIdentifierTypes() - { - identifierTypeA.setPersonDisplayName( true ); - identifierTypeB.setPersonDisplayName( true ); - - identifierTypeService.savePatientIdentifierType( identifierTypeA ); - identifierTypeService.savePatientIdentifierType( identifierTypeB ); - identifierTypeService.savePatientIdentifierType( identifierTypeC ); - - Collection identifierTypes = identifierTypeService - .getDisplayedPatientIdentifierTypes( true ); - assertEquals( 2, identifierTypes.size() ); - assertTrue( equals( identifierTypes, identifierTypeA, identifierTypeB ) ); - - identifierTypes = identifierTypeService.getDisplayedPatientIdentifierTypes( false ); - assertEquals( 1, identifierTypes.size() ); - assertTrue( equals( identifierTypes, identifierTypeC ) ); - } } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientIdentifierTypeStoreTest.java' --- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientIdentifierTypeStoreTest.java 2013-11-08 07:40:31 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientIdentifierTypeStoreTest.java 2014-01-07 15:02:45 +0000 @@ -79,23 +79,5 @@ assertEquals( 1, identifierTypes.size() ); assertTrue( equals( identifierTypes, identifierTypeC ) ); } - - @Test - public void testGetDisplayedPatientIdentifierTypes() - { - identifierTypeA.setPersonDisplayName( true ); - identifierTypeB.setPersonDisplayName( true ); - - identifierTypeStore.save( identifierTypeA ); - identifierTypeStore.save( identifierTypeB ); - identifierTypeStore.save( identifierTypeC ); - - Collection identifierTypes = identifierTypeStore.getByDisplayed( true ); - assertEquals( 2, identifierTypes.size() ); - assertTrue( equals( identifierTypes, identifierTypeA, identifierTypeB ) ); - - identifierTypes = identifierTypeStore.getByDisplayed( false ); - assertEquals( 1, identifierTypes.size() ); - assertTrue( equals( identifierTypes, identifierTypeC ) ); - } + } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java 2014-01-07 15:02:45 +0000 @@ -30,32 +30,25 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import org.hisp.dhis.common.Grid; -import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.hisp.dhis.i18n.I18n; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; import org.hisp.dhis.paging.ActionPagingSupport; import org.hisp.dhis.patient.Patient; import org.hisp.dhis.patient.PatientAttribute; -import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientService; -import org.hisp.dhis.patientattributevalue.PatientAttributeValue; -import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramInstance; -import org.hisp.dhis.program.ProgramPatientAttributeService; import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.program.ProgramStageInstance; import org.hisp.dhis.program.ProgramStageInstanceService; -import org.springframework.beans.factory.annotation.Autowired; public class GetDataRecordsAction extends ActionPagingSupport @@ -92,23 +85,6 @@ this.programStageInstanceService = programStageInstanceService; } - private PatientAttributeService patientAttributeService; - - public void setPatientAttributeService( PatientAttributeService patientAttributeService ) - { - this.patientAttributeService = patientAttributeService; - } - - private PatientAttributeValueService patientAttributeValueService; - - public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService ) - { - this.patientAttributeValueService = patientAttributeValueService; - } - - @Autowired - private ProgramPatientAttributeService programPatientAttributeService; - private I18n i18n; public void setI18n( I18n i18n ) @@ -197,20 +173,6 @@ return grid; } - private List patientAttributes; - - public List getPatientAttributes() - { - return patientAttributes; - } - - private Map> patientAttributeValueMap = new HashMap>(); - - public Map> getPatientAttributeValueMap() - { - return patientAttributeValueMap; - } - private Boolean followup; public void setFollowup( Boolean followup ) @@ -240,20 +202,12 @@ if ( programId != null ) { program = programService.getProgram( programId ); - identifierTypes = program.getPatientIdentifierTypes(); - attributes = new ArrayList( - programPatientAttributeService.getListPatientAttribute( program ) ); } if ( searchTexts.size() > 0 ) { if ( type == null ) { - patientAttributes = new ArrayList( - patientAttributeService.getPatientAttributesByDisplayOnVisitSchedule( true ) ); - - Collections.sort( patientAttributes, IdentifiableObjectNameComparator.INSTANCE ); - total = patientService.countSearchPatients( searchTexts, orgunits, followup, ProgramInstance.STATUS_ACTIVE ); this.paging = createPaging( total ); @@ -263,27 +217,9 @@ for ( Integer stageInstanceId : stageInstanceIds ) { - // Get programStageInstance - ProgramStageInstance programStageInstance = programStageInstanceService .getProgramStageInstance( stageInstanceId ); programStageInstances.add( programStageInstance ); - - // Get Patient-attributes - - Patient patient = programStageInstance.getProgramInstance().getPatient(); - if ( patientAttributeValueMap.get( patient.getId() ) == null ) - { - List values = new ArrayList(); - for ( PatientAttribute patientAttribute : patientAttributes ) - { - PatientAttributeValue patientAttributeValue = patientAttributeValueService - .getPatientAttributeValue( patient, patientAttribute ); - String value = (patientAttributeValue == null) ? "" : patientAttributeValue.getValue(); - values.add( value ); - } - patientAttributeValueMap.put( patient.getId(), values ); - } } } else if ( trackingReport != null && trackingReport ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java 2014-01-07 15:02:45 +0000 @@ -52,6 +52,7 @@ import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramDataEntryService; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.program.ProgramStage; import org.hisp.dhis.program.ProgramStageDataElement; @@ -122,6 +123,9 @@ @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + private I18n i18n; public void setI18n( I18n i18n ) @@ -192,7 +196,7 @@ programs.remove( program ); for ( Program p : programs ) { - identifierTypes.removeAll( p.getPatientIdentifierTypes() ); + identifierTypes.removeAll( programPatientIdentifierTypeService.getListPatientIdentifierType( p ) ); patientAttributesInProgram.addAll( programPatientAttributeService.getListPatientAttribute( p ) ); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java 2014-01-07 15:02:45 +0000 @@ -57,6 +57,7 @@ import org.hisp.dhis.program.ProgramInstance; import org.hisp.dhis.program.ProgramInstanceService; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.relationship.Relationship; import org.hisp.dhis.relationship.RelationshipService; @@ -100,6 +101,8 @@ @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; private I18n i18n; @@ -252,13 +255,13 @@ Collection programs = programService.getAllPrograms(); for ( Program p : programs ) { - identifierTypes.removeAll( p.getPatientIdentifierTypes() ); + identifierTypes.removeAll( programPatientIdentifierTypeService.getListPatientIdentifierType( p ) ); attributes.removeAll( programPatientAttributeService.getListPatientAttribute( p ) ); } } else { - identifierTypes = program.getPatientIdentifierTypes(); + identifierTypes = programPatientIdentifierTypeService.getListPatientIdentifierType( program ); attributes.removeAll( programPatientAttributeService.getListPatientAttribute( program ) ); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2014-01-07 15:02:45 +0000 @@ -50,6 +50,7 @@ import org.hisp.dhis.program.ProgramIndicatorService; import org.hisp.dhis.program.ProgramInstance; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.relationship.Relationship; import org.hisp.dhis.relationship.RelationshipService; @@ -87,6 +88,9 @@ @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // Input && Output // ------------------------------------------------------------------------- @@ -251,7 +255,8 @@ for ( Program program : programs ) { - Collection identifierTypes = program.getPatientIdentifierTypes(); + Collection identifierTypes = programPatientIdentifierTypeService + .getListPatientIdentifierType( program ); for ( PatientIdentifier identifier : _identifiers ) { if ( !identifierTypes.contains( identifier.getIdentifierType() ) ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2014-01-07 15:02:45 +0000 @@ -48,6 +48,7 @@ import org.hisp.dhis.program.ProgramInstance; import org.hisp.dhis.program.ProgramInstanceService; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramStageInstance; import org.hisp.dhis.program.comparator.ProgramStageInstanceVisitDateComparator; import org.springframework.beans.factory.annotation.Autowired; @@ -71,6 +72,9 @@ @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -196,7 +200,8 @@ // Load identifier types of the selected program // --------------------------------------------------------------------- - identifierTypes = programInstance.getProgram().getPatientIdentifierTypes(); + identifierTypes = new ArrayList( + programPatientIdentifierTypeService.getListPatientIdentifierType( programInstance.getProgram() ) ); identiferMap = new HashMap(); if ( identifierTypes != null && identifierTypes.size() > 0 ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveIdentifierAndAttributeAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveIdentifierAndAttributeAction.java 2014-01-06 06:29:46 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveIdentifierAndAttributeAction.java 2014-01-07 15:02:45 +0000 @@ -48,7 +48,9 @@ import org.hisp.dhis.patientattributevalue.PatientAttributeValue; import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramService; +import org.springframework.beans.factory.annotation.Autowired; import com.opensymphony.xwork2.Action; @@ -76,6 +78,9 @@ private ProgramService programService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + private I18nFormat format; // ------------------------------------------------------------------------- @@ -181,7 +186,8 @@ String value = null; - Collection identifierTypes = program.getPatientIdentifierTypes(); + Collection identifierTypes = programPatientIdentifierTypeService + .getListPatientIdentifierType( program ); PatientIdentifier identifier = null; === 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-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java 2014-01-07 15:02:45 +0000 @@ -28,29 +28,28 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; import org.hisp.dhis.paging.ActionPagingSupport; import org.hisp.dhis.patient.Patient; -import org.hisp.dhis.patient.PatientAttribute; -import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.user.CurrentUserService; import org.hisp.dhis.user.User; import org.hisp.dhis.user.UserService; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - /** * @author Abyot Asalefew Gizaw */ @@ -82,6 +81,9 @@ @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // Input/output // ------------------------------------------------------------------------- @@ -181,20 +183,6 @@ this.programId = programId; } - private List identifierTypes = new ArrayList(); - - public List getIdentifierTypes() - { - return identifierTypes; - } - - private List attributes = new ArrayList(); - - public List getAttributes() - { - return attributes; - } - private OrganisationUnit organisationUnit; public OrganisationUnit getOrganisationUnit() @@ -209,6 +197,13 @@ return mapUsers; } + private Program program; + + public Program getProgram() + { + return program; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -283,10 +278,7 @@ if ( programId != null ) { - Program program = programService.getProgram( programId ); - identifierTypes = program.getPatientIdentifierTypes(); - attributes = new ArrayList( - programPatientAttributeService.getListPatientAttribute( program ) ); + program = programService.getProgram( programId ); } } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java 2014-01-07 15:02:45 +0000 @@ -50,6 +50,7 @@ import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.relationship.RelationshipType; import org.hisp.dhis.relationship.RelationshipTypeService; @@ -121,6 +122,9 @@ @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + private I18n i18n; public void setI18n( I18n i18n ) @@ -321,14 +325,15 @@ Collection programs = programService.getAllPrograms(); for ( Program p : programs ) { - identifierTypes.removeAll( p.getPatientIdentifierTypes() ); + identifierTypes.removeAll( programPatientIdentifierTypeService.getListPatientIdentifierType( p )); attributes.removeAll( programPatientAttributeService.getListPatientAttribute( p ) ); } } else { - identifierTypes = program.getPatientIdentifierTypes(); - attributes = new ArrayList( programPatientAttributeService.getListPatientAttribute( program ) ); + identifierTypes = programPatientIdentifierTypeService.getListPatientIdentifierType( program ); + attributes = new ArrayList( + programPatientAttributeService.getListPatientAttribute( program ) ); } for ( PatientAttribute attribute : attributes ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetAggregateReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetAggregateReportAction.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetAggregateReportAction.java 2014-01-07 15:02:45 +0000 @@ -51,6 +51,7 @@ import org.hisp.dhis.patientreport.PatientAggregateReportService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramStage; import org.springframework.beans.factory.annotation.Autowired; @@ -106,6 +107,9 @@ @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // Input && Output // ------------------------------------------------------------------------- @@ -265,7 +269,7 @@ { PatientIdentifierType it = patientIdentifierTypeService.getPatientIdentifierType( dimensionId ); - if ( it != null && program.getPatientIdentifierTypes().contains( it ) ) + if ( it != null && programPatientIdentifierTypeService.getListPatientIdentifierType( program ).contains( it ) ) { dimensionIdentifierTypes.add( it ); } @@ -302,7 +306,7 @@ PatientIdentifierType it = patientIdentifierTypeService.getPatientIdentifierType( filterId ); - if ( it != null && program.getPatientIdentifierTypes().contains( it ) ) + if ( it != null && programPatientIdentifierTypeService.getListPatientIdentifierType( program ).contains( it ) ) { filterIdentifierTypes.add( it ); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java 2014-01-07 15:02:45 +0000 @@ -50,6 +50,7 @@ import org.hisp.dhis.patientreport.PatientTabularReportService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramStage; import org.springframework.beans.factory.annotation.Autowired; @@ -105,6 +106,9 @@ @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // Input // ------------------------------------------------------------------------- @@ -244,7 +248,7 @@ { PatientIdentifierType it = patientIdentifierTypeService.getPatientIdentifierType( dimensionId ); - if ( it != null && program.getPatientIdentifierTypes().contains( it ) ) + if ( it != null && programPatientIdentifierTypeService.getListPatientIdentifierType( program ).contains( it ) ) { dimensionIdentifierTypes.add( it ); } @@ -281,7 +285,7 @@ PatientIdentifierType it = patientIdentifierTypeService.getPatientIdentifierType( filterId ); - if ( it != null && program.getPatientIdentifierTypes().contains( it ) ) + if ( it != null && programPatientIdentifierTypeService.getListPatientIdentifierType( program ).contains( it ) ) { filterIdentifierTypes.add( it ); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadDataElementsAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadDataElementsAction.java 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadDataElementsAction.java 2014-01-07 15:02:45 +0000 @@ -35,6 +35,7 @@ import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramPatientAttributeService; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramStage; import org.hisp.dhis.program.ProgramStageDataElement; import org.hisp.dhis.program.ProgramStageSection; @@ -73,6 +74,9 @@ @Autowired private ProgramPatientAttributeService programPatientAttributeService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // Input/output // ------------------------------------------------------------------------- @@ -137,7 +141,8 @@ if ( program != null && program.isRegistration() ) { - identifierTypes = new ArrayList( program.getPatientIdentifierTypes() ); + identifierTypes = new ArrayList( + programPatientIdentifierTypeService.getListPatientIdentifierType( program ) ); patientAttributes = new ArrayList( programPatientAttributeService.getListPatientAttribute( program ) ); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2014-01-07 15:02:45 +0000 @@ -201,10 +201,6 @@ - - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm 2014-01-07 15:02:45 +0000 @@ -18,15 +18,15 @@ $i18n.getString('orgunit') #if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) ) - #foreach( $identifierType in $identifierTypes) - #if($identifierType.personDisplayName=='true') - $encoder.htmlEncode($identifierType.displayName) + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) + #if($programIdentifierType.displayedInList=='true') + $encoder.htmlEncode($programIdentifierType.patientIdentifierType.displayName) #end #end - #foreach( $attribute in $attributes ) - #if($attribute.displayedInList=='true') - $encoder.htmlEncode($attribute.displayName) + #foreach( $programAttribute in $program.programPatientAttributes ) + #if($programAttribute.displayedInList=='true') + $encoder.htmlEncode($programAttribute.patientAttribute.displayName) #end #end #end @@ -63,12 +63,12 @@ #if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) ) - #foreach( $identifierType in $identifierTypes) + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) #set($value="") - #if($identifierType.personDisplayName=='true') + #if($programIdentifierType.displayedInList=='true') - #foreach( $identifier in $programStageInstance.programInstance.patient.identifiers) - #if($!identifier.identifierType.id==$identifierType.id) + #foreach( $identifier in $patient.identifiers) + #if($!identifier.identifierType.id==$programIdentifierType.patientIdentifierType.id) #set($value=$identifier.identifier) #end #end @@ -77,17 +77,17 @@ #end #end - #foreach( $attribute in $attributes ) - #if($attribute.displayedInList=='true') + #foreach( $programAttribute in $program.programPatientAttributes ) + #if($programAttribute.displayedInList=='true') - #foreach( $attributeValue in $programStageInstance.programInstance.patient.attributeValues) - #if($!attributeValue.patientAttribute.id==$attribute.id) + #foreach( $attributeValue in $patient.attributeValues) + #if($!attributeValue.patientAttribute.id==$programAttribute.patientAttribute.id) #set($value=$attributeValue.value) - #if( $attribute.valueType == 'bool') + #if( $programAttribute.patientAttribute.valueType == 'bool') #set($value=$i18n.getString($attributeValue.value)) #end #end - #end + #end $encoder.htmlEncode($value) #end === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm 2014-01-07 15:02:45 +0000 @@ -58,12 +58,12 @@ #if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) ) - #foreach( $identifierType in $identifierTypes) + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) #set($value="") - #if($identifierType.personDisplayName=='true') + #if($programIdentifierType.displayedInList=='true') #foreach( $identifier in $patient.identifiers) - #if($!identifier.identifierType.id==$identifierType.id) + #if($!identifier.identifierType.id==$programIdentifierType.patientIdentifierType.id) #set($value=$identifier.identifier) #end #end @@ -72,13 +72,13 @@ #end #end - #foreach( $attribute in $attributes ) - #if($attribute.displayedInList=='true') + #foreach( $programAttribute in $program.programPatientAttributes ) + #if($programAttribute.displayedInList=='true') #foreach( $attributeValue in $patient.attributeValues) - #if($!attributeValue.patientAttribute.id==$attribute.id) + #if($!attributeValue.patientAttribute.id==$programAttribute.patientAttribute.id) #set($value=$attributeValue.value) - #if( $attribute.valueType == 'bool') + #if( $programAttribute.patientAttribute.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/identifierAndAttributeForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/identifierAndAttributeForm.vm 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/identifierAndAttributeForm.vm 2014-01-07 15:02:45 +0000 @@ -1,6 +1,7 @@ -#foreach ($identifierType in $program.patientIdentifierTypes) +#foreach ($prorgamIdentifierType in $program.programIdentifierTypes) + #set( $identifierType = $prorgamIdentifierType.patientIdentifierType ) === 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-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm 2014-01-07 15:02:45 +0000 @@ -26,14 +26,18 @@ - #foreach( $identifierType in $identifierTypes) - #if($identifierType.personDisplayName=='true')#end - #end - - #foreach( $attribute in $attributes ) - #if($attribute.displayedInList=='true')#end - #end - + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) + #if($programIdentifierType.displayedInList=='true') + + #end + #end + + #foreach( $programAttribute in $program.programPatientAttributes ) + #if($programAttribute.displayedInList=='true') + + #end + #end + #if($mapPatientOrgunit.size()!=0) #end @@ -43,17 +47,18 @@ - #foreach( $identifierType in $identifierTypes) - #if($identifierType.personDisplayName=='true') - + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) + #if($programIdentifierType.displayedInList=='true') + + #end + #end + + #foreach( $programAttribute in $program.programPatientAttributes ) + #if($programAttribute.displayedInList=='true') + #end #end - #foreach( $attribute in $attributes ) - #if($attribute.displayedInList=='true') - - #end - #end #if($mapPatientOrgunit.size()!=0) @@ -72,12 +77,12 @@ $nr - #foreach( $identifierType in $identifierTypes) + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) #set($value="") - #if($identifierType.personDisplayName=='true') + #if($programIdentifierType.displayedInList=='true') @@ -200,9 +198,7 @@ #set($patient=$rel.patientB) #set($value="") #foreach( $identifier in $patient.identifiers) - #if($!identifier.identifierType.personDisplayName=='true') - #set($value=$identifier.identifier) - #end + #set($value=$identifier.identifier) #end $value @@ -213,9 +209,7 @@ === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm 2014-01-07 15:02:45 +0000 @@ -12,11 +12,8 @@
#$encoder.htmlEncode($identifierType.displayName)$encoder.htmlEncode($programIdentifierType.patientIdentifierType.displayName)$encoder.htmlEncode($programAttribute.patientAttribute.displayName)$encoder.htmlEncode($attribute.displayName)$i18n.getString( "hierachy_orgunit" ) #foreach( $identifier in $patient.identifiers) - #if($!identifier.identifierType.id==$identifierType.id) + #if($!identifier.identifierType.id==$programIdentifierType.patientIdentifierType.id) #set($value=$identifier.identifier) #end #end @@ -86,13 +91,13 @@ #end #end - #foreach( $attribute in $attributes ) - #if($attribute.displayedInList=='true') + #foreach( $programAttribute in $program.programPatientAttributes ) + #if($programAttribute.displayedInList=='true') #foreach( $attributeValue in $patient.attributeValues) - #if($!attributeValue.patientAttribute.id==$attribute.id) + #if($!attributeValue.patientAttribute.id==$programAttribute.patientAttribute.id) #set($value=$attributeValue.value) - #if( $attribute.valueType == 'bool') + #if( $programAttribute.patientAttribute.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/patientDashboard.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2014-01-07 15:02:45 +0000 @@ -43,9 +43,7 @@ #foreach( $identifier in $identifiers )
- #if($!identifier.identifierType.personDisplayName=='true') $!identifier.identifierType.displayName - #end $identifier.identifier
#set($patient=$!rel.patientA) #foreach( $identifier in $patient.identifiers) - #if($!identifier.identifierType.personDisplayName=='true') - #set($value=$identifier.identifier) - #end + #set($value=$identifier.identifier) #end $value
#foreach( $identifier in $patient.identifiers) - #if($!identifier.identifierType.personDisplayName=='true') - - - #end - + + #end
$identifier.identifierType.displayName:$identifier.identifier$identifier.identifierType.displayName:$identifier.identifier
=== 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-06 18:15:35 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2014-01-07 15:02:45 +0000 @@ -34,12 +34,16 @@ - #foreach( $identifierType in $identifierTypes) - #if($identifierType.personDisplayName=='true')#end + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) + #if($programIdentifierType.displayedInList=='true') + + #end #end - - #foreach( $attribute in $attributes ) - #if($attribute.displayedInList=='true')#end + + #foreach( $programAttribute in $program.programPatientAttributes ) + #if($programAttribute.displayedInList=='true') + + #end #end #if($mapPatientOrgunit.size()!=0) @@ -51,15 +55,15 @@ - #foreach( $identifierType in $identifierTypes) - #if($identifierType.personDisplayName=='true') - + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) + #if($programIdentifierType.displayedInList=='true') + #end #end - - #foreach( $attribute in $attributes ) - #if($attribute.displayedInList=='true') - + + #foreach( $programAttribute in $program.programPatientAttributes ) + #if($programAttribute.displayedInList=='true') + #end #end @@ -79,35 +83,33 @@ #set( $nr = ( ( $paging.getCurrentPage() - 1 ) * $paging.pageSize ) + $velocityCount ) $nr - - #foreach( $identifierType in $identifierTypes) - #set($id="") - #if($identifierType.personDisplayName=='true') + + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) + #set($value="") + #if($programIdentifierType.displayedInList=='true') #end #end - #foreach( $attribute in $attributes ) - #if($attribute.displayedInList=='true') + #foreach( $programAttribute in $program.programPatientAttributes ) + #if($programAttribute.displayedInList=='true') #end #end === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm 2014-01-07 15:02:45 +0000 @@ -13,23 +13,19 @@ #set($status = $programStageInstance.getEventStatus()) #if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
#$encoder.htmlEncode($identifierType.displayName)$encoder.htmlEncode($programIdentifierType.patientIdentifierType.displayName)$encoder.htmlEncode($attribute.displayName)$encoder.htmlEncode($programAttribute.patientAttribute.displayName) #foreach( $identifier in $patient.identifiers) - #if($!identifier.identifierType.id==$identifierType.id) - #set($id=$identifier.identifier) + #if($!identifier.identifierType.id==$programIdentifierType.patientIdentifierType.id) + #set($value=$identifier.identifier) #end #end - $encoder.htmlEncode($id) + $encoder.htmlEncode($value) #foreach( $attributeValue in $patient.attributeValues) - #if($!attributeValue.patientAttribute.id==$attribute.id) + #if($!attributeValue.patientAttribute.id==$programAttribute.patientAttribute.id) #set($value=$attributeValue.value) - #if( $attribute.valueType == 'bool') + #if( $programAttribute.patientAttribute.valueType == 'bool') #set($value=$i18n.getString($attributeValue.value)) - #elseif( $attribute.valueType == 'users') - #set($value=$mapUsers.get($attributeValue.value)) #end #end #end - $!encoder.htmlEncode($value) + $encoder.htmlEncode($value)
- #foreach( $identifierType in $programStageInstance.programInstance.program.patientIdentifierTypes) + #foreach( $programIdentifierType in $programInstance.program.programPatientIdentifierTypes) - #if($identifierType.personDisplayName=='true') - - #foreach( $identifierType in $identifierTypes) + + #foreach( $identifierType in $identifierTypes) #set($id="") - #if($identifierType.personDisplayName=='true') - - #end - #end + #end #end === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingRecords.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingRecords.vm 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingRecords.vm 2014-01-07 15:02:45 +0000 @@ -22,15 +22,15 @@ - #foreach( $identifierType in $identifierTypes) - #if($identifierType.personDisplayName=='true') - + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) + #if($programIdentifierType.displayedInList=='true') + #end #end - - #foreach( $attribute in $attributes ) - #if($attribute.displayedInList=='true') - + + #foreach( $programAttribute in $program.programPatientAttributes ) + #if($programAttribute.displayedInList=='true') + #end #end @@ -56,12 +56,12 @@ #end - #foreach( $identifierType in $identifierTypes) + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) #set($id="") - #if($identifierType.personDisplayName=='true') + #if($programIdentifierType.displayedInList=='true') === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm 2014-01-07 15:02:45 +0000 @@ -37,12 +37,10 @@ - - - - #end + + + + #end === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm 2014-01-07 15:02:45 +0000 @@ -24,16 +24,13 @@ === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2014-01-07 15:02:45 +0000 @@ -1,9 +1,7 @@ - #foreach( $identifier in $program.patientIdentifierTypes ) + #foreach( $programIdentifier in $program.programPatientIdentifierTypes ) + #set($identifier = $programIdentifier.patientIdentifierType) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramPatientReminder.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramPatientReminder.vm 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramPatientReminder.vm 2014-01-07 15:02:45 +0000 @@ -150,7 +150,7 @@ - #foreach($identifierType in $program.patientIdentifierTypes) + #foreach($identifierType in $identifierTypes) #end #foreach($attribute in $attributes) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2014-01-07 08:22:52 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2014-01-07 15:02:45 +0000 @@ -321,7 +321,8 @@ - #foreach($identifierType in $program.patientIdentifierTypes) + #foreach($programPatientIdentifierType in $program.programPatientIdentifierTypes) + #set($identifierType = $programPatientIdentifierType.patientIdentifierType) #end #foreach($programPatientAttribute in $program.programPatientAttributes) @@ -394,7 +395,8 @@ var i18n_both = '$encoder.jsEscape( $i18n.getString( "both" ) , "'")'; var idenAttrOptions = ""; - #foreach($identifierType in $programStage.program.patientIdentifierTypes) + #foreach($programPatientIdentifierType in $programStage.program.programPatientIdentifierTypes) + #set($identifierType = $programPatientIdentifierType.patientIdentifierType) idenAttrOptions+=""; #end #foreach($programPatientAttribute in $programStage.program.programPatientAttributes) === modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/SearchPatientAction.java' --- dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/SearchPatientAction.java 2013-10-14 16:17:44 +0000 +++ dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/SearchPatientAction.java 2014-01-07 15:02:45 +0000 @@ -36,6 +36,7 @@ import org.hisp.dhis.patient.PatientService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramInstance; +import org.hisp.dhis.program.ProgramPatientIdentifierTypeService; import org.hisp.dhis.program.ProgramService; import org.springframework.beans.factory.annotation.Autowired; @@ -62,6 +63,9 @@ @Autowired private ProgramService programService; + @Autowired + private ProgramPatientIdentifierTypeService programPatientIdentifierTypeService; + // ------------------------------------------------------------------------- // Input/output // ------------------------------------------------------------------------- @@ -135,7 +139,7 @@ { OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit(); Collection orgunits = new HashSet(); - + // List all patients if ( listAll ) { @@ -150,15 +154,15 @@ else if ( searchTexts.size() > 0 ) { organisationUnit = (searchBySelectedOrgunit) ? organisationUnit : null; - if( organisationUnit != null ) + if ( organisationUnit != null ) { orgunits.add( organisationUnit ); } total = patientService.countSearchPatients( searchTexts, orgunits, null, ProgramInstance.STATUS_ACTIVE ); this.paging = createPaging( total ); - patients = patientService.searchPatients( searchTexts, orgunits, null, null, null, ProgramInstance.STATUS_ACTIVE, paging.getStartPos(), paging - .getPageSize() ); + patients = patientService.searchPatients( searchTexts, orgunits, null, null, null, + ProgramInstance.STATUS_ACTIVE, paging.getStartPos(), paging.getPageSize() ); if ( !searchBySelectedOrgunit ) { @@ -173,7 +177,8 @@ for ( Integer programId : programIds ) { Program program = programService.getProgram( programId ); - identifierTypes.addAll( program.getPatientIdentifierTypes() ); + identifierTypes + .addAll( programPatientIdentifierTypeService.getListPatientIdentifierType( program ) ); } } }
$encoder.htmlEncode($identifierType.displayName)$encoder.htmlEncode($identifierType.displayName) - #foreach( $identifier in $patient.identifiers) - #if($!identifier.identifierType.id==$identifierType.id) - #set($id=$identifier.identifier) - #end - #end - $encoder.htmlEncode($id) - + #foreach( $identifier in $patient.identifiers) + #if($!identifier.identifierType.id==$identifierType.id) + #set($id=$identifier.identifier) + #end + #end + $encoder.htmlEncode($id) +
$i18n.getString('risk')$encoder.htmlEncode($identifierType.displayName)$encoder.htmlEncode($programIdentifierType.patientIdentifierType.displayName)$encoder.htmlEncode($attribute.displayName)$encoder.htmlEncode($programAttribute.patientAttribute.displayName)$i18n.getString( "events" ) #foreach( $identifier in $patient.identifiers) - #if($!identifier.identifierType.id==$identifierType.id) + #if($!identifier.identifierType.id==$programIdentifierType.patientIdentifierType.id) $identifier.identifier #end #end @@ -70,13 +70,13 @@ #end #end - #foreach( $attribute in $attributes ) - #if($attribute.displayedInList=='true') + #foreach( $programAttribute in $program.programPatientAttributes ) + #if($programAttribute.displayedInList=='true') #foreach( $attributeValue in $patient.attributeValues) - #if($!attributeValue.patientAttribute.id==$attribute.id) + #if($!attributeValue.patientAttribute.id==$programAttribute.patientAttribute.id) #set($value=$attributeValue.value) - #if( $attribute.valueType == 'bool') + #if( $programAttribute.patientAttribute.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/records.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/records.vm 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/records.vm 2014-01-07 15:02:45 +0000 @@ -1,24 +1,20 @@ #foreach( $identifier in $patient.identifiers) - #if($!identifier.identifierType.personDisplayName=='true') - - - - - #end + + + + #end #foreach( $attributeValue in $patient.attributeValues) - #if($!attributeValue.patientAttribute.displayedInList=='true') - #set($value=$attributeValue.value) - #if( $attribute.valueType == 'bool') - #set($value=$i18n.getString($attributeValue.value)) - #end - - - - + #set($value=$attributeValue.value) + #if( $attribute.valueType == 'bool') + #set($value=$i18n.getString($attributeValue.value)) #end + + + + #end
$!identifier.identifierType.displayName:$!identifier.identifier
$!identifier.identifierType.displayName:$!identifier.identifier
$!attributeValue.patientAttribute.displayName:$!attributeValue.value
$!attributeValue.patientAttribute.displayName:$!attributeValue.value
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm 2014-01-07 15:02:45 +0000 @@ -14,25 +14,21 @@
#foreach( $identifier in $patient.identifiers) - #if($!identifier.identifierType.personDisplayName=='true') - - - - - #end + + + + #end #foreach( $attributeValue in $patient.attributeValues) - #if($!attributeValue.patientAttribute.displayedInList=='true') - #set($value=$attributeValue.value) - #if( $attribute.valueType == 'bool') - #set($value=$i18n.getString($attributeValue.value)) - #end - - - - + #set($value=$attributeValue.value) + #if( $attribute.valueType == 'bool') + #set($value=$i18n.getString($attributeValue.value)) #end + + + + #end
$!identifier.identifierType.displayName:$!identifier.identifier
$!identifier.identifierType.displayName:$!identifier.identifier
$!attributeValue.patientAttribute.displayName:$!attributeValue.value
$!attributeValue.patientAttribute.displayName:$!attributeValue.value
#foreach( $identifier in $patient.identifiers) - #if($!identifier.identifierType.personDisplayName=='true') -
$!identifier.identifierType.displayName:$!identifier.identifier
$!identifier.identifierType.displayName:$!identifier.identifier
#set( $value="") - #if($program.patientIdentifierTypes) - #foreach( $identifierType in $program.patientIdentifierTypes ) - #foreach( $pIdentifier in $programInstance.patient.identifiers ) - #if($identifierType.personDisplayName=="true" && $identifierType.id==$pIdentifier.identifierType.id) - #set( $value= $value + $pIdentifier.identifier + ' ' ) - #end + #foreach( $programIdentifierType in $program.programPatientIdentifierTypes) + #foreach( $identifier in $patient.identifiers) + #if($!identifier.identifierType.id==$programIdentifierType.patientIdentifierType.id) + #set( $value= $value + $pIdentifier.identifier + ' ' ) #end - #end + #end #end -