=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/resources/org/hisp/dhis/mobile/PatientMobileSetting.hbm.xml' --- dhis-2/dhis-services/dhis-service-mobile/src/main/resources/org/hisp/dhis/mobile/PatientMobileSetting.hbm.xml 2012-08-22 07:08:08 +0000 +++ dhis-2/dhis-services/dhis-service-mobile/src/main/resources/org/hisp/dhis/mobile/PatientMobileSetting.hbm.xml 2013-12-17 03:31:30 +0000 @@ -9,15 +9,7 @@ - - - - - - - - - + === 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 2013-12-16 04:45:10 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2013-12-17 03:31:30 +0000 @@ -278,11 +278,11 @@ executeSql( "ALTER TABLE patientaggregatereport DROP COLUMN facilityLB" ); executeSql( "update programstage_dataelements set allowDateInFuture=false where allowDateInFuture is null" ); executeSql( "update programstage set autoGenerateEvent=true where programid in ( select programid from program where type=2 )" ); - executeSql( "alter table patient alter column organisationunitid set not null" ); + executeSql( "alter table patient alter column organisationunitid set not null" ); executeSql( "ALTER TABLE patientdatavalue ALTER COLUMN timestamp TYPE timestamp" ); executeSql( "ALTER TABLE programstageinstance ALTER COLUMN executiondate TYPE timestamp" ); - + updateCoordinatesProgramStageInstance(); addPatientAttributes(); @@ -454,169 +454,190 @@ private void addPatientAttributes() { - int max = jdbcTemplate.queryForInt( "select max(patientattributeid) from patientattribute" ); - - // --------------------------------------------------------------------- - // Gender - // --------------------------------------------------------------------- - - max++; - executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" - + max - + ",'" - + CodeGenerator.generateCode() - + "','" - + DateUtils.getMediumDateString() - + "','Gender', 'Gender','" + PatientAttribute.TYPE_COMBO + "', false, false, false)" ); - - int maxOpt = jdbcTemplate.queryForInt( "select max(patientattributeoptionid) from patientattributeoption" ); - maxOpt++; - executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" - + maxOpt + "', 'F'," + max + ")" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," - + max + ",'F'," + maxOpt + " from patient where gender='F'" ); - - maxOpt++; - executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" - + maxOpt + "', 'M'," + max + ")" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," - + max + ",'M'," + maxOpt + " from patient where gender='M'" ); - - maxOpt++; - executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" - + maxOpt + "', 'T'," + max + ")" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," - + max + ",'T'," + maxOpt + " from patient where gender='T'" ); - - // Update Case Aggregate Query Builder - String source = "[CP" + CaseAggregationCondition.SEPARATOR_OBJECT + "gender]"; - String target = "[" + CaseAggregationCondition.OBJECT_PATIENT_ATTRIBUTE - + CaseAggregationCondition.SEPARATOR_OBJECT + max + "]"; - updateFixedAttributeInCaseAggregate( source, target ); - - // --------------------------------------------------------------------- - // Death date - // --------------------------------------------------------------------- - max++; - executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" - + max - + ",'" - + CodeGenerator.generateCode() - + "','" - + DateUtils.getMediumDateString() - + "','Death date', 'Death date','" + PatientAttribute.TYPE_DATE + "', false, false, false)" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + max - + ",deathDate from patient where deathDate is not null" ); - - // --------------------------------------------------------------------- - // registrationDate - // --------------------------------------------------------------------- - max++; - executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" - + max - + ",'" - + CodeGenerator.generateCode() - + "','" - + DateUtils.getMediumDateString() - + "','Registration date', 'Registration date','" + PatientAttribute.TYPE_DATE + "', false, false, false)" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + max - + ",registrationDate from patient where registrationDate is not null" ); - - // --------------------------------------------------------------------- - // isDead - // --------------------------------------------------------------------- - max++; - executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" - + max - + ",'" - + CodeGenerator.generateCode() - + "','" - + DateUtils.getMediumDateString() - + "','Is Dead', 'Is Dead','" + PatientAttribute.TYPE_TRUE_ONLY + "', false, false, false)" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + max - + ",isDead from patient where isDead is not null" ); - - // --------------------------------------------------------------------- - // underAge - // --------------------------------------------------------------------- - - max++; - executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, description, name, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" - + max - + ",'" - + CodeGenerator.generateCode() - + "','" - + DateUtils.getMediumDateString() - + "','Is under age', 'Is under age','" + PatientAttribute.TYPE_TRUE_ONLY + "', false, false, false)" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + max - + ",isDead from patient where underAge=true" ); - - // --------------------------------------------------------------------- - // DobType - // --------------------------------------------------------------------- - - max++; - executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, description, name, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" - + max - + ",'" - + CodeGenerator.generateCode() - + "','" - + DateUtils.getMediumDateString() - + "','DOB type', 'DOB type','" + PatientAttribute.TYPE_COMBO + "', false, false, false)" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + max - + ",dobType from patient where dobType is not null" ); - - maxOpt++; - executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" - + maxOpt + "', 'A'," + max + ")" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," - + max + ",'A'," + maxOpt + " from patient where dobType='A'" ); - - maxOpt++; - executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" - + maxOpt + "', 'D'," + max + ")" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," - + max + ",'D'," + maxOpt + " from patient where dobType='D'" ); - - maxOpt++; - executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" - + maxOpt + "', 'V'," + max + ")" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," - + max + ",'V'," + maxOpt + " from patient where dobType='V'" ); - - // Update Case Aggregate Query Builder - source = "[CP" + CaseAggregationCondition.SEPARATOR_OBJECT + "dobType]"; - target = "[" + CaseAggregationCondition.OBJECT_PATIENT_ATTRIBUTE + CaseAggregationCondition.SEPARATOR_OBJECT - + max + "]"; - updateFixedAttributeInCaseAggregate( source, target ); - - // --------------------------------------------------------------------- - // Birthdate - // --------------------------------------------------------------------- - - max++; - executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" - + max - + ",'" - + CodeGenerator.generateCode() - + "','" - + DateUtils.getMediumDateString() - + "','Birth date', 'Birth date','" + PatientAttribute.TYPE_DATE + "', false, false, false)" ); - executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + max - + ",birthdate from patient where birthdate is not null" ); - - // Update Case Aggregate Query Builder - source = "[CP" + CaseAggregationCondition.SEPARATOR_OBJECT + "age]"; - target = "[" + CaseAggregationCondition.OBJECT_PATIENT_ATTRIBUTE + CaseAggregationCondition.SEPARATOR_OBJECT - + max + ".age]"; - updateFixedAttributeInCaseAggregate( source, target ); - - executeSql( "ALTER TABLE patient DROP COLUMN deathDate" ); - executeSql( "ALTER TABLE patient DROP COLUMN registrationDate" ); - executeSql( "ALTER TABLE patient DROP COLUMN isDead" ); - executeSql( "ALTER TABLE patient DROP COLUMN underAge" ); - executeSql( "ALTER TABLE patient DROP COLUMN dobType" ); - executeSql( "ALTER TABLE patient DROP COLUMN birthdate" ); + StatementHolder holder = statementManager.getHolder(); + + try + { + Statement statement = holder.getStatement(); + + ResultSet resultSet = statement.executeQuery( "SELECT gender1 FROM patient" ); + + if ( resultSet.next() ) + {System.out.println("\n\n 1"); + + int max = jdbcTemplate.queryForInt( "select max(patientattributeid) from patientattribute" ); + + // --------------------------------------------------------------------- + // Gender + // --------------------------------------------------------------------- + + max++; + executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" + + max + + ",'" + + CodeGenerator.generateCode() + + "','" + + DateUtils.getMediumDateString() + + "','Gender', 'Gender','" + PatientAttribute.TYPE_COMBO + "', false, false, false)" ); + + int maxOpt = jdbcTemplate + .queryForInt( "select max(patientattributeoptionid) from patientattributeoption" ); + maxOpt++; + executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" + + maxOpt + "', 'F'," + max + ")" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," + + max + ",'F'," + maxOpt + " from patient where gender='F'" ); + + maxOpt++; + executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" + + maxOpt + "', 'M'," + max + ")" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," + + max + ",'M'," + maxOpt + " from patient where gender='M'" ); + + maxOpt++; + executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" + + maxOpt + "', 'T'," + max + ")" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," + + max + ",'T'," + maxOpt + " from patient where gender='T'" ); + + // Update Case Aggregate Query Builder + String source = "[CP" + CaseAggregationCondition.SEPARATOR_OBJECT + "gender]"; + String target = "[" + CaseAggregationCondition.OBJECT_PATIENT_ATTRIBUTE + + CaseAggregationCondition.SEPARATOR_OBJECT + max + "]"; + updateFixedAttributeInCaseAggregate( source, target ); + + // --------------------------------------------------------------------- + // Death date + // --------------------------------------------------------------------- + max++; + executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" + + max + + ",'" + + CodeGenerator.generateCode() + + "','" + + DateUtils.getMediumDateString() + + "','Death date', 'Death date','" + PatientAttribute.TYPE_DATE + "', false, false, false)" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + + max + ",deathDate from patient where deathDate is not null" ); + + // --------------------------------------------------------------------- + // registrationDate + // --------------------------------------------------------------------- + max++; + executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" + + max + + ",'" + + CodeGenerator.generateCode() + + "','" + + DateUtils.getMediumDateString() + + "','Registration date', 'Registration date','" + + PatientAttribute.TYPE_DATE + + "', false, false, false)" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + + max + ",registrationDate from patient where registrationDate is not null" ); + + // --------------------------------------------------------------------- + // isDead + // --------------------------------------------------------------------- + max++; + executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" + + max + + ",'" + + CodeGenerator.generateCode() + + "','" + + DateUtils.getMediumDateString() + + "','Is Dead', 'Is Dead','" + PatientAttribute.TYPE_TRUE_ONLY + "', false, false, false)" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + + max + ",isDead from patient where isDead is not null" ); + + // --------------------------------------------------------------------- + // underAge + // --------------------------------------------------------------------- + + max++; + executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, description, name, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" + + max + + ",'" + + CodeGenerator.generateCode() + + "','" + + DateUtils.getMediumDateString() + + "','Is under age', 'Is under age','" + + PatientAttribute.TYPE_TRUE_ONLY + + "', false, false, false)" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + + max + ",isDead from patient where underAge=true" ); + + // --------------------------------------------------------------------- + // DobType + // --------------------------------------------------------------------- + + max++; + executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, description, name, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" + + max + + ",'" + + CodeGenerator.generateCode() + + "','" + + DateUtils.getMediumDateString() + + "','DOB type', 'DOB type','" + PatientAttribute.TYPE_COMBO + "', false, false, false)" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + + max + ",dobType from patient where dobType is not null" ); + + maxOpt++; + executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" + + maxOpt + "', 'A'," + max + ")" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," + + max + ",'A'," + maxOpt + " from patient where dobType='A'" ); + + maxOpt++; + executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" + + maxOpt + "', 'D'," + max + ")" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," + + max + ",'D'," + maxOpt + " from patient where dobType='D'" ); + + maxOpt++; + executeSql( "INSERT INTO patientattributeoption (patientattributeoptionid, name, patientattributeid ) VALUES ('" + + maxOpt + "', 'V'," + max + ")" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value, patientattributeoptionid ) SELECT patientid," + + max + ",'V'," + maxOpt + " from patient where dobType='V'" ); + + // Update Case Aggregate Query Builder + source = "[CP" + CaseAggregationCondition.SEPARATOR_OBJECT + "dobType]"; + target = "[" + CaseAggregationCondition.OBJECT_PATIENT_ATTRIBUTE + + CaseAggregationCondition.SEPARATOR_OBJECT + max + "]"; + updateFixedAttributeInCaseAggregate( source, target ); + + // --------------------------------------------------------------------- + // Birthdate + // --------------------------------------------------------------------- + + max++; + executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" + + max + + ",'" + + CodeGenerator.generateCode() + + "','" + + DateUtils.getMediumDateString() + + "','Birth date', 'Birth date','" + PatientAttribute.TYPE_DATE + "', false, false, false)" ); + executeSql( "INSERT INTO patientattributevalue (patientid, patientattributeid, value ) SELECT patientid," + + max + ",birthdate from patient where birthdate is not null" ); + + // Update Case Aggregate Query Builder + source = "[CP" + CaseAggregationCondition.SEPARATOR_OBJECT + "age]"; + target = "[" + CaseAggregationCondition.OBJECT_PATIENT_ATTRIBUTE + + CaseAggregationCondition.SEPARATOR_OBJECT + max + ".age]"; + updateFixedAttributeInCaseAggregate( source, target ); + + executeSql( "ALTER TABLE patient DROP COLUMN deathDate" ); + executeSql( "ALTER TABLE patient DROP COLUMN registrationDate" ); + executeSql( "ALTER TABLE patient DROP COLUMN isDead" ); + executeSql( "ALTER TABLE patient DROP COLUMN underAge" ); + executeSql( "ALTER TABLE patient DROP COLUMN dobType" ); + executeSql( "ALTER TABLE patient DROP COLUMN birthdate" ); + } + } + catch ( Exception ex ) + { + } } private void updateFixedAttributeInCaseAggregate( String source, String target ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2013-12-17 01:29:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2013-12-17 03:31:30 +0000 @@ -76,7 +76,6 @@ var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") '; var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") '; var i18n_current_date = '$encoder.jsEscape( $i18n.getString( "current_date" ) , "'") '; - var i18n_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ) , "'") '; var i18n_incident_date = '$encoder.jsEscape( $i18n.getString( "incident_date" ) , "'") '; var i18n_enrollment_date = '$encoder.jsEscape( $i18n.getString( "enrollment_date" ) , "'") '; var isSubmit = true; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm 2013-07-30 08:48:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm 2013-12-17 03:31:30 +0000 @@ -78,10 +78,6 @@ - - - - - $i18n.getString("default_value") - - - - $i18n.getString("is_hidden") + + @@ -251,16 +226,12 @@ var i18n_property_is_inserted = '$encoder.jsEscape( $i18n.getString( "property_is_inserted" ) , "'" )'; var i18n_please_insert_all_required_fields = '$encoder.jsEscape( $i18n.getString( "please_insert_all_required_fields" ) , "'" )'; var i18n_required_fields_valivation = '$encoder.jsEscape( $i18n.getString( "required_fields_valivation" ) , "'" )'; - var i18n_registration_date = '$encoder.jsEscape( $i18n.getString( "registration_date" ) , "'" )'; var i18n_full_name = '$encoder.jsEscape( $i18n.getString( "full_name" ) , "'" )'; - var i18n_gender = '$encoder.jsEscape( $i18n.getString( "gender" ) , "'" )'; - var i18n_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ) , "'" )'; var i18n_properties = '$encoder.jsEscape( $i18n.getString( "properties" ) , "'" )'; var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patient_registration_form" ) , "'" )'; var i18n_save_unsuccess_please_insert_all_required_fields = '$encoder.jsEscape( $i18n.getString( "save_unsuccess" ) , "'" )' + '. ' + '$encoder.jsEscape( $i18n.getString( "please_insert_all_required_fields" ) , "'" )'; var i18n_validate_success = '$encoder.jsEscape( $i18n.getString( "validate_success" ) , "'" )'; var i18n_name_exists = '$encoder.jsEscape( $i18n.getString( "name_exists" ) , "'" )'; - var i18n_dob_type = '$encoder.jsEscape( $i18n.getString( "dob_type" ) , "'" )'; jQuery(document).ready( function(){ openPropertiesSelector(); });