=== 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 2012-05-29 15:37:40 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-05-29 19:37:01 +0000 @@ -35,8 +35,6 @@ import org.amplecode.quick.StatementManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.hisp.dhis.patient.PatientAttribute; -import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.system.startup.AbstractStartupRoutine; import org.springframework.transaction.annotation.Transactional; @@ -63,13 +61,6 @@ this.statementManager = statementManager; } - private PatientAttributeService patientAttributeService; - - public void setPatientAttributeService( PatientAttributeService patientAttributeService ) - { - this.patientAttributeService = patientAttributeService; - } - // ------------------------------------------------------------------------- // Action Implementation // ------------------------------------------------------------------------- @@ -106,9 +97,8 @@ executeSql( "ALTER TABLE patientattribute DROP COLUMN noChars" ); executeSql( "ALTER TABLE programstageinstance ALTER executiondate TYPE date" ); - createPatientAttribute(); executeSql( "ALTER TABLE patientidentifier ALTER COLUMN patientid DROP NOT NULL" ); - //executeSql( "ALTER TABLE patientmobilesetting DROP COLUMN bloodGroup" ); + executeSql( "ALTER TABLE patient DROP COLUMN bloodgroup" ); } // ------------------------------------------------------------------------- @@ -147,47 +137,6 @@ } } - private void createPatientAttribute() - { - PatientAttribute patientAttribute = patientAttributeService.getPatientAttributeByName( "Blood group" ); - if( patientAttribute == null ) - { - patientAttribute = new PatientAttribute(); - patientAttribute.setName( "Blood group" ); - patientAttribute.setDescription( "Blood group" ); - patientAttribute.setValueType( PatientAttribute.TYPE_STRING ); - patientAttribute.setMandatory( false ); - patientAttribute.setInheritable( false ); - patientAttribute.setGroupBy( false ); - int patientAttributeId = patientAttributeService.savePatientAttribute( patientAttribute ); - - StatementHolder holder = statementManager.getHolder(); - - try - { - Statement statement = holder.getStatement(); - - ResultSet resultSet = statement.executeQuery( "SELECT patientid, bloodgroup FROM patient where bloodgroup is not null and bloodgroup != '' " ); - - while ( resultSet.next() ) - { - executeSql( "INSERT INTO patientattributevalue(patientid, patientattributeid, value) VALUES ( " + - resultSet.getInt( 1 )+ "," + patientAttributeId + ",'" + resultSet.getString( 2 ) + "' )" ); - } - - executeSql( "ALTER TABLE patient DROP COLUMN bloodgroup" ); - } - catch ( Exception ex ) - { - log.error( ex ); - } - finally - { - holder.close(); - } - } - } - private int executeSql( String sql ) { try === 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 2012-05-29 15:37:40 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2012-05-29 19:37:01 +0000 @@ -364,7 +364,6 @@ -