=== 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-02-13 03:57:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java 2013-07-02 15:18:36 +0000 @@ -51,6 +51,8 @@ public static final String VALUE_TYPE_NUMBER = "number"; public static final String VALUE_TYPE_LETTER = "letter"; + + public static final String VALUE_TYPE_ORGUNIT_COUNT = "orgunitCount"; private String description; === 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 2013-04-26 15:24:15 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java 2013-07-02 15:18:36 +0000 @@ -47,6 +47,7 @@ import org.hisp.dhis.patient.PatientIdentifierTypeService; import org.hisp.dhis.patient.PatientRegistrationForm; import org.hisp.dhis.patient.PatientRegistrationFormService; +import org.hisp.dhis.patient.PatientService; import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramService; @@ -107,6 +108,13 @@ this.attributeGroupService = attributeGroupService; } + private PatientService patientService; + + public void setPatientService( PatientService patientService ) + { + this.patientService = patientService; + } + private I18n i18n; public void setI18n( I18n i18n ) @@ -188,6 +196,13 @@ return attributeGroups; } + private String orgunitCountIdentifier; + + public String getOrgunitCountIdentifier() + { + return orgunitCountIdentifier; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -227,8 +242,8 @@ Collection patientAttributesInProgram = new HashSet(); Collection programs = programService.getAllPrograms(); - programs.remove(program); - + programs.remove( program ); + for ( Program _program : programs ) { identifierTypes.removeAll( _program.getPatientIdentifierTypes() ); @@ -253,6 +268,32 @@ noGroupAttributes.removeAll( patientAttributesInProgram ); } + orgunitCountIdentifier = generateOrgunitIdentifier( organisationUnit ); + return SUCCESS; } + + private String generateOrgunitIdentifier( OrganisationUnit organisationUnit ) + { + String value = organisationUnit.getCode(); + + int totalPatient = patientService.countGetPatientsByOrgUnit( organisationUnit ); + if ( totalPatient < 10 ) + { + value += "000" + totalPatient; + } + else if ( totalPatient < 100 ) + { + value += "00" + totalPatient; + } + else if ( totalPatient < 1000 ) + { + value += "0" + totalPatient; + } + else + { + value += totalPatient; + } + return value; + } } === 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 2013-07-02 14:26:44 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-07-02 15:18:36 +0000 @@ -519,6 +519,7 @@ + === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2013-07-02 03:54:01 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2013-07-02 15:18:36 +0000 @@ -132,9 +132,15 @@ #else #set( $identifier = '' ) #set( $identifier = $identiferMap.get( $identifierType.id ) ) + #if($identifierType.type=='orgunitCount' && $!orgunitCountIdentifier) + #set( $identifier = $!orgunitCountIdentifier ) + #end + - + + + #end #end === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-07-02 14:26:44 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-07-02 15:18:36 +0000 @@ -421,4 +421,5 @@ complete_event = Complete event send_to = Send to complete_program = Complete program -from_the_day_set = From the day set \ No newline at end of file +from_the_day_set = From the day set +orgunit_count = Organisation unit count \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm 2013-02-28 07:12:57 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm 2013-07-02 15:18:36 +0000 @@ -54,6 +54,7 @@ + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientIdentifierType.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientIdentifierType.js 2012-09-17 06:40:26 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientIdentifierType.js 2013-07-02 15:18:36 +0000 @@ -17,7 +17,7 @@ setInnerHTML( 'relatedField', boolValueMap[boolType] ); setInnerHTML( 'noCharsField', json.patientIdentifierType.noChars ); - var valueTypeMap = { 'text':i18n_string, 'number':i18n_number, 'letter':i18n_letter_only }; + var valueTypeMap = { 'text':i18n_string, 'number':i18n_number, 'letter':i18n_letter_only, 'orgunitCount': i18n_orgunit_count }; var valueType = json.patientIdentifierType.type; setInnerHTML( 'typeField', valueTypeMap[valueType] ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientIdentifierType.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientIdentifierType.vm 2013-06-29 14:16:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientIdentifierType.vm 2013-07-02 15:18:36 +0000 @@ -63,4 +63,5 @@ var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ), "'")'; var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ), "'")'; var i18n_all = '$encoder.jsEscape( $i18n.getString( "all" ), "'")'; + var i18n_orgunit_count = '$encoder.jsEscape( $i18n.getString( "orgunit_count" ) , "'")'; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-06-29 14:16:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-07-02 15:18:36 +0000 @@ -3,9 +3,9 @@

$i18n.getString( "program_management" ) #openHelp( "program" )

- - - + + +
@@ -113,5 +113,4 @@ var i18n_multiple_events_with_registration = '$encoder.jsEscape( $i18n.getString( "multiple_events_with_registration" ) , "'")'; var i18n_single_event_with_registration = '$encoder.jsEscape( $i18n.getString( "single_event_with_registration" ) , "'")'; var i18n_single_event_without_registration = '$encoder.jsEscape( $i18n.getString( "single_event_without_registration" ) , "'")'; - === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm 2013-02-28 07:12:57 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm 2013-07-02 15:18:36 +0000 @@ -55,6 +55,7 @@ +